On 08/22/2009 01:46 AM, Mark Wright wrote:
> Hi Achint,
> 
> Maybe something like:
> 
> first
> @init { bool second_rule_matched = false; }
>   : (second)? { second_rule_matched = true; } third

    : (second { second_rule_matches = true; })? third
> {
>     if(second_rule_matched)
>       cout<<" Second rule matched"<<endl;
> }
> ;

Put the assignment action inside the optional subrule.

-- 
Kevin J. Cummings
[email protected]
[email protected]
[email protected]
Registered Linux User #1232 (http://counter.li.org)

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