[antlr-interest] Throwing an excption in a Tree Action
mzukowski at yci.com
mzukowski at yci.com
Fri Jun 21 12:53:52 PDT 2002
It looks like I am wrong about this. You can specify other exceptions to
throw with the throws clause:
a throws MyException
: A
;
Monty
> -----Original Message-----
> From: mzukowski at yci.com [mailto:mzukowski at yci.com]
> Sent: Thursday, June 20, 2002 8:37 AM
> To: antlr-interest at yahoogroups.com
> Subject: RE: [antlr-interest] Throwing an excption in a Tree Action
>
>
> No, you currently can't specify specific Exceptions that a
> rule can throw.
> You have to make sure that the exceptions you throw are subclasses of
> RecognitionException.
>
> Monty
>
> > -----Original Message-----
> > From: Niall Gormley [mailto:ngormley at hotmail.com]
> > Sent: Thursday, June 20, 2002 8:35 AM
> > To: antlr-interest at yahoogroups.com
> > Subject: [antlr-interest] Throwing an excption in a Tree Action
> >
> >
> > Hi,
> >
> > I would like to throw an exception in an action as per the
> > grammar below. Is
> > it possible to specify that it should throw my
> > InvalidAssignmentException
> > exception in the tree grammar?
> >
> > Thanks Again,
> > Niall
> >
> > assignmentExpression
> > : #( ASSIGN i:IDENT p:primaryExpression)
> > {
> > System.out.println("Checking Assignment Statement:
> > "+#i.getText()
> > +" "+#p.getText());
> > if(#i.getType()!=#p.getType())
> > {
> > throw new InvalidAssignmentException("Cannot assign"
> > + #i.getType() + " to " + #p.getType());
> > }
> > else
> > {
> > System.out.println("Assingment OK");
> > }
> > }
> > ;
> >
> > _________________________________________________________________
> > Send and receive Hotmail on your mobile device:
http://mobile.msn.com
>
>
>
>
> Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list