From: Mark Thom Date: Sun, 12 Apr 2020 04:40:29 +0000 (-0600) Subject: throw error when trying to use partial lists as DCG terminal-sequence (#286) X-Git-Tag: v0.8.119~14 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=0499005db5b60c622fa9498fdd2c0e2f2e082cbd;p=scryer-prolog.git throw error when trying to use partial lists as DCG terminal-sequence (#286) --- diff --git a/src/prolog/lib/dcgs.pl b/src/prolog/lib/dcgs.pl index bd35575d..33210f19 100644 --- a/src/prolog/lib/dcgs.pl +++ b/src/prolog/lib/dcgs.pl @@ -3,6 +3,7 @@ phrase/2, phrase/3]). +:- use_module(library(error)). :- use_module(library(lists), [append/3]). user:term_expansion(Term0, Term) :- @@ -108,6 +109,7 @@ dcg_constr((_->_)). % 7.14.12 - if-then (existence implementation dep.) % the construct to be expanded. dcg_cbody([], S0, S, S0 = S). dcg_cbody([T|Ts], S0, S, Goal) :- + must_be(list, [T|Ts]), dcg_terminals([T|Ts], S0, S, Goal). dcg_cbody(( GRFirst, GRSecond ), S0, S, ( First, Second )) :- dcg_body(GRFirst, S0, S1, First),