I am an ANTLR newbie. Here is a grammar for which I am trying to write a Visitor class.
grammar extremelysimpleexpr ;
stat : expr ;
expr : sub ;
sub : add ( '-' add )* ;
add : VAL ( '+' VAL )*
| VAL
;
VAL : [0-9]+ ;
[ \t\n\r]+ -> skip ;
Vistor.java
.........
public Integer vistAdd(ctx) {
if (some cond) {
throw new Exception()
}
}
..........
The problem is I am not able to throw exception since the generated code does not handle exceptions, the method signature does not have throws exception
in its signature. Is there any way out of it ?