[antlr-interest] Re: A simple question
lgcraymer
lgc at mail1.jpl.nasa.gov
Tue Aug 3 13:10:11 PDT 2004
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" <yjargudo at t...> 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