Skip to content

Commit

Permalink
Merge pull request mthom#2275 from triska/master
Browse files Browse the repository at this point in the history
Prevent assertion of clauses for (-->)/2 when DCGs are enabled.
  • Loading branch information
mthom authored Jan 5, 2024
2 parents d51defe + f2b63d1 commit ed92e1b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/lib/dcgs.pl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
phrase/3,
seq//1,
seqq//1,
... //0
... //0,
(-->)/2
]).

:- use_module(library(error)).
Expand Down Expand Up @@ -220,3 +221,10 @@
).

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)).

0 comments on commit ed92e1b

Please sign in to comment.