Hello Jim,

Thank you very much.

I did not know how to deal with these methods.

Following your advice my rule is now:

 

repeat 

@init{  int mark_before; }

:              

   ^(REPEAT a = atom  {mark_before = input.mark();}  list = .  ) 

         {     for (int i = 0; i < $a.r ; i++)  {

                   input.rewind(mark_before);

                   list_instructions();

              } 

             input.rewind(input.index() + 1);

             // need to skip one node to reach the right position

          }                    

   ;

 

Claude

------------------------------

 

Message: 33

Date: Thu, 05 Nov 2009 08:36:05 -0800

From: "Jim Idle" <[email protected]>

Subject: Re: [antlr-interest] repeating the parsing of a subtree

To: "[email protected]" <[email protected]>

Message-ID: <[email protected]>

Content-Type: text/plain;    charset="us-ascii"

 

Should you not be using the push(index) and pop() of the
CommonTreeNodeStream or mark() and rewind()? The index() method will
give you the current location when you hit the node that you want to
repeat.

 

Jim

 


--~--~---------~--~----~------------~-------~--~----~
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