[antlr-interest] leafnode value

Monty Zukowski monty at codetransform.com
Sun Oct 10 13:56:41 PDT 2004


You should use #procid instead of just procid.

Also, why don't you just set the text of the node directly?  
#procid.setText("Hello");

ANTLR & Java Consultant -- http://www.codetransform.com
ANSI C/GCC transformation toolkit -- 
http://www.codetransform.com/gcc.html
Embrace the Decay -- http://www.codetransform.com/EmbraceDecay.html

On Oct 10, 2004, at 1:20 PM, ManimuthuLakshmi Pitchaikani wrote:

> Hi,
>  
> I want to change the value of the leafnode in the result tree.
>  
> The code goes here:
>
> stop_stmt!
>
> {
>
> String strText = "";
>
>
> CommonAST ast;
>
>  AST[] ast1 = new AST[2]; // ast1[2];
>
>
> }
>
> : #(stp:STOP procId:PROCID
>
> {
>
> ast1[0] = (CommonAST) procId;
>
> System.out.println("stop procid="+ast1[0]);
>
>
>  ast1[0].setText("Hello");
>
>
> procId = (CommonAST) ast1[0];
>
> System.out.println("changed procid="+procId.getText());
>
>
> }
>
> )
>
>  {
>
> #stop_stmt = #([STOP,"./killproc"], procId);
>
>
> System.out.println("stop_stmt procId="+procId.getText());
>
>
> }
>
> ;
>
> Am getting the value of procId as "Hello" only in System output.  But 
> in the tree, the value is not getting changed.  Why?
>
> Thanks.
>
> Best Regards,
>
> Lakshmi
>
>  
>  
>  
>  
>
> Do you Yahoo!?
> vote.yahoo.com - Register online to vote today!
>
>  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 the Yahoo! Terms of 
> Service.
>
>  
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 2682 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20041010/f478d983/attachment.bin


More information about the antlr-interest mailing list