aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Peter McGoron 2021-07-25 23:57:08 -0400
committerGravatar - 2021-07-26 22:55:51 -0400
commitdd1471b44e9f7f86a83265f394da2713b12cd43a (patch)
tree0a0fb4fc0137f7461034e0bc3a1f41b6985df863
parentqueryparse: lift encapsulate() calls into loops to make cleaner parse trees (diff)
queryparse: fix infinite recursion in '[' e1 ']'
-rw-r--r--queryparse.py2
-rwxr-xr-xtest/t_queryparse.py1
2 files changed, 2 insertions, 1 deletions
diff --git a/queryparse.py b/queryparse.py
index 17227c2..5daf702 100644
--- a/queryparse.py
+++ b/queryparse.py
@@ -72,7 +72,7 @@ def e4(l):
typ,s = classify_head(l)
if typ == TokType.OPEN:
- pt,l = e1(l)
+ pt,l = e1(l[1:])
typ,_ = classify_head(l)
if typ != TokType.CLOSE:
raise ParseError
diff --git a/test/t_queryparse.py b/test/t_queryparse.py
index e1728e3..f3709d6 100755
--- a/test/t_queryparse.py
+++ b/test/t_queryparse.py
@@ -11,3 +11,4 @@ f(["x", "OR", "y"])
f(["x", "y", "OR", "a", "b"])
f(["x", "y", "z", "w"])
f(["NOT", "x", "OR", "y"])
+f(["NOT", "[", "x", "y", "z", "]"])