aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Peter McGoron 2021-07-25 23:55:49 -0400
committerGravatar - 2021-07-26 22:55:50 -0400
commitf76aa944b304eb9d3aa325807f13c4f9a20191b6 (patch)
tree37b9848c7dbf87223e74b6876d61573582cf53ed
parentqueryparse: fix error in returning from NOT (diff)
queryparse: lift encapsulate() calls into loops to make cleaner parse trees
-rw-r--r--queryparse.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/queryparse.py b/queryparse.py
index bd87079..17227c2 100644
--- a/queryparse.py
+++ b/queryparse.py
@@ -92,9 +92,9 @@ def e3(l):
def e2(l):
pt,l = e3(l)
try:
- pt = encapsulate(pt, TokType.AND)
while True:
pt2,l = e3(l)
+ pt = encapsulate(pt, TokType.AND)
pt.push(pt2)
except ParseError:
pass
@@ -105,9 +105,9 @@ def e1(l):
typ,_ = classify_head(l)
try:
- pt = encapsulate(pt, TokType.OR)
while typ == TokType.OR:
pt2,l = e2(l[1:])
+ pt = encapsulate(pt, TokType.OR)
pt.push(pt2)
typ,_ = classify_head(l)
except ParseError: