number of repetitions
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   cris_tian
Posted On:   Thursday, March 11, 2010 02:58 PM

Hello, I'm a newbie to ANTLR and I need a way to specify a number of repetitions for some chracters in the input.

I need for example to be able to parse what I would write in regexp as \d{1,3} or \d{5,60}

All I could find is something like

DIGIT(DIGIT(DIGIT)?)?

e.g - to be able to match 1 to 3 digits
this is ok for small inputs, but not for long ones

I'm surprised that there is no way to achieve this by using {x,y}

Is there an elegant way of doing this?
And maybe without generating code to do it?

Thanks a lot
Chris

About | Sitemap | Contact