[Mono-list] mcs parser bug-- fails on input without trailing new line

Dominic Cooney dominic@dcooney.com
Tue, 18 Dec 2001 21:28:50 +1000


There is a bug in the parser, in that it fails to accept input without a
trailing new line.

With the input:

class NoTrailingEOL {}

mcs.exe generates:

syntax error, expecting EOF ABSTRACT BOOL BYTE CHAR CLASS CONST DECIMAL
DELEGATE
 DOUBLE ENUM EVENT EXPLICIT EXTERN FLOAT IMPLICIT INT INTERFACE INTERNAL
LONG NA
MESPACE NEW OBJECT OVERRIDE PRIVATE PROTECTED PUBLIC READONLY SBYTE
SEALED SHORT
 STATIC STRING STRUCT UINT ULONG USHORT VIRTUAL VOID CLOSE_BRACE
OPEN_BRACKET SE
MICOLON TILDE IDENTIFIER
.\eol.cs (1,19), Token:342   : Parsing error
Mono.CSharp.yyParser.yyException: irrecoverable syntax error
   at Mono.CSharp.CSharpParser.yyparse(yyInput yyLex) in
C:\mono\mcs\mcs\-:line
839
   at Mono.CSharp.CSharpParser.parse() in
C:\mono\mcs\mcs\cs-parser.jay:line 357
3
Error: Parsing failed

Csc (framework v. 1.0.3328) accepts the program though.