]> Repositorios git - scryer-prolog.git/commitdiff
improve error context
authorMarkus Triska <[email protected]>
Tue, 23 Jan 2024 20:43:34 +0000 (21:43 +0100)
committerMarkus Triska <[email protected]>
Tue, 23 Jan 2024 20:43:34 +0000 (21:43 +0100)
Source: https://github.com/mthom/scryer-prolog/issues/2304#issuecomment-1906434756

src/lib/dcgs.pl

index 0fa9109ce0ad8a305465f368697f2e237dac69f1..4ee763f0f13276ffb15078689fc2a4e3d5060437 100644 (file)
@@ -174,10 +174,10 @@ dcg_constr(phrase(_)). % 7.14.9
 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.