[antlr-interest] Can subrules be set to 'n-to-m'?

Terence Parr parrt at cs.usfca.edu
Thu Mar 24 12:26:09 PST 2005


On Mar 24, 2005, at 11:07 AM, Bryan Ewbank wrote:

> Only way of which I'm aware is a counter in the loop, and a following
> semantic restriction:
>
> rule
> { int c = 0; }
> :
>      ( subrule { c++; } )*
>      {
>           if (c < N || c > M)
>           {
>              diediedie(...)
>           }
>      }
> ;

I'm thinking about this for 3.0.  Perhaps (...)+[n,m] ????

Ter

--
CS Professor & Grad Director, University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com





More information about the antlr-interest mailing list