[antlr-interest] TokenStreamRewriteEngine class and samples of its usage
kumarsriram
sriram.kumar at nomissolutions.com
Wed May 26 19:04:49 PDT 2004
Hi,
I'm a novice to ANTLR. I'm trying to write an expression parser
(extension to the one that is provided in the ANTLR examples). I
have a case where I need to replace some input characters
("$input.xyz" should be replaced with "getXYZ()"). I figured out
that I could use TokenStreamRewriteEngine to do that. But when I use
it in my program, I end up with ClassCastExceptions whenever I
invoke nextToken() method on the engine instance. Has anyone used
TokenStreamRewriteEngine before? BTW, am I taking the correct
approach?
I have tested my Lexer and Parser and they seem to be work fine.
Have enclosed my test code.
MyLexer lexer = new MyLexer(new StringBufferInputStream(inputStr));
System.out.println("Input string is " + inputStr);
TokenStreamRewriteEngine writer = new TokenStreamRewriteEngine
(lexer);
Token t = writer.nextToken; //here's the problematic code
Any help appreciated.
Cheers,
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