[antlr-interest] Bad code generated for simple AST rule
Steve Bennett
stevagewp at gmail.com
Wed Nov 28 01:48:45 PST 2007
This is probably a known bug, but is there a good workaround?
paragraph_separator: N+ -> BR+;
generates code that doesn't compile:
[20:45:44] \tmp\antlrworks\headerline6Parser.java:968: illegal start
of expression
[20:45:44] if ( !() ) {
[20:45:44] ^
[20:45:44] \tmp\antlrworks\headerline6Parser.java:976: ')' expected
Here's my code, if someone can see a workaround:
article: (N*) (line N paragraph_separator)*
-> ^(ARTICLE (line paragraph_separator)* );
paragraph_separator: N+ -> BR+;
N is a newline. BR is an abstract token. For every second and
subsequent newline between two lines of text, I want to generate one
special token.
Thanks,
Steve
More information about the antlr-interest
mailing list