Open Tiger-Tom opened 2 months ago
Looks like a bug. Thanks for the detailed report.
Let me know if you need any more details. This is a great library and I'm happy to help in whatever way I can.
Would you be able to provide a failing test for this?
Description
When overriding a terminal through multiple layers of grammar (
base.sub.SEP
), all rules using separator repetition syntax with the overridden terminal as the separator will fail with aKeyError
whilst constructingGrammar
What I Did
Say I have three files:
base.pg
, which importssub.pg
and defines a rule utilizingsub.Rule
sub.pg
, which defines a terminalSEP
and a ruleRule
that uses+[SEP]
overrider.pg
, which importsbase.pg
and defines a terminalbase.sub.SEP
Example files
base.pg
sub.pg
overrider.pg
When constructing grammar from
base.pg
, everything is fine.However, upon constructing grammar from
overrider.pg
:parglare.exceptions.GrammarError: Error at /home/shae/Desktop/Coding/Caustic/CausticGrammar/src/caustic/grammar/test/sub.pg:1:7:"Rule: **> ITEM+[SEP]" => Unexisting module "ITEM_1_base" in reference "ITEM_1_base.sub.SEP"
Full stack trace