[antlr-interest] Token Names

Adam Connelly adam.rpconnelly at googlemail.com
Thu Jan 10 10:04:29 PST 2008


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080110/d7630884/attachment.html 


More information about the antlr-interest mailing list