ref: 0c22d3d73005e7b956742bd5fc75f183b8784989
parent: 42be27517c8057733afe2d31b8bf7b98ee6f6578
author: Peter Mikkelsen <peter@pmikkelsen.com>
date: Tue Jul 20 18:28:46 EDT 2021
Add a bit of a hack to the parser so it can parse (a) op arg when a is an operator
--- a/dat.h
+++ b/dat.h
@@ -29,6 +29,7 @@
vlong ival;
double dval;
uvlong clausenr;
+ int inparens; /* kinda bad hack needed for the current parser */
};
struct Binding
--- a/misc.c
+++ b/misc.c
@@ -53,6 +53,7 @@
t->children = nil;
t->text = nil;
t->clausenr = 0;
+ t->inparens = 0;
return t;
}
--- a/parser.c
+++ b/parser.c
@@ -171,6 +171,7 @@
case ParenLeftTok:
match(ParenLeftTok);
result = fullterm(ParenRightTok, nil, nil);
+ result->inparens = 1;
match(ParenRightTok);
break;
case StringTok:
@@ -251,7 +252,7 @@
for(i = 0, t = list; i < length; i++){
Operator *op = getoperator(t->text, currentmod);
- if(op && t->tag == AtomTerm){
+ if(op && t->tag == AtomTerm && !t->inparens){
infos[i].type = op->type;
infos[i].level = op->level;
}else{