In a leex grammar file definition, is there a Regex rule for matching exactly N elements?

94 views Asked by At

Looking thru the documentation for leex, I don't see an example of matching exactly N elements, like (element){n}?

This fails:

Definitions.

ThreeFoos = foo{3}

The work around is this:

Definitions.

ThreeFoos = foofoofoo

So if I had a case where I want to match 3,000 foo's, the definition ThreeThousandFoos = foofoofoo<2,997 more foos> would get pretty unwieldy. There are hacks, like constructing increasingly large foo definitions from smaller ones (e.g. SixteenFoos = {EightFoos}{EightFoos}), but that seems silly.

1

There are 1 answers

0
juan.facorro On

It looks like the support in leex for interval ranges was commented out six years ago in Erlang/OTP and never included back again.