[antlr-interest] throws on rule declaration being ignored

Kaleb Pederson kaleb.pederson at gmail.com
Thu May 13 16:20:23 PDT 2010


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 
http://www.antlr.org/wiki/display/ANTLR3/Grammars but my exception is never 
declared so the Java compiler complains.

./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?

Thanks.

--
Kaleb Pederson

Blog - http://kalebpederson.com
Twitter - http://twitter.com/kalebpederson


More information about the antlr-interest mailing list