From 97aab6950ce5cd6c8b9fd9ec7c0bd0f9ccc8824c Mon Sep 17 00:00:00 2001 From: Mark Thom Date: Sat, 14 Mar 2020 14:14:26 -0600 Subject: [PATCH] correct DCG descriptions of lists (#286) --- src/prolog/lib/dcgs.pl | 3 +-- src/prolog/machine/term_expansion.rs | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/prolog/lib/dcgs.pl b/src/prolog/lib/dcgs.pl index bd35575d..e8e18844 100644 --- a/src/prolog/lib/dcgs.pl +++ b/src/prolog/lib/dcgs.pl @@ -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). diff --git a/src/prolog/machine/term_expansion.rs b/src/prolog/machine/term_expansion.rs index 5339a512..969e00c2 100644 --- a/src/prolog/machine/term_expansion.rs +++ b/src/prolog/machine/term_expansion.rs @@ -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())) } } } -- 2.54.0