[antlr-interest] Getting feedback from grammar errors

Jim Idle jimi at temporal-wave.com
Tue Aug 3 10:25:11 PDT 2010


Read the wiki articles on displayRecognitionError() and look at the source
code for that method. You basically override it with your own method that
can do anything it likes with the information. The default message is just
for grammar developers.

Jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Patrick Petermair
> Sent: Tuesday, August 03, 2010 10:23 AM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] Getting feedback from grammar errors
> 
> Hey list!
> 
> We are in the process of developing a timetracking application. One part
of it
> is some kind of "powerstring" that enables users to execute complex
> commands. The powerstring has to follow certain rules / grammar
> definitions.
> 
> This is where antlr comes in. We were able to write a grammar that follows
all
> those rules. Unfortunately we just get an exception with no meaningful
> description when something went wrong (= the provided string didn't match
> the grammar definition).
> 
> Is there a way to get some more feedback from antlr? If so, what would be
> the way to do it?
> 
> We want to provide the user with more information than just "Syntax error"
> or "MismatchedTokenException(-1!=6)" which isn't very helpful. If we could
> get at least the position in the String where the error occured...
> 
> Cheers,
> Patrick
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address



More information about the antlr-interest mailing list