From bb59db87f238f9e9c2eb418bf82fff2813db592d Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Sat, 8 May 2010 07:32:07 +0000 Subject: [PATCH] [VB10] - removed returnTypeAttributes from OperatorDeclaration - implemented automatic properties in Parser - added Initializer property - added Unit Tests git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/vbnet@5783 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../NRefactoryASTGenerator/AST/TypeLevel.cs | 2 +- .../NRefactory/Project/Src/Ast/Generated.cs | 38 +- .../Project/Src/Parser/VBNet/Parser.cs | 2580 +++++++++-------- .../Project/Src/Parser/VBNet/VBNET.ATG | 62 +- .../Project/Src/Parser/VBNet/VBNetParser.cs | 53 +- .../Src/Visitors/AbstractASTVisitor.cs | 9 +- .../Src/Visitors/AbstractAstTransformer.cs | 16 +- .../TypeLevel/PropertyDeclarationTests.cs | 74 +- 8 files changed, 1504 insertions(+), 1330 deletions(-) diff --git a/src/Libraries/NRefactory/NRefactoryASTGenerator/AST/TypeLevel.cs b/src/Libraries/NRefactory/NRefactoryASTGenerator/AST/TypeLevel.cs index 5c4a24fec2..ea058cbfe8 100644 --- a/src/Libraries/NRefactory/NRefactoryASTGenerator/AST/TypeLevel.cs +++ b/src/Libraries/NRefactory/NRefactoryASTGenerator/AST/TypeLevel.cs @@ -159,7 +159,6 @@ namespace NRefactoryASTGenerator.Ast class OperatorDeclaration : MethodDeclaration { ConversionType conversionType; - List returnTypeAttributes; OverloadableOperatorType overloadableOperator; } @@ -185,6 +184,7 @@ namespace NRefactoryASTGenerator.Ast Location bodyEnd; PropertyGetRegion getRegion; PropertySetRegion setRegion; + Expression initializer; public PropertyDeclaration(Modifiers modifier, List attributes, string name, List parameters) diff --git a/src/Libraries/NRefactory/Project/Src/Ast/Generated.cs b/src/Libraries/NRefactory/Project/Src/Ast/Generated.cs index c53ca259e0..59922784f2 100644 --- a/src/Libraries/NRefactory/Project/Src/Ast/Generated.cs +++ b/src/Libraries/NRefactory/Project/Src/Ast/Generated.cs @@ -2991,8 +2991,6 @@ public Location ExtendedEndLocation { get; set; } ConversionType conversionType; - List returnTypeAttributes; - OverloadableOperatorType overloadableOperator; public ConversionType ConversionType { @@ -3004,15 +3002,6 @@ public Location ExtendedEndLocation { get; set; } } } - public List ReturnTypeAttributes { - get { - return returnTypeAttributes; - } - set { - returnTypeAttributes = value ?? new List(); - } - } - public OverloadableOperatorType OverloadableOperator { get { return overloadableOperator; @@ -3023,7 +3012,6 @@ public Location ExtendedEndLocation { get; set; } } public OperatorDeclaration() { - returnTypeAttributes = new List(); } public bool IsConversionOperator { @@ -3037,10 +3025,9 @@ public Location ExtendedEndLocation { get; set; } } public override string ToString() { - return string.Format("[OperatorDeclaration ConversionType={0} ReturnTypeAttributes={1} OverloadableOper" + - "ator={2} Body={3} HandlesClause={4} Templates={5} IsExtensionMethod={6} Interfac" + - "eImplementations={7} TypeReference={8} Name={9} Parameters={10} Attributes={11} " + - "Modifier={12}]", ConversionType, GetCollectionString(ReturnTypeAttributes), OverloadableOperator, Body, GetCollectionString(HandlesClause), GetCollectionString(Templates), IsExtensionMethod, GetCollectionString(InterfaceImplementations), TypeReference, Name, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier); + return string.Format("[OperatorDeclaration ConversionType={0} OverloadableOperator={1} Body={2} Handles" + + "Clause={3} Templates={4} IsExtensionMethod={5} InterfaceImplementations={6} Type" + + "Reference={7} Name={8} Parameters={9} Attributes={10} Modifier={11}]", ConversionType, OverloadableOperator, Body, GetCollectionString(HandlesClause), GetCollectionString(Templates), IsExtensionMethod, GetCollectionString(InterfaceImplementations), TypeReference, Name, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier); } } @@ -3299,6 +3286,8 @@ public Location ExtendedEndLocation { get; set; } PropertySetRegion setRegion; + Expression initializer; + public Location BodyStart { get { return bodyStart; @@ -3337,6 +3326,16 @@ public Location ExtendedEndLocation { get; set; } } } + public Expression Initializer { + get { + return initializer; + } + set { + initializer = value ?? Expression.Null; + if (!initializer.IsNull) initializer.Parent = this; + } + } + public PropertyDeclaration(Modifiers modifier, List attributes, string name, List parameters) { Modifier = modifier; Attributes = attributes; @@ -3346,6 +3345,7 @@ public Location ExtendedEndLocation { get; set; } bodyEnd = Location.Empty; getRegion = PropertyGetRegion.Null; setRegion = PropertySetRegion.Null; + initializer = Expression.Null; } public bool HasGetRegion { @@ -3395,9 +3395,9 @@ public Location ExtendedEndLocation { get; set; } } public override string ToString() { - return string.Format("[PropertyDeclaration BodyStart={0} BodyEnd={1} GetRegion={2} SetRegion={3} Interf" + - "aceImplementations={4} TypeReference={5} Name={6} Parameters={7} Attributes={8} " + - "Modifier={9}]", BodyStart, BodyEnd, GetRegion, SetRegion, GetCollectionString(InterfaceImplementations), TypeReference, Name, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier); + return string.Format("[PropertyDeclaration BodyStart={0} BodyEnd={1} GetRegion={2} SetRegion={3} Initia" + + "lizer={4} InterfaceImplementations={5} TypeReference={6} Name={7} Parameters={8}" + + " Attributes={9} Modifier={10}]", BodyStart, BodyEnd, GetRegion, SetRegion, Initializer, GetCollectionString(InterfaceImplementations), TypeReference, Name, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier); } } diff --git a/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Parser.cs b/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Parser.cs index b5ef0909ea..f8e3b7b69f 100644 --- a/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Parser.cs +++ b/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Parser.cs @@ -180,7 +180,7 @@ out u); void GlobalAttributeSection() { Expect(28); -#line 2535 "VBNET.ATG" +#line 2567 "VBNET.ATG" Location startPos = t.Location; if (la.kind == 52) { lexer.NextToken(); @@ -188,20 +188,20 @@ out u); lexer.NextToken(); } else SynErr(226); -#line 2537 "VBNET.ATG" +#line 2569 "VBNET.ATG" string attributeTarget = t.val != null ? t.val.ToLower(System.Globalization.CultureInfo.InvariantCulture) : null; List attributes = new List(); ASTAttribute attribute; Expect(11); Attribute( -#line 2541 "VBNET.ATG" +#line 2573 "VBNET.ATG" out attribute); -#line 2541 "VBNET.ATG" +#line 2573 "VBNET.ATG" attributes.Add(attribute); while ( -#line 2542 "VBNET.ATG" +#line 2574 "VBNET.ATG" NotFinalComma()) { if (la.kind == 12) { lexer.NextToken(); @@ -213,10 +213,10 @@ NotFinalComma()) { Expect(11); } Attribute( -#line 2542 "VBNET.ATG" +#line 2574 "VBNET.ATG" out attribute); -#line 2542 "VBNET.ATG" +#line 2574 "VBNET.ATG" attributes.Add(attribute); } if (la.kind == 12) { @@ -225,7 +225,7 @@ out attribute); Expect(27); EndOfStmt(); -#line 2547 "VBNET.ATG" +#line 2579 "VBNET.ATG" AttributeSection section = new AttributeSection { AttributeTarget = attributeTarget, Attributes = attributes, @@ -334,47 +334,47 @@ out aliasedType); } void Qualident( -#line 3293 "VBNET.ATG" +#line 3325 "VBNET.ATG" out string qualident) { -#line 3295 "VBNET.ATG" +#line 3327 "VBNET.ATG" string name; qualidentBuilder.Length = 0; Identifier(); -#line 3299 "VBNET.ATG" +#line 3331 "VBNET.ATG" qualidentBuilder.Append(t.val); while ( -#line 3300 "VBNET.ATG" +#line 3332 "VBNET.ATG" DotAndIdentOrKw()) { Expect(16); IdentifierOrKeyword( -#line 3300 "VBNET.ATG" +#line 3332 "VBNET.ATG" out name); -#line 3300 "VBNET.ATG" +#line 3332 "VBNET.ATG" qualidentBuilder.Append('.'); qualidentBuilder.Append(name); } -#line 3302 "VBNET.ATG" +#line 3334 "VBNET.ATG" qualident = qualidentBuilder.ToString(); } void TypeName( -#line 2408 "VBNET.ATG" +#line 2440 "VBNET.ATG" out TypeReference typeref) { -#line 2409 "VBNET.ATG" +#line 2441 "VBNET.ATG" ArrayList rank = null; NonArrayTypeName( -#line 2411 "VBNET.ATG" +#line 2443 "VBNET.ATG" out typeref, false); ArrayTypeModifiers( -#line 2415 "VBNET.ATG" +#line 2447 "VBNET.ATG" out rank); -#line 2416 "VBNET.ATG" +#line 2448 "VBNET.ATG" if (rank != null && typeref != null) { typeref.RankSpecifier = (int[])rank.ToArray(typeof(int)); } @@ -397,35 +397,35 @@ out rank); } void AttributeSection( -#line 2610 "VBNET.ATG" +#line 2642 "VBNET.ATG" out AttributeSection section) { -#line 2612 "VBNET.ATG" +#line 2644 "VBNET.ATG" string attributeTarget = "";List attributes = new List(); ASTAttribute attribute; Expect(28); -#line 2616 "VBNET.ATG" +#line 2648 "VBNET.ATG" Location startPos = t.Location; if ( -#line 2617 "VBNET.ATG" +#line 2649 "VBNET.ATG" IsLocalAttrTarget()) { if (la.kind == 106) { lexer.NextToken(); -#line 2618 "VBNET.ATG" +#line 2650 "VBNET.ATG" attributeTarget = "event"; } else if (la.kind == 180) { lexer.NextToken(); -#line 2619 "VBNET.ATG" +#line 2651 "VBNET.ATG" attributeTarget = "return"; } else { Identifier(); -#line 2622 "VBNET.ATG" +#line 2654 "VBNET.ATG" string val = t.val.ToLower(System.Globalization.CultureInfo.InvariantCulture); if (val != "field" || val != "method" || val != "module" || val != "param" || @@ -438,20 +438,20 @@ IsLocalAttrTarget()) { Expect(11); } Attribute( -#line 2632 "VBNET.ATG" +#line 2664 "VBNET.ATG" out attribute); -#line 2632 "VBNET.ATG" +#line 2664 "VBNET.ATG" attributes.Add(attribute); while ( -#line 2633 "VBNET.ATG" +#line 2665 "VBNET.ATG" NotFinalComma()) { Expect(12); Attribute( -#line 2633 "VBNET.ATG" +#line 2665 "VBNET.ATG" out attribute); -#line 2633 "VBNET.ATG" +#line 2665 "VBNET.ATG" attributes.Add(attribute); } if (la.kind == 12) { @@ -459,7 +459,7 @@ out attribute); } Expect(27); -#line 2637 "VBNET.ATG" +#line 2669 "VBNET.ATG" section = new AttributeSection { AttributeTarget = attributeTarget, Attributes = attributes, @@ -470,69 +470,69 @@ out attribute); } void TypeModifier( -#line 3376 "VBNET.ATG" +#line 3408 "VBNET.ATG" ModifierList m) { switch (la.kind) { case 173: { lexer.NextToken(); -#line 3377 "VBNET.ATG" +#line 3409 "VBNET.ATG" m.Add(Modifiers.Public, t.Location); break; } case 172: { lexer.NextToken(); -#line 3378 "VBNET.ATG" +#line 3410 "VBNET.ATG" m.Add(Modifiers.Protected, t.Location); break; } case 112: { lexer.NextToken(); -#line 3379 "VBNET.ATG" +#line 3411 "VBNET.ATG" m.Add(Modifiers.Internal, t.Location); break; } case 170: { lexer.NextToken(); -#line 3380 "VBNET.ATG" +#line 3412 "VBNET.ATG" m.Add(Modifiers.Private, t.Location); break; } case 185: { lexer.NextToken(); -#line 3381 "VBNET.ATG" +#line 3413 "VBNET.ATG" m.Add(Modifiers.Static, t.Location); break; } case 184: { lexer.NextToken(); -#line 3382 "VBNET.ATG" +#line 3414 "VBNET.ATG" m.Add(Modifiers.New, t.Location); break; } case 142: { lexer.NextToken(); -#line 3383 "VBNET.ATG" +#line 3415 "VBNET.ATG" m.Add(Modifiers.Abstract, t.Location); break; } case 152: { lexer.NextToken(); -#line 3384 "VBNET.ATG" +#line 3416 "VBNET.ATG" m.Add(Modifiers.Sealed, t.Location); break; } case 168: { lexer.NextToken(); -#line 3385 "VBNET.ATG" +#line 3417 "VBNET.ATG" m.Add(Modifiers.Partial, t.Location); break; } @@ -962,28 +962,28 @@ out typeRef); } void TypeImplementsClause( -#line 1564 "VBNET.ATG" +#line 1596 "VBNET.ATG" out List baseInterfaces) { -#line 1566 "VBNET.ATG" +#line 1598 "VBNET.ATG" baseInterfaces = new List(); TypeReference type = null; Expect(123); TypeName( -#line 1569 "VBNET.ATG" +#line 1601 "VBNET.ATG" out type); -#line 1571 "VBNET.ATG" +#line 1603 "VBNET.ATG" if (type != null) baseInterfaces.Add(type); while (la.kind == 12) { lexer.NextToken(); TypeName( -#line 1574 "VBNET.ATG" +#line 1606 "VBNET.ATG" out type); -#line 1575 "VBNET.ATG" +#line 1607 "VBNET.ATG" if (type != null) baseInterfaces.Add(type); } EndOfStmt(); @@ -1113,10 +1113,10 @@ m, attributes); } void NonArrayTypeName( -#line 2434 "VBNET.ATG" +#line 2466 "VBNET.ATG" out TypeReference typeref, bool canBeUnbound) { -#line 2436 "VBNET.ATG" +#line 2468 "VBNET.ATG" string name; typeref = null; bool isGlobal = false; @@ -1126,36 +1126,36 @@ out TypeReference typeref, bool canBeUnbound) { lexer.NextToken(); Expect(16); -#line 2441 "VBNET.ATG" +#line 2473 "VBNET.ATG" isGlobal = true; } QualIdentAndTypeArguments( -#line 2442 "VBNET.ATG" +#line 2474 "VBNET.ATG" out typeref, canBeUnbound); -#line 2443 "VBNET.ATG" +#line 2475 "VBNET.ATG" typeref.IsGlobal = isGlobal; while (la.kind == 16) { lexer.NextToken(); -#line 2444 "VBNET.ATG" +#line 2476 "VBNET.ATG" TypeReference nestedTypeRef; QualIdentAndTypeArguments( -#line 2445 "VBNET.ATG" +#line 2477 "VBNET.ATG" out nestedTypeRef, canBeUnbound); -#line 2446 "VBNET.ATG" +#line 2478 "VBNET.ATG" typeref = new InnerClassTypeReference(typeref, nestedTypeRef.Type, nestedTypeRef.GenericTypes); } } else if (la.kind == 154) { lexer.NextToken(); -#line 2449 "VBNET.ATG" +#line 2481 "VBNET.ATG" typeref = new TypeReference("System.Object", true); if (la.kind == 21) { lexer.NextToken(); -#line 2453 "VBNET.ATG" +#line 2485 "VBNET.ATG" List typeArguments = new List(1); if (typeref != null) typeArguments.Add(typeref); typeref = new TypeReference("System.Nullable", typeArguments) { IsKeyword = true }; @@ -1163,15 +1163,15 @@ out nestedTypeRef, canBeUnbound); } } else if (StartOf(11)) { PrimitiveTypeName( -#line 2459 "VBNET.ATG" +#line 2491 "VBNET.ATG" out name); -#line 2459 "VBNET.ATG" +#line 2491 "VBNET.ATG" typeref = new TypeReference(name, true); if (la.kind == 21) { lexer.NextToken(); -#line 2463 "VBNET.ATG" +#line 2495 "VBNET.ATG" List typeArguments = new List(1); if (typeref != null) typeArguments.Add(typeref); typeref = new TypeReference("System.Nullable", typeArguments) { IsKeyword = true }; @@ -1210,27 +1210,27 @@ out f); } void InterfaceBase( -#line 1549 "VBNET.ATG" +#line 1581 "VBNET.ATG" out List bases) { -#line 1551 "VBNET.ATG" +#line 1583 "VBNET.ATG" TypeReference type; bases = new List(); Expect(127); TypeName( -#line 1555 "VBNET.ATG" +#line 1587 "VBNET.ATG" out type); -#line 1555 "VBNET.ATG" +#line 1587 "VBNET.ATG" if (type != null) bases.Add(type); while (la.kind == 12) { lexer.NextToken(); TypeName( -#line 1558 "VBNET.ATG" +#line 1590 "VBNET.ATG" out type); -#line 1558 "VBNET.ATG" +#line 1590 "VBNET.ATG" if (type != null) bases.Add(type); } EndOfStmt(); @@ -1257,162 +1257,162 @@ TypeDeclaration newType) { } void FormalParameterList( -#line 2647 "VBNET.ATG" +#line 2679 "VBNET.ATG" List parameter) { -#line 2648 "VBNET.ATG" +#line 2680 "VBNET.ATG" ParameterDeclarationExpression p; FormalParameter( -#line 2650 "VBNET.ATG" +#line 2682 "VBNET.ATG" out p); -#line 2650 "VBNET.ATG" +#line 2682 "VBNET.ATG" if (p != null) parameter.Add(p); while (la.kind == 12) { lexer.NextToken(); FormalParameter( -#line 2652 "VBNET.ATG" +#line 2684 "VBNET.ATG" out p); -#line 2652 "VBNET.ATG" +#line 2684 "VBNET.ATG" if (p != null) parameter.Add(p); } } void MemberModifier( -#line 3388 "VBNET.ATG" +#line 3420 "VBNET.ATG" ModifierList m) { switch (la.kind) { case 142: { lexer.NextToken(); -#line 3389 "VBNET.ATG" +#line 3421 "VBNET.ATG" m.Add(Modifiers.Abstract, t.Location); break; } case 89: { lexer.NextToken(); -#line 3390 "VBNET.ATG" +#line 3422 "VBNET.ATG" m.Add(Modifiers.Default, t.Location); break; } case 112: { lexer.NextToken(); -#line 3391 "VBNET.ATG" +#line 3423 "VBNET.ATG" m.Add(Modifiers.Internal, t.Location); break; } case 184: { lexer.NextToken(); -#line 3392 "VBNET.ATG" +#line 3424 "VBNET.ATG" m.Add(Modifiers.New, t.Location); break; } case 166: { lexer.NextToken(); -#line 3393 "VBNET.ATG" +#line 3425 "VBNET.ATG" m.Add(Modifiers.Override, t.Location); break; } case 143: { lexer.NextToken(); -#line 3394 "VBNET.ATG" +#line 3426 "VBNET.ATG" m.Add(Modifiers.Abstract, t.Location); break; } case 170: { lexer.NextToken(); -#line 3395 "VBNET.ATG" +#line 3427 "VBNET.ATG" m.Add(Modifiers.Private, t.Location); break; } case 172: { lexer.NextToken(); -#line 3396 "VBNET.ATG" +#line 3428 "VBNET.ATG" m.Add(Modifiers.Protected, t.Location); break; } case 173: { lexer.NextToken(); -#line 3397 "VBNET.ATG" +#line 3429 "VBNET.ATG" m.Add(Modifiers.Public, t.Location); break; } case 152: { lexer.NextToken(); -#line 3398 "VBNET.ATG" +#line 3430 "VBNET.ATG" m.Add(Modifiers.Sealed, t.Location); break; } case 153: { lexer.NextToken(); -#line 3399 "VBNET.ATG" +#line 3431 "VBNET.ATG" m.Add(Modifiers.Sealed, t.Location); break; } case 185: { lexer.NextToken(); -#line 3400 "VBNET.ATG" +#line 3432 "VBNET.ATG" m.Add(Modifiers.Static, t.Location); break; } case 165: { lexer.NextToken(); -#line 3401 "VBNET.ATG" +#line 3433 "VBNET.ATG" m.Add(Modifiers.Virtual, t.Location); break; } case 164: { lexer.NextToken(); -#line 3402 "VBNET.ATG" +#line 3434 "VBNET.ATG" m.Add(Modifiers.Overloads, t.Location); break; } case 175: { lexer.NextToken(); -#line 3403 "VBNET.ATG" +#line 3435 "VBNET.ATG" m.Add(Modifiers.ReadOnly, t.Location); break; } case 220: { lexer.NextToken(); -#line 3404 "VBNET.ATG" +#line 3436 "VBNET.ATG" m.Add(Modifiers.WriteOnly, t.Location); break; } case 219: { lexer.NextToken(); -#line 3405 "VBNET.ATG" +#line 3437 "VBNET.ATG" m.Add(Modifiers.WithEvents, t.Location); break; } case 92: { lexer.NextToken(); -#line 3406 "VBNET.ATG" +#line 3438 "VBNET.ATG" m.Add(Modifiers.Dim, t.Location); break; } case 168: { lexer.NextToken(); -#line 3407 "VBNET.ATG" +#line 3439 "VBNET.ATG" m.Add(Modifiers.Partial, t.Location); break; } @@ -1624,15 +1624,22 @@ p); lexer.NextToken(); while (la.kind == 28) { AttributeSection( -#line 893 "VBNET.ATG" +#line 894 "VBNET.ATG" out returnTypeAttributeSection); + +#line 896 "VBNET.ATG" + if (returnTypeAttributeSection != null) { + returnTypeAttributeSection.AttributeTarget = "return"; + attributes.Add(returnTypeAttributeSection); + } + } TypeName( -#line 893 "VBNET.ATG" +#line 902 "VBNET.ATG" out type); } -#line 895 "VBNET.ATG" +#line 904 "VBNET.ATG" if(type == null) { type = new TypeReference("System.Object", true); } @@ -1640,23 +1647,23 @@ out type); if (la.kind == 121 || la.kind == 123) { if (la.kind == 123) { ImplementsClause( -#line 901 "VBNET.ATG" +#line 910 "VBNET.ATG" out implementsClause); } else { HandlesClause( -#line 903 "VBNET.ATG" +#line 912 "VBNET.ATG" out handlesClause); } } -#line 906 "VBNET.ATG" +#line 915 "VBNET.ATG" Location endLocation = t.EndLocation; if ( -#line 909 "VBNET.ATG" +#line 918 "VBNET.ATG" IsMustOverride(m)) { EndOfStmt(); -#line 912 "VBNET.ATG" +#line 921 "VBNET.ATG" methodDeclaration = new MethodDeclaration { Name = name, Modifier = m.Modifier, TypeReference = type, Parameters = p, Attributes = attributes, @@ -1666,16 +1673,13 @@ IsMustOverride(m)) { Templates = templates, InterfaceImplementations = implementsClause }; - if (returnTypeAttributeSection != null) { - returnTypeAttributeSection.AttributeTarget = "return"; - methodDeclaration.Attributes.Add(returnTypeAttributeSection); - } + compilationUnit.AddChild(methodDeclaration); } else if (la.kind == 1) { lexer.NextToken(); -#line 930 "VBNET.ATG" +#line 936 "VBNET.ATG" methodDeclaration = new MethodDeclaration { Name = name, Modifier = m.Modifier, TypeReference = type, Parameters = p, Attributes = attributes, @@ -1685,21 +1689,17 @@ IsMustOverride(m)) { HandlesClause = handlesClause, InterfaceImplementations = implementsClause }; - if (returnTypeAttributeSection != null) { - returnTypeAttributeSection.AttributeTarget = "return"; - methodDeclaration.Attributes.Add(returnTypeAttributeSection); - } compilationUnit.AddChild(methodDeclaration); if (ParseMethodBodies) { Block( -#line 947 "VBNET.ATG" +#line 949 "VBNET.ATG" out stmt); Expect(100); Expect(114); -#line 949 "VBNET.ATG" +#line 951 "VBNET.ATG" } else { // don't parse method body lexer.SkipCurrentBlock(Tokens.Function); stmt = new BlockStatement(); @@ -1715,7 +1715,7 @@ out stmt); case 88: { lexer.NextToken(); -#line 963 "VBNET.ATG" +#line 965 "VBNET.ATG" m.Check(Modifiers.VBExternalMethods); Location startPos = t.Location; CharsetModifier charsetModifer = CharsetModifier.None; @@ -1725,39 +1725,39 @@ out stmt); if (StartOf(15)) { Charset( -#line 970 "VBNET.ATG" +#line 972 "VBNET.ATG" out charsetModifer); } if (la.kind == 195) { lexer.NextToken(); Identifier(); -#line 973 "VBNET.ATG" +#line 975 "VBNET.ATG" name = t.val; Expect(135); Expect(3); -#line 974 "VBNET.ATG" +#line 976 "VBNET.ATG" library = t.literalValue as string; if (la.kind == 46) { lexer.NextToken(); Expect(3); -#line 975 "VBNET.ATG" +#line 977 "VBNET.ATG" alias = t.literalValue as string; } if (la.kind == 25) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( -#line 976 "VBNET.ATG" +#line 978 "VBNET.ATG" p); } Expect(26); } EndOfStmt(); -#line 979 "VBNET.ATG" +#line 981 "VBNET.ATG" DeclareDeclaration declareDeclaration = new DeclareDeclaration(name, m.Modifier, null, p, attributes, library, alias, charsetModifer); declareDeclaration.StartLocation = m.GetDeclarationLocation(startPos); declareDeclaration.EndLocation = t.EndLocation; @@ -1767,25 +1767,25 @@ p); lexer.NextToken(); Identifier(); -#line 986 "VBNET.ATG" +#line 988 "VBNET.ATG" name = t.val; Expect(135); Expect(3); -#line 987 "VBNET.ATG" +#line 989 "VBNET.ATG" library = t.literalValue as string; if (la.kind == 46) { lexer.NextToken(); Expect(3); -#line 988 "VBNET.ATG" +#line 990 "VBNET.ATG" alias = t.literalValue as string; } if (la.kind == 25) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( -#line 989 "VBNET.ATG" +#line 991 "VBNET.ATG" p); } Expect(26); @@ -1793,12 +1793,12 @@ p); if (la.kind == 50) { lexer.NextToken(); TypeName( -#line 990 "VBNET.ATG" +#line 992 "VBNET.ATG" out type); } EndOfStmt(); -#line 993 "VBNET.ATG" +#line 995 "VBNET.ATG" DeclareDeclaration declareDeclaration = new DeclareDeclaration(name, m.Modifier, type, p, attributes, library, alias, charsetModifer); declareDeclaration.StartLocation = m.GetDeclarationLocation(startPos); declareDeclaration.EndLocation = t.EndLocation; @@ -1810,7 +1810,7 @@ out type); case 106: { lexer.NextToken(); -#line 1003 "VBNET.ATG" +#line 1005 "VBNET.ATG" m.Check(Modifiers.VBEvents); Location startPos = t.Location; EventDeclaration eventDeclaration; @@ -1819,19 +1819,19 @@ out type); Identifier(); -#line 1009 "VBNET.ATG" +#line 1011 "VBNET.ATG" name= t.val; if (la.kind == 50) { lexer.NextToken(); TypeName( -#line 1011 "VBNET.ATG" +#line 1013 "VBNET.ATG" out type); } else if (StartOf(16)) { if (la.kind == 25) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( -#line 1013 "VBNET.ATG" +#line 1015 "VBNET.ATG" p); } Expect(26); @@ -1839,11 +1839,11 @@ p); } else SynErr(242); if (la.kind == 123) { ImplementsClause( -#line 1015 "VBNET.ATG" +#line 1017 "VBNET.ATG" out implementsClause); } -#line 1017 "VBNET.ATG" +#line 1019 "VBNET.ATG" eventDeclaration = new EventDeclaration { Name = name, TypeReference = type, Modifier = m.Modifier, Parameters = p, Attributes = attributes, InterfaceImplementations = implementsClause, @@ -1857,29 +1857,29 @@ out implementsClause); } case 2: case 45: case 49: case 51: case 52: case 53: case 54: case 57: case 74: case 91: case 94: case 103: case 108: case 113: case 120: case 126: case 130: case 133: case 156: case 162: case 169: case 188: case 197: case 198: case 208: case 209: case 215: { -#line 1028 "VBNET.ATG" +#line 1030 "VBNET.ATG" m.Check(Modifiers.Fields); FieldDeclaration fd = new FieldDeclaration(attributes, null, m.Modifier); IdentifierForFieldDeclaration(); -#line 1031 "VBNET.ATG" +#line 1033 "VBNET.ATG" string name = t.val; -#line 1032 "VBNET.ATG" +#line 1034 "VBNET.ATG" fd.StartLocation = m.GetDeclarationLocation(t.Location); VariableDeclaratorPartAfterIdentifier( -#line 1034 "VBNET.ATG" +#line 1036 "VBNET.ATG" variableDeclarators, name); while (la.kind == 12) { lexer.NextToken(); VariableDeclarator( -#line 1035 "VBNET.ATG" +#line 1037 "VBNET.ATG" variableDeclarators); } EndOfStmt(); -#line 1038 "VBNET.ATG" +#line 1040 "VBNET.ATG" fd.EndLocation = t.EndLocation; fd.Fields = variableDeclarators; compilationUnit.AddChild(fd); @@ -1888,35 +1888,35 @@ variableDeclarators); } case 75: { -#line 1043 "VBNET.ATG" +#line 1045 "VBNET.ATG" m.Check(Modifiers.Fields); lexer.NextToken(); -#line 1044 "VBNET.ATG" +#line 1046 "VBNET.ATG" m.Add(Modifiers.Const, t.Location); -#line 1046 "VBNET.ATG" +#line 1048 "VBNET.ATG" FieldDeclaration fd = new FieldDeclaration(attributes, type, m.Modifier); fd.StartLocation = m.GetDeclarationLocation(t.Location); List constantDeclarators = new List(); ConstantDeclarator( -#line 1050 "VBNET.ATG" +#line 1052 "VBNET.ATG" constantDeclarators); while (la.kind == 12) { lexer.NextToken(); ConstantDeclarator( -#line 1051 "VBNET.ATG" +#line 1053 "VBNET.ATG" constantDeclarators); } -#line 1053 "VBNET.ATG" +#line 1055 "VBNET.ATG" fd.Fields = constantDeclarators; fd.EndLocation = t.Location; EndOfStmt(); -#line 1058 "VBNET.ATG" +#line 1060 "VBNET.ATG" fd.EndLocation = t.EndLocation; compilationUnit.AddChild(fd); @@ -1925,58 +1925,96 @@ constantDeclarators); case 171: { lexer.NextToken(); -#line 1064 "VBNET.ATG" +#line 1066 "VBNET.ATG" m.Check(Modifiers.VBProperties); Location startPos = t.Location; List implementsClause = null; + AttributeSection returnTypeAttributeSection = null; + Expression initializer = null; Identifier(); -#line 1068 "VBNET.ATG" +#line 1072 "VBNET.ATG" string propertyName = t.val; if (la.kind == 25) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( -#line 1069 "VBNET.ATG" +#line 1073 "VBNET.ATG" p); } Expect(26); } if (la.kind == 50) { lexer.NextToken(); - TypeName( -#line 1070 "VBNET.ATG" + while (la.kind == 28) { + AttributeSection( +#line 1076 "VBNET.ATG" +out returnTypeAttributeSection); + +#line 1078 "VBNET.ATG" + if (returnTypeAttributeSection != null) { + returnTypeAttributeSection.AttributeTarget = "return"; + attributes.Add(returnTypeAttributeSection); + } + + } + if ( +#line 1085 "VBNET.ATG" +IsNewExpression()) { + ObjectCreateExpression( +#line 1085 "VBNET.ATG" +out initializer); + +#line 1087 "VBNET.ATG" + if (initializer is ObjectCreateExpression) { + type = ((ObjectCreateExpression)initializer).CreateType.Clone(); + } else { + type = ((ArrayCreateExpression)initializer).CreateType.Clone(); + } + + } else if (StartOf(7)) { + TypeName( +#line 1094 "VBNET.ATG" out type); + } else SynErr(243); } -#line 1072 "VBNET.ATG" +#line 1098 "VBNET.ATG" if(type == null) { type = new TypeReference("System.Object", true); } + if (la.kind == 10) { + lexer.NextToken(); + VariableInitializer( +#line 1102 "VBNET.ATG" +out initializer); + } if (la.kind == 123) { ImplementsClause( -#line 1076 "VBNET.ATG" +#line 1103 "VBNET.ATG" out implementsClause); } EndOfStmt(); if ( -#line 1080 "VBNET.ATG" -IsMustOverride(m)) { +#line 1107 "VBNET.ATG" +IsMustOverride(m) || IsAutomaticProperty()) { -#line 1082 "VBNET.ATG" +#line 1109 "VBNET.ATG" PropertyDeclaration pDecl = new PropertyDeclaration(propertyName, type, m.Modifier, attributes); pDecl.StartLocation = m.GetDeclarationLocation(startPos); pDecl.EndLocation = t.Location; pDecl.TypeReference = type; pDecl.InterfaceImplementations = implementsClause; pDecl.Parameters = p; + if (initializer != null) + pDecl.Initializer = initializer; compilationUnit.AddChild(pDecl); } else if (StartOf(17)) { -#line 1092 "VBNET.ATG" +#line 1121 "VBNET.ATG" PropertyDeclaration pDecl = new PropertyDeclaration(propertyName, type, m.Modifier, attributes); pDecl.StartLocation = m.GetDeclarationLocation(startPos); pDecl.EndLocation = t.Location; @@ -1988,29 +2026,29 @@ IsMustOverride(m)) { PropertySetRegion setRegion; AccessorDecls( -#line 1102 "VBNET.ATG" +#line 1131 "VBNET.ATG" out getRegion, out setRegion); Expect(100); Expect(171); EndOfStmt(); -#line 1106 "VBNET.ATG" +#line 1135 "VBNET.ATG" pDecl.GetRegion = getRegion; pDecl.SetRegion = setRegion; - pDecl.BodyEnd = t.EndLocation; + pDecl.BodyEnd = t.Location; // t = EndOfStmt; not "Property" compilationUnit.AddChild(pDecl); - } else SynErr(243); + } else SynErr(244); break; } case 85: { lexer.NextToken(); -#line 1113 "VBNET.ATG" +#line 1142 "VBNET.ATG" Location startPos = t.Location; Expect(106); -#line 1115 "VBNET.ATG" +#line 1144 "VBNET.ATG" m.Check(Modifiers.VBCustomEvents); EventAddRemoveRegion eventAccessorDeclaration; EventAddRegion addHandlerAccessorDeclaration = null; @@ -2020,24 +2058,24 @@ out getRegion, out setRegion); Identifier(); -#line 1122 "VBNET.ATG" +#line 1151 "VBNET.ATG" string customEventName = t.val; Expect(50); TypeName( -#line 1123 "VBNET.ATG" +#line 1152 "VBNET.ATG" out type); if (la.kind == 123) { ImplementsClause( -#line 1124 "VBNET.ATG" +#line 1153 "VBNET.ATG" out implementsClause); } EndOfStmt(); while (StartOf(18)) { EventAccessorDeclaration( -#line 1127 "VBNET.ATG" +#line 1156 "VBNET.ATG" out eventAccessorDeclaration); -#line 1129 "VBNET.ATG" +#line 1158 "VBNET.ATG" if(eventAccessorDeclaration is EventAddRegion) { addHandlerAccessorDeclaration = (EventAddRegion)eventAccessorDeclaration; @@ -2056,7 +2094,7 @@ out eventAccessorDeclaration); Expect(106); EndOfStmt(); -#line 1145 "VBNET.ATG" +#line 1174 "VBNET.ATG" if(addHandlerAccessorDeclaration == null) { Error("Need to provide AddHandler accessor."); @@ -2087,24 +2125,24 @@ out eventAccessorDeclaration); } case 147: case 158: case 217: { -#line 1171 "VBNET.ATG" +#line 1200 "VBNET.ATG" ConversionType opConversionType = ConversionType.None; if (la.kind == 147 || la.kind == 217) { if (la.kind == 217) { lexer.NextToken(); -#line 1172 "VBNET.ATG" +#line 1201 "VBNET.ATG" opConversionType = ConversionType.Implicit; } else { lexer.NextToken(); -#line 1173 "VBNET.ATG" +#line 1202 "VBNET.ATG" opConversionType = ConversionType.Explicit; } } Expect(158); -#line 1176 "VBNET.ATG" +#line 1205 "VBNET.ATG" m.Check(Modifiers.VBOperators); Location startPos = t.Location; TypeReference returnType = NullTypeReference.Instance; @@ -2113,10 +2151,9 @@ out eventAccessorDeclaration); OverloadableOperatorType operatorType; AttributeSection section; List parameters = new List(); - List returnTypeAttributes = new List(); OverloadableOperator( -#line 1186 "VBNET.ATG" +#line 1214 "VBNET.ATG" out operatorType); Expect(25); if (la.kind == 59) { @@ -2124,16 +2161,16 @@ out operatorType); } Identifier(); -#line 1187 "VBNET.ATG" +#line 1215 "VBNET.ATG" operandName = t.val; if (la.kind == 50) { lexer.NextToken(); TypeName( -#line 1188 "VBNET.ATG" +#line 1216 "VBNET.ATG" out operandType); } -#line 1189 "VBNET.ATG" +#line 1217 "VBNET.ATG" parameters.Add(new ParameterDeclarationExpression(operandType, operandName, ParameterModifiers.In)); while (la.kind == 12) { lexer.NextToken(); @@ -2142,48 +2179,51 @@ out operandType); } Identifier(); -#line 1193 "VBNET.ATG" +#line 1221 "VBNET.ATG" operandName = t.val; if (la.kind == 50) { lexer.NextToken(); TypeName( -#line 1194 "VBNET.ATG" +#line 1222 "VBNET.ATG" out operandType); } -#line 1195 "VBNET.ATG" +#line 1223 "VBNET.ATG" parameters.Add(new ParameterDeclarationExpression(operandType, operandName, ParameterModifiers.In)); } Expect(26); -#line 1198 "VBNET.ATG" +#line 1226 "VBNET.ATG" Location endPos = t.EndLocation; if (la.kind == 50) { lexer.NextToken(); while (la.kind == 28) { AttributeSection( -#line 1199 "VBNET.ATG" +#line 1227 "VBNET.ATG" out section); -#line 1199 "VBNET.ATG" - returnTypeAttributes.Add(section); +#line 1228 "VBNET.ATG" + if (section != null) { + section.AttributeTarget = "return"; + attributes.Add(section); + } } TypeName( -#line 1199 "VBNET.ATG" +#line 1232 "VBNET.ATG" out returnType); -#line 1199 "VBNET.ATG" +#line 1232 "VBNET.ATG" endPos = t.EndLocation; } Expect(1); Block( -#line 1201 "VBNET.ATG" +#line 1234 "VBNET.ATG" out stmt); Expect(100); Expect(158); EndOfStmt(); -#line 1203 "VBNET.ATG" +#line 1236 "VBNET.ATG" OperatorDeclaration operatorDeclaration = new OperatorDeclaration { Modifier = m.Modifier, Attributes = attributes, @@ -2191,7 +2231,6 @@ out stmt); TypeReference = returnType, OverloadableOperator = operatorType, ConversionType = opConversionType, - ReturnTypeAttributes = returnTypeAttributes, Body = (BlockStatement)stmt, StartLocation = m.GetDeclarationLocation(startPos), EndLocation = endPos @@ -2202,7 +2241,7 @@ out stmt); break; } - default: SynErr(244); break; + default: SynErr(245); break; } } @@ -2436,116 +2475,116 @@ out type); pd.StartLocation = startLocation; compilationUnit.AddChild(pd); - } else SynErr(245); + } else SynErr(246); } else if (StartOf(20)) { NonModuleDeclaration( #line 739 "VBNET.ATG" mod, attributes); - } else SynErr(246); + } else SynErr(247); } void Expr( -#line 1608 "VBNET.ATG" +#line 1640 "VBNET.ATG" out Expression expr) { -#line 1609 "VBNET.ATG" +#line 1641 "VBNET.ATG" expr = null; if ( -#line 1610 "VBNET.ATG" +#line 1642 "VBNET.ATG" IsQueryExpression() ) { QueryExpr( -#line 1611 "VBNET.ATG" +#line 1643 "VBNET.ATG" out expr); } else if (la.kind == 114) { LambdaExpr( -#line 1612 "VBNET.ATG" +#line 1644 "VBNET.ATG" out expr); } else if (StartOf(21)) { DisjunctionExpr( -#line 1613 "VBNET.ATG" +#line 1645 "VBNET.ATG" out expr); - } else SynErr(247); + } else SynErr(248); } void ImplementsClause( -#line 1581 "VBNET.ATG" +#line 1613 "VBNET.ATG" out List baseInterfaces) { -#line 1583 "VBNET.ATG" +#line 1615 "VBNET.ATG" baseInterfaces = new List(); TypeReference type = null; string memberName = null; Expect(123); NonArrayTypeName( -#line 1588 "VBNET.ATG" +#line 1620 "VBNET.ATG" out type, false); -#line 1589 "VBNET.ATG" +#line 1621 "VBNET.ATG" if (type != null) memberName = TypeReference.StripLastIdentifierFromType(ref type); -#line 1590 "VBNET.ATG" +#line 1622 "VBNET.ATG" baseInterfaces.Add(new InterfaceImplementation(type, memberName)); while (la.kind == 12) { lexer.NextToken(); NonArrayTypeName( -#line 1592 "VBNET.ATG" +#line 1624 "VBNET.ATG" out type, false); -#line 1593 "VBNET.ATG" +#line 1625 "VBNET.ATG" if (type != null) memberName = TypeReference.StripLastIdentifierFromType(ref type); -#line 1594 "VBNET.ATG" +#line 1626 "VBNET.ATG" baseInterfaces.Add(new InterfaceImplementation(type, memberName)); } } void HandlesClause( -#line 1539 "VBNET.ATG" +#line 1571 "VBNET.ATG" out List handlesClause) { -#line 1541 "VBNET.ATG" +#line 1573 "VBNET.ATG" handlesClause = new List(); string name; Expect(121); EventMemberSpecifier( -#line 1544 "VBNET.ATG" +#line 1576 "VBNET.ATG" out name); -#line 1544 "VBNET.ATG" +#line 1576 "VBNET.ATG" if (name != null) handlesClause.Add(name); while (la.kind == 12) { lexer.NextToken(); EventMemberSpecifier( -#line 1545 "VBNET.ATG" +#line 1577 "VBNET.ATG" out name); -#line 1545 "VBNET.ATG" +#line 1577 "VBNET.ATG" if (name != null) handlesClause.Add(name); } } void Block( -#line 2694 "VBNET.ATG" +#line 2726 "VBNET.ATG" out Statement stmt) { -#line 2697 "VBNET.ATG" +#line 2729 "VBNET.ATG" BlockStatement blockStmt = new BlockStatement(); /* in snippet parsing mode, t might be null */ if (t != null) blockStmt.StartLocation = t.EndLocation; compilationUnit.BlockStart(blockStmt); while (StartOf(22) || -#line 2703 "VBNET.ATG" +#line 2735 "VBNET.ATG" IsEndStmtAhead()) { if ( -#line 2703 "VBNET.ATG" +#line 2735 "VBNET.ATG" IsEndStmtAhead()) { Expect(100); EndOfStmt(); -#line 2703 "VBNET.ATG" +#line 2735 "VBNET.ATG" compilationUnit.AddChild(new EndStatement()); } else { Statement(); @@ -2553,7 +2592,7 @@ IsEndStmtAhead()) { } } -#line 2708 "VBNET.ATG" +#line 2740 "VBNET.ATG" stmt = blockStmt; if (t != null) blockStmt.EndLocation = t.EndLocation; compilationUnit.BlockEnd(); @@ -2561,28 +2600,28 @@ IsEndStmtAhead()) { } void Charset( -#line 1531 "VBNET.ATG" +#line 1563 "VBNET.ATG" out CharsetModifier charsetModifier) { -#line 1532 "VBNET.ATG" +#line 1564 "VBNET.ATG" charsetModifier = CharsetModifier.None; if (la.kind == 114 || la.kind == 195) { } else if (la.kind == 49) { lexer.NextToken(); -#line 1533 "VBNET.ATG" +#line 1565 "VBNET.ATG" charsetModifier = CharsetModifier.Ansi; } else if (la.kind == 53) { lexer.NextToken(); -#line 1534 "VBNET.ATG" +#line 1566 "VBNET.ATG" charsetModifier = CharsetModifier.Auto; } else if (la.kind == 208) { lexer.NextToken(); -#line 1535 "VBNET.ATG" +#line 1567 "VBNET.ATG" charsetModifier = CharsetModifier.Unicode; - } else SynErr(248); + } else SynErr(249); } void IdentifierForFieldDeclaration() { @@ -2695,15 +2734,15 @@ out CharsetModifier charsetModifier) { lexer.NextToken(); break; } - default: SynErr(249); break; + default: SynErr(250); break; } } void VariableDeclaratorPartAfterIdentifier( -#line 1407 "VBNET.ATG" +#line 1439 "VBNET.ATG" List fieldDeclaration, string name) { -#line 1409 "VBNET.ATG" +#line 1441 "VBNET.ATG" Expression expr = null; TypeReference type = null; ArrayList rank = null; @@ -2711,28 +2750,28 @@ List fieldDeclaration, string name) { Location startLocation = t.Location; if ( -#line 1415 "VBNET.ATG" +#line 1447 "VBNET.ATG" IsSize() && !IsDims()) { ArrayInitializationModifier( -#line 1415 "VBNET.ATG" +#line 1447 "VBNET.ATG" out dimension); } if ( -#line 1416 "VBNET.ATG" +#line 1448 "VBNET.ATG" IsDims()) { ArrayNameModifier( -#line 1416 "VBNET.ATG" +#line 1448 "VBNET.ATG" out rank); } if ( -#line 1418 "VBNET.ATG" +#line 1450 "VBNET.ATG" IsObjectCreation()) { Expect(50); ObjectCreateExpression( -#line 1418 "VBNET.ATG" +#line 1450 "VBNET.ATG" out expr); -#line 1420 "VBNET.ATG" +#line 1452 "VBNET.ATG" if (expr is ObjectCreateExpression) { type = ((ObjectCreateExpression)expr).CreateType.Clone(); } else { @@ -2743,10 +2782,10 @@ out expr); if (la.kind == 50) { lexer.NextToken(); TypeName( -#line 1427 "VBNET.ATG" +#line 1459 "VBNET.ATG" out type); -#line 1429 "VBNET.ATG" +#line 1461 "VBNET.ATG" if (type != null) { for (int i = fieldDeclaration.Count - 1; i >= 0; i--) { VariableDeclaration vd = fieldDeclaration[i]; @@ -2759,7 +2798,7 @@ out type); } -#line 1441 "VBNET.ATG" +#line 1473 "VBNET.ATG" if (type == null && (dimension != null || rank != null)) { type = new TypeReference(""); } @@ -2786,12 +2825,12 @@ out type); if (la.kind == 10) { lexer.NextToken(); VariableInitializer( -#line 1464 "VBNET.ATG" +#line 1496 "VBNET.ATG" out expr); } - } else SynErr(250); + } else SynErr(251); -#line 1467 "VBNET.ATG" +#line 1499 "VBNET.ATG" VariableDeclaration varDecl = new VariableDeclaration(name, expr, type); varDecl.StartLocation = startLocation; varDecl.EndLocation = t.Location; @@ -2800,22 +2839,22 @@ out expr); } void VariableDeclarator( -#line 1401 "VBNET.ATG" +#line 1433 "VBNET.ATG" List fieldDeclaration) { Identifier(); -#line 1403 "VBNET.ATG" +#line 1435 "VBNET.ATG" string name = t.val; VariableDeclaratorPartAfterIdentifier( -#line 1404 "VBNET.ATG" +#line 1436 "VBNET.ATG" fieldDeclaration, name); } void ConstantDeclarator( -#line 1382 "VBNET.ATG" +#line 1414 "VBNET.ATG" List constantDeclaration) { -#line 1384 "VBNET.ATG" +#line 1416 "VBNET.ATG" Expression expr = null; TypeReference type = null; string name = String.Empty; @@ -2823,20 +2862,20 @@ List constantDeclaration) { Identifier(); -#line 1389 "VBNET.ATG" +#line 1421 "VBNET.ATG" name = t.val; location = t.Location; if (la.kind == 50) { lexer.NextToken(); TypeName( -#line 1390 "VBNET.ATG" +#line 1422 "VBNET.ATG" out type); } Expect(10); Expr( -#line 1391 "VBNET.ATG" +#line 1423 "VBNET.ATG" out expr); -#line 1393 "VBNET.ATG" +#line 1425 "VBNET.ATG" VariableDeclaration f = new VariableDeclaration(name, expr); f.TypeReference = type; f.StartLocation = location; @@ -2844,72 +2883,188 @@ out expr); } - void AccessorDecls( -#line 1316 "VBNET.ATG" -out PropertyGetRegion getBlock, out PropertySetRegion setBlock) { + void ObjectCreateExpression( +#line 1968 "VBNET.ATG" +out Expression oce) { -#line 1318 "VBNET.ATG" - List attributes = new List(); - AttributeSection section; - getBlock = null; - setBlock = null; +#line 1970 "VBNET.ATG" + TypeReference type = null; + Expression initializer = null; + List arguments = null; + ArrayList dimensions = null; + oce = null; + bool canBeNormal; bool canBeReDim; - while (la.kind == 28) { - AttributeSection( -#line 1323 "VBNET.ATG" -out section); - -#line 1323 "VBNET.ATG" - attributes.Add(section); - } - if (StartOf(24)) { - GetAccessorDecl( -#line 1325 "VBNET.ATG" -out getBlock, attributes); - if (StartOf(25)) { - -#line 1327 "VBNET.ATG" - attributes = new List(); - while (la.kind == 28) { - AttributeSection( -#line 1328 "VBNET.ATG" -out section); - -#line 1328 "VBNET.ATG" - attributes.Add(section); + Expect(148); + if (StartOf(7)) { + NonArrayTypeName( +#line 1978 "VBNET.ATG" +out type, false); + if (la.kind == 25) { + lexer.NextToken(); + NormalOrReDimArgumentList( +#line 1979 "VBNET.ATG" +out arguments, out canBeNormal, out canBeReDim); + Expect(26); + if (la.kind == 23 || +#line 1980 "VBNET.ATG" +la.kind == Tokens.OpenParenthesis) { + if ( +#line 1980 "VBNET.ATG" +la.kind == Tokens.OpenParenthesis) { + ArrayTypeModifiers( +#line 1981 "VBNET.ATG" +out dimensions); + CollectionInitializer( +#line 1982 "VBNET.ATG" +out initializer); + } else { + CollectionInitializer( +#line 1983 "VBNET.ATG" +out initializer); + } } - SetAccessorDecl( -#line 1329 "VBNET.ATG" -out setBlock, attributes); + +#line 1985 "VBNET.ATG" + if (canBeReDim && !canBeNormal && initializer == null) initializer = new CollectionInitializerExpression(); } - } else if (StartOf(26)) { - SetAccessorDecl( -#line 1332 "VBNET.ATG" -out setBlock, attributes); - if (StartOf(27)) { + } -#line 1334 "VBNET.ATG" +#line 1989 "VBNET.ATG" + if (initializer == null) { + oce = new ObjectCreateExpression(type, arguments); + } else { + if (dimensions == null) dimensions = new ArrayList(); + dimensions.Insert(0, (arguments == null) ? 0 : Math.Max(arguments.Count - 1, 0)); + type.RankSpecifier = (int[])dimensions.ToArray(typeof(int)); + ArrayCreateExpression ace = new ArrayCreateExpression(type, initializer as CollectionInitializerExpression); + ace.Arguments = arguments; + oce = ace; + } + + if (la.kind == 218) { + +#line 2003 "VBNET.ATG" + NamedArgumentExpression memberInitializer = null; + + lexer.NextToken(); + +#line 2007 "VBNET.ATG" + CollectionInitializerExpression memberInitializers = new CollectionInitializerExpression(); + memberInitializers.StartLocation = la.Location; + + Expect(23); + MemberInitializer( +#line 2011 "VBNET.ATG" +out memberInitializer); + +#line 2012 "VBNET.ATG" + memberInitializers.CreateExpressions.Add(memberInitializer); + while (la.kind == 12) { + lexer.NextToken(); + MemberInitializer( +#line 2014 "VBNET.ATG" +out memberInitializer); + +#line 2015 "VBNET.ATG" + memberInitializers.CreateExpressions.Add(memberInitializer); + } + Expect(24); + +#line 2019 "VBNET.ATG" + memberInitializers.EndLocation = t.Location; + if(oce is ObjectCreateExpression) + { + ((ObjectCreateExpression)oce).ObjectInitializer = memberInitializers; + } + + } + } + + void VariableInitializer( +#line 1535 "VBNET.ATG" +out Expression initializerExpression) { + +#line 1537 "VBNET.ATG" + initializerExpression = null; + + if (StartOf(24)) { + Expr( +#line 1539 "VBNET.ATG" +out initializerExpression); + } else if (la.kind == 23) { + CollectionInitializer( +#line 1540 "VBNET.ATG" +out initializerExpression); + } else SynErr(252); + } + + void AccessorDecls( +#line 1348 "VBNET.ATG" +out PropertyGetRegion getBlock, out PropertySetRegion setBlock) { + +#line 1350 "VBNET.ATG" + List attributes = new List(); + AttributeSection section; + getBlock = null; + setBlock = null; + + while (la.kind == 28) { + AttributeSection( +#line 1355 "VBNET.ATG" +out section); + +#line 1355 "VBNET.ATG" + attributes.Add(section); + } + if (StartOf(25)) { + GetAccessorDecl( +#line 1357 "VBNET.ATG" +out getBlock, attributes); + if (StartOf(26)) { + +#line 1359 "VBNET.ATG" attributes = new List(); while (la.kind == 28) { AttributeSection( -#line 1335 "VBNET.ATG" +#line 1360 "VBNET.ATG" out section); -#line 1335 "VBNET.ATG" +#line 1360 "VBNET.ATG" + attributes.Add(section); + } + SetAccessorDecl( +#line 1361 "VBNET.ATG" +out setBlock, attributes); + } + } else if (StartOf(27)) { + SetAccessorDecl( +#line 1364 "VBNET.ATG" +out setBlock, attributes); + if (StartOf(28)) { + +#line 1366 "VBNET.ATG" + attributes = new List(); + while (la.kind == 28) { + AttributeSection( +#line 1367 "VBNET.ATG" +out section); + +#line 1367 "VBNET.ATG" attributes.Add(section); } GetAccessorDecl( -#line 1336 "VBNET.ATG" +#line 1368 "VBNET.ATG" out getBlock, attributes); } - } else SynErr(251); + } else SynErr(253); } void EventAccessorDeclaration( -#line 1279 "VBNET.ATG" +#line 1311 "VBNET.ATG" out EventAddRemoveRegion eventAccessorDeclaration) { -#line 1281 "VBNET.ATG" +#line 1313 "VBNET.ATG" Statement stmt = null; List p = new List(); AttributeSection section; @@ -2918,10 +3073,10 @@ out EventAddRemoveRegion eventAccessorDeclaration) { while (la.kind == 28) { AttributeSection( -#line 1287 "VBNET.ATG" +#line 1319 "VBNET.ATG" out section); -#line 1287 "VBNET.ATG" +#line 1319 "VBNET.ATG" attributes.Add(section); } if (la.kind == 43) { @@ -2930,20 +3085,20 @@ out section); lexer.NextToken(); if (StartOf(4)) { FormalParameterList( -#line 1289 "VBNET.ATG" +#line 1321 "VBNET.ATG" p); } Expect(26); } Expect(1); Block( -#line 1290 "VBNET.ATG" +#line 1322 "VBNET.ATG" out stmt); Expect(100); Expect(43); EndOfStmt(); -#line 1292 "VBNET.ATG" +#line 1324 "VBNET.ATG" eventAccessorDeclaration = new EventAddRegion(attributes); eventAccessorDeclaration.Block = (BlockStatement)stmt; eventAccessorDeclaration.Parameters = p; @@ -2954,20 +3109,20 @@ out stmt); lexer.NextToken(); if (StartOf(4)) { FormalParameterList( -#line 1297 "VBNET.ATG" +#line 1329 "VBNET.ATG" p); } Expect(26); } Expect(1); Block( -#line 1298 "VBNET.ATG" +#line 1330 "VBNET.ATG" out stmt); Expect(100); Expect(178); EndOfStmt(); -#line 1300 "VBNET.ATG" +#line 1332 "VBNET.ATG" eventAccessorDeclaration = new EventRemoveRegion(attributes); eventAccessorDeclaration.Block = (BlockStatement)stmt; eventAccessorDeclaration.Parameters = p; @@ -2978,185 +3133,185 @@ out stmt); lexer.NextToken(); if (StartOf(4)) { FormalParameterList( -#line 1305 "VBNET.ATG" +#line 1337 "VBNET.ATG" p); } Expect(26); } Expect(1); Block( -#line 1306 "VBNET.ATG" +#line 1338 "VBNET.ATG" out stmt); Expect(100); Expect(174); EndOfStmt(); -#line 1308 "VBNET.ATG" +#line 1340 "VBNET.ATG" eventAccessorDeclaration = new EventRaiseRegion(attributes); eventAccessorDeclaration.Block = (BlockStatement)stmt; eventAccessorDeclaration.Parameters = p; - } else SynErr(252); + } else SynErr(254); } void OverloadableOperator( -#line 1221 "VBNET.ATG" +#line 1253 "VBNET.ATG" out OverloadableOperatorType operatorType) { -#line 1222 "VBNET.ATG" +#line 1254 "VBNET.ATG" operatorType = OverloadableOperatorType.None; switch (la.kind) { case 19: { lexer.NextToken(); -#line 1224 "VBNET.ATG" +#line 1256 "VBNET.ATG" operatorType = OverloadableOperatorType.Add; break; } case 18: { lexer.NextToken(); -#line 1226 "VBNET.ATG" +#line 1258 "VBNET.ATG" operatorType = OverloadableOperatorType.Subtract; break; } case 22: { lexer.NextToken(); -#line 1228 "VBNET.ATG" +#line 1260 "VBNET.ATG" operatorType = OverloadableOperatorType.Multiply; break; } case 14: { lexer.NextToken(); -#line 1230 "VBNET.ATG" +#line 1262 "VBNET.ATG" operatorType = OverloadableOperatorType.Divide; break; } case 15: { lexer.NextToken(); -#line 1232 "VBNET.ATG" +#line 1264 "VBNET.ATG" operatorType = OverloadableOperatorType.DivideInteger; break; } case 13: { lexer.NextToken(); -#line 1234 "VBNET.ATG" +#line 1266 "VBNET.ATG" operatorType = OverloadableOperatorType.Concat; break; } case 136: { lexer.NextToken(); -#line 1236 "VBNET.ATG" +#line 1268 "VBNET.ATG" operatorType = OverloadableOperatorType.Like; break; } case 140: { lexer.NextToken(); -#line 1238 "VBNET.ATG" +#line 1270 "VBNET.ATG" operatorType = OverloadableOperatorType.Modulus; break; } case 47: { lexer.NextToken(); -#line 1240 "VBNET.ATG" +#line 1272 "VBNET.ATG" operatorType = OverloadableOperatorType.BitwiseAnd; break; } case 161: { lexer.NextToken(); -#line 1242 "VBNET.ATG" +#line 1274 "VBNET.ATG" operatorType = OverloadableOperatorType.BitwiseOr; break; } case 221: { lexer.NextToken(); -#line 1244 "VBNET.ATG" +#line 1276 "VBNET.ATG" operatorType = OverloadableOperatorType.ExclusiveOr; break; } case 20: { lexer.NextToken(); -#line 1246 "VBNET.ATG" +#line 1278 "VBNET.ATG" operatorType = OverloadableOperatorType.Power; break; } case 32: { lexer.NextToken(); -#line 1248 "VBNET.ATG" +#line 1280 "VBNET.ATG" operatorType = OverloadableOperatorType.ShiftLeft; break; } case 33: { lexer.NextToken(); -#line 1250 "VBNET.ATG" +#line 1282 "VBNET.ATG" operatorType = OverloadableOperatorType.ShiftRight; break; } case 10: { lexer.NextToken(); -#line 1252 "VBNET.ATG" +#line 1284 "VBNET.ATG" operatorType = OverloadableOperatorType.Equality; break; } case 29: { lexer.NextToken(); -#line 1254 "VBNET.ATG" +#line 1286 "VBNET.ATG" operatorType = OverloadableOperatorType.InEquality; break; } case 28: { lexer.NextToken(); -#line 1256 "VBNET.ATG" +#line 1288 "VBNET.ATG" operatorType = OverloadableOperatorType.LessThan; break; } case 31: { lexer.NextToken(); -#line 1258 "VBNET.ATG" +#line 1290 "VBNET.ATG" operatorType = OverloadableOperatorType.LessThanOrEqual; break; } case 27: { lexer.NextToken(); -#line 1260 "VBNET.ATG" +#line 1292 "VBNET.ATG" operatorType = OverloadableOperatorType.GreaterThan; break; } case 30: { lexer.NextToken(); -#line 1262 "VBNET.ATG" +#line 1294 "VBNET.ATG" operatorType = OverloadableOperatorType.GreaterThanOrEqual; break; } case 81: { lexer.NextToken(); -#line 1264 "VBNET.ATG" +#line 1296 "VBNET.ATG" operatorType = OverloadableOperatorType.CType; break; } case 2: case 45: case 49: case 51: case 52: case 53: case 54: case 57: case 74: case 85: case 91: case 94: case 103: case 108: case 113: case 120: case 126: case 130: case 133: case 156: case 162: case 169: case 188: case 197: case 198: case 208: case 209: case 215: { Identifier(); -#line 1268 "VBNET.ATG" +#line 1300 "VBNET.ATG" string opName = t.val; if (string.Equals(opName, "istrue", StringComparison.InvariantCultureIgnoreCase)) { operatorType = OverloadableOperatorType.IsTrue; @@ -3168,72 +3323,72 @@ out OverloadableOperatorType operatorType) { break; } - default: SynErr(253); break; + default: SynErr(255); break; } } void GetAccessorDecl( -#line 1342 "VBNET.ATG" +#line 1374 "VBNET.ATG" out PropertyGetRegion getBlock, List attributes) { -#line 1343 "VBNET.ATG" +#line 1375 "VBNET.ATG" Statement stmt = null; Modifiers m; PropertyAccessorAccessModifier( -#line 1345 "VBNET.ATG" +#line 1377 "VBNET.ATG" out m); Expect(115); -#line 1347 "VBNET.ATG" +#line 1379 "VBNET.ATG" Location startLocation = t.Location; Expect(1); Block( -#line 1349 "VBNET.ATG" +#line 1381 "VBNET.ATG" out stmt); -#line 1350 "VBNET.ATG" +#line 1382 "VBNET.ATG" getBlock = new PropertyGetRegion((BlockStatement)stmt, attributes); Expect(100); Expect(115); -#line 1352 "VBNET.ATG" +#line 1384 "VBNET.ATG" getBlock.Modifier = m; -#line 1353 "VBNET.ATG" +#line 1385 "VBNET.ATG" getBlock.StartLocation = startLocation; getBlock.EndLocation = t.EndLocation; EndOfStmt(); } void SetAccessorDecl( -#line 1358 "VBNET.ATG" +#line 1390 "VBNET.ATG" out PropertySetRegion setBlock, List attributes) { -#line 1360 "VBNET.ATG" +#line 1392 "VBNET.ATG" Statement stmt = null; List p = new List(); Modifiers m; PropertyAccessorAccessModifier( -#line 1365 "VBNET.ATG" +#line 1397 "VBNET.ATG" out m); Expect(183); -#line 1367 "VBNET.ATG" +#line 1399 "VBNET.ATG" Location startLocation = t.Location; if (la.kind == 25) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( -#line 1368 "VBNET.ATG" +#line 1400 "VBNET.ATG" p); } Expect(26); } Expect(1); Block( -#line 1370 "VBNET.ATG" +#line 1402 "VBNET.ATG" out stmt); -#line 1372 "VBNET.ATG" +#line 1404 "VBNET.ATG" setBlock = new PropertySetRegion((BlockStatement)stmt, attributes); setBlock.Modifier = m; setBlock.Parameters = p; @@ -3241,267 +3396,151 @@ out stmt); Expect(100); Expect(183); -#line 1377 "VBNET.ATG" +#line 1409 "VBNET.ATG" setBlock.StartLocation = startLocation; setBlock.EndLocation = t.EndLocation; EndOfStmt(); } void PropertyAccessorAccessModifier( -#line 3410 "VBNET.ATG" +#line 3442 "VBNET.ATG" out Modifiers m) { -#line 3411 "VBNET.ATG" +#line 3443 "VBNET.ATG" m = Modifiers.None; - while (StartOf(28)) { + while (StartOf(29)) { if (la.kind == 173) { lexer.NextToken(); -#line 3413 "VBNET.ATG" +#line 3445 "VBNET.ATG" m |= Modifiers.Public; } else if (la.kind == 172) { lexer.NextToken(); -#line 3414 "VBNET.ATG" +#line 3446 "VBNET.ATG" m |= Modifiers.Protected; } else if (la.kind == 112) { lexer.NextToken(); -#line 3415 "VBNET.ATG" +#line 3447 "VBNET.ATG" m |= Modifiers.Internal; } else { lexer.NextToken(); -#line 3416 "VBNET.ATG" +#line 3448 "VBNET.ATG" m |= Modifiers.Private; } } } void ArrayInitializationModifier( -#line 1475 "VBNET.ATG" +#line 1507 "VBNET.ATG" out List arrayModifiers) { -#line 1477 "VBNET.ATG" +#line 1509 "VBNET.ATG" arrayModifiers = null; Expect(25); InitializationRankList( -#line 1479 "VBNET.ATG" +#line 1511 "VBNET.ATG" out arrayModifiers); Expect(26); } void ArrayNameModifier( -#line 2487 "VBNET.ATG" +#line 2519 "VBNET.ATG" out ArrayList arrayModifiers) { -#line 2489 "VBNET.ATG" +#line 2521 "VBNET.ATG" arrayModifiers = null; ArrayTypeModifiers( -#line 2491 "VBNET.ATG" +#line 2523 "VBNET.ATG" out arrayModifiers); } - void ObjectCreateExpression( -#line 1936 "VBNET.ATG" -out Expression oce) { - -#line 1938 "VBNET.ATG" - TypeReference type = null; - Expression initializer = null; - List arguments = null; - ArrayList dimensions = null; - oce = null; - bool canBeNormal; bool canBeReDim; - - Expect(148); - if (StartOf(7)) { - NonArrayTypeName( -#line 1946 "VBNET.ATG" -out type, false); - if (la.kind == 25) { - lexer.NextToken(); - NormalOrReDimArgumentList( -#line 1947 "VBNET.ATG" -out arguments, out canBeNormal, out canBeReDim); - Expect(26); - if (la.kind == 23 || -#line 1948 "VBNET.ATG" -la.kind == Tokens.OpenParenthesis) { - if ( -#line 1948 "VBNET.ATG" -la.kind == Tokens.OpenParenthesis) { - ArrayTypeModifiers( -#line 1949 "VBNET.ATG" -out dimensions); - CollectionInitializer( -#line 1950 "VBNET.ATG" -out initializer); - } else { - CollectionInitializer( -#line 1951 "VBNET.ATG" -out initializer); - } - } - -#line 1953 "VBNET.ATG" - if (canBeReDim && !canBeNormal && initializer == null) initializer = new CollectionInitializerExpression(); - } - } - -#line 1957 "VBNET.ATG" - if (initializer == null) { - oce = new ObjectCreateExpression(type, arguments); - } else { - if (dimensions == null) dimensions = new ArrayList(); - dimensions.Insert(0, (arguments == null) ? 0 : Math.Max(arguments.Count - 1, 0)); - type.RankSpecifier = (int[])dimensions.ToArray(typeof(int)); - ArrayCreateExpression ace = new ArrayCreateExpression(type, initializer as CollectionInitializerExpression); - ace.Arguments = arguments; - oce = ace; - } - - if (la.kind == 218) { - -#line 1971 "VBNET.ATG" - NamedArgumentExpression memberInitializer = null; - - lexer.NextToken(); - -#line 1975 "VBNET.ATG" - CollectionInitializerExpression memberInitializers = new CollectionInitializerExpression(); - memberInitializers.StartLocation = la.Location; - - Expect(23); - MemberInitializer( -#line 1979 "VBNET.ATG" -out memberInitializer); - -#line 1980 "VBNET.ATG" - memberInitializers.CreateExpressions.Add(memberInitializer); - while (la.kind == 12) { - lexer.NextToken(); - MemberInitializer( -#line 1982 "VBNET.ATG" -out memberInitializer); - -#line 1983 "VBNET.ATG" - memberInitializers.CreateExpressions.Add(memberInitializer); - } - Expect(24); - -#line 1987 "VBNET.ATG" - memberInitializers.EndLocation = t.Location; - if(oce is ObjectCreateExpression) - { - ((ObjectCreateExpression)oce).ObjectInitializer = memberInitializers; - } - - } - } - - void VariableInitializer( -#line 1503 "VBNET.ATG" -out Expression initializerExpression) { - -#line 1505 "VBNET.ATG" - initializerExpression = null; - - if (StartOf(29)) { - Expr( -#line 1507 "VBNET.ATG" -out initializerExpression); - } else if (la.kind == 23) { - CollectionInitializer( -#line 1508 "VBNET.ATG" -out initializerExpression); - } else SynErr(254); - } - void InitializationRankList( -#line 1483 "VBNET.ATG" +#line 1515 "VBNET.ATG" out List rank) { -#line 1485 "VBNET.ATG" +#line 1517 "VBNET.ATG" rank = new List(); Expression expr = null; Expr( -#line 1488 "VBNET.ATG" +#line 1520 "VBNET.ATG" out expr); if (la.kind == 201) { lexer.NextToken(); -#line 1489 "VBNET.ATG" +#line 1521 "VBNET.ATG" EnsureIsZero(expr); Expr( -#line 1490 "VBNET.ATG" +#line 1522 "VBNET.ATG" out expr); } -#line 1492 "VBNET.ATG" +#line 1524 "VBNET.ATG" if (expr != null) { rank.Add(expr); } while (la.kind == 12) { lexer.NextToken(); Expr( -#line 1494 "VBNET.ATG" +#line 1526 "VBNET.ATG" out expr); if (la.kind == 201) { lexer.NextToken(); -#line 1495 "VBNET.ATG" +#line 1527 "VBNET.ATG" EnsureIsZero(expr); Expr( -#line 1496 "VBNET.ATG" +#line 1528 "VBNET.ATG" out expr); } -#line 1498 "VBNET.ATG" +#line 1530 "VBNET.ATG" if (expr != null) { rank.Add(expr); } } } void CollectionInitializer( -#line 1512 "VBNET.ATG" +#line 1544 "VBNET.ATG" out Expression outExpr) { -#line 1514 "VBNET.ATG" +#line 1546 "VBNET.ATG" Expression expr = null; CollectionInitializerExpression initializer = new CollectionInitializerExpression(); Expect(23); if (StartOf(30)) { VariableInitializer( -#line 1519 "VBNET.ATG" +#line 1551 "VBNET.ATG" out expr); -#line 1521 "VBNET.ATG" +#line 1553 "VBNET.ATG" if (expr != null) { initializer.CreateExpressions.Add(expr); } while ( -#line 1524 "VBNET.ATG" +#line 1556 "VBNET.ATG" NotFinalComma()) { Expect(12); VariableInitializer( -#line 1524 "VBNET.ATG" +#line 1556 "VBNET.ATG" out expr); -#line 1525 "VBNET.ATG" +#line 1557 "VBNET.ATG" if (expr != null) { initializer.CreateExpressions.Add(expr); } } } Expect(24); -#line 1528 "VBNET.ATG" +#line 1560 "VBNET.ATG" outExpr = initializer; } void EventMemberSpecifier( -#line 1598 "VBNET.ATG" +#line 1630 "VBNET.ATG" out string name) { -#line 1599 "VBNET.ATG" +#line 1631 "VBNET.ATG" string eventName; if (StartOf(14)) { Identifier(); @@ -3509,55 +3548,55 @@ out string name) { lexer.NextToken(); } else if (la.kind == 139) { lexer.NextToken(); - } else SynErr(255); + } else SynErr(256); -#line 1602 "VBNET.ATG" +#line 1634 "VBNET.ATG" name = t.val; Expect(16); IdentifierOrKeyword( -#line 1604 "VBNET.ATG" +#line 1636 "VBNET.ATG" out eventName); -#line 1605 "VBNET.ATG" +#line 1637 "VBNET.ATG" name = name + "." + eventName; } void IdentifierOrKeyword( -#line 3343 "VBNET.ATG" +#line 3375 "VBNET.ATG" out string name) { -#line 3345 "VBNET.ATG" +#line 3377 "VBNET.ATG" lexer.NextToken(); name = t.val; } void QueryExpr( -#line 2014 "VBNET.ATG" +#line 2046 "VBNET.ATG" out Expression expr) { -#line 2016 "VBNET.ATG" +#line 2048 "VBNET.ATG" QueryExpressionVB qexpr = new QueryExpressionVB(); qexpr.StartLocation = la.Location; expr = qexpr; FromOrAggregateQueryOperator( -#line 2020 "VBNET.ATG" +#line 2052 "VBNET.ATG" qexpr.Clauses); while (StartOf(31)) { QueryOperator( -#line 2021 "VBNET.ATG" +#line 2053 "VBNET.ATG" qexpr.Clauses); } -#line 2023 "VBNET.ATG" +#line 2055 "VBNET.ATG" qexpr.EndLocation = t.EndLocation; } void LambdaExpr( -#line 1996 "VBNET.ATG" +#line 2028 "VBNET.ATG" out Expression expr) { -#line 1998 "VBNET.ATG" +#line 2030 "VBNET.ATG" Expression inner = null; LambdaExpression lambda = new LambdaExpression(); lambda.StartLocation = la.Location; @@ -3567,16 +3606,16 @@ out Expression expr) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( -#line 2004 "VBNET.ATG" +#line 2036 "VBNET.ATG" lambda.Parameters); } Expect(26); } Expr( -#line 2005 "VBNET.ATG" +#line 2037 "VBNET.ATG" out inner); -#line 2007 "VBNET.ATG" +#line 2039 "VBNET.ATG" lambda.ExpressionBody = inner; lambda.EndLocation = t.EndLocation; // la.Location? @@ -3585,172 +3624,172 @@ out inner); } void DisjunctionExpr( -#line 1780 "VBNET.ATG" +#line 1812 "VBNET.ATG" out Expression outExpr) { -#line 1782 "VBNET.ATG" +#line 1814 "VBNET.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; ConjunctionExpr( -#line 1785 "VBNET.ATG" +#line 1817 "VBNET.ATG" out outExpr); while (la.kind == 161 || la.kind == 163 || la.kind == 221) { if (la.kind == 161) { lexer.NextToken(); -#line 1788 "VBNET.ATG" +#line 1820 "VBNET.ATG" op = BinaryOperatorType.BitwiseOr; } else if (la.kind == 163) { lexer.NextToken(); -#line 1789 "VBNET.ATG" +#line 1821 "VBNET.ATG" op = BinaryOperatorType.LogicalOr; } else { lexer.NextToken(); -#line 1790 "VBNET.ATG" +#line 1822 "VBNET.ATG" op = BinaryOperatorType.ExclusiveOr; } ConjunctionExpr( -#line 1792 "VBNET.ATG" +#line 1824 "VBNET.ATG" out expr); -#line 1792 "VBNET.ATG" +#line 1824 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } } void AssignmentOperator( -#line 1616 "VBNET.ATG" +#line 1648 "VBNET.ATG" out AssignmentOperatorType op) { -#line 1617 "VBNET.ATG" +#line 1649 "VBNET.ATG" op = AssignmentOperatorType.None; switch (la.kind) { case 10: { lexer.NextToken(); -#line 1618 "VBNET.ATG" +#line 1650 "VBNET.ATG" op = AssignmentOperatorType.Assign; break; } case 42: { lexer.NextToken(); -#line 1619 "VBNET.ATG" +#line 1651 "VBNET.ATG" op = AssignmentOperatorType.ConcatString; break; } case 34: { lexer.NextToken(); -#line 1620 "VBNET.ATG" +#line 1652 "VBNET.ATG" op = AssignmentOperatorType.Add; break; } case 36: { lexer.NextToken(); -#line 1621 "VBNET.ATG" +#line 1653 "VBNET.ATG" op = AssignmentOperatorType.Subtract; break; } case 37: { lexer.NextToken(); -#line 1622 "VBNET.ATG" +#line 1654 "VBNET.ATG" op = AssignmentOperatorType.Multiply; break; } case 38: { lexer.NextToken(); -#line 1623 "VBNET.ATG" +#line 1655 "VBNET.ATG" op = AssignmentOperatorType.Divide; break; } case 39: { lexer.NextToken(); -#line 1624 "VBNET.ATG" +#line 1656 "VBNET.ATG" op = AssignmentOperatorType.DivideInteger; break; } case 35: { lexer.NextToken(); -#line 1625 "VBNET.ATG" +#line 1657 "VBNET.ATG" op = AssignmentOperatorType.Power; break; } case 40: { lexer.NextToken(); -#line 1626 "VBNET.ATG" +#line 1658 "VBNET.ATG" op = AssignmentOperatorType.ShiftLeft; break; } case 41: { lexer.NextToken(); -#line 1627 "VBNET.ATG" +#line 1659 "VBNET.ATG" op = AssignmentOperatorType.ShiftRight; break; } - default: SynErr(256); break; + default: SynErr(257); break; } } void SimpleExpr( -#line 1631 "VBNET.ATG" +#line 1663 "VBNET.ATG" out Expression pexpr) { -#line 1632 "VBNET.ATG" +#line 1664 "VBNET.ATG" string name; SimpleNonInvocationExpression( -#line 1634 "VBNET.ATG" +#line 1666 "VBNET.ATG" out pexpr); while (la.kind == 16 || la.kind == 17 || la.kind == 25) { if (la.kind == 16) { lexer.NextToken(); IdentifierOrKeyword( -#line 1636 "VBNET.ATG" +#line 1668 "VBNET.ATG" out name); -#line 1637 "VBNET.ATG" +#line 1669 "VBNET.ATG" pexpr = new MemberReferenceExpression(pexpr, name); if ( -#line 1638 "VBNET.ATG" +#line 1670 "VBNET.ATG" la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of) { lexer.NextToken(); Expect(155); TypeArgumentList( -#line 1639 "VBNET.ATG" +#line 1671 "VBNET.ATG" ((MemberReferenceExpression)pexpr).TypeArguments); Expect(26); } } else if (la.kind == 17) { lexer.NextToken(); IdentifierOrKeyword( -#line 1641 "VBNET.ATG" +#line 1673 "VBNET.ATG" out name); -#line 1641 "VBNET.ATG" +#line 1673 "VBNET.ATG" pexpr = new BinaryOperatorExpression(pexpr, BinaryOperatorType.DictionaryAccess, new PrimitiveExpression(name, name)); } else { InvocationExpression( -#line 1642 "VBNET.ATG" +#line 1674 "VBNET.ATG" ref pexpr); } } } void SimpleNonInvocationExpression( -#line 1646 "VBNET.ATG" +#line 1678 "VBNET.ATG" out Expression pexpr) { -#line 1648 "VBNET.ATG" +#line 1680 "VBNET.ATG" Expression expr; TypeReference type = null; string name = String.Empty; @@ -3761,98 +3800,98 @@ out Expression pexpr) { case 3: { lexer.NextToken(); -#line 1656 "VBNET.ATG" +#line 1688 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; break; } case 4: { lexer.NextToken(); -#line 1657 "VBNET.ATG" +#line 1689 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; break; } case 7: { lexer.NextToken(); -#line 1658 "VBNET.ATG" +#line 1690 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; break; } case 6: { lexer.NextToken(); -#line 1659 "VBNET.ATG" +#line 1691 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; break; } case 5: { lexer.NextToken(); -#line 1660 "VBNET.ATG" +#line 1692 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; break; } case 9: { lexer.NextToken(); -#line 1661 "VBNET.ATG" +#line 1693 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; break; } case 8: { lexer.NextToken(); -#line 1662 "VBNET.ATG" +#line 1694 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; break; } case 202: { lexer.NextToken(); -#line 1664 "VBNET.ATG" +#line 1696 "VBNET.ATG" pexpr = new PrimitiveExpression(true, "true"); break; } case 109: { lexer.NextToken(); -#line 1665 "VBNET.ATG" +#line 1697 "VBNET.ATG" pexpr = new PrimitiveExpression(false, "false"); break; } case 151: { lexer.NextToken(); -#line 1666 "VBNET.ATG" +#line 1698 "VBNET.ATG" pexpr = new PrimitiveExpression(null, "null"); break; } case 25: { lexer.NextToken(); Expr( -#line 1667 "VBNET.ATG" +#line 1699 "VBNET.ATG" out expr); Expect(26); -#line 1667 "VBNET.ATG" +#line 1699 "VBNET.ATG" pexpr = new ParenthesizedExpression(expr); break; } case 2: case 45: case 49: case 51: case 52: case 53: case 54: case 57: case 74: case 85: case 91: case 94: case 103: case 108: case 113: case 120: case 126: case 130: case 133: case 156: case 162: case 169: case 188: case 197: case 198: case 208: case 209: case 215: { Identifier(); -#line 1669 "VBNET.ATG" +#line 1701 "VBNET.ATG" pexpr = new IdentifierExpression(t.val); pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation; if ( -#line 1672 "VBNET.ATG" +#line 1704 "VBNET.ATG" la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of) { lexer.NextToken(); Expect(155); TypeArgumentList( -#line 1673 "VBNET.ATG" +#line 1705 "VBNET.ATG" ((IdentifierExpression)pexpr).TypeArguments); Expect(26); } @@ -3860,51 +3899,51 @@ la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of) { } case 55: case 58: case 69: case 86: case 87: case 96: case 128: case 137: case 154: case 181: case 186: case 187: case 193: case 206: case 207: case 210: { -#line 1675 "VBNET.ATG" +#line 1707 "VBNET.ATG" string val = String.Empty; if (StartOf(11)) { PrimitiveTypeName( -#line 1676 "VBNET.ATG" +#line 1708 "VBNET.ATG" out val); } else if (la.kind == 154) { lexer.NextToken(); -#line 1676 "VBNET.ATG" +#line 1708 "VBNET.ATG" val = "System.Object"; - } else SynErr(257); + } else SynErr(258); -#line 1677 "VBNET.ATG" +#line 1709 "VBNET.ATG" pexpr = new TypeReferenceExpression(new TypeReference(val, true)); break; } case 139: { lexer.NextToken(); -#line 1678 "VBNET.ATG" +#line 1710 "VBNET.ATG" pexpr = new ThisReferenceExpression(); break; } case 144: case 145: { -#line 1679 "VBNET.ATG" +#line 1711 "VBNET.ATG" Expression retExpr = null; if (la.kind == 144) { lexer.NextToken(); -#line 1680 "VBNET.ATG" +#line 1712 "VBNET.ATG" retExpr = new BaseReferenceExpression(); } else if (la.kind == 145) { lexer.NextToken(); -#line 1681 "VBNET.ATG" +#line 1713 "VBNET.ATG" retExpr = new ClassReferenceExpression(); - } else SynErr(258); + } else SynErr(259); Expect(16); IdentifierOrKeyword( -#line 1683 "VBNET.ATG" +#line 1715 "VBNET.ATG" out name); -#line 1683 "VBNET.ATG" +#line 1715 "VBNET.ATG" pexpr = new MemberReferenceExpression(retExpr, name); break; } @@ -3913,77 +3952,77 @@ out name); Expect(16); Identifier(); -#line 1685 "VBNET.ATG" +#line 1717 "VBNET.ATG" type = new TypeReference(t.val ?? ""); -#line 1687 "VBNET.ATG" +#line 1719 "VBNET.ATG" type.IsGlobal = true; -#line 1688 "VBNET.ATG" +#line 1720 "VBNET.ATG" pexpr = new TypeReferenceExpression(type); break; } case 148: { ObjectCreateExpression( -#line 1689 "VBNET.ATG" +#line 1721 "VBNET.ATG" out expr); -#line 1689 "VBNET.ATG" +#line 1721 "VBNET.ATG" pexpr = expr; break; } case 81: case 93: case 204: { -#line 1691 "VBNET.ATG" +#line 1723 "VBNET.ATG" CastType castType = CastType.Cast; if (la.kind == 93) { lexer.NextToken(); } else if (la.kind == 81) { lexer.NextToken(); -#line 1693 "VBNET.ATG" +#line 1725 "VBNET.ATG" castType = CastType.Conversion; } else if (la.kind == 204) { lexer.NextToken(); -#line 1694 "VBNET.ATG" +#line 1726 "VBNET.ATG" castType = CastType.TryCast; - } else SynErr(259); + } else SynErr(260); Expect(25); Expr( -#line 1696 "VBNET.ATG" +#line 1728 "VBNET.ATG" out expr); Expect(12); TypeName( -#line 1696 "VBNET.ATG" +#line 1728 "VBNET.ATG" out type); Expect(26); -#line 1697 "VBNET.ATG" +#line 1729 "VBNET.ATG" pexpr = new CastExpression(type, expr, castType); break; } case 63: case 64: case 65: case 66: case 67: case 68: case 70: case 72: case 73: case 77: case 78: case 79: case 80: case 82: case 83: case 84: { CastTarget( -#line 1698 "VBNET.ATG" +#line 1730 "VBNET.ATG" out type); Expect(25); Expr( -#line 1698 "VBNET.ATG" +#line 1730 "VBNET.ATG" out expr); Expect(26); -#line 1698 "VBNET.ATG" +#line 1730 "VBNET.ATG" pexpr = new CastExpression(type, expr, CastType.PrimitiveConversion); break; } case 44: { lexer.NextToken(); Expr( -#line 1699 "VBNET.ATG" +#line 1731 "VBNET.ATG" out expr); -#line 1699 "VBNET.ATG" +#line 1731 "VBNET.ATG" pexpr = new AddressOfExpression(expr); break; } @@ -3991,31 +4030,31 @@ out expr); lexer.NextToken(); Expect(25); GetTypeTypeName( -#line 1700 "VBNET.ATG" +#line 1732 "VBNET.ATG" out type); Expect(26); -#line 1700 "VBNET.ATG" +#line 1732 "VBNET.ATG" pexpr = new TypeOfExpression(type); break; } case 205: { lexer.NextToken(); SimpleExpr( -#line 1701 "VBNET.ATG" +#line 1733 "VBNET.ATG" out expr); Expect(131); TypeName( -#line 1701 "VBNET.ATG" +#line 1733 "VBNET.ATG" out type); -#line 1701 "VBNET.ATG" +#line 1733 "VBNET.ATG" pexpr = new TypeOfIsExpression(expr, type); break; } case 122: { ConditionalExpression( -#line 1702 "VBNET.ATG" +#line 1734 "VBNET.ATG" out pexpr); break; } @@ -4023,315 +4062,315 @@ out pexpr); } else if (la.kind == 16) { lexer.NextToken(); IdentifierOrKeyword( -#line 1706 "VBNET.ATG" +#line 1738 "VBNET.ATG" out name); -#line 1706 "VBNET.ATG" +#line 1738 "VBNET.ATG" pexpr = new MemberReferenceExpression(null, name); - } else SynErr(260); + } else SynErr(261); } void TypeArgumentList( -#line 2523 "VBNET.ATG" +#line 2555 "VBNET.ATG" List typeArguments) { -#line 2525 "VBNET.ATG" +#line 2557 "VBNET.ATG" TypeReference typeref; TypeName( -#line 2527 "VBNET.ATG" +#line 2559 "VBNET.ATG" out typeref); -#line 2527 "VBNET.ATG" +#line 2559 "VBNET.ATG" if (typeref != null) typeArguments.Add(typeref); while (la.kind == 12) { lexer.NextToken(); TypeName( -#line 2530 "VBNET.ATG" +#line 2562 "VBNET.ATG" out typeref); -#line 2530 "VBNET.ATG" +#line 2562 "VBNET.ATG" if (typeref != null) typeArguments.Add(typeref); } } void InvocationExpression( -#line 1744 "VBNET.ATG" +#line 1776 "VBNET.ATG" ref Expression pexpr) { -#line 1745 "VBNET.ATG" +#line 1777 "VBNET.ATG" List parameters = null; Expect(25); -#line 1747 "VBNET.ATG" +#line 1779 "VBNET.ATG" Location start = t.Location; ArgumentList( -#line 1748 "VBNET.ATG" +#line 1780 "VBNET.ATG" out parameters); Expect(26); -#line 1751 "VBNET.ATG" +#line 1783 "VBNET.ATG" pexpr = new InvocationExpression(pexpr, parameters); -#line 1753 "VBNET.ATG" +#line 1785 "VBNET.ATG" pexpr.StartLocation = start; pexpr.EndLocation = t.Location; } void PrimitiveTypeName( -#line 3350 "VBNET.ATG" +#line 3382 "VBNET.ATG" out string type) { -#line 3351 "VBNET.ATG" +#line 3383 "VBNET.ATG" type = String.Empty; switch (la.kind) { case 55: { lexer.NextToken(); -#line 3352 "VBNET.ATG" +#line 3384 "VBNET.ATG" type = "System.Boolean"; break; } case 86: { lexer.NextToken(); -#line 3353 "VBNET.ATG" +#line 3385 "VBNET.ATG" type = "System.DateTime"; break; } case 69: { lexer.NextToken(); -#line 3354 "VBNET.ATG" +#line 3386 "VBNET.ATG" type = "System.Char"; break; } case 193: { lexer.NextToken(); -#line 3355 "VBNET.ATG" +#line 3387 "VBNET.ATG" type = "System.String"; break; } case 87: { lexer.NextToken(); -#line 3356 "VBNET.ATG" +#line 3388 "VBNET.ATG" type = "System.Decimal"; break; } case 58: { lexer.NextToken(); -#line 3357 "VBNET.ATG" +#line 3389 "VBNET.ATG" type = "System.Byte"; break; } case 186: { lexer.NextToken(); -#line 3358 "VBNET.ATG" +#line 3390 "VBNET.ATG" type = "System.Int16"; break; } case 128: { lexer.NextToken(); -#line 3359 "VBNET.ATG" +#line 3391 "VBNET.ATG" type = "System.Int32"; break; } case 137: { lexer.NextToken(); -#line 3360 "VBNET.ATG" +#line 3392 "VBNET.ATG" type = "System.Int64"; break; } case 187: { lexer.NextToken(); -#line 3361 "VBNET.ATG" +#line 3393 "VBNET.ATG" type = "System.Single"; break; } case 96: { lexer.NextToken(); -#line 3362 "VBNET.ATG" +#line 3394 "VBNET.ATG" type = "System.Double"; break; } case 206: { lexer.NextToken(); -#line 3363 "VBNET.ATG" +#line 3395 "VBNET.ATG" type = "System.UInt32"; break; } case 207: { lexer.NextToken(); -#line 3364 "VBNET.ATG" +#line 3396 "VBNET.ATG" type = "System.UInt64"; break; } case 210: { lexer.NextToken(); -#line 3365 "VBNET.ATG" +#line 3397 "VBNET.ATG" type = "System.UInt16"; break; } case 181: { lexer.NextToken(); -#line 3366 "VBNET.ATG" +#line 3398 "VBNET.ATG" type = "System.SByte"; break; } - default: SynErr(261); break; + default: SynErr(262); break; } } void CastTarget( -#line 1758 "VBNET.ATG" +#line 1790 "VBNET.ATG" out TypeReference type) { -#line 1760 "VBNET.ATG" +#line 1792 "VBNET.ATG" type = null; switch (la.kind) { case 63: { lexer.NextToken(); -#line 1762 "VBNET.ATG" +#line 1794 "VBNET.ATG" type = new TypeReference("System.Boolean", true); break; } case 64: { lexer.NextToken(); -#line 1763 "VBNET.ATG" +#line 1795 "VBNET.ATG" type = new TypeReference("System.Byte", true); break; } case 77: { lexer.NextToken(); -#line 1764 "VBNET.ATG" +#line 1796 "VBNET.ATG" type = new TypeReference("System.SByte", true); break; } case 65: { lexer.NextToken(); -#line 1765 "VBNET.ATG" +#line 1797 "VBNET.ATG" type = new TypeReference("System.Char", true); break; } case 66: { lexer.NextToken(); -#line 1766 "VBNET.ATG" +#line 1798 "VBNET.ATG" type = new TypeReference("System.DateTime", true); break; } case 68: { lexer.NextToken(); -#line 1767 "VBNET.ATG" +#line 1799 "VBNET.ATG" type = new TypeReference("System.Decimal", true); break; } case 67: { lexer.NextToken(); -#line 1768 "VBNET.ATG" +#line 1800 "VBNET.ATG" type = new TypeReference("System.Double", true); break; } case 78: { lexer.NextToken(); -#line 1769 "VBNET.ATG" +#line 1801 "VBNET.ATG" type = new TypeReference("System.Int16", true); break; } case 70: { lexer.NextToken(); -#line 1770 "VBNET.ATG" +#line 1802 "VBNET.ATG" type = new TypeReference("System.Int32", true); break; } case 72: { lexer.NextToken(); -#line 1771 "VBNET.ATG" +#line 1803 "VBNET.ATG" type = new TypeReference("System.Int64", true); break; } case 84: { lexer.NextToken(); -#line 1772 "VBNET.ATG" +#line 1804 "VBNET.ATG" type = new TypeReference("System.UInt16", true); break; } case 82: { lexer.NextToken(); -#line 1773 "VBNET.ATG" +#line 1805 "VBNET.ATG" type = new TypeReference("System.UInt32", true); break; } case 83: { lexer.NextToken(); -#line 1774 "VBNET.ATG" +#line 1806 "VBNET.ATG" type = new TypeReference("System.UInt64", true); break; } case 73: { lexer.NextToken(); -#line 1775 "VBNET.ATG" +#line 1807 "VBNET.ATG" type = new TypeReference("System.Object", true); break; } case 79: { lexer.NextToken(); -#line 1776 "VBNET.ATG" +#line 1808 "VBNET.ATG" type = new TypeReference("System.Single", true); break; } case 80: { lexer.NextToken(); -#line 1777 "VBNET.ATG" +#line 1809 "VBNET.ATG" type = new TypeReference("System.String", true); break; } - default: SynErr(262); break; + default: SynErr(263); break; } } void GetTypeTypeName( -#line 2422 "VBNET.ATG" +#line 2454 "VBNET.ATG" out TypeReference typeref) { -#line 2423 "VBNET.ATG" +#line 2455 "VBNET.ATG" ArrayList rank = null; NonArrayTypeName( -#line 2425 "VBNET.ATG" +#line 2457 "VBNET.ATG" out typeref, true); ArrayTypeModifiers( -#line 2426 "VBNET.ATG" +#line 2458 "VBNET.ATG" out rank); -#line 2427 "VBNET.ATG" +#line 2459 "VBNET.ATG" if (rank != null && typeref != null) { typeref.RankSpecifier = (int[])rank.ToArray(typeof(int)); } @@ -4339,10 +4378,10 @@ out rank); } void ConditionalExpression( -#line 1710 "VBNET.ATG" +#line 1742 "VBNET.ATG" out Expression expr) { -#line 1712 "VBNET.ATG" +#line 1744 "VBNET.ATG" ConditionalExpression conditionalExpression = new ConditionalExpression(); BinaryOperatorExpression binaryOperatorExpression = new BinaryOperatorExpression(); conditionalExpression.StartLocation = binaryOperatorExpression.StartLocation = la.Location; @@ -4354,21 +4393,21 @@ out Expression expr) { Expect(122); Expect(25); Expr( -#line 1721 "VBNET.ATG" +#line 1753 "VBNET.ATG" out condition); Expect(12); Expr( -#line 1721 "VBNET.ATG" +#line 1753 "VBNET.ATG" out trueExpr); if (la.kind == 12) { lexer.NextToken(); Expr( -#line 1721 "VBNET.ATG" +#line 1753 "VBNET.ATG" out falseExpr); } Expect(26); -#line 1723 "VBNET.ATG" +#line 1755 "VBNET.ATG" if(falseExpr != null) { conditionalExpression.Condition = condition; @@ -4391,348 +4430,348 @@ out falseExpr); } void ArgumentList( -#line 2354 "VBNET.ATG" +#line 2386 "VBNET.ATG" out List arguments) { -#line 2356 "VBNET.ATG" +#line 2388 "VBNET.ATG" arguments = new List(); Expression expr = null; - if (StartOf(29)) { + if (StartOf(24)) { Argument( -#line 2359 "VBNET.ATG" +#line 2391 "VBNET.ATG" out expr); } while (la.kind == 12) { lexer.NextToken(); -#line 2360 "VBNET.ATG" +#line 2392 "VBNET.ATG" arguments.Add(expr ?? Expression.Null); expr = null; - if (StartOf(29)) { + if (StartOf(24)) { Argument( -#line 2361 "VBNET.ATG" +#line 2393 "VBNET.ATG" out expr); } -#line 2362 "VBNET.ATG" +#line 2394 "VBNET.ATG" if (expr == null) expr = Expression.Null; } -#line 2364 "VBNET.ATG" +#line 2396 "VBNET.ATG" if (expr != null) arguments.Add(expr); } void ConjunctionExpr( -#line 1796 "VBNET.ATG" +#line 1828 "VBNET.ATG" out Expression outExpr) { -#line 1798 "VBNET.ATG" +#line 1830 "VBNET.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; NotExpr( -#line 1801 "VBNET.ATG" +#line 1833 "VBNET.ATG" out outExpr); while (la.kind == 47 || la.kind == 48) { if (la.kind == 47) { lexer.NextToken(); -#line 1804 "VBNET.ATG" +#line 1836 "VBNET.ATG" op = BinaryOperatorType.BitwiseAnd; } else { lexer.NextToken(); -#line 1805 "VBNET.ATG" +#line 1837 "VBNET.ATG" op = BinaryOperatorType.LogicalAnd; } NotExpr( -#line 1807 "VBNET.ATG" +#line 1839 "VBNET.ATG" out expr); -#line 1807 "VBNET.ATG" +#line 1839 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } } void NotExpr( -#line 1811 "VBNET.ATG" +#line 1843 "VBNET.ATG" out Expression outExpr) { -#line 1812 "VBNET.ATG" +#line 1844 "VBNET.ATG" UnaryOperatorType uop = UnaryOperatorType.None; while (la.kind == 150) { lexer.NextToken(); -#line 1813 "VBNET.ATG" +#line 1845 "VBNET.ATG" uop = UnaryOperatorType.Not; } ComparisonExpr( -#line 1814 "VBNET.ATG" +#line 1846 "VBNET.ATG" out outExpr); -#line 1815 "VBNET.ATG" +#line 1847 "VBNET.ATG" if (uop != UnaryOperatorType.None) outExpr = new UnaryOperatorExpression(outExpr, uop); } void ComparisonExpr( -#line 1820 "VBNET.ATG" +#line 1852 "VBNET.ATG" out Expression outExpr) { -#line 1822 "VBNET.ATG" +#line 1854 "VBNET.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; ShiftExpr( -#line 1825 "VBNET.ATG" +#line 1857 "VBNET.ATG" out outExpr); while (StartOf(33)) { switch (la.kind) { case 28: { lexer.NextToken(); -#line 1828 "VBNET.ATG" +#line 1860 "VBNET.ATG" op = BinaryOperatorType.LessThan; break; } case 27: { lexer.NextToken(); -#line 1829 "VBNET.ATG" +#line 1861 "VBNET.ATG" op = BinaryOperatorType.GreaterThan; break; } case 31: { lexer.NextToken(); -#line 1830 "VBNET.ATG" +#line 1862 "VBNET.ATG" op = BinaryOperatorType.LessThanOrEqual; break; } case 30: { lexer.NextToken(); -#line 1831 "VBNET.ATG" +#line 1863 "VBNET.ATG" op = BinaryOperatorType.GreaterThanOrEqual; break; } case 29: { lexer.NextToken(); -#line 1832 "VBNET.ATG" +#line 1864 "VBNET.ATG" op = BinaryOperatorType.InEquality; break; } case 10: { lexer.NextToken(); -#line 1833 "VBNET.ATG" +#line 1865 "VBNET.ATG" op = BinaryOperatorType.Equality; break; } case 136: { lexer.NextToken(); -#line 1834 "VBNET.ATG" +#line 1866 "VBNET.ATG" op = BinaryOperatorType.Like; break; } case 131: { lexer.NextToken(); -#line 1835 "VBNET.ATG" +#line 1867 "VBNET.ATG" op = BinaryOperatorType.ReferenceEquality; break; } case 132: { lexer.NextToken(); -#line 1836 "VBNET.ATG" +#line 1868 "VBNET.ATG" op = BinaryOperatorType.ReferenceInequality; break; } } if (StartOf(34)) { ShiftExpr( -#line 1839 "VBNET.ATG" +#line 1871 "VBNET.ATG" out expr); -#line 1839 "VBNET.ATG" +#line 1871 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } else if (la.kind == 150) { lexer.NextToken(); ShiftExpr( -#line 1842 "VBNET.ATG" +#line 1874 "VBNET.ATG" out expr); -#line 1842 "VBNET.ATG" +#line 1874 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, new UnaryOperatorExpression(expr, UnaryOperatorType.Not)); - } else SynErr(263); + } else SynErr(264); } } void ShiftExpr( -#line 1847 "VBNET.ATG" +#line 1879 "VBNET.ATG" out Expression outExpr) { -#line 1849 "VBNET.ATG" +#line 1881 "VBNET.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; ConcatenationExpr( -#line 1852 "VBNET.ATG" +#line 1884 "VBNET.ATG" out outExpr); while (la.kind == 32 || la.kind == 33) { if (la.kind == 32) { lexer.NextToken(); -#line 1855 "VBNET.ATG" +#line 1887 "VBNET.ATG" op = BinaryOperatorType.ShiftLeft; } else { lexer.NextToken(); -#line 1856 "VBNET.ATG" +#line 1888 "VBNET.ATG" op = BinaryOperatorType.ShiftRight; } ConcatenationExpr( -#line 1858 "VBNET.ATG" +#line 1890 "VBNET.ATG" out expr); -#line 1858 "VBNET.ATG" +#line 1890 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } } void ConcatenationExpr( -#line 1862 "VBNET.ATG" +#line 1894 "VBNET.ATG" out Expression outExpr) { -#line 1863 "VBNET.ATG" +#line 1895 "VBNET.ATG" Expression expr; AdditiveExpr( -#line 1865 "VBNET.ATG" +#line 1897 "VBNET.ATG" out outExpr); while (la.kind == 13) { lexer.NextToken(); AdditiveExpr( -#line 1865 "VBNET.ATG" +#line 1897 "VBNET.ATG" out expr); -#line 1865 "VBNET.ATG" +#line 1897 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.Concat, expr); } } void AdditiveExpr( -#line 1868 "VBNET.ATG" +#line 1900 "VBNET.ATG" out Expression outExpr) { -#line 1870 "VBNET.ATG" +#line 1902 "VBNET.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; ModuloExpr( -#line 1873 "VBNET.ATG" +#line 1905 "VBNET.ATG" out outExpr); while (la.kind == 18 || la.kind == 19) { if (la.kind == 19) { lexer.NextToken(); -#line 1876 "VBNET.ATG" +#line 1908 "VBNET.ATG" op = BinaryOperatorType.Add; } else { lexer.NextToken(); -#line 1877 "VBNET.ATG" +#line 1909 "VBNET.ATG" op = BinaryOperatorType.Subtract; } ModuloExpr( -#line 1879 "VBNET.ATG" +#line 1911 "VBNET.ATG" out expr); -#line 1879 "VBNET.ATG" +#line 1911 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } } void ModuloExpr( -#line 1883 "VBNET.ATG" +#line 1915 "VBNET.ATG" out Expression outExpr) { -#line 1884 "VBNET.ATG" +#line 1916 "VBNET.ATG" Expression expr; IntegerDivisionExpr( -#line 1886 "VBNET.ATG" +#line 1918 "VBNET.ATG" out outExpr); while (la.kind == 140) { lexer.NextToken(); IntegerDivisionExpr( -#line 1886 "VBNET.ATG" +#line 1918 "VBNET.ATG" out expr); -#line 1886 "VBNET.ATG" +#line 1918 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.Modulus, expr); } } void IntegerDivisionExpr( -#line 1889 "VBNET.ATG" +#line 1921 "VBNET.ATG" out Expression outExpr) { -#line 1890 "VBNET.ATG" +#line 1922 "VBNET.ATG" Expression expr; MultiplicativeExpr( -#line 1892 "VBNET.ATG" +#line 1924 "VBNET.ATG" out outExpr); while (la.kind == 15) { lexer.NextToken(); MultiplicativeExpr( -#line 1892 "VBNET.ATG" +#line 1924 "VBNET.ATG" out expr); -#line 1892 "VBNET.ATG" +#line 1924 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.DivideInteger, expr); } } void MultiplicativeExpr( -#line 1895 "VBNET.ATG" +#line 1927 "VBNET.ATG" out Expression outExpr) { -#line 1897 "VBNET.ATG" +#line 1929 "VBNET.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; UnaryExpr( -#line 1900 "VBNET.ATG" +#line 1932 "VBNET.ATG" out outExpr); while (la.kind == 14 || la.kind == 22) { if (la.kind == 22) { lexer.NextToken(); -#line 1903 "VBNET.ATG" +#line 1935 "VBNET.ATG" op = BinaryOperatorType.Multiply; } else { lexer.NextToken(); -#line 1904 "VBNET.ATG" +#line 1936 "VBNET.ATG" op = BinaryOperatorType.Divide; } UnaryExpr( -#line 1906 "VBNET.ATG" +#line 1938 "VBNET.ATG" out expr); -#line 1906 "VBNET.ATG" +#line 1938 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } } void UnaryExpr( -#line 1910 "VBNET.ATG" +#line 1942 "VBNET.ATG" out Expression uExpr) { -#line 1912 "VBNET.ATG" +#line 1944 "VBNET.ATG" Expression expr; UnaryOperatorType uop = UnaryOperatorType.None; bool isUOp = false; @@ -4741,25 +4780,25 @@ out Expression uExpr) { if (la.kind == 19) { lexer.NextToken(); -#line 1916 "VBNET.ATG" +#line 1948 "VBNET.ATG" uop = UnaryOperatorType.Plus; isUOp = true; } else if (la.kind == 18) { lexer.NextToken(); -#line 1917 "VBNET.ATG" +#line 1949 "VBNET.ATG" uop = UnaryOperatorType.Minus; isUOp = true; } else { lexer.NextToken(); -#line 1918 "VBNET.ATG" +#line 1950 "VBNET.ATG" uop = UnaryOperatorType.Dereference; isUOp = true; } } ExponentiationExpr( -#line 1920 "VBNET.ATG" +#line 1952 "VBNET.ATG" out expr); -#line 1922 "VBNET.ATG" +#line 1954 "VBNET.ATG" if (isUOp) { uExpr = new UnaryOperatorExpression(expr, uop); } else { @@ -4769,107 +4808,107 @@ out expr); } void ExponentiationExpr( -#line 1930 "VBNET.ATG" +#line 1962 "VBNET.ATG" out Expression outExpr) { -#line 1931 "VBNET.ATG" +#line 1963 "VBNET.ATG" Expression expr; SimpleExpr( -#line 1933 "VBNET.ATG" +#line 1965 "VBNET.ATG" out outExpr); while (la.kind == 20) { lexer.NextToken(); SimpleExpr( -#line 1933 "VBNET.ATG" +#line 1965 "VBNET.ATG" out expr); -#line 1933 "VBNET.ATG" +#line 1965 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.Power, expr); } } void NormalOrReDimArgumentList( -#line 2368 "VBNET.ATG" +#line 2400 "VBNET.ATG" out List arguments, out bool canBeNormal, out bool canBeRedim) { -#line 2370 "VBNET.ATG" +#line 2402 "VBNET.ATG" arguments = new List(); canBeNormal = true; canBeRedim = !IsNamedAssign(); Expression expr = null; - if (StartOf(29)) { + if (StartOf(24)) { Argument( -#line 2375 "VBNET.ATG" +#line 2407 "VBNET.ATG" out expr); if (la.kind == 201) { lexer.NextToken(); -#line 2376 "VBNET.ATG" +#line 2408 "VBNET.ATG" EnsureIsZero(expr); canBeNormal = false; Expr( -#line 2377 "VBNET.ATG" +#line 2409 "VBNET.ATG" out expr); } } while (la.kind == 12) { lexer.NextToken(); -#line 2380 "VBNET.ATG" +#line 2412 "VBNET.ATG" if (expr == null) canBeRedim = false; -#line 2381 "VBNET.ATG" +#line 2413 "VBNET.ATG" arguments.Add(expr ?? Expression.Null); expr = null; -#line 2382 "VBNET.ATG" +#line 2414 "VBNET.ATG" canBeRedim &= !IsNamedAssign(); - if (StartOf(29)) { + if (StartOf(24)) { Argument( -#line 2383 "VBNET.ATG" +#line 2415 "VBNET.ATG" out expr); if (la.kind == 201) { lexer.NextToken(); -#line 2384 "VBNET.ATG" +#line 2416 "VBNET.ATG" EnsureIsZero(expr); canBeNormal = false; Expr( -#line 2385 "VBNET.ATG" +#line 2417 "VBNET.ATG" out expr); } } -#line 2387 "VBNET.ATG" +#line 2419 "VBNET.ATG" if (expr == null) { canBeRedim = false; expr = Expression.Null; } } -#line 2389 "VBNET.ATG" +#line 2421 "VBNET.ATG" if (expr != null) arguments.Add(expr); else canBeRedim = false; } void ArrayTypeModifiers( -#line 2496 "VBNET.ATG" +#line 2528 "VBNET.ATG" out ArrayList arrayModifiers) { -#line 2498 "VBNET.ATG" +#line 2530 "VBNET.ATG" arrayModifiers = new ArrayList(); int i = 0; while ( -#line 2501 "VBNET.ATG" +#line 2533 "VBNET.ATG" IsDims()) { Expect(25); if (la.kind == 12 || la.kind == 26) { RankList( -#line 2503 "VBNET.ATG" +#line 2535 "VBNET.ATG" out i); } -#line 2505 "VBNET.ATG" +#line 2537 "VBNET.ATG" arrayModifiers.Add(i); Expect(26); } -#line 2510 "VBNET.ATG" +#line 2542 "VBNET.ATG" if(arrayModifiers.Count == 0) { arrayModifiers = null; } @@ -4877,10 +4916,10 @@ out i); } void MemberInitializer( -#line 2338 "VBNET.ATG" +#line 2370 "VBNET.ATG" out NamedArgumentExpression memberInitializer) { -#line 2340 "VBNET.ATG" +#line 2372 "VBNET.ATG" memberInitializer = new NamedArgumentExpression(); memberInitializer.StartLocation = la.Location; Expression initExpr = null; @@ -4888,14 +4927,14 @@ out NamedArgumentExpression memberInitializer) { Expect(16); IdentifierOrKeyword( -#line 2345 "VBNET.ATG" +#line 2377 "VBNET.ATG" out name); Expect(10); Expr( -#line 2345 "VBNET.ATG" +#line 2377 "VBNET.ATG" out initExpr); -#line 2347 "VBNET.ATG" +#line 2379 "VBNET.ATG" memberInitializer.Name = name; memberInitializer.Expression = initExpr; memberInitializer.EndLocation = t.EndLocation; @@ -4903,35 +4942,35 @@ out initExpr); } void FromOrAggregateQueryOperator( -#line 2027 "VBNET.ATG" +#line 2059 "VBNET.ATG" List middleClauses) { -#line 2029 "VBNET.ATG" +#line 2061 "VBNET.ATG" QueryExpressionFromClause fromClause = null; QueryExpressionAggregateClause aggregateClause = null; if (la.kind == 113) { FromQueryOperator( -#line 2032 "VBNET.ATG" +#line 2064 "VBNET.ATG" out fromClause); -#line 2033 "VBNET.ATG" +#line 2065 "VBNET.ATG" middleClauses.Add(fromClause); } else if (la.kind == 45) { AggregateQueryOperator( -#line 2034 "VBNET.ATG" +#line 2066 "VBNET.ATG" out aggregateClause); -#line 2035 "VBNET.ATG" +#line 2067 "VBNET.ATG" middleClauses.Add(aggregateClause); - } else SynErr(264); + } else SynErr(265); } void QueryOperator( -#line 2038 "VBNET.ATG" +#line 2070 "VBNET.ATG" List middleClauses) { -#line 2040 "VBNET.ATG" +#line 2072 "VBNET.ATG" QueryExpressionJoinVBClause joinClause = null; QueryExpressionGroupVBClause groupByClause = null; QueryExpressionPartitionVBClause partitionClause = null; @@ -4941,94 +4980,94 @@ List middleClauses) { if (la.kind == 113) { FromQueryOperator( -#line 2047 "VBNET.ATG" +#line 2079 "VBNET.ATG" out fromClause); -#line 2048 "VBNET.ATG" +#line 2080 "VBNET.ATG" middleClauses.Add(fromClause); } else if (la.kind == 45) { AggregateQueryOperator( -#line 2049 "VBNET.ATG" +#line 2081 "VBNET.ATG" out aggregateClause); -#line 2050 "VBNET.ATG" +#line 2082 "VBNET.ATG" middleClauses.Add(aggregateClause); } else if (la.kind == 182) { SelectQueryOperator( -#line 2051 "VBNET.ATG" +#line 2083 "VBNET.ATG" middleClauses); } else if (la.kind == 94) { DistinctQueryOperator( -#line 2052 "VBNET.ATG" +#line 2084 "VBNET.ATG" middleClauses); } else if (la.kind == 215) { WhereQueryOperator( -#line 2053 "VBNET.ATG" +#line 2085 "VBNET.ATG" middleClauses); } else if (la.kind == 162) { OrderByQueryOperator( -#line 2054 "VBNET.ATG" +#line 2086 "VBNET.ATG" middleClauses); } else if (la.kind == 188 || la.kind == 197) { PartitionQueryOperator( -#line 2055 "VBNET.ATG" +#line 2087 "VBNET.ATG" out partitionClause); -#line 2056 "VBNET.ATG" +#line 2088 "VBNET.ATG" middleClauses.Add(partitionClause); } else if (la.kind == 134) { LetQueryOperator( -#line 2057 "VBNET.ATG" +#line 2089 "VBNET.ATG" middleClauses); } else if (la.kind == 133) { JoinQueryOperator( -#line 2058 "VBNET.ATG" +#line 2090 "VBNET.ATG" out joinClause); -#line 2059 "VBNET.ATG" +#line 2091 "VBNET.ATG" middleClauses.Add(joinClause); } else if ( -#line 2060 "VBNET.ATG" +#line 2092 "VBNET.ATG" la.kind == Tokens.Group && Peek(1).kind == Tokens.Join) { GroupJoinQueryOperator( -#line 2060 "VBNET.ATG" +#line 2092 "VBNET.ATG" out groupJoinClause); -#line 2061 "VBNET.ATG" +#line 2093 "VBNET.ATG" middleClauses.Add(groupJoinClause); } else if (la.kind == 120) { GroupByQueryOperator( -#line 2062 "VBNET.ATG" +#line 2094 "VBNET.ATG" out groupByClause); -#line 2063 "VBNET.ATG" +#line 2095 "VBNET.ATG" middleClauses.Add(groupByClause); - } else SynErr(265); + } else SynErr(266); } void FromQueryOperator( -#line 2138 "VBNET.ATG" +#line 2170 "VBNET.ATG" out QueryExpressionFromClause fromClause) { -#line 2140 "VBNET.ATG" +#line 2172 "VBNET.ATG" fromClause = new QueryExpressionFromClause(); fromClause.StartLocation = la.Location; Expect(113); CollectionRangeVariableDeclarationList( -#line 2143 "VBNET.ATG" +#line 2175 "VBNET.ATG" fromClause.Sources); -#line 2145 "VBNET.ATG" +#line 2177 "VBNET.ATG" fromClause.EndLocation = t.EndLocation; } void AggregateQueryOperator( -#line 2207 "VBNET.ATG" +#line 2239 "VBNET.ATG" out QueryExpressionAggregateClause aggregateClause) { -#line 2209 "VBNET.ATG" +#line 2241 "VBNET.ATG" aggregateClause = new QueryExpressionAggregateClause(); aggregateClause.IntoVariables = new List(); aggregateClause.StartLocation = la.Location; @@ -5036,77 +5075,77 @@ out QueryExpressionAggregateClause aggregateClause) { Expect(45); CollectionRangeVariableDeclaration( -#line 2214 "VBNET.ATG" +#line 2246 "VBNET.ATG" out source); -#line 2216 "VBNET.ATG" +#line 2248 "VBNET.ATG" aggregateClause.Source = source; while (StartOf(31)) { QueryOperator( -#line 2219 "VBNET.ATG" +#line 2251 "VBNET.ATG" aggregateClause.MiddleClauses); } Expect(130); ExpressionRangeVariableDeclarationList( -#line 2221 "VBNET.ATG" +#line 2253 "VBNET.ATG" aggregateClause.IntoVariables); -#line 2223 "VBNET.ATG" +#line 2255 "VBNET.ATG" aggregateClause.EndLocation = t.EndLocation; } void SelectQueryOperator( -#line 2149 "VBNET.ATG" +#line 2181 "VBNET.ATG" List middleClauses) { -#line 2151 "VBNET.ATG" +#line 2183 "VBNET.ATG" QueryExpressionSelectVBClause selectClause = new QueryExpressionSelectVBClause(); selectClause.StartLocation = la.Location; Expect(182); ExpressionRangeVariableDeclarationList( -#line 2154 "VBNET.ATG" +#line 2186 "VBNET.ATG" selectClause.Variables); -#line 2156 "VBNET.ATG" +#line 2188 "VBNET.ATG" selectClause.EndLocation = t.Location; middleClauses.Add(selectClause); } void DistinctQueryOperator( -#line 2161 "VBNET.ATG" +#line 2193 "VBNET.ATG" List middleClauses) { -#line 2163 "VBNET.ATG" +#line 2195 "VBNET.ATG" QueryExpressionDistinctClause distinctClause = new QueryExpressionDistinctClause(); distinctClause.StartLocation = la.Location; Expect(94); -#line 2168 "VBNET.ATG" +#line 2200 "VBNET.ATG" distinctClause.EndLocation = t.EndLocation; middleClauses.Add(distinctClause); } void WhereQueryOperator( -#line 2173 "VBNET.ATG" +#line 2205 "VBNET.ATG" List middleClauses) { -#line 2175 "VBNET.ATG" +#line 2207 "VBNET.ATG" QueryExpressionWhereClause whereClause = new QueryExpressionWhereClause(); whereClause.StartLocation = la.Location; Expression operand = null; Expect(215); Expr( -#line 2179 "VBNET.ATG" +#line 2211 "VBNET.ATG" out operand); -#line 2181 "VBNET.ATG" +#line 2213 "VBNET.ATG" whereClause.Condition = operand; whereClause.EndLocation = t.EndLocation; @@ -5115,10 +5154,10 @@ out operand); } void OrderByQueryOperator( -#line 2066 "VBNET.ATG" +#line 2098 "VBNET.ATG" List middleClauses) { -#line 2068 "VBNET.ATG" +#line 2100 "VBNET.ATG" QueryExpressionOrderClause orderClause = new QueryExpressionOrderClause(); orderClause.StartLocation = la.Location; List orderings = null; @@ -5126,10 +5165,10 @@ List middleClauses) { Expect(162); Expect(57); OrderExpressionList( -#line 2072 "VBNET.ATG" +#line 2104 "VBNET.ATG" out orderings); -#line 2074 "VBNET.ATG" +#line 2106 "VBNET.ATG" orderClause.Orderings = orderings; orderClause.EndLocation = t.EndLocation; middleClauses.Add(orderClause); @@ -5137,10 +5176,10 @@ out orderings); } void PartitionQueryOperator( -#line 2188 "VBNET.ATG" +#line 2220 "VBNET.ATG" out QueryExpressionPartitionVBClause partitionClause) { -#line 2190 "VBNET.ATG" +#line 2222 "VBNET.ATG" partitionClause = new QueryExpressionPartitionVBClause(); partitionClause.StartLocation = la.Location; Expression expr = null; @@ -5148,60 +5187,60 @@ out QueryExpressionPartitionVBClause partitionClause) { if (la.kind == 197) { lexer.NextToken(); -#line 2195 "VBNET.ATG" +#line 2227 "VBNET.ATG" partitionClause.PartitionType = QueryExpressionPartitionType.Take; if (la.kind == 216) { lexer.NextToken(); -#line 2196 "VBNET.ATG" +#line 2228 "VBNET.ATG" partitionClause.PartitionType = QueryExpressionPartitionType.TakeWhile; } } else if (la.kind == 188) { lexer.NextToken(); -#line 2197 "VBNET.ATG" +#line 2229 "VBNET.ATG" partitionClause.PartitionType = QueryExpressionPartitionType.Skip; if (la.kind == 216) { lexer.NextToken(); -#line 2198 "VBNET.ATG" +#line 2230 "VBNET.ATG" partitionClause.PartitionType = QueryExpressionPartitionType.SkipWhile; } - } else SynErr(266); + } else SynErr(267); Expr( -#line 2200 "VBNET.ATG" +#line 2232 "VBNET.ATG" out expr); -#line 2202 "VBNET.ATG" +#line 2234 "VBNET.ATG" partitionClause.Expression = expr; partitionClause.EndLocation = t.EndLocation; } void LetQueryOperator( -#line 2227 "VBNET.ATG" +#line 2259 "VBNET.ATG" List middleClauses) { -#line 2229 "VBNET.ATG" +#line 2261 "VBNET.ATG" QueryExpressionLetVBClause letClause = new QueryExpressionLetVBClause(); letClause.StartLocation = la.Location; Expect(134); ExpressionRangeVariableDeclarationList( -#line 2232 "VBNET.ATG" +#line 2264 "VBNET.ATG" letClause.Variables); -#line 2234 "VBNET.ATG" +#line 2266 "VBNET.ATG" letClause.EndLocation = t.EndLocation; middleClauses.Add(letClause); } void JoinQueryOperator( -#line 2271 "VBNET.ATG" +#line 2303 "VBNET.ATG" out QueryExpressionJoinVBClause joinClause) { -#line 2273 "VBNET.ATG" +#line 2305 "VBNET.ATG" joinClause = new QueryExpressionJoinVBClause(); joinClause.StartLocation = la.Location; CollectionRangeVariable joinVariable = null; @@ -5211,203 +5250,203 @@ out QueryExpressionJoinVBClause joinClause) { Expect(133); CollectionRangeVariableDeclaration( -#line 2280 "VBNET.ATG" +#line 2312 "VBNET.ATG" out joinVariable); -#line 2281 "VBNET.ATG" +#line 2313 "VBNET.ATG" joinClause.JoinVariable = joinVariable; if (la.kind == 133) { JoinQueryOperator( -#line 2283 "VBNET.ATG" +#line 2315 "VBNET.ATG" out subJoin); -#line 2284 "VBNET.ATG" +#line 2316 "VBNET.ATG" joinClause.SubJoin = subJoin; } Expect(157); JoinCondition( -#line 2287 "VBNET.ATG" +#line 2319 "VBNET.ATG" out condition); -#line 2288 "VBNET.ATG" +#line 2320 "VBNET.ATG" SafeAdd(joinClause, joinClause.Conditions, condition); while (la.kind == 47) { lexer.NextToken(); JoinCondition( -#line 2290 "VBNET.ATG" +#line 2322 "VBNET.ATG" out condition); -#line 2291 "VBNET.ATG" +#line 2323 "VBNET.ATG" SafeAdd(joinClause, joinClause.Conditions, condition); } -#line 2294 "VBNET.ATG" +#line 2326 "VBNET.ATG" joinClause.EndLocation = t.EndLocation; } void GroupJoinQueryOperator( -#line 2124 "VBNET.ATG" +#line 2156 "VBNET.ATG" out QueryExpressionGroupJoinVBClause groupJoinClause) { -#line 2126 "VBNET.ATG" +#line 2158 "VBNET.ATG" groupJoinClause = new QueryExpressionGroupJoinVBClause(); groupJoinClause.StartLocation = la.Location; QueryExpressionJoinVBClause joinClause = null; Expect(120); JoinQueryOperator( -#line 2130 "VBNET.ATG" +#line 2162 "VBNET.ATG" out joinClause); Expect(130); ExpressionRangeVariableDeclarationList( -#line 2131 "VBNET.ATG" +#line 2163 "VBNET.ATG" groupJoinClause.IntoVariables); -#line 2133 "VBNET.ATG" +#line 2165 "VBNET.ATG" groupJoinClause.JoinClause = joinClause; groupJoinClause.EndLocation = t.EndLocation; } void GroupByQueryOperator( -#line 2111 "VBNET.ATG" +#line 2143 "VBNET.ATG" out QueryExpressionGroupVBClause groupByClause) { -#line 2113 "VBNET.ATG" +#line 2145 "VBNET.ATG" groupByClause = new QueryExpressionGroupVBClause(); groupByClause.StartLocation = la.Location; Expect(120); ExpressionRangeVariableDeclarationList( -#line 2116 "VBNET.ATG" +#line 2148 "VBNET.ATG" groupByClause.GroupVariables); Expect(57); ExpressionRangeVariableDeclarationList( -#line 2117 "VBNET.ATG" +#line 2149 "VBNET.ATG" groupByClause.ByVariables); Expect(130); ExpressionRangeVariableDeclarationList( -#line 2118 "VBNET.ATG" +#line 2150 "VBNET.ATG" groupByClause.IntoVariables); -#line 2120 "VBNET.ATG" +#line 2152 "VBNET.ATG" groupByClause.EndLocation = t.EndLocation; } void OrderExpressionList( -#line 2080 "VBNET.ATG" +#line 2112 "VBNET.ATG" out List orderings) { -#line 2082 "VBNET.ATG" +#line 2114 "VBNET.ATG" orderings = new List(); QueryExpressionOrdering ordering = null; OrderExpression( -#line 2085 "VBNET.ATG" +#line 2117 "VBNET.ATG" out ordering); -#line 2086 "VBNET.ATG" +#line 2118 "VBNET.ATG" orderings.Add(ordering); while (la.kind == 12) { lexer.NextToken(); OrderExpression( -#line 2088 "VBNET.ATG" +#line 2120 "VBNET.ATG" out ordering); -#line 2089 "VBNET.ATG" +#line 2121 "VBNET.ATG" orderings.Add(ordering); } } void OrderExpression( -#line 2093 "VBNET.ATG" +#line 2125 "VBNET.ATG" out QueryExpressionOrdering ordering) { -#line 2095 "VBNET.ATG" +#line 2127 "VBNET.ATG" ordering = new QueryExpressionOrdering(); ordering.StartLocation = la.Location; ordering.Direction = QueryExpressionOrderingDirection.None; Expression orderExpr = null; Expr( -#line 2100 "VBNET.ATG" +#line 2132 "VBNET.ATG" out orderExpr); -#line 2102 "VBNET.ATG" +#line 2134 "VBNET.ATG" ordering.Criteria = orderExpr; if (la.kind == 51 || la.kind == 91) { if (la.kind == 51) { lexer.NextToken(); -#line 2105 "VBNET.ATG" +#line 2137 "VBNET.ATG" ordering.Direction = QueryExpressionOrderingDirection.Ascending; } else { lexer.NextToken(); -#line 2106 "VBNET.ATG" +#line 2138 "VBNET.ATG" ordering.Direction = QueryExpressionOrderingDirection.Descending; } } -#line 2108 "VBNET.ATG" +#line 2140 "VBNET.ATG" ordering.EndLocation = t.EndLocation; } void ExpressionRangeVariableDeclarationList( -#line 2239 "VBNET.ATG" +#line 2271 "VBNET.ATG" List variables) { -#line 2241 "VBNET.ATG" +#line 2273 "VBNET.ATG" ExpressionRangeVariable variable = null; ExpressionRangeVariableDeclaration( -#line 2243 "VBNET.ATG" +#line 2275 "VBNET.ATG" out variable); -#line 2244 "VBNET.ATG" +#line 2276 "VBNET.ATG" variables.Add(variable); while (la.kind == 12) { lexer.NextToken(); ExpressionRangeVariableDeclaration( -#line 2245 "VBNET.ATG" +#line 2277 "VBNET.ATG" out variable); -#line 2245 "VBNET.ATG" +#line 2277 "VBNET.ATG" variables.Add(variable); } } void CollectionRangeVariableDeclarationList( -#line 2298 "VBNET.ATG" +#line 2330 "VBNET.ATG" List rangeVariables) { -#line 2299 "VBNET.ATG" +#line 2331 "VBNET.ATG" CollectionRangeVariable variableDeclaration; CollectionRangeVariableDeclaration( -#line 2301 "VBNET.ATG" +#line 2333 "VBNET.ATG" out variableDeclaration); -#line 2302 "VBNET.ATG" +#line 2334 "VBNET.ATG" rangeVariables.Add(variableDeclaration); while (la.kind == 12) { lexer.NextToken(); CollectionRangeVariableDeclaration( -#line 2303 "VBNET.ATG" +#line 2335 "VBNET.ATG" out variableDeclaration); -#line 2303 "VBNET.ATG" +#line 2335 "VBNET.ATG" rangeVariables.Add(variableDeclaration); } } void CollectionRangeVariableDeclaration( -#line 2306 "VBNET.ATG" +#line 2338 "VBNET.ATG" out CollectionRangeVariable rangeVariable) { -#line 2308 "VBNET.ATG" +#line 2340 "VBNET.ATG" rangeVariable = new CollectionRangeVariable(); rangeVariable.StartLocation = la.Location; TypeReference typeName = null; @@ -5415,71 +5454,71 @@ out CollectionRangeVariable rangeVariable) { Identifier(); -#line 2313 "VBNET.ATG" +#line 2345 "VBNET.ATG" rangeVariable.Identifier = t.val; if (la.kind == 50) { lexer.NextToken(); TypeName( -#line 2314 "VBNET.ATG" +#line 2346 "VBNET.ATG" out typeName); -#line 2314 "VBNET.ATG" +#line 2346 "VBNET.ATG" rangeVariable.Type = typeName; } Expect(125); Expr( -#line 2315 "VBNET.ATG" +#line 2347 "VBNET.ATG" out inExpr); -#line 2317 "VBNET.ATG" +#line 2349 "VBNET.ATG" rangeVariable.Expression = inExpr; rangeVariable.EndLocation = t.EndLocation; } void ExpressionRangeVariableDeclaration( -#line 2248 "VBNET.ATG" +#line 2280 "VBNET.ATG" out ExpressionRangeVariable variable) { -#line 2250 "VBNET.ATG" +#line 2282 "VBNET.ATG" variable = new ExpressionRangeVariable(); variable.StartLocation = la.Location; Expression rhs = null; TypeReference typeName = null; if ( -#line 2256 "VBNET.ATG" +#line 2288 "VBNET.ATG" IsIdentifiedExpressionRange()) { Identifier(); -#line 2257 "VBNET.ATG" +#line 2289 "VBNET.ATG" variable.Identifier = t.val; if (la.kind == 50) { lexer.NextToken(); TypeName( -#line 2259 "VBNET.ATG" +#line 2291 "VBNET.ATG" out typeName); -#line 2260 "VBNET.ATG" +#line 2292 "VBNET.ATG" variable.Type = typeName; } Expect(10); } Expr( -#line 2264 "VBNET.ATG" +#line 2296 "VBNET.ATG" out rhs); -#line 2266 "VBNET.ATG" +#line 2298 "VBNET.ATG" variable.Expression = rhs; variable.EndLocation = t.EndLocation; } void JoinCondition( -#line 2322 "VBNET.ATG" +#line 2354 "VBNET.ATG" out QueryExpressionJoinConditionVB condition) { -#line 2324 "VBNET.ATG" +#line 2356 "VBNET.ATG" condition = new QueryExpressionJoinConditionVB(); condition.StartLocation = la.Location; @@ -5487,14 +5526,14 @@ out QueryExpressionJoinConditionVB condition) { Expression rhs = null; Expr( -#line 2330 "VBNET.ATG" +#line 2362 "VBNET.ATG" out lhs); Expect(103); Expr( -#line 2330 "VBNET.ATG" +#line 2362 "VBNET.ATG" out rhs); -#line 2332 "VBNET.ATG" +#line 2364 "VBNET.ATG" condition.LeftSide = lhs; condition.RightSide = rhs; condition.EndLocation = t.EndLocation; @@ -5502,94 +5541,94 @@ out rhs); } void Argument( -#line 2393 "VBNET.ATG" +#line 2425 "VBNET.ATG" out Expression argumentexpr) { -#line 2395 "VBNET.ATG" +#line 2427 "VBNET.ATG" Expression expr; argumentexpr = null; string name; if ( -#line 2399 "VBNET.ATG" +#line 2431 "VBNET.ATG" IsNamedAssign()) { Identifier(); -#line 2399 "VBNET.ATG" +#line 2431 "VBNET.ATG" name = t.val; Expect(11); Expect(10); Expr( -#line 2399 "VBNET.ATG" +#line 2431 "VBNET.ATG" out expr); -#line 2401 "VBNET.ATG" +#line 2433 "VBNET.ATG" argumentexpr = new NamedArgumentExpression(name, expr); - } else if (StartOf(29)) { + } else if (StartOf(24)) { Expr( -#line 2404 "VBNET.ATG" +#line 2436 "VBNET.ATG" out argumentexpr); - } else SynErr(267); + } else SynErr(268); } void QualIdentAndTypeArguments( -#line 2470 "VBNET.ATG" +#line 2502 "VBNET.ATG" out TypeReference typeref, bool canBeUnbound) { -#line 2471 "VBNET.ATG" +#line 2503 "VBNET.ATG" string name; typeref = null; Qualident( -#line 2473 "VBNET.ATG" +#line 2505 "VBNET.ATG" out name); -#line 2474 "VBNET.ATG" +#line 2506 "VBNET.ATG" typeref = new TypeReference(name); if ( -#line 2475 "VBNET.ATG" +#line 2507 "VBNET.ATG" la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of) { lexer.NextToken(); Expect(155); if ( -#line 2477 "VBNET.ATG" +#line 2509 "VBNET.ATG" canBeUnbound && (la.kind == Tokens.CloseParenthesis || la.kind == Tokens.Comma)) { -#line 2478 "VBNET.ATG" +#line 2510 "VBNET.ATG" typeref.GenericTypes.Add(NullTypeReference.Instance); while (la.kind == 12) { lexer.NextToken(); -#line 2479 "VBNET.ATG" +#line 2511 "VBNET.ATG" typeref.GenericTypes.Add(NullTypeReference.Instance); } } else if (StartOf(7)) { TypeArgumentList( -#line 2480 "VBNET.ATG" +#line 2512 "VBNET.ATG" typeref.GenericTypes); - } else SynErr(268); + } else SynErr(269); Expect(26); } } void RankList( -#line 2517 "VBNET.ATG" +#line 2549 "VBNET.ATG" out int i) { -#line 2518 "VBNET.ATG" +#line 2550 "VBNET.ATG" i = 0; while (la.kind == 12) { lexer.NextToken(); -#line 2519 "VBNET.ATG" +#line 2551 "VBNET.ATG" ++i; } } void Attribute( -#line 2558 "VBNET.ATG" +#line 2590 "VBNET.ATG" out ASTAttribute attribute) { -#line 2559 "VBNET.ATG" +#line 2591 "VBNET.ATG" string name; List positional = new List(); List named = new List(); @@ -5599,40 +5638,40 @@ out ASTAttribute attribute) { Expect(16); } Qualident( -#line 2564 "VBNET.ATG" +#line 2596 "VBNET.ATG" out name); if (la.kind == 25) { AttributeArguments( -#line 2565 "VBNET.ATG" +#line 2597 "VBNET.ATG" positional, named); } -#line 2567 "VBNET.ATG" +#line 2599 "VBNET.ATG" attribute = new ASTAttribute(name, positional, named); } void AttributeArguments( -#line 2572 "VBNET.ATG" +#line 2604 "VBNET.ATG" List positional, List named) { -#line 2574 "VBNET.ATG" +#line 2606 "VBNET.ATG" bool nameFound = false; string name = ""; Expression expr; Expect(25); if ( -#line 2580 "VBNET.ATG" +#line 2612 "VBNET.ATG" IsNotClosingParenthesis()) { if ( -#line 2582 "VBNET.ATG" +#line 2614 "VBNET.ATG" IsNamedAssign()) { -#line 2582 "VBNET.ATG" +#line 2614 "VBNET.ATG" nameFound = true; IdentifierOrKeyword( -#line 2583 "VBNET.ATG" +#line 2615 "VBNET.ATG" out name); if (la.kind == 11) { lexer.NextToken(); @@ -5640,10 +5679,10 @@ out name); Expect(10); } Expr( -#line 2585 "VBNET.ATG" +#line 2617 "VBNET.ATG" out expr); -#line 2587 "VBNET.ATG" +#line 2619 "VBNET.ATG" if (expr != null) { if (string.IsNullOrEmpty(name)) { positional.Add(expr); } else { named.Add(new NamedArgumentExpression(name, expr)); name = ""; } @@ -5652,28 +5691,28 @@ out expr); while (la.kind == 12) { lexer.NextToken(); if ( -#line 2595 "VBNET.ATG" +#line 2627 "VBNET.ATG" IsNamedAssign()) { -#line 2595 "VBNET.ATG" +#line 2627 "VBNET.ATG" nameFound = true; IdentifierOrKeyword( -#line 2596 "VBNET.ATG" +#line 2628 "VBNET.ATG" out name); if (la.kind == 11) { lexer.NextToken(); } Expect(10); - } else if (StartOf(29)) { + } else if (StartOf(24)) { -#line 2598 "VBNET.ATG" +#line 2630 "VBNET.ATG" if (nameFound) Error("no positional argument after named argument"); - } else SynErr(269); + } else SynErr(270); Expr( -#line 2599 "VBNET.ATG" +#line 2631 "VBNET.ATG" out expr); -#line 2599 "VBNET.ATG" +#line 2631 "VBNET.ATG" if (expr != null) { if(name == "") positional.Add(expr); else { named.Add(new NamedArgumentExpression(name, expr)); name = ""; } } @@ -5684,10 +5723,10 @@ out expr); } void FormalParameter( -#line 2656 "VBNET.ATG" +#line 2688 "VBNET.ATG" out ParameterDeclarationExpression p) { -#line 2658 "VBNET.ATG" +#line 2690 "VBNET.ATG" AttributeSection section; List attributes = new List(); TypeReference type = null; @@ -5698,36 +5737,36 @@ out ParameterDeclarationExpression p) { while (la.kind == 28) { AttributeSection( -#line 2667 "VBNET.ATG" +#line 2699 "VBNET.ATG" out section); -#line 2667 "VBNET.ATG" +#line 2699 "VBNET.ATG" attributes.Add(section); } while (StartOf(35)) { ParameterModifier( -#line 2668 "VBNET.ATG" +#line 2700 "VBNET.ATG" mod); } Identifier(); -#line 2669 "VBNET.ATG" +#line 2701 "VBNET.ATG" string parameterName = t.val; if ( -#line 2670 "VBNET.ATG" +#line 2702 "VBNET.ATG" IsDims()) { ArrayTypeModifiers( -#line 2670 "VBNET.ATG" +#line 2702 "VBNET.ATG" out arrayModifiers); } if (la.kind == 50) { lexer.NextToken(); TypeName( -#line 2671 "VBNET.ATG" +#line 2703 "VBNET.ATG" out type); } -#line 2673 "VBNET.ATG" +#line 2705 "VBNET.ATG" if(type != null) { if (arrayModifiers != null) { if (type.RankSpecifier != null) { @@ -5743,11 +5782,11 @@ out type); if (la.kind == 10) { lexer.NextToken(); Expr( -#line 2685 "VBNET.ATG" +#line 2717 "VBNET.ATG" out expr); } -#line 2687 "VBNET.ATG" +#line 2719 "VBNET.ATG" mod.Check(); p = new ParameterDeclarationExpression(type, parameterName, mod.Modifier, expr); p.Attributes = attributes; @@ -5755,34 +5794,34 @@ out expr); } void ParameterModifier( -#line 3369 "VBNET.ATG" +#line 3401 "VBNET.ATG" ParamModifierList m) { if (la.kind == 59) { lexer.NextToken(); -#line 3370 "VBNET.ATG" +#line 3402 "VBNET.ATG" m.Add(ParameterModifiers.In); } else if (la.kind == 56) { lexer.NextToken(); -#line 3371 "VBNET.ATG" +#line 3403 "VBNET.ATG" m.Add(ParameterModifiers.Ref); } else if (la.kind == 160) { lexer.NextToken(); -#line 3372 "VBNET.ATG" +#line 3404 "VBNET.ATG" m.Add(ParameterModifiers.Optional); } else if (la.kind == 167) { lexer.NextToken(); -#line 3373 "VBNET.ATG" +#line 3405 "VBNET.ATG" m.Add(ParameterModifiers.Params); - } else SynErr(270); + } else SynErr(271); } void Statement() { -#line 2716 "VBNET.ATG" +#line 2748 "VBNET.ATG" Statement stmt = null; Location startPos = la.Location; string label = String.Empty; @@ -5790,27 +5829,27 @@ ParamModifierList m) { if (la.kind == 1 || la.kind == 11) { } else if ( -#line 2722 "VBNET.ATG" +#line 2754 "VBNET.ATG" IsLabel()) { LabelName( -#line 2722 "VBNET.ATG" +#line 2754 "VBNET.ATG" out label); -#line 2724 "VBNET.ATG" +#line 2756 "VBNET.ATG" compilationUnit.AddChild(new LabelStatement(t.val)); Expect(11); Statement(); } else if (StartOf(36)) { EmbeddedStatement( -#line 2727 "VBNET.ATG" +#line 2759 "VBNET.ATG" out stmt); -#line 2727 "VBNET.ATG" +#line 2759 "VBNET.ATG" compilationUnit.AddChild(stmt); - } else SynErr(271); + } else SynErr(272); -#line 2730 "VBNET.ATG" +#line 2762 "VBNET.ATG" if (stmt != null) { stmt.StartLocation = startPos; stmt.EndLocation = t.Location; @@ -5819,30 +5858,30 @@ out stmt); } void LabelName( -#line 3145 "VBNET.ATG" +#line 3177 "VBNET.ATG" out string name) { -#line 3147 "VBNET.ATG" +#line 3179 "VBNET.ATG" name = String.Empty; if (StartOf(14)) { Identifier(); -#line 3149 "VBNET.ATG" +#line 3181 "VBNET.ATG" name = t.val; } else if (la.kind == 5) { lexer.NextToken(); -#line 3150 "VBNET.ATG" +#line 3182 "VBNET.ATG" name = t.val; - } else SynErr(272); + } else SynErr(273); } void EmbeddedStatement( -#line 2769 "VBNET.ATG" +#line 2801 "VBNET.ATG" out Statement statement) { -#line 2771 "VBNET.ATG" +#line 2803 "VBNET.ATG" Statement embeddedStatement = null; statement = null; Expression expr = null; @@ -5852,224 +5891,224 @@ out Statement statement) { if (la.kind == 107) { lexer.NextToken(); -#line 2777 "VBNET.ATG" +#line 2809 "VBNET.ATG" ExitType exitType = ExitType.None; switch (la.kind) { case 195: { lexer.NextToken(); -#line 2779 "VBNET.ATG" +#line 2811 "VBNET.ATG" exitType = ExitType.Sub; break; } case 114: { lexer.NextToken(); -#line 2781 "VBNET.ATG" +#line 2813 "VBNET.ATG" exitType = ExitType.Function; break; } case 171: { lexer.NextToken(); -#line 2783 "VBNET.ATG" +#line 2815 "VBNET.ATG" exitType = ExitType.Property; break; } case 95: { lexer.NextToken(); -#line 2785 "VBNET.ATG" +#line 2817 "VBNET.ATG" exitType = ExitType.Do; break; } case 111: { lexer.NextToken(); -#line 2787 "VBNET.ATG" +#line 2819 "VBNET.ATG" exitType = ExitType.For; break; } case 203: { lexer.NextToken(); -#line 2789 "VBNET.ATG" +#line 2821 "VBNET.ATG" exitType = ExitType.Try; break; } case 216: { lexer.NextToken(); -#line 2791 "VBNET.ATG" +#line 2823 "VBNET.ATG" exitType = ExitType.While; break; } case 182: { lexer.NextToken(); -#line 2793 "VBNET.ATG" +#line 2825 "VBNET.ATG" exitType = ExitType.Select; break; } - default: SynErr(273); break; + default: SynErr(274); break; } -#line 2795 "VBNET.ATG" +#line 2827 "VBNET.ATG" statement = new ExitStatement(exitType); } else if (la.kind == 203) { TryStatement( -#line 2796 "VBNET.ATG" +#line 2828 "VBNET.ATG" out statement); } else if (la.kind == 76) { lexer.NextToken(); -#line 2797 "VBNET.ATG" +#line 2829 "VBNET.ATG" ContinueType continueType = ContinueType.None; if (la.kind == 95 || la.kind == 111 || la.kind == 216) { if (la.kind == 95) { lexer.NextToken(); -#line 2797 "VBNET.ATG" +#line 2829 "VBNET.ATG" continueType = ContinueType.Do; } else if (la.kind == 111) { lexer.NextToken(); -#line 2797 "VBNET.ATG" +#line 2829 "VBNET.ATG" continueType = ContinueType.For; } else { lexer.NextToken(); -#line 2797 "VBNET.ATG" +#line 2829 "VBNET.ATG" continueType = ContinueType.While; } } -#line 2797 "VBNET.ATG" +#line 2829 "VBNET.ATG" statement = new ContinueStatement(continueType); } else if (la.kind == 200) { lexer.NextToken(); - if (StartOf(29)) { + if (StartOf(24)) { Expr( -#line 2799 "VBNET.ATG" +#line 2831 "VBNET.ATG" out expr); } -#line 2799 "VBNET.ATG" +#line 2831 "VBNET.ATG" statement = new ThrowStatement(expr); } else if (la.kind == 180) { lexer.NextToken(); - if (StartOf(29)) { + if (StartOf(24)) { Expr( -#line 2801 "VBNET.ATG" +#line 2833 "VBNET.ATG" out expr); } -#line 2801 "VBNET.ATG" +#line 2833 "VBNET.ATG" statement = new ReturnStatement(expr); } else if (la.kind == 196) { lexer.NextToken(); Expr( -#line 2803 "VBNET.ATG" +#line 2835 "VBNET.ATG" out expr); EndOfStmt(); Block( -#line 2803 "VBNET.ATG" +#line 2835 "VBNET.ATG" out embeddedStatement); Expect(100); Expect(196); -#line 2804 "VBNET.ATG" +#line 2836 "VBNET.ATG" statement = new LockStatement(expr, embeddedStatement); } else if (la.kind == 174) { lexer.NextToken(); Identifier(); -#line 2806 "VBNET.ATG" +#line 2838 "VBNET.ATG" name = t.val; if (la.kind == 25) { lexer.NextToken(); if (StartOf(37)) { ArgumentList( -#line 2807 "VBNET.ATG" +#line 2839 "VBNET.ATG" out p); } Expect(26); } -#line 2809 "VBNET.ATG" +#line 2841 "VBNET.ATG" statement = new RaiseEventStatement(name, p); } else if (la.kind == 218) { WithStatement( -#line 2812 "VBNET.ATG" +#line 2844 "VBNET.ATG" out statement); } else if (la.kind == 43) { lexer.NextToken(); -#line 2814 "VBNET.ATG" +#line 2846 "VBNET.ATG" Expression handlerExpr = null; Expr( -#line 2815 "VBNET.ATG" +#line 2847 "VBNET.ATG" out expr); Expect(12); Expr( -#line 2815 "VBNET.ATG" +#line 2847 "VBNET.ATG" out handlerExpr); -#line 2817 "VBNET.ATG" +#line 2849 "VBNET.ATG" statement = new AddHandlerStatement(expr, handlerExpr); } else if (la.kind == 178) { lexer.NextToken(); -#line 2820 "VBNET.ATG" +#line 2852 "VBNET.ATG" Expression handlerExpr = null; Expr( -#line 2821 "VBNET.ATG" +#line 2853 "VBNET.ATG" out expr); Expect(12); Expr( -#line 2821 "VBNET.ATG" +#line 2853 "VBNET.ATG" out handlerExpr); -#line 2823 "VBNET.ATG" +#line 2855 "VBNET.ATG" statement = new RemoveHandlerStatement(expr, handlerExpr); } else if (la.kind == 216) { lexer.NextToken(); Expr( -#line 2826 "VBNET.ATG" +#line 2858 "VBNET.ATG" out expr); EndOfStmt(); Block( -#line 2827 "VBNET.ATG" +#line 2859 "VBNET.ATG" out embeddedStatement); Expect(100); Expect(216); -#line 2829 "VBNET.ATG" +#line 2861 "VBNET.ATG" statement = new DoLoopStatement(expr, embeddedStatement, ConditionType.While, ConditionPosition.Start); } else if (la.kind == 95) { lexer.NextToken(); -#line 2834 "VBNET.ATG" +#line 2866 "VBNET.ATG" ConditionType conditionType = ConditionType.None; if (la.kind == 209 || la.kind == 216) { WhileOrUntil( -#line 2837 "VBNET.ATG" +#line 2869 "VBNET.ATG" out conditionType); Expr( -#line 2837 "VBNET.ATG" +#line 2869 "VBNET.ATG" out expr); EndOfStmt(); Block( -#line 2838 "VBNET.ATG" +#line 2870 "VBNET.ATG" out embeddedStatement); Expect(138); -#line 2841 "VBNET.ATG" +#line 2873 "VBNET.ATG" statement = new DoLoopStatement(expr, embeddedStatement, conditionType == ConditionType.While ? ConditionType.DoWhile : conditionType, @@ -6078,26 +6117,26 @@ out embeddedStatement); } else if (la.kind == 1 || la.kind == 11) { EndOfStmt(); Block( -#line 2848 "VBNET.ATG" +#line 2880 "VBNET.ATG" out embeddedStatement); Expect(138); if (la.kind == 209 || la.kind == 216) { WhileOrUntil( -#line 2849 "VBNET.ATG" +#line 2881 "VBNET.ATG" out conditionType); Expr( -#line 2849 "VBNET.ATG" +#line 2881 "VBNET.ATG" out expr); } -#line 2851 "VBNET.ATG" +#line 2883 "VBNET.ATG" statement = new DoLoopStatement(expr, embeddedStatement, conditionType, ConditionPosition.End); - } else SynErr(274); + } else SynErr(275); } else if (la.kind == 111) { lexer.NextToken(); -#line 2856 "VBNET.ATG" +#line 2888 "VBNET.ATG" Expression group = null; TypeReference typeReference; string typeName; @@ -6106,24 +6145,24 @@ out expr); if (la.kind == 97) { lexer.NextToken(); LoopControlVariable( -#line 2863 "VBNET.ATG" +#line 2895 "VBNET.ATG" out typeReference, out typeName); Expect(125); Expr( -#line 2864 "VBNET.ATG" +#line 2896 "VBNET.ATG" out group); EndOfStmt(); Block( -#line 2865 "VBNET.ATG" +#line 2897 "VBNET.ATG" out embeddedStatement); Expect(149); - if (StartOf(29)) { + if (StartOf(24)) { Expr( -#line 2866 "VBNET.ATG" +#line 2898 "VBNET.ATG" out expr); } -#line 2868 "VBNET.ATG" +#line 2900 "VBNET.ATG" statement = new ForeachStatement(typeReference, typeName, group, @@ -6135,7 +6174,7 @@ out expr); } else if (StartOf(38)) { -#line 2879 "VBNET.ATG" +#line 2911 "VBNET.ATG" Expression start = null; Expression end = null; Expression step = null; @@ -6144,59 +6183,59 @@ out expr); List nextExpressions = null; if ( -#line 2886 "VBNET.ATG" +#line 2918 "VBNET.ATG" IsLoopVariableDeclaration()) { LoopControlVariable( -#line 2887 "VBNET.ATG" +#line 2919 "VBNET.ATG" out typeReference, out typeName); } else { -#line 2889 "VBNET.ATG" +#line 2921 "VBNET.ATG" typeReference = null; typeName = null; SimpleExpr( -#line 2890 "VBNET.ATG" +#line 2922 "VBNET.ATG" out variableExpr); } Expect(10); Expr( -#line 2892 "VBNET.ATG" +#line 2924 "VBNET.ATG" out start); Expect(201); Expr( -#line 2892 "VBNET.ATG" +#line 2924 "VBNET.ATG" out end); if (la.kind == 190) { lexer.NextToken(); Expr( -#line 2892 "VBNET.ATG" +#line 2924 "VBNET.ATG" out step); } EndOfStmt(); Block( -#line 2893 "VBNET.ATG" +#line 2925 "VBNET.ATG" out embeddedStatement); Expect(149); - if (StartOf(29)) { + if (StartOf(24)) { Expr( -#line 2896 "VBNET.ATG" +#line 2928 "VBNET.ATG" out nextExpr); -#line 2898 "VBNET.ATG" +#line 2930 "VBNET.ATG" nextExpressions = new List(); nextExpressions.Add(nextExpr); while (la.kind == 12) { lexer.NextToken(); Expr( -#line 2901 "VBNET.ATG" +#line 2933 "VBNET.ATG" out nextExpr); -#line 2901 "VBNET.ATG" +#line 2933 "VBNET.ATG" nextExpressions.Add(nextExpr); } } -#line 2904 "VBNET.ATG" +#line 2936 "VBNET.ATG" statement = new ForNextStatement { TypeReference = typeReference, VariableName = typeName, @@ -6208,31 +6247,31 @@ out nextExpr); NextExpressions = nextExpressions }; - } else SynErr(275); + } else SynErr(276); } else if (la.kind == 105) { lexer.NextToken(); Expr( -#line 2917 "VBNET.ATG" +#line 2949 "VBNET.ATG" out expr); -#line 2917 "VBNET.ATG" +#line 2949 "VBNET.ATG" statement = new ErrorStatement(expr); } else if (la.kind == 176) { lexer.NextToken(); -#line 2919 "VBNET.ATG" +#line 2951 "VBNET.ATG" bool isPreserve = false; if (la.kind == 169) { lexer.NextToken(); -#line 2919 "VBNET.ATG" +#line 2951 "VBNET.ATG" isPreserve = true; } ReDimClause( -#line 2920 "VBNET.ATG" +#line 2952 "VBNET.ATG" out expr); -#line 2922 "VBNET.ATG" +#line 2954 "VBNET.ATG" ReDimStatement reDimStatement = new ReDimStatement(isPreserve); statement = reDimStatement; SafeAdd(reDimStatement, reDimStatement.ReDimClauses, expr as InvocationExpression); @@ -6240,48 +6279,48 @@ out expr); while (la.kind == 12) { lexer.NextToken(); ReDimClause( -#line 2926 "VBNET.ATG" +#line 2958 "VBNET.ATG" out expr); -#line 2927 "VBNET.ATG" +#line 2959 "VBNET.ATG" SafeAdd(reDimStatement, reDimStatement.ReDimClauses, expr as InvocationExpression); } } else if (la.kind == 104) { lexer.NextToken(); Expr( -#line 2931 "VBNET.ATG" +#line 2963 "VBNET.ATG" out expr); -#line 2933 "VBNET.ATG" +#line 2965 "VBNET.ATG" EraseStatement eraseStatement = new EraseStatement(); if (expr != null) { SafeAdd(eraseStatement, eraseStatement.Expressions, expr);} while (la.kind == 12) { lexer.NextToken(); Expr( -#line 2936 "VBNET.ATG" +#line 2968 "VBNET.ATG" out expr); -#line 2936 "VBNET.ATG" +#line 2968 "VBNET.ATG" if (expr != null) { SafeAdd(eraseStatement, eraseStatement.Expressions, expr); } } -#line 2937 "VBNET.ATG" +#line 2969 "VBNET.ATG" statement = eraseStatement; } else if (la.kind == 191) { lexer.NextToken(); -#line 2939 "VBNET.ATG" +#line 2971 "VBNET.ATG" statement = new StopStatement(); } else if ( -#line 2941 "VBNET.ATG" +#line 2973 "VBNET.ATG" la.kind == Tokens.If) { Expect(122); -#line 2942 "VBNET.ATG" +#line 2974 "VBNET.ATG" Location ifStartLocation = t.Location; Expr( -#line 2942 "VBNET.ATG" +#line 2974 "VBNET.ATG" out expr); if (la.kind == 199) { lexer.NextToken(); @@ -6289,46 +6328,46 @@ out expr); if (la.kind == 1 || la.kind == 11) { EndOfStmt(); Block( -#line 2945 "VBNET.ATG" +#line 2977 "VBNET.ATG" out embeddedStatement); -#line 2947 "VBNET.ATG" +#line 2979 "VBNET.ATG" IfElseStatement ifStatement = new IfElseStatement(expr, embeddedStatement); ifStatement.StartLocation = ifStartLocation; Location elseIfStart; while (la.kind == 99 || -#line 2953 "VBNET.ATG" +#line 2985 "VBNET.ATG" IsElseIf()) { if ( -#line 2953 "VBNET.ATG" +#line 2985 "VBNET.ATG" IsElseIf()) { Expect(98); -#line 2953 "VBNET.ATG" +#line 2985 "VBNET.ATG" elseIfStart = t.Location; Expect(122); } else { lexer.NextToken(); -#line 2954 "VBNET.ATG" +#line 2986 "VBNET.ATG" elseIfStart = t.Location; } -#line 2956 "VBNET.ATG" +#line 2988 "VBNET.ATG" Expression condition = null; Statement block = null; Expr( -#line 2957 "VBNET.ATG" +#line 2989 "VBNET.ATG" out condition); if (la.kind == 199) { lexer.NextToken(); } EndOfStmt(); Block( -#line 2958 "VBNET.ATG" +#line 2990 "VBNET.ATG" out block); -#line 2960 "VBNET.ATG" +#line 2992 "VBNET.ATG" ElseIfSection elseIfSection = new ElseIfSection(condition, block); elseIfSection.StartLocation = elseIfStart; elseIfSection.EndLocation = t.Location; @@ -6342,123 +6381,123 @@ out block); EndOfStmt(); } Block( -#line 2969 "VBNET.ATG" +#line 3001 "VBNET.ATG" out embeddedStatement); -#line 2971 "VBNET.ATG" +#line 3003 "VBNET.ATG" ifStatement.FalseStatement.Add(embeddedStatement); } Expect(100); Expect(122); -#line 2975 "VBNET.ATG" +#line 3007 "VBNET.ATG" ifStatement.EndLocation = t.Location; statement = ifStatement; } else if (StartOf(39)) { -#line 2980 "VBNET.ATG" +#line 3012 "VBNET.ATG" IfElseStatement ifStatement = new IfElseStatement(expr); ifStatement.StartLocation = ifStartLocation; SingleLineStatementList( -#line 2983 "VBNET.ATG" +#line 3015 "VBNET.ATG" ifStatement.TrueStatement); if (la.kind == 98) { lexer.NextToken(); if (StartOf(39)) { SingleLineStatementList( -#line 2986 "VBNET.ATG" +#line 3018 "VBNET.ATG" ifStatement.FalseStatement); } } -#line 2988 "VBNET.ATG" +#line 3020 "VBNET.ATG" ifStatement.EndLocation = t.Location; statement = ifStatement; - } else SynErr(276); + } else SynErr(277); } else if (la.kind == 182) { lexer.NextToken(); if (la.kind == 61) { lexer.NextToken(); } Expr( -#line 2991 "VBNET.ATG" +#line 3023 "VBNET.ATG" out expr); EndOfStmt(); -#line 2992 "VBNET.ATG" +#line 3024 "VBNET.ATG" List selectSections = new List(); Statement block = null; while (la.kind == 61) { -#line 2996 "VBNET.ATG" +#line 3028 "VBNET.ATG" List caseClauses = null; Location caseLocation = la.Location; lexer.NextToken(); CaseClauses( -#line 2997 "VBNET.ATG" +#line 3029 "VBNET.ATG" out caseClauses); if ( -#line 2997 "VBNET.ATG" +#line 3029 "VBNET.ATG" IsNotStatementSeparator()) { lexer.NextToken(); } EndOfStmt(); -#line 2999 "VBNET.ATG" +#line 3031 "VBNET.ATG" SwitchSection selectSection = new SwitchSection(caseClauses); selectSection.StartLocation = caseLocation; Block( -#line 3002 "VBNET.ATG" +#line 3034 "VBNET.ATG" out block); -#line 3004 "VBNET.ATG" +#line 3036 "VBNET.ATG" selectSection.Children = block.Children; selectSection.EndLocation = t.EndLocation; selectSections.Add(selectSection); } -#line 3010 "VBNET.ATG" +#line 3042 "VBNET.ATG" statement = new SwitchStatement(expr, selectSections); Expect(100); Expect(182); } else if (la.kind == 157) { -#line 3013 "VBNET.ATG" +#line 3045 "VBNET.ATG" OnErrorStatement onErrorStatement = null; OnErrorStatement( -#line 3014 "VBNET.ATG" +#line 3046 "VBNET.ATG" out onErrorStatement); -#line 3014 "VBNET.ATG" +#line 3046 "VBNET.ATG" statement = onErrorStatement; } else if (la.kind == 119) { -#line 3015 "VBNET.ATG" +#line 3047 "VBNET.ATG" GotoStatement goToStatement = null; GotoStatement( -#line 3016 "VBNET.ATG" +#line 3048 "VBNET.ATG" out goToStatement); -#line 3016 "VBNET.ATG" +#line 3048 "VBNET.ATG" statement = goToStatement; } else if (la.kind == 179) { -#line 3017 "VBNET.ATG" +#line 3049 "VBNET.ATG" ResumeStatement resumeStatement = null; ResumeStatement( -#line 3018 "VBNET.ATG" +#line 3050 "VBNET.ATG" out resumeStatement); -#line 3018 "VBNET.ATG" +#line 3050 "VBNET.ATG" statement = resumeStatement; } else if (StartOf(38)) { -#line 3021 "VBNET.ATG" +#line 3053 "VBNET.ATG" Expression val = null; AssignmentOperatorType op; @@ -6466,25 +6505,25 @@ out resumeStatement); la.kind == Tokens.Not || la.kind == Tokens.Times; SimpleExpr( -#line 3027 "VBNET.ATG" +#line 3059 "VBNET.ATG" out expr); if (StartOf(40)) { AssignmentOperator( -#line 3029 "VBNET.ATG" +#line 3061 "VBNET.ATG" out op); Expr( -#line 3029 "VBNET.ATG" +#line 3061 "VBNET.ATG" out val); -#line 3029 "VBNET.ATG" +#line 3061 "VBNET.ATG" expr = new AssignmentExpression(expr, op, val); } else if (la.kind == 1 || la.kind == 11 || la.kind == 98) { -#line 3030 "VBNET.ATG" +#line 3062 "VBNET.ATG" if (mustBeAssignment) Error("error in assignment."); - } else SynErr(277); + } else SynErr(278); -#line 3033 "VBNET.ATG" +#line 3065 "VBNET.ATG" // a field reference expression that stands alone is a // invocation expression without parantheses and arguments if(expr is MemberReferenceExpression || expr is IdentifierExpression) { @@ -6495,63 +6534,63 @@ out val); } else if (la.kind == 60) { lexer.NextToken(); SimpleExpr( -#line 3040 "VBNET.ATG" +#line 3072 "VBNET.ATG" out expr); -#line 3040 "VBNET.ATG" +#line 3072 "VBNET.ATG" statement = new ExpressionStatement(expr); } else if (la.kind == 211) { lexer.NextToken(); -#line 3042 "VBNET.ATG" +#line 3074 "VBNET.ATG" Statement block; if ( -#line 3043 "VBNET.ATG" +#line 3075 "VBNET.ATG" Peek(1).kind == Tokens.As) { -#line 3044 "VBNET.ATG" +#line 3076 "VBNET.ATG" LocalVariableDeclaration resourceAquisition = new LocalVariableDeclaration(Modifiers.None); VariableDeclarator( -#line 3045 "VBNET.ATG" +#line 3077 "VBNET.ATG" resourceAquisition.Variables); while (la.kind == 12) { lexer.NextToken(); VariableDeclarator( -#line 3047 "VBNET.ATG" +#line 3079 "VBNET.ATG" resourceAquisition.Variables); } Block( -#line 3049 "VBNET.ATG" +#line 3081 "VBNET.ATG" out block); -#line 3051 "VBNET.ATG" +#line 3083 "VBNET.ATG" statement = new UsingStatement(resourceAquisition, block); - } else if (StartOf(29)) { + } else if (StartOf(24)) { Expr( -#line 3053 "VBNET.ATG" +#line 3085 "VBNET.ATG" out expr); Block( -#line 3054 "VBNET.ATG" +#line 3086 "VBNET.ATG" out block); -#line 3055 "VBNET.ATG" +#line 3087 "VBNET.ATG" statement = new UsingStatement(new ExpressionStatement(expr), block); - } else SynErr(278); + } else SynErr(279); Expect(100); Expect(211); } else if (StartOf(41)) { LocalDeclarationStatement( -#line 3058 "VBNET.ATG" +#line 3090 "VBNET.ATG" out statement); - } else SynErr(279); + } else SynErr(280); } void LocalDeclarationStatement( -#line 2738 "VBNET.ATG" +#line 2770 "VBNET.ATG" out Statement statement) { -#line 2740 "VBNET.ATG" +#line 2772 "VBNET.ATG" ModifierList m = new ModifierList(); LocalVariableDeclaration localVariableDeclaration; bool dimfound = false; @@ -6560,22 +6599,22 @@ out Statement statement) { if (la.kind == 75) { lexer.NextToken(); -#line 2746 "VBNET.ATG" +#line 2778 "VBNET.ATG" m.Add(Modifiers.Const, t.Location); } else if (la.kind == 189) { lexer.NextToken(); -#line 2747 "VBNET.ATG" +#line 2779 "VBNET.ATG" m.Add(Modifiers.Static, t.Location); } else { lexer.NextToken(); -#line 2748 "VBNET.ATG" +#line 2780 "VBNET.ATG" dimfound = true; } } -#line 2751 "VBNET.ATG" +#line 2783 "VBNET.ATG" if(dimfound && (m.Modifier & Modifiers.Const) != 0) { Error("Dim is not allowed on constants."); } @@ -6588,135 +6627,135 @@ out Statement statement) { localVariableDeclaration.StartLocation = t.Location; VariableDeclarator( -#line 2762 "VBNET.ATG" +#line 2794 "VBNET.ATG" localVariableDeclaration.Variables); while (la.kind == 12) { lexer.NextToken(); VariableDeclarator( -#line 2763 "VBNET.ATG" +#line 2795 "VBNET.ATG" localVariableDeclaration.Variables); } -#line 2765 "VBNET.ATG" +#line 2797 "VBNET.ATG" statement = localVariableDeclaration; } void TryStatement( -#line 3259 "VBNET.ATG" +#line 3291 "VBNET.ATG" out Statement tryStatement) { -#line 3261 "VBNET.ATG" +#line 3293 "VBNET.ATG" Statement blockStmt = null, finallyStmt = null;List catchClauses = null; Expect(203); EndOfStmt(); Block( -#line 3264 "VBNET.ATG" +#line 3296 "VBNET.ATG" out blockStmt); if (la.kind == 62 || la.kind == 100 || la.kind == 110) { CatchClauses( -#line 3265 "VBNET.ATG" +#line 3297 "VBNET.ATG" out catchClauses); } if (la.kind == 110) { lexer.NextToken(); EndOfStmt(); Block( -#line 3266 "VBNET.ATG" +#line 3298 "VBNET.ATG" out finallyStmt); } Expect(100); Expect(203); -#line 3269 "VBNET.ATG" +#line 3301 "VBNET.ATG" tryStatement = new TryCatchStatement(blockStmt, catchClauses, finallyStmt); } void WithStatement( -#line 3239 "VBNET.ATG" +#line 3271 "VBNET.ATG" out Statement withStatement) { -#line 3241 "VBNET.ATG" +#line 3273 "VBNET.ATG" Statement blockStmt = null; Expression expr = null; Expect(218); -#line 3244 "VBNET.ATG" +#line 3276 "VBNET.ATG" Location start = t.Location; Expr( -#line 3245 "VBNET.ATG" +#line 3277 "VBNET.ATG" out expr); EndOfStmt(); -#line 3247 "VBNET.ATG" +#line 3279 "VBNET.ATG" withStatement = new WithStatement(expr); withStatement.StartLocation = start; Block( -#line 3250 "VBNET.ATG" +#line 3282 "VBNET.ATG" out blockStmt); -#line 3252 "VBNET.ATG" +#line 3284 "VBNET.ATG" ((WithStatement)withStatement).Body = (BlockStatement)blockStmt; Expect(100); Expect(218); -#line 3255 "VBNET.ATG" +#line 3287 "VBNET.ATG" withStatement.EndLocation = t.Location; } void WhileOrUntil( -#line 3232 "VBNET.ATG" +#line 3264 "VBNET.ATG" out ConditionType conditionType) { -#line 3233 "VBNET.ATG" +#line 3265 "VBNET.ATG" conditionType = ConditionType.None; if (la.kind == 216) { lexer.NextToken(); -#line 3234 "VBNET.ATG" +#line 3266 "VBNET.ATG" conditionType = ConditionType.While; } else if (la.kind == 209) { lexer.NextToken(); -#line 3235 "VBNET.ATG" +#line 3267 "VBNET.ATG" conditionType = ConditionType.Until; - } else SynErr(280); + } else SynErr(281); } void LoopControlVariable( -#line 3075 "VBNET.ATG" +#line 3107 "VBNET.ATG" out TypeReference type, out string name) { -#line 3076 "VBNET.ATG" +#line 3108 "VBNET.ATG" ArrayList arrayModifiers = null; type = null; Qualident( -#line 3080 "VBNET.ATG" +#line 3112 "VBNET.ATG" out name); if ( -#line 3081 "VBNET.ATG" +#line 3113 "VBNET.ATG" IsDims()) { ArrayTypeModifiers( -#line 3081 "VBNET.ATG" +#line 3113 "VBNET.ATG" out arrayModifiers); } if (la.kind == 50) { lexer.NextToken(); TypeName( -#line 3082 "VBNET.ATG" +#line 3114 "VBNET.ATG" out type); -#line 3082 "VBNET.ATG" +#line 3114 "VBNET.ATG" if (name.IndexOf('.') > 0) { Error("No type def for 'for each' member indexer allowed."); } } -#line 3084 "VBNET.ATG" +#line 3116 "VBNET.ATG" if (type != null) { if(type.RankSpecifier != null && arrayModifiers != null) { Error("array rank only allowed one time"); @@ -6728,34 +6767,34 @@ out type); } void ReDimClause( -#line 3154 "VBNET.ATG" +#line 3186 "VBNET.ATG" out Expression expr) { SimpleNonInvocationExpression( -#line 3156 "VBNET.ATG" +#line 3188 "VBNET.ATG" out expr); ReDimClauseInternal( -#line 3157 "VBNET.ATG" +#line 3189 "VBNET.ATG" ref expr); } void SingleLineStatementList( -#line 3061 "VBNET.ATG" +#line 3093 "VBNET.ATG" List list) { -#line 3062 "VBNET.ATG" +#line 3094 "VBNET.ATG" Statement embeddedStatement = null; if (la.kind == 100) { lexer.NextToken(); -#line 3064 "VBNET.ATG" +#line 3096 "VBNET.ATG" embeddedStatement = new EndStatement(); } else if (StartOf(36)) { EmbeddedStatement( -#line 3065 "VBNET.ATG" +#line 3097 "VBNET.ATG" out embeddedStatement); - } else SynErr(281); + } else SynErr(282); -#line 3066 "VBNET.ATG" +#line 3098 "VBNET.ATG" if (embeddedStatement != null) list.Add(embeddedStatement); while (la.kind == 11) { lexer.NextToken(); @@ -6765,62 +6804,62 @@ out embeddedStatement); if (la.kind == 100) { lexer.NextToken(); -#line 3068 "VBNET.ATG" +#line 3100 "VBNET.ATG" embeddedStatement = new EndStatement(); } else if (StartOf(36)) { EmbeddedStatement( -#line 3069 "VBNET.ATG" +#line 3101 "VBNET.ATG" out embeddedStatement); - } else SynErr(282); + } else SynErr(283); -#line 3070 "VBNET.ATG" +#line 3102 "VBNET.ATG" if (embeddedStatement != null) list.Add(embeddedStatement); } } void CaseClauses( -#line 3192 "VBNET.ATG" +#line 3224 "VBNET.ATG" out List caseClauses) { -#line 3194 "VBNET.ATG" +#line 3226 "VBNET.ATG" caseClauses = new List(); CaseLabel caseClause = null; CaseClause( -#line 3197 "VBNET.ATG" +#line 3229 "VBNET.ATG" out caseClause); -#line 3197 "VBNET.ATG" +#line 3229 "VBNET.ATG" if (caseClause != null) { caseClauses.Add(caseClause); } while (la.kind == 12) { lexer.NextToken(); CaseClause( -#line 3198 "VBNET.ATG" +#line 3230 "VBNET.ATG" out caseClause); -#line 3198 "VBNET.ATG" +#line 3230 "VBNET.ATG" if (caseClause != null) { caseClauses.Add(caseClause); } } } void OnErrorStatement( -#line 3095 "VBNET.ATG" +#line 3127 "VBNET.ATG" out OnErrorStatement stmt) { -#line 3097 "VBNET.ATG" +#line 3129 "VBNET.ATG" stmt = null; GotoStatement goToStatement = null; Expect(157); Expect(105); if ( -#line 3103 "VBNET.ATG" +#line 3135 "VBNET.ATG" IsNegativeLabelName()) { Expect(119); Expect(18); Expect(5); -#line 3105 "VBNET.ATG" +#line 3137 "VBNET.ATG" long intLabel = Int64.Parse(t.val); if(intLabel != 1) { Error("invalid label in on error statement."); @@ -6829,10 +6868,10 @@ IsNegativeLabelName()) { } else if (la.kind == 119) { GotoStatement( -#line 3111 "VBNET.ATG" +#line 3143 "VBNET.ATG" out goToStatement); -#line 3113 "VBNET.ATG" +#line 3145 "VBNET.ATG" string val = goToStatement.Label; // if value is numeric, make sure that is 0 @@ -6849,88 +6888,88 @@ out goToStatement); lexer.NextToken(); Expect(149); -#line 3127 "VBNET.ATG" +#line 3159 "VBNET.ATG" stmt = new OnErrorStatement(new ResumeStatement(true)); - } else SynErr(283); + } else SynErr(284); } void GotoStatement( -#line 3133 "VBNET.ATG" +#line 3165 "VBNET.ATG" out GotoStatement goToStatement) { -#line 3135 "VBNET.ATG" +#line 3167 "VBNET.ATG" string label = String.Empty; Expect(119); LabelName( -#line 3138 "VBNET.ATG" +#line 3170 "VBNET.ATG" out label); -#line 3140 "VBNET.ATG" +#line 3172 "VBNET.ATG" goToStatement = new GotoStatement(label); } void ResumeStatement( -#line 3181 "VBNET.ATG" +#line 3213 "VBNET.ATG" out ResumeStatement resumeStatement) { -#line 3183 "VBNET.ATG" +#line 3215 "VBNET.ATG" resumeStatement = null; string label = String.Empty; if ( -#line 3186 "VBNET.ATG" +#line 3218 "VBNET.ATG" IsResumeNext()) { Expect(179); Expect(149); -#line 3187 "VBNET.ATG" +#line 3219 "VBNET.ATG" resumeStatement = new ResumeStatement(true); } else if (la.kind == 179) { lexer.NextToken(); if (StartOf(42)) { LabelName( -#line 3188 "VBNET.ATG" +#line 3220 "VBNET.ATG" out label); } -#line 3188 "VBNET.ATG" +#line 3220 "VBNET.ATG" resumeStatement = new ResumeStatement(label); - } else SynErr(284); + } else SynErr(285); } void ReDimClauseInternal( -#line 3160 "VBNET.ATG" +#line 3192 "VBNET.ATG" ref Expression expr) { -#line 3161 "VBNET.ATG" +#line 3193 "VBNET.ATG" List arguments; bool canBeNormal; bool canBeRedim; string name; while (la.kind == 16 || -#line 3164 "VBNET.ATG" +#line 3196 "VBNET.ATG" la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of) { if (la.kind == 16) { lexer.NextToken(); IdentifierOrKeyword( -#line 3163 "VBNET.ATG" +#line 3195 "VBNET.ATG" out name); -#line 3163 "VBNET.ATG" +#line 3195 "VBNET.ATG" expr = new MemberReferenceExpression(expr, name); } else { InvocationExpression( -#line 3165 "VBNET.ATG" +#line 3197 "VBNET.ATG" ref expr); } } Expect(25); NormalOrReDimArgumentList( -#line 3168 "VBNET.ATG" +#line 3200 "VBNET.ATG" out arguments, out canBeNormal, out canBeRedim); Expect(26); -#line 3170 "VBNET.ATG" +#line 3202 "VBNET.ATG" expr = new InvocationExpression(expr, arguments); if (canBeRedim == false || canBeNormal && (la.kind == Tokens.Dot || la.kind == Tokens.OpenParenthesis)) { if (this.Errors.Count == 0) { @@ -6942,10 +6981,10 @@ out arguments, out canBeNormal, out canBeRedim); } void CaseClause( -#line 3202 "VBNET.ATG" +#line 3234 "VBNET.ATG" out CaseLabel caseClause) { -#line 3204 "VBNET.ATG" +#line 3236 "VBNET.ATG" Expression expr = null; Expression sexpr = null; BinaryOperatorType op = BinaryOperatorType.None; @@ -6954,7 +6993,7 @@ out CaseLabel caseClause) { if (la.kind == 98) { lexer.NextToken(); -#line 3210 "VBNET.ATG" +#line 3242 "VBNET.ATG" caseClause = new CaseLabel(); } else if (StartOf(43)) { if (la.kind == 131) { @@ -6964,76 +7003,76 @@ out CaseLabel caseClause) { case 28: { lexer.NextToken(); -#line 3214 "VBNET.ATG" +#line 3246 "VBNET.ATG" op = BinaryOperatorType.LessThan; break; } case 27: { lexer.NextToken(); -#line 3215 "VBNET.ATG" +#line 3247 "VBNET.ATG" op = BinaryOperatorType.GreaterThan; break; } case 31: { lexer.NextToken(); -#line 3216 "VBNET.ATG" +#line 3248 "VBNET.ATG" op = BinaryOperatorType.LessThanOrEqual; break; } case 30: { lexer.NextToken(); -#line 3217 "VBNET.ATG" +#line 3249 "VBNET.ATG" op = BinaryOperatorType.GreaterThanOrEqual; break; } case 10: { lexer.NextToken(); -#line 3218 "VBNET.ATG" +#line 3250 "VBNET.ATG" op = BinaryOperatorType.Equality; break; } case 29: { lexer.NextToken(); -#line 3219 "VBNET.ATG" +#line 3251 "VBNET.ATG" op = BinaryOperatorType.InEquality; break; } - default: SynErr(285); break; + default: SynErr(286); break; } Expr( -#line 3221 "VBNET.ATG" +#line 3253 "VBNET.ATG" out expr); -#line 3223 "VBNET.ATG" +#line 3255 "VBNET.ATG" caseClause = new CaseLabel(op, expr); - } else if (StartOf(29)) { + } else if (StartOf(24)) { Expr( -#line 3225 "VBNET.ATG" +#line 3257 "VBNET.ATG" out expr); if (la.kind == 201) { lexer.NextToken(); Expr( -#line 3225 "VBNET.ATG" +#line 3257 "VBNET.ATG" out sexpr); } -#line 3227 "VBNET.ATG" +#line 3259 "VBNET.ATG" caseClause = new CaseLabel(expr, sexpr); - } else SynErr(286); + } else SynErr(287); } void CatchClauses( -#line 3274 "VBNET.ATG" +#line 3306 "VBNET.ATG" out List catchClauses) { -#line 3276 "VBNET.ATG" +#line 3308 "VBNET.ATG" catchClauses = new List(); TypeReference type = null; Statement blockStmt = null; @@ -7045,27 +7084,27 @@ out List catchClauses) { if (StartOf(14)) { Identifier(); -#line 3284 "VBNET.ATG" +#line 3316 "VBNET.ATG" name = t.val; if (la.kind == 50) { lexer.NextToken(); TypeName( -#line 3284 "VBNET.ATG" +#line 3316 "VBNET.ATG" out type); } } if (la.kind == 214) { lexer.NextToken(); Expr( -#line 3285 "VBNET.ATG" +#line 3317 "VBNET.ATG" out expr); } EndOfStmt(); Block( -#line 3287 "VBNET.ATG" +#line 3319 "VBNET.ATG" out blockStmt); -#line 3288 "VBNET.ATG" +#line 3320 "VBNET.ATG" catchClauses.Add(new CatchClause(type, name, blockStmt, expr)); } } @@ -7327,48 +7366,49 @@ out blockStmt); case 242: s = "invalid StructureMemberDecl"; break; case 243: s = "invalid StructureMemberDecl"; break; case 244: s = "invalid StructureMemberDecl"; break; - case 245: s = "invalid InterfaceMemberDecl"; break; + case 245: s = "invalid StructureMemberDecl"; break; case 246: s = "invalid InterfaceMemberDecl"; break; - case 247: s = "invalid Expr"; break; - case 248: s = "invalid Charset"; break; - case 249: s = "invalid IdentifierForFieldDeclaration"; break; - case 250: s = "invalid VariableDeclaratorPartAfterIdentifier"; break; - case 251: s = "invalid AccessorDecls"; break; - case 252: s = "invalid EventAccessorDeclaration"; break; - case 253: s = "invalid OverloadableOperator"; break; - case 254: s = "invalid VariableInitializer"; break; - case 255: s = "invalid EventMemberSpecifier"; break; - case 256: s = "invalid AssignmentOperator"; break; - case 257: s = "invalid SimpleNonInvocationExpression"; break; + case 247: s = "invalid InterfaceMemberDecl"; break; + case 248: s = "invalid Expr"; break; + case 249: s = "invalid Charset"; break; + case 250: s = "invalid IdentifierForFieldDeclaration"; break; + case 251: s = "invalid VariableDeclaratorPartAfterIdentifier"; break; + case 252: s = "invalid VariableInitializer"; break; + case 253: s = "invalid AccessorDecls"; break; + case 254: s = "invalid EventAccessorDeclaration"; break; + case 255: s = "invalid OverloadableOperator"; break; + case 256: s = "invalid EventMemberSpecifier"; break; + case 257: s = "invalid AssignmentOperator"; break; case 258: s = "invalid SimpleNonInvocationExpression"; break; case 259: s = "invalid SimpleNonInvocationExpression"; break; case 260: s = "invalid SimpleNonInvocationExpression"; break; - case 261: s = "invalid PrimitiveTypeName"; break; - case 262: s = "invalid CastTarget"; break; - case 263: s = "invalid ComparisonExpr"; break; - case 264: s = "invalid FromOrAggregateQueryOperator"; break; - case 265: s = "invalid QueryOperator"; break; - case 266: s = "invalid PartitionQueryOperator"; break; - case 267: s = "invalid Argument"; break; - case 268: s = "invalid QualIdentAndTypeArguments"; break; - case 269: s = "invalid AttributeArguments"; break; - case 270: s = "invalid ParameterModifier"; break; - case 271: s = "invalid Statement"; break; - case 272: s = "invalid LabelName"; break; - case 273: s = "invalid EmbeddedStatement"; break; + case 261: s = "invalid SimpleNonInvocationExpression"; break; + case 262: s = "invalid PrimitiveTypeName"; break; + case 263: s = "invalid CastTarget"; break; + case 264: s = "invalid ComparisonExpr"; break; + case 265: s = "invalid FromOrAggregateQueryOperator"; break; + case 266: s = "invalid QueryOperator"; break; + case 267: s = "invalid PartitionQueryOperator"; break; + case 268: s = "invalid Argument"; break; + case 269: s = "invalid QualIdentAndTypeArguments"; break; + case 270: s = "invalid AttributeArguments"; break; + case 271: s = "invalid ParameterModifier"; break; + case 272: s = "invalid Statement"; break; + case 273: s = "invalid LabelName"; break; case 274: s = "invalid EmbeddedStatement"; break; case 275: s = "invalid EmbeddedStatement"; break; case 276: s = "invalid EmbeddedStatement"; break; case 277: s = "invalid EmbeddedStatement"; break; case 278: s = "invalid EmbeddedStatement"; break; case 279: s = "invalid EmbeddedStatement"; break; - case 280: s = "invalid WhileOrUntil"; break; - case 281: s = "invalid SingleLineStatementList"; break; + case 280: s = "invalid EmbeddedStatement"; break; + case 281: s = "invalid WhileOrUntil"; break; case 282: s = "invalid SingleLineStatementList"; break; - case 283: s = "invalid OnErrorStatement"; break; - case 284: s = "invalid ResumeStatement"; break; - case 285: s = "invalid CaseClause"; break; + case 283: s = "invalid SingleLineStatementList"; break; + case 284: s = "invalid OnErrorStatement"; break; + case 285: s = "invalid ResumeStatement"; break; case 286: s = "invalid CaseClause"; break; + case 287: s = "invalid CaseClause"; break; default: s = "error " + errorNumber; break; } @@ -7405,12 +7445,12 @@ out blockStmt); {x,x,T,T, T,T,T,T, T,T,x,x, x,x,x,x, T,x,T,T, x,x,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,x,x, x,T,x,T, T,T,T,T, x,T,T,x, x,x,x,T, T,T,T,T, T,T,T,x, T,T,T,x, x,T,T,T, T,T,T,T, T,T,T,T, x,x,x,T, x,T,T,x, T,x,x,x, x,x,x,T, x,x,x,x, T,T,x,x, x,T,x,x, T,T,x,x, T,x,T,x, x,x,T,x, T,x,T,x, x,T,x,x, x,T,x,T, x,x,x,x, T,T,x,x, T,x,T,T, x,x,T,x, T,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,T,T, T,x,x,x, x,T,x,x, x,T,T,x, x,x,T,x, T,T,T,T, T,T,T,x, x,x,x,T, x,x,x,x, x,x,x,x}, {x,T,T,T, T,T,T,T, T,T,x,T, 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,T, T,T,x,x, x,T,x,T, T,T,T,T, x,T,T,x, T,x,x,T, T,T,T,T, T,T,T,x, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, x,x,x,T, T,T,T,T, T,x,x,x, x,x,x,T, T,T,x,T, T,T,x,T, x,T,x,x, T,T,x,T, T,x,T,x, x,x,T,x, T,x,T,x, x,T,x,x, x,T,x,T, x,x,x,x, T,T,x,x, T,x,x,T, x,x,T,x, T,T,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,T,x, T,x,T,T, T,T,T,x, x,x,T,T, T,T,x,T, x,T,x,x, T,T,T,x, T,x,T,T, T,T,T,T, T,T,T,T, x,x,x,T, T,x,T,x, x,x,x,x}, {x,T,T,T, T,T,T,T, T,T,T,T, T,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,T, T,T,x,x, x,T,T,T, T,T,T,T, x,T,T,x, T,x,x,T, T,T,T,T, T,T,T,x, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, x,x,x,T, T,T,T,T, T,x,T,x, T,x,x,T, T,T,x,T, T,T,x,T, x,T,x,x, T,T,x,T, T,x,T,x, x,x,T,x, T,x,T,x, x,T,x,x, x,T,x,T, x,x,x,x, T,T,x,x, T,x,x,T, x,x,T,x, T,T,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,T,x, T,x,T,T, T,T,T,x, x,x,T,T, T,T,x,T, x,T,x,x, T,T,T,x, T,x,T,T, T,T,T,T, T,T,T,T, x,x,x,T, T,x,T,x, x,x,x,x}, + {x,x,T,T, T,T,T,T, T,T,x,x, x,x,x,x, T,x,T,T, x,x,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,x,x, x,T,x,T, T,T,T,T, x,T,T,x, x,x,x,T, T,T,T,T, T,T,T,x, T,T,T,x, x,T,T,T, T,T,T,T, T,T,T,T, x,x,x,T, x,T,T,x, T,x,x,x, x,x,x,T, x,x,x,x, T,T,x,x, x,T,T,x, T,T,x,x, T,x,T,x, x,x,T,x, T,x,T,x, x,T,x,x, x,T,x,T, x,x,x,x, T,T,x,x, T,x,T,T, x,x,T,x, T,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,T,T, T,x,x,x, x,T,x,x, x,T,T,x, x,x,T,x, T,T,T,T, T,T,T,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,x, x,x,x,x, x,x,x,x, x,x,x,x, T,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,T,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,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x}, {x,x,x,x, 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,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,T,x, T,T,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,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, 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,T,x, T,T,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, 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, T,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,T,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,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x}, {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, 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,T,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,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,x,x, x,x,x,x, T,x,T,T, x,x,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,x,x, x,T,x,T, T,T,T,T, x,T,T,x, x,x,x,T, T,T,T,T, T,T,T,x, T,T,T,x, x,T,T,T, T,T,T,T, T,T,T,T, x,x,x,T, x,T,T,x, T,x,x,x, x,x,x,T, x,x,x,x, T,T,x,x, x,T,T,x, T,T,x,x, T,x,T,x, x,x,T,x, T,x,T,x, x,T,x,x, x,T,x,T, x,x,x,x, T,T,x,x, T,x,T,T, x,x,T,x, T,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,T,T, T,x,x,x, x,T,x,x, x,T,T,x, x,x,T,x, T,T,T,T, T,T,T,x, x,x,x,T, x,x,x,x, x,x,x,x}, {x,x,T,T, T,T,T,T, T,T,x,x, x,x,x,x, T,x,T,T, x,x,T,T, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,x,x, x,T,x,T, T,T,T,T, x,T,T,x, x,x,x,T, T,T,T,T, T,T,T,x, T,T,T,x, x,T,T,T, T,T,T,T, T,T,T,T, x,x,x,T, x,T,T,x, T,x,x,x, x,x,x,T, x,x,x,x, T,T,x,x, x,T,T,x, T,T,x,x, T,x,T,x, x,x,T,x, T,x,T,x, x,T,x,x, x,T,x,T, x,x,x,x, T,T,x,x, T,x,T,T, x,x,T,x, T,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,T,T, T,x,x,x, x,T,x,x, x,T,T,x, x,x,T,x, T,T,T,T, T,T,T,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,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,T,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, T,x,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,T,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, 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,T, x,x,x,x, x,x,x,x}, {x,x,T,T, T,T,T,T, T,T,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,x,x, x,T,x,T, T,T,T,T, x,T,T,x, x,x,x,T, T,T,T,T, T,T,T,x, T,T,T,x, x,T,T,T, T,T,T,T, T,T,T,T, x,x,x,T, x,T,T,x, T,x,x,x, x,x,x,T, x,x,x,x, T,T,x,x, x,T,x,x, T,T,x,x, T,x,T,x, x,x,T,x, T,x,T,x, x,T,x,x, x,T,x,T, x,x,x,x, T,T,x,x, T,x,x,T, x,x,T,x, T,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,T,T, T,x,x,x, x,T,x,x, x,T,T,x, x,x,T,x, T,T,T,T, T,T,T,x, x,x,x,T, x,x,x,x, x,x,x,x}, diff --git a/src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG b/src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG index 5b263de9ae..6947aa5b23 100644 --- a/src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG +++ b/src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG @@ -890,7 +890,16 @@ StructureMemberDecl attributes> Identifier (. name = t.val; .) TypeParameterList [ "(" [ FormalParameterList

] ")" ] - ["As" { AttributeSection } TypeName ] + ["As" { + AttributeSection + (. + if (returnTypeAttributeSection != null) { + returnTypeAttributeSection.AttributeTarget = "return"; + attributes.Add(returnTypeAttributeSection); + } + .) + } + TypeName ] (. if(type == null) { type = new TypeReference("System.Object", true); @@ -918,10 +927,7 @@ StructureMemberDecl attributes> Templates = templates, InterfaceImplementations = implementsClause }; - if (returnTypeAttributeSection != null) { - returnTypeAttributeSection.AttributeTarget = "return"; - methodDeclaration.Attributes.Add(returnTypeAttributeSection); - } + compilationUnit.AddChild(methodDeclaration); .) | @@ -936,10 +942,6 @@ StructureMemberDecl attributes> HandlesClause = handlesClause, InterfaceImplementations = implementsClause }; - if (returnTypeAttributeSection != null) { - returnTypeAttributeSection.AttributeTarget = "return"; - methodDeclaration.Attributes.Add(returnTypeAttributeSection); - } compilationUnit.AddChild(methodDeclaration); @@ -1064,20 +1066,45 @@ StructureMemberDecl attributes> m.Check(Modifiers.VBProperties); Location startPos = t.Location; List implementsClause = null; + AttributeSection returnTypeAttributeSection = null; + Expression initializer = null; .) Identifier (. string propertyName = t.val; .) [ "(" [ FormalParameterList

] ")" ] - [ "As" TypeName ] + [ + "As" { + AttributeSection + (. + if (returnTypeAttributeSection != null) { + returnTypeAttributeSection.AttributeTarget = "return"; + attributes.Add(returnTypeAttributeSection); + } + .) + } + ( + IF (IsNewExpression()) ObjectCreateExpression + (. + if (initializer is ObjectCreateExpression) { + type = ((ObjectCreateExpression)initializer).CreateType.Clone(); + } else { + type = ((ArrayCreateExpression)initializer).CreateType.Clone(); + } + .) + | + TypeName + ) + ] (. if(type == null) { type = new TypeReference("System.Object", true); } .) + [ "=" VariableInitializer ] [ ImplementsClause ] EndOfStmt ( /* abstract properties without a body */ - IF(IsMustOverride(m)) + IF(IsMustOverride(m) || IsAutomaticProperty()) (. PropertyDeclaration pDecl = new PropertyDeclaration(propertyName, type, m.Modifier, attributes); pDecl.StartLocation = m.GetDeclarationLocation(startPos); @@ -1085,6 +1112,8 @@ StructureMemberDecl attributes> pDecl.TypeReference = type; pDecl.InterfaceImplementations = implementsClause; pDecl.Parameters = p; + if (initializer != null) + pDecl.Initializer = initializer; compilationUnit.AddChild(pDecl); .) | @@ -1105,7 +1134,7 @@ StructureMemberDecl attributes> (. pDecl.GetRegion = getRegion; pDecl.SetRegion = setRegion; - pDecl.BodyEnd = t.EndLocation; + pDecl.BodyEnd = t.Location; // t = EndOfStmt; not "Property" compilationUnit.AddChild(pDecl); .) ) @@ -1181,7 +1210,6 @@ StructureMemberDecl attributes> OverloadableOperatorType operatorType; AttributeSection section; List parameters = new List(); - List returnTypeAttributes = new List(); .) OverloadableOperator "(" [ "ByVal" ] Identifier (. operandName = t.val; .) @@ -1196,7 +1224,12 @@ StructureMemberDecl attributes> } ")" (. Location endPos = t.EndLocation; .) - [ "As" { AttributeSection (. returnTypeAttributes.Add(section); .) } TypeName (. endPos = t.EndLocation; .) ] + [ "As" { AttributeSection + (. if (section != null) { + section.AttributeTarget = "return"; + attributes.Add(section); + } .) + } TypeName (. endPos = t.EndLocation; .) ] EOL Block "End" "Operator" EndOfStmt (. @@ -1207,7 +1240,6 @@ StructureMemberDecl attributes> TypeReference = returnType, OverloadableOperator = operatorType, ConversionType = opConversionType, - ReturnTypeAttributes = returnTypeAttributes, Body = (BlockStatement)stmt, StartLocation = m.GetDeclarationLocation(startPos), EndLocation = endPos diff --git a/src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNetParser.cs b/src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNetParser.cs index 9625231a19..139fa09550 100644 --- a/src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNetParser.cs +++ b/src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNetParser.cs @@ -5,12 +5,14 @@ // $Revision$ // -using ICSharpCode.NRefactory.Visitors; using System; using System.Collections.Generic; using System.Diagnostics; +using System.Linq; using System.Text; + using ICSharpCode.NRefactory.Ast; +using ICSharpCode.NRefactory.Visitors; namespace ICSharpCode.NRefactory.Parser.VB { @@ -173,6 +175,10 @@ namespace ICSharpCode.NRefactory.Parser.VB bool IsObjectCreation() { return la.kind == Tokens.As && Peek(1).kind == Tokens.New; } + + bool IsNewExpression() { + return la.kind == Tokens.New; + } /* True, if "<" is followed by the ident "assembly" or "module" @@ -256,15 +262,52 @@ namespace ICSharpCode.NRefactory.Parser.VB int peek = Peek(1).kind; return la.kind == Tokens.Resume && peek == Tokens.Next; } - - /* - True, if ident/literal integer is followed by ":" - */ + + ///

+ /// Returns True, if ident/literal integer is followed by ":" + /// bool IsLabel() { return (la.kind == Tokens.Identifier || la.kind == Tokens.LiteralInteger) && Peek(1).kind == Tokens.Colon; } + + /// + /// Returns true if a property declaration is an automatic property. + /// + bool IsAutomaticProperty() + { + lexer.StartPeek(); + Token tn = la; + int braceCount = 0; + + // look for attributes + while (tn.kind == Tokens.LessThan) { + while (braceCount > 0 || tn.kind != Tokens.GreaterThan) { + tn = lexer.Peek(); + if (tn.kind == Tokens.OpenParenthesis) + braceCount++; + if (tn.kind == Tokens.CloseParenthesis) + braceCount--; + } + Debug.Assert(tn.kind == Tokens.GreaterThan); + tn = lexer.Peek(); + } + + // look for modifiers + var allowedTokens = new[] { + Tokens.Public, Tokens.Protected, + Tokens.Friend, Tokens.Private + }; + + while (allowedTokens.Contains(tn.kind)) + tn = lexer.Peek(); + + if (tn.Kind != Tokens.Get && tn.Kind != Tokens.Set) + return true; + + return false; + } bool IsNotStatementSeparator() { diff --git a/src/Libraries/NRefactory/Project/Src/Visitors/AbstractASTVisitor.cs b/src/Libraries/NRefactory/Project/Src/Visitors/AbstractASTVisitor.cs index e7c1240545..37327f06ed 100644 --- a/src/Libraries/NRefactory/Project/Src/Visitors/AbstractASTVisitor.cs +++ b/src/Libraries/NRefactory/Project/Src/Visitors/AbstractASTVisitor.cs @@ -704,7 +704,6 @@ namespace ICSharpCode.NRefactory.Visitors { Debug.Assert((operatorDeclaration.TypeReference != null)); Debug.Assert((operatorDeclaration.Body != null)); Debug.Assert((operatorDeclaration.Templates != null)); - Debug.Assert((operatorDeclaration.ReturnTypeAttributes != null)); foreach (AttributeSection o in operatorDeclaration.Attributes) { Debug.Assert(o != null); o.AcceptVisitor(this, data); @@ -723,10 +722,6 @@ namespace ICSharpCode.NRefactory.Visitors { Debug.Assert(o != null); o.AcceptVisitor(this, data); } - foreach (AttributeSection o in operatorDeclaration.ReturnTypeAttributes) { - Debug.Assert(o != null); - o.AcceptVisitor(this, data); - } return null; } @@ -779,6 +774,7 @@ namespace ICSharpCode.NRefactory.Visitors { Debug.Assert((propertyDeclaration.TypeReference != null)); Debug.Assert((propertyDeclaration.GetRegion != null)); Debug.Assert((propertyDeclaration.SetRegion != null)); + Debug.Assert((propertyDeclaration.Initializer != null)); foreach (AttributeSection o in propertyDeclaration.Attributes) { Debug.Assert(o != null); o.AcceptVisitor(this, data); @@ -793,7 +789,8 @@ namespace ICSharpCode.NRefactory.Visitors { } propertyDeclaration.TypeReference.AcceptVisitor(this, data); propertyDeclaration.GetRegion.AcceptVisitor(this, data); - return propertyDeclaration.SetRegion.AcceptVisitor(this, data); + propertyDeclaration.SetRegion.AcceptVisitor(this, data); + return propertyDeclaration.Initializer.AcceptVisitor(this, data); } public virtual object VisitPropertyGetRegion(PropertyGetRegion propertyGetRegion, object data) { diff --git a/src/Libraries/NRefactory/Project/Src/Visitors/AbstractAstTransformer.cs b/src/Libraries/NRefactory/Project/Src/Visitors/AbstractAstTransformer.cs index 4ab28d2564..c799f9028a 100644 --- a/src/Libraries/NRefactory/Project/Src/Visitors/AbstractAstTransformer.cs +++ b/src/Libraries/NRefactory/Project/Src/Visitors/AbstractAstTransformer.cs @@ -1269,7 +1269,6 @@ namespace ICSharpCode.NRefactory.Visitors { Debug.Assert((operatorDeclaration.TypeReference != null)); Debug.Assert((operatorDeclaration.Body != null)); Debug.Assert((operatorDeclaration.Templates != null)); - Debug.Assert((operatorDeclaration.ReturnTypeAttributes != null)); for (int i = 0; i < operatorDeclaration.Attributes.Count; i++) { AttributeSection o = operatorDeclaration.Attributes[i]; Debug.Assert(o != null); @@ -1320,17 +1319,6 @@ namespace ICSharpCode.NRefactory.Visitors { else operatorDeclaration.Templates[i] = o; } - for (int i = 0; i < operatorDeclaration.ReturnTypeAttributes.Count; i++) { - AttributeSection o = operatorDeclaration.ReturnTypeAttributes[i]; - Debug.Assert(o != null); - nodeStack.Push(o); - o.AcceptVisitor(this, data); - o = (AttributeSection)nodeStack.Pop(); - if (o == null) - operatorDeclaration.ReturnTypeAttributes.RemoveAt(i--); - else - operatorDeclaration.ReturnTypeAttributes[i] = o; - } return null; } @@ -1407,6 +1395,7 @@ namespace ICSharpCode.NRefactory.Visitors { Debug.Assert((propertyDeclaration.TypeReference != null)); Debug.Assert((propertyDeclaration.GetRegion != null)); Debug.Assert((propertyDeclaration.SetRegion != null)); + Debug.Assert((propertyDeclaration.Initializer != null)); for (int i = 0; i < propertyDeclaration.Attributes.Count; i++) { AttributeSection o = propertyDeclaration.Attributes[i]; Debug.Assert(o != null); @@ -1449,6 +1438,9 @@ namespace ICSharpCode.NRefactory.Visitors { nodeStack.Push(propertyDeclaration.SetRegion); propertyDeclaration.SetRegion.AcceptVisitor(this, data); propertyDeclaration.SetRegion = ((PropertySetRegion)(nodeStack.Pop())); + nodeStack.Push(propertyDeclaration.Initializer); + propertyDeclaration.Initializer.AcceptVisitor(this, data); + propertyDeclaration.Initializer = ((Expression)(nodeStack.Pop())); return null; } diff --git a/src/Libraries/NRefactory/Test/Parser/TypeLevel/PropertyDeclarationTests.cs b/src/Libraries/NRefactory/Test/Parser/TypeLevel/PropertyDeclarationTests.cs index 4d8d07786a..afd089fa92 100644 --- a/src/Libraries/NRefactory/Test/Parser/TypeLevel/PropertyDeclarationTests.cs +++ b/src/Libraries/NRefactory/Test/Parser/TypeLevel/PropertyDeclarationTests.cs @@ -120,19 +120,89 @@ namespace ICSharpCode.NRefactory.Tests.Ast [Test] public void VBNetSimpleGetPropertyDeclarationTest() { - PropertyDeclaration pd = ParseUtilVBNet.ParseTypeMember("Property MyProperty \nGet\nEnd Get\nEnd Property"); + PropertyDeclaration pd = ParseUtilVBNet.ParseTypeMember("ReadOnly Property MyProperty \nGet\nEnd Get\nEnd Property"); Assert.AreEqual("MyProperty", pd.Name); + Assert.AreEqual("System.Object", pd.TypeReference.Type); Assert.IsTrue(pd.HasGetRegion); Assert.IsFalse(pd.HasSetRegion); + Assert.IsTrue((pd.Modifier & Modifiers.ReadOnly) == Modifiers.ReadOnly); } [Test] public void VBNetSimpleSetPropertyDeclarationTest() { - PropertyDeclaration pd = ParseUtilVBNet.ParseTypeMember("Property MyProperty \n Set\nEnd Set\nEnd Property "); + PropertyDeclaration pd = ParseUtilVBNet.ParseTypeMember("WriteOnly Property MyProperty \n Set\nEnd Set\nEnd Property "); Assert.AreEqual("MyProperty", pd.Name); + Assert.AreEqual("System.Object", pd.TypeReference.Type); Assert.IsFalse(pd.HasGetRegion); Assert.IsTrue(pd.HasSetRegion); + Assert.IsTrue((pd.Modifier & Modifiers.WriteOnly) == Modifiers.WriteOnly); + } + + [Test] + public void VBNetAutoPropertyTest() + { + PropertyDeclaration pd = ParseUtilVBNet.ParseTypeMember("Property MyProperty"); + Assert.AreEqual("MyProperty", pd.Name); + Assert.AreEqual("System.Object", pd.TypeReference.Type); + Assert.IsTrue(pd.HasGetRegion); + Assert.IsTrue(pd.HasSetRegion); + Assert.AreEqual(pd.Initializer, Expression.Null); + } + + [Test] + public void VBNetReadOnlyAutoPropertyTest() + { + PropertyDeclaration pd = ParseUtilVBNet.ParseTypeMember("ReadOnly Property MyProperty"); + Assert.AreEqual("MyProperty", pd.Name); + Assert.AreEqual("System.Object", pd.TypeReference.Type); + Assert.IsTrue(pd.HasGetRegion); + Assert.IsFalse(pd.HasSetRegion); + Assert.AreEqual(pd.Initializer, Expression.Null); + } + + [Test] + public void VBNetWriteOnlyAutoPropertyTest() + { + PropertyDeclaration pd = ParseUtilVBNet.ParseTypeMember("WriteOnly Property MyProperty"); + Assert.AreEqual("MyProperty", pd.Name); + Assert.AreEqual("System.Object", pd.TypeReference.Type); + Assert.IsFalse(pd.HasGetRegion); + Assert.IsTrue(pd.HasSetRegion); + Assert.AreEqual(pd.Initializer, Expression.Null); + } + + [Test] + public void VBNetSimpleInitializerAutoPropertyTest() + { + PropertyDeclaration pd = ParseUtilVBNet.ParseTypeMember("Property MyProperty = 5"); + Assert.AreEqual("MyProperty", pd.Name); + Assert.AreEqual("System.Object", pd.TypeReference.Type); + Assert.IsTrue(pd.HasGetRegion); + Assert.IsTrue(pd.HasSetRegion); + Assert.AreEqual(pd.Initializer.ToString(), new PrimitiveExpression(5).ToString()); + } + + [Test] + public void VBNetSimpleInitializerAutoPropertyWithTypeTest() + { + PropertyDeclaration pd = ParseUtilVBNet.ParseTypeMember("Property MyProperty As Integer = 5"); + Assert.AreEqual("MyProperty", pd.Name); + Assert.AreEqual("System.Int32", pd.TypeReference.Type); + Assert.IsTrue(pd.HasGetRegion); + Assert.IsTrue(pd.HasSetRegion); + Assert.AreEqual(pd.Initializer.ToString(), new PrimitiveExpression(5).ToString()); + } + + [Test] + public void VBNetSimpleObjectInitializerAutoPropertyTest() + { + PropertyDeclaration pd = ParseUtilVBNet.ParseTypeMember("Property MyProperty As New List"); + Assert.AreEqual("MyProperty", pd.Name); + Assert.AreEqual("List", pd.TypeReference.Type); + Assert.IsTrue(pd.HasGetRegion); + Assert.IsTrue(pd.HasSetRegion); + Assert.AreEqual(pd.Initializer.ToString(), new ObjectCreateExpression(new TypeReference("List"), null).ToString()); } #endregion }