]> Repositorios git - scryer-prolog.git/commitdiff
make lists parse properly when used as dcg rules
authorMark Thom <[email protected]>
Sun, 21 Oct 2018 05:37:09 +0000 (23:37 -0600)
committerMark Thom <[email protected]>
Sun, 21 Oct 2018 05:37:09 +0000 (23:37 -0600)
src/prolog/lib/dcgs.pl

index 43cbaad168f9dbdd7e521e52e33d4b5877ce4821..d6d2f75952882b61ad4b5db7939580ad52bb716d 100644 (file)
@@ -4,10 +4,10 @@
 
 :- op(1200, xfx, -->).
 
+phrase(G, G) :-
+    nonvar(G), G = [_|_], !. %, append(G, _, Ls0).
 phrase(G, Ls0) :-
-    nonvar(G), G = [_|_], !, append(G, _, Ls0).
-phrase(G, Ls0) :-
-    nonvar(G), G = (G1, G2), !, phrase(G1, Ls0, Ls1), phrase(G2, Ls1).
+    nonvar(G), G = (G1, G2), !, phrase(G1, Ls0, Ls1), phrase(G2, Ls1, []).
 phrase(G, Ls0) :-
     call(G, Ls0, []).