[antlr-interest] Tell ANTLR to ignore parsing errors?

Andi Clemens Andi.Clemens at gmx.net
Thu Sep 9 07:15:16 PDT 2010


I found a way to remove the error messages, which is nice, but still I'd rather prefer to fix the errors than just ignoring them :-)


-------- Original-Nachricht --------
> Datum: Thu, 09 Sep 2010 14:44:43 +0200
> Von: "Andi Clemens" <Andi.Clemens at gmx.net>
> An: antlr-interest at antlr.org
> Betreff: [antlr-interest] Tell ANTLR to ignore parsing errors?

> Hi,
> 
> I use this ANTLR grammar file to parse Oracle PL/SQL statements:
> http://pastebin.com/uy0wZTax
> 
> But some of the statements produce errors when I try to parse them, for
> example:
> 
> "create user u1 identified by p1 account unlock;"
> 
> I get the following error message:
> 
> ==============================
> statementString(1)  : error 3 : , at offset -1
>     near [Index: 0 (Start: 141054912-Stop: 141054917) ='create', type<50>
> Line:
> 1 LinePos:-1]
>      : cannot match to any predicted input...
> ==============================
> 
> But why? The rule looks like this:
> ==============================
> create_user_statement
> 	:	'CREATE' 'USER' identifier 'INDENTIFIED' .*
> 	;
> ==============================
> 
> Could the wildcard character be the problem?
> Actually I just want to parse known Statements with my grammar, all
> unknown statements (parsing errors) could be ignored.
> 
> Can I tell ANTLR (for the C target) to ignore those error messages and
> just return FALSE or something like that, so that I can decide wether to take
> an appropiate action?
> 
> I get a lot of those error messages, and to be honest, the error messages
> are not helping me here. I can not see problems with the grammar.
> Unfortunately I'm not able to debug the grammar with ANTLRworks.
> 
> Can someone show me the error or tell me a way to disable those error
> messages in the ANTLR C target?
> 
> Andi
> 
> -- 
> GMX DSL SOMMER-SPECIAL: Surf & Phone Flat 16.000 für nur 19,99
> Euro/mtl.!*
> http://portal.gmx.net/de/go/dsl
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome


More information about the antlr-interest mailing list