Sorry ,I forgot to mention, I corrected $m.end.

 

Now, I am using {tokens.replace($m.start, $m.stop, "something else");}

 

but I got java.lang.NullPointerException  error.

 

It seems $m is null.

 

 

Annie

 


 


Date: Wed, 25 Mar 2009 08:40:46 +0530
From: [email protected]
To: [email protected]
CC: [email protected]
Subject: Re: [antlr-interest] Can TokenRewriteStream be applied to rules?

There was a typo in my mail. It is $m.stop and not $m.end. Sorry :-)

And here is the documentation: 
http://www.antlr.org/api/Java/classorg_1_1antlr_1_1runtime_1_1_parser_rule_return_scope.html

:-)

YINGAnnie wrote: 


 
 
Well, I tried it ,but this time the error is : java.lang.NullPointerException.
 
Did I do something wrong?
 
Thanks,
 
 
Annie
 

 

 
> Date: Wed, 25 Mar 2009 08:22:04 +0530
> From: [email protected]
> To: [email protected]
> CC: [email protected]
> Subject: Re: [antlr-interest] Can TokenRewriteStream be applied to rules?
> 
> This will work:
> 
> variableStatement
> : VAR? variableDeclaration ( COMMA m=variableDeclaration )* semic
> {tokens.replace($m.start, $m.end, "something else");} &n bsp;
> ;
> 
> $m will be of type variableDeclaration_return which will be subclass of
> 'ParserRuleReturnScope'. $m is not Token.
> 
> 
> - Indhu
> 
> 
> YINGAnnie wrote:
> > 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 no t 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");} &n bsp;
> > ;
> >
> > So how can I replace variableDeclaration ?
> >
> > Thanks in advance.
> >
> > Annie
> > ------------------------------------------------------------------------
> > 更多热辣资讯尽在新版MSN首页! 立刻访问! <http://cn.msn.com/>
> > ------------------------------------------------------------------------
> >
> >
> > List: http://www.antlr.org/mailman/listinfo/antlr-interest
> > Unsubscribe: http://www.antlr.org/mailman/options/antlr- 
> > interest/your-email-address
> > 
> 



微软地图实时路况,为您节省的不仅仅是时间! 立即查看!

_________________________________________________________________
Live Search视频搜索,快速检索视频的利器!
http://www.live.com/?scope=video
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

Reply via email to