summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Mikkelsen <peter@pmikkelsen.com>2021-07-20 22:28:46 +0000
committerPeter Mikkelsen <peter@pmikkelsen.com>2021-07-20 22:28:46 +0000
commit0c22d3d73005e7b956742bd5fc75f183b8784989 (patch)
tree9ba0e3b6a58c4a8d80de3ee6c229b3c8b1a69c31
parent42be27517c8057733afe2d31b8bf7b98ee6f6578 (diff)
Add a bit of a hack to the parser so it can parse (a) op arg when a is an operator
-rw-r--r--dat.h1
-rw-r--r--misc.c1
-rw-r--r--parser.c3
3 files changed, 4 insertions, 1 deletions
diff --git a/dat.h b/dat.h
index d634435..72a95b5 100644
--- a/dat.h
+++ b/dat.h
@@ -29,6 +29,7 @@ struct Term
vlong ival;
double dval;
uvlong clausenr;
+ int inparens; /* kinda bad hack needed for the current parser */
};
struct Binding
diff --git a/misc.c b/misc.c
index fd74a82..f25c583 100644
--- a/misc.c
+++ b/misc.c
@@ -53,6 +53,7 @@ mkterm(int tag)
t->children = nil;
t->text = nil;
t->clausenr = 0;
+ t->inparens = 0;
return t;
}
diff --git a/parser.c b/parser.c
index a2b045e..3d2bf6f 100644
--- a/parser.c
+++ b/parser.c
@@ -171,6 +171,7 @@ term(void)
case ParenLeftTok:
match(ParenLeftTok);
result = fullterm(ParenRightTok, nil, nil);
+ result->inparens = 1;
match(ParenRightTok);
break;
case StringTok:
@@ -251,7 +252,7 @@ parseoperators(Term *list)
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{