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

Bart Kiers bkiers at gmail.com
Tue Jul 26 00:52:09 PDT 2011


But you'd have to have a good reason to use a string literal as a parser
rule instead of a lexer rule.

Bart.


On Tue, Jul 26, 2011 at 9:16 AM, Rob Aarnts <rob at aarnts.com> wrote:

>
> 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.
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>


More information about the antlr-interest mailing list