[antlr-interest] Re: While using preliminary C# code generator.

micheal_jor open.zone at virgin.net
Wed Apr 24 04:46:50 PDT 2002


--- In antlr-interest at y..., "dinurp" <dinurp at y...> wrote:
> I faced 2 other problems while using th epreliminary C# code 
> generator:
> 1) new MyLexer(System.In) //did not compile

System.In is a Java-ism. In C# you need to use System.Console.In 
instead. See the CSharp examples for more info.

> 2) Option caseSensitiveLiterals=false didn't work

I am not sure why this is the case. 

> 
> Following is the list of changes I made to the code generator to 
get 
> going. They seem to set things right. Any suggestions?

> 
> Thanks,
> Dinu
> 
> 315c315
> <println("using TextReader= System.IO.TextReader;"); //DINU
> ---
> >println("using StreamReader= System.IO.StreamReader;");
> 393c393
> <println("public " + grammar.getClassName() + "(TextReader r) : this
> (new CharBuffer(r))"); //DINU
> ---
> >println("public " + grammar.getClassName() + "(StreamReader r) : 
this
> (new CharBuffer(r))");

A StreamReader is a TextReader. It's a subclass of TextReader.
CharBuffer would accept a StreamReader in any case.
No need for this change AFAICT.

> 433,439c433
> <if ( g.caseSensitiveLiterals ) //DINU
> <	println("literals = new Hashtable();");
> <else //DINU
> < 	println("literals = new Hashtable(" + //DINU
> < 	"System.Collections.CaseInsensitiveHashCodeProvider.Default," 
> + //DINU
> 
<       "System.Collections.CaseInsensitiveComparer.Default);"); //DIN
> U
> < 
> ---
> > 	println("literals = new Hashtable();");

I will try this out too dinurp. Seems it might do what you want. 

Thanks

Micheal



 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list