[antlr-interest] How to create a case-insensitive parser using theC target?

Vaclav Barta vbar at comp.cz
Wed Jul 11 22:17:52 PDT 2007


On Tuesday 10 July 2007 21:28, Jim Idle wrote:
> I have added case insensitivity to the C input streams, but this is not
> part of the currently shipping library and I am still testing it so have
> not yet submitted it (probably today though, especially is someone wants
...
> The method call installs a version of LA() that always returns toupper()
> on the input char (which means that it does not alter the actual input
> stream, but will MATCH in upper case. You then specify all your keywords
> in upper case only.
Just a nitpick: for case-insensitive matching by conversion to a single case, 
lower case is AFAIK preferred, because not all Unicode characters have upper 
case (German sharp s is probably the most common example; I'm not sure 
whether all Unicode characters have lower case, but if there are 
counter-examples, they should at least be more exotic)...

	Bye
		Vasek


More information about the antlr-interest mailing list