[antlr-interest] newbie question - string literals

Duygu Altinok duygu_the_duygu at yahoo.com
Wed Dec 9 17:04:24 PST 2009


Hi all,
I'm really a newbie and  have a question. I would like to define string literals  enclosed in ` and '. Here's the rules :\

STR
    :   '`' ( ESC_SEQ | ~('\\'|'"') )* '\'';

ESC_SEQ
    :   '\\' ('b'|'t'|'n'|'f'|'r'|'"'|'\''|'\\')
    |   UNICODE_ESC
    |   OCTAL_ESC
    ;

OCTAL_ESC
    :   '\\' ('0'..'3') ('0'..'7') ('0'..'7')
    |   '\\' ('0'..'7') ('0'..'7')
    |   '\\' ('0'..'7')
    ;

UNICODE_ESC
    :   '\\' 'u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT
  ;

HEX_DIGIT : ('0'..'9'|'a'..'f'|'A'..'F') ;


I dunno why it doesn't work. Any help is appreciated.


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20091209/84db945c/attachment.html 


More information about the antlr-interest mailing list