[antlr-interest] Creating tokens on error

Jim Idle jimi at temporal-wave.com
Mon Apr 7 14:51:49 PDT 2008


> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
 
> At 05:41 7/04/2008, Marko Simovic wrote:
>  >If I have a parser rule for addition that looks like this:
>  >
>  >sum	:	something (Plus^ something)*;


>  >
>  >however, if I have input such as:
>  >
>  >a+
>  >
>  >which is invalid syntax (and causes a NoViableAltException), I
>  >would like the parser to generate a "placeholder" token for the
>  >missing operand. Is this possible?

ANTLR 3.1 will in fact add an error node to the AST. ANTLR 3.0 does not do that.

Jim





More information about the antlr-interest mailing list