[antlr-interest] Can TokenRewriteStream be applied to rules?

YINGAnnie yimm8369 at hotmail.com
Tue Mar 24 16:27:07 PDT 2009


Hi again,
 
TokenRewriteStream can only replace the declared  token, not the rule. right?
 
for example,If I want to replace VAR, it works fine, But if I want to replace variableDeclaration , the error said $a can not be resolved.
 
variableStatement
    :    m= VAR? variableDeclaration ( COMMA variableDeclaration )* semic  {tokens.replace($m, "something else");}                               
    ;
 
 
variableStatement
    :    VAR? variableDeclaration ( COMMA m=variableDeclaration )* semic  {tokens.replace($m, "something else");}                               
    ;
 
So how can I replace variableDeclaration ?
 
Thanks in advance.
 
Annie
_________________________________________________________________
Live Search视频搜索,快速检索视频的利器!
http://www.live.com/?scope=video
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090325/d144b6ea/attachment.html 


More information about the antlr-interest mailing list