diff --git a/data/templates/project/CSharp/SharpDevelopAddin.xpt b/data/templates/project/CSharp/SharpDevelopAddin.xpt index 3c9981811d..2103066e11 100644 --- a/data/templates/project/CSharp/SharpDevelopAddin.xpt +++ b/data/templates/project/CSharp/SharpDevelopAddin.xpt @@ -33,127 +33,20 @@ - - - - - - - - + author = "${USER}" + url = "" + description = "TODO: Put description here"> + + + + + + -]]> - - - - - - - - - - - - - - - - - - - - - - - - - - -]]> - - ("test").Click += ButtonClick; - } - - void ButtonClick(object sender, EventArgs e) - { - System.Windows.Forms.MessageBox.Show("The button was clicked!"); - } -} -} -]]> - - -/// Description of the pad content -/// -public class TestPad : AbstractPadContent -{ - MyUserControl ctl; - - /// - /// Creates a new TestPad object - /// - public TestPad() - { - ctl = new MyUserControl(); - } - - /// - /// The representing the pad - /// - public override Control Control { - get { - return ctl; - } - } - - /// - /// Refreshes the pad - /// - public override void RedrawContent() - { - // TODO: Refresh the whole pad control here, renew all resource strings whatever - // Note that you do not need to recreate the control. - } - - /// - /// Cleans up all used resources - /// - public override void Dispose() - { - ctl.Dispose(); - } -} -} ]]> diff --git a/src/Libraries/NRefactory/Project/Src/Ast/AbstractNode.cs b/src/Libraries/NRefactory/Project/Src/Ast/AbstractNode.cs index c6179019cc..fab65038cf 100644 --- a/src/Libraries/NRefactory/Project/Src/Ast/AbstractNode.cs +++ b/src/Libraries/NRefactory/Project/Src/Ast/AbstractNode.cs @@ -15,38 +15,12 @@ namespace ICSharpCode.NRefactory.Ast { public abstract class AbstractNode : INode { - INode parent; List children = new List(); - Location startLocation; - Location endLocation; - - public INode Parent { - get { - return parent; - } - set { - parent = value; - } - } - - public Location StartLocation { - get { - return startLocation; - } - set { - startLocation = value; - } - } - - public Location EndLocation { - get { - return endLocation; - } - set { - endLocation = value; - } - } + public INode Parent { get; set; } + public Location StartLocation { get; set; } + public Location EndLocation { get; set; } + public object UserData { get; set; } public List Children { get { diff --git a/src/Libraries/NRefactory/Project/Src/Ast/INode.cs b/src/Libraries/NRefactory/Project/Src/Ast/INode.cs index 82376e8708..df036d2c20 100644 --- a/src/Libraries/NRefactory/Project/Src/Ast/INode.cs +++ b/src/Libraries/NRefactory/Project/Src/Ast/INode.cs @@ -31,6 +31,11 @@ namespace ICSharpCode.NRefactory.Ast set; } + object UserData { + get; + set; + } + /// /// Visits all children /// diff --git a/src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs b/src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs index de873b2695..53075e9286 100644 --- a/src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs +++ b/src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs @@ -190,70 +190,70 @@ m, attributes); } void Qualident( -#line 456 "cs.ATG" +#line 458 "cs.ATG" out string qualident) { Identifier(); -#line 458 "cs.ATG" +#line 460 "cs.ATG" qualidentBuilder.Length = 0; qualidentBuilder.Append(t.val); while ( -#line 459 "cs.ATG" +#line 461 "cs.ATG" DotAndIdent()) { Expect(15); Identifier(); -#line 459 "cs.ATG" +#line 461 "cs.ATG" qualidentBuilder.Append('.'); qualidentBuilder.Append(t.val); } -#line 462 "cs.ATG" +#line 464 "cs.ATG" qualident = qualidentBuilder.ToString(); } void NonArrayType( -#line 569 "cs.ATG" +#line 573 "cs.ATG" out TypeReference type) { -#line 571 "cs.ATG" +#line 575 "cs.ATG" string name; int pointer = 0; type = null; if (StartOf(4)) { ClassType( -#line 576 "cs.ATG" +#line 580 "cs.ATG" out type, false); } else if (StartOf(5)) { SimpleType( -#line 577 "cs.ATG" +#line 581 "cs.ATG" out name); -#line 577 "cs.ATG" +#line 581 "cs.ATG" type = new TypeReference(name); } else if (la.kind == 123) { lexer.NextToken(); Expect(6); -#line 578 "cs.ATG" +#line 582 "cs.ATG" pointer = 1; type = new TypeReference("void"); } else SynErr(147); if (la.kind == 12) { NullableQuestionMark( -#line 581 "cs.ATG" +#line 585 "cs.ATG" ref type); } while ( -#line 583 "cs.ATG" +#line 587 "cs.ATG" IsPointer()) { Expect(6); -#line 584 "cs.ATG" +#line 588 "cs.ATG" ++pointer; } -#line 586 "cs.ATG" +#line 590 "cs.ATG" if (type != null) { type.PointerNestingLevel = pointer; } } @@ -444,63 +444,73 @@ out expr); } void Expr( -#line 1670 "cs.ATG" +#line 1716 "cs.ATG" out Expression expr) { -#line 1671 "cs.ATG" +#line 1717 "cs.ATG" expr = null; Expression expr1 = null, expr2 = null; AssignmentOperatorType op; + +#line 1719 "cs.ATG" + Location startLocation = la.Location; UnaryExpr( -#line 1673 "cs.ATG" +#line 1720 "cs.ATG" out expr); if (StartOf(7)) { AssignmentOperator( -#line 1676 "cs.ATG" +#line 1723 "cs.ATG" out op); Expr( -#line 1676 "cs.ATG" +#line 1723 "cs.ATG" out expr1); -#line 1676 "cs.ATG" +#line 1723 "cs.ATG" expr = new AssignmentExpression(expr, op, expr1); } else if ( -#line 1677 "cs.ATG" +#line 1724 "cs.ATG" la.kind == Tokens.GreaterThan && Peek(1).kind == Tokens.GreaterEqual) { AssignmentOperator( -#line 1678 "cs.ATG" +#line 1725 "cs.ATG" out op); Expr( -#line 1678 "cs.ATG" +#line 1725 "cs.ATG" out expr1); -#line 1678 "cs.ATG" +#line 1725 "cs.ATG" expr = new AssignmentExpression(expr, op, expr1); } else if (StartOf(8)) { ConditionalOrExpr( -#line 1680 "cs.ATG" +#line 1727 "cs.ATG" ref expr); if (la.kind == 13) { lexer.NextToken(); Expr( -#line 1681 "cs.ATG" +#line 1728 "cs.ATG" out expr1); -#line 1681 "cs.ATG" +#line 1728 "cs.ATG" expr = new BinaryOperatorExpression(expr, BinaryOperatorType.NullCoalescing, expr1); } if (la.kind == 12) { lexer.NextToken(); Expr( -#line 1682 "cs.ATG" +#line 1729 "cs.ATG" out expr1); Expect(9); Expr( -#line 1682 "cs.ATG" +#line 1729 "cs.ATG" out expr2); -#line 1682 "cs.ATG" +#line 1729 "cs.ATG" expr = new ConditionalExpression(expr, expr1, expr2); } } else SynErr(150); + +#line 1732 "cs.ATG" + if (expr != null) { + expr.StartLocation = startLocation; + expr.EndLocation = t.EndLocation; + } + } void AttributeSection( @@ -574,76 +584,76 @@ out attribute); } void TypeModifier( -#line 656 "cs.ATG" +#line 660 "cs.ATG" ModifierList m) { switch (la.kind) { case 89: { lexer.NextToken(); -#line 658 "cs.ATG" +#line 662 "cs.ATG" m.Add(Modifiers.New, t.Location); break; } case 98: { lexer.NextToken(); -#line 659 "cs.ATG" +#line 663 "cs.ATG" m.Add(Modifiers.Public, t.Location); break; } case 97: { lexer.NextToken(); -#line 660 "cs.ATG" +#line 664 "cs.ATG" m.Add(Modifiers.Protected, t.Location); break; } case 84: { lexer.NextToken(); -#line 661 "cs.ATG" +#line 665 "cs.ATG" m.Add(Modifiers.Internal, t.Location); break; } case 96: { lexer.NextToken(); -#line 662 "cs.ATG" +#line 666 "cs.ATG" m.Add(Modifiers.Private, t.Location); break; } case 119: { lexer.NextToken(); -#line 663 "cs.ATG" +#line 667 "cs.ATG" m.Add(Modifiers.Unsafe, t.Location); break; } case 49: { lexer.NextToken(); -#line 664 "cs.ATG" +#line 668 "cs.ATG" m.Add(Modifiers.Abstract, t.Location); break; } case 103: { lexer.NextToken(); -#line 665 "cs.ATG" +#line 669 "cs.ATG" m.Add(Modifiers.Sealed, t.Location); break; } case 107: { lexer.NextToken(); -#line 666 "cs.ATG" +#line 670 "cs.ATG" m.Add(Modifiers.Static, t.Location); break; } case 126: { lexer.NextToken(); -#line 667 "cs.ATG" +#line 671 "cs.ATG" m.Add(Modifiers.Partial, t.Location); break; } @@ -709,18 +719,18 @@ templates); lexer.NextToken(); } -#line 366 "cs.ATG" +#line 368 "cs.ATG" newType.EndLocation = t.Location; compilationUnit.BlockEnd(); } else if (StartOf(9)) { -#line 369 "cs.ATG" +#line 371 "cs.ATG" m.Check(Modifiers.StructsInterfacesEnumsDelegates); if (la.kind == 109) { lexer.NextToken(); -#line 370 "cs.ATG" +#line 372 "cs.ATG" TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes); templates = newType.Templates; newType.StartLocation = m.GetDeclarationLocation(t.Location); @@ -730,42 +740,42 @@ templates); Identifier(); -#line 377 "cs.ATG" +#line 379 "cs.ATG" newType.Name = t.val; if (la.kind == 23) { TypeParameterList( -#line 380 "cs.ATG" +#line 382 "cs.ATG" templates); } if (la.kind == 9) { StructInterfaces( -#line 382 "cs.ATG" +#line 384 "cs.ATG" out names); -#line 382 "cs.ATG" +#line 384 "cs.ATG" newType.BaseTypes = names; } while (la.kind == 127) { TypeParameterConstraintsClause( -#line 385 "cs.ATG" +#line 387 "cs.ATG" templates); } -#line 388 "cs.ATG" +#line 390 "cs.ATG" newType.BodyStartLocation = t.EndLocation; StructBody(); if (la.kind == 11) { lexer.NextToken(); } -#line 390 "cs.ATG" +#line 392 "cs.ATG" newType.EndLocation = t.Location; compilationUnit.BlockEnd(); } else if (la.kind == 83) { lexer.NextToken(); -#line 394 "cs.ATG" +#line 396 "cs.ATG" TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes); templates = newType.Templates; compilationUnit.AddChild(newType); @@ -775,42 +785,42 @@ templates); Identifier(); -#line 401 "cs.ATG" +#line 403 "cs.ATG" newType.Name = t.val; if (la.kind == 23) { TypeParameterList( -#line 404 "cs.ATG" +#line 406 "cs.ATG" templates); } if (la.kind == 9) { InterfaceBase( -#line 406 "cs.ATG" +#line 408 "cs.ATG" out names); -#line 406 "cs.ATG" +#line 408 "cs.ATG" newType.BaseTypes = names; } while (la.kind == 127) { TypeParameterConstraintsClause( -#line 409 "cs.ATG" +#line 411 "cs.ATG" templates); } -#line 411 "cs.ATG" +#line 413 "cs.ATG" newType.BodyStartLocation = t.EndLocation; InterfaceBody(); if (la.kind == 11) { lexer.NextToken(); } -#line 413 "cs.ATG" +#line 415 "cs.ATG" newType.EndLocation = t.Location; compilationUnit.BlockEnd(); } else if (la.kind == 68) { lexer.NextToken(); -#line 417 "cs.ATG" +#line 419 "cs.ATG" TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes); compilationUnit.AddChild(newType); compilationUnit.BlockStart(newType); @@ -819,79 +829,79 @@ templates); Identifier(); -#line 423 "cs.ATG" +#line 425 "cs.ATG" newType.Name = t.val; if (la.kind == 9) { lexer.NextToken(); IntegralType( -#line 424 "cs.ATG" +#line 426 "cs.ATG" out name); -#line 424 "cs.ATG" +#line 426 "cs.ATG" newType.BaseTypes.Add(new TypeReference(name)); } -#line 426 "cs.ATG" +#line 428 "cs.ATG" newType.BodyStartLocation = t.EndLocation; EnumBody(); if (la.kind == 11) { lexer.NextToken(); } -#line 428 "cs.ATG" +#line 430 "cs.ATG" newType.EndLocation = t.Location; compilationUnit.BlockEnd(); } else { lexer.NextToken(); -#line 432 "cs.ATG" +#line 434 "cs.ATG" DelegateDeclaration delegateDeclr = new DelegateDeclaration(m.Modifier, attributes); templates = delegateDeclr.Templates; delegateDeclr.StartLocation = m.GetDeclarationLocation(t.Location); if ( -#line 436 "cs.ATG" +#line 438 "cs.ATG" NotVoidPointer()) { Expect(123); -#line 436 "cs.ATG" +#line 438 "cs.ATG" delegateDeclr.ReturnType = new TypeReference("void", 0, null); } else if (StartOf(10)) { Type( -#line 437 "cs.ATG" +#line 439 "cs.ATG" out type); -#line 437 "cs.ATG" +#line 439 "cs.ATG" delegateDeclr.ReturnType = type; } else SynErr(152); Identifier(); -#line 439 "cs.ATG" +#line 441 "cs.ATG" delegateDeclr.Name = t.val; if (la.kind == 23) { TypeParameterList( -#line 442 "cs.ATG" +#line 444 "cs.ATG" templates); } Expect(20); if (StartOf(11)) { FormalParameterList( -#line 444 "cs.ATG" +#line 446 "cs.ATG" p); -#line 444 "cs.ATG" +#line 446 "cs.ATG" delegateDeclr.Parameters = p; } Expect(21); while (la.kind == 127) { TypeParameterConstraintsClause( -#line 448 "cs.ATG" +#line 450 "cs.ATG" templates); } Expect(11); -#line 450 "cs.ATG" +#line 452 "cs.ATG" delegateDeclr.EndLocation = t.Location; compilationUnit.AddChild(delegateDeclr); @@ -900,87 +910,87 @@ templates); } void TypeParameterList( -#line 2217 "cs.ATG" +#line 2281 "cs.ATG" List templates) { -#line 2219 "cs.ATG" +#line 2283 "cs.ATG" AttributeSection section; List attributes = new List(); Expect(23); while (la.kind == 18) { AttributeSection( -#line 2223 "cs.ATG" +#line 2287 "cs.ATG" out section); -#line 2223 "cs.ATG" +#line 2287 "cs.ATG" attributes.Add(section); } Identifier(); -#line 2224 "cs.ATG" +#line 2288 "cs.ATG" templates.Add(new TemplateDefinition(t.val, attributes)); while (la.kind == 14) { lexer.NextToken(); while (la.kind == 18) { AttributeSection( -#line 2225 "cs.ATG" +#line 2289 "cs.ATG" out section); -#line 2225 "cs.ATG" +#line 2289 "cs.ATG" attributes.Add(section); } Identifier(); -#line 2226 "cs.ATG" +#line 2290 "cs.ATG" templates.Add(new TemplateDefinition(t.val, attributes)); } Expect(22); } void ClassBase( -#line 465 "cs.ATG" +#line 467 "cs.ATG" out List names) { -#line 467 "cs.ATG" +#line 469 "cs.ATG" TypeReference typeRef; names = new List(); Expect(9); ClassType( -#line 471 "cs.ATG" +#line 473 "cs.ATG" out typeRef, false); -#line 471 "cs.ATG" +#line 473 "cs.ATG" if (typeRef != null) { names.Add(typeRef); } while (la.kind == 14) { lexer.NextToken(); TypeName( -#line 472 "cs.ATG" +#line 474 "cs.ATG" out typeRef, false); -#line 472 "cs.ATG" +#line 474 "cs.ATG" if (typeRef != null) { names.Add(typeRef); } } } void TypeParameterConstraintsClause( -#line 2230 "cs.ATG" +#line 2294 "cs.ATG" List templates) { -#line 2231 "cs.ATG" +#line 2295 "cs.ATG" string name = ""; TypeReference type; Expect(127); Identifier(); -#line 2234 "cs.ATG" +#line 2298 "cs.ATG" name = t.val; Expect(9); TypeParameterConstraintsClauseBase( -#line 2236 "cs.ATG" +#line 2300 "cs.ATG" out type); -#line 2237 "cs.ATG" +#line 2301 "cs.ATG" TemplateDefinition td = null; foreach (TemplateDefinition d in templates) { if (d.Name == name) { @@ -993,10 +1003,10 @@ out type); while (la.kind == 14) { lexer.NextToken(); TypeParameterConstraintsClauseBase( -#line 2246 "cs.ATG" +#line 2310 "cs.ATG" out type); -#line 2247 "cs.ATG" +#line 2311 "cs.ATG" td = null; foreach (TemplateDefinition d in templates) { if (d.Name == name) { @@ -1011,215 +1021,217 @@ out type); void ClassBody() { -#line 476 "cs.ATG" +#line 478 "cs.ATG" AttributeSection section; while (StartOf(12)) { -#line 478 "cs.ATG" +#line 480 "cs.ATG" List attributes = new List(); ModifierList m = new ModifierList(); + while (!(StartOf(13))) {SynErr(154); lexer.NextToken(); } while (la.kind == 18) { AttributeSection( -#line 481 "cs.ATG" +#line 484 "cs.ATG" out section); -#line 481 "cs.ATG" +#line 484 "cs.ATG" attributes.Add(section); } MemberModifiers( -#line 482 "cs.ATG" +#line 485 "cs.ATG" m); ClassMemberDecl( -#line 483 "cs.ATG" +#line 486 "cs.ATG" m, attributes); } } void StructInterfaces( -#line 487 "cs.ATG" +#line 490 "cs.ATG" out List names) { -#line 489 "cs.ATG" +#line 492 "cs.ATG" TypeReference typeRef; names = new List(); Expect(9); TypeName( -#line 493 "cs.ATG" +#line 496 "cs.ATG" out typeRef, false); -#line 493 "cs.ATG" +#line 496 "cs.ATG" if (typeRef != null) { names.Add(typeRef); } while (la.kind == 14) { lexer.NextToken(); TypeName( -#line 494 "cs.ATG" +#line 497 "cs.ATG" out typeRef, false); -#line 494 "cs.ATG" +#line 497 "cs.ATG" if (typeRef != null) { names.Add(typeRef); } } } void StructBody() { -#line 498 "cs.ATG" +#line 501 "cs.ATG" AttributeSection section; Expect(16); - while (StartOf(13)) { + while (StartOf(14)) { -#line 501 "cs.ATG" +#line 504 "cs.ATG" List attributes = new List(); ModifierList m = new ModifierList(); while (la.kind == 18) { AttributeSection( -#line 504 "cs.ATG" +#line 507 "cs.ATG" out section); -#line 504 "cs.ATG" +#line 507 "cs.ATG" attributes.Add(section); } MemberModifiers( -#line 505 "cs.ATG" +#line 508 "cs.ATG" m); StructMemberDecl( -#line 506 "cs.ATG" +#line 509 "cs.ATG" m, attributes); } Expect(17); } void InterfaceBase( -#line 511 "cs.ATG" +#line 514 "cs.ATG" out List names) { -#line 513 "cs.ATG" +#line 516 "cs.ATG" TypeReference typeRef; names = new List(); Expect(9); TypeName( -#line 517 "cs.ATG" +#line 520 "cs.ATG" out typeRef, false); -#line 517 "cs.ATG" +#line 520 "cs.ATG" if (typeRef != null) { names.Add(typeRef); } while (la.kind == 14) { lexer.NextToken(); TypeName( -#line 518 "cs.ATG" +#line 521 "cs.ATG" out typeRef, false); -#line 518 "cs.ATG" +#line 521 "cs.ATG" if (typeRef != null) { names.Add(typeRef); } } } void InterfaceBody() { Expect(16); - while (StartOf(14)) { + while (StartOf(15)) { + while (!(StartOf(16))) {SynErr(155); lexer.NextToken(); } InterfaceMemberDecl(); } Expect(17); } void IntegralType( -#line 678 "cs.ATG" +#line 682 "cs.ATG" out string name) { -#line 678 "cs.ATG" +#line 682 "cs.ATG" name = ""; switch (la.kind) { case 102: { lexer.NextToken(); -#line 680 "cs.ATG" +#line 684 "cs.ATG" name = "sbyte"; break; } case 54: { lexer.NextToken(); -#line 681 "cs.ATG" +#line 685 "cs.ATG" name = "byte"; break; } case 104: { lexer.NextToken(); -#line 682 "cs.ATG" +#line 686 "cs.ATG" name = "short"; break; } case 120: { lexer.NextToken(); -#line 683 "cs.ATG" +#line 687 "cs.ATG" name = "ushort"; break; } case 82: { lexer.NextToken(); -#line 684 "cs.ATG" +#line 688 "cs.ATG" name = "int"; break; } case 116: { lexer.NextToken(); -#line 685 "cs.ATG" +#line 689 "cs.ATG" name = "uint"; break; } case 87: { lexer.NextToken(); -#line 686 "cs.ATG" +#line 690 "cs.ATG" name = "long"; break; } case 117: { lexer.NextToken(); -#line 687 "cs.ATG" +#line 691 "cs.ATG" name = "ulong"; break; } case 57: { lexer.NextToken(); -#line 688 "cs.ATG" +#line 692 "cs.ATG" name = "char"; break; } - default: SynErr(154); break; + default: SynErr(156); break; } } void EnumBody() { -#line 527 "cs.ATG" +#line 530 "cs.ATG" FieldDeclaration f; Expect(16); - if (StartOf(15)) { + if (StartOf(17)) { EnumMemberDecl( -#line 530 "cs.ATG" +#line 533 "cs.ATG" out f); -#line 530 "cs.ATG" +#line 533 "cs.ATG" compilationUnit.AddChild(f); while ( -#line 531 "cs.ATG" +#line 534 "cs.ATG" NotFinalComma()) { Expect(14); EnumMemberDecl( -#line 532 "cs.ATG" +#line 535 "cs.ATG" out f); -#line 532 "cs.ATG" +#line 535 "cs.ATG" compilationUnit.AddChild(f); } if (la.kind == 14) { @@ -1230,36 +1242,36 @@ out f); } void Type( -#line 537 "cs.ATG" +#line 541 "cs.ATG" out TypeReference type) { TypeWithRestriction( -#line 539 "cs.ATG" +#line 543 "cs.ATG" out type, true, false); } void FormalParameterList( -#line 600 "cs.ATG" +#line 604 "cs.ATG" List parameter) { -#line 603 "cs.ATG" +#line 607 "cs.ATG" ParameterDeclarationExpression p; AttributeSection section; List attributes = new List(); while (la.kind == 18) { AttributeSection( -#line 608 "cs.ATG" +#line 612 "cs.ATG" out section); -#line 608 "cs.ATG" +#line 612 "cs.ATG" attributes.Add(section); } - if (StartOf(16)) { + if (StartOf(18)) { FixedParameter( -#line 610 "cs.ATG" +#line 614 "cs.ATG" out p); -#line 610 "cs.ATG" +#line 614 "cs.ATG" bool paramsFound = false; p.Attributes = attributes; parameter.Add(p); @@ -1267,96 +1279,96 @@ out p); while (la.kind == 14) { lexer.NextToken(); -#line 615 "cs.ATG" +#line 619 "cs.ATG" attributes = new List(); if (paramsFound) Error("params array must be at end of parameter list"); while (la.kind == 18) { AttributeSection( -#line 616 "cs.ATG" +#line 620 "cs.ATG" out section); -#line 616 "cs.ATG" +#line 620 "cs.ATG" attributes.Add(section); } - if (StartOf(16)) { + if (StartOf(18)) { FixedParameter( -#line 618 "cs.ATG" +#line 622 "cs.ATG" out p); -#line 618 "cs.ATG" +#line 622 "cs.ATG" p.Attributes = attributes; parameter.Add(p); } else if (la.kind == 95) { ParameterArray( -#line 619 "cs.ATG" +#line 623 "cs.ATG" out p); -#line 619 "cs.ATG" +#line 623 "cs.ATG" paramsFound = true; p.Attributes = attributes; parameter.Add(p); - } else SynErr(155); + } else SynErr(157); } } else if (la.kind == 95) { ParameterArray( -#line 622 "cs.ATG" +#line 626 "cs.ATG" out p); -#line 622 "cs.ATG" +#line 626 "cs.ATG" p.Attributes = attributes; parameter.Add(p); - } else SynErr(156); + } else SynErr(158); } void ClassType( -#line 670 "cs.ATG" +#line 674 "cs.ATG" out TypeReference typeRef, bool canBeUnbound) { -#line 671 "cs.ATG" +#line 675 "cs.ATG" TypeReference r; typeRef = null; - if (StartOf(17)) { + if (StartOf(19)) { TypeName( -#line 673 "cs.ATG" +#line 677 "cs.ATG" out r, canBeUnbound); -#line 673 "cs.ATG" +#line 677 "cs.ATG" typeRef = r; } else if (la.kind == 91) { lexer.NextToken(); -#line 674 "cs.ATG" +#line 678 "cs.ATG" typeRef = new TypeReference("object"); } else if (la.kind == 108) { lexer.NextToken(); -#line 675 "cs.ATG" +#line 679 "cs.ATG" typeRef = new TypeReference("string"); - } else SynErr(157); + } else SynErr(159); } void TypeName( -#line 2160 "cs.ATG" +#line 2224 "cs.ATG" out TypeReference typeRef, bool canBeUnbound) { -#line 2161 "cs.ATG" +#line 2225 "cs.ATG" List typeArguments = null; string alias = null; string qualident; if ( -#line 2166 "cs.ATG" +#line 2230 "cs.ATG" IdentAndDoubleColon()) { Identifier(); -#line 2167 "cs.ATG" +#line 2231 "cs.ATG" alias = t.val; Expect(10); } Qualident( -#line 2170 "cs.ATG" +#line 2234 "cs.ATG" out qualident); if (la.kind == 23) { TypeArgumentList( -#line 2171 "cs.ATG" +#line 2235 "cs.ATG" out typeArguments, canBeUnbound); } -#line 2173 "cs.ATG" +#line 2237 "cs.ATG" if (alias == null) { typeRef = new TypeReference(qualident, typeArguments); } else if (alias == "global") { @@ -1367,140 +1379,140 @@ out typeArguments, canBeUnbound); } while ( -#line 2182 "cs.ATG" +#line 2246 "cs.ATG" DotAndIdent()) { Expect(15); -#line 2183 "cs.ATG" +#line 2247 "cs.ATG" typeArguments = null; Qualident( -#line 2184 "cs.ATG" +#line 2248 "cs.ATG" out qualident); if (la.kind == 23) { TypeArgumentList( -#line 2185 "cs.ATG" +#line 2249 "cs.ATG" out typeArguments, canBeUnbound); } -#line 2186 "cs.ATG" +#line 2250 "cs.ATG" typeRef = new InnerClassTypeReference(typeRef, qualident, typeArguments); } } void MemberModifiers( -#line 691 "cs.ATG" +#line 695 "cs.ATG" ModifierList m) { - while (StartOf(18)) { + while (StartOf(20)) { switch (la.kind) { case 49: { lexer.NextToken(); -#line 694 "cs.ATG" +#line 698 "cs.ATG" m.Add(Modifiers.Abstract, t.Location); break; } case 71: { lexer.NextToken(); -#line 695 "cs.ATG" +#line 699 "cs.ATG" m.Add(Modifiers.Extern, t.Location); break; } case 84: { lexer.NextToken(); -#line 696 "cs.ATG" +#line 700 "cs.ATG" m.Add(Modifiers.Internal, t.Location); break; } case 89: { lexer.NextToken(); -#line 697 "cs.ATG" +#line 701 "cs.ATG" m.Add(Modifiers.New, t.Location); break; } case 94: { lexer.NextToken(); -#line 698 "cs.ATG" +#line 702 "cs.ATG" m.Add(Modifiers.Override, t.Location); break; } case 96: { lexer.NextToken(); -#line 699 "cs.ATG" +#line 703 "cs.ATG" m.Add(Modifiers.Private, t.Location); break; } case 97: { lexer.NextToken(); -#line 700 "cs.ATG" +#line 704 "cs.ATG" m.Add(Modifiers.Protected, t.Location); break; } case 98: { lexer.NextToken(); -#line 701 "cs.ATG" +#line 705 "cs.ATG" m.Add(Modifiers.Public, t.Location); break; } case 99: { lexer.NextToken(); -#line 702 "cs.ATG" +#line 706 "cs.ATG" m.Add(Modifiers.ReadOnly, t.Location); break; } case 103: { lexer.NextToken(); -#line 703 "cs.ATG" +#line 707 "cs.ATG" m.Add(Modifiers.Sealed, t.Location); break; } case 107: { lexer.NextToken(); -#line 704 "cs.ATG" +#line 708 "cs.ATG" m.Add(Modifiers.Static, t.Location); break; } case 74: { lexer.NextToken(); -#line 705 "cs.ATG" +#line 709 "cs.ATG" m.Add(Modifiers.Fixed, t.Location); break; } case 119: { lexer.NextToken(); -#line 706 "cs.ATG" +#line 710 "cs.ATG" m.Add(Modifiers.Unsafe, t.Location); break; } case 122: { lexer.NextToken(); -#line 707 "cs.ATG" +#line 711 "cs.ATG" m.Add(Modifiers.Virtual, t.Location); break; } case 124: { lexer.NextToken(); -#line 708 "cs.ATG" +#line 712 "cs.ATG" m.Add(Modifiers.Volatile, t.Location); break; } case 126: { lexer.NextToken(); -#line 709 "cs.ATG" +#line 713 "cs.ATG" m.Add(Modifiers.Partial, t.Location); break; } @@ -1509,23 +1521,23 @@ ModifierList m) { } void ClassMemberDecl( -#line 1018 "cs.ATG" +#line 1022 "cs.ATG" ModifierList m, List attributes) { -#line 1019 "cs.ATG" +#line 1023 "cs.ATG" Statement stmt = null; - if (StartOf(19)) { + if (StartOf(21)) { StructMemberDecl( -#line 1021 "cs.ATG" +#line 1025 "cs.ATG" m, attributes); } else if (la.kind == 27) { -#line 1022 "cs.ATG" +#line 1026 "cs.ATG" m.Check(Modifiers.Destructors); Location startPos = t.Location; lexer.NextToken(); Identifier(); -#line 1023 "cs.ATG" +#line 1027 "cs.ATG" DestructorDeclaration d = new DestructorDeclaration(t.val, m.Modifier, attributes); d.Modifier = m.Modifier; d.StartLocation = m.GetDeclarationLocation(startPos); @@ -1533,28 +1545,28 @@ m, attributes); Expect(20); Expect(21); -#line 1027 "cs.ATG" +#line 1031 "cs.ATG" d.EndLocation = t.EndLocation; if (la.kind == 16) { Block( -#line 1027 "cs.ATG" +#line 1031 "cs.ATG" out stmt); } else if (la.kind == 11) { lexer.NextToken(); - } else SynErr(158); + } else SynErr(160); -#line 1028 "cs.ATG" +#line 1032 "cs.ATG" d.Body = (BlockStatement)stmt; compilationUnit.AddChild(d); - } else SynErr(159); + } else SynErr(161); } void StructMemberDecl( -#line 713 "cs.ATG" +#line 717 "cs.ATG" ModifierList m, List attributes) { -#line 715 "cs.ATG" +#line 719 "cs.ATG" string qualident = null; TypeReference type; Expression expr; @@ -1567,18 +1579,18 @@ ModifierList m, List attributes) { if (la.kind == 60) { -#line 726 "cs.ATG" +#line 730 "cs.ATG" m.Check(Modifiers.Constants); lexer.NextToken(); -#line 727 "cs.ATG" +#line 731 "cs.ATG" Location startPos = t.Location; Type( -#line 728 "cs.ATG" +#line 732 "cs.ATG" out type); Identifier(); -#line 728 "cs.ATG" +#line 732 "cs.ATG" FieldDeclaration fd = new FieldDeclaration(attributes, type, m.Modifier | Modifiers.Const); fd.StartLocation = m.GetDeclarationLocation(startPos); VariableDeclaration f = new VariableDeclaration(t.val); @@ -1586,78 +1598,78 @@ out type); Expect(3); Expr( -#line 733 "cs.ATG" +#line 737 "cs.ATG" out expr); -#line 733 "cs.ATG" +#line 737 "cs.ATG" f.Initializer = expr; while (la.kind == 14) { lexer.NextToken(); Identifier(); -#line 734 "cs.ATG" +#line 738 "cs.ATG" f = new VariableDeclaration(t.val); fd.Fields.Add(f); Expect(3); Expr( -#line 737 "cs.ATG" +#line 741 "cs.ATG" out expr); -#line 737 "cs.ATG" +#line 741 "cs.ATG" f.Initializer = expr; } Expect(11); -#line 738 "cs.ATG" +#line 742 "cs.ATG" fd.EndLocation = t.EndLocation; compilationUnit.AddChild(fd); } else if ( -#line 742 "cs.ATG" +#line 746 "cs.ATG" NotVoidPointer()) { -#line 742 "cs.ATG" +#line 746 "cs.ATG" m.Check(Modifiers.PropertysEventsMethods); Expect(123); -#line 743 "cs.ATG" +#line 747 "cs.ATG" Location startPos = t.Location; if ( -#line 744 "cs.ATG" +#line 748 "cs.ATG" IsExplicitInterfaceImplementation()) { TypeName( -#line 745 "cs.ATG" +#line 749 "cs.ATG" out explicitInterface, false); -#line 746 "cs.ATG" +#line 750 "cs.ATG" if (la.kind != Tokens.Dot || Peek(1).kind != Tokens.This) { qualident = TypeReference.StripLastIdentifierFromType(ref explicitInterface); } - } else if (StartOf(17)) { + } else if (StartOf(19)) { Identifier(); -#line 749 "cs.ATG" +#line 753 "cs.ATG" qualident = t.val; - } else SynErr(160); + } else SynErr(162); if (la.kind == 23) { TypeParameterList( -#line 752 "cs.ATG" +#line 756 "cs.ATG" templates); } Expect(20); if (la.kind == 111) { lexer.NextToken(); -#line 755 "cs.ATG" +#line 759 "cs.ATG" isExtensionMethod = true; /* C# 3.0 */ } if (StartOf(11)) { FormalParameterList( -#line 756 "cs.ATG" +#line 760 "cs.ATG" p); } Expect(21); -#line 757 "cs.ATG" +#line 761 "cs.ATG" MethodDeclaration methodDeclaration = new MethodDeclaration { Name = qualident, Modifier = m.Modifier, @@ -1676,28 +1688,28 @@ p); while (la.kind == 127) { TypeParameterConstraintsClause( -#line 775 "cs.ATG" +#line 779 "cs.ATG" templates); } if (la.kind == 16) { Block( -#line 777 "cs.ATG" +#line 781 "cs.ATG" out stmt); } else if (la.kind == 11) { lexer.NextToken(); - } else SynErr(161); + } else SynErr(163); -#line 777 "cs.ATG" +#line 781 "cs.ATG" compilationUnit.BlockEnd(); methodDeclaration.Body = (BlockStatement)stmt; } else if (la.kind == 69) { -#line 781 "cs.ATG" +#line 785 "cs.ATG" m.Check(Modifiers.PropertysEventsMethods); lexer.NextToken(); -#line 783 "cs.ATG" +#line 787 "cs.ATG" EventDeclaration eventDecl = new EventDeclaration { Modifier = m.Modifier, Attributes = attributes, @@ -1709,113 +1721,113 @@ out stmt); EventRemoveRegion removeBlock = null; Type( -#line 793 "cs.ATG" +#line 797 "cs.ATG" out type); -#line 793 "cs.ATG" +#line 797 "cs.ATG" eventDecl.TypeReference = type; if ( -#line 794 "cs.ATG" +#line 798 "cs.ATG" IsExplicitInterfaceImplementation()) { TypeName( -#line 795 "cs.ATG" +#line 799 "cs.ATG" out explicitInterface, false); -#line 796 "cs.ATG" +#line 800 "cs.ATG" qualident = TypeReference.StripLastIdentifierFromType(ref explicitInterface); -#line 797 "cs.ATG" +#line 801 "cs.ATG" eventDecl.InterfaceImplementations.Add(new InterfaceImplementation(explicitInterface, qualident)); - } else if (StartOf(17)) { + } else if (StartOf(19)) { Identifier(); -#line 799 "cs.ATG" +#line 803 "cs.ATG" qualident = t.val; - } else SynErr(162); + } else SynErr(164); -#line 801 "cs.ATG" +#line 805 "cs.ATG" eventDecl.Name = qualident; eventDecl.EndLocation = t.EndLocation; if (la.kind == 3) { lexer.NextToken(); Expr( -#line 802 "cs.ATG" +#line 806 "cs.ATG" out expr); -#line 802 "cs.ATG" +#line 806 "cs.ATG" eventDecl.Initializer = expr; } if (la.kind == 16) { lexer.NextToken(); -#line 803 "cs.ATG" +#line 807 "cs.ATG" eventDecl.BodyStart = t.Location; EventAccessorDecls( -#line 804 "cs.ATG" +#line 808 "cs.ATG" out addBlock, out removeBlock); Expect(17); -#line 805 "cs.ATG" +#line 809 "cs.ATG" eventDecl.BodyEnd = t.EndLocation; } if (la.kind == 11) { lexer.NextToken(); } -#line 808 "cs.ATG" +#line 812 "cs.ATG" compilationUnit.BlockEnd(); eventDecl.AddRegion = addBlock; eventDecl.RemoveRegion = removeBlock; } else if ( -#line 814 "cs.ATG" +#line 818 "cs.ATG" IdentAndLPar()) { -#line 814 "cs.ATG" +#line 818 "cs.ATG" m.Check(Modifiers.Constructors | Modifiers.StaticConstructors); Identifier(); -#line 815 "cs.ATG" +#line 819 "cs.ATG" string name = t.val; Location startPos = t.Location; Expect(20); if (StartOf(11)) { -#line 815 "cs.ATG" +#line 819 "cs.ATG" m.Check(Modifiers.Constructors); FormalParameterList( -#line 816 "cs.ATG" +#line 820 "cs.ATG" p); } Expect(21); -#line 818 "cs.ATG" +#line 822 "cs.ATG" ConstructorInitializer init = null; if (la.kind == 9) { -#line 819 "cs.ATG" +#line 823 "cs.ATG" m.Check(Modifiers.Constructors); ConstructorInitializer( -#line 820 "cs.ATG" +#line 824 "cs.ATG" out init); } -#line 822 "cs.ATG" +#line 826 "cs.ATG" ConstructorDeclaration cd = new ConstructorDeclaration(name, m.Modifier, p, init, attributes); cd.StartLocation = startPos; cd.EndLocation = t.EndLocation; if (la.kind == 16) { Block( -#line 827 "cs.ATG" +#line 831 "cs.ATG" out stmt); } else if (la.kind == 11) { lexer.NextToken(); - } else SynErr(163); + } else SynErr(165); -#line 827 "cs.ATG" +#line 831 "cs.ATG" cd.Body = (BlockStatement)stmt; compilationUnit.AddChild(cd); } else if (la.kind == 70 || la.kind == 80) { -#line 830 "cs.ATG" +#line 834 "cs.ATG" m.Check(Modifiers.Operators); if (m.isNone) Error("at least one modifier must be set"); bool isImplicit = true; @@ -1824,45 +1836,45 @@ out stmt); if (la.kind == 80) { lexer.NextToken(); -#line 835 "cs.ATG" +#line 839 "cs.ATG" startPos = t.Location; } else { lexer.NextToken(); -#line 835 "cs.ATG" +#line 839 "cs.ATG" isImplicit = false; startPos = t.Location; } Expect(92); Type( -#line 836 "cs.ATG" +#line 840 "cs.ATG" out type); -#line 836 "cs.ATG" +#line 840 "cs.ATG" TypeReference operatorType = type; Expect(20); Type( -#line 837 "cs.ATG" +#line 841 "cs.ATG" out type); Identifier(); -#line 837 "cs.ATG" +#line 841 "cs.ATG" string varName = t.val; Expect(21); -#line 838 "cs.ATG" +#line 842 "cs.ATG" Location endPos = t.Location; if (la.kind == 16) { Block( -#line 839 "cs.ATG" +#line 843 "cs.ATG" out stmt); } else if (la.kind == 11) { lexer.NextToken(); -#line 839 "cs.ATG" +#line 843 "cs.ATG" stmt = null; - } else SynErr(164); + } else SynErr(166); -#line 842 "cs.ATG" +#line 846 "cs.ATG" List parameters = new List(); parameters.Add(new ParameterDeclarationExpression(type, varName)); OperatorDeclaration operatorDeclaration = new OperatorDeclaration { @@ -1877,63 +1889,63 @@ out stmt); }; compilationUnit.AddChild(operatorDeclaration); - } else if (StartOf(20)) { + } else if (StartOf(22)) { TypeDecl( -#line 859 "cs.ATG" +#line 863 "cs.ATG" m, attributes); } else if (StartOf(10)) { Type( -#line 861 "cs.ATG" +#line 865 "cs.ATG" out type); -#line 861 "cs.ATG" +#line 865 "cs.ATG" Location startPos = t.Location; if (la.kind == 92) { -#line 863 "cs.ATG" +#line 867 "cs.ATG" OverloadableOperatorType op; m.Check(Modifiers.Operators); if (m.isNone) Error("at least one modifier must be set"); lexer.NextToken(); OverloadableOperator( -#line 867 "cs.ATG" +#line 871 "cs.ATG" out op); -#line 867 "cs.ATG" +#line 871 "cs.ATG" TypeReference firstType, secondType = null; string secondName = null; Expect(20); Type( -#line 868 "cs.ATG" +#line 872 "cs.ATG" out firstType); Identifier(); -#line 868 "cs.ATG" +#line 872 "cs.ATG" string firstName = t.val; if (la.kind == 14) { lexer.NextToken(); Type( -#line 869 "cs.ATG" +#line 873 "cs.ATG" out secondType); Identifier(); -#line 869 "cs.ATG" +#line 873 "cs.ATG" secondName = t.val; } else if (la.kind == 21) { - } else SynErr(165); + } else SynErr(167); -#line 877 "cs.ATG" +#line 881 "cs.ATG" Location endPos = t.Location; Expect(21); if (la.kind == 16) { Block( -#line 878 "cs.ATG" +#line 882 "cs.ATG" out stmt); } else if (la.kind == 11) { lexer.NextToken(); - } else SynErr(166); + } else SynErr(168); -#line 880 "cs.ATG" +#line 884 "cs.ATG" List parameters = new List(); parameters.Add(new ParameterDeclarationExpression(firstType, firstName)); if (secondType != null) { @@ -1952,75 +1964,75 @@ out stmt); compilationUnit.AddChild(operatorDeclaration); } else if ( -#line 899 "cs.ATG" +#line 903 "cs.ATG" IsVarDecl()) { -#line 900 "cs.ATG" +#line 904 "cs.ATG" m.Check(Modifiers.Fields); FieldDeclaration fd = new FieldDeclaration(attributes, type, m.Modifier); fd.StartLocation = m.GetDeclarationLocation(startPos); if ( -#line 904 "cs.ATG" +#line 908 "cs.ATG" m.Contains(Modifiers.Fixed)) { VariableDeclarator( -#line 905 "cs.ATG" +#line 909 "cs.ATG" variableDeclarators); Expect(18); Expr( -#line 907 "cs.ATG" +#line 911 "cs.ATG" out expr); -#line 907 "cs.ATG" +#line 911 "cs.ATG" if (variableDeclarators.Count > 0) variableDeclarators[variableDeclarators.Count-1].FixedArrayInitialization = expr; Expect(19); while (la.kind == 14) { lexer.NextToken(); VariableDeclarator( -#line 911 "cs.ATG" +#line 915 "cs.ATG" variableDeclarators); Expect(18); Expr( -#line 913 "cs.ATG" +#line 917 "cs.ATG" out expr); -#line 913 "cs.ATG" +#line 917 "cs.ATG" if (variableDeclarators.Count > 0) variableDeclarators[variableDeclarators.Count-1].FixedArrayInitialization = expr; Expect(19); } - } else if (StartOf(17)) { + } else if (StartOf(19)) { VariableDeclarator( -#line 918 "cs.ATG" +#line 922 "cs.ATG" variableDeclarators); while (la.kind == 14) { lexer.NextToken(); VariableDeclarator( -#line 919 "cs.ATG" +#line 923 "cs.ATG" variableDeclarators); } - } else SynErr(167); + } else SynErr(169); Expect(11); -#line 921 "cs.ATG" +#line 925 "cs.ATG" fd.EndLocation = t.EndLocation; fd.Fields = variableDeclarators; compilationUnit.AddChild(fd); } else if (la.kind == 111) { -#line 924 "cs.ATG" +#line 928 "cs.ATG" m.Check(Modifiers.Indexers); lexer.NextToken(); Expect(18); FormalParameterList( -#line 925 "cs.ATG" +#line 929 "cs.ATG" p); Expect(19); -#line 925 "cs.ATG" +#line 929 "cs.ATG" Location endLocation = t.EndLocation; Expect(16); -#line 926 "cs.ATG" +#line 930 "cs.ATG" IndexerDeclaration indexer = new IndexerDeclaration(type, p, m.Modifier, attributes); indexer.StartLocation = startPos; indexer.EndLocation = endLocation; @@ -2029,64 +2041,64 @@ p); PropertySetRegion setRegion; AccessorDecls( -#line 933 "cs.ATG" +#line 937 "cs.ATG" out getRegion, out setRegion); Expect(17); -#line 934 "cs.ATG" +#line 938 "cs.ATG" indexer.BodyEnd = t.EndLocation; indexer.GetRegion = getRegion; indexer.SetRegion = setRegion; compilationUnit.AddChild(indexer); } else if ( -#line 939 "cs.ATG" +#line 943 "cs.ATG" IsIdentifierToken(la)) { if ( -#line 940 "cs.ATG" +#line 944 "cs.ATG" IsExplicitInterfaceImplementation()) { TypeName( -#line 941 "cs.ATG" +#line 945 "cs.ATG" out explicitInterface, false); -#line 942 "cs.ATG" +#line 946 "cs.ATG" if (la.kind != Tokens.Dot || Peek(1).kind != Tokens.This) { qualident = TypeReference.StripLastIdentifierFromType(ref explicitInterface); } - } else if (StartOf(17)) { + } else if (StartOf(19)) { Identifier(); -#line 945 "cs.ATG" +#line 949 "cs.ATG" qualident = t.val; - } else SynErr(168); + } else SynErr(170); -#line 947 "cs.ATG" +#line 951 "cs.ATG" Location qualIdentEndLocation = t.EndLocation; if (la.kind == 16 || la.kind == 20 || la.kind == 23) { if (la.kind == 20 || la.kind == 23) { -#line 951 "cs.ATG" +#line 955 "cs.ATG" m.Check(Modifiers.PropertysEventsMethods); if (la.kind == 23) { TypeParameterList( -#line 953 "cs.ATG" +#line 957 "cs.ATG" templates); } Expect(20); if (la.kind == 111) { lexer.NextToken(); -#line 955 "cs.ATG" +#line 959 "cs.ATG" isExtensionMethod = true; } if (StartOf(11)) { FormalParameterList( -#line 956 "cs.ATG" +#line 960 "cs.ATG" p); } Expect(21); -#line 958 "cs.ATG" +#line 962 "cs.ATG" MethodDeclaration methodDeclaration = new MethodDeclaration { Name = qualident, Modifier = m.Modifier, @@ -2104,23 +2116,23 @@ p); while (la.kind == 127) { TypeParameterConstraintsClause( -#line 973 "cs.ATG" +#line 977 "cs.ATG" templates); } if (la.kind == 16) { Block( -#line 974 "cs.ATG" +#line 978 "cs.ATG" out stmt); } else if (la.kind == 11) { lexer.NextToken(); - } else SynErr(169); + } else SynErr(171); -#line 974 "cs.ATG" +#line 978 "cs.ATG" methodDeclaration.Body = (BlockStatement)stmt; } else { lexer.NextToken(); -#line 977 "cs.ATG" +#line 981 "cs.ATG" PropertyDeclaration pDecl = new PropertyDeclaration(qualident, type, m.Modifier, attributes); if (explicitInterface != null) pDecl.InterfaceImplementations.Add(new InterfaceImplementation(explicitInterface, qualident)); @@ -2131,11 +2143,11 @@ out stmt); PropertySetRegion setRegion; AccessorDecls( -#line 986 "cs.ATG" +#line 990 "cs.ATG" out getRegion, out setRegion); Expect(17); -#line 988 "cs.ATG" +#line 992 "cs.ATG" pDecl.GetRegion = getRegion; pDecl.SetRegion = setRegion; pDecl.BodyEnd = t.EndLocation; @@ -2144,17 +2156,17 @@ out getRegion, out setRegion); } } else if (la.kind == 15) { -#line 996 "cs.ATG" +#line 1000 "cs.ATG" m.Check(Modifiers.Indexers); lexer.NextToken(); Expect(111); Expect(18); FormalParameterList( -#line 997 "cs.ATG" +#line 1001 "cs.ATG" p); Expect(19); -#line 998 "cs.ATG" +#line 1002 "cs.ATG" IndexerDeclaration indexer = new IndexerDeclaration(type, p, m.Modifier, attributes); indexer.StartLocation = m.GetDeclarationLocation(startPos); indexer.EndLocation = t.EndLocation; @@ -2165,28 +2177,28 @@ p); Expect(16); -#line 1006 "cs.ATG" +#line 1010 "cs.ATG" Location bodyStart = t.Location; AccessorDecls( -#line 1007 "cs.ATG" +#line 1011 "cs.ATG" out getRegion, out setRegion); Expect(17); -#line 1008 "cs.ATG" +#line 1012 "cs.ATG" indexer.BodyStart = bodyStart; indexer.BodyEnd = t.EndLocation; indexer.GetRegion = getRegion; indexer.SetRegion = setRegion; compilationUnit.AddChild(indexer); - } else SynErr(170); - } else SynErr(171); - } else SynErr(172); + } else SynErr(172); + } else SynErr(173); + } else SynErr(174); } void InterfaceMemberDecl() { -#line 1035 "cs.ATG" +#line 1039 "cs.ATG" TypeReference type; AttributeSection section; @@ -2201,49 +2213,49 @@ out getRegion, out setRegion); while (la.kind == 18) { AttributeSection( -#line 1048 "cs.ATG" +#line 1052 "cs.ATG" out section); -#line 1048 "cs.ATG" +#line 1052 "cs.ATG" attributes.Add(section); } if (la.kind == 89) { lexer.NextToken(); -#line 1049 "cs.ATG" +#line 1053 "cs.ATG" mod = Modifiers.New; startLocation = t.Location; } if ( -#line 1052 "cs.ATG" +#line 1056 "cs.ATG" NotVoidPointer()) { Expect(123); -#line 1052 "cs.ATG" +#line 1056 "cs.ATG" if (startLocation.X == -1) startLocation = t.Location; Identifier(); -#line 1053 "cs.ATG" +#line 1057 "cs.ATG" name = t.val; if (la.kind == 23) { TypeParameterList( -#line 1054 "cs.ATG" +#line 1058 "cs.ATG" templates); } Expect(20); if (StartOf(11)) { FormalParameterList( -#line 1055 "cs.ATG" +#line 1059 "cs.ATG" parameters); } Expect(21); while (la.kind == 127) { TypeParameterConstraintsClause( -#line 1056 "cs.ATG" +#line 1060 "cs.ATG" templates); } Expect(11); -#line 1058 "cs.ATG" +#line 1062 "cs.ATG" MethodDeclaration md = new MethodDeclaration { Name = name, Modifier = mod, TypeReference = new TypeReference("void"), Parameters = parameters, Attributes = attributes, Templates = templates, @@ -2251,40 +2263,40 @@ templates); }; compilationUnit.AddChild(md); - } else if (StartOf(21)) { + } else if (StartOf(23)) { if (StartOf(10)) { Type( -#line 1066 "cs.ATG" +#line 1070 "cs.ATG" out type); -#line 1066 "cs.ATG" +#line 1070 "cs.ATG" if (startLocation.X == -1) startLocation = t.Location; - if (StartOf(17)) { + if (StartOf(19)) { Identifier(); -#line 1068 "cs.ATG" +#line 1072 "cs.ATG" name = t.val; Location qualIdentEndLocation = t.EndLocation; if (la.kind == 20 || la.kind == 23) { if (la.kind == 23) { TypeParameterList( -#line 1072 "cs.ATG" +#line 1076 "cs.ATG" templates); } Expect(20); if (StartOf(11)) { FormalParameterList( -#line 1073 "cs.ATG" +#line 1077 "cs.ATG" parameters); } Expect(21); while (la.kind == 127) { TypeParameterConstraintsClause( -#line 1075 "cs.ATG" +#line 1079 "cs.ATG" templates); } Expect(11); -#line 1076 "cs.ATG" +#line 1080 "cs.ATG" MethodDeclaration md = new MethodDeclaration { Name = name, Modifier = mod, TypeReference = type, Parameters = parameters, Attributes = attributes, Templates = templates, @@ -2294,56 +2306,56 @@ templates); } else if (la.kind == 16) { -#line 1084 "cs.ATG" +#line 1088 "cs.ATG" PropertyDeclaration pd = new PropertyDeclaration(name, type, mod, attributes); compilationUnit.AddChild(pd); lexer.NextToken(); -#line 1085 "cs.ATG" +#line 1089 "cs.ATG" Location bodyStart = t.Location; InterfaceAccessors( -#line 1085 "cs.ATG" +#line 1089 "cs.ATG" out getBlock, out setBlock); Expect(17); -#line 1085 "cs.ATG" +#line 1089 "cs.ATG" pd.GetRegion = getBlock; pd.SetRegion = setBlock; pd.StartLocation = startLocation; pd.EndLocation = qualIdentEndLocation; pd.BodyStart = bodyStart; pd.BodyEnd = t.EndLocation; - } else SynErr(173); + } else SynErr(175); } else if (la.kind == 111) { lexer.NextToken(); Expect(18); FormalParameterList( -#line 1088 "cs.ATG" +#line 1092 "cs.ATG" parameters); Expect(19); -#line 1088 "cs.ATG" +#line 1092 "cs.ATG" Location bracketEndLocation = t.EndLocation; -#line 1088 "cs.ATG" +#line 1092 "cs.ATG" IndexerDeclaration id = new IndexerDeclaration(type, parameters, mod, attributes); compilationUnit.AddChild(id); Expect(16); -#line 1089 "cs.ATG" +#line 1093 "cs.ATG" Location bodyStart = t.Location; InterfaceAccessors( -#line 1089 "cs.ATG" +#line 1093 "cs.ATG" out getBlock, out setBlock); Expect(17); -#line 1089 "cs.ATG" +#line 1093 "cs.ATG" id.GetRegion = getBlock; id.SetRegion = setBlock; id.StartLocation = startLocation; id.EndLocation = bracketEndLocation; id.BodyStart = bodyStart; id.BodyEnd = t.EndLocation; - } else SynErr(174); + } else SynErr(176); } else { lexer.NextToken(); -#line 1092 "cs.ATG" +#line 1096 "cs.ATG" if (startLocation.X == -1) startLocation = t.Location; Type( -#line 1093 "cs.ATG" +#line 1097 "cs.ATG" out type); Identifier(); -#line 1094 "cs.ATG" +#line 1098 "cs.ATG" EventDeclaration ed = new EventDeclaration { TypeReference = type, Name = t.val, Modifier = mod, Attributes = attributes }; @@ -2351,17 +2363,17 @@ out type); Expect(11); -#line 1099 "cs.ATG" +#line 1103 "cs.ATG" ed.StartLocation = startLocation; ed.EndLocation = t.EndLocation; } - } else SynErr(175); + } else SynErr(177); } void EnumMemberDecl( -#line 1104 "cs.ATG" +#line 1108 "cs.ATG" out FieldDeclaration f) { -#line 1106 "cs.ATG" +#line 1110 "cs.ATG" Expression expr = null; List attributes = new List(); AttributeSection section = null; @@ -2369,15 +2381,15 @@ out FieldDeclaration f) { while (la.kind == 18) { AttributeSection( -#line 1112 "cs.ATG" +#line 1116 "cs.ATG" out section); -#line 1112 "cs.ATG" +#line 1116 "cs.ATG" attributes.Add(section); } Identifier(); -#line 1113 "cs.ATG" +#line 1117 "cs.ATG" f = new FieldDeclaration(attributes); varDecl = new VariableDeclaration(t.val); f.Fields.Add(varDecl); @@ -2386,78 +2398,78 @@ out section); if (la.kind == 3) { lexer.NextToken(); Expr( -#line 1118 "cs.ATG" +#line 1122 "cs.ATG" out expr); -#line 1118 "cs.ATG" +#line 1122 "cs.ATG" varDecl.Initializer = expr; } } void TypeWithRestriction( -#line 542 "cs.ATG" +#line 546 "cs.ATG" out TypeReference type, bool allowNullable, bool canBeUnbound) { -#line 544 "cs.ATG" +#line 548 "cs.ATG" string name; int pointer = 0; type = null; if (StartOf(4)) { ClassType( -#line 549 "cs.ATG" +#line 553 "cs.ATG" out type, canBeUnbound); } else if (StartOf(5)) { SimpleType( -#line 550 "cs.ATG" +#line 554 "cs.ATG" out name); -#line 550 "cs.ATG" +#line 554 "cs.ATG" type = new TypeReference(name); } else if (la.kind == 123) { lexer.NextToken(); Expect(6); -#line 551 "cs.ATG" +#line 555 "cs.ATG" pointer = 1; type = new TypeReference("void"); - } else SynErr(176); + } else SynErr(178); -#line 552 "cs.ATG" +#line 556 "cs.ATG" List r = new List(); if ( -#line 554 "cs.ATG" +#line 558 "cs.ATG" allowNullable && la.kind == Tokens.Question) { NullableQuestionMark( -#line 554 "cs.ATG" +#line 558 "cs.ATG" ref type); } while ( -#line 556 "cs.ATG" +#line 560 "cs.ATG" IsPointerOrDims()) { -#line 556 "cs.ATG" +#line 560 "cs.ATG" int i = 0; if (la.kind == 6) { lexer.NextToken(); -#line 557 "cs.ATG" +#line 561 "cs.ATG" ++pointer; } else if (la.kind == 18) { lexer.NextToken(); while (la.kind == 14) { lexer.NextToken(); -#line 558 "cs.ATG" +#line 562 "cs.ATG" ++i; } Expect(19); -#line 558 "cs.ATG" +#line 562 "cs.ATG" r.Add(i); - } else SynErr(177); + } else SynErr(179); } -#line 561 "cs.ATG" +#line 565 "cs.ATG" if (type != null) { type.RankSpecifier = r.ToArray(); type.PointerNestingLevel = pointer; @@ -2466,57 +2478,57 @@ IsPointerOrDims()) { } void SimpleType( -#line 589 "cs.ATG" +#line 593 "cs.ATG" out string name) { -#line 590 "cs.ATG" +#line 594 "cs.ATG" name = String.Empty; - if (StartOf(22)) { + if (StartOf(24)) { IntegralType( -#line 592 "cs.ATG" +#line 596 "cs.ATG" out name); } else if (la.kind == 75) { lexer.NextToken(); -#line 593 "cs.ATG" +#line 597 "cs.ATG" name = "float"; } else if (la.kind == 66) { lexer.NextToken(); -#line 594 "cs.ATG" +#line 598 "cs.ATG" name = "double"; } else if (la.kind == 62) { lexer.NextToken(); -#line 595 "cs.ATG" +#line 599 "cs.ATG" name = "decimal"; } else if (la.kind == 52) { lexer.NextToken(); -#line 596 "cs.ATG" +#line 600 "cs.ATG" name = "bool"; - } else SynErr(178); + } else SynErr(180); } void NullableQuestionMark( -#line 2191 "cs.ATG" +#line 2255 "cs.ATG" ref TypeReference typeRef) { -#line 2192 "cs.ATG" +#line 2256 "cs.ATG" List typeArguments = new List(1); Expect(12); -#line 2196 "cs.ATG" +#line 2260 "cs.ATG" if (typeRef != null) typeArguments.Add(typeRef); typeRef = new TypeReference("System.Nullable", typeArguments); } void FixedParameter( -#line 626 "cs.ATG" +#line 630 "cs.ATG" out ParameterDeclarationExpression p) { -#line 628 "cs.ATG" +#line 632 "cs.ATG" TypeReference type; ParameterModifiers mod = ParameterModifiers.In; Location start = t.Location; @@ -2525,93 +2537,93 @@ out ParameterDeclarationExpression p) { if (la.kind == 100) { lexer.NextToken(); -#line 634 "cs.ATG" +#line 638 "cs.ATG" mod = ParameterModifiers.Ref; } else { lexer.NextToken(); -#line 635 "cs.ATG" +#line 639 "cs.ATG" mod = ParameterModifiers.Out; } } Type( -#line 637 "cs.ATG" +#line 641 "cs.ATG" out type); Identifier(); -#line 637 "cs.ATG" +#line 641 "cs.ATG" p = new ParameterDeclarationExpression(type, t.val, mod); p.StartLocation = start; p.EndLocation = t.Location; } void ParameterArray( -#line 640 "cs.ATG" +#line 644 "cs.ATG" out ParameterDeclarationExpression p) { -#line 641 "cs.ATG" +#line 645 "cs.ATG" TypeReference type; Expect(95); Type( -#line 643 "cs.ATG" +#line 647 "cs.ATG" out type); Identifier(); -#line 643 "cs.ATG" +#line 647 "cs.ATG" p = new ParameterDeclarationExpression(type, t.val, ParameterModifiers.Params); } void AccessorModifiers( -#line 646 "cs.ATG" +#line 650 "cs.ATG" out ModifierList m) { -#line 647 "cs.ATG" +#line 651 "cs.ATG" m = new ModifierList(); if (la.kind == 96) { lexer.NextToken(); -#line 649 "cs.ATG" +#line 653 "cs.ATG" m.Add(Modifiers.Private, t.Location); } else if (la.kind == 97) { lexer.NextToken(); -#line 650 "cs.ATG" +#line 654 "cs.ATG" m.Add(Modifiers.Protected, t.Location); if (la.kind == 84) { lexer.NextToken(); -#line 651 "cs.ATG" +#line 655 "cs.ATG" m.Add(Modifiers.Internal, t.Location); } } else if (la.kind == 84) { lexer.NextToken(); -#line 652 "cs.ATG" +#line 656 "cs.ATG" m.Add(Modifiers.Internal, t.Location); if (la.kind == 97) { lexer.NextToken(); -#line 653 "cs.ATG" +#line 657 "cs.ATG" m.Add(Modifiers.Protected, t.Location); } - } else SynErr(179); + } else SynErr(181); } void Block( -#line 1237 "cs.ATG" +#line 1241 "cs.ATG" out Statement stmt) { Expect(16); -#line 1239 "cs.ATG" +#line 1243 "cs.ATG" BlockStatement blockStmt = new BlockStatement(); blockStmt.StartLocation = t.Location; compilationUnit.BlockStart(blockStmt); if (!ParseMethodBodies) lexer.SkipCurrentBlock(0); - while (StartOf(23)) { + while (StartOf(25)) { Statement(); } Expect(17); -#line 1246 "cs.ATG" +#line 1250 "cs.ATG" stmt = blockStmt; blockStmt.EndLocation = t.EndLocation; compilationUnit.BlockEnd(); @@ -2619,10 +2631,10 @@ out Statement stmt) { } void EventAccessorDecls( -#line 1175 "cs.ATG" +#line 1179 "cs.ATG" out EventAddRegion addBlock, out EventRemoveRegion removeBlock) { -#line 1176 "cs.ATG" +#line 1180 "cs.ATG" AttributeSection section; List attributes = new List(); Statement stmt; @@ -2631,93 +2643,93 @@ out EventAddRegion addBlock, out EventRemoveRegion removeBlock) { while (la.kind == 18) { AttributeSection( -#line 1183 "cs.ATG" +#line 1187 "cs.ATG" out section); -#line 1183 "cs.ATG" +#line 1187 "cs.ATG" attributes.Add(section); } if (la.kind == 130) { -#line 1185 "cs.ATG" +#line 1189 "cs.ATG" addBlock = new EventAddRegion(attributes); AddAccessorDecl( -#line 1186 "cs.ATG" +#line 1190 "cs.ATG" out stmt); -#line 1186 "cs.ATG" +#line 1190 "cs.ATG" attributes = new List(); addBlock.Block = (BlockStatement)stmt; while (la.kind == 18) { AttributeSection( -#line 1187 "cs.ATG" +#line 1191 "cs.ATG" out section); -#line 1187 "cs.ATG" +#line 1191 "cs.ATG" attributes.Add(section); } RemoveAccessorDecl( -#line 1188 "cs.ATG" +#line 1192 "cs.ATG" out stmt); -#line 1188 "cs.ATG" +#line 1192 "cs.ATG" removeBlock = new EventRemoveRegion(attributes); removeBlock.Block = (BlockStatement)stmt; } else if (la.kind == 131) { RemoveAccessorDecl( -#line 1190 "cs.ATG" +#line 1194 "cs.ATG" out stmt); -#line 1190 "cs.ATG" +#line 1194 "cs.ATG" removeBlock = new EventRemoveRegion(attributes); removeBlock.Block = (BlockStatement)stmt; attributes = new List(); while (la.kind == 18) { AttributeSection( -#line 1191 "cs.ATG" +#line 1195 "cs.ATG" out section); -#line 1191 "cs.ATG" +#line 1195 "cs.ATG" attributes.Add(section); } AddAccessorDecl( -#line 1192 "cs.ATG" +#line 1196 "cs.ATG" out stmt); -#line 1192 "cs.ATG" +#line 1196 "cs.ATG" addBlock = new EventAddRegion(attributes); addBlock.Block = (BlockStatement)stmt; - } else SynErr(180); + } else SynErr(182); } void ConstructorInitializer( -#line 1266 "cs.ATG" +#line 1270 "cs.ATG" out ConstructorInitializer ci) { -#line 1267 "cs.ATG" +#line 1271 "cs.ATG" Expression expr; ci = new ConstructorInitializer(); Expect(9); if (la.kind == 51) { lexer.NextToken(); -#line 1271 "cs.ATG" +#line 1275 "cs.ATG" ci.ConstructorInitializerType = ConstructorInitializerType.Base; } else if (la.kind == 111) { lexer.NextToken(); -#line 1272 "cs.ATG" +#line 1276 "cs.ATG" ci.ConstructorInitializerType = ConstructorInitializerType.This; - } else SynErr(181); + } else SynErr(183); Expect(20); - if (StartOf(24)) { + if (StartOf(26)) { Argument( -#line 1275 "cs.ATG" +#line 1279 "cs.ATG" out expr); -#line 1275 "cs.ATG" +#line 1279 "cs.ATG" if (expr != null) { ci.Arguments.Add(expr); } while (la.kind == 14) { lexer.NextToken(); Argument( -#line 1275 "cs.ATG" +#line 1279 "cs.ATG" out expr); -#line 1275 "cs.ATG" +#line 1279 "cs.ATG" if (expr != null) { ci.Arguments.Add(expr); } } } @@ -2725,198 +2737,198 @@ out expr); } void OverloadableOperator( -#line 1287 "cs.ATG" +#line 1291 "cs.ATG" out OverloadableOperatorType op) { -#line 1288 "cs.ATG" +#line 1292 "cs.ATG" op = OverloadableOperatorType.None; switch (la.kind) { case 4: { lexer.NextToken(); -#line 1290 "cs.ATG" +#line 1294 "cs.ATG" op = OverloadableOperatorType.Add; break; } case 5: { lexer.NextToken(); -#line 1291 "cs.ATG" +#line 1295 "cs.ATG" op = OverloadableOperatorType.Subtract; break; } case 24: { lexer.NextToken(); -#line 1293 "cs.ATG" +#line 1297 "cs.ATG" op = OverloadableOperatorType.Not; break; } case 27: { lexer.NextToken(); -#line 1294 "cs.ATG" +#line 1298 "cs.ATG" op = OverloadableOperatorType.BitNot; break; } case 31: { lexer.NextToken(); -#line 1296 "cs.ATG" +#line 1300 "cs.ATG" op = OverloadableOperatorType.Increment; break; } case 32: { lexer.NextToken(); -#line 1297 "cs.ATG" +#line 1301 "cs.ATG" op = OverloadableOperatorType.Decrement; break; } case 113: { lexer.NextToken(); -#line 1299 "cs.ATG" +#line 1303 "cs.ATG" op = OverloadableOperatorType.IsTrue; break; } case 72: { lexer.NextToken(); -#line 1300 "cs.ATG" +#line 1304 "cs.ATG" op = OverloadableOperatorType.IsFalse; break; } case 6: { lexer.NextToken(); -#line 1302 "cs.ATG" +#line 1306 "cs.ATG" op = OverloadableOperatorType.Multiply; break; } case 7: { lexer.NextToken(); -#line 1303 "cs.ATG" +#line 1307 "cs.ATG" op = OverloadableOperatorType.Divide; break; } case 8: { lexer.NextToken(); -#line 1304 "cs.ATG" +#line 1308 "cs.ATG" op = OverloadableOperatorType.Modulus; break; } case 28: { lexer.NextToken(); -#line 1306 "cs.ATG" +#line 1310 "cs.ATG" op = OverloadableOperatorType.BitwiseAnd; break; } case 29: { lexer.NextToken(); -#line 1307 "cs.ATG" +#line 1311 "cs.ATG" op = OverloadableOperatorType.BitwiseOr; break; } case 30: { lexer.NextToken(); -#line 1308 "cs.ATG" +#line 1312 "cs.ATG" op = OverloadableOperatorType.ExclusiveOr; break; } case 37: { lexer.NextToken(); -#line 1310 "cs.ATG" +#line 1314 "cs.ATG" op = OverloadableOperatorType.ShiftLeft; break; } case 33: { lexer.NextToken(); -#line 1311 "cs.ATG" +#line 1315 "cs.ATG" op = OverloadableOperatorType.Equality; break; } case 34: { lexer.NextToken(); -#line 1312 "cs.ATG" +#line 1316 "cs.ATG" op = OverloadableOperatorType.InEquality; break; } case 23: { lexer.NextToken(); -#line 1313 "cs.ATG" +#line 1317 "cs.ATG" op = OverloadableOperatorType.LessThan; break; } case 35: { lexer.NextToken(); -#line 1314 "cs.ATG" +#line 1318 "cs.ATG" op = OverloadableOperatorType.GreaterThanOrEqual; break; } case 36: { lexer.NextToken(); -#line 1315 "cs.ATG" +#line 1319 "cs.ATG" op = OverloadableOperatorType.LessThanOrEqual; break; } case 22: { lexer.NextToken(); -#line 1316 "cs.ATG" +#line 1320 "cs.ATG" op = OverloadableOperatorType.GreaterThan; if (la.kind == 22) { lexer.NextToken(); -#line 1316 "cs.ATG" +#line 1320 "cs.ATG" op = OverloadableOperatorType.ShiftRight; } break; } - default: SynErr(182); break; + default: SynErr(184); break; } } void VariableDeclarator( -#line 1230 "cs.ATG" +#line 1234 "cs.ATG" List fieldDeclaration) { -#line 1231 "cs.ATG" +#line 1235 "cs.ATG" Expression expr = null; Identifier(); -#line 1233 "cs.ATG" +#line 1237 "cs.ATG" VariableDeclaration f = new VariableDeclaration(t.val); if (la.kind == 3) { lexer.NextToken(); VariableInitializer( -#line 1234 "cs.ATG" +#line 1238 "cs.ATG" out expr); -#line 1234 "cs.ATG" +#line 1238 "cs.ATG" f.Initializer = expr; } -#line 1234 "cs.ATG" +#line 1238 "cs.ATG" fieldDeclaration.Add(f); } void AccessorDecls( -#line 1122 "cs.ATG" +#line 1126 "cs.ATG" out PropertyGetRegion getBlock, out PropertySetRegion setBlock) { -#line 1124 "cs.ATG" +#line 1128 "cs.ATG" List attributes = new List(); AttributeSection section; getBlock = null; @@ -2925,92 +2937,92 @@ out PropertyGetRegion getBlock, out PropertySetRegion setBlock) { while (la.kind == 18) { AttributeSection( -#line 1131 "cs.ATG" +#line 1135 "cs.ATG" out section); -#line 1131 "cs.ATG" +#line 1135 "cs.ATG" attributes.Add(section); } if (la.kind == 84 || la.kind == 96 || la.kind == 97) { AccessorModifiers( -#line 1132 "cs.ATG" +#line 1136 "cs.ATG" out modifiers); } if (la.kind == 128) { GetAccessorDecl( -#line 1134 "cs.ATG" +#line 1138 "cs.ATG" out getBlock, attributes); -#line 1135 "cs.ATG" +#line 1139 "cs.ATG" if (modifiers != null) {getBlock.Modifier = modifiers.Modifier; } - if (StartOf(25)) { + if (StartOf(27)) { -#line 1136 "cs.ATG" +#line 1140 "cs.ATG" attributes = new List(); modifiers = null; while (la.kind == 18) { AttributeSection( -#line 1137 "cs.ATG" +#line 1141 "cs.ATG" out section); -#line 1137 "cs.ATG" +#line 1141 "cs.ATG" attributes.Add(section); } if (la.kind == 84 || la.kind == 96 || la.kind == 97) { AccessorModifiers( -#line 1138 "cs.ATG" +#line 1142 "cs.ATG" out modifiers); } SetAccessorDecl( -#line 1139 "cs.ATG" +#line 1143 "cs.ATG" out setBlock, attributes); -#line 1140 "cs.ATG" +#line 1144 "cs.ATG" if (modifiers != null) {setBlock.Modifier = modifiers.Modifier; } } } else if (la.kind == 129) { SetAccessorDecl( -#line 1143 "cs.ATG" +#line 1147 "cs.ATG" out setBlock, attributes); -#line 1144 "cs.ATG" +#line 1148 "cs.ATG" if (modifiers != null) {setBlock.Modifier = modifiers.Modifier; } - if (StartOf(26)) { + if (StartOf(28)) { -#line 1145 "cs.ATG" +#line 1149 "cs.ATG" attributes = new List(); modifiers = null; while (la.kind == 18) { AttributeSection( -#line 1146 "cs.ATG" +#line 1150 "cs.ATG" out section); -#line 1146 "cs.ATG" +#line 1150 "cs.ATG" attributes.Add(section); } if (la.kind == 84 || la.kind == 96 || la.kind == 97) { AccessorModifiers( -#line 1147 "cs.ATG" +#line 1151 "cs.ATG" out modifiers); } GetAccessorDecl( -#line 1148 "cs.ATG" +#line 1152 "cs.ATG" out getBlock, attributes); -#line 1149 "cs.ATG" +#line 1153 "cs.ATG" if (modifiers != null) {getBlock.Modifier = modifiers.Modifier; } } - } else if (StartOf(17)) { + } else if (StartOf(19)) { Identifier(); -#line 1151 "cs.ATG" +#line 1155 "cs.ATG" Error("get or set accessor declaration expected"); - } else SynErr(183); + } else SynErr(185); } void InterfaceAccessors( -#line 1196 "cs.ATG" +#line 1200 "cs.ATG" out PropertyGetRegion getBlock, out PropertySetRegion setBlock) { -#line 1198 "cs.ATG" +#line 1202 "cs.ATG" AttributeSection section; List attributes = new List(); getBlock = null; setBlock = null; @@ -3018,244 +3030,245 @@ out PropertyGetRegion getBlock, out PropertySetRegion setBlock) { while (la.kind == 18) { AttributeSection( -#line 1204 "cs.ATG" +#line 1208 "cs.ATG" out section); -#line 1204 "cs.ATG" +#line 1208 "cs.ATG" attributes.Add(section); } -#line 1205 "cs.ATG" +#line 1209 "cs.ATG" Location startLocation = la.Location; if (la.kind == 128) { lexer.NextToken(); -#line 1207 "cs.ATG" +#line 1211 "cs.ATG" getBlock = new PropertyGetRegion(null, attributes); } else if (la.kind == 129) { lexer.NextToken(); -#line 1208 "cs.ATG" +#line 1212 "cs.ATG" setBlock = new PropertySetRegion(null, attributes); - } else SynErr(184); + } else SynErr(186); Expect(11); -#line 1211 "cs.ATG" +#line 1215 "cs.ATG" if (getBlock != null) { getBlock.StartLocation = startLocation; getBlock.EndLocation = t.EndLocation; } if (setBlock != null) { setBlock.StartLocation = startLocation; setBlock.EndLocation = t.EndLocation; } attributes = new List(); if (la.kind == 18 || la.kind == 128 || la.kind == 129) { while (la.kind == 18) { AttributeSection( -#line 1215 "cs.ATG" +#line 1219 "cs.ATG" out section); -#line 1215 "cs.ATG" +#line 1219 "cs.ATG" attributes.Add(section); } -#line 1216 "cs.ATG" +#line 1220 "cs.ATG" startLocation = la.Location; if (la.kind == 128) { lexer.NextToken(); -#line 1218 "cs.ATG" +#line 1222 "cs.ATG" if (getBlock != null) Error("get already declared"); else { getBlock = new PropertyGetRegion(null, attributes); lastBlock = getBlock; } } else if (la.kind == 129) { lexer.NextToken(); -#line 1221 "cs.ATG" +#line 1225 "cs.ATG" if (setBlock != null) Error("set already declared"); else { setBlock = new PropertySetRegion(null, attributes); lastBlock = setBlock; } - } else SynErr(185); + } else SynErr(187); Expect(11); -#line 1226 "cs.ATG" +#line 1230 "cs.ATG" if (lastBlock != null) { lastBlock.StartLocation = startLocation; lastBlock.EndLocation = t.EndLocation; } } } void GetAccessorDecl( -#line 1155 "cs.ATG" +#line 1159 "cs.ATG" out PropertyGetRegion getBlock, List attributes) { -#line 1156 "cs.ATG" +#line 1160 "cs.ATG" Statement stmt = null; Expect(128); -#line 1159 "cs.ATG" +#line 1163 "cs.ATG" Location startLocation = t.Location; if (la.kind == 16) { Block( -#line 1160 "cs.ATG" +#line 1164 "cs.ATG" out stmt); } else if (la.kind == 11) { lexer.NextToken(); - } else SynErr(186); + } else SynErr(188); -#line 1161 "cs.ATG" +#line 1165 "cs.ATG" getBlock = new PropertyGetRegion((BlockStatement)stmt, attributes); -#line 1162 "cs.ATG" +#line 1166 "cs.ATG" getBlock.StartLocation = startLocation; getBlock.EndLocation = t.EndLocation; } void SetAccessorDecl( -#line 1165 "cs.ATG" +#line 1169 "cs.ATG" out PropertySetRegion setBlock, List attributes) { -#line 1166 "cs.ATG" +#line 1170 "cs.ATG" Statement stmt = null; Expect(129); -#line 1169 "cs.ATG" +#line 1173 "cs.ATG" Location startLocation = t.Location; if (la.kind == 16) { Block( -#line 1170 "cs.ATG" +#line 1174 "cs.ATG" out stmt); } else if (la.kind == 11) { lexer.NextToken(); - } else SynErr(187); + } else SynErr(189); -#line 1171 "cs.ATG" +#line 1175 "cs.ATG" setBlock = new PropertySetRegion((BlockStatement)stmt, attributes); -#line 1172 "cs.ATG" +#line 1176 "cs.ATG" setBlock.StartLocation = startLocation; setBlock.EndLocation = t.EndLocation; } void AddAccessorDecl( -#line 1252 "cs.ATG" +#line 1256 "cs.ATG" out Statement stmt) { -#line 1253 "cs.ATG" +#line 1257 "cs.ATG" stmt = null; Expect(130); Block( -#line 1256 "cs.ATG" +#line 1260 "cs.ATG" out stmt); } void RemoveAccessorDecl( -#line 1259 "cs.ATG" +#line 1263 "cs.ATG" out Statement stmt) { -#line 1260 "cs.ATG" +#line 1264 "cs.ATG" stmt = null; Expect(131); Block( -#line 1263 "cs.ATG" +#line 1267 "cs.ATG" out stmt); } void VariableInitializer( -#line 1279 "cs.ATG" +#line 1283 "cs.ATG" out Expression initializerExpression) { -#line 1280 "cs.ATG" +#line 1284 "cs.ATG" TypeReference type = null; Expression expr = null; initializerExpression = null; if (StartOf(6)) { Expr( -#line 1282 "cs.ATG" +#line 1286 "cs.ATG" out initializerExpression); } else if (la.kind == 16) { CollectionInitializer( -#line 1283 "cs.ATG" +#line 1287 "cs.ATG" out initializerExpression); } else if (la.kind == 106) { lexer.NextToken(); Type( -#line 1284 "cs.ATG" +#line 1288 "cs.ATG" out type); Expect(18); Expr( -#line 1284 "cs.ATG" +#line 1288 "cs.ATG" out expr); Expect(19); -#line 1284 "cs.ATG" +#line 1288 "cs.ATG" initializerExpression = new StackAllocExpression(type, expr); - } else SynErr(188); + } else SynErr(190); } void Statement() { -#line 1423 "cs.ATG" +#line 1429 "cs.ATG" TypeReference type; Expression expr; Statement stmt = null; Location startPos = la.Location; + while (!(StartOf(29))) {SynErr(191); lexer.NextToken(); } if ( -#line 1431 "cs.ATG" +#line 1438 "cs.ATG" IsLabel()) { Identifier(); -#line 1431 "cs.ATG" +#line 1438 "cs.ATG" compilationUnit.AddChild(new LabelStatement(t.val)); Expect(9); Statement(); } else if (la.kind == 60) { lexer.NextToken(); Type( -#line 1434 "cs.ATG" +#line 1441 "cs.ATG" out type); -#line 1434 "cs.ATG" +#line 1441 "cs.ATG" LocalVariableDeclaration var = new LocalVariableDeclaration(type, Modifiers.Const); string ident = null; var.StartLocation = t.Location; Identifier(); -#line 1435 "cs.ATG" +#line 1442 "cs.ATG" ident = t.val; Expect(3); Expr( -#line 1436 "cs.ATG" +#line 1443 "cs.ATG" out expr); -#line 1436 "cs.ATG" +#line 1443 "cs.ATG" var.Variables.Add(new VariableDeclaration(ident, expr)); while (la.kind == 14) { lexer.NextToken(); Identifier(); -#line 1437 "cs.ATG" +#line 1444 "cs.ATG" ident = t.val; Expect(3); Expr( -#line 1437 "cs.ATG" +#line 1444 "cs.ATG" out expr); -#line 1437 "cs.ATG" +#line 1444 "cs.ATG" var.Variables.Add(new VariableDeclaration(ident, expr)); } Expect(11); -#line 1438 "cs.ATG" +#line 1445 "cs.ATG" compilationUnit.AddChild(var); } else if ( -#line 1440 "cs.ATG" +#line 1448 "cs.ATG" IsLocalVarDecl()) { LocalVariableDecl( -#line 1440 "cs.ATG" +#line 1448 "cs.ATG" out stmt); Expect(11); -#line 1440 "cs.ATG" +#line 1448 "cs.ATG" compilationUnit.AddChild(stmt); - } else if (StartOf(27)) { + } else if (StartOf(30)) { EmbeddedStatement( -#line 1441 "cs.ATG" +#line 1450 "cs.ATG" out stmt); -#line 1441 "cs.ATG" +#line 1450 "cs.ATG" compilationUnit.AddChild(stmt); - } else SynErr(189); + } else SynErr(192); -#line 1447 "cs.ATG" +#line 1456 "cs.ATG" if (stmt != null) { stmt.StartLocation = startPos; stmt.EndLocation = t.EndLocation; @@ -3264,10 +3277,10 @@ out stmt); } void Argument( -#line 1319 "cs.ATG" +#line 1323 "cs.ATG" out Expression argumentexpr) { -#line 1321 "cs.ATG" +#line 1325 "cs.ATG" Expression expr; FieldDirection fd = FieldDirection.None; @@ -3275,51 +3288,51 @@ out Expression argumentexpr) { if (la.kind == 100) { lexer.NextToken(); -#line 1326 "cs.ATG" +#line 1330 "cs.ATG" fd = FieldDirection.Ref; } else { lexer.NextToken(); -#line 1327 "cs.ATG" +#line 1331 "cs.ATG" fd = FieldDirection.Out; } } Expr( -#line 1329 "cs.ATG" +#line 1333 "cs.ATG" out expr); -#line 1329 "cs.ATG" +#line 1334 "cs.ATG" argumentexpr = fd != FieldDirection.None ? argumentexpr = new DirectionExpression(fd, expr) : expr; } void CollectionInitializer( -#line 1349 "cs.ATG" +#line 1354 "cs.ATG" out Expression outExpr) { -#line 1351 "cs.ATG" +#line 1356 "cs.ATG" Expression expr = null; CollectionInitializerExpression initializer = new CollectionInitializerExpression(); Expect(16); -#line 1355 "cs.ATG" +#line 1360 "cs.ATG" initializer.StartLocation = t.Location; - if (StartOf(28)) { + if (StartOf(31)) { VariableInitializer( -#line 1356 "cs.ATG" +#line 1361 "cs.ATG" out expr); -#line 1357 "cs.ATG" +#line 1362 "cs.ATG" if (expr != null) { initializer.CreateExpressions.Add(expr); } while ( -#line 1358 "cs.ATG" +#line 1363 "cs.ATG" NotFinalComma()) { Expect(14); VariableInitializer( -#line 1359 "cs.ATG" +#line 1364 "cs.ATG" out expr); -#line 1360 "cs.ATG" +#line 1365 "cs.ATG" if (expr != null) { initializer.CreateExpressions.Add(expr); } } if (la.kind == 14) { @@ -3328,105 +3341,105 @@ out expr); } Expect(17); -#line 1364 "cs.ATG" +#line 1369 "cs.ATG" initializer.EndLocation = t.Location; outExpr = initializer; } void AssignmentOperator( -#line 1332 "cs.ATG" +#line 1337 "cs.ATG" out AssignmentOperatorType op) { -#line 1333 "cs.ATG" +#line 1338 "cs.ATG" op = AssignmentOperatorType.None; if (la.kind == 3) { lexer.NextToken(); -#line 1335 "cs.ATG" +#line 1340 "cs.ATG" op = AssignmentOperatorType.Assign; } else if (la.kind == 38) { lexer.NextToken(); -#line 1336 "cs.ATG" +#line 1341 "cs.ATG" op = AssignmentOperatorType.Add; } else if (la.kind == 39) { lexer.NextToken(); -#line 1337 "cs.ATG" +#line 1342 "cs.ATG" op = AssignmentOperatorType.Subtract; } else if (la.kind == 40) { lexer.NextToken(); -#line 1338 "cs.ATG" +#line 1343 "cs.ATG" op = AssignmentOperatorType.Multiply; } else if (la.kind == 41) { lexer.NextToken(); -#line 1339 "cs.ATG" +#line 1344 "cs.ATG" op = AssignmentOperatorType.Divide; } else if (la.kind == 42) { lexer.NextToken(); -#line 1340 "cs.ATG" +#line 1345 "cs.ATG" op = AssignmentOperatorType.Modulus; } else if (la.kind == 43) { lexer.NextToken(); -#line 1341 "cs.ATG" +#line 1346 "cs.ATG" op = AssignmentOperatorType.BitwiseAnd; } else if (la.kind == 44) { lexer.NextToken(); -#line 1342 "cs.ATG" +#line 1347 "cs.ATG" op = AssignmentOperatorType.BitwiseOr; } else if (la.kind == 45) { lexer.NextToken(); -#line 1343 "cs.ATG" +#line 1348 "cs.ATG" op = AssignmentOperatorType.ExclusiveOr; } else if (la.kind == 46) { lexer.NextToken(); -#line 1344 "cs.ATG" +#line 1349 "cs.ATG" op = AssignmentOperatorType.ShiftLeft; } else if ( -#line 1345 "cs.ATG" +#line 1350 "cs.ATG" la.kind == Tokens.GreaterThan && Peek(1).kind == Tokens.GreaterEqual) { Expect(22); Expect(35); -#line 1346 "cs.ATG" +#line 1351 "cs.ATG" op = AssignmentOperatorType.ShiftRight; - } else SynErr(190); + } else SynErr(193); } void CollectionOrObjectInitializer( -#line 1367 "cs.ATG" +#line 1372 "cs.ATG" out Expression outExpr) { -#line 1369 "cs.ATG" +#line 1374 "cs.ATG" Expression expr = null; CollectionInitializerExpression initializer = new CollectionInitializerExpression(); Expect(16); -#line 1373 "cs.ATG" +#line 1378 "cs.ATG" initializer.StartLocation = t.Location; - if (StartOf(28)) { + if (StartOf(31)) { ObjectPropertyInitializerOrVariableInitializer( -#line 1374 "cs.ATG" +#line 1379 "cs.ATG" out expr); -#line 1375 "cs.ATG" +#line 1380 "cs.ATG" if (expr != null) { initializer.CreateExpressions.Add(expr); } while ( -#line 1376 "cs.ATG" +#line 1381 "cs.ATG" NotFinalComma()) { Expect(14); ObjectPropertyInitializerOrVariableInitializer( -#line 1377 "cs.ATG" +#line 1382 "cs.ATG" out expr); -#line 1378 "cs.ATG" +#line 1383 "cs.ATG" if (expr != null) { initializer.CreateExpressions.Add(expr); } } if (la.kind == 14) { @@ -3435,444 +3448,468 @@ out expr); } Expect(17); -#line 1382 "cs.ATG" +#line 1387 "cs.ATG" initializer.EndLocation = t.Location; outExpr = initializer; } void ObjectPropertyInitializerOrVariableInitializer( -#line 1385 "cs.ATG" +#line 1390 "cs.ATG" out Expression expr) { -#line 1386 "cs.ATG" +#line 1391 "cs.ATG" expr = null; if ( -#line 1388 "cs.ATG" +#line 1393 "cs.ATG" IdentAndAsgn()) { Identifier(); -#line 1390 "cs.ATG" +#line 1395 "cs.ATG" NamedArgumentExpression nae = new NamedArgumentExpression(t.val, null); nae.StartLocation = t.Location; Expression r = null; Expect(3); if (la.kind == 16) { CollectionOrObjectInitializer( -#line 1394 "cs.ATG" +#line 1399 "cs.ATG" out r); - } else if (StartOf(28)) { + } else if (StartOf(31)) { VariableInitializer( -#line 1395 "cs.ATG" +#line 1400 "cs.ATG" out r); - } else SynErr(191); + } else SynErr(194); -#line 1396 "cs.ATG" +#line 1401 "cs.ATG" nae.Expression = r; nae.EndLocation = t.EndLocation; expr = nae; - } else if (StartOf(28)) { + } else if (StartOf(31)) { VariableInitializer( -#line 1398 "cs.ATG" +#line 1403 "cs.ATG" out expr); - } else SynErr(192); + } else SynErr(195); } void LocalVariableDecl( -#line 1402 "cs.ATG" +#line 1407 "cs.ATG" out Statement stmt) { -#line 1404 "cs.ATG" +#line 1409 "cs.ATG" TypeReference type; VariableDeclaration var = null; LocalVariableDeclaration localVariableDeclaration; Type( -#line 1409 "cs.ATG" +#line 1414 "cs.ATG" out type); -#line 1409 "cs.ATG" +#line 1414 "cs.ATG" localVariableDeclaration = new LocalVariableDeclaration(type); localVariableDeclaration.StartLocation = t.Location; LocalVariableDeclarator( -#line 1410 "cs.ATG" +#line 1415 "cs.ATG" out var); -#line 1410 "cs.ATG" +#line 1415 "cs.ATG" localVariableDeclaration.Variables.Add(var); while (la.kind == 14) { lexer.NextToken(); LocalVariableDeclarator( -#line 1411 "cs.ATG" +#line 1416 "cs.ATG" out var); -#line 1411 "cs.ATG" +#line 1416 "cs.ATG" localVariableDeclaration.Variables.Add(var); } -#line 1412 "cs.ATG" +#line 1417 "cs.ATG" stmt = localVariableDeclaration; } void LocalVariableDeclarator( -#line 1415 "cs.ATG" +#line 1420 "cs.ATG" out VariableDeclaration var) { -#line 1416 "cs.ATG" +#line 1421 "cs.ATG" Expression expr = null; Identifier(); -#line 1418 "cs.ATG" +#line 1423 "cs.ATG" var = new VariableDeclaration(t.val); if (la.kind == 3) { lexer.NextToken(); VariableInitializer( -#line 1418 "cs.ATG" +#line 1424 "cs.ATG" out expr); -#line 1418 "cs.ATG" +#line 1424 "cs.ATG" var.Initializer = expr; } } void EmbeddedStatement( -#line 1454 "cs.ATG" +#line 1463 "cs.ATG" out Statement statement) { -#line 1456 "cs.ATG" +#line 1465 "cs.ATG" TypeReference type = null; Expression expr = null; Statement embeddedStatement = null; statement = null; + +#line 1471 "cs.ATG" + Location startLocation = la.Location; if (la.kind == 16) { Block( -#line 1462 "cs.ATG" +#line 1473 "cs.ATG" out statement); } else if (la.kind == 11) { lexer.NextToken(); -#line 1464 "cs.ATG" +#line 1476 "cs.ATG" statement = new EmptyStatement(); } else if ( -#line 1466 "cs.ATG" +#line 1479 "cs.ATG" UnCheckedAndLBrace()) { -#line 1466 "cs.ATG" +#line 1479 "cs.ATG" Statement block; bool isChecked = true; if (la.kind == 58) { lexer.NextToken(); } else if (la.kind == 118) { lexer.NextToken(); -#line 1467 "cs.ATG" +#line 1480 "cs.ATG" isChecked = false; - } else SynErr(193); + } else SynErr(196); Block( -#line 1468 "cs.ATG" +#line 1481 "cs.ATG" out block); -#line 1468 "cs.ATG" +#line 1481 "cs.ATG" statement = isChecked ? (Statement)new CheckedStatement(block) : (Statement)new UncheckedStatement(block); } else if (la.kind == 79) { - lexer.NextToken(); - -#line 1470 "cs.ATG" - Statement elseStatement = null; - Expect(20); - Expr( -#line 1471 "cs.ATG" -out expr); - Expect(21); - EmbeddedStatement( -#line 1472 "cs.ATG" -out embeddedStatement); - if (la.kind == 67) { - lexer.NextToken(); - EmbeddedStatement( -#line 1473 "cs.ATG" -out elseStatement); - } - -#line 1474 "cs.ATG" - statement = elseStatement != null ? new IfElseStatement(expr, embeddedStatement, elseStatement) : new IfElseStatement(expr, embeddedStatement); - -#line 1475 "cs.ATG" - if (elseStatement is IfElseStatement && (elseStatement as IfElseStatement).TrueStatement.Count == 1) { - /* else if-section (otherwise we would have a BlockStatment) */ - (statement as IfElseStatement).ElseIfSections.Add( - new ElseIfSection((elseStatement as IfElseStatement).Condition, - (elseStatement as IfElseStatement).TrueStatement[0])); - (statement as IfElseStatement).ElseIfSections.AddRange((elseStatement as IfElseStatement).ElseIfSections); - (statement as IfElseStatement).FalseStatement = (elseStatement as IfElseStatement).FalseStatement; - } + IfStatement( +#line 1484 "cs.ATG" +out statement); } else if (la.kind == 110) { lexer.NextToken(); -#line 1483 "cs.ATG" +#line 1486 "cs.ATG" List switchSections = new List(); Expect(20); Expr( -#line 1484 "cs.ATG" +#line 1487 "cs.ATG" out expr); Expect(21); Expect(16); SwitchSections( -#line 1485 "cs.ATG" +#line 1488 "cs.ATG" switchSections); Expect(17); -#line 1486 "cs.ATG" +#line 1489 "cs.ATG" statement = new SwitchStatement(expr, switchSections); } else if (la.kind == 125) { lexer.NextToken(); Expect(20); Expr( -#line 1488 "cs.ATG" +#line 1492 "cs.ATG" out expr); Expect(21); EmbeddedStatement( -#line 1490 "cs.ATG" +#line 1493 "cs.ATG" out embeddedStatement); -#line 1490 "cs.ATG" +#line 1494 "cs.ATG" statement = new DoLoopStatement(expr, embeddedStatement, ConditionType.While, ConditionPosition.Start); } else if (la.kind == 65) { lexer.NextToken(); EmbeddedStatement( -#line 1491 "cs.ATG" +#line 1496 "cs.ATG" out embeddedStatement); Expect(125); Expect(20); Expr( -#line 1492 "cs.ATG" +#line 1497 "cs.ATG" out expr); Expect(21); Expect(11); -#line 1492 "cs.ATG" +#line 1498 "cs.ATG" statement = new DoLoopStatement(expr, embeddedStatement, ConditionType.While, ConditionPosition.End); } else if (la.kind == 76) { lexer.NextToken(); -#line 1493 "cs.ATG" +#line 1500 "cs.ATG" List initializer = null; List iterator = null; Expect(20); if (StartOf(6)) { ForInitializer( -#line 1494 "cs.ATG" +#line 1501 "cs.ATG" out initializer); } Expect(11); if (StartOf(6)) { Expr( -#line 1495 "cs.ATG" +#line 1502 "cs.ATG" out expr); } Expect(11); if (StartOf(6)) { ForIterator( -#line 1496 "cs.ATG" +#line 1503 "cs.ATG" out iterator); } Expect(21); EmbeddedStatement( -#line 1497 "cs.ATG" +#line 1504 "cs.ATG" out embeddedStatement); -#line 1497 "cs.ATG" +#line 1504 "cs.ATG" statement = new ForStatement(initializer, expr, iterator, embeddedStatement); } else if (la.kind == 77) { lexer.NextToken(); Expect(20); Type( -#line 1498 "cs.ATG" +#line 1506 "cs.ATG" out type); Identifier(); -#line 1498 "cs.ATG" - string varName = t.val; Location start = t.Location; +#line 1506 "cs.ATG" + string varName = t.val; Expect(81); Expr( -#line 1499 "cs.ATG" +#line 1507 "cs.ATG" out expr); Expect(21); EmbeddedStatement( -#line 1500 "cs.ATG" +#line 1508 "cs.ATG" out embeddedStatement); -#line 1500 "cs.ATG" +#line 1509 "cs.ATG" statement = new ForeachStatement(type, varName , expr, embeddedStatement); - statement.EndLocation = t.EndLocation; - } else if (la.kind == 53) { lexer.NextToken(); Expect(11); -#line 1504 "cs.ATG" +#line 1512 "cs.ATG" statement = new BreakStatement(); } else if (la.kind == 61) { lexer.NextToken(); Expect(11); -#line 1505 "cs.ATG" +#line 1513 "cs.ATG" statement = new ContinueStatement(); } else if (la.kind == 78) { GotoStatement( -#line 1506 "cs.ATG" +#line 1514 "cs.ATG" out statement); } else if ( -#line 1507 "cs.ATG" +#line 1516 "cs.ATG" IsYieldStatement()) { Expect(132); if (la.kind == 101) { lexer.NextToken(); Expr( -#line 1507 "cs.ATG" +#line 1517 "cs.ATG" out expr); -#line 1507 "cs.ATG" +#line 1517 "cs.ATG" statement = new YieldStatement(new ReturnStatement(expr)); } else if (la.kind == 53) { lexer.NextToken(); -#line 1508 "cs.ATG" +#line 1518 "cs.ATG" statement = new YieldStatement(new BreakStatement()); - } else SynErr(194); + } else SynErr(197); Expect(11); } else if (la.kind == 101) { lexer.NextToken(); if (StartOf(6)) { Expr( -#line 1509 "cs.ATG" +#line 1521 "cs.ATG" out expr); } Expect(11); -#line 1509 "cs.ATG" +#line 1521 "cs.ATG" statement = new ReturnStatement(expr); } else if (la.kind == 112) { lexer.NextToken(); if (StartOf(6)) { Expr( -#line 1510 "cs.ATG" +#line 1522 "cs.ATG" out expr); } Expect(11); -#line 1510 "cs.ATG" +#line 1522 "cs.ATG" statement = new ThrowStatement(expr); } else if (StartOf(6)) { StatementExpr( -#line 1513 "cs.ATG" +#line 1525 "cs.ATG" out statement); + while (!(la.kind == 0 || la.kind == 11)) {SynErr(198); lexer.NextToken(); } Expect(11); } else if (la.kind == 114) { TryStatement( -#line 1515 "cs.ATG" +#line 1528 "cs.ATG" out statement); } else if (la.kind == 86) { lexer.NextToken(); Expect(20); Expr( -#line 1517 "cs.ATG" +#line 1531 "cs.ATG" out expr); Expect(21); EmbeddedStatement( -#line 1518 "cs.ATG" +#line 1532 "cs.ATG" out embeddedStatement); -#line 1518 "cs.ATG" +#line 1532 "cs.ATG" statement = new LockStatement(expr, embeddedStatement); } else if (la.kind == 121) { -#line 1520 "cs.ATG" +#line 1535 "cs.ATG" Statement resourceAcquisitionStmt = null; lexer.NextToken(); Expect(20); ResourceAcquisition( -#line 1522 "cs.ATG" +#line 1537 "cs.ATG" out resourceAcquisitionStmt); Expect(21); EmbeddedStatement( -#line 1523 "cs.ATG" +#line 1538 "cs.ATG" out embeddedStatement); -#line 1523 "cs.ATG" +#line 1538 "cs.ATG" statement = new UsingStatement(resourceAcquisitionStmt, embeddedStatement); } else if (la.kind == 119) { lexer.NextToken(); Block( -#line 1525 "cs.ATG" +#line 1541 "cs.ATG" out embeddedStatement); -#line 1525 "cs.ATG" +#line 1541 "cs.ATG" statement = new UnsafeStatement(embeddedStatement); } else if (la.kind == 74) { lexer.NextToken(); Expect(20); Type( -#line 1528 "cs.ATG" +#line 1544 "cs.ATG" out type); -#line 1528 "cs.ATG" +#line 1544 "cs.ATG" if (type.PointerNestingLevel == 0) Error("can only fix pointer types"); List pointerDeclarators = new List(1); Identifier(); -#line 1531 "cs.ATG" +#line 1547 "cs.ATG" string identifier = t.val; Expect(3); Expr( -#line 1532 "cs.ATG" +#line 1548 "cs.ATG" out expr); -#line 1532 "cs.ATG" +#line 1548 "cs.ATG" pointerDeclarators.Add(new VariableDeclaration(identifier, expr)); while (la.kind == 14) { lexer.NextToken(); Identifier(); -#line 1534 "cs.ATG" +#line 1550 "cs.ATG" identifier = t.val; Expect(3); Expr( -#line 1535 "cs.ATG" +#line 1551 "cs.ATG" out expr); -#line 1535 "cs.ATG" +#line 1551 "cs.ATG" pointerDeclarators.Add(new VariableDeclaration(identifier, expr)); } Expect(21); EmbeddedStatement( -#line 1537 "cs.ATG" +#line 1553 "cs.ATG" out embeddedStatement); -#line 1537 "cs.ATG" +#line 1553 "cs.ATG" statement = new FixedStatement(type, pointerDeclarators, embeddedStatement); - } else SynErr(195); + } else SynErr(199); + +#line 1555 "cs.ATG" + if (statement != null) { + statement.StartLocation = startLocation; + statement.EndLocation = t.EndLocation; + } + + } + + void IfStatement( +#line 1562 "cs.ATG" +out Statement statement) { + +#line 1564 "cs.ATG" + Expression expr = null; + Statement embeddedStatement = null; + statement = null; + + Expect(79); + Expect(20); + Expr( +#line 1570 "cs.ATG" +out expr); + Expect(21); + EmbeddedStatement( +#line 1571 "cs.ATG" +out embeddedStatement); + +#line 1572 "cs.ATG" + Statement elseStatement = null; + if (la.kind == 67) { + lexer.NextToken(); + EmbeddedStatement( +#line 1573 "cs.ATG" +out elseStatement); + } + +#line 1574 "cs.ATG" + statement = elseStatement != null ? new IfElseStatement(expr, embeddedStatement, elseStatement) : new IfElseStatement(expr, embeddedStatement); + +#line 1575 "cs.ATG" + if (elseStatement is IfElseStatement && (elseStatement as IfElseStatement).TrueStatement.Count == 1) { + /* else if-section (otherwise we would have a BlockStatment) */ + (statement as IfElseStatement).ElseIfSections.Add( + new ElseIfSection((elseStatement as IfElseStatement).Condition, + (elseStatement as IfElseStatement).TrueStatement[0])); + (statement as IfElseStatement).ElseIfSections.AddRange((elseStatement as IfElseStatement).ElseIfSections); + (statement as IfElseStatement).FalseStatement = (elseStatement as IfElseStatement).FalseStatement; + } + } void SwitchSections( -#line 1559 "cs.ATG" +#line 1605 "cs.ATG" List switchSections) { -#line 1561 "cs.ATG" +#line 1607 "cs.ATG" SwitchSection switchSection = new SwitchSection(); CaseLabel label; SwitchLabel( -#line 1565 "cs.ATG" +#line 1611 "cs.ATG" out label); -#line 1565 "cs.ATG" +#line 1611 "cs.ATG" if (label != null) { switchSection.SwitchLabels.Add(label); } -#line 1566 "cs.ATG" +#line 1612 "cs.ATG" compilationUnit.BlockStart(switchSection); - while (StartOf(29)) { + while (StartOf(32)) { if (la.kind == 55 || la.kind == 63) { SwitchLabel( -#line 1568 "cs.ATG" +#line 1614 "cs.ATG" out label); -#line 1569 "cs.ATG" +#line 1615 "cs.ATG" if (label != null) { if (switchSection.Children.Count > 0) { // open new section @@ -3888,347 +3925,347 @@ out label); } } -#line 1581 "cs.ATG" +#line 1627 "cs.ATG" compilationUnit.BlockEnd(); switchSections.Add(switchSection); } void ForInitializer( -#line 1540 "cs.ATG" +#line 1586 "cs.ATG" out List initializer) { -#line 1542 "cs.ATG" +#line 1588 "cs.ATG" Statement stmt; initializer = new List(); if ( -#line 1546 "cs.ATG" +#line 1592 "cs.ATG" IsLocalVarDecl()) { LocalVariableDecl( -#line 1546 "cs.ATG" +#line 1592 "cs.ATG" out stmt); -#line 1546 "cs.ATG" +#line 1592 "cs.ATG" initializer.Add(stmt); } else if (StartOf(6)) { StatementExpr( -#line 1547 "cs.ATG" +#line 1593 "cs.ATG" out stmt); -#line 1547 "cs.ATG" +#line 1593 "cs.ATG" initializer.Add(stmt); while (la.kind == 14) { lexer.NextToken(); StatementExpr( -#line 1547 "cs.ATG" +#line 1593 "cs.ATG" out stmt); -#line 1547 "cs.ATG" +#line 1593 "cs.ATG" initializer.Add(stmt); } - } else SynErr(196); + } else SynErr(200); } void ForIterator( -#line 1550 "cs.ATG" +#line 1596 "cs.ATG" out List iterator) { -#line 1552 "cs.ATG" +#line 1598 "cs.ATG" Statement stmt; iterator = new List(); StatementExpr( -#line 1556 "cs.ATG" +#line 1602 "cs.ATG" out stmt); -#line 1556 "cs.ATG" +#line 1602 "cs.ATG" iterator.Add(stmt); while (la.kind == 14) { lexer.NextToken(); StatementExpr( -#line 1556 "cs.ATG" +#line 1602 "cs.ATG" out stmt); -#line 1556 "cs.ATG" +#line 1602 "cs.ATG" iterator.Add(stmt); } } void GotoStatement( -#line 1634 "cs.ATG" +#line 1680 "cs.ATG" out Statement stmt) { -#line 1635 "cs.ATG" +#line 1681 "cs.ATG" Expression expr; stmt = null; Expect(78); - if (StartOf(17)) { + if (StartOf(19)) { Identifier(); -#line 1639 "cs.ATG" +#line 1685 "cs.ATG" stmt = new GotoStatement(t.val); Expect(11); } else if (la.kind == 55) { lexer.NextToken(); Expr( -#line 1640 "cs.ATG" +#line 1686 "cs.ATG" out expr); Expect(11); -#line 1640 "cs.ATG" +#line 1686 "cs.ATG" stmt = new GotoCaseStatement(expr); } else if (la.kind == 63) { lexer.NextToken(); Expect(11); -#line 1641 "cs.ATG" +#line 1687 "cs.ATG" stmt = new GotoCaseStatement(null); - } else SynErr(197); + } else SynErr(201); } void StatementExpr( -#line 1661 "cs.ATG" +#line 1707 "cs.ATG" out Statement stmt) { -#line 1662 "cs.ATG" +#line 1708 "cs.ATG" Expression expr; Expr( -#line 1664 "cs.ATG" +#line 1710 "cs.ATG" out expr); -#line 1667 "cs.ATG" +#line 1713 "cs.ATG" stmt = new ExpressionStatement(expr); } void TryStatement( -#line 1591 "cs.ATG" +#line 1637 "cs.ATG" out Statement tryStatement) { -#line 1593 "cs.ATG" +#line 1639 "cs.ATG" Statement blockStmt = null, finallyStmt = null; List catchClauses = null; Expect(114); Block( -#line 1597 "cs.ATG" +#line 1643 "cs.ATG" out blockStmt); if (la.kind == 56) { CatchClauses( -#line 1599 "cs.ATG" +#line 1645 "cs.ATG" out catchClauses); if (la.kind == 73) { lexer.NextToken(); Block( -#line 1599 "cs.ATG" +#line 1645 "cs.ATG" out finallyStmt); } } else if (la.kind == 73) { lexer.NextToken(); Block( -#line 1600 "cs.ATG" +#line 1646 "cs.ATG" out finallyStmt); - } else SynErr(198); + } else SynErr(202); -#line 1603 "cs.ATG" +#line 1649 "cs.ATG" tryStatement = new TryCatchStatement(blockStmt, catchClauses, finallyStmt); } void ResourceAcquisition( -#line 1645 "cs.ATG" +#line 1691 "cs.ATG" out Statement stmt) { -#line 1647 "cs.ATG" +#line 1693 "cs.ATG" stmt = null; Expression expr; if ( -#line 1652 "cs.ATG" +#line 1698 "cs.ATG" IsLocalVarDecl()) { LocalVariableDecl( -#line 1652 "cs.ATG" +#line 1698 "cs.ATG" out stmt); } else if (StartOf(6)) { Expr( -#line 1653 "cs.ATG" +#line 1699 "cs.ATG" out expr); -#line 1657 "cs.ATG" +#line 1703 "cs.ATG" stmt = new ExpressionStatement(expr); - } else SynErr(199); + } else SynErr(203); } void SwitchLabel( -#line 1584 "cs.ATG" +#line 1630 "cs.ATG" out CaseLabel label) { -#line 1585 "cs.ATG" +#line 1631 "cs.ATG" Expression expr = null; label = null; if (la.kind == 55) { lexer.NextToken(); Expr( -#line 1587 "cs.ATG" +#line 1633 "cs.ATG" out expr); Expect(9); -#line 1587 "cs.ATG" +#line 1633 "cs.ATG" label = new CaseLabel(expr); } else if (la.kind == 63) { lexer.NextToken(); Expect(9); -#line 1588 "cs.ATG" +#line 1634 "cs.ATG" label = new CaseLabel(); - } else SynErr(200); + } else SynErr(204); } void CatchClauses( -#line 1608 "cs.ATG" +#line 1654 "cs.ATG" out List catchClauses) { -#line 1610 "cs.ATG" +#line 1656 "cs.ATG" catchClauses = new List(); Expect(56); -#line 1613 "cs.ATG" +#line 1659 "cs.ATG" string identifier; Statement stmt; TypeReference typeRef; if (la.kind == 16) { Block( -#line 1619 "cs.ATG" +#line 1665 "cs.ATG" out stmt); -#line 1619 "cs.ATG" +#line 1665 "cs.ATG" catchClauses.Add(new CatchClause(stmt)); } else if (la.kind == 20) { lexer.NextToken(); ClassType( -#line 1621 "cs.ATG" +#line 1667 "cs.ATG" out typeRef, false); -#line 1621 "cs.ATG" +#line 1667 "cs.ATG" identifier = null; - if (StartOf(17)) { + if (StartOf(19)) { Identifier(); -#line 1622 "cs.ATG" +#line 1668 "cs.ATG" identifier = t.val; } Expect(21); Block( -#line 1623 "cs.ATG" +#line 1669 "cs.ATG" out stmt); -#line 1624 "cs.ATG" +#line 1670 "cs.ATG" catchClauses.Add(new CatchClause(typeRef, identifier, stmt)); while ( -#line 1625 "cs.ATG" +#line 1671 "cs.ATG" IsTypedCatch()) { Expect(56); Expect(20); ClassType( -#line 1625 "cs.ATG" +#line 1671 "cs.ATG" out typeRef, false); -#line 1625 "cs.ATG" +#line 1671 "cs.ATG" identifier = null; - if (StartOf(17)) { + if (StartOf(19)) { Identifier(); -#line 1626 "cs.ATG" +#line 1672 "cs.ATG" identifier = t.val; } Expect(21); Block( -#line 1627 "cs.ATG" +#line 1673 "cs.ATG" out stmt); -#line 1628 "cs.ATG" +#line 1674 "cs.ATG" catchClauses.Add(new CatchClause(typeRef, identifier, stmt)); } if (la.kind == 56) { lexer.NextToken(); Block( -#line 1630 "cs.ATG" +#line 1676 "cs.ATG" out stmt); -#line 1630 "cs.ATG" +#line 1676 "cs.ATG" catchClauses.Add(new CatchClause(stmt)); } - } else SynErr(201); + } else SynErr(205); } void UnaryExpr( -#line 1688 "cs.ATG" +#line 1740 "cs.ATG" out Expression uExpr) { -#line 1690 "cs.ATG" +#line 1742 "cs.ATG" TypeReference type = null; Expression expr = null; ArrayList expressions = new ArrayList(); uExpr = null; - while (StartOf(30) || -#line 1712 "cs.ATG" + while (StartOf(33) || +#line 1764 "cs.ATG" IsTypeCast()) { if (la.kind == 4) { lexer.NextToken(); -#line 1699 "cs.ATG" +#line 1751 "cs.ATG" expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Plus)); } else if (la.kind == 5) { lexer.NextToken(); -#line 1700 "cs.ATG" +#line 1752 "cs.ATG" expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Minus)); } else if (la.kind == 24) { lexer.NextToken(); -#line 1701 "cs.ATG" +#line 1753 "cs.ATG" expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Not)); } else if (la.kind == 27) { lexer.NextToken(); -#line 1702 "cs.ATG" +#line 1754 "cs.ATG" expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.BitNot)); } else if (la.kind == 6) { lexer.NextToken(); -#line 1703 "cs.ATG" +#line 1755 "cs.ATG" expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Star)); } else if (la.kind == 31) { lexer.NextToken(); -#line 1704 "cs.ATG" +#line 1756 "cs.ATG" expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Increment)); } else if (la.kind == 32) { lexer.NextToken(); -#line 1705 "cs.ATG" +#line 1757 "cs.ATG" expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Decrement)); } else if (la.kind == 28) { lexer.NextToken(); -#line 1706 "cs.ATG" +#line 1758 "cs.ATG" expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.BitWiseAnd)); } else { Expect(20); Type( -#line 1712 "cs.ATG" +#line 1764 "cs.ATG" out type); Expect(21); -#line 1712 "cs.ATG" +#line 1764 "cs.ATG" expressions.Add(new CastExpression(type)); } } if ( -#line 1717 "cs.ATG" +#line 1769 "cs.ATG" LastExpressionIsUnaryMinus(expressions) && IsMostNegativeIntegerWithoutTypeSuffix()) { Expect(2); -#line 1720 "cs.ATG" +#line 1772 "cs.ATG" expressions.RemoveAt(expressions.Count - 1); if (t.literalValue is uint) { expr = new PrimitiveExpression(int.MinValue, int.MinValue.ToString()); @@ -4238,13 +4275,13 @@ LastExpressionIsUnaryMinus(expressions) && IsMostNegativeIntegerWithoutTypeSuffi throw new Exception("t.literalValue must be uint or ulong"); } - } else if (StartOf(31)) { + } else if (StartOf(34)) { PrimaryExpr( -#line 1729 "cs.ATG" +#line 1781 "cs.ATG" out expr); - } else SynErr(202); + } else SynErr(206); -#line 1731 "cs.ATG" +#line 1783 "cs.ATG" for (int i = 0; i < expressions.Count; ++i) { Expression nextExpression = i + 1 < expressions.Count ? (Expression)expressions[i + 1] : expr; if (expressions[i] is CastExpression) { @@ -4262,511 +4299,496 @@ out expr); } void ConditionalOrExpr( -#line 2031 "cs.ATG" +#line 2095 "cs.ATG" ref Expression outExpr) { -#line 2032 "cs.ATG" +#line 2096 "cs.ATG" Expression expr; ConditionalAndExpr( -#line 2034 "cs.ATG" +#line 2098 "cs.ATG" ref outExpr); while (la.kind == 26) { lexer.NextToken(); UnaryExpr( -#line 2034 "cs.ATG" +#line 2098 "cs.ATG" out expr); ConditionalAndExpr( -#line 2034 "cs.ATG" +#line 2098 "cs.ATG" ref expr); -#line 2034 "cs.ATG" +#line 2098 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.LogicalOr, expr); } } void PrimaryExpr( -#line 1748 "cs.ATG" +#line 1800 "cs.ATG" out Expression pexpr) { -#line 1750 "cs.ATG" +#line 1802 "cs.ATG" TypeReference type = null; Expression expr; pexpr = null; + +#line 1807 "cs.ATG" + Location startLocation = la.Location; if (la.kind == 113) { lexer.NextToken(); -#line 1756 "cs.ATG" +#line 1809 "cs.ATG" pexpr = new PrimitiveExpression(true, "true"); } else if (la.kind == 72) { lexer.NextToken(); -#line 1757 "cs.ATG" +#line 1810 "cs.ATG" pexpr = new PrimitiveExpression(false, "false"); } else if (la.kind == 90) { lexer.NextToken(); -#line 1758 "cs.ATG" +#line 1811 "cs.ATG" pexpr = new PrimitiveExpression(null, "null"); } else if (la.kind == 2) { lexer.NextToken(); -#line 1759 "cs.ATG" +#line 1812 "cs.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val); } else if ( -#line 1760 "cs.ATG" +#line 1813 "cs.ATG" StartOfQueryExpression()) { QueryExpression( -#line 1761 "cs.ATG" +#line 1814 "cs.ATG" out pexpr); } else if ( -#line 1762 "cs.ATG" +#line 1815 "cs.ATG" IdentAndDoubleColon()) { Identifier(); -#line 1763 "cs.ATG" +#line 1816 "cs.ATG" type = new TypeReference(t.val); Expect(10); -#line 1764 "cs.ATG" +#line 1817 "cs.ATG" pexpr = new TypeReferenceExpression(type); Identifier(); -#line 1765 "cs.ATG" +#line 1818 "cs.ATG" if (type.Type == "global") { type.IsGlobal = true; type.Type = (t.val ?? "?"); } else type.Type += "." + (t.val ?? "?"); - } else if (StartOf(17)) { + } else if (StartOf(19)) { Identifier(); -#line 1768 "cs.ATG" +#line 1822 "cs.ATG" pexpr = new IdentifierExpression(t.val); - -#line 1769 "cs.ATG" - pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation; if (la.kind == 48 || -#line 1772 "cs.ATG" +#line 1825 "cs.ATG" IsGenericInSimpleNameOrMemberAccess()) { if (la.kind == 48) { ShortedLambdaExpression( -#line 1771 "cs.ATG" +#line 1824 "cs.ATG" (IdentifierExpression)pexpr, out pexpr); } else { -#line 1773 "cs.ATG" +#line 1826 "cs.ATG" List typeList; TypeArgumentList( -#line 1774 "cs.ATG" +#line 1827 "cs.ATG" out typeList, false); -#line 1775 "cs.ATG" +#line 1828 "cs.ATG" ((IdentifierExpression)pexpr).TypeArguments = typeList; } } } else if ( -#line 1777 "cs.ATG" +#line 1830 "cs.ATG" IsLambdaExpression()) { LambdaExpression( -#line 1778 "cs.ATG" +#line 1831 "cs.ATG" out pexpr); } else if (la.kind == 20) { lexer.NextToken(); Expr( -#line 1780 "cs.ATG" +#line 1834 "cs.ATG" out expr); Expect(21); -#line 1780 "cs.ATG" +#line 1834 "cs.ATG" pexpr = new ParenthesizedExpression(expr); - } else if (StartOf(32)) { + } else if (StartOf(35)) { -#line 1782 "cs.ATG" +#line 1837 "cs.ATG" string val = null; switch (la.kind) { case 52: { lexer.NextToken(); -#line 1784 "cs.ATG" +#line 1838 "cs.ATG" val = "bool"; break; } case 54: { lexer.NextToken(); -#line 1785 "cs.ATG" +#line 1839 "cs.ATG" val = "byte"; break; } case 57: { lexer.NextToken(); -#line 1786 "cs.ATG" +#line 1840 "cs.ATG" val = "char"; break; } case 62: { lexer.NextToken(); -#line 1787 "cs.ATG" +#line 1841 "cs.ATG" val = "decimal"; break; } case 66: { lexer.NextToken(); -#line 1788 "cs.ATG" +#line 1842 "cs.ATG" val = "double"; break; } case 75: { lexer.NextToken(); -#line 1789 "cs.ATG" +#line 1843 "cs.ATG" val = "float"; break; } case 82: { lexer.NextToken(); -#line 1790 "cs.ATG" +#line 1844 "cs.ATG" val = "int"; break; } case 87: { lexer.NextToken(); -#line 1791 "cs.ATG" +#line 1845 "cs.ATG" val = "long"; break; } case 91: { lexer.NextToken(); -#line 1792 "cs.ATG" +#line 1846 "cs.ATG" val = "object"; break; } case 102: { lexer.NextToken(); -#line 1793 "cs.ATG" +#line 1847 "cs.ATG" val = "sbyte"; break; } case 104: { lexer.NextToken(); -#line 1794 "cs.ATG" +#line 1848 "cs.ATG" val = "short"; break; } case 108: { lexer.NextToken(); -#line 1795 "cs.ATG" +#line 1849 "cs.ATG" val = "string"; break; } case 116: { lexer.NextToken(); -#line 1796 "cs.ATG" +#line 1850 "cs.ATG" val = "uint"; break; } case 117: { lexer.NextToken(); -#line 1797 "cs.ATG" +#line 1851 "cs.ATG" val = "ulong"; break; } case 120: { lexer.NextToken(); -#line 1798 "cs.ATG" +#line 1852 "cs.ATG" val = "ushort"; break; } } MemberAccess( -#line 1800 "cs.ATG" +#line 1854 "cs.ATG" out pexpr, new TypeReferenceExpression(val)); } else if (la.kind == 111) { lexer.NextToken(); -#line 1802 "cs.ATG" +#line 1857 "cs.ATG" pexpr = new ThisReferenceExpression(); } else if (la.kind == 51) { lexer.NextToken(); -#line 1804 "cs.ATG" - Expression retExpr = new BaseReferenceExpression(); - if (la.kind == 15) { - MemberAccess( -#line 1806 "cs.ATG" -out retExpr, retExpr); - } else if (la.kind == 18) { - lexer.NextToken(); - Expr( -#line 1807 "cs.ATG" -out expr); - -#line 1807 "cs.ATG" - List indices = new List(); if (expr != null) { indices.Add(expr); } - while (la.kind == 14) { - lexer.NextToken(); - Expr( -#line 1808 "cs.ATG" -out expr); - -#line 1808 "cs.ATG" - if (expr != null) { indices.Add(expr); } - } - Expect(19); - -#line 1809 "cs.ATG" - retExpr = new IndexerExpression(retExpr, indices); - } else SynErr(203); - -#line 1810 "cs.ATG" - pexpr = retExpr; +#line 1859 "cs.ATG" + pexpr = new BaseReferenceExpression(); } else if (la.kind == 89) { NewExpression( -#line 1813 "cs.ATG" -out expr); - -#line 1813 "cs.ATG" - pexpr = expr; +#line 1862 "cs.ATG" +out pexpr); } else if (la.kind == 115) { lexer.NextToken(); Expect(20); if ( -#line 1817 "cs.ATG" +#line 1866 "cs.ATG" NotVoidPointer()) { Expect(123); -#line 1817 "cs.ATG" +#line 1866 "cs.ATG" type = new TypeReference("void"); } else if (StartOf(10)) { TypeWithRestriction( -#line 1818 "cs.ATG" +#line 1867 "cs.ATG" out type, true, true); - } else SynErr(204); + } else SynErr(207); Expect(21); -#line 1819 "cs.ATG" +#line 1869 "cs.ATG" pexpr = new TypeOfExpression(type); } else if (la.kind == 63) { lexer.NextToken(); Expect(20); Type( -#line 1821 "cs.ATG" +#line 1871 "cs.ATG" out type); Expect(21); -#line 1821 "cs.ATG" +#line 1871 "cs.ATG" pexpr = new DefaultValueExpression(type); } else if (la.kind == 105) { lexer.NextToken(); Expect(20); Type( -#line 1822 "cs.ATG" +#line 1872 "cs.ATG" out type); Expect(21); -#line 1822 "cs.ATG" +#line 1872 "cs.ATG" pexpr = new SizeOfExpression(type); } else if (la.kind == 58) { lexer.NextToken(); Expect(20); Expr( -#line 1823 "cs.ATG" +#line 1873 "cs.ATG" out expr); Expect(21); -#line 1823 "cs.ATG" +#line 1873 "cs.ATG" pexpr = new CheckedExpression(expr); } else if (la.kind == 118) { lexer.NextToken(); Expect(20); Expr( -#line 1824 "cs.ATG" +#line 1874 "cs.ATG" out expr); Expect(21); -#line 1824 "cs.ATG" +#line 1874 "cs.ATG" pexpr = new UncheckedExpression(expr); } else if (la.kind == 64) { lexer.NextToken(); AnonymousMethodExpr( -#line 1825 "cs.ATG" +#line 1875 "cs.ATG" out expr); -#line 1825 "cs.ATG" +#line 1875 "cs.ATG" pexpr = expr; - } else SynErr(205); - while (StartOf(33)) { + } else SynErr(208); + +#line 1877 "cs.ATG" + if (pexpr != null) { + pexpr.StartLocation = startLocation; + pexpr.EndLocation = t.EndLocation; + } + + while (StartOf(36)) { if (la.kind == 31 || la.kind == 32) { + +#line 1883 "cs.ATG" + startLocation = la.Location; if (la.kind == 31) { lexer.NextToken(); -#line 1829 "cs.ATG" +#line 1885 "cs.ATG" pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostIncrement); } else if (la.kind == 32) { lexer.NextToken(); -#line 1830 "cs.ATG" +#line 1886 "cs.ATG" pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostDecrement); - } else SynErr(206); + } else SynErr(209); } else if (la.kind == 47) { PointerMemberAccess( -#line 1833 "cs.ATG" +#line 1889 "cs.ATG" out pexpr, pexpr); } else if (la.kind == 15) { MemberAccess( -#line 1834 "cs.ATG" +#line 1890 "cs.ATG" out pexpr, pexpr); } else if (la.kind == 20) { lexer.NextToken(); -#line 1837 "cs.ATG" +#line 1893 "cs.ATG" List parameters = new List(); - if (StartOf(24)) { + if (StartOf(26)) { Argument( -#line 1838 "cs.ATG" +#line 1894 "cs.ATG" out expr); -#line 1838 "cs.ATG" +#line 1894 "cs.ATG" if (expr != null) {parameters.Add(expr);} while (la.kind == 14) { lexer.NextToken(); Argument( -#line 1839 "cs.ATG" +#line 1895 "cs.ATG" out expr); -#line 1839 "cs.ATG" +#line 1895 "cs.ATG" if (expr != null) {parameters.Add(expr);} } } Expect(21); -#line 1840 "cs.ATG" +#line 1898 "cs.ATG" pexpr = new InvocationExpression(pexpr, parameters); } else { -#line 1843 "cs.ATG" +#line 1901 "cs.ATG" List indices = new List(); lexer.NextToken(); Expr( -#line 1845 "cs.ATG" +#line 1903 "cs.ATG" out expr); -#line 1845 "cs.ATG" +#line 1903 "cs.ATG" if (expr != null) { indices.Add(expr); } while (la.kind == 14) { lexer.NextToken(); Expr( -#line 1846 "cs.ATG" +#line 1904 "cs.ATG" out expr); -#line 1846 "cs.ATG" +#line 1904 "cs.ATG" if (expr != null) { indices.Add(expr); } } Expect(19); -#line 1847 "cs.ATG" +#line 1905 "cs.ATG" pexpr = new IndexerExpression(pexpr, indices); + +#line 1907 "cs.ATG" + if (pexpr != null) { + pexpr.StartLocation = startLocation; + pexpr.EndLocation = t.EndLocation; + } + } } } void QueryExpression( -#line 2267 "cs.ATG" +#line 2331 "cs.ATG" out Expression outExpr) { -#line 2268 "cs.ATG" +#line 2332 "cs.ATG" QueryExpression q = new QueryExpression(); outExpr = q; q.StartLocation = la.Location; QueryExpressionFromClause fromClause; QueryExpressionFromClause( -#line 2272 "cs.ATG" +#line 2336 "cs.ATG" out fromClause); -#line 2272 "cs.ATG" +#line 2336 "cs.ATG" q.FromClause = fromClause; QueryExpressionBody( -#line 2273 "cs.ATG" +#line 2337 "cs.ATG" q); -#line 2274 "cs.ATG" +#line 2338 "cs.ATG" q.EndLocation = t.EndLocation; } void ShortedLambdaExpression( -#line 1956 "cs.ATG" +#line 2020 "cs.ATG" IdentifierExpression ident, out Expression pexpr) { -#line 1957 "cs.ATG" +#line 2021 "cs.ATG" LambdaExpression lambda = new LambdaExpression(); pexpr = lambda; Expect(48); -#line 1962 "cs.ATG" +#line 2026 "cs.ATG" lambda.StartLocation = ident.StartLocation; lambda.Parameters.Add(new ParameterDeclarationExpression(null, ident.Identifier)); lambda.Parameters[0].StartLocation = ident.StartLocation; lambda.Parameters[0].EndLocation = ident.EndLocation; LambdaExpressionBody( -#line 1967 "cs.ATG" +#line 2031 "cs.ATG" lambda); } void TypeArgumentList( -#line 2201 "cs.ATG" +#line 2265 "cs.ATG" out List types, bool canBeUnbound) { -#line 2203 "cs.ATG" +#line 2267 "cs.ATG" types = new List(); TypeReference type = null; Expect(23); if ( -#line 2208 "cs.ATG" +#line 2272 "cs.ATG" canBeUnbound && (la.kind == Tokens.GreaterThan || la.kind == Tokens.Comma)) { -#line 2209 "cs.ATG" +#line 2273 "cs.ATG" types.Add(TypeReference.Null); while (la.kind == 14) { lexer.NextToken(); -#line 2210 "cs.ATG" +#line 2274 "cs.ATG" types.Add(TypeReference.Null); } } else if (StartOf(10)) { Type( -#line 2211 "cs.ATG" +#line 2275 "cs.ATG" out type); -#line 2211 "cs.ATG" +#line 2275 "cs.ATG" if (type != null) { types.Add(type); } while (la.kind == 14) { lexer.NextToken(); Type( -#line 2212 "cs.ATG" +#line 2276 "cs.ATG" out type); -#line 2212 "cs.ATG" +#line 2276 "cs.ATG" if (type != null) { types.Add(type); } } - } else SynErr(207); + } else SynErr(210); Expect(22); } void LambdaExpression( -#line 1936 "cs.ATG" +#line 2000 "cs.ATG" out Expression outExpr) { -#line 1938 "cs.ATG" +#line 2002 "cs.ATG" LambdaExpression lambda = new LambdaExpression(); lambda.StartLocation = la.Location; ParameterDeclarationExpression p; @@ -4775,36 +4797,36 @@ out Expression outExpr) { Expect(20); if (StartOf(10)) { LambdaExpressionParameter( -#line 1946 "cs.ATG" +#line 2010 "cs.ATG" out p); -#line 1946 "cs.ATG" +#line 2010 "cs.ATG" if (p != null) lambda.Parameters.Add(p); while (la.kind == 14) { lexer.NextToken(); LambdaExpressionParameter( -#line 1948 "cs.ATG" +#line 2012 "cs.ATG" out p); -#line 1948 "cs.ATG" +#line 2012 "cs.ATG" if (p != null) lambda.Parameters.Add(p); } } Expect(21); Expect(48); LambdaExpressionBody( -#line 1953 "cs.ATG" +#line 2017 "cs.ATG" lambda); } void MemberAccess( -#line 1851 "cs.ATG" +#line 1915 "cs.ATG" out Expression expr, Expression target) { -#line 1852 "cs.ATG" +#line 1916 "cs.ATG" List typeList; -#line 1854 "cs.ATG" +#line 1918 "cs.ATG" if (ShouldConvertTargetExpressionToTypeReference(target)) { TypeReference type = GetTypeReferenceFromExpression(target); if (type != null) { @@ -4816,25 +4838,25 @@ out Expression expr, Expression target) { Expect(15); Identifier(); -#line 1864 "cs.ATG" +#line 1928 "cs.ATG" expr = new MemberReferenceExpression(target, t.val); if ( -#line 1865 "cs.ATG" +#line 1929 "cs.ATG" IsGenericInSimpleNameOrMemberAccess()) { TypeArgumentList( -#line 1866 "cs.ATG" +#line 1930 "cs.ATG" out typeList, false); -#line 1867 "cs.ATG" +#line 1931 "cs.ATG" ((MemberReferenceExpression)expr).TypeArguments = typeList; } } void NewExpression( -#line 1883 "cs.ATG" +#line 1947 "cs.ATG" out Expression pexpr) { -#line 1884 "cs.ATG" +#line 1948 "cs.ATG" pexpr = null; List parameters = new List(); TypeReference type = null; @@ -4843,65 +4865,65 @@ out Expression pexpr) { Expect(89); if (StartOf(10)) { NonArrayType( -#line 1891 "cs.ATG" +#line 1955 "cs.ATG" out type); } if (la.kind == 16 || la.kind == 20) { if (la.kind == 20) { -#line 1897 "cs.ATG" +#line 1961 "cs.ATG" ObjectCreateExpression oce = new ObjectCreateExpression(type, parameters); lexer.NextToken(); -#line 1898 "cs.ATG" +#line 1962 "cs.ATG" if (type == null) Error("Cannot use an anonymous type with arguments for the constructor"); - if (StartOf(24)) { + if (StartOf(26)) { Argument( -#line 1899 "cs.ATG" +#line 1963 "cs.ATG" out expr); -#line 1899 "cs.ATG" +#line 1963 "cs.ATG" if (expr != null) { parameters.Add(expr); } while (la.kind == 14) { lexer.NextToken(); Argument( -#line 1900 "cs.ATG" +#line 1964 "cs.ATG" out expr); -#line 1900 "cs.ATG" +#line 1964 "cs.ATG" if (expr != null) { parameters.Add(expr); } } } Expect(21); -#line 1902 "cs.ATG" +#line 1966 "cs.ATG" pexpr = oce; if (la.kind == 16) { CollectionOrObjectInitializer( -#line 1903 "cs.ATG" +#line 1967 "cs.ATG" out expr); -#line 1903 "cs.ATG" +#line 1967 "cs.ATG" oce.ObjectInitializer = (CollectionInitializerExpression)expr; } } else { -#line 1904 "cs.ATG" +#line 1968 "cs.ATG" ObjectCreateExpression oce = new ObjectCreateExpression(type, parameters); CollectionOrObjectInitializer( -#line 1905 "cs.ATG" +#line 1969 "cs.ATG" out expr); -#line 1905 "cs.ATG" +#line 1969 "cs.ATG" oce.ObjectInitializer = (CollectionInitializerExpression)expr; -#line 1906 "cs.ATG" +#line 1970 "cs.ATG" pexpr = oce; } } else if (la.kind == 18) { lexer.NextToken(); -#line 1911 "cs.ATG" +#line 1975 "cs.ATG" ArrayCreateExpression ace = new ArrayCreateExpression(type); /* we must not change RankSpecifier on the null type reference*/ if (ace.CreateType.IsNull) { ace.CreateType = new TypeReference(""); } @@ -4912,91 +4934,91 @@ out expr); while (la.kind == 14) { lexer.NextToken(); -#line 1918 "cs.ATG" +#line 1982 "cs.ATG" dims += 1; } Expect(19); -#line 1919 "cs.ATG" +#line 1983 "cs.ATG" ranks.Add(dims); dims = 0; while (la.kind == 18) { lexer.NextToken(); while (la.kind == 14) { lexer.NextToken(); -#line 1920 "cs.ATG" +#line 1984 "cs.ATG" ++dims; } Expect(19); -#line 1920 "cs.ATG" +#line 1984 "cs.ATG" ranks.Add(dims); dims = 0; } -#line 1921 "cs.ATG" +#line 1985 "cs.ATG" ace.CreateType.RankSpecifier = ranks.ToArray(); CollectionInitializer( -#line 1922 "cs.ATG" +#line 1986 "cs.ATG" out expr); -#line 1922 "cs.ATG" +#line 1986 "cs.ATG" ace.ArrayInitializer = (CollectionInitializerExpression)expr; } else if (StartOf(6)) { Expr( -#line 1923 "cs.ATG" +#line 1987 "cs.ATG" out expr); -#line 1923 "cs.ATG" +#line 1987 "cs.ATG" if (expr != null) parameters.Add(expr); while (la.kind == 14) { lexer.NextToken(); -#line 1924 "cs.ATG" +#line 1988 "cs.ATG" dims += 1; Expr( -#line 1925 "cs.ATG" +#line 1989 "cs.ATG" out expr); -#line 1925 "cs.ATG" +#line 1989 "cs.ATG" if (expr != null) parameters.Add(expr); } Expect(19); -#line 1927 "cs.ATG" +#line 1991 "cs.ATG" ranks.Add(dims); ace.Arguments = parameters; dims = 0; while (la.kind == 18) { lexer.NextToken(); while (la.kind == 14) { lexer.NextToken(); -#line 1928 "cs.ATG" +#line 1992 "cs.ATG" ++dims; } Expect(19); -#line 1928 "cs.ATG" +#line 1992 "cs.ATG" ranks.Add(dims); dims = 0; } -#line 1929 "cs.ATG" +#line 1993 "cs.ATG" ace.CreateType.RankSpecifier = ranks.ToArray(); if (la.kind == 16) { CollectionInitializer( -#line 1930 "cs.ATG" +#line 1994 "cs.ATG" out expr); -#line 1930 "cs.ATG" +#line 1994 "cs.ATG" ace.ArrayInitializer = (CollectionInitializerExpression)expr; } - } else SynErr(208); - } else SynErr(209); + } else SynErr(211); + } else SynErr(212); } void AnonymousMethodExpr( -#line 1998 "cs.ATG" +#line 2062 "cs.ATG" out Expression outExpr) { -#line 2000 "cs.ATG" +#line 2064 "cs.ATG" AnonymousMethodExpression expr = new AnonymousMethodExpression(); expr.StartLocation = t.Location; BlockStatement stmt; @@ -5007,420 +5029,420 @@ out Expression outExpr) { lexer.NextToken(); if (StartOf(11)) { FormalParameterList( -#line 2009 "cs.ATG" +#line 2073 "cs.ATG" p); -#line 2009 "cs.ATG" +#line 2073 "cs.ATG" expr.Parameters = p; } Expect(21); -#line 2011 "cs.ATG" +#line 2075 "cs.ATG" expr.HasParameterList = true; } BlockInsideExpression( -#line 2013 "cs.ATG" +#line 2077 "cs.ATG" out stmt); -#line 2013 "cs.ATG" +#line 2077 "cs.ATG" expr.Body = stmt; -#line 2014 "cs.ATG" +#line 2078 "cs.ATG" expr.EndLocation = t.Location; } void PointerMemberAccess( -#line 1871 "cs.ATG" +#line 1935 "cs.ATG" out Expression expr, Expression target) { -#line 1872 "cs.ATG" +#line 1936 "cs.ATG" List typeList; Expect(47); Identifier(); -#line 1876 "cs.ATG" +#line 1940 "cs.ATG" expr = new PointerReferenceExpression(target, t.val); if ( -#line 1877 "cs.ATG" +#line 1941 "cs.ATG" IsGenericInSimpleNameOrMemberAccess()) { TypeArgumentList( -#line 1878 "cs.ATG" +#line 1942 "cs.ATG" out typeList, false); -#line 1879 "cs.ATG" +#line 1943 "cs.ATG" ((MemberReferenceExpression)expr).TypeArguments = typeList; } } void LambdaExpressionParameter( -#line 1970 "cs.ATG" +#line 2034 "cs.ATG" out ParameterDeclarationExpression p) { -#line 1971 "cs.ATG" +#line 2035 "cs.ATG" Location start = la.Location; p = null; TypeReference type; if ( -#line 1975 "cs.ATG" +#line 2039 "cs.ATG" Peek(1).kind == Tokens.Comma || Peek(1).kind == Tokens.CloseParenthesis) { Identifier(); -#line 1977 "cs.ATG" +#line 2041 "cs.ATG" p = new ParameterDeclarationExpression(null, t.val); p.StartLocation = start; p.EndLocation = t.EndLocation; } else if (StartOf(10)) { Type( -#line 1980 "cs.ATG" +#line 2044 "cs.ATG" out type); Identifier(); -#line 1982 "cs.ATG" +#line 2046 "cs.ATG" p = new ParameterDeclarationExpression(type, t.val); p.StartLocation = start; p.EndLocation = t.EndLocation; - } else SynErr(210); + } else SynErr(213); } void LambdaExpressionBody( -#line 1988 "cs.ATG" +#line 2052 "cs.ATG" LambdaExpression lambda) { -#line 1989 "cs.ATG" +#line 2053 "cs.ATG" Expression expr; BlockStatement stmt; if (la.kind == 16) { BlockInsideExpression( -#line 1992 "cs.ATG" +#line 2056 "cs.ATG" out stmt); -#line 1992 "cs.ATG" +#line 2056 "cs.ATG" lambda.StatementBody = stmt; } else if (StartOf(6)) { Expr( -#line 1993 "cs.ATG" +#line 2057 "cs.ATG" out expr); -#line 1993 "cs.ATG" +#line 2057 "cs.ATG" lambda.ExpressionBody = expr; - } else SynErr(211); + } else SynErr(214); -#line 1995 "cs.ATG" +#line 2059 "cs.ATG" lambda.EndLocation = t.EndLocation; } void BlockInsideExpression( -#line 2017 "cs.ATG" +#line 2081 "cs.ATG" out BlockStatement outStmt) { -#line 2018 "cs.ATG" +#line 2082 "cs.ATG" Statement stmt = null; outStmt = null; -#line 2022 "cs.ATG" +#line 2086 "cs.ATG" if (compilationUnit != null) { Block( -#line 2023 "cs.ATG" +#line 2087 "cs.ATG" out stmt); -#line 2023 "cs.ATG" +#line 2087 "cs.ATG" outStmt = (BlockStatement)stmt; -#line 2024 "cs.ATG" +#line 2088 "cs.ATG" } else { Expect(16); -#line 2026 "cs.ATG" +#line 2090 "cs.ATG" lexer.SkipCurrentBlock(0); Expect(17); -#line 2028 "cs.ATG" +#line 2092 "cs.ATG" } } void ConditionalAndExpr( -#line 2037 "cs.ATG" +#line 2101 "cs.ATG" ref Expression outExpr) { -#line 2038 "cs.ATG" +#line 2102 "cs.ATG" Expression expr; InclusiveOrExpr( -#line 2040 "cs.ATG" +#line 2104 "cs.ATG" ref outExpr); while (la.kind == 25) { lexer.NextToken(); UnaryExpr( -#line 2040 "cs.ATG" +#line 2104 "cs.ATG" out expr); InclusiveOrExpr( -#line 2040 "cs.ATG" +#line 2104 "cs.ATG" ref expr); -#line 2040 "cs.ATG" +#line 2104 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.LogicalAnd, expr); } } void InclusiveOrExpr( -#line 2043 "cs.ATG" +#line 2107 "cs.ATG" ref Expression outExpr) { -#line 2044 "cs.ATG" +#line 2108 "cs.ATG" Expression expr; ExclusiveOrExpr( -#line 2046 "cs.ATG" +#line 2110 "cs.ATG" ref outExpr); while (la.kind == 29) { lexer.NextToken(); UnaryExpr( -#line 2046 "cs.ATG" +#line 2110 "cs.ATG" out expr); ExclusiveOrExpr( -#line 2046 "cs.ATG" +#line 2110 "cs.ATG" ref expr); -#line 2046 "cs.ATG" +#line 2110 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.BitwiseOr, expr); } } void ExclusiveOrExpr( -#line 2049 "cs.ATG" +#line 2113 "cs.ATG" ref Expression outExpr) { -#line 2050 "cs.ATG" +#line 2114 "cs.ATG" Expression expr; AndExpr( -#line 2052 "cs.ATG" +#line 2116 "cs.ATG" ref outExpr); while (la.kind == 30) { lexer.NextToken(); UnaryExpr( -#line 2052 "cs.ATG" +#line 2116 "cs.ATG" out expr); AndExpr( -#line 2052 "cs.ATG" +#line 2116 "cs.ATG" ref expr); -#line 2052 "cs.ATG" +#line 2116 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.ExclusiveOr, expr); } } void AndExpr( -#line 2055 "cs.ATG" +#line 2119 "cs.ATG" ref Expression outExpr) { -#line 2056 "cs.ATG" +#line 2120 "cs.ATG" Expression expr; EqualityExpr( -#line 2058 "cs.ATG" +#line 2122 "cs.ATG" ref outExpr); while (la.kind == 28) { lexer.NextToken(); UnaryExpr( -#line 2058 "cs.ATG" +#line 2122 "cs.ATG" out expr); EqualityExpr( -#line 2058 "cs.ATG" +#line 2122 "cs.ATG" ref expr); -#line 2058 "cs.ATG" +#line 2122 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.BitwiseAnd, expr); } } void EqualityExpr( -#line 2061 "cs.ATG" +#line 2125 "cs.ATG" ref Expression outExpr) { -#line 2063 "cs.ATG" +#line 2127 "cs.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; RelationalExpr( -#line 2067 "cs.ATG" +#line 2131 "cs.ATG" ref outExpr); while (la.kind == 33 || la.kind == 34) { if (la.kind == 34) { lexer.NextToken(); -#line 2070 "cs.ATG" +#line 2134 "cs.ATG" op = BinaryOperatorType.InEquality; } else { lexer.NextToken(); -#line 2071 "cs.ATG" +#line 2135 "cs.ATG" op = BinaryOperatorType.Equality; } UnaryExpr( -#line 2073 "cs.ATG" +#line 2137 "cs.ATG" out expr); RelationalExpr( -#line 2073 "cs.ATG" +#line 2137 "cs.ATG" ref expr); -#line 2073 "cs.ATG" +#line 2137 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } } void RelationalExpr( -#line 2077 "cs.ATG" +#line 2141 "cs.ATG" ref Expression outExpr) { -#line 2079 "cs.ATG" +#line 2143 "cs.ATG" TypeReference type; Expression expr; BinaryOperatorType op = BinaryOperatorType.None; ShiftExpr( -#line 2084 "cs.ATG" +#line 2148 "cs.ATG" ref outExpr); - while (StartOf(34)) { - if (StartOf(35)) { + while (StartOf(37)) { + if (StartOf(38)) { if (la.kind == 23) { lexer.NextToken(); -#line 2086 "cs.ATG" +#line 2150 "cs.ATG" op = BinaryOperatorType.LessThan; } else if (la.kind == 22) { lexer.NextToken(); -#line 2087 "cs.ATG" +#line 2151 "cs.ATG" op = BinaryOperatorType.GreaterThan; } else if (la.kind == 36) { lexer.NextToken(); -#line 2088 "cs.ATG" +#line 2152 "cs.ATG" op = BinaryOperatorType.LessThanOrEqual; } else if (la.kind == 35) { lexer.NextToken(); -#line 2089 "cs.ATG" +#line 2153 "cs.ATG" op = BinaryOperatorType.GreaterThanOrEqual; - } else SynErr(212); + } else SynErr(215); UnaryExpr( -#line 2091 "cs.ATG" +#line 2155 "cs.ATG" out expr); ShiftExpr( -#line 2092 "cs.ATG" +#line 2156 "cs.ATG" ref expr); -#line 2093 "cs.ATG" +#line 2157 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } else { if (la.kind == 85) { lexer.NextToken(); TypeWithRestriction( -#line 2096 "cs.ATG" +#line 2160 "cs.ATG" out type, false, false); if ( -#line 2097 "cs.ATG" +#line 2161 "cs.ATG" la.kind == Tokens.Question && !IsPossibleExpressionStart(Peek(1).kind)) { NullableQuestionMark( -#line 2098 "cs.ATG" +#line 2162 "cs.ATG" ref type); } -#line 2099 "cs.ATG" +#line 2163 "cs.ATG" outExpr = new TypeOfIsExpression(outExpr, type); } else if (la.kind == 50) { lexer.NextToken(); TypeWithRestriction( -#line 2101 "cs.ATG" +#line 2165 "cs.ATG" out type, false, false); if ( -#line 2102 "cs.ATG" +#line 2166 "cs.ATG" la.kind == Tokens.Question && !IsPossibleExpressionStart(Peek(1).kind)) { NullableQuestionMark( -#line 2103 "cs.ATG" +#line 2167 "cs.ATG" ref type); } -#line 2104 "cs.ATG" +#line 2168 "cs.ATG" outExpr = new CastExpression(type, outExpr, CastType.TryCast); - } else SynErr(213); + } else SynErr(216); } } } void ShiftExpr( -#line 2109 "cs.ATG" +#line 2173 "cs.ATG" ref Expression outExpr) { -#line 2111 "cs.ATG" +#line 2175 "cs.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; AdditiveExpr( -#line 2115 "cs.ATG" +#line 2179 "cs.ATG" ref outExpr); while (la.kind == 37 || -#line 2118 "cs.ATG" +#line 2182 "cs.ATG" IsShiftRight()) { if (la.kind == 37) { lexer.NextToken(); -#line 2117 "cs.ATG" +#line 2181 "cs.ATG" op = BinaryOperatorType.ShiftLeft; } else { Expect(22); Expect(22); -#line 2119 "cs.ATG" +#line 2183 "cs.ATG" op = BinaryOperatorType.ShiftRight; } UnaryExpr( -#line 2122 "cs.ATG" +#line 2186 "cs.ATG" out expr); AdditiveExpr( -#line 2122 "cs.ATG" +#line 2186 "cs.ATG" ref expr); -#line 2122 "cs.ATG" +#line 2186 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } } void AdditiveExpr( -#line 2126 "cs.ATG" +#line 2190 "cs.ATG" ref Expression outExpr) { -#line 2128 "cs.ATG" +#line 2192 "cs.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; MultiplicativeExpr( -#line 2132 "cs.ATG" +#line 2196 "cs.ATG" ref outExpr); while (la.kind == 4 || la.kind == 5) { if (la.kind == 4) { lexer.NextToken(); -#line 2135 "cs.ATG" +#line 2199 "cs.ATG" op = BinaryOperatorType.Add; } else { lexer.NextToken(); -#line 2136 "cs.ATG" +#line 2200 "cs.ATG" op = BinaryOperatorType.Subtract; } UnaryExpr( -#line 2138 "cs.ATG" +#line 2202 "cs.ATG" out expr); MultiplicativeExpr( -#line 2138 "cs.ATG" +#line 2202 "cs.ATG" ref expr); -#line 2138 "cs.ATG" +#line 2202 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } } void MultiplicativeExpr( -#line 2142 "cs.ATG" +#line 2206 "cs.ATG" ref Expression outExpr) { -#line 2144 "cs.ATG" +#line 2208 "cs.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; @@ -5428,381 +5450,381 @@ ref Expression outExpr) { if (la.kind == 6) { lexer.NextToken(); -#line 2150 "cs.ATG" +#line 2214 "cs.ATG" op = BinaryOperatorType.Multiply; } else if (la.kind == 7) { lexer.NextToken(); -#line 2151 "cs.ATG" +#line 2215 "cs.ATG" op = BinaryOperatorType.Divide; } else { lexer.NextToken(); -#line 2152 "cs.ATG" +#line 2216 "cs.ATG" op = BinaryOperatorType.Modulus; } UnaryExpr( -#line 2154 "cs.ATG" +#line 2218 "cs.ATG" out expr); -#line 2154 "cs.ATG" +#line 2218 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } } void TypeParameterConstraintsClauseBase( -#line 2258 "cs.ATG" +#line 2322 "cs.ATG" out TypeReference type) { -#line 2259 "cs.ATG" +#line 2323 "cs.ATG" TypeReference t; type = null; if (la.kind == 109) { lexer.NextToken(); -#line 2261 "cs.ATG" +#line 2325 "cs.ATG" type = TypeReference.StructConstraint; } else if (la.kind == 59) { lexer.NextToken(); -#line 2262 "cs.ATG" +#line 2326 "cs.ATG" type = TypeReference.ClassConstraint; } else if (la.kind == 89) { lexer.NextToken(); Expect(20); Expect(21); -#line 2263 "cs.ATG" +#line 2327 "cs.ATG" type = TypeReference.NewConstraint; } else if (StartOf(10)) { Type( -#line 2264 "cs.ATG" +#line 2328 "cs.ATG" out t); -#line 2264 "cs.ATG" +#line 2328 "cs.ATG" type = t; - } else SynErr(214); + } else SynErr(217); } void QueryExpressionFromClause( -#line 2277 "cs.ATG" +#line 2341 "cs.ATG" out QueryExpressionFromClause fc) { -#line 2278 "cs.ATG" +#line 2342 "cs.ATG" fc = new QueryExpressionFromClause(); fc.StartLocation = la.Location; Expect(137); QueryExpressionFromOrJoinClause( -#line 2282 "cs.ATG" +#line 2346 "cs.ATG" fc); -#line 2283 "cs.ATG" +#line 2347 "cs.ATG" fc.EndLocation = t.EndLocation; } void QueryExpressionBody( -#line 2313 "cs.ATG" +#line 2377 "cs.ATG" QueryExpression q) { -#line 2314 "cs.ATG" +#line 2378 "cs.ATG" QueryExpressionFromClause fromClause; QueryExpressionWhereClause whereClause; QueryExpressionLetClause letClause; QueryExpressionJoinClause joinClause; QueryExpressionSelectClause selectClause; QueryExpressionGroupClause groupClause; QueryExpressionIntoClause intoClause; - while (StartOf(36)) { + while (StartOf(39)) { if (la.kind == 137) { QueryExpressionFromClause( -#line 2320 "cs.ATG" +#line 2384 "cs.ATG" out fromClause); -#line 2320 "cs.ATG" +#line 2384 "cs.ATG" SafeAdd(q, q.FromLetWhereClauses, fromClause); } else if (la.kind == 127) { QueryExpressionWhereClause( -#line 2321 "cs.ATG" +#line 2385 "cs.ATG" out whereClause); -#line 2321 "cs.ATG" +#line 2385 "cs.ATG" SafeAdd(q, q.FromLetWhereClauses, whereClause); } else if (la.kind == 141) { QueryExpressionLetClause( -#line 2322 "cs.ATG" +#line 2386 "cs.ATG" out letClause); -#line 2322 "cs.ATG" +#line 2386 "cs.ATG" SafeAdd(q, q.FromLetWhereClauses, letClause); } else { QueryExpressionJoinClause( -#line 2323 "cs.ATG" +#line 2387 "cs.ATG" out joinClause); -#line 2323 "cs.ATG" +#line 2387 "cs.ATG" SafeAdd(q, q.FromLetWhereClauses, joinClause); } } if (la.kind == 140) { QueryExpressionOrderByClause( -#line 2325 "cs.ATG" +#line 2389 "cs.ATG" q); } if (la.kind == 133) { QueryExpressionSelectClause( -#line 2326 "cs.ATG" +#line 2390 "cs.ATG" out selectClause); -#line 2326 "cs.ATG" +#line 2390 "cs.ATG" q.SelectOrGroupClause = selectClause; } else if (la.kind == 134) { QueryExpressionGroupClause( -#line 2327 "cs.ATG" +#line 2391 "cs.ATG" out groupClause); -#line 2327 "cs.ATG" +#line 2391 "cs.ATG" q.SelectOrGroupClause = groupClause; - } else SynErr(215); + } else SynErr(218); if (la.kind == 136) { QueryExpressionIntoClause( -#line 2329 "cs.ATG" +#line 2393 "cs.ATG" out intoClause); -#line 2329 "cs.ATG" +#line 2393 "cs.ATG" q.IntoClause = intoClause; } } void QueryExpressionFromOrJoinClause( -#line 2303 "cs.ATG" +#line 2367 "cs.ATG" QueryExpressionFromOrJoinClause fjc) { -#line 2304 "cs.ATG" +#line 2368 "cs.ATG" TypeReference type; Expression expr; -#line 2306 "cs.ATG" +#line 2370 "cs.ATG" fjc.Type = null; if ( -#line 2307 "cs.ATG" +#line 2371 "cs.ATG" IsLocalVarDecl()) { Type( -#line 2307 "cs.ATG" +#line 2371 "cs.ATG" out type); -#line 2307 "cs.ATG" +#line 2371 "cs.ATG" fjc.Type = type; } Identifier(); -#line 2308 "cs.ATG" +#line 2372 "cs.ATG" fjc.Identifier = t.val; Expect(81); Expr( -#line 2310 "cs.ATG" +#line 2374 "cs.ATG" out expr); -#line 2310 "cs.ATG" +#line 2374 "cs.ATG" fjc.InExpression = expr; } void QueryExpressionJoinClause( -#line 2286 "cs.ATG" +#line 2350 "cs.ATG" out QueryExpressionJoinClause jc) { -#line 2287 "cs.ATG" +#line 2351 "cs.ATG" jc = new QueryExpressionJoinClause(); jc.StartLocation = la.Location; Expression expr; Expect(142); QueryExpressionFromOrJoinClause( -#line 2292 "cs.ATG" +#line 2356 "cs.ATG" jc); Expect(143); Expr( -#line 2294 "cs.ATG" +#line 2358 "cs.ATG" out expr); -#line 2294 "cs.ATG" +#line 2358 "cs.ATG" jc.OnExpression = expr; Expect(144); Expr( -#line 2296 "cs.ATG" +#line 2360 "cs.ATG" out expr); -#line 2296 "cs.ATG" +#line 2360 "cs.ATG" jc.EqualsExpression = expr; if (la.kind == 136) { lexer.NextToken(); Identifier(); -#line 2298 "cs.ATG" +#line 2362 "cs.ATG" jc.IntoIdentifier = t.val; } -#line 2300 "cs.ATG" +#line 2364 "cs.ATG" jc.EndLocation = t.EndLocation; } void QueryExpressionWhereClause( -#line 2332 "cs.ATG" +#line 2396 "cs.ATG" out QueryExpressionWhereClause wc) { -#line 2333 "cs.ATG" +#line 2397 "cs.ATG" Expression expr; wc = new QueryExpressionWhereClause(); wc.StartLocation = la.Location; Expect(127); Expr( -#line 2336 "cs.ATG" +#line 2400 "cs.ATG" out expr); -#line 2336 "cs.ATG" +#line 2400 "cs.ATG" wc.Condition = expr; -#line 2337 "cs.ATG" +#line 2401 "cs.ATG" wc.EndLocation = t.EndLocation; } void QueryExpressionLetClause( -#line 2340 "cs.ATG" +#line 2404 "cs.ATG" out QueryExpressionLetClause wc) { -#line 2341 "cs.ATG" +#line 2405 "cs.ATG" Expression expr; wc = new QueryExpressionLetClause(); wc.StartLocation = la.Location; Expect(141); Identifier(); -#line 2344 "cs.ATG" +#line 2408 "cs.ATG" wc.Identifier = t.val; Expect(3); Expr( -#line 2346 "cs.ATG" +#line 2410 "cs.ATG" out expr); -#line 2346 "cs.ATG" +#line 2410 "cs.ATG" wc.Expression = expr; -#line 2347 "cs.ATG" +#line 2411 "cs.ATG" wc.EndLocation = t.EndLocation; } void QueryExpressionOrderByClause( -#line 2350 "cs.ATG" +#line 2414 "cs.ATG" QueryExpression q) { -#line 2351 "cs.ATG" +#line 2415 "cs.ATG" QueryExpressionOrdering ordering; Expect(140); QueryExpressionOrderingClause( -#line 2354 "cs.ATG" +#line 2418 "cs.ATG" out ordering); -#line 2354 "cs.ATG" +#line 2418 "cs.ATG" SafeAdd(q, q.Orderings, ordering); while (la.kind == 14) { lexer.NextToken(); QueryExpressionOrderingClause( -#line 2356 "cs.ATG" +#line 2420 "cs.ATG" out ordering); -#line 2356 "cs.ATG" +#line 2420 "cs.ATG" SafeAdd(q, q.Orderings, ordering); } } void QueryExpressionSelectClause( -#line 2370 "cs.ATG" +#line 2434 "cs.ATG" out QueryExpressionSelectClause sc) { -#line 2371 "cs.ATG" +#line 2435 "cs.ATG" Expression expr; sc = new QueryExpressionSelectClause(); sc.StartLocation = la.Location; Expect(133); Expr( -#line 2374 "cs.ATG" +#line 2438 "cs.ATG" out expr); -#line 2374 "cs.ATG" +#line 2438 "cs.ATG" sc.Projection = expr; -#line 2375 "cs.ATG" +#line 2439 "cs.ATG" sc.EndLocation = t.EndLocation; } void QueryExpressionGroupClause( -#line 2378 "cs.ATG" +#line 2442 "cs.ATG" out QueryExpressionGroupClause gc) { -#line 2379 "cs.ATG" +#line 2443 "cs.ATG" Expression expr; gc = new QueryExpressionGroupClause(); gc.StartLocation = la.Location; Expect(134); Expr( -#line 2382 "cs.ATG" +#line 2446 "cs.ATG" out expr); -#line 2382 "cs.ATG" +#line 2446 "cs.ATG" gc.Projection = expr; Expect(135); Expr( -#line 2384 "cs.ATG" +#line 2448 "cs.ATG" out expr); -#line 2384 "cs.ATG" +#line 2448 "cs.ATG" gc.GroupBy = expr; -#line 2385 "cs.ATG" +#line 2449 "cs.ATG" gc.EndLocation = t.EndLocation; } void QueryExpressionIntoClause( -#line 2388 "cs.ATG" +#line 2452 "cs.ATG" out QueryExpressionIntoClause ic) { -#line 2389 "cs.ATG" +#line 2453 "cs.ATG" ic = new QueryExpressionIntoClause(); ic.StartLocation = la.Location; Expect(136); Identifier(); -#line 2392 "cs.ATG" +#line 2456 "cs.ATG" ic.IntoIdentifier = t.val; -#line 2393 "cs.ATG" +#line 2457 "cs.ATG" ic.ContinuedQuery = new QueryExpression(); -#line 2394 "cs.ATG" +#line 2458 "cs.ATG" ic.ContinuedQuery.StartLocation = la.Location; QueryExpressionBody( -#line 2395 "cs.ATG" +#line 2459 "cs.ATG" ic.ContinuedQuery); -#line 2396 "cs.ATG" +#line 2460 "cs.ATG" ic.ContinuedQuery.EndLocation = t.EndLocation; -#line 2397 "cs.ATG" +#line 2461 "cs.ATG" ic.EndLocation = t.EndLocation; } void QueryExpressionOrderingClause( -#line 2360 "cs.ATG" +#line 2424 "cs.ATG" out QueryExpressionOrdering ordering) { -#line 2361 "cs.ATG" +#line 2425 "cs.ATG" Expression expr; ordering = new QueryExpressionOrdering(); ordering.StartLocation = la.Location; Expr( -#line 2363 "cs.ATG" +#line 2427 "cs.ATG" out expr); -#line 2363 "cs.ATG" +#line 2427 "cs.ATG" ordering.Criteria = expr; if (la.kind == 138 || la.kind == 139) { if (la.kind == 138) { lexer.NextToken(); -#line 2364 "cs.ATG" +#line 2428 "cs.ATG" ordering.Direction = QueryExpressionOrderingDirection.Ascending; } else { lexer.NextToken(); -#line 2365 "cs.ATG" +#line 2429 "cs.ATG" ordering.Direction = QueryExpressionOrderingDirection.Descending; } } -#line 2367 "cs.ATG" +#line 2431 "cs.ATG" ordering.EndLocation = t.EndLocation; } @@ -5972,14 +5994,14 @@ out expr); case 151: s = "invalid TypeModifier"; break; case 152: s = "invalid TypeDecl"; break; case 153: s = "invalid TypeDecl"; break; - case 154: s = "invalid IntegralType"; break; - case 155: s = "invalid FormalParameterList"; break; - case 156: s = "invalid FormalParameterList"; break; - case 157: s = "invalid ClassType"; break; - case 158: s = "invalid ClassMemberDecl"; break; - case 159: s = "invalid ClassMemberDecl"; break; - case 160: s = "invalid StructMemberDecl"; break; - case 161: s = "invalid StructMemberDecl"; break; + case 154: s = "this symbol not expected in ClassBody"; break; + case 155: s = "this symbol not expected in InterfaceBody"; break; + case 156: s = "invalid IntegralType"; break; + case 157: s = "invalid FormalParameterList"; break; + case 158: s = "invalid FormalParameterList"; break; + case 159: s = "invalid ClassType"; break; + case 160: s = "invalid ClassMemberDecl"; break; + case 161: s = "invalid ClassMemberDecl"; break; case 162: s = "invalid StructMemberDecl"; break; case 163: s = "invalid StructMemberDecl"; break; case 164: s = "invalid StructMemberDecl"; break; @@ -5991,49 +6013,52 @@ out expr); case 170: s = "invalid StructMemberDecl"; break; case 171: s = "invalid StructMemberDecl"; break; case 172: s = "invalid StructMemberDecl"; break; - case 173: s = "invalid InterfaceMemberDecl"; break; - case 174: s = "invalid InterfaceMemberDecl"; break; + case 173: s = "invalid StructMemberDecl"; break; + case 174: s = "invalid StructMemberDecl"; break; case 175: s = "invalid InterfaceMemberDecl"; break; - case 176: s = "invalid TypeWithRestriction"; break; - case 177: s = "invalid TypeWithRestriction"; break; - case 178: s = "invalid SimpleType"; break; - case 179: s = "invalid AccessorModifiers"; break; - case 180: s = "invalid EventAccessorDecls"; break; - case 181: s = "invalid ConstructorInitializer"; break; - case 182: s = "invalid OverloadableOperator"; break; - case 183: s = "invalid AccessorDecls"; break; - case 184: s = "invalid InterfaceAccessors"; break; - case 185: s = "invalid InterfaceAccessors"; break; - case 186: s = "invalid GetAccessorDecl"; break; - case 187: s = "invalid SetAccessorDecl"; break; - case 188: s = "invalid VariableInitializer"; break; - case 189: s = "invalid Statement"; break; - case 190: s = "invalid AssignmentOperator"; break; - case 191: s = "invalid ObjectPropertyInitializerOrVariableInitializer"; break; - case 192: s = "invalid ObjectPropertyInitializerOrVariableInitializer"; break; - case 193: s = "invalid EmbeddedStatement"; break; - case 194: s = "invalid EmbeddedStatement"; break; - case 195: s = "invalid EmbeddedStatement"; break; - case 196: s = "invalid ForInitializer"; break; - case 197: s = "invalid GotoStatement"; break; - case 198: s = "invalid TryStatement"; break; - case 199: s = "invalid ResourceAcquisition"; break; - case 200: s = "invalid SwitchLabel"; break; - case 201: s = "invalid CatchClauses"; break; - case 202: s = "invalid UnaryExpr"; break; - case 203: s = "invalid PrimaryExpr"; break; - case 204: s = "invalid PrimaryExpr"; break; - case 205: s = "invalid PrimaryExpr"; break; - case 206: s = "invalid PrimaryExpr"; break; - case 207: s = "invalid TypeArgumentList"; break; - case 208: s = "invalid NewExpression"; break; - case 209: s = "invalid NewExpression"; break; - case 210: s = "invalid LambdaExpressionParameter"; break; - case 211: s = "invalid LambdaExpressionBody"; break; - case 212: s = "invalid RelationalExpr"; break; - case 213: s = "invalid RelationalExpr"; break; - case 214: s = "invalid TypeParameterConstraintsClauseBase"; break; - case 215: s = "invalid QueryExpressionBody"; break; + case 176: s = "invalid InterfaceMemberDecl"; break; + case 177: s = "invalid InterfaceMemberDecl"; break; + case 178: s = "invalid TypeWithRestriction"; break; + case 179: s = "invalid TypeWithRestriction"; break; + case 180: s = "invalid SimpleType"; break; + case 181: s = "invalid AccessorModifiers"; break; + case 182: s = "invalid EventAccessorDecls"; break; + case 183: s = "invalid ConstructorInitializer"; break; + case 184: s = "invalid OverloadableOperator"; break; + case 185: s = "invalid AccessorDecls"; break; + case 186: s = "invalid InterfaceAccessors"; break; + case 187: s = "invalid InterfaceAccessors"; break; + case 188: s = "invalid GetAccessorDecl"; break; + case 189: s = "invalid SetAccessorDecl"; break; + case 190: s = "invalid VariableInitializer"; break; + case 191: s = "this symbol not expected in Statement"; break; + case 192: s = "invalid Statement"; break; + case 193: s = "invalid AssignmentOperator"; break; + case 194: s = "invalid ObjectPropertyInitializerOrVariableInitializer"; break; + case 195: s = "invalid ObjectPropertyInitializerOrVariableInitializer"; break; + case 196: s = "invalid EmbeddedStatement"; break; + case 197: s = "invalid EmbeddedStatement"; break; + case 198: s = "this symbol not expected in EmbeddedStatement"; break; + case 199: s = "invalid EmbeddedStatement"; break; + case 200: s = "invalid ForInitializer"; break; + case 201: s = "invalid GotoStatement"; break; + case 202: s = "invalid TryStatement"; break; + case 203: s = "invalid ResourceAcquisition"; break; + case 204: s = "invalid SwitchLabel"; break; + case 205: s = "invalid CatchClauses"; break; + case 206: s = "invalid UnaryExpr"; break; + case 207: s = "invalid PrimaryExpr"; break; + case 208: s = "invalid PrimaryExpr"; break; + case 209: s = "invalid PrimaryExpr"; break; + case 210: s = "invalid TypeArgumentList"; break; + case 211: s = "invalid NewExpression"; break; + case 212: s = "invalid NewExpression"; break; + case 213: s = "invalid LambdaExpressionParameter"; break; + case 214: s = "invalid LambdaExpressionBody"; break; + case 215: s = "invalid RelationalExpr"; break; + case 216: s = "invalid RelationalExpr"; break; + case 217: s = "invalid TypeParameterConstraintsClauseBase"; break; + case 218: s = "invalid QueryExpressionBody"; break; default: s = "error " + errorNumber; break; } @@ -6046,7 +6071,7 @@ out expr); } static bool[,] set = { - {T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x}, + {T,T,T,x, T,T,T,x, x,x,x,T, x,x,x,x, T,x,T,x, T,x,x,x, T,x,x,T, T,x,x,T, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,T, T,T,T,x, x,T,T,T, T,T,T,T, T,T,T,x, T,T,T,T, T,x,T,T, T,T,T,T, T,x,T,T, T,x,T,T, x,T,T,T, x,x,T,x, T,T,T,T, x,T,T,T, T,T,x,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x}, {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,T, x,x,x,x, T,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,x,x,x, T,T,x,x, x,x,x,x, T,T,T,x, x,x,x,T, x,x,x,T, x,T,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x}, {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,T, x,x,x,x, T,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,x,x,x, x,T,x,x, x,x,x,x, T,T,T,x, x,x,x,T, x,x,x,T, x,T,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x}, {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,T,x,x, x,x,x,x, T,T,T,x, x,x,x,T, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x}, @@ -6059,8 +6084,10 @@ out expr); {x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,T,x, x,T,x,x, x,x,T,x, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,T,x, x,x,x,T, x,x,x,T, x,x,x,x, x,x,x,x, x,x,T,x, T,x,x,x, T,x,x,x, x,x,x,x, T,T,x,x, T,x,x,T, x,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x}, {x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,T,x, x,T,x,x, x,x,T,x, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,T,x, x,x,x,T, x,x,x,T, x,T,x,T, x,x,x,x, T,x,T,x, T,x,x,x, T,x,x,x, x,x,x,x, T,T,x,x, T,x,x,T, x,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x}, {x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, T,x,T,x, x,T,x,T, T,x,T,x, T,x,T,x, T,T,T,T, x,x,T,T, x,x,x,x, T,x,T,T, T,x,x,T, x,T,x,T, x,x,T,x, T,T,T,T, x,x,T,T, T,x,x,T, T,T,x,x, x,x,x,x, T,T,x,T, T,x,T,T, T,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x}, + {T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, T,x,T,x, x,T,x,T, T,x,T,x, T,x,T,x, T,T,T,T, x,x,T,T, x,x,x,x, T,x,T,T, T,x,x,T, x,T,x,T, x,x,T,x, T,T,T,T, x,x,T,T, T,x,x,T, T,T,x,x, x,x,x,x, T,T,x,T, T,x,T,T, T,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x}, {x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, T,x,T,x, x,T,x,T, T,x,T,x, T,x,T,x, T,T,T,T, x,x,T,T, x,x,x,x, T,x,T,T, T,x,x,T, x,T,x,T, x,x,T,x, T,T,T,T, x,x,T,T, T,x,x,T, T,T,x,x, x,x,x,x, T,T,x,T, T,x,T,T, T,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x}, {x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,T,x, x,T,x,x, x,x,T,x, x,x,T,x, x,T,x,x, x,x,x,T, x,x,x,x, x,x,T,x, x,x,x,T, x,T,x,T, x,x,x,x, x,x,x,x, x,x,T,x, T,x,x,x, T,x,x,x, x,x,x,x, T,T,x,x, T,x,x,T, x,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x}, + {T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,T,x, x,T,x,x, x,x,T,x, x,x,T,x, x,T,x,x, x,x,x,T, x,x,x,x, x,x,T,x, x,x,x,T, x,T,x,T, x,x,x,x, x,x,x,x, x,x,T,x, T,x,x,x, T,x,x,x, x,x,x,x, T,T,x,x, T,x,x,T, x,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x}, {x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x}, {x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,T,x, x,T,x,x, x,x,T,x, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,T,x, x,x,x,T, x,x,x,T, x,T,x,x, x,x,x,x, T,x,T,x, T,x,x,x, T,x,x,x, x,x,x,x, T,T,x,x, T,x,x,T, x,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x}, {x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x}, @@ -6073,6 +6100,7 @@ out expr); {x,T,T,x, T,T,T,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, T,x,x,T, T,x,x,T, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,x,T,x, x,T,T,x, x,x,T,T, T,x,T,x, x,x,x,x, T,x,x,T, x,x,x,x, x,x,T,x, x,x,x,T, x,T,T,T, x,T,x,x, x,x,x,x, T,x,T,x, T,T,x,x, T,x,x,T, x,T,x,T, T,T,T,x, T,x,x,x, x,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x}, {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x}, {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x}, + {T,T,T,x, T,T,T,x, x,x,x,T, x,x,x,x, T,x,x,x, T,x,x,x, T,x,x,T, T,x,x,T, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,T,T,x, x,T,T,x, T,T,T,T, T,T,T,x, x,x,x,x, T,x,T,T, T,T,T,T, x,x,T,x, x,x,T,T, x,T,T,T, x,x,x,x, x,x,x,x, x,T,T,x, T,T,x,x, T,x,T,T, T,T,T,T, T,T,T,T, T,T,x,x, x,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x}, {x,T,T,x, T,T,T,x, x,x,x,T, x,x,x,x, T,x,x,x, T,x,x,x, T,x,x,T, T,x,x,T, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,T,T,x, x,T,T,x, x,T,T,T, T,T,T,x, x,x,x,x, T,x,T,T, T,T,T,T, x,x,T,x, x,x,T,T, x,T,T,T, x,x,x,x, x,x,x,x, x,T,T,x, T,T,x,x, T,x,T,T, T,T,T,T, T,T,T,T, T,T,x,x, x,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x}, {x,T,T,x, T,T,T,x, x,x,x,x, x,x,x,x, T,x,x,x, T,x,x,x, T,x,x,T, T,x,x,T, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,x,T,x, x,T,T,x, x,x,T,T, T,x,T,x, x,x,x,x, T,x,x,T, x,x,x,x, x,x,T,x, x,x,x,T, x,T,T,T, x,x,x,x, x,x,x,x, x,x,T,x, T,T,T,x, T,x,x,T, x,T,x,T, T,T,T,x, T,x,x,x, x,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x}, {x,T,T,x, T,T,T,x, x,x,x,T, x,x,x,x, T,x,x,x, T,x,x,x, T,x,x,T, T,x,x,T, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,T,T,T, x,T,T,x, T,T,T,T, T,T,T,x, x,x,x,x, T,x,T,T, T,T,T,T, x,x,T,x, x,x,T,T, x,T,T,T, x,x,x,x, x,x,x,x, x,T,T,x, T,T,x,x, T,x,T,T, T,T,T,T, T,T,T,T, T,T,x,x, x,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x}, diff --git a/src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG b/src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG index 409c35ad8f..6bc983061c 100644 --- a/src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG +++ b/src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG @@ -362,7 +362,9 @@ TypeDecl attributes> { TypeParameterConstraintsClause } (. newType.BodyStartLocation = t.EndLocation; .) - "{" ClassBody "}" + "{" + ClassBody + "}" [ ";" ] (. newType.EndLocation = t.Location; compilationUnit.BlockEnd(); .) @@ -478,6 +480,7 @@ ClassBody { (.List attributes = new List(); ModifierList m = new ModifierList(); .) + SYNC { AttributeSection (. attributes.Add(section); .) } MemberModifiers ClassMemberDecl @@ -505,7 +508,7 @@ StructBody MemberModifiers StructMemberDecl } - "}" + "}" . InterfaceBase names> @@ -520,7 +523,7 @@ InterfaceBase names> InterfaceBody = "{" - { InterfaceMemberDecl } + { SYNC InterfaceMemberDecl } "}" . @@ -531,7 +534,8 @@ EnumBody (. FieldDeclaration f; .) { IF (NotFinalComma()) "," EnumMemberDecl (. compilationUnit.AddChild(f); .) } - [","] ] "}" + [","] ] + "}" . Type @@ -1326,7 +1330,8 @@ Argument "ref" (. fd = FieldDirection.Ref; .) | "out" (. fd = FieldDirection.Out; .) ] - Expr (. argumentexpr = fd != FieldDirection.None ? argumentexpr = new DirectionExpression(fd, expr) : expr; .) + Expr + (. argumentexpr = fd != FieldDirection.None ? argumentexpr = new DirectionExpression(fd, expr) : expr; .) . AssignmentOperator @@ -1415,7 +1420,8 @@ LocalVariableDecl LocalVariableDeclarator (. Expression expr = null; .) = - Identifier (. var = new VariableDeclaration(t.val); .) [ "=" VariableInitializer (. var.Initializer = expr; .) ] + Identifier (. var = new VariableDeclaration(t.val); .) + [ "=" VariableInitializer (. var.Initializer = expr; .) ] . Statement @@ -1426,6 +1432,7 @@ Statement Location startPos = la.Location; .) = + SYNC ( /*--- labeled statement: */ IF (IsLabel()) Identifier (. compilationUnit.AddChild(new LabelStatement(t.val)); .) @@ -1436,9 +1443,11 @@ Statement "=" Expr (. var.Variables.Add(new VariableDeclaration(ident, expr)); .) { "," Identifier (. ident = t.val; .) "=" Expr (. var.Variables.Add(new VariableDeclaration(ident, expr)); .) } ";" (. compilationUnit.AddChild(var); .) + /*--- local variable declaration: */ - | IF (IsLocalVarDecl()) LocalVariableDecl ";" (. compilationUnit.AddChild(stmt); .) - | EmbeddedStatement (. compilationUnit.AddChild(stmt); .) + | IF (IsLocalVarDecl()) LocalVariableDecl ";" (. compilationUnit.AddChild(stmt); .) + + | EmbeddedStatement (. compilationUnit.AddChild(stmt); .) /* LL(1) confict: LocalVariableDecl * * <-> StatementExpr * * ident {"." ident} { "[" Expr ... */ @@ -1459,17 +1468,108 @@ EmbeddedStatement statement = null; .) = - Block - /*--- empty statement: */ - | ";" (. statement = new EmptyStatement(); .) - /*--- checked / unchecked statement: */ - | IF (UnCheckedAndLBrace()) (. Statement block; bool isChecked = true; .) - ("checked" | "unchecked" (. isChecked = false;.) ) - Block (. statement = isChecked ? (Statement)new CheckedStatement(block) : (Statement)new UncheckedStatement(block); .) - /*--- selection statements (if, switch): */ - | "if" (. Statement elseStatement = null; .) + (. Location startLocation = la.Location; .) + ( + Block + + /*--- empty statement: */ + | ";" (. statement = new EmptyStatement(); .) + + /*--- checked / unchecked statement: */ + | IF (UnCheckedAndLBrace()) (. Statement block; bool isChecked = true; .) + ("checked" | "unchecked" (. isChecked = false;.) ) + Block (. statement = isChecked ? (Statement)new CheckedStatement(block) : (Statement)new UncheckedStatement(block); .) + + /*--- selection statements (if, switch): */ + | IfStatement + + | "switch" (. List switchSections = new List(); .) + "(" Expr ")" + "{" SwitchSections + "}" (. statement = new SwitchStatement(expr, switchSections); .) + + /*--- iteration statements (while, do, for, foreach): */ + | "while" "(" Expr ")" + EmbeddedStatement + (. statement = new DoLoopStatement(expr, embeddedStatement, ConditionType.While, ConditionPosition.Start);.) + + | "do" EmbeddedStatement "while" + "(" Expr ")" ";" + (. statement = new DoLoopStatement(expr, embeddedStatement, ConditionType.While, ConditionPosition.End); .) + + | "for" (. List initializer = null; List iterator = null; .) + "(" [ ForInitializer ] ";" + [ Expr ] ";" + [ ForIterator ] ")" + EmbeddedStatement (. statement = new ForStatement(initializer, expr, iterator, embeddedStatement); .) + + | "foreach" "(" Type Identifier (. string varName = t.val; .) + "in" Expr ")" + EmbeddedStatement + (. statement = new ForeachStatement(type, varName , expr, embeddedStatement); .) + + /*--- jump statements (break, contine, goto, return, throw): */ + | "break" ";" (. statement = new BreakStatement(); .) + | "continue" ";" (. statement = new ContinueStatement(); .) + | GotoStatement + + | IF (IsYieldStatement()) "yield" + ( "return" Expr (. statement = new YieldStatement(new ReturnStatement(expr)); .) + | "break" (. statement = new YieldStatement(new BreakStatement()); .) ) + ";" + + | "return" [ Expr ] ";" (. statement = new ReturnStatement(expr); .) + | "throw" [ Expr ] ";" (. statement = new ThrowStatement(expr); .) + + /*--- expression statement: */ + | StatementExpr SYNC ";" + + /*--- try statement: */ + | TryStatement + + /*--- lock satement: */ + | "lock" "(" Expr ")" + EmbeddedStatement (. statement = new LockStatement(expr, embeddedStatement); .) + + /*--- using statement: */ + | (.Statement resourceAcquisitionStmt = null; .) + "using" "(" + ResourceAcquisition ")" + EmbeddedStatement (. statement = new UsingStatement(resourceAcquisitionStmt, embeddedStatement); .) + + /*--- unsafe statement: */ + | "unsafe" Block (. statement = new UnsafeStatement(embeddedStatement); .) + /*--- fixed statement: */ + | "fixed" + "(" Type (. if (type.PointerNestingLevel == 0) Error("can only fix pointer types"); + List pointerDeclarators = new List(1); + .) + Identifier (. string identifier = t.val; .) + "=" Expr (. pointerDeclarators.Add(new VariableDeclaration(identifier, expr)); .) + { + "," Identifier (. identifier = t.val; .) + "=" Expr (. pointerDeclarators.Add(new VariableDeclaration(identifier, expr)); .) + } + ")" EmbeddedStatement (. statement = new FixedStatement(type, pointerDeclarators, embeddedStatement); .) + ) + (. if (statement != null) { + statement.StartLocation = startLocation; + statement.EndLocation = t.EndLocation; + } + .) +. + +IfStatement +(. + Expression expr = null; + Statement embeddedStatement = null; + statement = null; +.) += + "if" "(" Expr ")" EmbeddedStatement + (. Statement elseStatement = null; .) [ "else" EmbeddedStatement ] (. statement = elseStatement != null ? new IfElseStatement(expr, embeddedStatement, elseStatement) : new IfElseStatement(expr, embeddedStatement); .) (. if (elseStatement is IfElseStatement && (elseStatement as IfElseStatement).TrueStatement.Count == 1) { @@ -1479,62 +1579,8 @@ EmbeddedStatement (elseStatement as IfElseStatement).TrueStatement[0])); (statement as IfElseStatement).ElseIfSections.AddRange((elseStatement as IfElseStatement).ElseIfSections); (statement as IfElseStatement).FalseStatement = (elseStatement as IfElseStatement).FalseStatement; - } .) - | "switch" (. List switchSections = new List(); .) - "(" Expr ")" - "{" SwitchSections - "}" (. statement = new SwitchStatement(expr, switchSections); .) - /*--- iteration statements (while, do, for, foreach): */ - | "while" "(" Expr ")" - - EmbeddedStatement (. statement = new DoLoopStatement(expr, embeddedStatement, ConditionType.While, ConditionPosition.Start);.) - | "do" EmbeddedStatement "while" - "(" Expr ")" ";" (. statement = new DoLoopStatement(expr, embeddedStatement, ConditionType.While, ConditionPosition.End); .) - | "for" (. List initializer = null; List iterator = null; .) - "(" [ ForInitializer ] ";" - [ Expr ] ";" - [ ForIterator ] ")" - EmbeddedStatement (. statement = new ForStatement(initializer, expr, iterator, embeddedStatement); .) - | "foreach" "(" Type Identifier (. string varName = t.val; Location start = t.Location;.) - "in" Expr ")" - EmbeddedStatement (. statement = new ForeachStatement(type, varName , expr, embeddedStatement); - statement.EndLocation = t.EndLocation; - .) - /*--- jump statements (break, contine, goto, return, throw): */ - | "break" ";" (. statement = new BreakStatement(); .) - | "continue" ";" (. statement = new ContinueStatement(); .) - | GotoStatement - | IF (IsYieldStatement()) "yield" ( "return" Expr (. statement = new YieldStatement(new ReturnStatement(expr)); .) - | "break" (. statement = new YieldStatement(new BreakStatement()); .) ) ";" - | "return" [ Expr ] ";" (. statement = new ReturnStatement(expr); .) - | "throw" [ Expr ] ";" (. statement = new ThrowStatement(expr); .) - - /*--- expression statement: */ - | StatementExpr ";" - /*--- try statement: */ - | TryStatement - /*--- lock satement: */ - | "lock" "(" Expr ")" - EmbeddedStatement (. statement = new LockStatement(expr, embeddedStatement); .) - /*--- using statement: */ - | (.Statement resourceAcquisitionStmt = null; .) - "using" "(" - ResourceAcquisition ")" - EmbeddedStatement (. statement = new UsingStatement(resourceAcquisitionStmt, embeddedStatement); .) - /*--- unsafe statement: */ - | "unsafe" Block (. statement = new UnsafeStatement(embeddedStatement); .) - /*--- fixed statement: */ - | "fixed" - "(" Type (. if (type.PointerNestingLevel == 0) Error("can only fix pointer types"); - List pointerDeclarators = new List(1); - .) - Identifier (. string identifier = t.val; .) - "=" Expr (. pointerDeclarators.Add(new VariableDeclaration(identifier, expr)); .) - { - "," Identifier (. identifier = t.val; .) - "=" Expr (. pointerDeclarators.Add(new VariableDeclaration(identifier, expr)); .) - } - ")" EmbeddedStatement (. statement = new FixedStatement(type, pointerDeclarators, embeddedStatement); .) + } + .) . ForInitializer initializer> @@ -1670,6 +1716,7 @@ StatementExpr Expr (. expr = null; Expression expr1 = null, expr2 = null; AssignmentOperatorType op; .) = + (. Location startLocation = la.Location; .) UnaryExpr /*--- conditional expression: */ ( @@ -1682,6 +1729,11 @@ Expr [ "?" Expr ":" Expr (. expr = new ConditionalExpression(expr, expr1, expr2); .) ] ) ) + (. if (expr != null) { + expr.StartLocation = startLocation; + expr.EndLocation = t.EndLocation; + } + .) . @@ -1752,79 +1804,83 @@ PrimaryExpr pexpr = null; .) = + (. Location startLocation = la.Location; .) ( "true" (.pexpr = new PrimitiveExpression(true, "true"); .) - | "false" (.pexpr = new PrimitiveExpression(false, "false"); .) - | "null" (.pexpr = new PrimitiveExpression(null, "null"); .) /* from literal token */ - | Literal (.pexpr = new PrimitiveExpression(t.literalValue, t.val); .) - | IF (StartOfQueryExpression()) - QueryExpression - | IF (IdentAndDoubleColon()) - Identifier (. type = new TypeReference(t.val); .) - "::" (. pexpr = new TypeReferenceExpression(type); .) - Identifier (. if (type.Type == "global") { type.IsGlobal = true; type.Type = (t.val ?? "?"); } else type.Type += "." + (t.val ?? "?"); .) + | "false" (.pexpr = new PrimitiveExpression(false, "false"); .) + | "null" (.pexpr = new PrimitiveExpression(null, "null"); .) /* from literal token */ + | Literal (.pexpr = new PrimitiveExpression(t.literalValue, t.val); .) + | IF (StartOfQueryExpression()) + QueryExpression + | IF (IdentAndDoubleColon()) + Identifier (. type = new TypeReference(t.val); .) + "::" (. pexpr = new TypeReferenceExpression(type); .) + Identifier (. if (type.Type == "global") { type.IsGlobal = true; type.Type = (t.val ?? "?"); } else type.Type += "." + (t.val ?? "?"); .) + /*--- simple name (IdentifierExpression): */ - | Identifier - (. pexpr = new IdentifierExpression(t.val); .) - (. pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation; .) - - [ ShortedLambdaExpression<(IdentifierExpression)pexpr, out pexpr> - | IF (IsGenericInSimpleNameOrMemberAccess()) - (. List typeList; .) - TypeArgumentList - (. ((IdentifierExpression)pexpr).TypeArguments = typeList; .) - ] - | IF (IsLambdaExpression()) /* Lambda expression */ - LambdaExpression + | Identifier + (. pexpr = new IdentifierExpression(t.val); .) + + [ ShortedLambdaExpression<(IdentifierExpression)pexpr, out pexpr> + | IF (IsGenericInSimpleNameOrMemberAccess()) + (. List typeList; .) + TypeArgumentList + (. ((IdentifierExpression)pexpr).TypeArguments = typeList; .) + ] + | IF (IsLambdaExpression()) /* Lambda expression */ + LambdaExpression + /*--- parenthesized expression: */ - | "(" Expr ")" (. pexpr = new ParenthesizedExpression(expr); .) - | /*--- predefined type member access: */ + | "(" Expr ")" (. pexpr = new ParenthesizedExpression(expr); .) + + | /*--- predefined type member access: */ (. string val = null; .) - ( - "bool" (. val = "bool"; .) - | "byte" (. val = "byte"; .) - | "char" (. val = "char"; .) - | "decimal" (. val = "decimal"; .) - | "double" (. val = "double"; .) - | "float" (. val = "float"; .) - | "int" (. val = "int"; .) - | "long" (. val = "long"; .) - | "object" (. val = "object"; .) - | "sbyte" (. val = "sbyte"; .) - | "short" (. val = "short"; .) - | "string" (. val = "string"; .) - | "uint" (. val = "uint"; .) - | "ulong" (. val = "ulong"; .) - | "ushort" (. val = "ushort"; .) - ) - MemberAccess + ( "bool" (. val = "bool"; .) + | "byte" (. val = "byte"; .) + | "char" (. val = "char"; .) + | "decimal" (. val = "decimal"; .) + | "double" (. val = "double"; .) + | "float" (. val = "float"; .) + | "int" (. val = "int"; .) + | "long" (. val = "long"; .) + | "object" (. val = "object"; .) + | "sbyte" (. val = "sbyte"; .) + | "short" (. val = "short"; .) + | "string" (. val = "string"; .) + | "uint" (. val = "uint"; .) + | "ulong" (. val = "ulong"; .) + | "ushort" (. val = "ushort"; .) + ) + MemberAccess + /*--- this access: */ - | "this" (. pexpr = new ThisReferenceExpression(); .) + | "this" (. pexpr = new ThisReferenceExpression(); .) /*--- base access: */ - | "base" (. Expression retExpr = new BaseReferenceExpression(); .) - ( - MemberAccess - | "[" Expr (. List indices = new List(); if (expr != null) { indices.Add(expr); } .) - { "," Expr (. if (expr != null) { indices.Add(expr); } .) } - "]" (. retExpr = new IndexerExpression(retExpr, indices); .) - ) (. pexpr = retExpr; .) - + | "base" (. pexpr = new BaseReferenceExpression(); .) + /* new ... - ObjectCreationExpression or ArrayCreateExpression */ - | NewExpression (.pexpr = expr; .) - - | "typeof" "(" + | NewExpression + + | "typeof" "(" ( IF (NotVoidPointer()) "void" (. type = new TypeReference("void"); .) - | TypeWithRestriction - ) ")" (. pexpr = new TypeOfExpression(type); .) + | TypeWithRestriction + ) + ")" (. pexpr = new TypeOfExpression(type); .) - | "default" "(" Type ")" (. pexpr = new DefaultValueExpression(type); .) - | "sizeof" "(" Type ")" (. pexpr = new SizeOfExpression(type); .) - | "checked" "(" Expr ")" (. pexpr = new CheckedExpression(expr); .) - | "unchecked" "(" Expr ")" (. pexpr = new UncheckedExpression(expr); .) - | "delegate" AnonymousMethodExpr (. pexpr = expr; .) + | "default" "(" Type ")" (. pexpr = new DefaultValueExpression(type); .) + | "sizeof" "(" Type ")" (. pexpr = new SizeOfExpression(type); .) + | "checked" "(" Expr ")" (. pexpr = new CheckedExpression(expr); .) + | "unchecked" "(" Expr ")" (. pexpr = new UncheckedExpression(expr); .) + | "delegate" AnonymousMethodExpr (. pexpr = expr; .) ) + (. if (pexpr != null) { + pexpr.StartLocation = startLocation; + pexpr.EndLocation = t.EndLocation; + } + .) { + (. startLocation = la.Location; .) ( "++" (. pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostIncrement); .) | "--" (. pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostDecrement); .) @@ -1836,8 +1892,10 @@ PrimaryExpr /*--- invocation expression: */ | "(" (. List parameters = new List(); .) [ Argument (. if (expr != null) {parameters.Add(expr);} .) - { "," Argument (. if (expr != null) {parameters.Add(expr);} .) - } ] ")" (. pexpr = new InvocationExpression(pexpr, parameters); .) + { "," Argument (. if (expr != null) {parameters.Add(expr);} .) + } + ] + ")" (. pexpr = new InvocationExpression(pexpr, parameters); .) /*--- element access */ | (. /*if (isArrayCreation) Error("element access not allow on array creation");*/ List indices = new List(); @@ -1845,6 +1903,12 @@ PrimaryExpr "[" Expr (. if (expr != null) { indices.Add(expr); } .) { "," Expr (. if (expr != null) { indices.Add(expr); } .) } "]" (. pexpr = new IndexerExpression(pexpr, indices); .) + + (. if (pexpr != null) { + pexpr.StartLocation = startLocation; + pexpr.EndLocation = t.EndLocation; + } + .) } . diff --git a/src/Libraries/NRefactory/Project/Src/SnippetParser.cs b/src/Libraries/NRefactory/Project/Src/SnippetParser.cs index 66ee835964..048268d912 100644 --- a/src/Libraries/NRefactory/Project/Src/SnippetParser.cs +++ b/src/Libraries/NRefactory/Project/Src/SnippetParser.cs @@ -117,6 +117,8 @@ namespace ICSharpCode.NRefactory set { throw new NotSupportedException(); } } + public object UserData { get; set; } + public object AcceptChildren(IAstVisitor visitor, object data) { foreach (INode n in nodes) { diff --git a/src/Main/Base/Project/Src/Gui/AbstractViewContent.cs b/src/Main/Base/Project/Src/Gui/AbstractViewContent.cs index d95022c4f2..8293c053ec 100644 --- a/src/Main/Base/Project/Src/Gui/AbstractViewContent.cs +++ b/src/Main/Base/Project/Src/Gui/AbstractViewContent.cs @@ -53,13 +53,22 @@ namespace ICSharpCode.SharpDevelop.Gui IWorkbenchWindow IViewContent.WorkbenchWindow { get { return workbenchWindow; } - set { workbenchWindow = value; } + set { + if (workbenchWindow != value) { + workbenchWindow = value; + OnWorkbenchWindowChanged(); + } + } } public IWorkbenchWindow WorkbenchWindow { get { return workbenchWindow; } } + protected virtual void OnWorkbenchWindowChanged() + { + } + string tabPageText = "TabPageText"; public event EventHandler TabPageTextChanged; diff --git a/src/Main/Base/Project/Src/Gui/IWorkbenchWindow.cs b/src/Main/Base/Project/Src/Gui/IWorkbenchWindow.cs index bf9a48b8b9..50753c595b 100644 --- a/src/Main/Base/Project/Src/Gui/IWorkbenchWindow.cs +++ b/src/Main/Base/Project/Src/Gui/IWorkbenchWindow.cs @@ -38,6 +38,14 @@ namespace ICSharpCode.SharpDevelop.Gui set; } + /// + /// Gets/Sets the icon of the view content. + /// + System.Drawing.Icon Icon { + get; + set; + } + /// /// Is raised when the ActiveViewContent property has changed. /// diff --git a/src/Main/Base/Project/Src/Gui/Pads/FileScout.cs b/src/Main/Base/Project/Src/Gui/Pads/FileScout.cs index 7efde4dcb5..8ca2375cc4 100644 --- a/src/Main/Base/Project/Src/Gui/Pads/FileScout.cs +++ b/src/Main/Base/Project/Src/Gui/Pads/FileScout.cs @@ -19,7 +19,7 @@ using ICSharpCode.SharpDevelop.Project; namespace ICSharpCode.SharpDevelop.Gui { - public class DriveObject + sealed class DriveObject { DriveInfo driveInfo; string text = null; @@ -64,7 +64,7 @@ namespace ICSharpCode.SharpDevelop.Gui } } - class IconManager + sealed class IconManager { private static ImageList icons = new ImageList(); private static Hashtable iconIndecies = new Hashtable(); @@ -110,7 +110,7 @@ namespace ICSharpCode.SharpDevelop.Gui } } - public class FileList : ListView + sealed class FileList : ListView { private FileSystemWatcher watcher; @@ -305,7 +305,7 @@ namespace ICSharpCode.SharpDevelop.Gui EndUpdate(); } - public class FileListItem : ListViewItem + internal class FileListItem : ListViewItem { string fullname; public string FullName { @@ -403,7 +403,7 @@ namespace ICSharpCode.SharpDevelop.Gui } } - public class ShellTree : TreeView + sealed class ShellTree : TreeView { public string NodePath { get { diff --git a/src/Main/Base/Project/Src/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs b/src/Main/Base/Project/Src/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs index 5920ddfe62..0cb1001ea2 100644 --- a/src/Main/Base/Project/Src/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs +++ b/src/Main/Base/Project/Src/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs @@ -66,7 +66,7 @@ namespace ICSharpCode.SharpDevelop.Gui public IViewContent ActiveViewContent { get { Debug.Assert(WorkbenchSingleton.InvokeRequired == false); - if (viewTabControl != null && viewTabControl.SelectedIndex >= 0) { + if (viewTabControl != null && viewTabControl.SelectedIndex >= 0 && viewTabControl.SelectedIndex < ViewContents.Count) { return ViewContents[viewTabControl.SelectedIndex]; } else if (ViewContents.Count == 1) { return ViewContents[0]; diff --git a/src/Main/Base/Project/Src/Gui/WorkbenchSingleton.cs b/src/Main/Base/Project/Src/Gui/WorkbenchSingleton.cs index 815ede51f6..1c7e5b4f35 100644 --- a/src/Main/Base/Project/Src/Gui/WorkbenchSingleton.cs +++ b/src/Main/Base/Project/Src/Gui/WorkbenchSingleton.cs @@ -144,6 +144,8 @@ namespace ICSharpCode.SharpDevelop.Gui public STAThreadCaller(Control ctl) { + if (ctl == null) + throw new ArgumentNullException("ctl"); this.ctl = ctl; } diff --git a/src/Main/Base/Project/Src/Services/DisplayBinding/ShellExecuteDisplayBinding.cs b/src/Main/Base/Project/Src/Services/DisplayBinding/ShellExecuteDisplayBinding.cs index 374c4c7da5..9a88fe5baa 100644 --- a/src/Main/Base/Project/Src/Services/DisplayBinding/ShellExecuteDisplayBinding.cs +++ b/src/Main/Base/Project/Src/Services/DisplayBinding/ShellExecuteDisplayBinding.cs @@ -6,6 +6,7 @@ // using System; +using System.IO; using ICSharpCode.Core; using System.Diagnostics; @@ -27,7 +28,9 @@ namespace ICSharpCode.SharpDevelop // TODO: warn user that the file must be saved } try { - Process.Start(file.FileName); + Process.Start(new ProcessStartInfo(file.FileName) { + WorkingDirectory = Path.GetDirectoryName(file.FileName) + }); } catch (Exception ex) { MessageService.ShowError(ex.Message); } diff --git a/src/Main/Base/Project/Src/Services/ParserService/ParserService.cs b/src/Main/Base/Project/Src/Services/ParserService/ParserService.cs index 4b40cd4ae9..3af075550d 100644 --- a/src/Main/Base/Project/Src/Services/ParserService/ParserService.cs +++ b/src/Main/Base/Project/Src/Services/ParserService/ParserService.cs @@ -388,11 +388,6 @@ namespace ICSharpCode.SharpDevelop LoggingService.Info("ParserUpdateThread stopped"); } - static IViewContent GetActiveViewContent() - { - return WorkbenchSingleton.Workbench.ActiveViewContent; - } - public static void ParseCurrentViewContent() { ParserUpdateStep(); @@ -400,9 +395,22 @@ namespace ICSharpCode.SharpDevelop static void ParserUpdateStep() { - IViewContent activeViewContent; + IViewContent activeViewContent = null; + string fileName = null; + bool isUntitled = false; try { - activeViewContent = WorkbenchSingleton.SafeThreadFunction(GetActiveViewContent); + WorkbenchSingleton.SafeThreadCall( + delegate { + try { + activeViewContent = WorkbenchSingleton.Workbench.ActiveViewContent; + if (activeViewContent != null && activeViewContent.PrimaryFile != null) { + fileName = activeViewContent.PrimaryFileName; + isUntitled = activeViewContent.PrimaryFile.IsUntitled; + } + } catch (Exception ex) { + MessageService.ShowError(ex.ToString()); + } + }); } catch (InvalidOperationException) { // includes ObjectDisposedException // maybe workbench has been disposed while waiting for the SafeThreadCall // can occur after workbench unload or after aborting SharpDevelop with @@ -412,8 +420,6 @@ namespace ICSharpCode.SharpDevelop } IEditable editable = activeViewContent as IEditable; if (editable != null) { - #warning PrimaryFileName is not thread-safe, move all property accesses that are not guaranteed to be thread-safe into GetActiveViewContent - string fileName = activeViewContent.PrimaryFileName; string text = null; if (!(fileName == null || fileName.Length == 0)) { @@ -425,7 +431,7 @@ namespace ICSharpCode.SharpDevelop } int hash = text.GetHashCode(); if (!lastUpdateHash.ContainsKey(fileName) || lastUpdateHash[fileName] != hash) { - parseInformation = ParseFile(fileName, text, !activeViewContent.PrimaryFile.IsUntitled); + parseInformation = ParseFile(fileName, text, !isUntitled); lastUpdateHash[fileName] = hash; updated = true; } diff --git a/src/Main/Base/Project/Src/TextEditor/Gui/Editor/TextEditorDisplayBinding.cs b/src/Main/Base/Project/Src/TextEditor/Gui/Editor/TextEditorDisplayBinding.cs index 15c8c49f15..900effeeb4 100644 --- a/src/Main/Base/Project/Src/TextEditor/Gui/Editor/TextEditorDisplayBinding.cs +++ b/src/Main/Base/Project/Src/TextEditor/Gui/Editor/TextEditorDisplayBinding.cs @@ -312,12 +312,29 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor } } - ParserService.ClearParseInformation(oldFileName); + SetIcon(); + ParserService.ClearParseInformation(oldFileName); textEditorControl.FileName = newFileName; ParserService.ParseViewContent(this); } + protected override void OnWorkbenchWindowChanged() + { + base.OnWorkbenchWindowChanged(); + SetIcon(); + } + + void SetIcon() + { + if (this.WorkbenchWindow != null) { + System.Drawing.Icon icon = ResourceService.GetIcon(IconService.GetImageForFile(this.PrimaryFileName)); + if (icon != null) { + this.WorkbenchWindow.Icon = icon; + } + } + } + #region IPositionable implementation public void JumpTo(int line, int column) { diff --git a/src/Main/Base/Test/CSharpExpressionFinderTests.cs b/src/Main/Base/Test/CSharpExpressionFinderTests.cs index 9a1dd632af..cb86263e31 100644 --- a/src/Main/Base/Test/CSharpExpressionFinderTests.cs +++ b/src/Main/Base/Test/CSharpExpressionFinderTests.cs @@ -336,6 +336,19 @@ class Main { Assert.AreEqual(ExpressionContext.ObjectCreation.ToString(), result.Context.ToString()); } + [Test] + public void FindObjectCreationContextForConstructorInsight4() + { + const string program = @"using System; using System.Text; +class Main { + void M() { + StringBuilder b = new StringBuilderBla"; + + ExpressionResult result = ef.FindExpression(program, program.Length - 3); + Assert.AreEqual("StringBuilder", result.Expression); + Assert.AreEqual(ExpressionContext.ObjectCreation.ToString(), result.Context.ToString()); + } + [Test] public void ExpressionContextInFieldInitializer() { diff --git a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/CSharp/ExpressionFinder.cs b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/CSharp/ExpressionFinder.cs index 876973c7ba..eb6eceb11f 100644 --- a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/CSharp/ExpressionFinder.cs +++ b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/CSharp/ExpressionFinder.cs @@ -264,10 +264,13 @@ namespace ICSharpCode.SharpDevelop.Dom.CSharp while ((token = lexer.NextToken()) != null) { if (token.kind == Tokens.EOF) break; - if (targetPosition < token.EndLocation) { + if (targetPosition <= token.Location) { break; } ApplyToken(token); + if (targetPosition < token.EndLocation) { + break; + } lastToken = token.kind; } diff --git a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/CecilReader.cs b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/CecilReader.cs index 421c9e0a88..e41ee5d089 100644 --- a/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/CecilReader.cs +++ b/src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/CecilReader.cs @@ -453,7 +453,7 @@ namespace ICSharpCode.SharpDevelop.Dom if (field.IsLiteral) m |= ModifierEnum.Const; - else if (field.IsReadOnly) + else if (field.IsInitOnly) m |= ModifierEnum.Readonly; if ((field.Attributes & FieldAttributes.Public) == FieldAttributes.Public)