[antlr-interest] Added ranges, escapes to [a-z] notation in lexer to honey badger

Peter Boughton boughtonp at gmail.com
Tue Jan 24 09:14:30 PST 2012


Is the character class syntax only for use in isolation, or should it
work within a group of alternatives?

i.e. I tried to convert a rule in the form:
	~('a'|'x'|'q'|'f'|'aaa'|'bbb'|'ccc')+

into:
	~([axqf]|'aaa'|'bbb'|'ccc')+

...but it gives a "complete surprise" error on whatever the contents
of the brackets are.


Actually, I also tested ~[abc] and ~[a-c] syntax on its own, and they also say:
	'~' came as a complete surprise to me while looking for lexer rule
elementlexer rule element".

Trying it as just [abc] and [a-c] both work as expected.


More information about the antlr-interest mailing list