[antlr-interest] [bug?] Unrecognized escape sequence in Lexer .cs code(3.1b1 C# Target)

Radu Damboianu radurd at hotmail.com
Wed May 28 12:27:54 PDT 2008


I have encountered this issue as well. The correct solution for the unrecognized C# escape sequences is not prepending a @ (that would kill the correct \uffff escape sequences as well) but replacing escapes like \3 with \u0003.
 
Unfortunately, even after doing that (I wrote a small program that does the replacements above), I found that there were other problems in 3.1b1 for the C# target which makes it basically unusable in the current state.



> Date: Wed, 28 May 2008 21:03:16 +0400> From: gmdidro at gmail.com> To: antlr-interest at antlr.org> Subject: [antlr-interest] [bug?] Unrecognized escape sequence in Lexer .cs code(3.1b1 C# Target)> > Hello,> the Lexer code generated in accordance to the following grammar gets> the many errors "LPMEDLexer.cs(510,11): error CS1009: Unrecognized> escape sequence".> > It seems to me, that when ANTLR generates a code for DFA, it doesn't> use "@" for format-string representation:> > LPMEDLexer.cs> line: 510> "\3\uffff\2\10\4\uffff\4\10\1\17\1\10\1\uffff\1\21\1\uffff";> it should be> @"\3\uffff\2\10\4\uffff\4\10\1\17\1\10\1\uffff\1\21\1\uffff";> > I also have such errors in Parser and Tree Parser code, but can't> reproduce it with a small grammar.> > Is it a bug ?> ----------------------------------------------------------------------------------------------------------------------> grammar LPMED;> options{ language = CSharp; }> tokens{ CINT; CBOOL; }> > program : atom '.' ;> > atom> options> {> backtrack=true;> } : dMFID> | INT //-> ^(CINT INT)> | dBOOL //-> ^(CBOOL dBOOL)> ;> > dMFID : ',' atom | ID;> > dBOOL :> 'true'> |'false'> ;> > > INT : ('0'..'9')+ ;> WS : ( ' '> | '\t'> | '\r'> | '\n'> )+> { $channel=HIDDEN; }> ;> > fragment NEWLINE> : '\r'|'\n'> ;> > LINECOMMENT> : '//' ~('\r'|'\n')* NEWLINE {$channel=HIDDEN;}> ;> > ID : ('a'..'z' | 'A'..'Z' | '_') ('a'..'z' | 'A'..'Z' | '0'..'9' | '_')*;> ----------------------------------------------------------------------------------------------------------------------> > //ANTLR Parser Generator Version 3.1b1 (May 20, 2008) 1989-2008> //LPMEDLexer.cs(510,11): error CS1009: Unrecognized escape sequence> > Thank you
_________________________________________________________________
Change the world with e-mail. Join the i’m Initiative from Microsoft.
http://im.live.com/Messenger/IM/Join/Default.aspx?source=EML_WL_ChangeWorld
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080528/45af1bef/attachment.html 


More information about the antlr-interest mailing list