We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
parglare sometimes accepts multiple definitions of the same non-terminal, and sometimes it doesn't. Example case:
parglare
from parglare import Grammar from parglare import Parser text = "a" gram1 = """\ A : "a" ; A : "b" ; """ grammar = Grammar.from_string(gram1) # line 11 parser = Parser(grammar) result = parser.parse(text) print(result) gram2 = """\ A : t="a" ; A : t="b" ; """ grammar = Grammar.from_string(gram2) # line 21 parser = Parser(grammar) result = parser.parse(text) print(result)
Produces
a Traceback (most recent call last): File "m.py", line 21, in <module> grammar = Grammar.from_string(gram2) File "~/compiler3/parglare/grammar.py", line 615, in from_string .parse(grammar_str, context=context), File "~/compiler3/parglare/parser.py", line 381, in parse context) File "~/compiler3/parglare/parser.py", line 619, in _call_reduce_action result = sem_action(context, subresults) File "~/compiler3/parglare/grammar.py", line 961, in act_production_rule .format(name)) parglare.exceptions.GrammarError: Multiple definition for Rule/Class "A"
Note that it crashes at line 21, but not line 11.
EDIT:
The only difference between both grammars are the t= additions in grammar2.
t=
grammar2
Merging both alternatives with a | avoids the crash.
|
The text was updated successfully, but these errors were encountered:
Thanks for detailed report and test case. Looks like a bug. Will investigate.
Sorry, something went wrong.
7c6fade
@alberth Fixed on master.
master
igordejanovic
No branches or pull requests
Description
parglare
sometimes accepts multiple definitions of the same non-terminal, and sometimes it doesn't.Example case:
Produces
Note that it crashes at line 21, but not line 11.
EDIT:
The only difference between both grammars are the
t=
additions ingrammar2
.Merging both alternatives with a
|
avoids the crash.The text was updated successfully, but these errors were encountered: