]> Repositorios git - scryer-prolog.git/commitdiff
correct DCG descriptions of lists (#286)
authorMark Thom <[email protected]>
Sat, 14 Mar 2020 20:14:26 +0000 (14:14 -0600)
committerMark Thom <[email protected]>
Sat, 14 Mar 2020 20:14:26 +0000 (14:14 -0600)
src/prolog/lib/dcgs.pl
src/prolog/machine/term_expansion.rs

index bd35575dc5aad65c27becc6341e2b555dfa6a72e..e8e188449a07f0d9d81527e8c68fcd24b96ff142 100644 (file)
@@ -107,8 +107,7 @@ 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, Goal) :-
-    dcg_terminals([T|Ts], S0, S, Goal).
+dcg_cbody([T|Ts], S0, S, lists:append([T|Ts], S, S0)).
 dcg_cbody(( GRFirst, GRSecond ), S0, S, ( First, Second )) :-
     dcg_body(GRFirst, S0, S1, First),
     dcg_body(GRSecond, S1, S, Second).
index 5339a512ed1623ce260d3da9a6e3ea3287442852..969e00c2b732b8f31d3c570d3d73f445a15a27db 100644 (file)
@@ -379,7 +379,8 @@ impl MachineState {
             let output = self.print_with_locs(Addr::HeapCell(h), &wam.indices.op_dir);
 
             self.reset_with_heap_preservation();
-            Some(output.result())
+
+            Some(output.result()))
         }
     }
 }