Fw: Re[2]: [antlr-interest] A little trouble with single linecomments andEOFs

Alexey Demakov demakov at ispras.ru
Wed Mar 16 02:54:41 PST 2005


In your code LA(1) is checked twice. Not very big overhead.

Regards,
Alexey

-----
Alexey Demakov
TreeDL: Tree Description Language: http://treedl.sourceforge.net
RedVerst Group: http://www.unitesk.com


----- Original Message ----- 
From: "Alex Sedow" <alexsedow at mail.ru>
To: "Alexey Demakov" <demakov at ispras.ru>; "antlr-interest" <antlr-interest at antlr.org>
Sent: Wednesday, March 16, 2005 1:11 PM
Subject: Re: Fw: Re[2]: [antlr-interest] A little trouble with single linecomments andEOFs


> Alexey,
> 
> Thanks. I fix male preferences.
> 
> About trick. Is code generated by ANTLR is equal in both cases? Or tricky code faster?
> 
> Alex.
> 
> -----Original Message-----
> From: "Alexey Demakov" <demakov at ispras.ru>
> To: "antlr-interest" <antlr-interest at antlr.org>
> Date: Wed, 16 Mar 2005 12:15:38 +0300
> Subject: Fw: Re[2]: [antlr-interest] A little trouble with single linecomments andEOFs
> 
> > 
> > Alexey, don't forget to "reply all" to send message in list!
> > And change, please, your name in message header because cyrillics is unreadably
> > for many list readers.
> > 
> > Yes, it's just a little trick :) See at generated code - ANTLR check LA(1) automatically.
> > 
> > Regards,
> > Alexey
> > 
> > -----
> > Alexey Demakov
> > TreeDL: Tree Description Language: http://treedl.sourceforge.net
> > RedVerst Group: http://www.unitesk.com
> > 
> > 
> > ----- Original Message ----- 
> > From: "Alexey Sedov" <alexsedow at mail.ru>
> > To: "Alexey Demakov" <demakov at ispras.ru>
> > Sent: Wednesday, March 16, 2005 11:57 AM
> > Subject: Re[2]: [antlr-interest] A little trouble with single line comments andEOFs
> > 
> > 
> > > > protected
> > > > NL : (   {LA(2) == '\n'}? '\r' '\n'
> > > >        | '\r'
> > > >        | '\n'
> > > >      )
> > > >      { newline(); }
> > > >    ;
> > > 
> > > Is this Right?
> > > 
> > > I suppose, should be
> > > 
> > > protected
> > > NL : (   {LA(1) == '\r' && LA(2) == '\n'}? '\r' '\n'
> > >        | '\r'
> > >        | '\n'
> > >      )
> > >      { newline(); }
> > >    ;




More information about the antlr-interest mailing list