[antlr-interest] hide particular character in a token?

J.R Karthikeyan jrk1987 at yahoo.co.in
Tue Nov 29 15:04:53 PST 2011


HI,

 I have a STRING token definition as below

STRING:QUOTE (options {greedy=false;} : ('\\' ( 'b' |'t'| '\r\n' | 'n' | 'f' | '\" '| '\'' | '\\' ) | ~('\r' | '\n' |'\\'|'\"')))* QUOTE

;

  Which will parse the string like

"H\
W" 

successfully. The above string has 'H', '\','\r'. '\n' and 'W'. 


But where as in C++

s = "H\
W";

s has the following character'H',  '\' and 'W'. 

C++ remove the '\r\n' in the above string. I would like to do the same in parser and I wonder how to enable in ANTLR C parser. I am using version Antlrworks-1.4 and antlr v3.2 libraries

Thanks in advance.


More information about the antlr-interest mailing list