fix DCG bugs
This commit is contained in:
@@ -158,6 +158,7 @@ The following predicates are built-in to rusty-wam.
|
||||
* `numbervars/2`
|
||||
* `once/1`
|
||||
* `partial_string/2`
|
||||
* `phrase/{2,3}`
|
||||
* `rational/1`
|
||||
* `read/1`
|
||||
* `repeat/0`
|
||||
|
||||
@@ -41,11 +41,12 @@ term_expansion(Term0, (ModHead :- ModBody)) :-
|
||||
nonvar(Body),
|
||||
expand_body(Body, ModBody, 0, N).
|
||||
|
||||
expand_body((Term, Terms), (ModTerm, ModTerms), N0, N) :-
|
||||
!, expand_body_term(Term, ModTerm, N0, N1),
|
||||
expand_body(Term0, (ModTerm, ModTerms), N0, N) :-
|
||||
nonvar(Term0), Term0 = (Term, Terms), !,
|
||||
expand_body_term(Term, ModTerm, N0, N1),
|
||||
expand_body(Terms, ModTerms, N1, N).
|
||||
expand_body(Term, ModTerm, N0, N) :-
|
||||
expand_body_term(Term, ModTerm, N0, N).
|
||||
expand_body(Term0, ModTerm, N0, N) :-
|
||||
nonvar(Term0), expand_body_term(Term0, ModTerm, N0, N).
|
||||
|
||||
expand_body_term([], true, N, N) :- !.
|
||||
expand_body_term([Arg|Args], ModTerm, N0, N) :-
|
||||
|
||||
Reference in New Issue
Block a user