[antlr-interest] Csharp target, Recover(input, e)

Mari Matinlassi mmatinlassi at icinetic.com
Wed Sep 28 08:37:25 PDT 2011


Hi,

 

I am doing a grammar for C sharp target. I have following problem, I need
help with


 

When parser input contains unexpected character, let´s say ‘*’  or ‘<’  that
is not defined in any lexer/parser rule or token, happens the following:

1.       RecognitionException (subtype MismatchedTokenException)will be
thrown from the rule in question. This OK.

2.       Error reported is ok. Something like “mismatched input
[@20,56:55='',<18>,8:2] expecting ENDOFCLASS”

3.       Recover method will be called. This takes forever(or at least 10
seconds), then another exception will be thrown. Either
“OutOfMemoryException” or “ArgumentOutOfRangeException”

 

Shouldn´t Recover(input, e) method recover from this kinds of errors? What
am I doing wrong?

 

Thanks for help,

 

Mari



More information about the antlr-interest mailing list