[antlr-interest] Re: Defining AST for the literals ( keywords )

lgcraymer lgc at mail1.jpl.nasa.gov
Fri Nov 14 11:34:56 PST 2003


If you take a look at the xxxTokenTypes files, you will find that each literal has an associated token type.  "return", for example, 
translates to LITERAL_return (or something like).  Just set an AST type for that literal in the "tokens" section and you should get the 
expected behavior.  Just watch out for the new ASTFactory initialization stuff--if you start getting weird crashes, check the 2.7.2 
release notes.

--Loring


--- In antlr-interest at yahoogroups.com, mzukowski at y... wrote:
> Oh, you're using heterogenous trees.  I haven't tried those yet, so I can't
> help much there.
> 
> Monty
> 
> -----Original Message-----
> From: gunay_arslan [mailto:gunay_arslan at y...] 
> Sent: Friday, November 14, 2003 7:23 AM
> To: antlr-interest at yahoogroups.com
> Subject: [antlr-interest] Re: Defining AST for the literals ( keywords)
> 
> What I mean is to have ( at least ) two seperate AST types. 
>  1) defined for Keywords ( literals ) 
>  2) default one ( defined via   parser setASTNodeClass(String cl) 
> method. 
> 
> If I set the AST type  using setASTNodeClass(String cl) , how I can
> set the AST type for the literal ? ( different AST type ) 
> 
> Tks. 
> 
> --- In antlr-interest at yahoogroups.com, mzukowski at y... wrote:
> > Yeah, that's done by default.
> > 
> > Monty
> > 
> > -----Original Message-----
> > From: gunay_arslan [mailto:gunay_arslan at y...] 
> > Sent: Thursday, November 13, 2003 3:58 AM
> > To: antlr-interest at yahoogroups.com
> > Subject: [antlr-interest] Defining AST for the literals ( keywords)
> > 
> > Hi ,
> > 
> > Is it possible to automatically define a concrete AST type for all
> > tokens defined in the lexer grammar ? 
> > 
> > Thank you in advance.
> > 
> > 
> > 
> > 
> >  
> > 
> > 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