[antlr-interest] lexer rule for string

Krupa Benhur krupa_gadde at yahoo.com
Tue Oct 15 23:08:43 PDT 2002


Hi Stephan,

Include "\\" also as part of you lexer for string. I
guess this should solve your problem.

--Benhur

 --- stephane brossier <dognogod at yahoo.com> wrote: >
Hi,
> 
> I am trying to recognize some strings in a C
> program.
> 
> I first had a lexer rule defined as is:
> 
> STRING: '"' ~'"' '"';
> 
> This worked pretty well until I had some traces
> like:
>  printf("The string is  \" the_string \" ");
> 
> How can i make the lexer understand that \" is not
> the
> end of my string but is actually part of my string
> since there is an escape char before?
> 
> Thanks,
> 
> S.

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list