From 77e04d5d7baf432ba6419f0a8b38161de1c76bec Mon Sep 17 00:00:00 2001 From: SoniEx2 Date: Sun, 31 Jan 2021 20:33:09 -0300 Subject: Fix unexpected token after subvalue raising wrong --- abdl/_parser.py | 2 +- setup.py | 2 +- testing/test_regress.py | 11 +++++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 testing/test_regress.py 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("();") -- cgit 1.4.1