From: Mark Thom Date: Sun, 12 Apr 2020 03:52:45 +0000 (-0600) Subject: do not accept [X|Xs] patterns as DCG non-terminals (#286) X-Git-Tag: v0.8.119~19 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=92d86421332b7d1fed92e748f887103599f7ca8b;p=scryer-prolog.git do not accept [X|Xs] patterns as DCG non-terminals (#286) --- diff --git a/src/prolog/lib/dcgs.pl b/src/prolog/lib/dcgs.pl index e8e18844..bd35575d 100644 --- a/src/prolog/lib/dcgs.pl +++ b/src/prolog/lib/dcgs.pl @@ -107,7 +107,8 @@ dcg_constr((_->_)). % 7.14.12 - if-then (existence implementation dep.) % The principal functor of the first argument indicates % the construct to be expanded. dcg_cbody([], S0, S, S0 = S). -dcg_cbody([T|Ts], S0, S, lists:append([T|Ts], S, S0)). +dcg_cbody([T|Ts], S0, S, Goal) :- + dcg_terminals([T|Ts], S0, S, Goal). dcg_cbody(( GRFirst, GRSecond ), S0, S, ( First, Second )) :- dcg_body(GRFirst, S0, S1, First), dcg_body(GRSecond, S1, S, Second).