[antlr-interest] A proposal for keywords

shmuel siegel antlr at shmuelhome.mine.nu
Wed May 24 16:00:14 PDT 2006


Martin Probst wrote:
> I would recommend not changing the text of a token anyways, but rather
> having a field "parsed text", or "modified text", or whatever.
> 
> Rationale is that you want to have the original token text for error
> reporting, plus it's not actually expensive to have the string around
> (it's not a copy, it's just offsets into the original string). So I'd
> create a method called getModifiedText() that defaults to return the
> original text (if modified text is null).
> 
> 

Are you saying that you recommend creating my own AST class rather than 
use "!" in a lexer rule? Do you believe that the following rule is bad form?

STRING: '"'! ( ESCAPE | ~('"'|'\\') )* '"'! ;


More information about the antlr-interest mailing list