[antlr-interest] Suppress error mesages in console

Jim Idle jimi at temporal-wave.com
Sat Feb 2 07:07:32 PST 2008


Implement your own error reporting routine (should be an example in the
wiki I think) and then you can do anything you like including being
silent. However, this looks like a lexer specification problem. Do you
have something that takes a path like: ‘0’...’9’+ ‘:’ and your input is
[999]? You need to allow the lexer rule to end before the ‘:’ and let
the lexer change the type of the token to whatever that means.

 

In a lexer, unless you feel that your rules encapsulate all input at all
points, then you may find it useful to have as your last rule:

 

UNKNOWN : . {System.err.println(“Debug: Character ‘” + $text + “’ is not
catered for.”); } ;

 

Jim

 

From: Dmitry Gusev [mailto:dmitry.gusev at gmail.com] 
Sent: Saturday, February 02, 2008 4:54 AM
To: antlr-interest at antlr.org
Subject: [antlr-interest] Suppress error mesages in console

 

If I try to parse bad input I have error messages in console like this:

line 1:6 mismatched character ']' expecting ':'

How can I suppress this output?



-- 
Dmitry Gusev 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080202/7cfb1aaa/attachment-0001.html 


More information about the antlr-interest mailing list