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
With the file SimpleLexer.g4: lexer grammar SimpleLexer; RULE0: 'a' -> pushMode(MODE1); mode MODE1; RULE1: 'b' -> Mode(MODE2); mode MODE2; RULE2: 'c' -> popMode;
If I build using Antlr downloaded today (4.7.1) antlr4 -Dlanguage=Go -o parser SimpleLexer.g4
The emitted code contains: p.SetMode(MODE2)
However, p and MODE2 are not defined in the file resulting in syntax errors.
Instead, the following symbols are defined: const ( SimpleLexerMODE1 = iota + 1 SimpleLexerMODE2 )
My guess is there is a bug in: https://github.com/antlr/antlr4/tree/master/tool/resources/org/antlr/v4/tool/templates/codegen/Go but I am not sure how to fix it.
Other targets (e.g. Python2 and Java) seem to work fine because MODE2 is defined in the file (instead of SimpleLexerMODE2).
For the moment I am working around this by using pushMode(MODE2) in RULE1 and popmode,popmode in RULE2.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
With the file SimpleLexer.g4:
lexer grammar SimpleLexer;
RULE0: 'a' -> pushMode(MODE1);
mode MODE1;
RULE1: 'b' -> Mode(MODE2);
mode MODE2;
RULE2: 'c' -> popMode;
If I build using Antlr downloaded today (4.7.1)
antlr4 -Dlanguage=Go -o parser SimpleLexer.g4
The emitted code contains:
p.SetMode(MODE2)
However, p and MODE2 are not defined in the file resulting in syntax errors.
Instead, the following symbols are defined:
const (
SimpleLexerMODE1 = iota + 1
SimpleLexerMODE2
)
My guess is there is a bug in:
https://github.com/antlr/antlr4/tree/master/tool/resources/org/antlr/v4/tool/templates/codegen/Go
but I am not sure how to fix it.
Other targets (e.g. Python2 and Java) seem to work fine because MODE2 is defined in the file (instead of SimpleLexerMODE2).
For the moment I am working around this by using pushMode(MODE2) in RULE1 and popmode,popmode in RULE2.
The text was updated successfully, but these errors were encountered: