Fix unexpected token after subvalue raising wrong
HEAD default3 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("();")
|