[antlr-interest] Simple Grammar breaks ANTLRWorks Interpreter & Debugger?
Gavin Lambert
antlr at mirality.co.nz
Thu Aug 13 13:26:13 PDT 2009
At 07:32 14/08/2009, consiliens at gmail.com wrote:
>I have a simple grammar for quizzes that doesn't work in the
>debugger, although works fine in the interpreter.
[...]
>LETTER : ('a'..'z'|'A'..'Z');
>INT : '0'..'9'+;
>NEWLINE : '\n' '\r'? {skip();};
These rules should be marked as fragments, since you're consuming
them from other lexer rules and not expecting to receive them in
the parser.
The general rule of thumb is that you should never define two
non-fragment lexer rules that can consume the same input, and try
to avoid doing so when they consume the same common left
prefix. (Even in the cases where you can get away with having a
common left prefix, it reduces performance to do so.)
More information about the antlr-interest
mailing list