[antlr-interest] ANTLR3 Nested parser

Bertalan Fodor lilypondtool at organum.hu
Mon Jan 21 15:45:25 PST 2008


Hi,

I'm creating a parser with nested parser. To make it simple I tell you 
my problem as if I was doing Javadoc parsing inside a Java parser.
So I have this in my lexer:
JAVADOC: '/**' { JavadocParser javadocParser = new JavadocParser(new 
CommonTokenStream(new JavadocLexer(this.input))); 
javadocParser.rootRule(); }

The problem is that while this code correctly switches to the Javadoc 
lexer, and parses the Javadoc parts correctly, upon returning from the 
Javadoc parsing, the character stream is not correctly positioned.

Can you help me how to achieve the nested parsing in antlr 3?

Thank you very much,

Bertalan Fodor

ps I've already asked this on this list, but got no answer, so I tried 
to make my question more simple.


More information about the antlr-interest mailing list