]> Repositorios git - scryer-prolog.git/commitdiff
strip modules from GRBody in phrase/3 (#1565)
authorMark Thom <[email protected]>
Sun, 14 Aug 2022 02:46:52 +0000 (20:46 -0600)
committerMark Thom <[email protected]>
Thu, 27 Oct 2022 05:36:07 +0000 (23:36 -0600)
src/lib/dcgs.pl

index 7435a520c1268f524881c500afdfafd5101c4c63..13be7aceb728a082fcc5c2ae202a37aba571f004 100644 (file)
@@ -20,12 +20,14 @@ phrase(GRBody, S0) :-
     phrase(GRBody, S0, []).
 
 phrase(GRBody, S0, S) :-
+    strip_module(GRBody, M, GRBody1),
     (  var(GRBody) ->
        instantiation_error(phrase/3)
-    ;  dcg_constr(GRBody),
-       dcg_body(GRBody, S0, S, GRBody1) ->
-       call(GRBody1)
-    ;  call(GRBody, S0, S)
+    ;  nonvar(GRBody1),
+       dcg_constr(GRBody1),
+       dcg_body(GRBody1, S0, S, GRBody2) ->
+       call(GRBody2)
+    ;  call(M:GRBody1, S0, S)
     ).