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

Cristian Amitroaie cristian at amiq.ro
Tue Nov 18 05:10:26 PST 2003


It seems antlr issues a warning if you redefine a literal token in the parser: 
"warning:Redefinition of token in tokens {...}: LITERAL_xxx".

Yet the token types txt files seem to be ok (same value from Lexer to Parser 
to Walker -btw, which stay in separate g files). 

Is this the specified behaviour: warn, but things work OK if only attributes 
changed?

Thank you,
Cristian

On Friday 14 November 2003 21:34, lgcraymer wrote:
> 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/


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list