You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When two grammar files import the same file (lets say root imports a and b, and a imports b), one file (root) will have a different "version" (root.b) of the imported file (b) from the other file (a, root.a.b)
When the first file overrides a terminal in the imported file, the second terminal should, in theory, use that override (a.b.B), however it does not (b.B)
Given the above examples, upon constructing the grammar (parglare.Grammar.from_file('./root.pg')), the terminals are as such:
b.B
a.b.B
I would expect there to be only one, a.b.B, as having each import potentially separate makes overriding complex multi-file grammars much more difficult.
The text was updated successfully, but these errors were encountered:
I created a pull request with a small, somewhat untested simple fix at #152 for a starting point. If you approve of the base concept, I will add tests and update anything else as necessary.
Looks good as a starting point. Watch out for file_path which is relative to the importing file. That should probably be normalized to be e.g. relative to the root file to be sure that we always get the same file back no matter where we are importing it from.
Description
When two grammar files import the same file (lets say
root
importsa
andb
, anda
importsb
), one file (root
) will have a different "version" (root.b
) of the imported file (b
) from the other file (a
,root.a.b
)When the first file overrides a terminal in the imported file, the second terminal should, in theory, use that override (
a.b.B
), however it does not (b.B
)What I Did
root.pg
a.pg
b.pg
Given the above examples, upon constructing the grammar (
parglare.Grammar.from_file('./root.pg')
), the terminals are as such:b.B
a.b.B
I would expect there to be only one,
a.b.B
, as having each import potentially separate makes overriding complex multi-file grammars much more difficult.The text was updated successfully, but these errors were encountered: