Check ANTLRToolListener in antlr source or whatever. it has a similar problem
to solve.
Ter
On Nov 30, 2010, at 5:13 PM, Arthur Goldberg wrote:
> Hello All
>
> My ANTLR parser is embedded in other code. I've decided that reporting
> errors out of the parser would be better handled as a list of errors,
> not exceptions, so that the parse is allowed to recover from errors and
> complete, if possible.
> Does anyone have a working pattern for returning errors from ANTLR in a
> list, not STDERR?
> In more detail, I'd run it in two modes:
> 1) testing: call some rule other than the root
> In this case, I will let the rule report an error via an exception.
>
> 2) production: call the root rule
> In this case, a newReportError() in
>
> catch (RecognitionException re) {
> newReportError(re);
> recover(input,re);
> }
>
> would catch exceptions thrown by other rules, and store them in a list.
> When the root rule returns, it returns the list of errors, along with
> the results of the parse.
>
> If someone can help me with this, I'll make it worth your while. I'm
> running out of time for messing with ANTLR.
>
> Thanks
> Arthur
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en.