Xie, Linlin wrote:

Hi Jim,

 

Thanks for your previous replies. How does the fixation of the conversion to common token bug go? As I can use labels for all the sub-rules, but can’t do it to the current rule, as the example shown:

 

P: r1=rule1 r2=rule2;

 

I can use labels for rule1 and rule2, but can’t assign rule P to any label and use the label to refer to the current rule. If you can fix that as soon as possible, that’d be great!

Not sure that I can get to this quickly to be honest. Probably this week though.

 

Also this problem probably has some connection with the ADAPTER->rulePostProcessing( ADAPTER, root_0 ) function. Though having read the code for the function, I still couldn’t get a consistent picture of how it works. To me, sometimes the rulePostProcessing cuts the root_0 node, and sometimes it doesn’t for the same situation of having a single child in a rule. So I wonder if you can explain to me how exactly this function works? Or is there any signal or parameter that I can use to switch off the cut off of the root_0 (i.e. the prioritization of the tree)?  I suppose if the $tree can be used (i.e. the bug above fixed), and I attach some user data to the user pointer of the $tree, the rulePostProcessing has to do something to pass on the data when it has to cut off the root_0, right?

The post processing only cuts out nil nodes, which you cannot produce anyway. Nil nodes are the root_0, root_1 that are used to build the tree before rewrites etc. Hence there are no, or should not be any,  user pointers in the nil nodes that postProcessing stashes for re-use.

Generally, I find that when you feel the need to use $tree on its own, there is usually a better way to structure the grammar. This is not always the case but it is generally the case.

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