Antlr lexer support for range of occurrences?
antlr, lexer
Solution
No, there is not. Not in ANTLR v3, nor in the future (now in beta) ANTLR v4.
You could use a predicate1 to (manually) count the number of chars the rule has matched, and stop matching after a predefined number.
1 What is a 'semantic predicate' in ANTLR?
Problem
Antlr's lexer supports Kleene closure (`*`) and positive Kleene closure (`+`) that indicates occurrences of a character for non-positive/positive times respectively. Is there a construct for Antlr's lexer to support a range of occurrences of a certain character like regular expressions do, like `'a' {8,16}`?