[antlr-interest] Token Names
Terence Parr
parrt at cs.usfca.edu
Thu Jan 10 15:06:58 PST 2008
Can't you override the error reporting method(s)?
Ter
On Jan 10, 2008, at 10:04 AM, Adam Connelly wrote:
> I know I can do that, but what if I want to have it as a lexer
> token, but still show the text of the token rather than the name?
> Example:
>
> rule
> : expression SCOLON
> ;
>
> SCOLON : ';'
> ;
>
> I think I might have a partial workaround (by altering the way the
> parser gets the token name), but I just wanted to know if there was
> any facility in antlr to specify that you want to use the token text
> rather than the token name.
>
> I guess a reason for wanting to be able to do this would be if you
> planned to have multiple lexers with the same parser (like if I
> wanted to have two lexers, one which specifies an end of expression
> character as ';' and another which specifies it as ':' - a bit
> contrived I'll agree).
>
> Cheers,
>
> Adam
More information about the antlr-interest
mailing list