]> Repositorios git - scryer-prolog.git/commitdiff
Prevent assertion of clauses for (-->)/2 when DCGs are enabled.
authorMarkus Triska <[email protected]>
Fri, 5 Jan 2024 17:50:08 +0000 (18:50 +0100)
committerMarkus Triska <[email protected]>
Fri, 5 Jan 2024 18:04:53 +0000 (19:04 +0100)
This addresses #1508.

src/lib/dcgs.pl

index 550009bb85b6217f9e7874c6c3b6f9c9ff339dc9..ef2e8253308c97f64653a574b3b9819a286a5d25 100644 (file)
@@ -14,7 +14,8 @@ to learn more about them.
            phrase/3,
            seq//1,
            seqq//1,
-           ... //0
+           ... //0,
+           (-->)/2
           ]).
 
 :- use_module(library(error)).
@@ -220,3 +221,10 @@ user:goal_expansion(phrase(GRBody, S, S0), GRBody2) :-
     ).
 
 user:goal_expansion(phrase(GRBody, S), phrase(GRBody, S, [])).
+
+
+% (-->)/2 behaves as if it didn't exist. We export (and define) it
+% only so that clauses for (-->)/2 cannot be asserted when
+% library(dcgs) is loaded.
+
+(_-->_) :- throw(error(existence_error(procedure,(-->)/2),(-->)/2)).