MPGG Unexpected error

This is the error I get when compiling the parser.y file. It is the modified parser.y file from ManagedMyC example. The parser.y file is attached to this post.

"G:\Program Files\Visual Studio 2005 SDK\2006.09\VisualStudioIntegration\Tools\bin\MPPG.exe" Generated\parser.y > obj\Debug\parser.cs
Unexpected Error Collection was modified; enumeration operation may not execute.

Can anyone help me

Thanks, Zvonko

%using Microsoft.VisualStudio.TextManager.Interop
%namespace Babel.Parser
%valuetype LexValue
%partial

/* %expect 5 */

%union {
public string str;
}

%{
ErrorHandler handler = null;
public void SetHandler(ErrorHandler hdlr) { handler = hdlr; }
internal void CallHdlr(string msg, LexLocation val)
{
handler.AddError(msg, val.sLin, val.sCol, val.eCol - val.sCol);
}
internal TextSpan MkTSpan(LexLocation s) { return TextSpan(s.sLin, s.sCol, s.eLin, s.eCol); }

internal void Match(LexLocation lh, LexLocation rh)
{
DefineMatch(MkTSpan(lh), MkTSpan(rh));
}
%}

%token IDENTIFIER NUMBER STRING
%token ABORT ADDBRANDINGIMAGE ADDSIZE AUTOCLOSE
%token SECTION FUNCTION SECTIONEND FUNCTIONEND
%token TRUE FALSE
%token LEFT RIGHT TOP BOTTOM

%token EQ NEQ GT GTE LT LTE AMPAMP BARBAR
%token LEX_WHITE LEX_COMMENT LEX_ERROR

%left '*' '/'
%left '+' '-'

%%

Program
: Declarations
;
Declarations
: Declaration Declarations
| Declaration error { CallHdlr("Expected Declaration", @2); }
| /* empty */
;
Declaration /* might need an init action for symtab init here */
: Declaration_
;
Declaration_
: GlobalBlock
| SectionsD
| FunctionsD
;
SectionsD
: SectionD SectionsD
| SectionD error { CallHdlr("Expected Section", @2); }
| /* empty */
;
SectionD
: SECTION IDENTIFIER SectionBlock SECTIONEND
| SECTION SectionBlock SECTIONEND
;
FunctionsD
: FunctionD FunctionsD
| FunctionD error { CallHdlr("Expected Function", @2); }
| /* empty */
;
FunctionD
: FUNCTION IDENTIFIER FunctionBlock FUNCTIONEND
;
SectionBlock
: AbortD
| AddSizeD
;
FunctionBlock
: AbortD
;
GlobalBlock
: AddBrandingImageD
| AutoCloseD
;

/******************
FUNCTION DEFINITION
******************/
AbortD
: ABORT
| ABORT STRING
;
AddBrandingImageD
: ADDBRANDINGIMAGE Position NUMBER
| ADDBRANDINGIMAGE Position NUMBER NUMBER
;
AddSizeD
: ADDSIZE NUMBER
;
AutoCloseD
: AUTOCLOSE Boolean
;

/*****************
GLOBAL DEFINITIONS
*****************/
Boolean
: TRUE
| FALSE
;
Position
: LEFT
| RIGHT
| TOP
| BOTTOM
;
%%



Answer this question

MPGG Unexpected error

  • Brian Baker

    I figured out, that if I delete all instances of:
    | /* empty */

    except the one in "Declarations" section, it works like a charm...


    Does anyone know why


  • MPGG Unexpected error