I am having inconsistent results with the antlrworks interpreter. The 
following grammar gives a mismatched token exception while processing 
the string part of

#include "abc"


The debugger works fine with this grammar. If I remove ESC_SEQ from the 
definition of STRING, the interpreter works fine. FWIW STRING was 
auto-generated from the antlrworks new grammar wizard.


grammar test;

prog:     INCLUDE STRING;
INCLUDE     :     '#include';

STRING
     :  '"' ( ESC_SEQ | ~('\\'|'"') )* '"'
     ;

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

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

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



List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to