[antlr-interest] 2 lexers and stream filter

a_j_key a_j_key at yahoo.com
Wed Jul 2 01:34:21 PDT 2003


Hi,

I'm trying to translate Java sourcecode with JavaDocs and normal 
comments. I've looked into the examples and read documentation but I 
still cannot figure it out how to connect them together with the 
filter.

Here is the code from the main methode:

MyLexer lexer = new MyLexer(r); //input stream
lexer.setTokenObjectClass("antlr.CommonHiddenStreamToken");

TokenStreamHiddenTokenFilter filter = new TokenStreamHiddenTokenFilter
(lexer);
filter.hide(SL_COMMENT);

JavaDocLexer doclexer = new JavaDocLexer(lexer.getInputstate());
TokenStreamSelector selector = new TokenStreamSelector();
selector.addInputStream(lexer, "lexer");
selector.addInputStream(doclexer, "doclexer");
selector.select("lexer");

MyParser parser = new MyParser(selector);
parser.setASTNodeClass("antlr.CommonASTWithHiddenTokens");
parser.compilationUnit();

Could someone tell me how I can solve it? I really appreciate your 
help.

Kind regards,

AKey


 

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




More information about the antlr-interest mailing list