summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorSoniEx2 <endermoneymod@gmail.com>2021-01-31 20:33:09 -0300
committerSoniEx2 <endermoneymod@gmail.com>2021-01-31 20:33:51 -0300
commit77e04d5d7baf432ba6419f0a8b38161de1c76bec (patch)
treed4bf8acc4ea02fe69b4e400cc12b918baf51036e
parentff3628c36eab5ec19ab850e9126a951f5c203568 (diff)
Fix unexpected token after subvalue raising wrong HEAD default
-rw-r--r--abdl/_parser.py2
-rw-r--r--setup.py2
-rw-r--r--testing/test_regress.py11
3 files changed, 13 insertions, 2 deletions
diff --git a/abdl/_parser.py b/abdl/_parser.py
index 3c38ab2..074b351 100644
--- a/abdl/_parser.py
+++ b/abdl/_parser.py
@@ -113,6 +113,6 @@ def _build_syntax():
                  + (valuesubtree
                     + Empty().setParseAction(_vm.End.action))[...])
 
-    return ((subtree | unexpected_token) + StringEnd()).parseWithTabs()
+    return ((subtree | unexpected_token) + (StringEnd() | unexpected_token)).parseWithTabs()
 
 BUILT_SYNTAX = _build_syntax()
diff --git a/setup.py b/setup.py
index 15f07b8..1178c77 100644
--- a/setup.py
+++ b/setup.py
@@ -1,3 +1,3 @@
 import setuptools
 
-setuptools.setup(name="gan0f74bd87a23b515b45da7e6f5d9cc82380443dab", version="2.2.1", packages=["abdl"], install_requires=["pyparsing >= 2.4.2"])
+setuptools.setup(name="gan0f74bd87a23b515b45da7e6f5d9cc82380443dab", version="2.2.2", packages=["abdl"], install_requires=["pyparsing >= 2.4.2"])
diff --git a/testing/test_regress.py b/testing/test_regress.py
new file mode 100644
index 0000000..2f3ea7d
--- /dev/null
+++ b/testing/test_regress.py
@@ -0,0 +1,11 @@
+# Bugs found
+
+import re
+
+import abdl
+
+import pytest
+
+def test_unexpected_after_subvalue():
+    with pytest.raises(abdl.exceptions.PatternError):
+        abdl.compile("();")