[antlr-interest] Modifying token text - is it possible?
Terence Parr
parrt at cs.usfca.edu
Tue Nov 20 08:52:21 PST 2007
Hi. that is v2 stuff so beware. Try setText, which modifies the text
member of the lexer.
Ter
On Nov 20, 2007, at 4:30 AM, Steve Bennett wrote:
> According to http://www.cs.usfca.edu/~parrt/course/652/lectures/
> antlr-lexers.html
> it ought to be possible to modify a token's text two ways:
>
> FOO: '<'! ... ; // '<' does not become part of the token
>
> FOO: '<' ...{ $setText (...); // $setText manually overrides the
> matched text.
>
> Neither of these constructs seems to work for me...were they perhaps
> taken out or changed to something else? I see there is a setText
> method on Lexer, but can't make it work: does FOO: x=TOKEN {$x...};
> notation actually work?
>
> Steve
More information about the antlr-interest
mailing list