[antlr-interest] "Tokens"

Johannes Luber jaluber at gmx.de
Sun Nov 18 15:05:39 PST 2007


Steve Bennett wrote:
> On 11/19/07, Johannes Luber <jaluber at gmx.de> wrote:
>> Not with the lowercase names though. ;)
> 
> Why not? I was under the impression that a given piece of text will be
> labelled as exactly one kind of token, so this wouldn't work:
> 
> MINUS: '-';
> HYPHEN: '-';
> 
> Every '-' would be a MINUS. Whereas by making minus/hyphen parser
> rules, every '-' would just be a '-' at the lexer level, but could be
> either a minus or a hyphen at the parser level?
> 
> (err, I see Gavin agrees with me - should have read first :))

I've misread your intent - I overlooked the identical literals.
Nonetheless I was under the impression that ANTLR doesn't like parser
rules with only literals. I am wrong in that regard?

Johannes


More information about the antlr-interest mailing list