[antlr-interest] Is it possible to do rewriting for lexer?

Rob Aarnts rob at aarnts.com
Tue Jul 26 00:16:26 PDT 2011


You're entirely right. I use this trick but with a parser rule in stead
of a lexer one. So SINGLE_QUOTED_STRING should be single_quoted_string
according to the ANTLR convention
----------------------------------------------------- 
Rob Aarnts
phone: +31 2356 14444
mobile: +31 6 5582 2856
fax: +31 8 4227 4444
-----------------------------------------------------
On 26 jul 2011 09:02 "Gokulakannan Somasundaram" <gokul007 at gmail.com>
<gokul007 at gmail.com> wrote:
> > On Mon, Jul 25, 2011 at 4:44 PM, Rob Aarnts <<rob at aarnts.com>>
> > wrote:
> > > Or:
> > >  
> > > SINGLE_QUOTED_STRING returns [string result]
> > >     : SQUOTE
> > >            val=((~SQUOTE)*)    { $result = val.Text; }
> > >       SQUOTE
> > >     ;
> > Is this possible? To my knowledge, Lexer cannot return...
> > Gokul. 


More information about the antlr-interest mailing list