aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Peter McGoron 2021-07-25 23:54:42 -0400
committerGravatar - 2021-07-26 22:55:48 -0400
commit90891d90f00d8e69d4f4a6ed33ff73d2843bc1e4 (patch)
treed0aa2685335e20a00b5498b862ae569148ca398b
parentqueryparse: fix mistaken command in AND (diff)
queryparse: fix error in returning from NOT
-rw-r--r--queryparse.py4
-rwxr-xr-xtest/t_queryparse.py2
2 files changed, 4 insertions, 2 deletions
diff --git a/queryparse.py b/queryparse.py
index 127e09b..bd87079 100644
--- a/queryparse.py
+++ b/queryparse.py
@@ -85,8 +85,8 @@ def e4(l):
def e3(l):
typ,_ = classify_head(l)
if typ == TokType.NOT:
- return encapsulate(e4(l[1:]), \
- TokType.NOT)
+ pt,l = e4(l[1:])
+ return encapsulate(pt, TokType.NOT), l
return e4(l)
def e2(l):
diff --git a/test/t_queryparse.py b/test/t_queryparse.py
index a37a67b..e1728e3 100755
--- a/test/t_queryparse.py
+++ b/test/t_queryparse.py
@@ -9,3 +9,5 @@ def f(x):
f(["x", "OR", "y"])
f(["x", "y", "OR", "a", "b"])
+f(["x", "y", "z", "w"])
+f(["NOT", "x", "OR", "y"])