ref: 2d7f3ffa770b6eb698566b6566d7e37f10193744
parent: 8fdf0bc6e9770e2cea4d8e18299ff5a8a9aa0802
author: Peter Mikkelsen <[email protected]>
date: Tue Jun 29 12:38:09 EDT 2021
Parse , and make xfy do what it should
--- a/example.pl
+++ b/example.pl
@@ -2,4 +2,13 @@
math(A,B,C,D) :- D is A + B + C * A.
-true.
\ No newline at end of file
+true.
+
+likes(bob, ice).
+likes(sam, text).
+likes(sam, ice).
+
+could_be_friends(Person1, Person2) :-
+ likes(Person1, Thing1),
+ likes(Person2, Thing2),
+ Thing1 = Thing2.
\ No newline at end of file
--- a/parser.c
+++ b/parser.c
@@ -158,6 +158,10 @@
result = mknumber(NumberFloat, 0, lookahead.dval);
match(FloatTok);
break;
+ case CommaTok:
+ result = mkatom(L",");
+ match(CommaTok);
+ break;
default:
print("Cant parse term of token type %d\n", lookahead.tag);
syntaxerror("term");
@@ -219,7 +223,7 @@
for(i = 0; i < length; i++){
if(infos[i].type == 0)
continue;
- if(infos[i].level == lowest && infos[i].type == Xfy && i == index+1)
+ if(infos[i].level == lowest && infos[i].type == Xfy)
index = i;
else if(infos[i].level < lowest){
index = i;