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
It is not possible to use grammars that contain any Python keywords as rule name.
Consider the following ANTLR grammar:
grammar keyword; start: False; False: 'anything';`
This wil procude the keywordGenerator.py with the following function:
@depthcontrol def False(self, parent=None): current = UnlexerRule(name='False', parent=parent) self._enter_rule(current) UnlexerRule(src='anything', parent=current) self._exit_rule(current) return current False.min_depth = 0
Because False is a reserved keyword in Python this is not valid Python code. The bug occurs with every keyword.
False
The text was updated successfully, but these errors were encountered:
@38b394ce01 This is in sync with ANTLR, you cannot generate lexers/parsers from grammars containing keywords of the target language:
error(134): keyword.g4:3:0: symbol False conflicts with generated code in target language or runtime
The only aspect we could improve here is to give a similar error message in our grammar processing step.
Sorry, something went wrong.
It's probably not actual since ANTLR >= 4.10 since it renames conflicting symbols in corresponding runtimes.
@KvanTTT Thanks for pointing it out to me, I was not aware of this new feature. In this case, I'll add it to my TODO list.
No branches or pull requests
It is not possible to use grammars that contain any Python keywords as rule name.
Consider the following ANTLR grammar:
This wil procude the keywordGenerator.py with the following function:
Because
False
is a reserved keyword in Python this is not valid Python code.The bug occurs with every keyword.
The text was updated successfully, but these errors were encountered: