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

Петров Александр gmdidro at gmail.com
Wed May 28 10:03:16 PDT 2008


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


More information about the antlr-interest mailing list