> >   
> It's difficult to see exactly from your examples of course, but I think 
> that that is what you want to do. Assuming that you are only looking for 
> C C, then a simple syntactic predicate shoudl suffice:

Right, I had forgotten about those. Up until now I had no use for them.
I guess I must reread the relevant section in the book again :-)

> 
> element : 
>   A
> | B
> | C   (   (C)=> C  {special stuff; }
>         |          {something else do nothing}
>       )
> | etc.
> 
> You can also set a flag to say whether you are in an alternation by using a 
> scope at the element_list level like this:
> 
> element_list 
> scope
> {
>   ANTLR3_BOOLEAN isAlternation;
> }
> @init
> {
>    $element_list::isAlternation = ANTLR3_FALSE;
> }
> : 
> 
> 
> ...
> 
> alternation
> 
> :  ^( ALTERNATION { $element_list:isAlternation = ANTLR3_TRUE; } group+ )
> 
> and then testing that flag.
> 
> This might not be exactly what you are looking for, but it is close I think.
Indeed it is. It gave me an idea. I can keep a flag at alternation scope
that tells me whether the alternation is  over C's only. I can then use
this in the grammar for the case C ALT C

Thanks for the insights,

Sven


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

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

Reply via email to