From 665f319a0ecef09ee01f608b4a6efbf28746c65a Mon Sep 17 00:00:00 2001 From: Markus Triska Date: Tue, 23 Jan 2024 21:40:50 +0100 Subject: [PATCH 1/2] no longer use (->)//2, since it is implementation defined This addresses #2304. --- src/lib/clpb.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/clpb.pl b/src/lib/clpb.pl index 6ee1b4608..a20694d03 100644 --- a/src/lib/clpb.pl +++ b/src/lib/clpb.pl @@ -1251,7 +1251,7 @@ node_id(Node, ID) }, ( { I0 =:= VI } -> ( { Value =:= 0 } -> { Res = Low } - ; { Value =:= 1 } -> { Res = High } + ; { Res = High } ) ; { I0 > VI } -> { Res = Node } ; state(G0), { get_assoc(ID, G0, Res) } -> [] From a6ccf95076fbf0441ccbe894c399310e2f9139ad Mon Sep 17 00:00:00 2001 From: Markus Triska Date: Tue, 23 Jan 2024 21:43:34 +0100 Subject: [PATCH 2/2] improve error context Source: https://github.com/mthom/scryer-prolog/issues/2304#issuecomment-1906434756 --- src/lib/dcgs.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/dcgs.pl b/src/lib/dcgs.pl index 0fa9109ce..4ee763f0f 100644 --- a/src/lib/dcgs.pl +++ b/src/lib/dcgs.pl @@ -174,10 +174,10 @@ dcg_constr(phrase(_,_)). % extension of 7.14.9 dcg_constr(phrase(_,_,_)). % extension of 7.14.9 dcg_constr(!). % 7.14.10 -dcg_constr(\+ _) :- % 7.14.11 - not (existence implementation dep.) - throw(error(representation_error(dcg_body), phrase/3)). -dcg_constr((_->_)) :- % 7.14.12 - if-then (existence implementation dep.) - throw(error(representation_error(dcg_body), phrase/3)). +dcg_constr(\+ G_0) :- % 7.14.11 - not (existence implementation def.) + throw(error(representation_error(dcg_body), [culprit- (\+ G_0)])). +dcg_constr((If->Then)) :- % 7.14.12 - if-then (existence implementation def.) + throw(error(representation_error(dcg_body), [culprit- (If->Then)])). % The principal functor of the first argument indicates % the construct to be expanded.