[antlr-interest] Equivalent of TOKEN{x,y}

Kaleb Pederson kaleb.pederson at gmail.com
Wed Nov 11 11:35:21 PST 2009


Is there an easy way to enforce in the grammar that a lexical token must be present a certain number of times?

For example, with TOKEN{x,y} as you might see in an extended regular expression, it would require that TOKEN be present at minimum x times and at most y times.

I know I can easily check during semantic analysis, but in this case I'd prefer to do so at the grammar level.

Thanks.

--
Kaleb Pederson

Blog - http://kalebpederson.com
Twitter - http://twitter.com/kalebpederson


More information about the antlr-interest mailing list