[antlr-interest] v4 "Honey Badger" teaser

Gavin Lambert antlr at mirality.co.nz
Fri Dec 30 14:34:53 PST 2011


At 13:47 30/12/2011, Terence Parr wrote:
 >Could be interesting
 I was kind of hoping to 
save those `
` for
 >future use. but yes making case insensitivity 
easier it would be
 >nice.

How about a rule-level option 
"case-insensitive=true" (which could also be 
applied globally)?  (Or maybe "caseless=true" or 
something, just to make it shorter.)

This might get a little messy between "real" 
lexer rules, fragments, and embedded literals in 
parser rules, though.


On a tangentially related note, it'd be good if 
v4 fixed up the lexer-predicate problem (where 
predicates get ignored because they only apply to 
alts, not rule selection; ignoring the fact that 
lexer rules are really just alts of the implicit 
TOKENS rule) -- then you could handle Graham's 
more-complicated-character-matching cases with 
something like this:

   SPECIAL: { isSpecialThreeCharKeyword() }? . . .;

Or even:

   SPECIAL: { isSpecialKeyword() }? { emitSpecialKeyword(); };



More information about the antlr-interest mailing list