emit callable type errors from call/1 and phrase/3 when appropriate (#2202)

This commit is contained in:
Mark
2023-12-04 12:20:14 -07:00
parent 004201abda
commit 2c76943d35
2 changed files with 15 additions and 9 deletions

View File

@@ -101,7 +101,10 @@ dcg_rule(( NonTerminal --> GRBody ), ( Head :- Body )) :-
dcg_non_terminal(NonTerminal, S0, S, Goal) :-
NonTerminal =.. NonTerminalUniv,
append(NonTerminalUniv, [S0, S], GoalUniv),
Goal =.. GoalUniv.
( callable(NonTerminal) ->
Goal =.. GoalUniv
; Goal = NonTerminal % let call/N throw an error instead of throwing one here.
).
dcg_terminals(Terminals, S0, S, S0 = List) :-
append(Terminals, S, List).