[antlr-interest] Stop ASTWalker on own Exception

Alexander Gängel alexander at gaengel.de
Thu Mar 27 01:30:47 PDT 2008


just for the record (if any one searches in the Archive) just inherit 
the exception form RuntimeException then it works

Alexander

Alexander Gängel schrieb:
> I throw under some circumstances in an Action an exception.
>
> Is it possible to stop the astwalker when the excetion occurs? In the 
> book the example only works when an RecognitionException occurs.
>
> The rule is like this:
> rule: Identifier
>    {
>        ...owncode...
>               if(error){
>                    throw new OwnException();
>                            }
>        }
>    ;
>    catch [OwnException e]{
>            System.err.println(e.toString());
>    }
>
>
> Thank you
> Alexander
>


More information about the antlr-interest mailing list