From de0de804484cb1b7c810c71be4c97acb551c7a08 Mon Sep 17 00:00:00 2001 From: Igor Dejanovic Date: Fri, 7 Jun 2024 16:21:16 +0200 Subject: [PATCH] test: failing test for issue #150 --- .../test_issue150_override_repetitions/base.pg | 2 ++ .../test_issue150_override_repetitions/overrider.pg | 4 ++++ .../test_issue150_override_repetitions/sub.pg | 4 ++++ .../test_issue150_override_repetitions.py | 13 +++++++++++++ 4 files changed, 23 insertions(+) create mode 100644 tests/func/regressions/test_issue150_override_repetitions/base.pg create mode 100644 tests/func/regressions/test_issue150_override_repetitions/overrider.pg create mode 100644 tests/func/regressions/test_issue150_override_repetitions/sub.pg create mode 100644 tests/func/regressions/test_issue150_override_repetitions/test_issue150_override_repetitions.py diff --git a/tests/func/regressions/test_issue150_override_repetitions/base.pg b/tests/func/regressions/test_issue150_override_repetitions/base.pg new file mode 100644 index 0000000..1d1c4b5 --- /dev/null +++ b/tests/func/regressions/test_issue150_override_repetitions/base.pg @@ -0,0 +1,2 @@ +import './sub.pg' ; +main: sub.Rule+ ; diff --git a/tests/func/regressions/test_issue150_override_repetitions/overrider.pg b/tests/func/regressions/test_issue150_override_repetitions/overrider.pg new file mode 100644 index 0000000..ea57317 --- /dev/null +++ b/tests/func/regressions/test_issue150_override_repetitions/overrider.pg @@ -0,0 +1,4 @@ +import './base.pg' ; +main: base.main ; +terminals +base.sub.SEP: ',' ; diff --git a/tests/func/regressions/test_issue150_override_repetitions/sub.pg b/tests/func/regressions/test_issue150_override_repetitions/sub.pg new file mode 100644 index 0000000..474688d --- /dev/null +++ b/tests/func/regressions/test_issue150_override_repetitions/sub.pg @@ -0,0 +1,4 @@ +Rule: ITEM+[SEP] ; +terminals +ITEM: /\w+/ ; +SEP: '.' ; diff --git a/tests/func/regressions/test_issue150_override_repetitions/test_issue150_override_repetitions.py b/tests/func/regressions/test_issue150_override_repetitions/test_issue150_override_repetitions.py new file mode 100644 index 0000000..1ab270e --- /dev/null +++ b/tests/func/regressions/test_issue150_override_repetitions/test_issue150_override_repetitions.py @@ -0,0 +1,13 @@ +from os.path import dirname, join + +from parglare import GLRParser, Grammar + + +def test_import_plus_raises_keyerror(): + + this_folder = dirname(__file__) + grammar = Grammar.from_file(join(this_folder, 'base.pg')) + GLRParser(grammar) + + grammar = Grammar.from_file(join(this_folder, 'overrider.pg')) + GLRParser(grammar)