[antlr-interest] Checking whether an optional rule matched or not

Achint Mehta achintmehta at gmail.com
Fri Aug 21 20:34:05 PDT 2009


Hi All,

If I have a option rule in my grammar, how can I check whether that rule
matched or not.
e.g. if I have a rule in my grammar

first: (second)? third
{
    if(/* second rule matched */)
      cout<<" Second rule matched"<<endl;
}

How do I write the if condition (in C/C++) ? (I am using version 3.1.3 of
the antlr)

Thanks!

Regards,
Achint
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090821/106c4e75/attachment.html 


More information about the antlr-interest mailing list