Exception declared on ANTLR grammar rule ignored

I have a tree parser that's doing semantic analysis on the AST generated by my parser. It has a rule declared as follows:

transitionDefinition throws WorkflowStateNotFoundException: /* ... */

This compiles just fine and matches the rule syntax at the ANTLR Wiki but my exception is never declared so the Java compiler complains about undeclared exceptions.

./tool/src/main/antlr3/org/antlr/grammar/v3/ANTLRv3.g shows that it's building a tree (but I'm not actually positive if it's the v2 or v3 grammar that ANTLR 3.2 is using):

throwsSpec
    :   'throws' id ( ',' id )* -> ^('throws' id+)
    ;

I know I can make it a runtime exception, but I'd like to use my exception hierarchy. Am I doing something wrong or should that syntax work?

Answers


It looks like this is a known issue: http://www.antlr.org/jira/browse/ANTLR-100

Unfortunate, as I'm trying to do the same thing.


Need Your Help

Testing Backbone Model's trigger method with Jasmine

testing backbone.js jasmine

I got a weird error when testing the trigger method of my Backbone model. Below is my code: