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)