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

Andi Clemens Andi.Clemens at gmx.net
Thu Sep 9 05:44:43 PDT 2010


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


More information about the antlr-interest mailing list