[antlr-interest] Fixed width field

Joel Shellman jshellman at gmail.com
Wed Aug 1 01:10:13 PDT 2007


Is there a way to specify a number of matches of something?

So,

rule : CHAR;

would match 1 char,

rule2 : CHAR+;

is 1 or more,

rule3 : CHAR*;

is 0 or more, but what if I want to specify a certain number, like:

rule4: CHAR CHAR CHAR;

I know this would do 3 times, but it's rather unwieldy especially if I
had 36 or 150 or something like that. Is there some syntax to specify
to match n times?

Thanks.


More information about the antlr-interest mailing list