Hi,
I would like to throw my own exception (i.e. no subclass of
RecognitionException) in a tree parser rule.
>From the rule specification I would assume that this is possible via the
throws directive:
/** rule comment */
access-modifier rule-name[«arguments»] returns [«return-values»] throws
name1, name2, ...
options {...}
scope {...}
scope global-scope-name, ..., global-scope-nameN;
@init {...}
@after {...}
: «alternative-1» -> «rewrite-rule-1»
| «alternative-2» -> «rewrite-rule-2»
...
| «alternative-n» -> «rewrite-rule-n»
;
catch [«exception-arg-1»] {...}
catch [«exception-arg-2»] {...}
finally {...}
I tried the following:
crlProgram throws ValidationException
@after{
Validator v = new Validator(model);
v.validate();
}
: statement*;
I do not get an error when generating the parser but the generated code
throws only RecognitionException:
public final GrammarParser.crlProgram_return crlProgram() throws
RecognitionException {...
While I would expect:
public final CcrnGrammarParser.crlProgram_return crlProgram() throws
RecognitionException, ValidationException {...
Does anybody know how to get this work?
Thanks and best,
Chris
--
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.
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address