[antlr-interest] Re: A simple question

yjargudo yjargudo at tiscali.es
Wed Aug 4 03:59:58 PDT 2004


The problem is that I want to avoid built AST.

There's another way to get the two parsings?

Yolanda

--- In antlr-interest at yahoogroups.com, "lgcraymer"  wrote:
> This is the type of situation where trees make the most sense. 
> Parsing twice is slower (significantly) and not nearly as clean as
> having two versions of a tree walker.
> 
> --Loring
> 
> 
> --- In antlr-interest at yahoogroups.com, "yjargudo"  wrote:
> > hello,
> > 
> > I need to parse a file twice. In each parsing I have to use the same
> > grammar only with different antlr actions added.
> > 
> > What I have to do?
> > 
> > I tried the following but It doesn't works
> > 
> > CPPLexer lex=new CPPLexer(anInputStream);
> > lex.setTokenObjectClass("antlr.CommonHiddenStreamToken");
> > TokenStreamHiddenTokenFilter filter=new 
> >         TokenStreamHiddenTokenFilter(lex);
> > filter.hide(CPPParser.Comment);
> > filter.hide(CPPParser.CPPComment);
> > parser = new CPPParser(filter);
> > parser.translation_unit(this);
> > 
> > 
> > CPPLexer2 lex2=new CPPLexer2(anInputStream);
> > lex2.setTokenObjectClass("antlr.CommonHiddenStreamToken");
> > TokenStreamHiddenTokenFilter filter2=new 
> >        TokenStreamHiddenTokenFilter(lex2);
> > filter2.hide(CPPParser2.Comment);
> > filter2.hide(CPPParser2.CPPComment);
> > parser2 = new CPPParser2(filter2);
> > parser2.translation_unit(this);
> > 
> > 
> > Thanks a lot,
> > 
> > Yolanda



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

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



More information about the antlr-interest mailing list