[antlr-interest] Manually raising recognition error
mike at lischke-online.de
Wed Jul 25 02:19:31 PDT 2012
similar questions have been asked already, but I couldn't find any answer (neither in MarkMail nor Google). Given a rule like this:
b (c | d)
I would like to report more precisely if both c and d are missing. Letting the default handling process this I often get errors that don't really address the actual problem. So I tried:
| -> ^(MISSING_TOKEN)
which works very well, except that now I don't get any error at all and would need to parse the tree to know that there was a missing token. So my wish is to also raise an error in addition.
I guess raising an error is specific to the parser target, so I'd be especially interested in a C target solution.
More information about the antlr-interest