[antlr-interest] Interpreter exceptions?

Gavin Lambert antlr at mirality.co.nz
Fri Jul 10 04:23:45 PDT 2009


At 08:50 10/07/2009, Natan wrote:
 >STRING
 >    :    '"' ( '\"' | ~('"') )* '"';

ANTLR parses backslashes as escape sequences.  So you really 
should be using this instead:

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

 >I am aware that the debug and interpreter trees are not the 
same,
 >and that the interpreter does not support some things like
 >actions etc, but still this simple syntax should work right?

I've usually found the interpreter to be unreliable even without 
getting into actions and predicates.  It's usually best to just 
pretend it doesn't exist, and use a combination of the debugger, 
unit tests, and the main code instead.



More information about the antlr-interest mailing list