[antlr-interest] ANTLR3 C# InvariantCultureIgnoreCase

Dr. Kocher, Hartmut h.kocher at pharmatechnik.de
Thu May 10 00:12:49 PDT 2007


Hi Fabio,

yes, you could still use this solution. Parsing is done in all lowercase (i.e. in your grammar you specify your keywords in all lowercase ("order"). Your identifiers will be matched as lower case. However, the original case is preserved in the token. Therefore, $Ident.text is still mixed case!

Hope this helps.

Regards
Hartmut

-----Ursprüngliche Nachricht-----
Von: antlr-interest-bounces at antlr.org [mailto:antlr-interest-bounces at antlr.org] Im Auftrag von Fabio Maulo
Gesendet: Donnerstag, 10. Mai 2007 06:26
An: antlr-interest at antlr.org
Betreff: Re: [antlr-interest] ANTLR3 C# InvariantCultureIgnoreCase

Dr. Hartmut Kocher escribió:
> Here is a solution for C#
The CaseInsensitiveStringStream work even if I need *caseSensitive* Idents ?

Ident: Letter (Letter|'0'..'9')*;

I mean...
I need that a token like ORDER='order' must match with :
Order, oRder, oRdER ... and so on
But the a word like AnIdentifier must be different than anIdentifier.

In my lenguage keyWords are CaseInsensitive but identifiers are 
CaseSensitive.

Fabio.



--------------------------------------------------------------------
Pharmatechnik GmbH & Co. KG
Münchner Straße 15
D-82319 Starnberg

Sitz der Gesellschaft: Starnberg
HRA: 64434, HRB: 66369, Amtsgericht München
Geschäftsführer: Dr. Detlef Graessner, Stephan Jörgens, Dr. Mathias Schindl


More information about the antlr-interest mailing list