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

Prashant Deva prashant.deva at gmail.com
Thu Mar 24 13:38:12 PST 2005


Ter, 
 I think you should put this in 3.0 only if it is widely useful, which
it doesn't seem to be.
For special cases like this, people can use the code like its provided above.

PRASHANT

On Thu, 24 Mar 2005 12:26:09 -0800, Terence Parr <parrt at cs.usfca.edu> wrote:
> 
> 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