[antlr-interest] Using token values in other java classes (newbie)

Nigel Sheridan-Smith nbsherid at secsme.org.au
Tue Jan 18 17:06:52 PST 2005



> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Nigel Sheridan-Smith
> Sent: Wednesday, 19 January 2005 9:38 AM
> To: 'Peter Robinson'; antlr-interest at antlr.org
> Subject: RE: [antlr-interest] Using token values in other java classes
> (newbie)
> 
> > -----Original Message-----
> > From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> > bounces at antlr.org] On Behalf Of Peter Robinson
> > Sent: Wednesday, 19 January 2005 9:11 AM
> > To: antlr-interest at antlr.org
> > Subject: [antlr-interest] Using token values in other java classes
> > (newbie)
> >
> >
> > 	STATUS_KW
> > 		s:status_type {
> > 		  myJavaObject.setStatus(Integer.parseInt(s.getText())); }
> >

Oh yeah! One other thing, you need to declare s (for saving return values):

	STATUS_KW
					{int s=0;}
		: s=status_type 	{myJavaObject.setStatus(s);};

Nigel



--
Nigel Sheridan-Smith
PhD research student

Faculty of Engineering
University of Technology, Sydney
Phone: 02 9514 7946
Fax: 02 9514 2435



More information about the antlr-interest mailing list