diff --git a/src/Libraries/NRefactory/NRefactory.sln b/src/Libraries/NRefactory/NRefactory.sln index 30513b2045..3c0509a5cd 100644 --- a/src/Libraries/NRefactory/NRefactory.sln +++ b/src/Libraries/NRefactory/NRefactory.sln @@ -1,7 +1,7 @@  -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -# SharpDevelop 4.0.0.5490 +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +# SharpDevelop 4.0.0.5705 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NRefactory", "Project\NRefactory.csproj", "{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NRefactoryTests", "Test\NRefactoryTests.csproj", "{870115DD-960A-4406-A6B9-600BCDC36A03}" @@ -10,10 +10,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NRefactoryASTGenerator", "N EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NRefactoryDemo", "..\..\..\samples\NRefactoryDemo\NRefactoryDemo.csproj", "{63199047-9D5D-474C-B3CC-62ABBB071B67}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VBParserExperiment", "Project\Src\Parser\VBNet\Experimental\Test\VBParserExperiment.csproj", "{A21BF46E-27BC-4DCA-AB11-462BE5B0B028}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU + Debug|x86 = Debug|x86 + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Debug|Any CPU.ActiveCfg = Debug|Any CPU @@ -32,6 +36,14 @@ Global {63199047-9D5D-474C-B3CC-62ABBB071B67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {63199047-9D5D-474C-B3CC-62ABBB071B67}.Release|Any CPU.Build.0 = Release|Any CPU {63199047-9D5D-474C-B3CC-62ABBB071B67}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A21BF46E-27BC-4DCA-AB11-462BE5B0B028}.Debug|Any CPU.Build.0 = Debug|x86 + {A21BF46E-27BC-4DCA-AB11-462BE5B0B028}.Debug|Any CPU.ActiveCfg = Debug|x86 + {A21BF46E-27BC-4DCA-AB11-462BE5B0B028}.Debug|x86.Build.0 = Debug|x86 + {A21BF46E-27BC-4DCA-AB11-462BE5B0B028}.Debug|x86.ActiveCfg = Debug|x86 + {A21BF46E-27BC-4DCA-AB11-462BE5B0B028}.Release|Any CPU.Build.0 = Release|x86 + {A21BF46E-27BC-4DCA-AB11-462BE5B0B028}.Release|Any CPU.ActiveCfg = Release|x86 + {A21BF46E-27BC-4DCA-AB11-462BE5B0B028}.Release|x86.Build.0 = Release|x86 + {A21BF46E-27BC-4DCA-AB11-462BE5B0B028}.Release|x86.ActiveCfg = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Libraries/NRefactory/NRefactoryASTGenerator/AST/Expressions.cs b/src/Libraries/NRefactory/NRefactoryASTGenerator/AST/Expressions.cs index c6ec7a1275..89e3ecb4d0 100644 --- a/src/Libraries/NRefactory/NRefactoryASTGenerator/AST/Expressions.cs +++ b/src/Libraries/NRefactory/NRefactoryASTGenerator/AST/Expressions.cs @@ -40,6 +40,15 @@ namespace NRefactoryASTGenerator.Ast public NamedArgumentExpression(string name, Expression expression) {} } + class MemberInitializerExpression : Expression { + string name; + bool isKey; + Expression expression; + + public MemberInitializerExpression() { } + public MemberInitializerExpression(string name, Expression expression) {} + } + [IncludeBoolProperty("IsAnonymousType", "return createType.IsNull || string.IsNullOrEmpty(createType.Type);")] class ObjectCreateExpression : Expression { TypeReference createType; @@ -379,4 +388,6 @@ namespace NRefactoryASTGenerator.Ast QueryExpressionJoinVBClause joinClause; List intoVariables; } + + } diff --git a/src/Libraries/NRefactory/Project/NRefactory.csproj b/src/Libraries/NRefactory/Project/NRefactory.csproj index c67e5ba440..04d841ea37 100644 --- a/src/Libraries/NRefactory/Project/NRefactory.csproj +++ b/src/Libraries/NRefactory/Project/NRefactory.csproj @@ -55,6 +55,9 @@ + + ParserHelper.atg + @@ -84,6 +87,7 @@ + @@ -134,6 +138,15 @@ + + ParserHelper.atg + + + CocoParserGenerator + + + ParserHelper.atg + @@ -147,8 +160,12 @@ - + + Never + CocoParserGenerator + + diff --git a/src/Libraries/NRefactory/Project/Src/Ast/Enums.cs b/src/Libraries/NRefactory/Project/Src/Ast/Enums.cs index aa12e3cd2b..f0a1c335b7 100644 --- a/src/Libraries/NRefactory/Project/Src/Ast/Enums.cs +++ b/src/Libraries/NRefactory/Project/Src/Ast/Enums.cs @@ -20,7 +20,6 @@ namespace ICSharpCode.NRefactory.Ast Internal = 0x0002, Protected = 0x0004, Public = 0x0008, - Dim = 0x0010, // VB.NET SPECIFIC, for fields/local variables only // Scope Abstract = 0x0010, // == MustOverride/MustInherit @@ -45,6 +44,8 @@ namespace ICSharpCode.NRefactory.Ast Default = 0x40000, // VB specific Fixed = 0x80000, // C# specific (fixed size arrays in unsafe structs) + Dim = 0x100000, // VB.NET SPECIFIC, for fields/local variables only + /// Generated code, not part of parsed code Synthetic = 0x200000, /// Only for VB properties. diff --git a/src/Libraries/NRefactory/Project/Src/Ast/Generated.cs b/src/Libraries/NRefactory/Project/Src/Ast/Generated.cs index 59922784f2..173dd82dd5 100644 --- a/src/Libraries/NRefactory/Project/Src/Ast/Generated.cs +++ b/src/Libraries/NRefactory/Project/Src/Ast/Generated.cs @@ -2689,6 +2689,61 @@ public Location ExtendedEndLocation { get; set; } } } + public class MemberInitializerExpression : Expression { + + string name; + + bool isKey; + + Expression expression; + + public string Name { + get { + return name; + } + set { + name = value ?? ""; + } + } + + public bool IsKey { + get { + return isKey; + } + set { + isKey = value; + } + } + + public Expression Expression { + get { + return expression; + } + set { + expression = value ?? Expression.Null; + if (!expression.IsNull) expression.Parent = this; + } + } + + public MemberInitializerExpression() { + name = ""; + expression = Expression.Null; + } + + public MemberInitializerExpression(string name, Expression expression) { + Name = name; + Expression = expression; + } + + public override object AcceptVisitor(IAstVisitor visitor, object data) { + return visitor.VisitMemberInitializerExpression(this, data); + } + + public override string ToString() { + return string.Format("[MemberInitializerExpression Name={0} IsKey={1} Expression={2}]", Name, IsKey, Expression); + } + } + public abstract class MemberNode : ParametrizedNode { List interfaceImplementations; @@ -5362,43 +5417,6 @@ public UsingDeclaration(string @namespace, TypeReference alias) { usings = new L } } - public abstract class XmlLiteralExpression : AbstractNode, INullable { - - protected XmlLiteralExpression() { - } - - public virtual bool IsNull { - get { - return false; - } - } - - public static XmlLiteralExpression Null { - get { - return NullXmlLiteralExpression.Instance; - } - } - } - - internal sealed class NullXmlLiteralExpression : XmlLiteralExpression { - - internal static NullXmlLiteralExpression Instance = new NullXmlLiteralExpression(); - - public override bool IsNull { - get { - return true; - } - } - - public override object AcceptVisitor(IAstVisitor visitor, object data) { - return null; - } - - public override string ToString() { - return "[NullXmlLiteralExpression]"; - } - } - public class YieldStatement : Statement { Statement statement; diff --git a/src/Libraries/NRefactory/Project/Src/IAstVisitor.cs b/src/Libraries/NRefactory/Project/Src/IAstVisitor.cs index 1db4d9f95d..a839045661 100644 --- a/src/Libraries/NRefactory/Project/Src/IAstVisitor.cs +++ b/src/Libraries/NRefactory/Project/Src/IAstVisitor.cs @@ -135,6 +135,8 @@ namespace ICSharpCode.NRefactory { object VisitLockStatement(LockStatement lockStatement, object data); + object VisitMemberInitializerExpression(MemberInitializerExpression memberInitializerExpression, object data); + object VisitMemberReferenceExpression(MemberReferenceExpression memberReferenceExpression, object data); object VisitMethodDeclaration(MethodDeclaration methodDeclaration, object data); diff --git a/src/Libraries/NRefactory/Project/Src/Lexer/VBNet/Tokens.cs b/src/Libraries/NRefactory/Project/Src/Lexer/VBNet/Tokens.cs index 9807c7b07c..a5c97524ff 100644 --- a/src/Libraries/NRefactory/Project/Src/Lexer/VBNet/Tokens.cs +++ b/src/Libraries/NRefactory/Project/Src/Lexer/VBNet/Tokens.cs @@ -246,6 +246,8 @@ namespace ICSharpCode.NRefactory.Parser.VB public static BitArray Null = NewSet(Nothing); public static BitArray BlockSucc = NewSet(Case, Catch, Else, ElseIf, End, Finally, Loop, Next); public static BitArray IdentifierTokens = NewSet(Text, Binary, Compare, Assembly, Ansi, Auto, Preserve, Unicode, Until, Off, Explicit, Infer, From, Join, Equals, Distinct, Where, Take, Skip, Order, By, Ascending, Descending, Group, Into, Aggregate); + public static BitArray TypeLevel = NewSet(Public, Friend, Class, Interface, Structure, Enum, Delegate, Shared, Partial, Protected, Private, Public, Const, Event, Explicit, New, Operator); + public static BitArray GlobalLevel = NewSet(Namespace, Imports, Public, Friend, Class, Interface, Structure, Enum, Delegate, Partial); static string[] tokenList = new string[] { // ----- terminal classes ----- diff --git a/src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs b/src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs index 86aca2f292..930a336d3d 100644 --- a/src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs +++ b/src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs @@ -487,68 +487,68 @@ out expr); } void Expr( -#line 1779 "cs.ATG" +#line 1780 "cs.ATG" out Expression expr) { -#line 1780 "cs.ATG" +#line 1781 "cs.ATG" expr = null; Expression expr1 = null, expr2 = null; AssignmentOperatorType op; -#line 1782 "cs.ATG" +#line 1783 "cs.ATG" Location startLocation = la.Location; UnaryExpr( -#line 1783 "cs.ATG" +#line 1784 "cs.ATG" out expr); if (StartOf(7)) { AssignmentOperator( -#line 1786 "cs.ATG" +#line 1787 "cs.ATG" out op); Expr( -#line 1786 "cs.ATG" +#line 1787 "cs.ATG" out expr1); -#line 1786 "cs.ATG" +#line 1787 "cs.ATG" expr = new AssignmentExpression(expr, op, expr1); } else if ( -#line 1787 "cs.ATG" +#line 1788 "cs.ATG" la.kind == Tokens.GreaterThan && Peek(1).kind == Tokens.GreaterEqual) { AssignmentOperator( -#line 1788 "cs.ATG" +#line 1789 "cs.ATG" out op); Expr( -#line 1788 "cs.ATG" +#line 1789 "cs.ATG" out expr1); -#line 1788 "cs.ATG" +#line 1789 "cs.ATG" expr = new AssignmentExpression(expr, op, expr1); } else if (StartOf(8)) { ConditionalOrExpr( -#line 1790 "cs.ATG" +#line 1791 "cs.ATG" ref expr); if (la.kind == 13) { lexer.NextToken(); Expr( -#line 1791 "cs.ATG" +#line 1792 "cs.ATG" out expr1); -#line 1791 "cs.ATG" +#line 1792 "cs.ATG" expr = new BinaryOperatorExpression(expr, BinaryOperatorType.NullCoalescing, expr1); } if (la.kind == 12) { lexer.NextToken(); Expr( -#line 1792 "cs.ATG" +#line 1793 "cs.ATG" out expr1); Expect(9); Expr( -#line 1792 "cs.ATG" +#line 1793 "cs.ATG" out expr2); -#line 1792 "cs.ATG" +#line 1793 "cs.ATG" expr = new ConditionalExpression(expr, expr1, expr2); } } else SynErr(150); -#line 1795 "cs.ATG" +#line 1796 "cs.ATG" if (expr != null) { if (expr.StartLocation.IsEmpty) expr.StartLocation = startLocation; @@ -952,26 +952,26 @@ templates); } void TypeParameterList( -#line 2360 "cs.ATG" +#line 2361 "cs.ATG" List templates) { -#line 2362 "cs.ATG" +#line 2363 "cs.ATG" TemplateDefinition template; Expect(23); VariantTypeParameter( -#line 2366 "cs.ATG" +#line 2367 "cs.ATG" out template); -#line 2366 "cs.ATG" +#line 2367 "cs.ATG" templates.Add(template); while (la.kind == 14) { lexer.NextToken(); VariantTypeParameter( -#line 2368 "cs.ATG" +#line 2369 "cs.ATG" out template); -#line 2368 "cs.ATG" +#line 2369 "cs.ATG" templates.Add(template); } Expect(22); @@ -1004,22 +1004,22 @@ out typeRef, false); } void TypeParameterConstraintsClause( -#line 2388 "cs.ATG" +#line 2389 "cs.ATG" List templates) { -#line 2389 "cs.ATG" +#line 2390 "cs.ATG" string name = ""; TypeReference type; Expect(127); Identifier(); -#line 2392 "cs.ATG" +#line 2393 "cs.ATG" name = t.val; Expect(9); TypeParameterConstraintsClauseBase( -#line 2394 "cs.ATG" +#line 2395 "cs.ATG" out type); -#line 2395 "cs.ATG" +#line 2396 "cs.ATG" TemplateDefinition td = null; foreach (TemplateDefinition d in templates) { if (d.Name == name) { @@ -1032,10 +1032,10 @@ out type); while (la.kind == 14) { lexer.NextToken(); TypeParameterConstraintsClauseBase( -#line 2404 "cs.ATG" +#line 2405 "cs.ATG" out type); -#line 2405 "cs.ATG" +#line 2406 "cs.ATG" td = null; foreach (TemplateDefinition d in templates) { if (d.Name == name) { @@ -1352,34 +1352,34 @@ out r, canBeUnbound); } void TypeName( -#line 2301 "cs.ATG" +#line 2302 "cs.ATG" out TypeReference typeRef, bool canBeUnbound) { -#line 2302 "cs.ATG" +#line 2303 "cs.ATG" List typeArguments = null; string alias = null; string qualident; Location startLocation = la.Location; if ( -#line 2308 "cs.ATG" +#line 2309 "cs.ATG" IdentAndDoubleColon()) { Identifier(); -#line 2309 "cs.ATG" +#line 2310 "cs.ATG" alias = t.val; Expect(10); } Qualident( -#line 2312 "cs.ATG" +#line 2313 "cs.ATG" out qualident); if (la.kind == 23) { TypeArgumentList( -#line 2313 "cs.ATG" +#line 2314 "cs.ATG" out typeArguments, canBeUnbound); } -#line 2315 "cs.ATG" +#line 2316 "cs.ATG" if (alias == null) { typeRef = new TypeReference(qualident, typeArguments); } else if (alias == "global") { @@ -1390,26 +1390,26 @@ out typeArguments, canBeUnbound); } while ( -#line 2324 "cs.ATG" +#line 2325 "cs.ATG" DotAndIdent()) { Expect(15); -#line 2325 "cs.ATG" +#line 2326 "cs.ATG" typeArguments = null; Qualident( -#line 2326 "cs.ATG" +#line 2327 "cs.ATG" out qualident); if (la.kind == 23) { TypeArgumentList( -#line 2327 "cs.ATG" +#line 2328 "cs.ATG" out typeArguments, canBeUnbound); } -#line 2328 "cs.ATG" +#line 2329 "cs.ATG" typeRef = new InnerClassTypeReference(typeRef, qualident, typeArguments); } -#line 2330 "cs.ATG" +#line 2331 "cs.ATG" typeRef.StartLocation = startLocation; } @@ -2541,14 +2541,14 @@ out name); } void NullableQuestionMark( -#line 2334 "cs.ATG" +#line 2335 "cs.ATG" ref TypeReference typeRef) { -#line 2335 "cs.ATG" +#line 2336 "cs.ATG" List typeArguments = new List(1); Expect(12); -#line 2339 "cs.ATG" +#line 2340 "cs.ATG" if (typeRef != null) typeArguments.Add(typeRef); typeRef = new TypeReference("System.Nullable", typeArguments) { IsKeyword = true }; @@ -3229,52 +3229,52 @@ out expr); void Statement() { -#line 1497 "cs.ATG" +#line 1498 "cs.ATG" Statement stmt = null; Location startPos = la.Location; while (!(StartOf(28))) {SynErr(190); lexer.NextToken(); } if ( -#line 1504 "cs.ATG" +#line 1505 "cs.ATG" IsLabel()) { Identifier(); -#line 1504 "cs.ATG" +#line 1505 "cs.ATG" compilationUnit.AddChild(new LabelStatement(t.val)); Expect(9); Statement(); } else if (la.kind == 60) { lexer.NextToken(); LocalVariableDecl( -#line 1508 "cs.ATG" +#line 1509 "cs.ATG" out stmt); -#line 1509 "cs.ATG" +#line 1510 "cs.ATG" if (stmt != null) { ((LocalVariableDeclaration)stmt).Modifier |= Modifiers.Const; } Expect(11); -#line 1510 "cs.ATG" +#line 1511 "cs.ATG" compilationUnit.AddChild(stmt); } else if ( -#line 1512 "cs.ATG" +#line 1513 "cs.ATG" IsLocalVarDecl()) { LocalVariableDecl( -#line 1512 "cs.ATG" +#line 1513 "cs.ATG" out stmt); Expect(11); -#line 1512 "cs.ATG" +#line 1513 "cs.ATG" compilationUnit.AddChild(stmt); } else if (StartOf(29)) { EmbeddedStatement( -#line 1514 "cs.ATG" +#line 1515 "cs.ATG" out stmt); -#line 1514 "cs.ATG" +#line 1515 "cs.ATG" compilationUnit.AddChild(stmt); } else SynErr(191); -#line 1520 "cs.ATG" +#line 1521 "cs.ATG" if (stmt != null) { stmt.StartLocation = startPos; stmt.EndLocation = t.EndLocation; @@ -3500,264 +3500,265 @@ IdentAndAsgn()) { Identifier(); #line 1461 "cs.ATG" - NamedArgumentExpression nae = new NamedArgumentExpression(t.val, null); - nae.StartLocation = t.Location; + MemberInitializerExpression mie = new MemberInitializerExpression(t.val, null); + mie.StartLocation = t.Location; + mie.IsKey = true; Expression r = null; Expect(3); if (la.kind == 16) { CollectionOrObjectInitializer( -#line 1465 "cs.ATG" +#line 1466 "cs.ATG" out r); } else if (StartOf(30)) { VariableInitializer( -#line 1466 "cs.ATG" +#line 1467 "cs.ATG" out r); } else SynErr(194); -#line 1467 "cs.ATG" - nae.Expression = r; nae.EndLocation = t.EndLocation; expr = nae; +#line 1468 "cs.ATG" + mie.Expression = r; mie.EndLocation = t.EndLocation; expr = mie; } else if (StartOf(30)) { VariableInitializer( -#line 1469 "cs.ATG" +#line 1470 "cs.ATG" out expr); } else SynErr(195); } void LocalVariableDecl( -#line 1473 "cs.ATG" +#line 1474 "cs.ATG" out Statement stmt) { -#line 1475 "cs.ATG" +#line 1476 "cs.ATG" TypeReference type; VariableDeclaration var = null; LocalVariableDeclaration localVariableDeclaration; Location startPos = la.Location; Type( -#line 1481 "cs.ATG" +#line 1482 "cs.ATG" out type); -#line 1481 "cs.ATG" +#line 1482 "cs.ATG" localVariableDeclaration = new LocalVariableDeclaration(type); localVariableDeclaration.StartLocation = startPos; LocalVariableDeclarator( -#line 1482 "cs.ATG" +#line 1483 "cs.ATG" out var); -#line 1482 "cs.ATG" +#line 1483 "cs.ATG" SafeAdd(localVariableDeclaration, localVariableDeclaration.Variables, var); while (la.kind == 14) { lexer.NextToken(); LocalVariableDeclarator( -#line 1483 "cs.ATG" +#line 1484 "cs.ATG" out var); -#line 1483 "cs.ATG" +#line 1484 "cs.ATG" SafeAdd(localVariableDeclaration, localVariableDeclaration.Variables, var); } -#line 1484 "cs.ATG" +#line 1485 "cs.ATG" stmt = localVariableDeclaration; stmt.EndLocation = t.EndLocation; } void LocalVariableDeclarator( -#line 1487 "cs.ATG" +#line 1488 "cs.ATG" out VariableDeclaration var) { -#line 1488 "cs.ATG" +#line 1489 "cs.ATG" Expression expr = null; Identifier(); -#line 1490 "cs.ATG" +#line 1491 "cs.ATG" var = new VariableDeclaration(t.val); var.StartLocation = t.Location; if (la.kind == 3) { lexer.NextToken(); VariableInitializer( -#line 1491 "cs.ATG" +#line 1492 "cs.ATG" out expr); -#line 1491 "cs.ATG" +#line 1492 "cs.ATG" var.Initializer = expr; } -#line 1492 "cs.ATG" +#line 1493 "cs.ATG" var.EndLocation = t.EndLocation; } void EmbeddedStatement( -#line 1527 "cs.ATG" +#line 1528 "cs.ATG" out Statement statement) { -#line 1529 "cs.ATG" +#line 1530 "cs.ATG" TypeReference type = null; Expression expr = null; Statement embeddedStatement = null; statement = null; -#line 1535 "cs.ATG" +#line 1536 "cs.ATG" Location startLocation = la.Location; if (la.kind == 16) { Block( -#line 1537 "cs.ATG" +#line 1538 "cs.ATG" out statement); } else if (la.kind == 11) { lexer.NextToken(); -#line 1540 "cs.ATG" +#line 1541 "cs.ATG" statement = new EmptyStatement(); } else if ( -#line 1543 "cs.ATG" +#line 1544 "cs.ATG" UnCheckedAndLBrace()) { -#line 1543 "cs.ATG" +#line 1544 "cs.ATG" Statement block; bool isChecked = true; if (la.kind == 58) { lexer.NextToken(); } else if (la.kind == 118) { lexer.NextToken(); -#line 1544 "cs.ATG" +#line 1545 "cs.ATG" isChecked = false; } else SynErr(196); Block( -#line 1545 "cs.ATG" +#line 1546 "cs.ATG" out block); -#line 1545 "cs.ATG" +#line 1546 "cs.ATG" statement = isChecked ? (Statement)new CheckedStatement(block) : (Statement)new UncheckedStatement(block); } else if (la.kind == 79) { IfStatement( -#line 1548 "cs.ATG" +#line 1549 "cs.ATG" out statement); } else if (la.kind == 110) { lexer.NextToken(); -#line 1550 "cs.ATG" +#line 1551 "cs.ATG" List switchSections = new List(); Expect(20); Expr( -#line 1551 "cs.ATG" +#line 1552 "cs.ATG" out expr); Expect(21); Expect(16); SwitchSections( -#line 1552 "cs.ATG" +#line 1553 "cs.ATG" switchSections); Expect(17); -#line 1554 "cs.ATG" +#line 1555 "cs.ATG" statement = new SwitchStatement(expr, switchSections); } else if (la.kind == 125) { lexer.NextToken(); Expect(20); Expr( -#line 1557 "cs.ATG" +#line 1558 "cs.ATG" out expr); Expect(21); EmbeddedStatement( -#line 1558 "cs.ATG" +#line 1559 "cs.ATG" out embeddedStatement); -#line 1559 "cs.ATG" +#line 1560 "cs.ATG" statement = new DoLoopStatement(expr, embeddedStatement, ConditionType.While, ConditionPosition.Start); } else if (la.kind == 65) { lexer.NextToken(); EmbeddedStatement( -#line 1561 "cs.ATG" +#line 1562 "cs.ATG" out embeddedStatement); Expect(125); Expect(20); Expr( -#line 1562 "cs.ATG" +#line 1563 "cs.ATG" out expr); Expect(21); Expect(11); -#line 1563 "cs.ATG" +#line 1564 "cs.ATG" statement = new DoLoopStatement(expr, embeddedStatement, ConditionType.While, ConditionPosition.End); } else if (la.kind == 76) { lexer.NextToken(); -#line 1565 "cs.ATG" +#line 1566 "cs.ATG" List initializer = null; List iterator = null; Expect(20); if (StartOf(6)) { ForInitializer( -#line 1566 "cs.ATG" +#line 1567 "cs.ATG" out initializer); } Expect(11); if (StartOf(6)) { Expr( -#line 1567 "cs.ATG" +#line 1568 "cs.ATG" out expr); } Expect(11); if (StartOf(6)) { ForIterator( -#line 1568 "cs.ATG" +#line 1569 "cs.ATG" out iterator); } Expect(21); EmbeddedStatement( -#line 1569 "cs.ATG" +#line 1570 "cs.ATG" out embeddedStatement); -#line 1570 "cs.ATG" +#line 1571 "cs.ATG" statement = new ForStatement(initializer, expr, iterator, embeddedStatement); } else if (la.kind == 77) { lexer.NextToken(); Expect(20); Type( -#line 1572 "cs.ATG" +#line 1573 "cs.ATG" out type); Identifier(); -#line 1572 "cs.ATG" +#line 1573 "cs.ATG" string varName = t.val; Expect(81); Expr( -#line 1573 "cs.ATG" +#line 1574 "cs.ATG" out expr); Expect(21); EmbeddedStatement( -#line 1574 "cs.ATG" +#line 1575 "cs.ATG" out embeddedStatement); -#line 1575 "cs.ATG" +#line 1576 "cs.ATG" statement = new ForeachStatement(type, varName , expr, embeddedStatement); } else if (la.kind == 53) { lexer.NextToken(); Expect(11); -#line 1578 "cs.ATG" +#line 1579 "cs.ATG" statement = new BreakStatement(); } else if (la.kind == 61) { lexer.NextToken(); Expect(11); -#line 1579 "cs.ATG" +#line 1580 "cs.ATG" statement = new ContinueStatement(); } else if (la.kind == 78) { GotoStatement( -#line 1580 "cs.ATG" +#line 1581 "cs.ATG" out statement); } else if ( -#line 1582 "cs.ATG" +#line 1583 "cs.ATG" IsYieldStatement()) { Expect(132); if (la.kind == 101) { lexer.NextToken(); Expr( -#line 1583 "cs.ATG" +#line 1584 "cs.ATG" out expr); -#line 1583 "cs.ATG" +#line 1584 "cs.ATG" statement = new YieldStatement(new ReturnStatement(expr)); } else if (la.kind == 53) { lexer.NextToken(); -#line 1584 "cs.ATG" +#line 1585 "cs.ATG" statement = new YieldStatement(new BreakStatement()); } else SynErr(197); Expect(11); @@ -3765,90 +3766,90 @@ out expr); lexer.NextToken(); if (StartOf(6)) { Expr( -#line 1587 "cs.ATG" +#line 1588 "cs.ATG" out expr); } Expect(11); -#line 1587 "cs.ATG" +#line 1588 "cs.ATG" statement = new ReturnStatement(expr); } else if (la.kind == 112) { lexer.NextToken(); if (StartOf(6)) { Expr( -#line 1588 "cs.ATG" +#line 1589 "cs.ATG" out expr); } Expect(11); -#line 1588 "cs.ATG" +#line 1589 "cs.ATG" statement = new ThrowStatement(expr); } else if (StartOf(6)) { StatementExpr( -#line 1591 "cs.ATG" +#line 1592 "cs.ATG" out statement); while (!(la.kind == 0 || la.kind == 11)) {SynErr(198); lexer.NextToken(); } Expect(11); } else if (la.kind == 114) { TryStatement( -#line 1594 "cs.ATG" +#line 1595 "cs.ATG" out statement); } else if (la.kind == 86) { lexer.NextToken(); Expect(20); Expr( -#line 1597 "cs.ATG" +#line 1598 "cs.ATG" out expr); Expect(21); EmbeddedStatement( -#line 1598 "cs.ATG" +#line 1599 "cs.ATG" out embeddedStatement); -#line 1598 "cs.ATG" +#line 1599 "cs.ATG" statement = new LockStatement(expr, embeddedStatement); } else if (la.kind == 121) { -#line 1601 "cs.ATG" +#line 1602 "cs.ATG" Statement resourceAcquisitionStmt = null; lexer.NextToken(); Expect(20); ResourceAcquisition( -#line 1603 "cs.ATG" +#line 1604 "cs.ATG" out resourceAcquisitionStmt); Expect(21); EmbeddedStatement( -#line 1604 "cs.ATG" +#line 1605 "cs.ATG" out embeddedStatement); -#line 1604 "cs.ATG" +#line 1605 "cs.ATG" statement = new UsingStatement(resourceAcquisitionStmt, embeddedStatement); } else if (la.kind == 119) { lexer.NextToken(); Block( -#line 1607 "cs.ATG" +#line 1608 "cs.ATG" out embeddedStatement); -#line 1607 "cs.ATG" +#line 1608 "cs.ATG" statement = new UnsafeStatement(embeddedStatement); } else if (la.kind == 74) { -#line 1609 "cs.ATG" +#line 1610 "cs.ATG" Statement pointerDeclarationStmt = null; lexer.NextToken(); Expect(20); ResourceAcquisition( -#line 1611 "cs.ATG" +#line 1612 "cs.ATG" out pointerDeclarationStmt); Expect(21); EmbeddedStatement( -#line 1612 "cs.ATG" +#line 1613 "cs.ATG" out embeddedStatement); -#line 1612 "cs.ATG" +#line 1613 "cs.ATG" statement = new FixedStatement(pointerDeclarationStmt, embeddedStatement); } else SynErr(199); -#line 1614 "cs.ATG" +#line 1615 "cs.ATG" if (statement != null) { statement.StartLocation = startLocation; statement.EndLocation = t.EndLocation; @@ -3857,10 +3858,10 @@ out embeddedStatement); } void IfStatement( -#line 1621 "cs.ATG" +#line 1622 "cs.ATG" out Statement statement) { -#line 1623 "cs.ATG" +#line 1624 "cs.ATG" Expression expr = null; Statement embeddedStatement = null; statement = null; @@ -3868,26 +3869,26 @@ out Statement statement) { Expect(79); Expect(20); Expr( -#line 1629 "cs.ATG" +#line 1630 "cs.ATG" out expr); Expect(21); EmbeddedStatement( -#line 1630 "cs.ATG" +#line 1631 "cs.ATG" out embeddedStatement); -#line 1631 "cs.ATG" +#line 1632 "cs.ATG" Statement elseStatement = null; if (la.kind == 67) { lexer.NextToken(); EmbeddedStatement( -#line 1632 "cs.ATG" +#line 1633 "cs.ATG" out elseStatement); } -#line 1633 "cs.ATG" +#line 1634 "cs.ATG" statement = elseStatement != null ? new IfElseStatement(expr, embeddedStatement, elseStatement) : new IfElseStatement(expr, embeddedStatement); -#line 1634 "cs.ATG" +#line 1635 "cs.ATG" if (elseStatement is IfElseStatement && (elseStatement as IfElseStatement).TrueStatement.Count == 1) { /* else if-section (otherwise we would have a BlockStatment) */ (statement as IfElseStatement).ElseIfSections.Add( @@ -3900,29 +3901,29 @@ out elseStatement); } void SwitchSections( -#line 1664 "cs.ATG" +#line 1665 "cs.ATG" List switchSections) { -#line 1666 "cs.ATG" +#line 1667 "cs.ATG" SwitchSection switchSection = new SwitchSection(); CaseLabel label; SwitchLabel( -#line 1670 "cs.ATG" +#line 1671 "cs.ATG" out label); -#line 1670 "cs.ATG" +#line 1671 "cs.ATG" SafeAdd(switchSection, switchSection.SwitchLabels, label); -#line 1671 "cs.ATG" +#line 1672 "cs.ATG" compilationUnit.BlockStart(switchSection); while (StartOf(31)) { if (la.kind == 55 || la.kind == 63) { SwitchLabel( -#line 1673 "cs.ATG" +#line 1674 "cs.ATG" out label); -#line 1674 "cs.ATG" +#line 1675 "cs.ATG" if (label != null) { if (switchSection.Children.Count > 0) { // open new section @@ -3938,145 +3939,145 @@ out label); } } -#line 1686 "cs.ATG" +#line 1687 "cs.ATG" compilationUnit.BlockEnd(); switchSections.Add(switchSection); } void ForInitializer( -#line 1645 "cs.ATG" +#line 1646 "cs.ATG" out List initializer) { -#line 1647 "cs.ATG" +#line 1648 "cs.ATG" Statement stmt; initializer = new List(); if ( -#line 1651 "cs.ATG" +#line 1652 "cs.ATG" IsLocalVarDecl()) { LocalVariableDecl( -#line 1651 "cs.ATG" +#line 1652 "cs.ATG" out stmt); -#line 1651 "cs.ATG" +#line 1652 "cs.ATG" initializer.Add(stmt); } else if (StartOf(6)) { StatementExpr( -#line 1652 "cs.ATG" +#line 1653 "cs.ATG" out stmt); -#line 1652 "cs.ATG" +#line 1653 "cs.ATG" initializer.Add(stmt); while (la.kind == 14) { lexer.NextToken(); StatementExpr( -#line 1652 "cs.ATG" +#line 1653 "cs.ATG" out stmt); -#line 1652 "cs.ATG" +#line 1653 "cs.ATG" initializer.Add(stmt); } } else SynErr(200); } void ForIterator( -#line 1655 "cs.ATG" +#line 1656 "cs.ATG" out List iterator) { -#line 1657 "cs.ATG" +#line 1658 "cs.ATG" Statement stmt; iterator = new List(); StatementExpr( -#line 1661 "cs.ATG" +#line 1662 "cs.ATG" out stmt); -#line 1661 "cs.ATG" +#line 1662 "cs.ATG" iterator.Add(stmt); while (la.kind == 14) { lexer.NextToken(); StatementExpr( -#line 1661 "cs.ATG" +#line 1662 "cs.ATG" out stmt); -#line 1661 "cs.ATG" +#line 1662 "cs.ATG" iterator.Add(stmt); } } void GotoStatement( -#line 1743 "cs.ATG" +#line 1744 "cs.ATG" out Statement stmt) { -#line 1744 "cs.ATG" +#line 1745 "cs.ATG" Expression expr; stmt = null; Expect(78); if (StartOf(18)) { Identifier(); -#line 1748 "cs.ATG" +#line 1749 "cs.ATG" stmt = new GotoStatement(t.val); Expect(11); } else if (la.kind == 55) { lexer.NextToken(); Expr( -#line 1749 "cs.ATG" +#line 1750 "cs.ATG" out expr); Expect(11); -#line 1749 "cs.ATG" +#line 1750 "cs.ATG" stmt = new GotoCaseStatement(expr); } else if (la.kind == 63) { lexer.NextToken(); Expect(11); -#line 1750 "cs.ATG" +#line 1751 "cs.ATG" stmt = new GotoCaseStatement(null); } else SynErr(201); } void StatementExpr( -#line 1770 "cs.ATG" +#line 1771 "cs.ATG" out Statement stmt) { -#line 1771 "cs.ATG" +#line 1772 "cs.ATG" Expression expr; Expr( -#line 1773 "cs.ATG" +#line 1774 "cs.ATG" out expr); -#line 1776 "cs.ATG" +#line 1777 "cs.ATG" stmt = new ExpressionStatement(expr); } void TryStatement( -#line 1696 "cs.ATG" +#line 1697 "cs.ATG" out Statement tryStatement) { -#line 1698 "cs.ATG" +#line 1699 "cs.ATG" Statement blockStmt = null, finallyStmt = null; CatchClause catchClause = null; List catchClauses = new List(); Expect(114); Block( -#line 1703 "cs.ATG" +#line 1704 "cs.ATG" out blockStmt); while (la.kind == 56) { CatchClause( -#line 1705 "cs.ATG" +#line 1706 "cs.ATG" out catchClause); -#line 1706 "cs.ATG" +#line 1707 "cs.ATG" if (catchClause != null) catchClauses.Add(catchClause); } if (la.kind == 73) { lexer.NextToken(); Block( -#line 1708 "cs.ATG" +#line 1709 "cs.ATG" out finallyStmt); } -#line 1710 "cs.ATG" +#line 1711 "cs.ATG" tryStatement = new TryCatchStatement(blockStmt, catchClauses, finallyStmt); if (catchClauses != null) { foreach (CatchClause cc in catchClauses) cc.Parent = tryStatement; @@ -4085,59 +4086,59 @@ out finallyStmt); } void ResourceAcquisition( -#line 1754 "cs.ATG" +#line 1755 "cs.ATG" out Statement stmt) { -#line 1756 "cs.ATG" +#line 1757 "cs.ATG" stmt = null; Expression expr; if ( -#line 1761 "cs.ATG" +#line 1762 "cs.ATG" IsLocalVarDecl()) { LocalVariableDecl( -#line 1761 "cs.ATG" +#line 1762 "cs.ATG" out stmt); } else if (StartOf(6)) { Expr( -#line 1762 "cs.ATG" +#line 1763 "cs.ATG" out expr); -#line 1766 "cs.ATG" +#line 1767 "cs.ATG" stmt = new ExpressionStatement(expr); } else SynErr(202); } void SwitchLabel( -#line 1689 "cs.ATG" +#line 1690 "cs.ATG" out CaseLabel label) { -#line 1690 "cs.ATG" +#line 1691 "cs.ATG" Expression expr = null; label = null; if (la.kind == 55) { lexer.NextToken(); Expr( -#line 1692 "cs.ATG" +#line 1693 "cs.ATG" out expr); Expect(9); -#line 1692 "cs.ATG" +#line 1693 "cs.ATG" label = new CaseLabel(expr); } else if (la.kind == 63) { lexer.NextToken(); Expect(9); -#line 1693 "cs.ATG" +#line 1694 "cs.ATG" label = new CaseLabel(); } else SynErr(203); } void CatchClause( -#line 1717 "cs.ATG" +#line 1718 "cs.ATG" out CatchClause catchClause) { Expect(56); -#line 1719 "cs.ATG" +#line 1720 "cs.ATG" string identifier; Statement stmt; TypeReference typeRef; @@ -4146,35 +4147,35 @@ out CatchClause catchClause) { if (la.kind == 16) { Block( -#line 1727 "cs.ATG" +#line 1728 "cs.ATG" out stmt); -#line 1727 "cs.ATG" +#line 1728 "cs.ATG" catchClause = new CatchClause(stmt); } else if (la.kind == 20) { lexer.NextToken(); ClassType( -#line 1730 "cs.ATG" +#line 1731 "cs.ATG" out typeRef, false); -#line 1730 "cs.ATG" +#line 1731 "cs.ATG" identifier = null; if (StartOf(18)) { Identifier(); -#line 1731 "cs.ATG" +#line 1732 "cs.ATG" identifier = t.val; } Expect(21); Block( -#line 1732 "cs.ATG" +#line 1733 "cs.ATG" out stmt); -#line 1733 "cs.ATG" +#line 1734 "cs.ATG" catchClause = new CatchClause(typeRef, identifier, stmt); } else SynErr(204); -#line 1736 "cs.ATG" +#line 1737 "cs.ATG" if (catchClause != null) { catchClause.StartLocation = startPos; catchClause.EndLocation = t.Location; @@ -4183,75 +4184,75 @@ out stmt); } void UnaryExpr( -#line 1805 "cs.ATG" +#line 1806 "cs.ATG" out Expression uExpr) { -#line 1807 "cs.ATG" +#line 1808 "cs.ATG" TypeReference type = null; Expression expr = null; ArrayList expressions = new ArrayList(); uExpr = null; while (StartOf(32) || -#line 1829 "cs.ATG" +#line 1830 "cs.ATG" IsTypeCast()) { if (la.kind == 4) { lexer.NextToken(); -#line 1816 "cs.ATG" +#line 1817 "cs.ATG" expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Plus)); } else if (la.kind == 5) { lexer.NextToken(); -#line 1817 "cs.ATG" +#line 1818 "cs.ATG" expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Minus)); } else if (la.kind == 24) { lexer.NextToken(); -#line 1818 "cs.ATG" +#line 1819 "cs.ATG" expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Not)); } else if (la.kind == 27) { lexer.NextToken(); -#line 1819 "cs.ATG" +#line 1820 "cs.ATG" expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.BitNot)); } else if (la.kind == 6) { lexer.NextToken(); -#line 1820 "cs.ATG" +#line 1821 "cs.ATG" expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Dereference)); } else if (la.kind == 31) { lexer.NextToken(); -#line 1821 "cs.ATG" +#line 1822 "cs.ATG" expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Increment)); } else if (la.kind == 32) { lexer.NextToken(); -#line 1822 "cs.ATG" +#line 1823 "cs.ATG" expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Decrement)); } else if (la.kind == 28) { lexer.NextToken(); -#line 1823 "cs.ATG" +#line 1824 "cs.ATG" expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.AddressOf)); } else { Expect(20); Type( -#line 1829 "cs.ATG" +#line 1830 "cs.ATG" out type); Expect(21); -#line 1829 "cs.ATG" +#line 1830 "cs.ATG" expressions.Add(new CastExpression(type)); } } if ( -#line 1834 "cs.ATG" +#line 1835 "cs.ATG" LastExpressionIsUnaryMinus(expressions) && IsMostNegativeIntegerWithoutTypeSuffix()) { Expect(2); -#line 1837 "cs.ATG" +#line 1838 "cs.ATG" expressions.RemoveAt(expressions.Count - 1); if (t.literalValue is uint) { expr = new PrimitiveExpression(int.MinValue, int.MinValue.ToString()); @@ -4263,11 +4264,11 @@ LastExpressionIsUnaryMinus(expressions) && IsMostNegativeIntegerWithoutTypeSuffi } else if (StartOf(33)) { PrimaryExpr( -#line 1846 "cs.ATG" +#line 1847 "cs.ATG" out expr); } else SynErr(205); -#line 1848 "cs.ATG" +#line 1849 "cs.ATG" for (int i = 0; i < expressions.Count; ++i) { Expression nextExpression = i + 1 < expressions.Count ? (Expression)expressions[i + 1] : expr; if (expressions[i] is CastExpression) { @@ -4285,325 +4286,325 @@ out expr); } void ConditionalOrExpr( -#line 2172 "cs.ATG" +#line 2173 "cs.ATG" ref Expression outExpr) { -#line 2173 "cs.ATG" +#line 2174 "cs.ATG" Expression expr; ConditionalAndExpr( -#line 2175 "cs.ATG" +#line 2176 "cs.ATG" ref outExpr); while (la.kind == 26) { lexer.NextToken(); UnaryExpr( -#line 2175 "cs.ATG" +#line 2176 "cs.ATG" out expr); ConditionalAndExpr( -#line 2175 "cs.ATG" +#line 2176 "cs.ATG" ref expr); -#line 2175 "cs.ATG" +#line 2176 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.LogicalOr, expr); } } void PrimaryExpr( -#line 1865 "cs.ATG" +#line 1866 "cs.ATG" out Expression pexpr) { -#line 1867 "cs.ATG" +#line 1868 "cs.ATG" TypeReference type = null; Expression expr; pexpr = null; -#line 1872 "cs.ATG" +#line 1873 "cs.ATG" Location startLocation = la.Location; if (la.kind == 113) { lexer.NextToken(); -#line 1874 "cs.ATG" +#line 1875 "cs.ATG" pexpr = new PrimitiveExpression(true, "true"); } else if (la.kind == 72) { lexer.NextToken(); -#line 1875 "cs.ATG" +#line 1876 "cs.ATG" pexpr = new PrimitiveExpression(false, "false"); } else if (la.kind == 90) { lexer.NextToken(); -#line 1876 "cs.ATG" +#line 1877 "cs.ATG" pexpr = new PrimitiveExpression(null, "null"); } else if (la.kind == 2) { lexer.NextToken(); -#line 1877 "cs.ATG" +#line 1878 "cs.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; } else if ( -#line 1878 "cs.ATG" +#line 1879 "cs.ATG" StartOfQueryExpression()) { QueryExpression( -#line 1879 "cs.ATG" +#line 1880 "cs.ATG" out pexpr); } else if ( -#line 1880 "cs.ATG" +#line 1881 "cs.ATG" IdentAndDoubleColon()) { Identifier(); -#line 1881 "cs.ATG" +#line 1882 "cs.ATG" type = new TypeReference(t.val); Expect(10); -#line 1882 "cs.ATG" +#line 1883 "cs.ATG" pexpr = new TypeReferenceExpression(type); Identifier(); -#line 1883 "cs.ATG" +#line 1884 "cs.ATG" if (type.Type == "global") { type.IsGlobal = true; type.Type = t.val ?? "?"; } else type.Type += "." + (t.val ?? "?"); } else if (StartOf(18)) { Identifier(); -#line 1887 "cs.ATG" +#line 1888 "cs.ATG" pexpr = new IdentifierExpression(t.val); if (la.kind == 48 || -#line 1890 "cs.ATG" +#line 1891 "cs.ATG" IsGenericInSimpleNameOrMemberAccess()) { if (la.kind == 48) { ShortedLambdaExpression( -#line 1889 "cs.ATG" +#line 1890 "cs.ATG" (IdentifierExpression)pexpr, out pexpr); } else { -#line 1891 "cs.ATG" +#line 1892 "cs.ATG" List typeList; TypeArgumentList( -#line 1892 "cs.ATG" +#line 1893 "cs.ATG" out typeList, false); -#line 1893 "cs.ATG" +#line 1894 "cs.ATG" ((IdentifierExpression)pexpr).TypeArguments = typeList; } } } else if ( -#line 1895 "cs.ATG" +#line 1896 "cs.ATG" IsLambdaExpression()) { LambdaExpression( -#line 1896 "cs.ATG" +#line 1897 "cs.ATG" out pexpr); } else if (la.kind == 20) { lexer.NextToken(); Expr( -#line 1899 "cs.ATG" +#line 1900 "cs.ATG" out expr); Expect(21); -#line 1899 "cs.ATG" +#line 1900 "cs.ATG" pexpr = new ParenthesizedExpression(expr); } else if (StartOf(34)) { -#line 1902 "cs.ATG" +#line 1903 "cs.ATG" string val = null; switch (la.kind) { case 52: { lexer.NextToken(); -#line 1903 "cs.ATG" +#line 1904 "cs.ATG" val = "System.Boolean"; break; } case 54: { lexer.NextToken(); -#line 1904 "cs.ATG" +#line 1905 "cs.ATG" val = "System.Byte"; break; } case 57: { lexer.NextToken(); -#line 1905 "cs.ATG" +#line 1906 "cs.ATG" val = "System.Char"; break; } case 62: { lexer.NextToken(); -#line 1906 "cs.ATG" +#line 1907 "cs.ATG" val = "System.Decimal"; break; } case 66: { lexer.NextToken(); -#line 1907 "cs.ATG" +#line 1908 "cs.ATG" val = "System.Double"; break; } case 75: { lexer.NextToken(); -#line 1908 "cs.ATG" +#line 1909 "cs.ATG" val = "System.Single"; break; } case 82: { lexer.NextToken(); -#line 1909 "cs.ATG" +#line 1910 "cs.ATG" val = "System.Int32"; break; } case 87: { lexer.NextToken(); -#line 1910 "cs.ATG" +#line 1911 "cs.ATG" val = "System.Int64"; break; } case 91: { lexer.NextToken(); -#line 1911 "cs.ATG" +#line 1912 "cs.ATG" val = "System.Object"; break; } case 102: { lexer.NextToken(); -#line 1912 "cs.ATG" +#line 1913 "cs.ATG" val = "System.SByte"; break; } case 104: { lexer.NextToken(); -#line 1913 "cs.ATG" +#line 1914 "cs.ATG" val = "System.Int16"; break; } case 108: { lexer.NextToken(); -#line 1914 "cs.ATG" +#line 1915 "cs.ATG" val = "System.String"; break; } case 116: { lexer.NextToken(); -#line 1915 "cs.ATG" +#line 1916 "cs.ATG" val = "System.UInt32"; break; } case 117: { lexer.NextToken(); -#line 1916 "cs.ATG" +#line 1917 "cs.ATG" val = "System.UInt64"; break; } case 120: { lexer.NextToken(); -#line 1917 "cs.ATG" +#line 1918 "cs.ATG" val = "System.UInt16"; break; } case 123: { lexer.NextToken(); -#line 1918 "cs.ATG" +#line 1919 "cs.ATG" val = "System.Void"; break; } } -#line 1920 "cs.ATG" +#line 1921 "cs.ATG" pexpr = new TypeReferenceExpression(new TypeReference(val, true)) { StartLocation = t.Location, EndLocation = t.EndLocation }; } else if (la.kind == 111) { lexer.NextToken(); -#line 1923 "cs.ATG" +#line 1924 "cs.ATG" pexpr = new ThisReferenceExpression(); pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation; } else if (la.kind == 51) { lexer.NextToken(); -#line 1925 "cs.ATG" +#line 1926 "cs.ATG" pexpr = new BaseReferenceExpression(); pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation; } else if (la.kind == 89) { NewExpression( -#line 1928 "cs.ATG" +#line 1929 "cs.ATG" out pexpr); } else if (la.kind == 115) { lexer.NextToken(); Expect(20); if ( -#line 1932 "cs.ATG" +#line 1933 "cs.ATG" NotVoidPointer()) { Expect(123); -#line 1932 "cs.ATG" +#line 1933 "cs.ATG" type = new TypeReference("System.Void", true); } else if (StartOf(10)) { TypeWithRestriction( -#line 1933 "cs.ATG" +#line 1934 "cs.ATG" out type, true, true); } else SynErr(206); Expect(21); -#line 1935 "cs.ATG" +#line 1936 "cs.ATG" pexpr = new TypeOfExpression(type); } else if (la.kind == 63) { lexer.NextToken(); Expect(20); Type( -#line 1937 "cs.ATG" +#line 1938 "cs.ATG" out type); Expect(21); -#line 1937 "cs.ATG" +#line 1938 "cs.ATG" pexpr = new DefaultValueExpression(type); } else if (la.kind == 105) { lexer.NextToken(); Expect(20); Type( -#line 1938 "cs.ATG" +#line 1939 "cs.ATG" out type); Expect(21); -#line 1938 "cs.ATG" +#line 1939 "cs.ATG" pexpr = new SizeOfExpression(type); } else if (la.kind == 58) { lexer.NextToken(); Expect(20); Expr( -#line 1939 "cs.ATG" +#line 1940 "cs.ATG" out expr); Expect(21); -#line 1939 "cs.ATG" +#line 1940 "cs.ATG" pexpr = new CheckedExpression(expr); } else if (la.kind == 118) { lexer.NextToken(); Expect(20); Expr( -#line 1940 "cs.ATG" +#line 1941 "cs.ATG" out expr); Expect(21); -#line 1940 "cs.ATG" +#line 1941 "cs.ATG" pexpr = new UncheckedExpression(expr); } else if (la.kind == 64) { lexer.NextToken(); AnonymousMethodExpr( -#line 1941 "cs.ATG" +#line 1942 "cs.ATG" out expr); -#line 1941 "cs.ATG" +#line 1942 "cs.ATG" pexpr = expr; } else SynErr(207); -#line 1943 "cs.ATG" +#line 1944 "cs.ATG" if (pexpr != null) { if (pexpr.StartLocation.IsEmpty) pexpr.StartLocation = startLocation; @@ -4613,57 +4614,57 @@ out expr); while (StartOf(35)) { -#line 1951 "cs.ATG" +#line 1952 "cs.ATG" startLocation = la.Location; switch (la.kind) { case 31: { lexer.NextToken(); -#line 1953 "cs.ATG" +#line 1954 "cs.ATG" pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostIncrement); break; } case 32: { lexer.NextToken(); -#line 1955 "cs.ATG" +#line 1956 "cs.ATG" pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostDecrement); break; } case 47: { PointerMemberAccess( -#line 1957 "cs.ATG" +#line 1958 "cs.ATG" out pexpr, pexpr); break; } case 15: { MemberAccess( -#line 1958 "cs.ATG" +#line 1959 "cs.ATG" out pexpr, pexpr); break; } case 20: { lexer.NextToken(); -#line 1962 "cs.ATG" +#line 1963 "cs.ATG" List parameters = new List(); -#line 1963 "cs.ATG" +#line 1964 "cs.ATG" pexpr = new InvocationExpression(pexpr, parameters); if (StartOf(25)) { Argument( -#line 1964 "cs.ATG" +#line 1965 "cs.ATG" out expr); -#line 1964 "cs.ATG" +#line 1965 "cs.ATG" SafeAdd(pexpr, parameters, expr); while (la.kind == 14) { lexer.NextToken(); Argument( -#line 1965 "cs.ATG" +#line 1966 "cs.ATG" out expr); -#line 1965 "cs.ATG" +#line 1966 "cs.ATG" SafeAdd(pexpr, parameters, expr); } } @@ -4672,24 +4673,24 @@ out expr); } case 18: { -#line 1971 "cs.ATG" +#line 1972 "cs.ATG" List indices = new List(); pexpr = new IndexerExpression(pexpr, indices); lexer.NextToken(); Expr( -#line 1974 "cs.ATG" +#line 1975 "cs.ATG" out expr); -#line 1974 "cs.ATG" +#line 1975 "cs.ATG" SafeAdd(pexpr, indices, expr); while (la.kind == 14) { lexer.NextToken(); Expr( -#line 1975 "cs.ATG" +#line 1976 "cs.ATG" out expr); -#line 1975 "cs.ATG" +#line 1976 "cs.ATG" SafeAdd(pexpr, indices, expr); } Expect(19); @@ -4697,7 +4698,7 @@ out expr); } } -#line 1978 "cs.ATG" +#line 1979 "cs.ATG" if (pexpr != null) { if (pexpr.StartLocation.IsEmpty) pexpr.StartLocation = startLocation; @@ -4709,83 +4710,83 @@ out expr); } void QueryExpression( -#line 2425 "cs.ATG" +#line 2426 "cs.ATG" out Expression outExpr) { -#line 2426 "cs.ATG" +#line 2427 "cs.ATG" QueryExpression q = new QueryExpression(); outExpr = q; q.StartLocation = la.Location; QueryExpressionFromClause fromClause; QueryExpressionFromClause( -#line 2430 "cs.ATG" +#line 2431 "cs.ATG" out fromClause); -#line 2430 "cs.ATG" +#line 2431 "cs.ATG" q.FromClause = fromClause; QueryExpressionBody( -#line 2431 "cs.ATG" +#line 2432 "cs.ATG" ref q); -#line 2432 "cs.ATG" +#line 2433 "cs.ATG" q.EndLocation = t.EndLocation; outExpr = q; /* set outExpr to q again if QueryExpressionBody changed it (can happen with 'into' clauses) */ } void ShortedLambdaExpression( -#line 2092 "cs.ATG" +#line 2093 "cs.ATG" IdentifierExpression ident, out Expression pexpr) { -#line 2093 "cs.ATG" +#line 2094 "cs.ATG" LambdaExpression lambda = new LambdaExpression(); pexpr = lambda; Expect(48); -#line 2098 "cs.ATG" +#line 2099 "cs.ATG" lambda.StartLocation = ident.StartLocation; SafeAdd(lambda, lambda.Parameters, new ParameterDeclarationExpression(null, ident.Identifier)); lambda.Parameters[0].StartLocation = ident.StartLocation; lambda.Parameters[0].EndLocation = ident.EndLocation; LambdaExpressionBody( -#line 2103 "cs.ATG" +#line 2104 "cs.ATG" lambda); } void TypeArgumentList( -#line 2344 "cs.ATG" +#line 2345 "cs.ATG" out List types, bool canBeUnbound) { -#line 2346 "cs.ATG" +#line 2347 "cs.ATG" types = new List(); TypeReference type = null; Expect(23); if ( -#line 2351 "cs.ATG" +#line 2352 "cs.ATG" canBeUnbound && (la.kind == Tokens.GreaterThan || la.kind == Tokens.Comma)) { -#line 2352 "cs.ATG" +#line 2353 "cs.ATG" types.Add(TypeReference.Null); while (la.kind == 14) { lexer.NextToken(); -#line 2353 "cs.ATG" +#line 2354 "cs.ATG" types.Add(TypeReference.Null); } } else if (StartOf(10)) { Type( -#line 2354 "cs.ATG" +#line 2355 "cs.ATG" out type); -#line 2354 "cs.ATG" +#line 2355 "cs.ATG" if (type != null) { types.Add(type); } while (la.kind == 14) { lexer.NextToken(); Type( -#line 2355 "cs.ATG" +#line 2356 "cs.ATG" out type); -#line 2355 "cs.ATG" +#line 2356 "cs.ATG" if (type != null) { types.Add(type); } } } else SynErr(208); @@ -4793,10 +4794,10 @@ out type); } void LambdaExpression( -#line 2072 "cs.ATG" +#line 2073 "cs.ATG" out Expression outExpr) { -#line 2074 "cs.ATG" +#line 2075 "cs.ATG" LambdaExpression lambda = new LambdaExpression(); lambda.StartLocation = la.Location; ParameterDeclarationExpression p; @@ -4805,33 +4806,33 @@ out Expression outExpr) { Expect(20); if (StartOf(36)) { LambdaExpressionParameter( -#line 2082 "cs.ATG" +#line 2083 "cs.ATG" out p); -#line 2082 "cs.ATG" +#line 2083 "cs.ATG" SafeAdd(lambda, lambda.Parameters, p); while (la.kind == 14) { lexer.NextToken(); LambdaExpressionParameter( -#line 2084 "cs.ATG" +#line 2085 "cs.ATG" out p); -#line 2084 "cs.ATG" +#line 2085 "cs.ATG" SafeAdd(lambda, lambda.Parameters, p); } } Expect(21); Expect(48); LambdaExpressionBody( -#line 2089 "cs.ATG" +#line 2090 "cs.ATG" lambda); } void NewExpression( -#line 2019 "cs.ATG" +#line 2020 "cs.ATG" out Expression pexpr) { -#line 2020 "cs.ATG" +#line 2021 "cs.ATG" pexpr = null; List parameters = new List(); TypeReference type = null; @@ -4840,65 +4841,65 @@ out Expression pexpr) { Expect(89); if (StartOf(10)) { NonArrayType( -#line 2027 "cs.ATG" +#line 2028 "cs.ATG" out type); } if (la.kind == 16 || la.kind == 20) { if (la.kind == 20) { -#line 2033 "cs.ATG" +#line 2034 "cs.ATG" ObjectCreateExpression oce = new ObjectCreateExpression(type, parameters); lexer.NextToken(); -#line 2034 "cs.ATG" +#line 2035 "cs.ATG" if (type == null) Error("Cannot use an anonymous type with arguments for the constructor"); if (StartOf(25)) { Argument( -#line 2035 "cs.ATG" +#line 2036 "cs.ATG" out expr); -#line 2035 "cs.ATG" +#line 2036 "cs.ATG" SafeAdd(oce, parameters, expr); while (la.kind == 14) { lexer.NextToken(); Argument( -#line 2036 "cs.ATG" +#line 2037 "cs.ATG" out expr); -#line 2036 "cs.ATG" +#line 2037 "cs.ATG" SafeAdd(oce, parameters, expr); } } Expect(21); -#line 2038 "cs.ATG" +#line 2039 "cs.ATG" pexpr = oce; if (la.kind == 16) { CollectionOrObjectInitializer( -#line 2039 "cs.ATG" +#line 2040 "cs.ATG" out expr); -#line 2039 "cs.ATG" +#line 2040 "cs.ATG" oce.ObjectInitializer = (CollectionInitializerExpression)expr; } } else { -#line 2040 "cs.ATG" +#line 2041 "cs.ATG" ObjectCreateExpression oce = new ObjectCreateExpression(type, parameters); CollectionOrObjectInitializer( -#line 2041 "cs.ATG" +#line 2042 "cs.ATG" out expr); -#line 2041 "cs.ATG" +#line 2042 "cs.ATG" oce.ObjectInitializer = (CollectionInitializerExpression)expr; -#line 2042 "cs.ATG" +#line 2043 "cs.ATG" pexpr = oce; } } else if (la.kind == 18) { lexer.NextToken(); -#line 2047 "cs.ATG" +#line 2048 "cs.ATG" ArrayCreateExpression ace = new ArrayCreateExpression(type); /* we must not change RankSpecifier on the null type reference*/ if (ace.CreateType.IsNull) { ace.CreateType = new TypeReference(""); } @@ -4909,80 +4910,80 @@ out expr); while (la.kind == 14) { lexer.NextToken(); -#line 2054 "cs.ATG" +#line 2055 "cs.ATG" dims += 1; } Expect(19); -#line 2055 "cs.ATG" +#line 2056 "cs.ATG" ranks.Add(dims); dims = 0; while (la.kind == 18) { lexer.NextToken(); while (la.kind == 14) { lexer.NextToken(); -#line 2056 "cs.ATG" +#line 2057 "cs.ATG" ++dims; } Expect(19); -#line 2056 "cs.ATG" +#line 2057 "cs.ATG" ranks.Add(dims); dims = 0; } -#line 2057 "cs.ATG" +#line 2058 "cs.ATG" ace.CreateType.RankSpecifier = ranks.ToArray(); CollectionInitializer( -#line 2058 "cs.ATG" +#line 2059 "cs.ATG" out expr); -#line 2058 "cs.ATG" +#line 2059 "cs.ATG" ace.ArrayInitializer = (CollectionInitializerExpression)expr; } else if (StartOf(6)) { Expr( -#line 2059 "cs.ATG" +#line 2060 "cs.ATG" out expr); -#line 2059 "cs.ATG" +#line 2060 "cs.ATG" if (expr != null) parameters.Add(expr); while (la.kind == 14) { lexer.NextToken(); -#line 2060 "cs.ATG" +#line 2061 "cs.ATG" dims += 1; Expr( -#line 2061 "cs.ATG" +#line 2062 "cs.ATG" out expr); -#line 2061 "cs.ATG" +#line 2062 "cs.ATG" if (expr != null) parameters.Add(expr); } Expect(19); -#line 2063 "cs.ATG" +#line 2064 "cs.ATG" ranks.Add(dims); ace.Arguments = parameters; dims = 0; while (la.kind == 18) { lexer.NextToken(); while (la.kind == 14) { lexer.NextToken(); -#line 2064 "cs.ATG" +#line 2065 "cs.ATG" ++dims; } Expect(19); -#line 2064 "cs.ATG" +#line 2065 "cs.ATG" ranks.Add(dims); dims = 0; } -#line 2065 "cs.ATG" +#line 2066 "cs.ATG" ace.CreateType.RankSpecifier = ranks.ToArray(); if (la.kind == 16) { CollectionInitializer( -#line 2066 "cs.ATG" +#line 2067 "cs.ATG" out expr); -#line 2066 "cs.ATG" +#line 2067 "cs.ATG" ace.ArrayInitializer = (CollectionInitializerExpression)expr; } } else SynErr(209); @@ -4990,10 +4991,10 @@ out expr); } void AnonymousMethodExpr( -#line 2139 "cs.ATG" +#line 2140 "cs.ATG" out Expression outExpr) { -#line 2141 "cs.ATG" +#line 2142 "cs.ATG" AnonymousMethodExpression expr = new AnonymousMethodExpression(); expr.StartLocation = t.Location; BlockStatement stmt; @@ -5004,59 +5005,59 @@ out Expression outExpr) { lexer.NextToken(); if (StartOf(11)) { FormalParameterList( -#line 2150 "cs.ATG" +#line 2151 "cs.ATG" p); -#line 2150 "cs.ATG" +#line 2151 "cs.ATG" expr.Parameters = p; } Expect(21); -#line 2152 "cs.ATG" +#line 2153 "cs.ATG" expr.HasParameterList = true; } BlockInsideExpression( -#line 2154 "cs.ATG" +#line 2155 "cs.ATG" out stmt); -#line 2154 "cs.ATG" +#line 2155 "cs.ATG" expr.Body = stmt; -#line 2155 "cs.ATG" +#line 2156 "cs.ATG" expr.EndLocation = t.Location; } void PointerMemberAccess( -#line 2007 "cs.ATG" +#line 2008 "cs.ATG" out Expression expr, Expression target) { -#line 2008 "cs.ATG" +#line 2009 "cs.ATG" List typeList; Expect(47); Identifier(); -#line 2012 "cs.ATG" +#line 2013 "cs.ATG" expr = new PointerReferenceExpression(target, t.val); expr.StartLocation = t.Location; expr.EndLocation = t.EndLocation; if ( -#line 2013 "cs.ATG" +#line 2014 "cs.ATG" IsGenericInSimpleNameOrMemberAccess()) { TypeArgumentList( -#line 2014 "cs.ATG" +#line 2015 "cs.ATG" out typeList, false); -#line 2015 "cs.ATG" +#line 2016 "cs.ATG" ((MemberReferenceExpression)expr).TypeArguments = typeList; } } void MemberAccess( -#line 1988 "cs.ATG" +#line 1989 "cs.ATG" out Expression expr, Expression target) { -#line 1989 "cs.ATG" +#line 1990 "cs.ATG" List typeList; -#line 1991 "cs.ATG" +#line 1992 "cs.ATG" if (ShouldConvertTargetExpressionToTypeReference(target)) { TypeReference type = GetTypeReferenceFromExpression(target); if (type != null) { @@ -5066,39 +5067,39 @@ out Expression expr, Expression target) { Expect(15); -#line 1998 "cs.ATG" +#line 1999 "cs.ATG" Location startLocation = t.Location; Identifier(); -#line 2000 "cs.ATG" +#line 2001 "cs.ATG" expr = new MemberReferenceExpression(target, t.val); expr.StartLocation = startLocation; expr.EndLocation = t.EndLocation; if ( -#line 2001 "cs.ATG" +#line 2002 "cs.ATG" IsGenericInSimpleNameOrMemberAccess()) { TypeArgumentList( -#line 2002 "cs.ATG" +#line 2003 "cs.ATG" out typeList, false); -#line 2003 "cs.ATG" +#line 2004 "cs.ATG" ((MemberReferenceExpression)expr).TypeArguments = typeList; } } void LambdaExpressionParameter( -#line 2106 "cs.ATG" +#line 2107 "cs.ATG" out ParameterDeclarationExpression p) { -#line 2107 "cs.ATG" +#line 2108 "cs.ATG" Location start = la.Location; p = null; TypeReference type; ParameterModifiers mod = ParameterModifiers.In; if ( -#line 2112 "cs.ATG" +#line 2113 "cs.ATG" Peek(1).kind == Tokens.Comma || Peek(1).kind == Tokens.CloseParenthesis) { Identifier(); -#line 2114 "cs.ATG" +#line 2115 "cs.ATG" p = new ParameterDeclarationExpression(null, t.val); p.StartLocation = start; p.EndLocation = t.EndLocation; @@ -5107,21 +5108,21 @@ Peek(1).kind == Tokens.Comma || Peek(1).kind == Tokens.CloseParenthesis) { if (la.kind == 100) { lexer.NextToken(); -#line 2117 "cs.ATG" +#line 2118 "cs.ATG" mod = ParameterModifiers.Ref; } else { lexer.NextToken(); -#line 2118 "cs.ATG" +#line 2119 "cs.ATG" mod = ParameterModifiers.Out; } } Type( -#line 2120 "cs.ATG" +#line 2121 "cs.ATG" out type); Identifier(); -#line 2122 "cs.ATG" +#line 2123 "cs.ATG" p = new ParameterDeclarationExpression(type, t.val, mod); p.StartLocation = start; p.EndLocation = t.EndLocation; @@ -5129,263 +5130,263 @@ out type); } void LambdaExpressionBody( -#line 2128 "cs.ATG" +#line 2129 "cs.ATG" LambdaExpression lambda) { -#line 2129 "cs.ATG" +#line 2130 "cs.ATG" Expression expr; BlockStatement stmt; if (la.kind == 16) { BlockInsideExpression( -#line 2132 "cs.ATG" +#line 2133 "cs.ATG" out stmt); -#line 2132 "cs.ATG" +#line 2133 "cs.ATG" lambda.StatementBody = stmt; } else if (StartOf(6)) { Expr( -#line 2133 "cs.ATG" +#line 2134 "cs.ATG" out expr); -#line 2133 "cs.ATG" +#line 2134 "cs.ATG" lambda.ExpressionBody = expr; } else SynErr(212); -#line 2135 "cs.ATG" +#line 2136 "cs.ATG" lambda.EndLocation = t.EndLocation; -#line 2136 "cs.ATG" +#line 2137 "cs.ATG" lambda.ExtendedEndLocation = la.Location; } void BlockInsideExpression( -#line 2158 "cs.ATG" +#line 2159 "cs.ATG" out BlockStatement outStmt) { -#line 2159 "cs.ATG" +#line 2160 "cs.ATG" Statement stmt = null; outStmt = null; -#line 2163 "cs.ATG" +#line 2164 "cs.ATG" if (compilationUnit != null) { Block( -#line 2164 "cs.ATG" +#line 2165 "cs.ATG" out stmt); -#line 2164 "cs.ATG" +#line 2165 "cs.ATG" outStmt = (BlockStatement)stmt; -#line 2165 "cs.ATG" +#line 2166 "cs.ATG" } else { Expect(16); -#line 2167 "cs.ATG" +#line 2168 "cs.ATG" lexer.SkipCurrentBlock(0); Expect(17); -#line 2169 "cs.ATG" +#line 2170 "cs.ATG" } } void ConditionalAndExpr( -#line 2178 "cs.ATG" +#line 2179 "cs.ATG" ref Expression outExpr) { -#line 2179 "cs.ATG" +#line 2180 "cs.ATG" Expression expr; InclusiveOrExpr( -#line 2181 "cs.ATG" +#line 2182 "cs.ATG" ref outExpr); while (la.kind == 25) { lexer.NextToken(); UnaryExpr( -#line 2181 "cs.ATG" +#line 2182 "cs.ATG" out expr); InclusiveOrExpr( -#line 2181 "cs.ATG" +#line 2182 "cs.ATG" ref expr); -#line 2181 "cs.ATG" +#line 2182 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.LogicalAnd, expr); } } void InclusiveOrExpr( -#line 2184 "cs.ATG" +#line 2185 "cs.ATG" ref Expression outExpr) { -#line 2185 "cs.ATG" +#line 2186 "cs.ATG" Expression expr; ExclusiveOrExpr( -#line 2187 "cs.ATG" +#line 2188 "cs.ATG" ref outExpr); while (la.kind == 29) { lexer.NextToken(); UnaryExpr( -#line 2187 "cs.ATG" +#line 2188 "cs.ATG" out expr); ExclusiveOrExpr( -#line 2187 "cs.ATG" +#line 2188 "cs.ATG" ref expr); -#line 2187 "cs.ATG" +#line 2188 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.BitwiseOr, expr); } } void ExclusiveOrExpr( -#line 2190 "cs.ATG" +#line 2191 "cs.ATG" ref Expression outExpr) { -#line 2191 "cs.ATG" +#line 2192 "cs.ATG" Expression expr; AndExpr( -#line 2193 "cs.ATG" +#line 2194 "cs.ATG" ref outExpr); while (la.kind == 30) { lexer.NextToken(); UnaryExpr( -#line 2193 "cs.ATG" +#line 2194 "cs.ATG" out expr); AndExpr( -#line 2193 "cs.ATG" +#line 2194 "cs.ATG" ref expr); -#line 2193 "cs.ATG" +#line 2194 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.ExclusiveOr, expr); } } void AndExpr( -#line 2196 "cs.ATG" +#line 2197 "cs.ATG" ref Expression outExpr) { -#line 2197 "cs.ATG" +#line 2198 "cs.ATG" Expression expr; EqualityExpr( -#line 2199 "cs.ATG" +#line 2200 "cs.ATG" ref outExpr); while (la.kind == 28) { lexer.NextToken(); UnaryExpr( -#line 2199 "cs.ATG" +#line 2200 "cs.ATG" out expr); EqualityExpr( -#line 2199 "cs.ATG" +#line 2200 "cs.ATG" ref expr); -#line 2199 "cs.ATG" +#line 2200 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.BitwiseAnd, expr); } } void EqualityExpr( -#line 2202 "cs.ATG" +#line 2203 "cs.ATG" ref Expression outExpr) { -#line 2204 "cs.ATG" +#line 2205 "cs.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; RelationalExpr( -#line 2208 "cs.ATG" +#line 2209 "cs.ATG" ref outExpr); while (la.kind == 33 || la.kind == 34) { if (la.kind == 34) { lexer.NextToken(); -#line 2211 "cs.ATG" +#line 2212 "cs.ATG" op = BinaryOperatorType.InEquality; } else { lexer.NextToken(); -#line 2212 "cs.ATG" +#line 2213 "cs.ATG" op = BinaryOperatorType.Equality; } UnaryExpr( -#line 2214 "cs.ATG" +#line 2215 "cs.ATG" out expr); RelationalExpr( -#line 2214 "cs.ATG" +#line 2215 "cs.ATG" ref expr); -#line 2214 "cs.ATG" +#line 2215 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } } void RelationalExpr( -#line 2218 "cs.ATG" +#line 2219 "cs.ATG" ref Expression outExpr) { -#line 2220 "cs.ATG" +#line 2221 "cs.ATG" TypeReference type; Expression expr; BinaryOperatorType op = BinaryOperatorType.None; ShiftExpr( -#line 2225 "cs.ATG" +#line 2226 "cs.ATG" ref outExpr); while (StartOf(37)) { if (StartOf(38)) { if (la.kind == 23) { lexer.NextToken(); -#line 2227 "cs.ATG" +#line 2228 "cs.ATG" op = BinaryOperatorType.LessThan; } else if (la.kind == 22) { lexer.NextToken(); -#line 2228 "cs.ATG" +#line 2229 "cs.ATG" op = BinaryOperatorType.GreaterThan; } else if (la.kind == 36) { lexer.NextToken(); -#line 2229 "cs.ATG" +#line 2230 "cs.ATG" op = BinaryOperatorType.LessThanOrEqual; } else if (la.kind == 35) { lexer.NextToken(); -#line 2230 "cs.ATG" +#line 2231 "cs.ATG" op = BinaryOperatorType.GreaterThanOrEqual; } else SynErr(213); UnaryExpr( -#line 2232 "cs.ATG" +#line 2233 "cs.ATG" out expr); ShiftExpr( -#line 2233 "cs.ATG" +#line 2234 "cs.ATG" ref expr); -#line 2234 "cs.ATG" +#line 2235 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } else { if (la.kind == 85) { lexer.NextToken(); TypeWithRestriction( -#line 2237 "cs.ATG" +#line 2238 "cs.ATG" out type, false, false); if ( -#line 2238 "cs.ATG" +#line 2239 "cs.ATG" la.kind == Tokens.Question && !IsPossibleExpressionStart(Peek(1).kind)) { NullableQuestionMark( -#line 2239 "cs.ATG" +#line 2240 "cs.ATG" ref type); } -#line 2240 "cs.ATG" +#line 2241 "cs.ATG" outExpr = new TypeOfIsExpression(outExpr, type); } else if (la.kind == 50) { lexer.NextToken(); TypeWithRestriction( -#line 2242 "cs.ATG" +#line 2243 "cs.ATG" out type, false, false); if ( -#line 2243 "cs.ATG" +#line 2244 "cs.ATG" la.kind == Tokens.Question && !IsPossibleExpressionStart(Peek(1).kind)) { NullableQuestionMark( -#line 2244 "cs.ATG" +#line 2245 "cs.ATG" ref type); } -#line 2245 "cs.ATG" +#line 2246 "cs.ATG" outExpr = new CastExpression(type, outExpr, CastType.TryCast); } else SynErr(214); } @@ -5393,83 +5394,83 @@ ref type); } void ShiftExpr( -#line 2250 "cs.ATG" +#line 2251 "cs.ATG" ref Expression outExpr) { -#line 2252 "cs.ATG" +#line 2253 "cs.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; AdditiveExpr( -#line 2256 "cs.ATG" +#line 2257 "cs.ATG" ref outExpr); while (la.kind == 37 || -#line 2259 "cs.ATG" +#line 2260 "cs.ATG" IsShiftRight()) { if (la.kind == 37) { lexer.NextToken(); -#line 2258 "cs.ATG" +#line 2259 "cs.ATG" op = BinaryOperatorType.ShiftLeft; } else { Expect(22); Expect(22); -#line 2260 "cs.ATG" +#line 2261 "cs.ATG" op = BinaryOperatorType.ShiftRight; } UnaryExpr( -#line 2263 "cs.ATG" +#line 2264 "cs.ATG" out expr); AdditiveExpr( -#line 2263 "cs.ATG" +#line 2264 "cs.ATG" ref expr); -#line 2263 "cs.ATG" +#line 2264 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } } void AdditiveExpr( -#line 2267 "cs.ATG" +#line 2268 "cs.ATG" ref Expression outExpr) { -#line 2269 "cs.ATG" +#line 2270 "cs.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; MultiplicativeExpr( -#line 2273 "cs.ATG" +#line 2274 "cs.ATG" ref outExpr); while (la.kind == 4 || la.kind == 5) { if (la.kind == 4) { lexer.NextToken(); -#line 2276 "cs.ATG" +#line 2277 "cs.ATG" op = BinaryOperatorType.Add; } else { lexer.NextToken(); -#line 2277 "cs.ATG" +#line 2278 "cs.ATG" op = BinaryOperatorType.Subtract; } UnaryExpr( -#line 2279 "cs.ATG" +#line 2280 "cs.ATG" out expr); MultiplicativeExpr( -#line 2279 "cs.ATG" +#line 2280 "cs.ATG" ref expr); -#line 2279 "cs.ATG" +#line 2280 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } } void MultiplicativeExpr( -#line 2283 "cs.ATG" +#line 2284 "cs.ATG" ref Expression outExpr) { -#line 2285 "cs.ATG" +#line 2286 "cs.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; @@ -5477,124 +5478,124 @@ ref Expression outExpr) { if (la.kind == 6) { lexer.NextToken(); -#line 2291 "cs.ATG" +#line 2292 "cs.ATG" op = BinaryOperatorType.Multiply; } else if (la.kind == 7) { lexer.NextToken(); -#line 2292 "cs.ATG" +#line 2293 "cs.ATG" op = BinaryOperatorType.Divide; } else { lexer.NextToken(); -#line 2293 "cs.ATG" +#line 2294 "cs.ATG" op = BinaryOperatorType.Modulus; } UnaryExpr( -#line 2295 "cs.ATG" +#line 2296 "cs.ATG" out expr); -#line 2295 "cs.ATG" +#line 2296 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } } void VariantTypeParameter( -#line 2373 "cs.ATG" +#line 2374 "cs.ATG" out TemplateDefinition typeParameter) { -#line 2375 "cs.ATG" +#line 2376 "cs.ATG" typeParameter = new TemplateDefinition(); AttributeSection section; while (la.kind == 18) { AttributeSection( -#line 2379 "cs.ATG" +#line 2380 "cs.ATG" out section); -#line 2379 "cs.ATG" +#line 2380 "cs.ATG" typeParameter.Attributes.Add(section); } if (la.kind == 81 || la.kind == 93) { if (la.kind == 81) { lexer.NextToken(); -#line 2381 "cs.ATG" +#line 2382 "cs.ATG" typeParameter.VarianceModifier = VarianceModifier.Contravariant; } else { lexer.NextToken(); -#line 2382 "cs.ATG" +#line 2383 "cs.ATG" typeParameter.VarianceModifier = VarianceModifier.Covariant; } } Identifier(); -#line 2384 "cs.ATG" +#line 2385 "cs.ATG" typeParameter.Name = t.val; typeParameter.StartLocation = t.Location; -#line 2385 "cs.ATG" +#line 2386 "cs.ATG" typeParameter.EndLocation = t.EndLocation; } void TypeParameterConstraintsClauseBase( -#line 2416 "cs.ATG" +#line 2417 "cs.ATG" out TypeReference type) { -#line 2417 "cs.ATG" +#line 2418 "cs.ATG" TypeReference t; type = null; if (la.kind == 109) { lexer.NextToken(); -#line 2419 "cs.ATG" +#line 2420 "cs.ATG" type = TypeReference.StructConstraint; } else if (la.kind == 59) { lexer.NextToken(); -#line 2420 "cs.ATG" +#line 2421 "cs.ATG" type = TypeReference.ClassConstraint; } else if (la.kind == 89) { lexer.NextToken(); Expect(20); Expect(21); -#line 2421 "cs.ATG" +#line 2422 "cs.ATG" type = TypeReference.NewConstraint; } else if (StartOf(10)) { Type( -#line 2422 "cs.ATG" +#line 2423 "cs.ATG" out t); -#line 2422 "cs.ATG" +#line 2423 "cs.ATG" type = t; } else SynErr(215); } void QueryExpressionFromClause( -#line 2437 "cs.ATG" +#line 2438 "cs.ATG" out QueryExpressionFromClause fc) { -#line 2438 "cs.ATG" +#line 2439 "cs.ATG" fc = new QueryExpressionFromClause(); fc.StartLocation = la.Location; CollectionRangeVariable variable; Expect(137); QueryExpressionFromOrJoinClause( -#line 2444 "cs.ATG" +#line 2445 "cs.ATG" out variable); -#line 2445 "cs.ATG" +#line 2446 "cs.ATG" fc.EndLocation = t.EndLocation; fc.Sources.Add(variable); } void QueryExpressionBody( -#line 2481 "cs.ATG" +#line 2482 "cs.ATG" ref QueryExpression q) { -#line 2482 "cs.ATG" +#line 2483 "cs.ATG" QueryExpressionFromClause fromClause; QueryExpressionWhereClause whereClause; QueryExpressionLetClause letClause; QueryExpressionJoinClause joinClause; QueryExpressionOrderClause orderClause; @@ -5603,252 +5604,252 @@ ref QueryExpression q) { while (StartOf(39)) { if (la.kind == 137) { QueryExpressionFromClause( -#line 2488 "cs.ATG" +#line 2489 "cs.ATG" out fromClause); -#line 2488 "cs.ATG" +#line 2489 "cs.ATG" SafeAdd(q, q.MiddleClauses, fromClause); } else if (la.kind == 127) { QueryExpressionWhereClause( -#line 2489 "cs.ATG" +#line 2490 "cs.ATG" out whereClause); -#line 2489 "cs.ATG" +#line 2490 "cs.ATG" SafeAdd(q, q.MiddleClauses, whereClause); } else if (la.kind == 141) { QueryExpressionLetClause( -#line 2490 "cs.ATG" +#line 2491 "cs.ATG" out letClause); -#line 2490 "cs.ATG" +#line 2491 "cs.ATG" SafeAdd(q, q.MiddleClauses, letClause); } else if (la.kind == 142) { QueryExpressionJoinClause( -#line 2491 "cs.ATG" +#line 2492 "cs.ATG" out joinClause); -#line 2491 "cs.ATG" +#line 2492 "cs.ATG" SafeAdd(q, q.MiddleClauses, joinClause); } else { QueryExpressionOrderByClause( -#line 2492 "cs.ATG" +#line 2493 "cs.ATG" out orderClause); -#line 2492 "cs.ATG" +#line 2493 "cs.ATG" SafeAdd(q, q.MiddleClauses, orderClause); } } if (la.kind == 133) { QueryExpressionSelectClause( -#line 2494 "cs.ATG" +#line 2495 "cs.ATG" out selectClause); -#line 2494 "cs.ATG" +#line 2495 "cs.ATG" q.SelectOrGroupClause = selectClause; } else if (la.kind == 134) { QueryExpressionGroupClause( -#line 2495 "cs.ATG" +#line 2496 "cs.ATG" out groupClause); -#line 2495 "cs.ATG" +#line 2496 "cs.ATG" q.SelectOrGroupClause = groupClause; } else SynErr(216); if (la.kind == 136) { QueryExpressionIntoClause( -#line 2497 "cs.ATG" +#line 2498 "cs.ATG" ref q); } } void QueryExpressionFromOrJoinClause( -#line 2471 "cs.ATG" +#line 2472 "cs.ATG" out CollectionRangeVariable variable) { -#line 2472 "cs.ATG" +#line 2473 "cs.ATG" TypeReference type; Expression expr; variable = new CollectionRangeVariable(); -#line 2474 "cs.ATG" +#line 2475 "cs.ATG" variable.Type = null; if ( -#line 2475 "cs.ATG" +#line 2476 "cs.ATG" IsLocalVarDecl()) { Type( -#line 2475 "cs.ATG" +#line 2476 "cs.ATG" out type); -#line 2475 "cs.ATG" +#line 2476 "cs.ATG" variable.Type = type; } Identifier(); -#line 2476 "cs.ATG" +#line 2477 "cs.ATG" variable.Identifier = t.val; Expect(81); Expr( -#line 2478 "cs.ATG" +#line 2479 "cs.ATG" out expr); -#line 2478 "cs.ATG" +#line 2479 "cs.ATG" variable.Expression = expr; } void QueryExpressionJoinClause( -#line 2450 "cs.ATG" +#line 2451 "cs.ATG" out QueryExpressionJoinClause jc) { -#line 2451 "cs.ATG" +#line 2452 "cs.ATG" jc = new QueryExpressionJoinClause(); jc.StartLocation = la.Location; Expression expr; CollectionRangeVariable variable; Expect(142); QueryExpressionFromOrJoinClause( -#line 2457 "cs.ATG" +#line 2458 "cs.ATG" out variable); Expect(143); Expr( -#line 2459 "cs.ATG" +#line 2460 "cs.ATG" out expr); -#line 2459 "cs.ATG" +#line 2460 "cs.ATG" jc.OnExpression = expr; Expect(144); Expr( -#line 2461 "cs.ATG" +#line 2462 "cs.ATG" out expr); -#line 2461 "cs.ATG" +#line 2462 "cs.ATG" jc.EqualsExpression = expr; if (la.kind == 136) { lexer.NextToken(); Identifier(); -#line 2463 "cs.ATG" +#line 2464 "cs.ATG" jc.IntoIdentifier = t.val; } -#line 2466 "cs.ATG" +#line 2467 "cs.ATG" jc.EndLocation = t.EndLocation; jc.Source = variable; } void QueryExpressionWhereClause( -#line 2500 "cs.ATG" +#line 2501 "cs.ATG" out QueryExpressionWhereClause wc) { -#line 2501 "cs.ATG" +#line 2502 "cs.ATG" Expression expr; wc = new QueryExpressionWhereClause(); wc.StartLocation = la.Location; Expect(127); Expr( -#line 2504 "cs.ATG" +#line 2505 "cs.ATG" out expr); -#line 2504 "cs.ATG" +#line 2505 "cs.ATG" wc.Condition = expr; -#line 2505 "cs.ATG" +#line 2506 "cs.ATG" wc.EndLocation = t.EndLocation; } void QueryExpressionLetClause( -#line 2508 "cs.ATG" +#line 2509 "cs.ATG" out QueryExpressionLetClause wc) { -#line 2509 "cs.ATG" +#line 2510 "cs.ATG" Expression expr; wc = new QueryExpressionLetClause(); wc.StartLocation = la.Location; Expect(141); Identifier(); -#line 2512 "cs.ATG" +#line 2513 "cs.ATG" wc.Identifier = t.val; Expect(3); Expr( -#line 2514 "cs.ATG" +#line 2515 "cs.ATG" out expr); -#line 2514 "cs.ATG" +#line 2515 "cs.ATG" wc.Expression = expr; -#line 2515 "cs.ATG" +#line 2516 "cs.ATG" wc.EndLocation = t.EndLocation; } void QueryExpressionOrderByClause( -#line 2518 "cs.ATG" +#line 2519 "cs.ATG" out QueryExpressionOrderClause oc) { -#line 2519 "cs.ATG" +#line 2520 "cs.ATG" QueryExpressionOrdering ordering; oc = new QueryExpressionOrderClause(); oc.StartLocation = la.Location; Expect(140); QueryExpressionOrdering( -#line 2522 "cs.ATG" +#line 2523 "cs.ATG" out ordering); -#line 2522 "cs.ATG" +#line 2523 "cs.ATG" SafeAdd(oc, oc.Orderings, ordering); while (la.kind == 14) { lexer.NextToken(); QueryExpressionOrdering( -#line 2524 "cs.ATG" +#line 2525 "cs.ATG" out ordering); -#line 2524 "cs.ATG" +#line 2525 "cs.ATG" SafeAdd(oc, oc.Orderings, ordering); } -#line 2526 "cs.ATG" +#line 2527 "cs.ATG" oc.EndLocation = t.EndLocation; } void QueryExpressionSelectClause( -#line 2539 "cs.ATG" +#line 2540 "cs.ATG" out QueryExpressionSelectClause sc) { -#line 2540 "cs.ATG" +#line 2541 "cs.ATG" Expression expr; sc = new QueryExpressionSelectClause(); sc.StartLocation = la.Location; Expect(133); Expr( -#line 2543 "cs.ATG" +#line 2544 "cs.ATG" out expr); -#line 2543 "cs.ATG" +#line 2544 "cs.ATG" sc.Projection = expr; -#line 2544 "cs.ATG" +#line 2545 "cs.ATG" sc.EndLocation = t.EndLocation; } void QueryExpressionGroupClause( -#line 2547 "cs.ATG" +#line 2548 "cs.ATG" out QueryExpressionGroupClause gc) { -#line 2548 "cs.ATG" +#line 2549 "cs.ATG" Expression expr; gc = new QueryExpressionGroupClause(); gc.StartLocation = la.Location; Expect(134); Expr( -#line 2551 "cs.ATG" +#line 2552 "cs.ATG" out expr); -#line 2551 "cs.ATG" +#line 2552 "cs.ATG" gc.Projection = expr; Expect(135); Expr( -#line 2553 "cs.ATG" +#line 2554 "cs.ATG" out expr); -#line 2553 "cs.ATG" +#line 2554 "cs.ATG" gc.GroupBy = expr; -#line 2554 "cs.ATG" +#line 2555 "cs.ATG" gc.EndLocation = t.EndLocation; } void QueryExpressionIntoClause( -#line 2557 "cs.ATG" +#line 2558 "cs.ATG" ref QueryExpression q) { -#line 2558 "cs.ATG" +#line 2559 "cs.ATG" QueryExpression firstQuery = q; QueryExpression continuedQuery = new QueryExpression(); continuedQuery.StartLocation = q.StartLocation; @@ -5865,43 +5866,43 @@ ref QueryExpression q) { Expect(136); Identifier(); -#line 2573 "cs.ATG" +#line 2574 "cs.ATG" fromVariable.Identifier = t.val; -#line 2574 "cs.ATG" +#line 2575 "cs.ATG" continuedQuery.FromClause.EndLocation = t.EndLocation; QueryExpressionBody( -#line 2575 "cs.ATG" +#line 2576 "cs.ATG" ref q); } void QueryExpressionOrdering( -#line 2529 "cs.ATG" +#line 2530 "cs.ATG" out QueryExpressionOrdering ordering) { -#line 2530 "cs.ATG" +#line 2531 "cs.ATG" Expression expr; ordering = new QueryExpressionOrdering(); ordering.StartLocation = la.Location; Expr( -#line 2532 "cs.ATG" +#line 2533 "cs.ATG" out expr); -#line 2532 "cs.ATG" +#line 2533 "cs.ATG" ordering.Criteria = expr; if (la.kind == 138 || la.kind == 139) { if (la.kind == 138) { lexer.NextToken(); -#line 2533 "cs.ATG" +#line 2534 "cs.ATG" ordering.Direction = QueryExpressionOrderingDirection.Ascending; } else { lexer.NextToken(); -#line 2534 "cs.ATG" +#line 2535 "cs.ATG" ordering.Direction = QueryExpressionOrderingDirection.Descending; } } -#line 2536 "cs.ATG" +#line 2537 "cs.ATG" ordering.EndLocation = t.EndLocation; } diff --git a/src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG b/src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG index fa338f7490..e682976a43 100644 --- a/src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG +++ b/src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG @@ -1458,13 +1458,14 @@ ObjectPropertyInitializerOrVariableInitializer = ( IF (IdentAndAsgn()) Identifier - (. NamedArgumentExpression nae = new NamedArgumentExpression(t.val, null); - nae.StartLocation = t.Location; + (. MemberInitializerExpression mie = new MemberInitializerExpression(t.val, null); + mie.StartLocation = t.Location; + mie.IsKey = true; Expression r = null; .) "=" ( CollectionOrObjectInitializer - | VariableInitializer ) - (. nae.Expression = r; nae.EndLocation = t.EndLocation; expr = nae; .) + | VariableInitializer ) + (. mie.Expression = r; mie.EndLocation = t.EndLocation; expr = mie; .) | VariableInitializer ) diff --git a/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Experimental/Parser.cs b/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Experimental/Parser.cs new file mode 100644 index 0000000000..3ad64234b6 --- /dev/null +++ b/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Experimental/Parser.cs @@ -0,0 +1,780 @@ +using System.Collections; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Text; +using ICSharpCode.NRefactory.Ast; +using ICSharpCode.NRefactory.Parser.VB; +using ASTAttribute = ICSharpCode.NRefactory.Ast.Attribute; +using ICSharpCode.NRefactory.Parser.VBNet.Experimental; + + + +using System; + +namespace ICSharpCode.NRefactory.Parser.VBNet.Experimental { + + + +public partial class Parser { + public const int _EOF = 0; + public const int _EOL = 1; + public const int _ident = 2; + public const int _LiteralString = 3; + public const int _LiteralCharacter = 4; + public const int _LiteralInteger = 5; + public const int _LiteralDouble = 6; + public const int _LiteralSingle = 7; + public const int _LiteralDecimal = 8; + public const int _LiteralDate = 9; + public const int maxT = 222; + + const bool T = true; + const bool x = false; + const int minErrDist = 2; + + public ILexer lexer; + public Errors errors; + + public Parser(ILexer lexer) + { + this.lexer = lexer; + this.errors = new Errors(); + } + + public Token t; // last recognized token + public Token la; // lookahead token + int errDist = minErrDist; + + + + void SynErr (int n) { + if (errDist >= minErrDist) errors.SynErr(la.line, la.col, n); + errDist = 0; + } + + public void SemErr (string msg) { + if (errDist >= minErrDist) errors.SemErr(t.line, t.col, msg); + errDist = 0; + } + + void Get () { + for (;;) { + t = la; + la = lexer.NextToken(); + if (la.kind <= maxT) { ++errDist; break; } + + la = t; + } + } + + void Expect (int n) { + if (la.kind==n) Get(); else { SynErr(n); } + } + + bool StartOf (int s) { + return set[s, la.kind]; + } + + void ExpectWeak (int n, int follow) { + if (la.kind == n) Get(); + else { + SynErr(n); + while (!StartOf(follow)) Get(); + } + } + + + bool WeakSeparator(int n, int syFol, int repFol) { + int kind = la.kind; + if (kind == n) {Get(); return true;} + else if (StartOf(repFol)) {return false;} + else { + SynErr(n); + while (!(set[syFol, kind] || set[repFol, kind] || set[0, kind])) { + Get(); + kind = la.kind; + } + return StartOf(syFol); + } + } + + + void ParserHelper() { + while (la.kind == 159) { + OptionStatement(); + } + while (la.kind == 124) { + ImportsStatement(); + } + while (la.kind == 1 || la.kind == 28) { + AttributeBlock(); + } + while (StartOf(1)) { + NamespaceMemberDeclaration(); + } + } + + void OptionStatement() { + Expect(159); + while (StartOf(2)) { + Get(); + } + StatementTerminator(); + } + + void ImportsStatement() { + Expect(124); + while (StartOf(2)) { + Get(); + } + StatementTerminator(); + } + + void AttributeBlock() { + Attribute(); + while (la.kind == 1 || la.kind == 28) { + Attribute(); + } + StatementTerminator(); + } + + void NamespaceMemberDeclaration() { + if (la.kind == 146) { + NamespaceDeclaration(); + } else if (StartOf(3)) { + TypeDeclaration(); + } else SynErr(223); + } + + void StatementTerminator() { + if (la.kind == 1) { + Get(); + } else if (la.kind == 11) { + Get(); + } else SynErr(224); + } + + void Attribute() { + if (la.kind == 1) { + Get(); + } + Expect(28); + while (StartOf(4)) { + Get(); + } + Expect(27); + if (la.kind == 1) { + Get(); + } + } + + void NamespaceDeclaration() { + Expect(146); + while (StartOf(2)) { + Get(); + } + StatementTerminator(); + while (StartOf(1)) { + NamespaceMemberDeclaration(); + } + Expect(100); + Expect(146); + StatementTerminator(); + } + + void TypeDeclaration() { + while (la.kind == 1 || la.kind == 28) { + AttributeBlock(); + } + while (StartOf(5)) { + TypeModifier(); + } + Expect(141); + while (StartOf(2)) { + Get(); + } + StatementTerminator(); + PushContext(Context.Type); + while (StartOf(6)) { + ModuleMemberDeclaration(); + } + Expect(100); + Expect(141); + StatementTerminator(); + PopContext(); + } + + void TypeModifier() { + if (StartOf(7)) { + AccessModifier(); + } else if (la.kind == 184) { + Get(); + } else SynErr(225); + } + + void ModuleMemberDeclaration() { + PushContext(Context.Member); + SubOrFunctionDeclaration(); + PopContext(); + } + + void SubOrFunctionDeclaration() { + while (la.kind == 1 || la.kind == 28) { + AttributeBlock(); + } + while (StartOf(8)) { + MemberModifier(); + } + if (la.kind == 195) { + Get(); + } else if (la.kind == 114) { + Get(); + } else SynErr(226); + PushContext(Context.IdentifierExpected); + Get(); + PopContext(); + if (la.kind == 25) { + Get(); + if (StartOf(9)) { + ParameterList(); + } + Expect(26); + } + Expect(1); + if (la.kind == 1) { + Block(); + } + Expect(100); + if (la.kind == 195) { + Get(); + } else if (la.kind == 114) { + Get(); + } else SynErr(227); + StatementTerminator(); + } + + void MemberModifier() { + switch (la.kind) { + case 112: case 170: case 172: case 173: { + AccessModifier(); + break; + } + case 184: { + Get(); + break; + } + case 185: { + Get(); + break; + } + case 165: { + Get(); + break; + } + case 153: { + Get(); + break; + } + case 166: { + Get(); + break; + } + case 164: { + Get(); + break; + } + case 168: { + Get(); + break; + } + default: SynErr(228); break; + } + } + + void ParameterList() { + Parameter(); + while (la.kind == 12) { + Get(); + Parameter(); + } + } + + void Block() { + Expect(1); + } + + void Parameter() { + while (la.kind == 1 || la.kind == 28) { + AttributeBlock(); + } + while (StartOf(10)) { + ParameterModifier(); + } + Identifier(); + if (la.kind == 50) { + Get(); + Get(); + } + if (la.kind == 10) { + Get(); + while (StartOf(11)) { + Get(); + } + } + } + + void ParameterModifier() { + if (la.kind == 59) { + Get(); + } else if (la.kind == 56) { + Get(); + } else if (la.kind == 160) { + Get(); + } else if (la.kind == 167) { + Get(); + } else SynErr(229); + } + + void Identifier() { + PushContext(Context.IdentifierExpected); + if (StartOf(12)) { + IdentifierForFieldDeclaration(); + } else if (la.kind == 85) { + Get(); + } else SynErr(230); + PopContext(); + } + + void IdentifierForFieldDeclaration() { + switch (la.kind) { + case 2: { + Get(); + break; + } + case 45: { + Get(); + break; + } + case 49: { + Get(); + break; + } + case 51: { + Get(); + break; + } + case 52: { + Get(); + break; + } + case 53: { + Get(); + break; + } + case 54: { + Get(); + break; + } + case 57: { + Get(); + break; + } + case 74: { + Get(); + break; + } + case 91: { + Get(); + break; + } + case 94: { + Get(); + break; + } + case 103: { + Get(); + break; + } + case 108: { + Get(); + break; + } + case 113: { + Get(); + break; + } + case 120: { + Get(); + break; + } + case 126: { + Get(); + break; + } + case 130: { + Get(); + break; + } + case 133: { + Get(); + break; + } + case 156: { + Get(); + break; + } + case 162: { + Get(); + break; + } + case 169: { + Get(); + break; + } + case 188: { + Get(); + break; + } + case 197: { + Get(); + break; + } + case 198: { + Get(); + break; + } + case 208: { + Get(); + break; + } + case 209: { + Get(); + break; + } + case 215: { + Get(); + break; + } + default: SynErr(231); break; + } + } + + void AccessModifier() { + if (la.kind == 173) { + Get(); + } else if (la.kind == 112) { + Get(); + } else if (la.kind == 172) { + Get(); + if (la.kind == 112) { + Get(); + } + } else if (la.kind == 170) { + Get(); + } else SynErr(232); + } + + + + public void Parse() { + PushContext(Context.Global); + la = new Token(1, 1, 1); + Get(); + ParserHelper(); + + Expect(0); + PopContext(); + } + + static readonly bool[,] set = { + {T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,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, 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,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,T,x, T,T,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,T,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, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,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, 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,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,T,x, T,T,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,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,x, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,x}, + {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, 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, 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,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, 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,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, T,T,T,x, T,x,T,x, T,T,x,x, x,x,x,x, x,x,x,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, 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,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, 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,T,x,x, x,x,x,x, x,x,x,x, T,T,T,x, T,x,T,x, T,T,x,x, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,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, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,T,x,T, T,T,T,x, T,T,x,T, 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,x,x, x,x,x,T, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, T,x,x,x, x,T,x,x, x,x,x,x, T,x,x,x, x,x,T,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, T,x,x,x, T,x,T,x, x,x,x,T, 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,x, x,T,T,x, x,x,x,x, x,x,x,x, T,T,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, 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,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, 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,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,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,x}, + {x,x,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,T,x,x, x,T,x,T, T,T,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, T,x,x,x, x,T,x,x, x,x,x,x, T,x,x,x, x,x,T,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, 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,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,T,T,x, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,T, x,x,x,x, x,x,x,x} + + }; +} // end Parser + + +public class Errors { + public int count = 0; // number of errors detected + public System.IO.TextWriter errorStream = Console.Out; // error messages go to this stream + public string errMsgFormat = "-- line {0} col {1}: {2}"; // 0=line, 1=column, 2=text + + public void SynErr (int line, int col, int n) { + string s; + switch (n) { + case 0: s = "EOF expected"; break; + case 1: s = "EOL expected"; break; + case 2: s = "ident expected"; break; + case 3: s = "LiteralString expected"; break; + case 4: s = "LiteralCharacter expected"; break; + case 5: s = "LiteralInteger expected"; break; + case 6: s = "LiteralDouble expected"; break; + case 7: s = "LiteralSingle expected"; break; + case 8: s = "LiteralDecimal expected"; break; + case 9: s = "LiteralDate expected"; break; + case 10: s = "\"=\" expected"; break; + case 11: s = "\":\" expected"; break; + case 12: s = "\",\" expected"; break; + case 13: s = "\"&\" expected"; break; + case 14: s = "\"/\" expected"; break; + case 15: s = "\"\\\\\" expected"; break; + case 16: s = "\".\" expected"; break; + case 17: s = "\"!\" expected"; break; + case 18: s = "\"-\" expected"; break; + case 19: s = "\"+\" expected"; break; + case 20: s = "\"^\" expected"; break; + case 21: s = "\"?\" expected"; break; + case 22: s = "\"*\" expected"; break; + case 23: s = "\"{\" expected"; break; + case 24: s = "\"}\" expected"; break; + case 25: s = "\"(\" expected"; break; + case 26: s = "\")\" expected"; break; + case 27: s = "\">\" expected"; break; + case 28: s = "\"<\" expected"; break; + case 29: s = "\"<>\" expected"; break; + case 30: s = "\">=\" expected"; break; + case 31: s = "\"<=\" expected"; break; + case 32: s = "\"<<\" expected"; break; + case 33: s = "\">>\" expected"; break; + case 34: s = "\"+=\" expected"; break; + case 35: s = "\"^=\" expected"; break; + case 36: s = "\"-=\" expected"; break; + case 37: s = "\"*=\" expected"; break; + case 38: s = "\"/=\" expected"; break; + case 39: s = "\"\\\\=\" expected"; break; + case 40: s = "\"<<=\" expected"; break; + case 41: s = "\">>=\" expected"; break; + case 42: s = "\"&=\" expected"; break; + case 43: s = "\"AddHandler\" expected"; break; + case 44: s = "\"AddressOf\" expected"; break; + case 45: s = "\"Aggregate\" expected"; break; + case 46: s = "\"Alias\" expected"; break; + case 47: s = "\"And\" expected"; break; + case 48: s = "\"AndAlso\" expected"; break; + case 49: s = "\"Ansi\" expected"; break; + case 50: s = "\"As\" expected"; break; + case 51: s = "\"Ascending\" expected"; break; + case 52: s = "\"Assembly\" expected"; break; + case 53: s = "\"Auto\" expected"; break; + case 54: s = "\"Binary\" expected"; break; + case 55: s = "\"Boolean\" expected"; break; + case 56: s = "\"ByRef\" expected"; break; + case 57: s = "\"By\" expected"; break; + case 58: s = "\"Byte\" expected"; break; + case 59: s = "\"ByVal\" expected"; break; + case 60: s = "\"Call\" expected"; break; + case 61: s = "\"Case\" expected"; break; + case 62: s = "\"Catch\" expected"; break; + case 63: s = "\"CBool\" expected"; break; + case 64: s = "\"CByte\" expected"; break; + case 65: s = "\"CChar\" expected"; break; + case 66: s = "\"CDate\" expected"; break; + case 67: s = "\"CDbl\" expected"; break; + case 68: s = "\"CDec\" expected"; break; + case 69: s = "\"Char\" expected"; break; + case 70: s = "\"CInt\" expected"; break; + case 71: s = "\"Class\" expected"; break; + case 72: s = "\"CLng\" expected"; break; + case 73: s = "\"CObj\" expected"; break; + case 74: s = "\"Compare\" expected"; break; + case 75: s = "\"Const\" expected"; break; + case 76: s = "\"Continue\" expected"; break; + case 77: s = "\"CSByte\" expected"; break; + case 78: s = "\"CShort\" expected"; break; + case 79: s = "\"CSng\" expected"; break; + case 80: s = "\"CStr\" expected"; break; + case 81: s = "\"CType\" expected"; break; + case 82: s = "\"CUInt\" expected"; break; + case 83: s = "\"CULng\" expected"; break; + case 84: s = "\"CUShort\" expected"; break; + case 85: s = "\"Custom\" expected"; break; + case 86: s = "\"Date\" expected"; break; + case 87: s = "\"Decimal\" expected"; break; + case 88: s = "\"Declare\" expected"; break; + case 89: s = "\"Default\" expected"; break; + case 90: s = "\"Delegate\" expected"; break; + case 91: s = "\"Descending\" expected"; break; + case 92: s = "\"Dim\" expected"; break; + case 93: s = "\"DirectCast\" expected"; break; + case 94: s = "\"Distinct\" expected"; break; + case 95: s = "\"Do\" expected"; break; + case 96: s = "\"Double\" expected"; break; + case 97: s = "\"Each\" expected"; break; + case 98: s = "\"Else\" expected"; break; + case 99: s = "\"ElseIf\" expected"; break; + case 100: s = "\"End\" expected"; break; + case 101: s = "\"EndIf\" expected"; break; + case 102: s = "\"Enum\" expected"; break; + case 103: s = "\"Equals\" expected"; break; + case 104: s = "\"Erase\" expected"; break; + case 105: s = "\"Error\" expected"; break; + case 106: s = "\"Event\" expected"; break; + case 107: s = "\"Exit\" expected"; break; + case 108: s = "\"Explicit\" expected"; break; + case 109: s = "\"False\" expected"; break; + case 110: s = "\"Finally\" expected"; break; + case 111: s = "\"For\" expected"; break; + case 112: s = "\"Friend\" expected"; break; + case 113: s = "\"From\" expected"; break; + case 114: s = "\"Function\" expected"; break; + case 115: s = "\"Get\" expected"; break; + case 116: s = "\"GetType\" expected"; break; + case 117: s = "\"Global\" expected"; break; + case 118: s = "\"GoSub\" expected"; break; + case 119: s = "\"GoTo\" expected"; break; + case 120: s = "\"Group\" expected"; break; + case 121: s = "\"Handles\" expected"; break; + case 122: s = "\"If\" expected"; break; + case 123: s = "\"Implements\" expected"; break; + case 124: s = "\"Imports\" expected"; break; + case 125: s = "\"In\" expected"; break; + case 126: s = "\"Infer\" expected"; break; + case 127: s = "\"Inherits\" expected"; break; + case 128: s = "\"Integer\" expected"; break; + case 129: s = "\"Interface\" expected"; break; + case 130: s = "\"Into\" expected"; break; + case 131: s = "\"Is\" expected"; break; + case 132: s = "\"IsNot\" expected"; break; + case 133: s = "\"Join\" expected"; break; + case 134: s = "\"Let\" expected"; break; + case 135: s = "\"Lib\" expected"; break; + case 136: s = "\"Like\" expected"; break; + case 137: s = "\"Long\" expected"; break; + case 138: s = "\"Loop\" expected"; break; + case 139: s = "\"Me\" expected"; break; + case 140: s = "\"Mod\" expected"; break; + case 141: s = "\"Module\" expected"; break; + case 142: s = "\"MustInherit\" expected"; break; + case 143: s = "\"MustOverride\" expected"; break; + case 144: s = "\"MyBase\" expected"; break; + case 145: s = "\"MyClass\" expected"; break; + case 146: s = "\"Namespace\" expected"; break; + case 147: s = "\"Narrowing\" expected"; break; + case 148: s = "\"New\" expected"; break; + case 149: s = "\"Next\" expected"; break; + case 150: s = "\"Not\" expected"; break; + case 151: s = "\"Nothing\" expected"; break; + case 152: s = "\"NotInheritable\" expected"; break; + case 153: s = "\"NotOverridable\" expected"; break; + case 154: s = "\"Object\" expected"; break; + case 155: s = "\"Of\" expected"; break; + case 156: s = "\"Off\" expected"; break; + case 157: s = "\"On\" expected"; break; + case 158: s = "\"Operator\" expected"; break; + case 159: s = "\"Option\" expected"; break; + case 160: s = "\"Optional\" expected"; break; + case 161: s = "\"Or\" expected"; break; + case 162: s = "\"Order\" expected"; break; + case 163: s = "\"OrElse\" expected"; break; + case 164: s = "\"Overloads\" expected"; break; + case 165: s = "\"Overridable\" expected"; break; + case 166: s = "\"Overrides\" expected"; break; + case 167: s = "\"ParamArray\" expected"; break; + case 168: s = "\"Partial\" expected"; break; + case 169: s = "\"Preserve\" expected"; break; + case 170: s = "\"Private\" expected"; break; + case 171: s = "\"Property\" expected"; break; + case 172: s = "\"Protected\" expected"; break; + case 173: s = "\"Public\" expected"; break; + case 174: s = "\"RaiseEvent\" expected"; break; + case 175: s = "\"ReadOnly\" expected"; break; + case 176: s = "\"ReDim\" expected"; break; + case 177: s = "\"Rem\" expected"; break; + case 178: s = "\"RemoveHandler\" expected"; break; + case 179: s = "\"Resume\" expected"; break; + case 180: s = "\"Return\" expected"; break; + case 181: s = "\"SByte\" expected"; break; + case 182: s = "\"Select\" expected"; break; + case 183: s = "\"Set\" expected"; break; + case 184: s = "\"Shadows\" expected"; break; + case 185: s = "\"Shared\" expected"; break; + case 186: s = "\"Short\" expected"; break; + case 187: s = "\"Single\" expected"; break; + case 188: s = "\"Skip\" expected"; break; + case 189: s = "\"Static\" expected"; break; + case 190: s = "\"Step\" expected"; break; + case 191: s = "\"Stop\" expected"; break; + case 192: s = "\"Strict\" expected"; break; + case 193: s = "\"String\" expected"; break; + case 194: s = "\"Structure\" expected"; break; + case 195: s = "\"Sub\" expected"; break; + case 196: s = "\"SyncLock\" expected"; break; + case 197: s = "\"Take\" expected"; break; + case 198: s = "\"Text\" expected"; break; + case 199: s = "\"Then\" expected"; break; + case 200: s = "\"Throw\" expected"; break; + case 201: s = "\"To\" expected"; break; + case 202: s = "\"True\" expected"; break; + case 203: s = "\"Try\" expected"; break; + case 204: s = "\"TryCast\" expected"; break; + case 205: s = "\"TypeOf\" expected"; break; + case 206: s = "\"UInteger\" expected"; break; + case 207: s = "\"ULong\" expected"; break; + case 208: s = "\"Unicode\" expected"; break; + case 209: s = "\"Until\" expected"; break; + case 210: s = "\"UShort\" expected"; break; + case 211: s = "\"Using\" expected"; break; + case 212: s = "\"Variant\" expected"; break; + case 213: s = "\"Wend\" expected"; break; + case 214: s = "\"When\" expected"; break; + case 215: s = "\"Where\" expected"; break; + case 216: s = "\"While\" expected"; break; + case 217: s = "\"Widening\" expected"; break; + case 218: s = "\"With\" expected"; break; + case 219: s = "\"WithEvents\" expected"; break; + case 220: s = "\"WriteOnly\" expected"; break; + case 221: s = "\"Xor\" expected"; break; + case 222: s = "??? expected"; break; + case 223: s = "invalid NamespaceMemberDeclaration"; break; + case 224: s = "invalid StatementTerminator"; break; + case 225: s = "invalid TypeModifier"; break; + case 226: s = "invalid SubOrFunctionDeclaration"; break; + case 227: s = "invalid SubOrFunctionDeclaration"; break; + case 228: s = "invalid MemberModifier"; break; + case 229: s = "invalid ParameterModifier"; break; + case 230: s = "invalid Identifier"; break; + case 231: s = "invalid IdentifierForFieldDeclaration"; break; + case 232: s = "invalid AccessModifier"; break; + + default: s = "error " + n; break; + } + errorStream.WriteLine(errMsgFormat, line, col, s); + count++; + } + + public void SemErr (int line, int col, string s) { + errorStream.WriteLine(errMsgFormat, line, col, s); + count++; + } + + public void SemErr (string s) { + errorStream.WriteLine(s); + count++; + } + + public void Warning (int line, int col, string s) { + errorStream.WriteLine(errMsgFormat, line, col, s); + } + + public void Warning(string s) { + errorStream.WriteLine(s); + } +} // Errors + + +public class FatalError: Exception { + public FatalError(string m): base(m) {} +} + +} \ No newline at end of file diff --git a/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Experimental/Parser.frame b/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Experimental/Parser.frame new file mode 100644 index 0000000000..24b844d4e9 --- /dev/null +++ b/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Experimental/Parser.frame @@ -0,0 +1,161 @@ +/*---------------------------------------------------------------------- +Compiler Generator Coco/R, +Copyright (c) 1990, 2004 Hanspeter Moessenboeck, University of Linz +extended by M. Loeberbauer & A. Woess, Univ. of Linz +with improvements by Pat Terry, Rhodes University + +This program is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +As an exception, it is allowed to write an extension of Coco/R that is +used as a plugin in non-free software. + +If not otherwise stated, any source code generated by Coco/R (other than +Coco/R itself) does not fall under the GNU General Public License. +----------------------------------------------------------------------*/ +-->begin +using System; + +-->namespace + +public partial class Parser { +-->constants + const bool T = true; + const bool x = false; + const int minErrDist = 2; + + public ILexer lexer; + public Errors errors; + + public Parser(ILexer lexer) + { + this.lexer = lexer; + this.errors = new Errors(); + } + + public Token t; // last recognized token + public Token la; // lookahead token + int errDist = minErrDist; + +-->declarations + + void SynErr (int n) { + if (errDist >= minErrDist) errors.SynErr(la.line, la.col, n); + errDist = 0; + } + + public void SemErr (string msg) { + if (errDist >= minErrDist) errors.SemErr(t.line, t.col, msg); + errDist = 0; + } + + void Get () { + for (;;) { + t = la; + la = lexer.NextToken(); + if (la.kind <= maxT) { ++errDist; break; } +-->pragmas + la = t; + } + } + + void Expect (int n) { + if (la.kind==n) Get(); else { SynErr(n); } + } + + bool StartOf (int s) { + return set[s, la.kind]; + } + + void ExpectWeak (int n, int follow) { + if (la.kind == n) Get(); + else { + SynErr(n); + while (!StartOf(follow)) Get(); + } + } + + + bool WeakSeparator(int n, int syFol, int repFol) { + int kind = la.kind; + if (kind == n) {Get(); return true;} + else if (StartOf(repFol)) {return false;} + else { + SynErr(n); + while (!(set[syFol, kind] || set[repFol, kind] || set[0, kind])) { + Get(); + kind = la.kind; + } + return StartOf(syFol); + } + } + + +-->productions + + public void Parse() { + PushContext(Context.Global); + la = new Token(1, 1, 1); + Get(); +-->parseRoot + Expect(0); + PopContext(); + } + + static readonly bool[,] set = { +-->initialization + }; +} // end Parser + + +public class Errors { + public int count = 0; // number of errors detected + public System.IO.TextWriter errorStream = Console.Out; // error messages go to this stream + public string errMsgFormat = "-- line {0} col {1}: {2}"; // 0=line, 1=column, 2=text + + public void SynErr (int line, int col, int n) { + string s; + switch (n) { +-->errors + default: s = "error " + n; break; + } + errorStream.WriteLine(errMsgFormat, line, col, s); + count++; + } + + public void SemErr (int line, int col, string s) { + errorStream.WriteLine(errMsgFormat, line, col, s); + count++; + } + + public void SemErr (string s) { + errorStream.WriteLine(s); + count++; + } + + public void Warning (int line, int col, string s) { + errorStream.WriteLine(errMsgFormat, line, col, s); + } + + public void Warning(string s) { + errorStream.WriteLine(s); + } +} // Errors + + +public class FatalError: Exception { + public FatalError(string m): base(m) {} +} + +$$$ \ No newline at end of file diff --git a/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Experimental/ParserHelper.atg b/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Experimental/ParserHelper.atg new file mode 100644 index 0000000000..6a3faacfd6 --- /dev/null +++ b/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Experimental/ParserHelper.atg @@ -0,0 +1,390 @@ +using System.Collections; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Text; +using ICSharpCode.NRefactory.Ast; +using ICSharpCode.NRefactory.Parser.VB; +using ASTAttribute = ICSharpCode.NRefactory.Ast.Attribute; +using ICSharpCode.NRefactory.Parser.VBNet.Experimental; + +COMPILER ParserHelper + +/* START AUTOGENERATED TOKENS SECTION */ +TOKENS + /* ----- terminal classes ----- */ + /* EOF is 0 */ + EOL + ident + LiteralString + LiteralCharacter + LiteralInteger + LiteralDouble + LiteralSingle + LiteralDecimal + LiteralDate + + /* ----- special character ----- */ + "=" + ":" + "," + "&" + "/" + "\\" + "." + "!" + "-" + "+" + "^" + "?" + "*" + "{" + "}" + "(" + ")" + ">" + "<" + "<>" + ">=" + "<=" + "<<" + ">>" + "+=" + "^=" + "-=" + "*=" + "/=" + "\\=" + "<<=" + ">>=" + "&=" + + /* ----- keywords ----- */ + "AddHandler" + "AddressOf" + "Aggregate" + "Alias" + "And" + "AndAlso" + "Ansi" + "As" + "Ascending" + "Assembly" + "Auto" + "Binary" + "Boolean" + "ByRef" + "By" + "Byte" + "ByVal" + "Call" + "Case" + "Catch" + "CBool" + "CByte" + "CChar" + "CDate" + "CDbl" + "CDec" + "Char" + "CInt" + "Class" + "CLng" + "CObj" + "Compare" + "Const" + "Continue" + "CSByte" + "CShort" + "CSng" + "CStr" + "CType" + "CUInt" + "CULng" + "CUShort" + "Custom" + "Date" + "Decimal" + "Declare" + "Default" + "Delegate" + "Descending" + "Dim" + "DirectCast" + "Distinct" + "Do" + "Double" + "Each" + "Else" + "ElseIf" + "End" + "EndIf" + "Enum" + "Equals" + "Erase" + "Error" + "Event" + "Exit" + "Explicit" + "False" + "Finally" + "For" + "Friend" + "From" + "Function" + "Get" + "GetType" + "Global" + "GoSub" + "GoTo" + "Group" + "Handles" + "If" + "Implements" + "Imports" + "In" + "Infer" + "Inherits" + "Integer" + "Interface" + "Into" + "Is" + "IsNot" + "Join" + "Let" + "Lib" + "Like" + "Long" + "Loop" + "Me" + "Mod" + "Module" + "MustInherit" + "MustOverride" + "MyBase" + "MyClass" + "Namespace" + "Narrowing" + "New" + "Next" + "Not" + "Nothing" + "NotInheritable" + "NotOverridable" + "Object" + "Of" + "Off" + "On" + "Operator" + "Option" + "Optional" + "Or" + "Order" + "OrElse" + "Overloads" + "Overridable" + "Overrides" + "ParamArray" + "Partial" + "Preserve" + "Private" + "Property" + "Protected" + "Public" + "RaiseEvent" + "ReadOnly" + "ReDim" + "Rem" + "RemoveHandler" + "Resume" + "Return" + "SByte" + "Select" + "Set" + "Shadows" + "Shared" + "Short" + "Single" + "Skip" + "Static" + "Step" + "Stop" + "Strict" + "String" + "Structure" + "Sub" + "SyncLock" + "Take" + "Text" + "Then" + "Throw" + "To" + "True" + "Try" + "TryCast" + "TypeOf" + "UInteger" + "ULong" + "Unicode" + "Until" + "UShort" + "Using" + "Variant" + "Wend" + "When" + "Where" + "While" + "Widening" + "With" + "WithEvents" + "WriteOnly" + "Xor" +/* END AUTOGENERATED TOKENS SECTION */ + +PRODUCTIONS +/*------------------------------------------------------------------------*/ +ParserHelper = + { OptionStatement } + { ImportsStatement } + { AttributeBlock } + { NamespaceMemberDeclaration } +. + +StatementTerminator = EOL | ":" . + +OptionStatement = + "Option" { ANY } StatementTerminator +. + +ImportsStatement = + "Imports" { ANY } StatementTerminator +. + +AttributeBlock = + Attribute { Attribute } StatementTerminator +. + +Attribute = + [ EOL ] "<" { ANY } ">" [ EOL ] +. + +NamespaceMemberDeclaration = + NamespaceDeclaration | TypeDeclaration +. + +NamespaceDeclaration = + "Namespace" { ANY } StatementTerminator + { NamespaceMemberDeclaration } + "End" "Namespace" StatementTerminator +. + +TypeDeclaration = + { AttributeBlock } + { TypeModifier } + "Module" { ANY } StatementTerminator + (. PushContext(Context.Type); .) + { ModuleMemberDeclaration } + "End" "Module" StatementTerminator + (. PopContext(); .) +. + +ModuleMemberDeclaration + (. PushContext(Context.Member); .) += + SubOrFunctionDeclaration + (. PopContext(); .) +. + +SubOrFunctionDeclaration = + { AttributeBlock } { MemberModifier } ("Sub" | "Function") + (. PushContext(Context.IdentifierExpected); .) ANY (. PopContext(); .) + [ "(" [ ParameterList ] ")" ] EOL + [ Block ] + "End" ("Sub" | "Function") StatementTerminator +. + +ParameterList = + Parameter { "," Parameter } +. + +Parameter = + { AttributeBlock } { ParameterModifier } Identifier [ "As" ANY ] [ "=" { ANY } ] +. + +Block = + EOL +. + +/* This production handles pseudo keywords that are needed in the grammar */ +Identifier + (. PushContext(Context.IdentifierExpected); .) += + ( + IdentifierForFieldDeclaration + | + "Custom" + ) + (. PopContext(); .) +. + +IdentifierForFieldDeclaration = + ident + | "Aggregate" + | "Ansi" + | "Ascending" + | "Assembly" + | "Auto" + | "Binary" + | "By" + | "Compare" + | "Descending" + | "Distinct" + | "Equals" + | "Explicit" + | "From" + | "Group" + | "Infer" + | "Into" + | "Join" + | "Off" + | "Order" + | "Preserve" + | "Skip" + | "Take" + | "Text" + | "Unicode" + | "Until" + | "Where" +. + +AccessModifier = + "Public" | + "Friend" | + "Protected" [ "Friend" ] | + "Private" +. + +TypeModifier = + AccessModifier | + "Shadows" +. + +MemberModifier = + AccessModifier | + "Shadows" | + "Shared" | + "Overridable" | + "NotOverridable" | + "Overrides" | + "Overloads" | + "Partial" +. + +ParameterModifier = + "ByVal" | + "ByRef" | + "Optional" | + "ParamArray" +. + +END ParserHelper. + diff --git a/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Experimental/ParserHelper.cs b/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Experimental/ParserHelper.cs new file mode 100644 index 0000000000..b4027b08c2 --- /dev/null +++ b/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Experimental/ParserHelper.cs @@ -0,0 +1,48 @@ +// +// +// +// +// $Revision$ +// + +using System; +using System.Collections.Generic; + +namespace ICSharpCode.NRefactory.Parser.VBNet.Experimental +{ + partial class Parser + { + Stack stack = new Stack(); + + void PopContext() + { + if (stack.Count > 0) { + string indent = new string('\t', stack.Count - 1); + var item = stack.Pop(); + Console.WriteLine(indent + "exit " + item); + } else { + Console.WriteLine("empty stack"); + } + } + + void PushContext(Context context) + { + string indent = new string('\t', stack.Count); + stack.Push(context); + Console.WriteLine(indent + "enter " + context); + } + + void SetContext(Context context) + { + PopContext(); + PushContext(context); + } + } + + public enum Context { + Global, + Type, + Member, + IdentifierExpected + } +} diff --git a/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Experimental/Scanner.frame b/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Experimental/Scanner.frame new file mode 100644 index 0000000000..3b37546e94 --- /dev/null +++ b/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Experimental/Scanner.frame @@ -0,0 +1,363 @@ +/*---------------------------------------------------------------------- +Compiler Generator Coco/R, +Copyright (c) 1990, 2004 Hanspeter Moessenboeck, University of Linz +extended by M. Loeberbauer & A. Woess, Univ. of Linz +with improvements by Pat Terry, Rhodes University + +This program is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +As an exception, it is allowed to write an extension of Coco/R that is +used as a plugin in non-free software. + +If not otherwise stated, any source code generated by Coco/R (other than +Coco/R itself) does not fall under the GNU General Public License. +-----------------------------------------------------------------------*/ +-->begin +using System; +using System.IO; +using System.Collections.Generic; + +-->namespace + +public class Token { + public int kind; // token kind + public int pos; // token position in the source text (starting at 0) + public int col; // token column (starting at 1) + public int line; // token line (starting at 1) + public string val; // token value + public Token next; // ML 2005-03-11 Tokens are kept in linked list +} + +//----------------------------------------------------------------------------------- +// Buffer +//----------------------------------------------------------------------------------- +public class Buffer { + // This Buffer supports the following cases: + // 1) seekable stream (file) + // a) whole stream in buffer + // b) part of stream in buffer + // 2) non seekable stream (network, console) + + public const int EOF = char.MaxValue + 1; + const int MIN_BUFFER_LENGTH = 1024; // 1KB + const int MAX_BUFFER_LENGTH = MIN_BUFFER_LENGTH * 64; // 64KB + byte[] buf; // input buffer + int bufStart; // position of first byte in buffer relative to input stream + int bufLen; // length of buffer + int fileLen; // length of input stream (may change if the stream is no file) + int bufPos; // current position in buffer + Stream stream; // input stream (seekable) + bool isUserStream; // was the stream opened by the user? + + public Buffer (Stream s, bool isUserStream) { + stream = s; this.isUserStream = isUserStream; + + if (stream.CanSeek) { + fileLen = (int) stream.Length; + bufLen = Math.Min(fileLen, MAX_BUFFER_LENGTH); + bufStart = Int32.MaxValue; // nothing in the buffer so far + } else { + fileLen = bufLen = bufStart = 0; + } + + buf = new byte[(bufLen>0) ? bufLen : MIN_BUFFER_LENGTH]; + if (fileLen > 0) Pos = 0; // setup buffer to position 0 (start) + else bufPos = 0; // index 0 is already after the file, thus Pos = 0 is invalid + if (bufLen == fileLen && stream.CanSeek) Close(); + } + + protected Buffer(Buffer b) { // called in UTF8Buffer constructor + buf = b.buf; + bufStart = b.bufStart; + bufLen = b.bufLen; + fileLen = b.fileLen; + bufPos = b.bufPos; + stream = b.stream; + // keep destructor from closing the stream + b.stream = null; + isUserStream = b.isUserStream; + } + + ~Buffer() { Close(); } + + protected void Close() { + if (!isUserStream && stream != null) { + stream.Close(); + stream = null; + } + } + + public virtual int Read () { + if (bufPos < bufLen) { + return buf[bufPos++]; + } else if (Pos < fileLen) { + Pos = Pos; // shift buffer start to Pos + return buf[bufPos++]; + } else if (stream != null && !stream.CanSeek && ReadNextStreamChunk() > 0) { + return buf[bufPos++]; + } else { + return EOF; + } + } + + public int Peek () { + int curPos = Pos; + int ch = Read(); + Pos = curPos; + return ch; + } + + public string GetString (int beg, int end) { + int len = 0; + char[] buf = new char[end - beg]; + int oldPos = Pos; + Pos = beg; + while (Pos < end) buf[len++] = (char) Read(); + Pos = oldPos; + return new String(buf, 0, len); + } + + public int Pos { + get { return bufPos + bufStart; } + set { + if (value >= fileLen && stream != null && !stream.CanSeek) { + // Wanted position is after buffer and the stream + // is not seek-able e.g. network or console, + // thus we have to read the stream manually till + // the wanted position is in sight. + while (value >= fileLen && ReadNextStreamChunk() > 0); + } + + if (value < 0 || value > fileLen) { + throw new FatalError("buffer out of bounds access, position: " + value); + } + + if (value >= bufStart && value < bufStart + bufLen) { // already in buffer + bufPos = value - bufStart; + } else if (stream != null) { // must be swapped in + stream.Seek(value, SeekOrigin.Begin); + bufLen = stream.Read(buf, 0, buf.Length); + bufStart = value; bufPos = 0; + } else { + // set the position to the end of the file, Pos will return fileLen. + bufPos = fileLen - bufStart; + } + } + } + + // Read the next chunk of bytes from the stream, increases the buffer + // if needed and updates the fields fileLen and bufLen. + // Returns the number of bytes read. + private int ReadNextStreamChunk() { + int free = buf.Length - bufLen; + if (free == 0) { + // in the case of a growing input stream + // we can neither seek in the stream, nor can we + // foresee the maximum length, thus we must adapt + // the buffer size on demand. + byte[] newBuf = new byte[bufLen * 2]; + Array.Copy(buf, newBuf, bufLen); + buf = newBuf; + free = bufLen; + } + int read = stream.Read(buf, bufLen, free); + if (read > 0) { + fileLen = bufLen = (bufLen + read); + return read; + } + // end of stream reached + return 0; + } +} + +//----------------------------------------------------------------------------------- +// UTF8Buffer +//----------------------------------------------------------------------------------- +public class UTF8Buffer: Buffer { + public UTF8Buffer(Buffer b): base(b) {} + + public override int Read() { + int ch; + do { + ch = base.Read(); + // until we find a utf8 start (0xxxxxxx or 11xxxxxx) + } while ((ch >= 128) && ((ch & 0xC0) != 0xC0) && (ch != EOF)); + if (ch < 128 || ch == EOF) { + // nothing to do, first 127 chars are the same in ascii and utf8 + // 0xxxxxxx or end of file character + } else if ((ch & 0xF0) == 0xF0) { + // 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx + int c1 = ch & 0x07; ch = base.Read(); + int c2 = ch & 0x3F; ch = base.Read(); + int c3 = ch & 0x3F; ch = base.Read(); + int c4 = ch & 0x3F; + ch = (((((c1 << 6) | c2) << 6) | c3) << 6) | c4; + } else if ((ch & 0xE0) == 0xE0) { + // 1110xxxx 10xxxxxx 10xxxxxx + int c1 = ch & 0x0F; ch = base.Read(); + int c2 = ch & 0x3F; ch = base.Read(); + int c3 = ch & 0x3F; + ch = (((c1 << 6) | c2) << 6) | c3; + } else if ((ch & 0xC0) == 0xC0) { + // 110xxxxx 10xxxxxx + int c1 = ch & 0x1F; ch = base.Read(); + int c2 = ch & 0x3F; + ch = (c1 << 6) | c2; + } + return ch; + } +} + +//----------------------------------------------------------------------------------- +// Scanner +//----------------------------------------------------------------------------------- +public class Scanner { + const char EOL = '\n'; + const int eofSym = 0; /* pdt */ +-->declarations + + public Buffer buffer; // scanner buffer + + Token t; // current token + int ch; // current input character + int pos; // byte position of current character + int col; // column number of current character + int line; // line number of current character + int oldEols; // EOLs that appeared in a comment; + static readonly Dictionary start; // maps first token character to start state + + Token tokens; // list of tokens already peeked (first token is a dummy) + Token pt; // current peek token + + char[] tval = new char[128]; // text of current token + int tlen; // length of current token + + static Scanner() { + start = new Dictionary(128); +-->initialization + } + + public Scanner (string fileName) { + try { + Stream stream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read); + buffer = new Buffer(stream, false); + Init(); + } catch (IOException) { + throw new FatalError("Cannot open file " + fileName); + } + } + + public Scanner (Stream s) { + buffer = new Buffer(s, true); + Init(); + } + + void Init() { + pos = -1; line = 1; col = 0; + oldEols = 0; + NextCh(); + if (ch == 0xEF) { // check optional byte order mark for UTF-8 + NextCh(); int ch1 = ch; + NextCh(); int ch2 = ch; + if (ch1 != 0xBB || ch2 != 0xBF) { + throw new FatalError(String.Format("illegal byte order mark: EF {0,2:X} {1,2:X}", ch1, ch2)); + } + buffer = new UTF8Buffer(buffer); col = 0; + NextCh(); + } + pt = tokens = new Token(); // first token is a dummy + } + + void NextCh() { + if (oldEols > 0) { ch = EOL; oldEols--; } + else { + pos = buffer.Pos; + ch = buffer.Read(); col++; + // replace isolated '\r' by '\n' in order to make + // eol handling uniform across Windows, Unix and Mac + if (ch == '\r' && buffer.Peek() != '\n') ch = EOL; + if (ch == EOL) { line++; col = 0; } + } +-->casing1 + } + + void AddCh() { + if (tlen >= tval.Length) { + char[] newBuf = new char[2 * tval.Length]; + Array.Copy(tval, 0, newBuf, 0, tval.Length); + tval = newBuf; + } + if (ch != Buffer.EOF) { +-->casing2 + NextCh(); + } + } + + +-->comments + + void CheckLiteral() { +-->literals + } + + Token NextToken() { + while (ch == ' ' || +-->scan1 + ) NextCh(); +-->scan2 + t = new Token(); + t.pos = pos; t.col = col; t.line = line; + int state; + if (!start.TryGetValue(ch, out state)) + state = 0; + tlen = 0; AddCh(); + + switch (state) { + case -1: { t.kind = eofSym; break; } // NextCh already done + case 0: { t.kind = noSym; break; } // NextCh already done +-->scan3 + } + t.val = new String(tval, 0, tlen); + return t; + } + + // get the next token (possibly a token already seen during peeking) + public Token Scan () { + if (tokens.next == null) { + return NextToken(); + } else { + pt = tokens = tokens.next; + return tokens; + } + } + + // peek for the next token, ignore pragmas + public Token Peek () { + do { + if (pt.next == null) { + pt.next = NextToken(); + } + pt = pt.next; + } while (pt.kind > maxT); // skip pragmas + + return pt; + } + + // make sure that peeking starts at the current scan position + public void ResetPeek () { pt = tokens; } + +} // end Scanner + +$$$ diff --git a/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Experimental/Test/Program.cs b/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Experimental/Test/Program.cs new file mode 100644 index 0000000000..39bca05baa --- /dev/null +++ b/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Experimental/Test/Program.cs @@ -0,0 +1,50 @@ +// +// +// +// +// $Revision$ +// + +using System; +using System.IO; +using ICSharpCode.NRefactory; +using ICSharpCode.NRefactory.Parser.VB; +using ICSharpCode.NRefactory.Parser.VBNet.Experimental; + +namespace VBParserExperiment +{ + class Program + { + static string data = @"Option Explicit +Option Strict On + +Imports System +Imports System.Linq + +Module Program + +End Module + +Namespace Test + Module Functions + Public Sub New() + + End Sub + + Public Sub Test(ByVal x As Integer) + + End Sub + End Module +End Namespace + "; + + public static void Main(string[] args) + { + Parser p = new Parser(ParserFactory.CreateLexer(SupportedLanguage.VBNet, new StringReader(data))); + + p.Parse(); + + Console.ReadKey(true); + } + } +} \ No newline at end of file diff --git a/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Experimental/Test/Properties/AssemblyInfo.cs b/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Experimental/Test/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..fbf342d55e --- /dev/null +++ b/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Experimental/Test/Properties/AssemblyInfo.cs @@ -0,0 +1,31 @@ +#region Using directives + +using System; +using System.Reflection; +using System.Runtime.InteropServices; + +#endregion + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("VBParserExperiment")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("VBParserExperiment")] +[assembly: AssemblyCopyright("Copyright 2010")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// This sets the default COM visibility of types in the assembly to invisible. +// If you need to expose a type to COM, use [ComVisible(true)] on that type. +[assembly: ComVisible(false)] + +// The assembly version has following format : +// +// Major.Minor.Build.Revision +// +// You can specify all the values or you can use the default the Revision and +// Build Numbers by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.*")] diff --git a/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Experimental/Test/VBParserExperiment.csproj b/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Experimental/Test/VBParserExperiment.csproj new file mode 100644 index 0000000000..376a9f3408 --- /dev/null +++ b/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Experimental/Test/VBParserExperiment.csproj @@ -0,0 +1,61 @@ + + + + {A21BF46E-27BC-4DCA-AB11-462BE5B0B028} + Debug + x86 + Exe + VBParserExperiment + VBParserExperiment + v4.0 + Properties + + + x86 + + + bin\Debug\ + True + Full + False + True + DEBUG;TRACE + + + bin\Release\ + False + None + True + False + TRACE + + + + + 3.5 + + + + 3.5 + + + + 3.5 + + + + + + + + + {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195} + NRefactory + + + {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195} + NRefactory + + + + \ No newline at end of file diff --git a/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Parser.cs b/src/Libraries/NRefactory/Project/Src/Parser/VBNet/Parser.cs index c8199fabb5..0466c88457 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 2562 "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 2564 "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 2568 "VBNET.ATG" +#line 2573 "VBNET.ATG" out attribute); -#line 2568 "VBNET.ATG" +#line 2573 "VBNET.ATG" attributes.Add(attribute); while ( -#line 2569 "VBNET.ATG" +#line 2574 "VBNET.ATG" NotFinalComma()) { if (la.kind == 12) { lexer.NextToken(); @@ -213,10 +213,10 @@ NotFinalComma()) { Expect(11); } Attribute( -#line 2569 "VBNET.ATG" +#line 2574 "VBNET.ATG" out attribute); -#line 2569 "VBNET.ATG" +#line 2574 "VBNET.ATG" attributes.Add(attribute); } if (la.kind == 12) { @@ -225,7 +225,7 @@ out attribute); Expect(27); EndOfStmt(); -#line 2574 "VBNET.ATG" +#line 2579 "VBNET.ATG" AttributeSection section = new AttributeSection { AttributeTarget = attributeTarget, Attributes = attributes, @@ -334,47 +334,47 @@ out aliasedType); } void Qualident( -#line 3320 "VBNET.ATG" +#line 3325 "VBNET.ATG" out string qualident) { -#line 3322 "VBNET.ATG" +#line 3327 "VBNET.ATG" string name; qualidentBuilder.Length = 0; Identifier(); -#line 3326 "VBNET.ATG" +#line 3331 "VBNET.ATG" qualidentBuilder.Append(t.val); while ( -#line 3327 "VBNET.ATG" +#line 3332 "VBNET.ATG" DotAndIdentOrKw()) { Expect(16); IdentifierOrKeyword( -#line 3327 "VBNET.ATG" +#line 3332 "VBNET.ATG" out name); -#line 3327 "VBNET.ATG" +#line 3332 "VBNET.ATG" qualidentBuilder.Append('.'); qualidentBuilder.Append(name); } -#line 3329 "VBNET.ATG" +#line 3334 "VBNET.ATG" qualident = qualidentBuilder.ToString(); } void TypeName( -#line 2435 "VBNET.ATG" +#line 2440 "VBNET.ATG" out TypeReference typeref) { -#line 2436 "VBNET.ATG" +#line 2441 "VBNET.ATG" ArrayList rank = null; NonArrayTypeName( -#line 2438 "VBNET.ATG" +#line 2443 "VBNET.ATG" out typeref, false); ArrayTypeModifiers( -#line 2442 "VBNET.ATG" +#line 2447 "VBNET.ATG" out rank); -#line 2443 "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 2637 "VBNET.ATG" +#line 2642 "VBNET.ATG" out AttributeSection section) { -#line 2639 "VBNET.ATG" +#line 2644 "VBNET.ATG" string attributeTarget = "";List attributes = new List(); ASTAttribute attribute; Expect(28); -#line 2643 "VBNET.ATG" +#line 2648 "VBNET.ATG" Location startPos = t.Location; if ( -#line 2644 "VBNET.ATG" +#line 2649 "VBNET.ATG" IsLocalAttrTarget()) { if (la.kind == 106) { lexer.NextToken(); -#line 2645 "VBNET.ATG" +#line 2650 "VBNET.ATG" attributeTarget = "event"; } else if (la.kind == 180) { lexer.NextToken(); -#line 2646 "VBNET.ATG" +#line 2651 "VBNET.ATG" attributeTarget = "return"; } else { Identifier(); -#line 2649 "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 2659 "VBNET.ATG" +#line 2664 "VBNET.ATG" out attribute); -#line 2659 "VBNET.ATG" +#line 2664 "VBNET.ATG" attributes.Add(attribute); while ( -#line 2660 "VBNET.ATG" +#line 2665 "VBNET.ATG" NotFinalComma()) { Expect(12); Attribute( -#line 2660 "VBNET.ATG" +#line 2665 "VBNET.ATG" out attribute); -#line 2660 "VBNET.ATG" +#line 2665 "VBNET.ATG" attributes.Add(attribute); } if (la.kind == 12) { @@ -459,7 +459,7 @@ out attribute); } Expect(27); -#line 2664 "VBNET.ATG" +#line 2669 "VBNET.ATG" section = new AttributeSection { AttributeTarget = attributeTarget, Attributes = attributes, @@ -470,69 +470,69 @@ out attribute); } void TypeModifier( -#line 3403 "VBNET.ATG" +#line 3408 "VBNET.ATG" ModifierList m) { switch (la.kind) { case 173: { lexer.NextToken(); -#line 3404 "VBNET.ATG" +#line 3409 "VBNET.ATG" m.Add(Modifiers.Public, t.Location); break; } case 172: { lexer.NextToken(); -#line 3405 "VBNET.ATG" +#line 3410 "VBNET.ATG" m.Add(Modifiers.Protected, t.Location); break; } case 112: { lexer.NextToken(); -#line 3406 "VBNET.ATG" +#line 3411 "VBNET.ATG" m.Add(Modifiers.Internal, t.Location); break; } case 170: { lexer.NextToken(); -#line 3407 "VBNET.ATG" +#line 3412 "VBNET.ATG" m.Add(Modifiers.Private, t.Location); break; } case 185: { lexer.NextToken(); -#line 3408 "VBNET.ATG" +#line 3413 "VBNET.ATG" m.Add(Modifiers.Static, t.Location); break; } case 184: { lexer.NextToken(); -#line 3409 "VBNET.ATG" +#line 3414 "VBNET.ATG" m.Add(Modifiers.New, t.Location); break; } case 142: { lexer.NextToken(); -#line 3410 "VBNET.ATG" +#line 3415 "VBNET.ATG" m.Add(Modifiers.Abstract, t.Location); break; } case 152: { lexer.NextToken(); -#line 3411 "VBNET.ATG" +#line 3416 "VBNET.ATG" m.Add(Modifiers.Sealed, t.Location); break; } case 168: { lexer.NextToken(); -#line 3412 "VBNET.ATG" +#line 3417 "VBNET.ATG" m.Add(Modifiers.Partial, t.Location); break; } @@ -962,28 +962,28 @@ out typeRef); } void TypeImplementsClause( -#line 1591 "VBNET.ATG" +#line 1582 "VBNET.ATG" out List baseInterfaces) { -#line 1593 "VBNET.ATG" +#line 1584 "VBNET.ATG" baseInterfaces = new List(); TypeReference type = null; Expect(123); TypeName( -#line 1596 "VBNET.ATG" +#line 1587 "VBNET.ATG" out type); -#line 1598 "VBNET.ATG" +#line 1589 "VBNET.ATG" if (type != null) baseInterfaces.Add(type); while (la.kind == 12) { lexer.NextToken(); TypeName( -#line 1601 "VBNET.ATG" +#line 1592 "VBNET.ATG" out type); -#line 1602 "VBNET.ATG" +#line 1593 "VBNET.ATG" if (type != null) baseInterfaces.Add(type); } EndOfStmt(); @@ -1113,10 +1113,10 @@ m, attributes); } void NonArrayTypeName( -#line 2461 "VBNET.ATG" +#line 2466 "VBNET.ATG" out TypeReference typeref, bool canBeUnbound) { -#line 2463 "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 2468 "VBNET.ATG" +#line 2473 "VBNET.ATG" isGlobal = true; } QualIdentAndTypeArguments( -#line 2469 "VBNET.ATG" +#line 2474 "VBNET.ATG" out typeref, canBeUnbound); -#line 2470 "VBNET.ATG" +#line 2475 "VBNET.ATG" typeref.IsGlobal = isGlobal; while (la.kind == 16) { lexer.NextToken(); -#line 2471 "VBNET.ATG" +#line 2476 "VBNET.ATG" TypeReference nestedTypeRef; QualIdentAndTypeArguments( -#line 2472 "VBNET.ATG" +#line 2477 "VBNET.ATG" out nestedTypeRef, canBeUnbound); -#line 2473 "VBNET.ATG" +#line 2478 "VBNET.ATG" typeref = new InnerClassTypeReference(typeref, nestedTypeRef.Type, nestedTypeRef.GenericTypes); } } else if (la.kind == 154) { lexer.NextToken(); -#line 2476 "VBNET.ATG" +#line 2481 "VBNET.ATG" typeref = new TypeReference("System.Object", true); if (la.kind == 21) { lexer.NextToken(); -#line 2480 "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 2486 "VBNET.ATG" +#line 2491 "VBNET.ATG" out name); -#line 2486 "VBNET.ATG" +#line 2491 "VBNET.ATG" typeref = new TypeReference(name, true); if (la.kind == 21) { lexer.NextToken(); -#line 2490 "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 1576 "VBNET.ATG" +#line 1567 "VBNET.ATG" out List bases) { -#line 1578 "VBNET.ATG" +#line 1569 "VBNET.ATG" TypeReference type; bases = new List(); Expect(127); TypeName( -#line 1582 "VBNET.ATG" +#line 1573 "VBNET.ATG" out type); -#line 1582 "VBNET.ATG" +#line 1573 "VBNET.ATG" if (type != null) bases.Add(type); while (la.kind == 12) { lexer.NextToken(); TypeName( -#line 1585 "VBNET.ATG" +#line 1576 "VBNET.ATG" out type); -#line 1585 "VBNET.ATG" +#line 1576 "VBNET.ATG" if (type != null) bases.Add(type); } EndOfStmt(); @@ -1257,162 +1257,162 @@ TypeDeclaration newType) { } void FormalParameterList( -#line 2674 "VBNET.ATG" +#line 2679 "VBNET.ATG" List parameter) { -#line 2675 "VBNET.ATG" +#line 2680 "VBNET.ATG" ParameterDeclarationExpression p; FormalParameter( -#line 2677 "VBNET.ATG" +#line 2682 "VBNET.ATG" out p); -#line 2677 "VBNET.ATG" +#line 2682 "VBNET.ATG" if (p != null) parameter.Add(p); while (la.kind == 12) { lexer.NextToken(); FormalParameter( -#line 2679 "VBNET.ATG" +#line 2684 "VBNET.ATG" out p); -#line 2679 "VBNET.ATG" +#line 2684 "VBNET.ATG" if (p != null) parameter.Add(p); } } void MemberModifier( -#line 3415 "VBNET.ATG" +#line 3420 "VBNET.ATG" ModifierList m) { switch (la.kind) { case 142: { lexer.NextToken(); -#line 3416 "VBNET.ATG" +#line 3421 "VBNET.ATG" m.Add(Modifiers.Abstract, t.Location); break; } case 89: { lexer.NextToken(); -#line 3417 "VBNET.ATG" +#line 3422 "VBNET.ATG" m.Add(Modifiers.Default, t.Location); break; } case 112: { lexer.NextToken(); -#line 3418 "VBNET.ATG" +#line 3423 "VBNET.ATG" m.Add(Modifiers.Internal, t.Location); break; } case 184: { lexer.NextToken(); -#line 3419 "VBNET.ATG" +#line 3424 "VBNET.ATG" m.Add(Modifiers.New, t.Location); break; } case 166: { lexer.NextToken(); -#line 3420 "VBNET.ATG" +#line 3425 "VBNET.ATG" m.Add(Modifiers.Override, t.Location); break; } case 143: { lexer.NextToken(); -#line 3421 "VBNET.ATG" +#line 3426 "VBNET.ATG" m.Add(Modifiers.Abstract, t.Location); break; } case 170: { lexer.NextToken(); -#line 3422 "VBNET.ATG" +#line 3427 "VBNET.ATG" m.Add(Modifiers.Private, t.Location); break; } case 172: { lexer.NextToken(); -#line 3423 "VBNET.ATG" +#line 3428 "VBNET.ATG" m.Add(Modifiers.Protected, t.Location); break; } case 173: { lexer.NextToken(); -#line 3424 "VBNET.ATG" +#line 3429 "VBNET.ATG" m.Add(Modifiers.Public, t.Location); break; } case 152: { lexer.NextToken(); -#line 3425 "VBNET.ATG" +#line 3430 "VBNET.ATG" m.Add(Modifiers.Sealed, t.Location); break; } case 153: { lexer.NextToken(); -#line 3426 "VBNET.ATG" +#line 3431 "VBNET.ATG" m.Add(Modifiers.Sealed, t.Location); break; } case 185: { lexer.NextToken(); -#line 3427 "VBNET.ATG" +#line 3432 "VBNET.ATG" m.Add(Modifiers.Static, t.Location); break; } case 165: { lexer.NextToken(); -#line 3428 "VBNET.ATG" +#line 3433 "VBNET.ATG" m.Add(Modifiers.Virtual, t.Location); break; } case 164: { lexer.NextToken(); -#line 3429 "VBNET.ATG" +#line 3434 "VBNET.ATG" m.Add(Modifiers.Overloads, t.Location); break; } case 175: { lexer.NextToken(); -#line 3430 "VBNET.ATG" +#line 3435 "VBNET.ATG" m.Add(Modifiers.ReadOnly, t.Location); break; } case 220: { lexer.NextToken(); -#line 3431 "VBNET.ATG" +#line 3436 "VBNET.ATG" m.Add(Modifiers.WriteOnly, t.Location); break; } case 219: { lexer.NextToken(); -#line 3432 "VBNET.ATG" +#line 3437 "VBNET.ATG" m.Add(Modifiers.WithEvents, t.Location); break; } case 92: { lexer.NextToken(); -#line 3433 "VBNET.ATG" +#line 3438 "VBNET.ATG" m.Add(Modifiers.Dim, t.Location); break; } case 168: { lexer.NextToken(); -#line 3434 "VBNET.ATG" +#line 3439 "VBNET.ATG" m.Add(Modifiers.Partial, t.Location); break; } @@ -1981,7 +1981,7 @@ out type); } if (la.kind == 10) { lexer.NextToken(); - VariableInitializer( + Expr( #line 1097 "VBNET.ATG" out initializer); } @@ -2478,107 +2478,107 @@ mod, attributes); } void Expr( -#line 1635 "VBNET.ATG" +#line 1626 "VBNET.ATG" out Expression expr) { -#line 1636 "VBNET.ATG" +#line 1627 "VBNET.ATG" expr = null; if ( -#line 1637 "VBNET.ATG" +#line 1628 "VBNET.ATG" IsQueryExpression() ) { QueryExpr( -#line 1638 "VBNET.ATG" +#line 1629 "VBNET.ATG" out expr); } else if (la.kind == 114) { LambdaExpr( -#line 1639 "VBNET.ATG" +#line 1630 "VBNET.ATG" out expr); } else if (StartOf(21)) { DisjunctionExpr( -#line 1640 "VBNET.ATG" +#line 1631 "VBNET.ATG" out expr); } else SynErr(248); } void ImplementsClause( -#line 1608 "VBNET.ATG" +#line 1599 "VBNET.ATG" out List baseInterfaces) { -#line 1610 "VBNET.ATG" +#line 1601 "VBNET.ATG" baseInterfaces = new List(); TypeReference type = null; string memberName = null; Expect(123); NonArrayTypeName( -#line 1615 "VBNET.ATG" +#line 1606 "VBNET.ATG" out type, false); -#line 1616 "VBNET.ATG" +#line 1607 "VBNET.ATG" if (type != null) memberName = TypeReference.StripLastIdentifierFromType(ref type); -#line 1617 "VBNET.ATG" +#line 1608 "VBNET.ATG" baseInterfaces.Add(new InterfaceImplementation(type, memberName)); while (la.kind == 12) { lexer.NextToken(); NonArrayTypeName( -#line 1619 "VBNET.ATG" +#line 1610 "VBNET.ATG" out type, false); -#line 1620 "VBNET.ATG" +#line 1611 "VBNET.ATG" if (type != null) memberName = TypeReference.StripLastIdentifierFromType(ref type); -#line 1621 "VBNET.ATG" +#line 1612 "VBNET.ATG" baseInterfaces.Add(new InterfaceImplementation(type, memberName)); } } void HandlesClause( -#line 1566 "VBNET.ATG" +#line 1557 "VBNET.ATG" out List handlesClause) { -#line 1568 "VBNET.ATG" +#line 1559 "VBNET.ATG" handlesClause = new List(); string name; Expect(121); EventMemberSpecifier( -#line 1571 "VBNET.ATG" +#line 1562 "VBNET.ATG" out name); -#line 1571 "VBNET.ATG" +#line 1562 "VBNET.ATG" if (name != null) handlesClause.Add(name); while (la.kind == 12) { lexer.NextToken(); EventMemberSpecifier( -#line 1572 "VBNET.ATG" +#line 1563 "VBNET.ATG" out name); -#line 1572 "VBNET.ATG" +#line 1563 "VBNET.ATG" if (name != null) handlesClause.Add(name); } } void Block( -#line 2721 "VBNET.ATG" +#line 2726 "VBNET.ATG" out Statement stmt) { -#line 2724 "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 2730 "VBNET.ATG" +#line 2735 "VBNET.ATG" IsEndStmtAhead()) { if ( -#line 2730 "VBNET.ATG" +#line 2735 "VBNET.ATG" IsEndStmtAhead()) { Expect(100); EndOfStmt(); -#line 2730 "VBNET.ATG" +#line 2735 "VBNET.ATG" compilationUnit.AddChild(new EndStatement()); } else { Statement(); @@ -2586,7 +2586,7 @@ IsEndStmtAhead()) { } } -#line 2735 "VBNET.ATG" +#line 2740 "VBNET.ATG" stmt = blockStmt; if (t != null) blockStmt.EndLocation = t.EndLocation; compilationUnit.BlockEnd(); @@ -2594,26 +2594,26 @@ IsEndStmtAhead()) { } void Charset( -#line 1558 "VBNET.ATG" +#line 1549 "VBNET.ATG" out CharsetModifier charsetModifier) { -#line 1559 "VBNET.ATG" +#line 1550 "VBNET.ATG" charsetModifier = CharsetModifier.None; if (la.kind == 114 || la.kind == 195) { } else if (la.kind == 49) { lexer.NextToken(); -#line 1560 "VBNET.ATG" +#line 1551 "VBNET.ATG" charsetModifier = CharsetModifier.Ansi; } else if (la.kind == 53) { lexer.NextToken(); -#line 1561 "VBNET.ATG" +#line 1552 "VBNET.ATG" charsetModifier = CharsetModifier.Auto; } else if (la.kind == 208) { lexer.NextToken(); -#line 1562 "VBNET.ATG" +#line 1553 "VBNET.ATG" charsetModifier = CharsetModifier.Unicode; } else SynErr(249); } @@ -2818,7 +2818,7 @@ out type); if (la.kind == 10) { lexer.NextToken(); - VariableInitializer( + Expr( #line 1491 "VBNET.ATG" out expr); } @@ -2878,12 +2878,12 @@ out expr); } void ObjectCreateExpression( -#line 1963 "VBNET.ATG" +#line 1954 "VBNET.ATG" out Expression oce) { -#line 1965 "VBNET.ATG" +#line 1956 "VBNET.ATG" TypeReference type = null; - Expression initializer = null; + CollectionInitializerExpression initializer = null; List arguments = null; ArrayList dimensions = null; oce = null; @@ -2892,105 +2892,99 @@ out Expression oce) { Expect(148); if (StartOf(7)) { NonArrayTypeName( -#line 1973 "VBNET.ATG" +#line 1964 "VBNET.ATG" out type, false); if (la.kind == 25) { lexer.NextToken(); NormalOrReDimArgumentList( -#line 1974 "VBNET.ATG" +#line 1965 "VBNET.ATG" out arguments, out canBeNormal, out canBeReDim); Expect(26); if (la.kind == 23 || -#line 1975 "VBNET.ATG" +#line 1966 "VBNET.ATG" la.kind == Tokens.OpenParenthesis) { if ( -#line 1975 "VBNET.ATG" +#line 1966 "VBNET.ATG" la.kind == Tokens.OpenParenthesis) { ArrayTypeModifiers( -#line 1976 "VBNET.ATG" +#line 1967 "VBNET.ATG" out dimensions); CollectionInitializer( -#line 1977 "VBNET.ATG" +#line 1968 "VBNET.ATG" out initializer); } else { CollectionInitializer( -#line 1978 "VBNET.ATG" +#line 1969 "VBNET.ATG" out initializer); } } -#line 1980 "VBNET.ATG" +#line 1971 "VBNET.ATG" if (canBeReDim && !canBeNormal && initializer == null) initializer = new CollectionInitializerExpression(); } } -#line 1984 "VBNET.ATG" +#line 1975 "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); + ArrayCreateExpression ace = new ArrayCreateExpression(type, initializer); ace.Arguments = arguments; oce = ace; } - if (la.kind == 218) { + if (la.kind == 113 || la.kind == 218) { + if (la.kind == 218) { -#line 1998 "VBNET.ATG" - NamedArgumentExpression memberInitializer = null; - - lexer.NextToken(); - -#line 2002 "VBNET.ATG" - CollectionInitializerExpression memberInitializers = new CollectionInitializerExpression(); - memberInitializers.StartLocation = la.Location; - - Expect(23); - MemberInitializer( -#line 2006 "VBNET.ATG" -out memberInitializer); - -#line 2007 "VBNET.ATG" - memberInitializers.CreateExpressions.Add(memberInitializer); - while (la.kind == 12) { +#line 1990 "VBNET.ATG" + MemberInitializerExpression memberInitializer = null; + lexer.NextToken(); + +#line 1994 "VBNET.ATG" + CollectionInitializerExpression memberInitializers = new CollectionInitializerExpression(); + memberInitializers.StartLocation = la.Location; + + Expect(23); MemberInitializer( -#line 2009 "VBNET.ATG" +#line 1998 "VBNET.ATG" out memberInitializer); -#line 2010 "VBNET.ATG" +#line 1999 "VBNET.ATG" memberInitializers.CreateExpressions.Add(memberInitializer); - } - Expect(24); + while (la.kind == 12) { + lexer.NextToken(); + MemberInitializer( +#line 2001 "VBNET.ATG" +out memberInitializer); -#line 2014 "VBNET.ATG" - memberInitializers.EndLocation = t.Location; - if(oce is ObjectCreateExpression) - { - ((ObjectCreateExpression)oce).ObjectInitializer = memberInitializers; - } - - } - } +#line 2002 "VBNET.ATG" + memberInitializers.CreateExpressions.Add(memberInitializer); + } + Expect(24); - void VariableInitializer( -#line 1530 "VBNET.ATG" -out Expression initializerExpression) { +#line 2006 "VBNET.ATG" + memberInitializers.EndLocation = t.Location; + if(oce is ObjectCreateExpression) + { + ((ObjectCreateExpression)oce).ObjectInitializer = memberInitializers; + } + + } else { + lexer.NextToken(); + CollectionInitializer( +#line 2016 "VBNET.ATG" +out initializer); -#line 1532 "VBNET.ATG" - initializerExpression = null; - - if (StartOf(24)) { - Expr( -#line 1534 "VBNET.ATG" -out initializerExpression); - } else if (la.kind == 23) { - CollectionInitializer( -#line 1535 "VBNET.ATG" -out initializerExpression); - } else SynErr(252); +#line 2018 "VBNET.ATG" + if(oce is ObjectCreateExpression) + ((ObjectCreateExpression)oce).ObjectInitializer = initializer; + + } + } } void AccessorDecls( @@ -3011,11 +3005,11 @@ out section); #line 1350 "VBNET.ATG" attributes.Add(section); } - if (StartOf(25)) { + if (StartOf(24)) { GetAccessorDecl( #line 1352 "VBNET.ATG" out getBlock, attributes); - if (StartOf(26)) { + if (StartOf(25)) { #line 1354 "VBNET.ATG" attributes = new List(); @@ -3031,11 +3025,11 @@ out section); #line 1356 "VBNET.ATG" out setBlock, attributes); } - } else if (StartOf(27)) { + } else if (StartOf(26)) { SetAccessorDecl( #line 1359 "VBNET.ATG" out setBlock, attributes); - if (StartOf(28)) { + if (StartOf(27)) { #line 1361 "VBNET.ATG" attributes = new List(); @@ -3051,7 +3045,7 @@ out section); #line 1363 "VBNET.ATG" out getBlock, attributes); } - } else SynErr(253); + } else SynErr(252); } void EventAccessorDeclaration( @@ -3145,7 +3139,7 @@ out stmt); eventAccessorDeclaration.Block = (BlockStatement)stmt; eventAccessorDeclaration.Parameters = p; - } else SynErr(254); + } else SynErr(253); } void OverloadableOperator( @@ -3317,7 +3311,7 @@ out OverloadableOperatorType operatorType) { break; } - default: SynErr(255); break; + default: SynErr(254); break; } } @@ -3396,31 +3390,31 @@ out stmt); } void PropertyAccessorAccessModifier( -#line 3437 "VBNET.ATG" +#line 3442 "VBNET.ATG" out Modifiers m) { -#line 3438 "VBNET.ATG" +#line 3443 "VBNET.ATG" m = Modifiers.None; - while (StartOf(29)) { + while (StartOf(28)) { if (la.kind == 173) { lexer.NextToken(); -#line 3440 "VBNET.ATG" +#line 3445 "VBNET.ATG" m |= Modifiers.Public; } else if (la.kind == 172) { lexer.NextToken(); -#line 3441 "VBNET.ATG" +#line 3446 "VBNET.ATG" m |= Modifiers.Protected; } else if (la.kind == 112) { lexer.NextToken(); -#line 3442 "VBNET.ATG" +#line 3447 "VBNET.ATG" m |= Modifiers.Internal; } else { lexer.NextToken(); -#line 3443 "VBNET.ATG" +#line 3448 "VBNET.ATG" m |= Modifiers.Private; } } @@ -3441,14 +3435,14 @@ out arrayModifiers); } void ArrayNameModifier( -#line 2514 "VBNET.ATG" +#line 2519 "VBNET.ATG" out ArrayList arrayModifiers) { -#line 2516 "VBNET.ATG" +#line 2521 "VBNET.ATG" arrayModifiers = null; ArrayTypeModifiers( -#line 2518 "VBNET.ATG" +#line 2523 "VBNET.ATG" out arrayModifiers); } @@ -3496,45 +3490,45 @@ out expr); } void CollectionInitializer( -#line 1539 "VBNET.ATG" -out Expression outExpr) { +#line 1530 "VBNET.ATG" +out CollectionInitializerExpression outExpr) { -#line 1541 "VBNET.ATG" +#line 1532 "VBNET.ATG" Expression expr = null; CollectionInitializerExpression initializer = new CollectionInitializerExpression(); Expect(23); - if (StartOf(30)) { - VariableInitializer( -#line 1546 "VBNET.ATG" + if (StartOf(29)) { + Expr( +#line 1537 "VBNET.ATG" out expr); -#line 1548 "VBNET.ATG" +#line 1539 "VBNET.ATG" if (expr != null) { initializer.CreateExpressions.Add(expr); } while ( -#line 1551 "VBNET.ATG" +#line 1542 "VBNET.ATG" NotFinalComma()) { Expect(12); - VariableInitializer( -#line 1551 "VBNET.ATG" + Expr( +#line 1542 "VBNET.ATG" out expr); -#line 1552 "VBNET.ATG" +#line 1543 "VBNET.ATG" if (expr != null) { initializer.CreateExpressions.Add(expr); } } } Expect(24); -#line 1555 "VBNET.ATG" +#line 1546 "VBNET.ATG" outExpr = initializer; } void EventMemberSpecifier( -#line 1625 "VBNET.ATG" +#line 1616 "VBNET.ATG" out string name) { -#line 1626 "VBNET.ATG" +#line 1617 "VBNET.ATG" string eventName; if (StartOf(14)) { Identifier(); @@ -3542,55 +3536,55 @@ out string name) { lexer.NextToken(); } else if (la.kind == 139) { lexer.NextToken(); - } else SynErr(256); + } else SynErr(255); -#line 1629 "VBNET.ATG" +#line 1620 "VBNET.ATG" name = t.val; Expect(16); IdentifierOrKeyword( -#line 1631 "VBNET.ATG" +#line 1622 "VBNET.ATG" out eventName); -#line 1632 "VBNET.ATG" +#line 1623 "VBNET.ATG" name = name + "." + eventName; } void IdentifierOrKeyword( -#line 3370 "VBNET.ATG" +#line 3375 "VBNET.ATG" out string name) { -#line 3372 "VBNET.ATG" +#line 3377 "VBNET.ATG" lexer.NextToken(); name = t.val; } void QueryExpr( -#line 2041 "VBNET.ATG" +#line 2043 "VBNET.ATG" out Expression expr) { -#line 2043 "VBNET.ATG" +#line 2045 "VBNET.ATG" QueryExpressionVB qexpr = new QueryExpressionVB(); qexpr.StartLocation = la.Location; expr = qexpr; FromOrAggregateQueryOperator( -#line 2047 "VBNET.ATG" +#line 2049 "VBNET.ATG" qexpr.Clauses); - while (StartOf(31)) { + while (StartOf(30)) { QueryOperator( -#line 2048 "VBNET.ATG" +#line 2050 "VBNET.ATG" qexpr.Clauses); } -#line 2050 "VBNET.ATG" +#line 2052 "VBNET.ATG" qexpr.EndLocation = t.EndLocation; } void LambdaExpr( -#line 2023 "VBNET.ATG" +#line 2025 "VBNET.ATG" out Expression expr) { -#line 2025 "VBNET.ATG" +#line 2027 "VBNET.ATG" Expression inner = null; LambdaExpression lambda = new LambdaExpression(); lambda.StartLocation = la.Location; @@ -3600,16 +3594,16 @@ out Expression expr) { lexer.NextToken(); if (StartOf(4)) { FormalParameterList( -#line 2031 "VBNET.ATG" +#line 2033 "VBNET.ATG" lambda.Parameters); } Expect(26); } Expr( -#line 2032 "VBNET.ATG" +#line 2034 "VBNET.ATG" out inner); -#line 2034 "VBNET.ATG" +#line 2036 "VBNET.ATG" lambda.ExpressionBody = inner; lambda.EndLocation = t.EndLocation; // la.Location? @@ -3618,274 +3612,274 @@ out inner); } void DisjunctionExpr( -#line 1807 "VBNET.ATG" +#line 1798 "VBNET.ATG" out Expression outExpr) { -#line 1809 "VBNET.ATG" +#line 1800 "VBNET.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; ConjunctionExpr( -#line 1812 "VBNET.ATG" +#line 1803 "VBNET.ATG" out outExpr); while (la.kind == 161 || la.kind == 163 || la.kind == 221) { if (la.kind == 161) { lexer.NextToken(); -#line 1815 "VBNET.ATG" +#line 1806 "VBNET.ATG" op = BinaryOperatorType.BitwiseOr; } else if (la.kind == 163) { lexer.NextToken(); -#line 1816 "VBNET.ATG" +#line 1807 "VBNET.ATG" op = BinaryOperatorType.LogicalOr; } else { lexer.NextToken(); -#line 1817 "VBNET.ATG" +#line 1808 "VBNET.ATG" op = BinaryOperatorType.ExclusiveOr; } ConjunctionExpr( -#line 1819 "VBNET.ATG" +#line 1810 "VBNET.ATG" out expr); -#line 1819 "VBNET.ATG" +#line 1810 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } } void AssignmentOperator( -#line 1643 "VBNET.ATG" +#line 1634 "VBNET.ATG" out AssignmentOperatorType op) { -#line 1644 "VBNET.ATG" +#line 1635 "VBNET.ATG" op = AssignmentOperatorType.None; switch (la.kind) { case 10: { lexer.NextToken(); -#line 1645 "VBNET.ATG" +#line 1636 "VBNET.ATG" op = AssignmentOperatorType.Assign; break; } case 42: { lexer.NextToken(); -#line 1646 "VBNET.ATG" +#line 1637 "VBNET.ATG" op = AssignmentOperatorType.ConcatString; break; } case 34: { lexer.NextToken(); -#line 1647 "VBNET.ATG" +#line 1638 "VBNET.ATG" op = AssignmentOperatorType.Add; break; } case 36: { lexer.NextToken(); -#line 1648 "VBNET.ATG" +#line 1639 "VBNET.ATG" op = AssignmentOperatorType.Subtract; break; } case 37: { lexer.NextToken(); -#line 1649 "VBNET.ATG" +#line 1640 "VBNET.ATG" op = AssignmentOperatorType.Multiply; break; } case 38: { lexer.NextToken(); -#line 1650 "VBNET.ATG" +#line 1641 "VBNET.ATG" op = AssignmentOperatorType.Divide; break; } case 39: { lexer.NextToken(); -#line 1651 "VBNET.ATG" +#line 1642 "VBNET.ATG" op = AssignmentOperatorType.DivideInteger; break; } case 35: { lexer.NextToken(); -#line 1652 "VBNET.ATG" +#line 1643 "VBNET.ATG" op = AssignmentOperatorType.Power; break; } case 40: { lexer.NextToken(); -#line 1653 "VBNET.ATG" +#line 1644 "VBNET.ATG" op = AssignmentOperatorType.ShiftLeft; break; } case 41: { lexer.NextToken(); -#line 1654 "VBNET.ATG" +#line 1645 "VBNET.ATG" op = AssignmentOperatorType.ShiftRight; break; } - default: SynErr(257); break; + default: SynErr(256); break; } } void SimpleExpr( -#line 1658 "VBNET.ATG" +#line 1649 "VBNET.ATG" out Expression pexpr) { -#line 1659 "VBNET.ATG" +#line 1650 "VBNET.ATG" string name; SimpleNonInvocationExpression( -#line 1661 "VBNET.ATG" +#line 1652 "VBNET.ATG" out pexpr); while (la.kind == 16 || la.kind == 17 || la.kind == 25) { if (la.kind == 16) { lexer.NextToken(); IdentifierOrKeyword( -#line 1663 "VBNET.ATG" +#line 1654 "VBNET.ATG" out name); -#line 1664 "VBNET.ATG" +#line 1655 "VBNET.ATG" pexpr = new MemberReferenceExpression(pexpr, name); if ( -#line 1665 "VBNET.ATG" +#line 1656 "VBNET.ATG" la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of) { lexer.NextToken(); Expect(155); TypeArgumentList( -#line 1666 "VBNET.ATG" +#line 1657 "VBNET.ATG" ((MemberReferenceExpression)pexpr).TypeArguments); Expect(26); } } else if (la.kind == 17) { lexer.NextToken(); IdentifierOrKeyword( -#line 1668 "VBNET.ATG" +#line 1659 "VBNET.ATG" out name); -#line 1668 "VBNET.ATG" +#line 1659 "VBNET.ATG" pexpr = new BinaryOperatorExpression(pexpr, BinaryOperatorType.DictionaryAccess, new PrimitiveExpression(name, name)); } else { InvocationExpression( -#line 1669 "VBNET.ATG" +#line 1660 "VBNET.ATG" ref pexpr); } } } void SimpleNonInvocationExpression( -#line 1673 "VBNET.ATG" +#line 1664 "VBNET.ATG" out Expression pexpr) { -#line 1675 "VBNET.ATG" +#line 1666 "VBNET.ATG" Expression expr; TypeReference type = null; string name = String.Empty; pexpr = null; - if (StartOf(32)) { + if (StartOf(31)) { switch (la.kind) { case 3: { lexer.NextToken(); -#line 1683 "VBNET.ATG" +#line 1674 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; break; } case 4: { lexer.NextToken(); -#line 1684 "VBNET.ATG" +#line 1675 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; break; } case 7: { lexer.NextToken(); -#line 1685 "VBNET.ATG" +#line 1676 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; break; } case 6: { lexer.NextToken(); -#line 1686 "VBNET.ATG" +#line 1677 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; break; } case 5: { lexer.NextToken(); -#line 1687 "VBNET.ATG" +#line 1678 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; break; } case 9: { lexer.NextToken(); -#line 1688 "VBNET.ATG" +#line 1679 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; break; } case 8: { lexer.NextToken(); -#line 1689 "VBNET.ATG" +#line 1680 "VBNET.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; break; } case 202: { lexer.NextToken(); -#line 1691 "VBNET.ATG" +#line 1682 "VBNET.ATG" pexpr = new PrimitiveExpression(true, "true"); break; } case 109: { lexer.NextToken(); -#line 1692 "VBNET.ATG" +#line 1683 "VBNET.ATG" pexpr = new PrimitiveExpression(false, "false"); break; } case 151: { lexer.NextToken(); -#line 1693 "VBNET.ATG" +#line 1684 "VBNET.ATG" pexpr = new PrimitiveExpression(null, "null"); break; } case 25: { lexer.NextToken(); Expr( -#line 1694 "VBNET.ATG" +#line 1685 "VBNET.ATG" out expr); Expect(26); -#line 1694 "VBNET.ATG" +#line 1685 "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 1696 "VBNET.ATG" +#line 1687 "VBNET.ATG" pexpr = new IdentifierExpression(t.val); pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation; if ( -#line 1699 "VBNET.ATG" +#line 1690 "VBNET.ATG" la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of) { lexer.NextToken(); Expect(155); TypeArgumentList( -#line 1700 "VBNET.ATG" +#line 1691 "VBNET.ATG" ((IdentifierExpression)pexpr).TypeArguments); Expect(26); } @@ -3893,51 +3887,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 1702 "VBNET.ATG" +#line 1693 "VBNET.ATG" string val = String.Empty; if (StartOf(11)) { PrimitiveTypeName( -#line 1703 "VBNET.ATG" +#line 1694 "VBNET.ATG" out val); } else if (la.kind == 154) { lexer.NextToken(); -#line 1703 "VBNET.ATG" +#line 1694 "VBNET.ATG" val = "System.Object"; - } else SynErr(258); + } else SynErr(257); -#line 1704 "VBNET.ATG" +#line 1695 "VBNET.ATG" pexpr = new TypeReferenceExpression(new TypeReference(val, true)); break; } case 139: { lexer.NextToken(); -#line 1705 "VBNET.ATG" +#line 1696 "VBNET.ATG" pexpr = new ThisReferenceExpression(); break; } case 144: case 145: { -#line 1706 "VBNET.ATG" +#line 1697 "VBNET.ATG" Expression retExpr = null; if (la.kind == 144) { lexer.NextToken(); -#line 1707 "VBNET.ATG" +#line 1698 "VBNET.ATG" retExpr = new BaseReferenceExpression(); } else if (la.kind == 145) { lexer.NextToken(); -#line 1708 "VBNET.ATG" +#line 1699 "VBNET.ATG" retExpr = new ClassReferenceExpression(); - } else SynErr(259); + } else SynErr(258); Expect(16); IdentifierOrKeyword( -#line 1710 "VBNET.ATG" +#line 1701 "VBNET.ATG" out name); -#line 1710 "VBNET.ATG" +#line 1701 "VBNET.ATG" pexpr = new MemberReferenceExpression(retExpr, name); break; } @@ -3946,77 +3940,77 @@ out name); Expect(16); Identifier(); -#line 1712 "VBNET.ATG" +#line 1703 "VBNET.ATG" type = new TypeReference(t.val ?? ""); -#line 1714 "VBNET.ATG" +#line 1705 "VBNET.ATG" type.IsGlobal = true; -#line 1715 "VBNET.ATG" +#line 1706 "VBNET.ATG" pexpr = new TypeReferenceExpression(type); break; } case 148: { ObjectCreateExpression( -#line 1716 "VBNET.ATG" +#line 1707 "VBNET.ATG" out expr); -#line 1716 "VBNET.ATG" +#line 1707 "VBNET.ATG" pexpr = expr; break; } case 81: case 93: case 204: { -#line 1718 "VBNET.ATG" +#line 1709 "VBNET.ATG" CastType castType = CastType.Cast; if (la.kind == 93) { lexer.NextToken(); } else if (la.kind == 81) { lexer.NextToken(); -#line 1720 "VBNET.ATG" +#line 1711 "VBNET.ATG" castType = CastType.Conversion; } else if (la.kind == 204) { lexer.NextToken(); -#line 1721 "VBNET.ATG" +#line 1712 "VBNET.ATG" castType = CastType.TryCast; - } else SynErr(260); + } else SynErr(259); Expect(25); Expr( -#line 1723 "VBNET.ATG" +#line 1714 "VBNET.ATG" out expr); Expect(12); TypeName( -#line 1723 "VBNET.ATG" +#line 1714 "VBNET.ATG" out type); Expect(26); -#line 1724 "VBNET.ATG" +#line 1715 "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 1725 "VBNET.ATG" +#line 1716 "VBNET.ATG" out type); Expect(25); Expr( -#line 1725 "VBNET.ATG" +#line 1716 "VBNET.ATG" out expr); Expect(26); -#line 1725 "VBNET.ATG" +#line 1716 "VBNET.ATG" pexpr = new CastExpression(type, expr, CastType.PrimitiveConversion); break; } case 44: { lexer.NextToken(); Expr( -#line 1726 "VBNET.ATG" +#line 1717 "VBNET.ATG" out expr); -#line 1726 "VBNET.ATG" +#line 1717 "VBNET.ATG" pexpr = new AddressOfExpression(expr); break; } @@ -4024,31 +4018,31 @@ out expr); lexer.NextToken(); Expect(25); GetTypeTypeName( -#line 1727 "VBNET.ATG" +#line 1718 "VBNET.ATG" out type); Expect(26); -#line 1727 "VBNET.ATG" +#line 1718 "VBNET.ATG" pexpr = new TypeOfExpression(type); break; } case 205: { lexer.NextToken(); SimpleExpr( -#line 1728 "VBNET.ATG" +#line 1719 "VBNET.ATG" out expr); Expect(131); TypeName( -#line 1728 "VBNET.ATG" +#line 1719 "VBNET.ATG" out type); -#line 1728 "VBNET.ATG" +#line 1719 "VBNET.ATG" pexpr = new TypeOfIsExpression(expr, type); break; } case 122: { ConditionalExpression( -#line 1729 "VBNET.ATG" +#line 1720 "VBNET.ATG" out pexpr); break; } @@ -4056,315 +4050,315 @@ out pexpr); } else if (la.kind == 16) { lexer.NextToken(); IdentifierOrKeyword( -#line 1733 "VBNET.ATG" +#line 1724 "VBNET.ATG" out name); -#line 1733 "VBNET.ATG" +#line 1724 "VBNET.ATG" pexpr = new MemberReferenceExpression(null, name); - } else SynErr(261); + } else SynErr(260); } void TypeArgumentList( -#line 2550 "VBNET.ATG" +#line 2555 "VBNET.ATG" List typeArguments) { -#line 2552 "VBNET.ATG" +#line 2557 "VBNET.ATG" TypeReference typeref; TypeName( -#line 2554 "VBNET.ATG" +#line 2559 "VBNET.ATG" out typeref); -#line 2554 "VBNET.ATG" +#line 2559 "VBNET.ATG" if (typeref != null) typeArguments.Add(typeref); while (la.kind == 12) { lexer.NextToken(); TypeName( -#line 2557 "VBNET.ATG" +#line 2562 "VBNET.ATG" out typeref); -#line 2557 "VBNET.ATG" +#line 2562 "VBNET.ATG" if (typeref != null) typeArguments.Add(typeref); } } void InvocationExpression( -#line 1771 "VBNET.ATG" +#line 1762 "VBNET.ATG" ref Expression pexpr) { -#line 1772 "VBNET.ATG" +#line 1763 "VBNET.ATG" List parameters = null; Expect(25); -#line 1774 "VBNET.ATG" +#line 1765 "VBNET.ATG" Location start = t.Location; ArgumentList( -#line 1775 "VBNET.ATG" +#line 1766 "VBNET.ATG" out parameters); Expect(26); -#line 1778 "VBNET.ATG" +#line 1769 "VBNET.ATG" pexpr = new InvocationExpression(pexpr, parameters); -#line 1780 "VBNET.ATG" +#line 1771 "VBNET.ATG" pexpr.StartLocation = start; pexpr.EndLocation = t.Location; } void PrimitiveTypeName( -#line 3377 "VBNET.ATG" +#line 3382 "VBNET.ATG" out string type) { -#line 3378 "VBNET.ATG" +#line 3383 "VBNET.ATG" type = String.Empty; switch (la.kind) { case 55: { lexer.NextToken(); -#line 3379 "VBNET.ATG" +#line 3384 "VBNET.ATG" type = "System.Boolean"; break; } case 86: { lexer.NextToken(); -#line 3380 "VBNET.ATG" +#line 3385 "VBNET.ATG" type = "System.DateTime"; break; } case 69: { lexer.NextToken(); -#line 3381 "VBNET.ATG" +#line 3386 "VBNET.ATG" type = "System.Char"; break; } case 193: { lexer.NextToken(); -#line 3382 "VBNET.ATG" +#line 3387 "VBNET.ATG" type = "System.String"; break; } case 87: { lexer.NextToken(); -#line 3383 "VBNET.ATG" +#line 3388 "VBNET.ATG" type = "System.Decimal"; break; } case 58: { lexer.NextToken(); -#line 3384 "VBNET.ATG" +#line 3389 "VBNET.ATG" type = "System.Byte"; break; } case 186: { lexer.NextToken(); -#line 3385 "VBNET.ATG" +#line 3390 "VBNET.ATG" type = "System.Int16"; break; } case 128: { lexer.NextToken(); -#line 3386 "VBNET.ATG" +#line 3391 "VBNET.ATG" type = "System.Int32"; break; } case 137: { lexer.NextToken(); -#line 3387 "VBNET.ATG" +#line 3392 "VBNET.ATG" type = "System.Int64"; break; } case 187: { lexer.NextToken(); -#line 3388 "VBNET.ATG" +#line 3393 "VBNET.ATG" type = "System.Single"; break; } case 96: { lexer.NextToken(); -#line 3389 "VBNET.ATG" +#line 3394 "VBNET.ATG" type = "System.Double"; break; } case 206: { lexer.NextToken(); -#line 3390 "VBNET.ATG" +#line 3395 "VBNET.ATG" type = "System.UInt32"; break; } case 207: { lexer.NextToken(); -#line 3391 "VBNET.ATG" +#line 3396 "VBNET.ATG" type = "System.UInt64"; break; } case 210: { lexer.NextToken(); -#line 3392 "VBNET.ATG" +#line 3397 "VBNET.ATG" type = "System.UInt16"; break; } case 181: { lexer.NextToken(); -#line 3393 "VBNET.ATG" +#line 3398 "VBNET.ATG" type = "System.SByte"; break; } - default: SynErr(262); break; + default: SynErr(261); break; } } void CastTarget( -#line 1785 "VBNET.ATG" +#line 1776 "VBNET.ATG" out TypeReference type) { -#line 1787 "VBNET.ATG" +#line 1778 "VBNET.ATG" type = null; switch (la.kind) { case 63: { lexer.NextToken(); -#line 1789 "VBNET.ATG" +#line 1780 "VBNET.ATG" type = new TypeReference("System.Boolean", true); break; } case 64: { lexer.NextToken(); -#line 1790 "VBNET.ATG" +#line 1781 "VBNET.ATG" type = new TypeReference("System.Byte", true); break; } case 77: { lexer.NextToken(); -#line 1791 "VBNET.ATG" +#line 1782 "VBNET.ATG" type = new TypeReference("System.SByte", true); break; } case 65: { lexer.NextToken(); -#line 1792 "VBNET.ATG" +#line 1783 "VBNET.ATG" type = new TypeReference("System.Char", true); break; } case 66: { lexer.NextToken(); -#line 1793 "VBNET.ATG" +#line 1784 "VBNET.ATG" type = new TypeReference("System.DateTime", true); break; } case 68: { lexer.NextToken(); -#line 1794 "VBNET.ATG" +#line 1785 "VBNET.ATG" type = new TypeReference("System.Decimal", true); break; } case 67: { lexer.NextToken(); -#line 1795 "VBNET.ATG" +#line 1786 "VBNET.ATG" type = new TypeReference("System.Double", true); break; } case 78: { lexer.NextToken(); -#line 1796 "VBNET.ATG" +#line 1787 "VBNET.ATG" type = new TypeReference("System.Int16", true); break; } case 70: { lexer.NextToken(); -#line 1797 "VBNET.ATG" +#line 1788 "VBNET.ATG" type = new TypeReference("System.Int32", true); break; } case 72: { lexer.NextToken(); -#line 1798 "VBNET.ATG" +#line 1789 "VBNET.ATG" type = new TypeReference("System.Int64", true); break; } case 84: { lexer.NextToken(); -#line 1799 "VBNET.ATG" +#line 1790 "VBNET.ATG" type = new TypeReference("System.UInt16", true); break; } case 82: { lexer.NextToken(); -#line 1800 "VBNET.ATG" +#line 1791 "VBNET.ATG" type = new TypeReference("System.UInt32", true); break; } case 83: { lexer.NextToken(); -#line 1801 "VBNET.ATG" +#line 1792 "VBNET.ATG" type = new TypeReference("System.UInt64", true); break; } case 73: { lexer.NextToken(); -#line 1802 "VBNET.ATG" +#line 1793 "VBNET.ATG" type = new TypeReference("System.Object", true); break; } case 79: { lexer.NextToken(); -#line 1803 "VBNET.ATG" +#line 1794 "VBNET.ATG" type = new TypeReference("System.Single", true); break; } case 80: { lexer.NextToken(); -#line 1804 "VBNET.ATG" +#line 1795 "VBNET.ATG" type = new TypeReference("System.String", true); break; } - default: SynErr(263); break; + default: SynErr(262); break; } } void GetTypeTypeName( -#line 2449 "VBNET.ATG" +#line 2454 "VBNET.ATG" out TypeReference typeref) { -#line 2450 "VBNET.ATG" +#line 2455 "VBNET.ATG" ArrayList rank = null; NonArrayTypeName( -#line 2452 "VBNET.ATG" +#line 2457 "VBNET.ATG" out typeref, true); ArrayTypeModifiers( -#line 2453 "VBNET.ATG" +#line 2458 "VBNET.ATG" out rank); -#line 2454 "VBNET.ATG" +#line 2459 "VBNET.ATG" if (rank != null && typeref != null) { typeref.RankSpecifier = (int[])rank.ToArray(typeof(int)); } @@ -4372,10 +4366,10 @@ out rank); } void ConditionalExpression( -#line 1737 "VBNET.ATG" +#line 1728 "VBNET.ATG" out Expression expr) { -#line 1739 "VBNET.ATG" +#line 1730 "VBNET.ATG" ConditionalExpression conditionalExpression = new ConditionalExpression(); BinaryOperatorExpression binaryOperatorExpression = new BinaryOperatorExpression(); conditionalExpression.StartLocation = binaryOperatorExpression.StartLocation = la.Location; @@ -4387,21 +4381,21 @@ out Expression expr) { Expect(122); Expect(25); Expr( -#line 1748 "VBNET.ATG" +#line 1739 "VBNET.ATG" out condition); Expect(12); Expr( -#line 1748 "VBNET.ATG" +#line 1739 "VBNET.ATG" out trueExpr); if (la.kind == 12) { lexer.NextToken(); Expr( -#line 1748 "VBNET.ATG" +#line 1739 "VBNET.ATG" out falseExpr); } Expect(26); -#line 1750 "VBNET.ATG" +#line 1741 "VBNET.ATG" if(falseExpr != null) { conditionalExpression.Condition = condition; @@ -4424,348 +4418,348 @@ out falseExpr); } void ArgumentList( -#line 2381 "VBNET.ATG" +#line 2386 "VBNET.ATG" out List arguments) { -#line 2383 "VBNET.ATG" +#line 2388 "VBNET.ATG" arguments = new List(); Expression expr = null; - if (StartOf(24)) { + if (StartOf(29)) { Argument( -#line 2386 "VBNET.ATG" +#line 2391 "VBNET.ATG" out expr); } while (la.kind == 12) { lexer.NextToken(); -#line 2387 "VBNET.ATG" +#line 2392 "VBNET.ATG" arguments.Add(expr ?? Expression.Null); expr = null; - if (StartOf(24)) { + if (StartOf(29)) { Argument( -#line 2388 "VBNET.ATG" +#line 2393 "VBNET.ATG" out expr); } -#line 2389 "VBNET.ATG" +#line 2394 "VBNET.ATG" if (expr == null) expr = Expression.Null; } -#line 2391 "VBNET.ATG" +#line 2396 "VBNET.ATG" if (expr != null) arguments.Add(expr); } void ConjunctionExpr( -#line 1823 "VBNET.ATG" +#line 1814 "VBNET.ATG" out Expression outExpr) { -#line 1825 "VBNET.ATG" +#line 1816 "VBNET.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; NotExpr( -#line 1828 "VBNET.ATG" +#line 1819 "VBNET.ATG" out outExpr); while (la.kind == 47 || la.kind == 48) { if (la.kind == 47) { lexer.NextToken(); -#line 1831 "VBNET.ATG" +#line 1822 "VBNET.ATG" op = BinaryOperatorType.BitwiseAnd; } else { lexer.NextToken(); -#line 1832 "VBNET.ATG" +#line 1823 "VBNET.ATG" op = BinaryOperatorType.LogicalAnd; } NotExpr( -#line 1834 "VBNET.ATG" +#line 1825 "VBNET.ATG" out expr); -#line 1834 "VBNET.ATG" +#line 1825 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } } void NotExpr( -#line 1838 "VBNET.ATG" +#line 1829 "VBNET.ATG" out Expression outExpr) { -#line 1839 "VBNET.ATG" +#line 1830 "VBNET.ATG" UnaryOperatorType uop = UnaryOperatorType.None; while (la.kind == 150) { lexer.NextToken(); -#line 1840 "VBNET.ATG" +#line 1831 "VBNET.ATG" uop = UnaryOperatorType.Not; } ComparisonExpr( -#line 1841 "VBNET.ATG" +#line 1832 "VBNET.ATG" out outExpr); -#line 1842 "VBNET.ATG" +#line 1833 "VBNET.ATG" if (uop != UnaryOperatorType.None) outExpr = new UnaryOperatorExpression(outExpr, uop); } void ComparisonExpr( -#line 1847 "VBNET.ATG" +#line 1838 "VBNET.ATG" out Expression outExpr) { -#line 1849 "VBNET.ATG" +#line 1840 "VBNET.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; ShiftExpr( -#line 1852 "VBNET.ATG" +#line 1843 "VBNET.ATG" out outExpr); - while (StartOf(33)) { + while (StartOf(32)) { switch (la.kind) { case 28: { lexer.NextToken(); -#line 1855 "VBNET.ATG" +#line 1846 "VBNET.ATG" op = BinaryOperatorType.LessThan; break; } case 27: { lexer.NextToken(); -#line 1856 "VBNET.ATG" +#line 1847 "VBNET.ATG" op = BinaryOperatorType.GreaterThan; break; } case 31: { lexer.NextToken(); -#line 1857 "VBNET.ATG" +#line 1848 "VBNET.ATG" op = BinaryOperatorType.LessThanOrEqual; break; } case 30: { lexer.NextToken(); -#line 1858 "VBNET.ATG" +#line 1849 "VBNET.ATG" op = BinaryOperatorType.GreaterThanOrEqual; break; } case 29: { lexer.NextToken(); -#line 1859 "VBNET.ATG" +#line 1850 "VBNET.ATG" op = BinaryOperatorType.InEquality; break; } case 10: { lexer.NextToken(); -#line 1860 "VBNET.ATG" +#line 1851 "VBNET.ATG" op = BinaryOperatorType.Equality; break; } case 136: { lexer.NextToken(); -#line 1861 "VBNET.ATG" +#line 1852 "VBNET.ATG" op = BinaryOperatorType.Like; break; } case 131: { lexer.NextToken(); -#line 1862 "VBNET.ATG" +#line 1853 "VBNET.ATG" op = BinaryOperatorType.ReferenceEquality; break; } case 132: { lexer.NextToken(); -#line 1863 "VBNET.ATG" +#line 1854 "VBNET.ATG" op = BinaryOperatorType.ReferenceInequality; break; } } - if (StartOf(34)) { + if (StartOf(33)) { ShiftExpr( -#line 1866 "VBNET.ATG" +#line 1857 "VBNET.ATG" out expr); -#line 1866 "VBNET.ATG" +#line 1857 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } else if (la.kind == 150) { lexer.NextToken(); ShiftExpr( -#line 1869 "VBNET.ATG" +#line 1860 "VBNET.ATG" out expr); -#line 1869 "VBNET.ATG" +#line 1860 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, new UnaryOperatorExpression(expr, UnaryOperatorType.Not)); - } else SynErr(264); + } else SynErr(263); } } void ShiftExpr( -#line 1874 "VBNET.ATG" +#line 1865 "VBNET.ATG" out Expression outExpr) { -#line 1876 "VBNET.ATG" +#line 1867 "VBNET.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; ConcatenationExpr( -#line 1879 "VBNET.ATG" +#line 1870 "VBNET.ATG" out outExpr); while (la.kind == 32 || la.kind == 33) { if (la.kind == 32) { lexer.NextToken(); -#line 1882 "VBNET.ATG" +#line 1873 "VBNET.ATG" op = BinaryOperatorType.ShiftLeft; } else { lexer.NextToken(); -#line 1883 "VBNET.ATG" +#line 1874 "VBNET.ATG" op = BinaryOperatorType.ShiftRight; } ConcatenationExpr( -#line 1885 "VBNET.ATG" +#line 1876 "VBNET.ATG" out expr); -#line 1885 "VBNET.ATG" +#line 1876 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } } void ConcatenationExpr( -#line 1889 "VBNET.ATG" +#line 1880 "VBNET.ATG" out Expression outExpr) { -#line 1890 "VBNET.ATG" +#line 1881 "VBNET.ATG" Expression expr; AdditiveExpr( -#line 1892 "VBNET.ATG" +#line 1883 "VBNET.ATG" out outExpr); while (la.kind == 13) { lexer.NextToken(); AdditiveExpr( -#line 1892 "VBNET.ATG" +#line 1883 "VBNET.ATG" out expr); -#line 1892 "VBNET.ATG" +#line 1883 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.Concat, expr); } } void AdditiveExpr( -#line 1895 "VBNET.ATG" +#line 1886 "VBNET.ATG" out Expression outExpr) { -#line 1897 "VBNET.ATG" +#line 1888 "VBNET.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; ModuloExpr( -#line 1900 "VBNET.ATG" +#line 1891 "VBNET.ATG" out outExpr); while (la.kind == 18 || la.kind == 19) { if (la.kind == 19) { lexer.NextToken(); -#line 1903 "VBNET.ATG" +#line 1894 "VBNET.ATG" op = BinaryOperatorType.Add; } else { lexer.NextToken(); -#line 1904 "VBNET.ATG" +#line 1895 "VBNET.ATG" op = BinaryOperatorType.Subtract; } ModuloExpr( -#line 1906 "VBNET.ATG" +#line 1897 "VBNET.ATG" out expr); -#line 1906 "VBNET.ATG" +#line 1897 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } } void ModuloExpr( -#line 1910 "VBNET.ATG" +#line 1901 "VBNET.ATG" out Expression outExpr) { -#line 1911 "VBNET.ATG" +#line 1902 "VBNET.ATG" Expression expr; IntegerDivisionExpr( -#line 1913 "VBNET.ATG" +#line 1904 "VBNET.ATG" out outExpr); while (la.kind == 140) { lexer.NextToken(); IntegerDivisionExpr( -#line 1913 "VBNET.ATG" +#line 1904 "VBNET.ATG" out expr); -#line 1913 "VBNET.ATG" +#line 1904 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.Modulus, expr); } } void IntegerDivisionExpr( -#line 1916 "VBNET.ATG" +#line 1907 "VBNET.ATG" out Expression outExpr) { -#line 1917 "VBNET.ATG" +#line 1908 "VBNET.ATG" Expression expr; MultiplicativeExpr( -#line 1919 "VBNET.ATG" +#line 1910 "VBNET.ATG" out outExpr); while (la.kind == 15) { lexer.NextToken(); MultiplicativeExpr( -#line 1919 "VBNET.ATG" +#line 1910 "VBNET.ATG" out expr); -#line 1919 "VBNET.ATG" +#line 1910 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.DivideInteger, expr); } } void MultiplicativeExpr( -#line 1922 "VBNET.ATG" +#line 1913 "VBNET.ATG" out Expression outExpr) { -#line 1924 "VBNET.ATG" +#line 1915 "VBNET.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; UnaryExpr( -#line 1927 "VBNET.ATG" +#line 1918 "VBNET.ATG" out outExpr); while (la.kind == 14 || la.kind == 22) { if (la.kind == 22) { lexer.NextToken(); -#line 1930 "VBNET.ATG" +#line 1921 "VBNET.ATG" op = BinaryOperatorType.Multiply; } else { lexer.NextToken(); -#line 1931 "VBNET.ATG" +#line 1922 "VBNET.ATG" op = BinaryOperatorType.Divide; } UnaryExpr( -#line 1933 "VBNET.ATG" +#line 1924 "VBNET.ATG" out expr); -#line 1933 "VBNET.ATG" +#line 1924 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } } void UnaryExpr( -#line 1937 "VBNET.ATG" +#line 1928 "VBNET.ATG" out Expression uExpr) { -#line 1939 "VBNET.ATG" +#line 1930 "VBNET.ATG" Expression expr; UnaryOperatorType uop = UnaryOperatorType.None; bool isUOp = false; @@ -4774,25 +4768,25 @@ out Expression uExpr) { if (la.kind == 19) { lexer.NextToken(); -#line 1943 "VBNET.ATG" +#line 1934 "VBNET.ATG" uop = UnaryOperatorType.Plus; isUOp = true; } else if (la.kind == 18) { lexer.NextToken(); -#line 1944 "VBNET.ATG" +#line 1935 "VBNET.ATG" uop = UnaryOperatorType.Minus; isUOp = true; } else { lexer.NextToken(); -#line 1945 "VBNET.ATG" +#line 1936 "VBNET.ATG" uop = UnaryOperatorType.Dereference; isUOp = true; } } ExponentiationExpr( -#line 1947 "VBNET.ATG" +#line 1938 "VBNET.ATG" out expr); -#line 1949 "VBNET.ATG" +#line 1940 "VBNET.ATG" if (isUOp) { uExpr = new UnaryOperatorExpression(expr, uop); } else { @@ -4802,107 +4796,107 @@ out expr); } void ExponentiationExpr( -#line 1957 "VBNET.ATG" +#line 1948 "VBNET.ATG" out Expression outExpr) { -#line 1958 "VBNET.ATG" +#line 1949 "VBNET.ATG" Expression expr; SimpleExpr( -#line 1960 "VBNET.ATG" +#line 1951 "VBNET.ATG" out outExpr); while (la.kind == 20) { lexer.NextToken(); SimpleExpr( -#line 1960 "VBNET.ATG" +#line 1951 "VBNET.ATG" out expr); -#line 1960 "VBNET.ATG" +#line 1951 "VBNET.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.Power, expr); } } void NormalOrReDimArgumentList( -#line 2395 "VBNET.ATG" +#line 2400 "VBNET.ATG" out List arguments, out bool canBeNormal, out bool canBeRedim) { -#line 2397 "VBNET.ATG" +#line 2402 "VBNET.ATG" arguments = new List(); canBeNormal = true; canBeRedim = !IsNamedAssign(); Expression expr = null; - if (StartOf(24)) { + if (StartOf(29)) { Argument( -#line 2402 "VBNET.ATG" +#line 2407 "VBNET.ATG" out expr); if (la.kind == 201) { lexer.NextToken(); -#line 2403 "VBNET.ATG" +#line 2408 "VBNET.ATG" EnsureIsZero(expr); canBeNormal = false; Expr( -#line 2404 "VBNET.ATG" +#line 2409 "VBNET.ATG" out expr); } } while (la.kind == 12) { lexer.NextToken(); -#line 2407 "VBNET.ATG" +#line 2412 "VBNET.ATG" if (expr == null) canBeRedim = false; -#line 2408 "VBNET.ATG" +#line 2413 "VBNET.ATG" arguments.Add(expr ?? Expression.Null); expr = null; -#line 2409 "VBNET.ATG" +#line 2414 "VBNET.ATG" canBeRedim &= !IsNamedAssign(); - if (StartOf(24)) { + if (StartOf(29)) { Argument( -#line 2410 "VBNET.ATG" +#line 2415 "VBNET.ATG" out expr); if (la.kind == 201) { lexer.NextToken(); -#line 2411 "VBNET.ATG" +#line 2416 "VBNET.ATG" EnsureIsZero(expr); canBeNormal = false; Expr( -#line 2412 "VBNET.ATG" +#line 2417 "VBNET.ATG" out expr); } } -#line 2414 "VBNET.ATG" +#line 2419 "VBNET.ATG" if (expr == null) { canBeRedim = false; expr = Expression.Null; } } -#line 2416 "VBNET.ATG" +#line 2421 "VBNET.ATG" if (expr != null) arguments.Add(expr); else canBeRedim = false; } void ArrayTypeModifiers( -#line 2523 "VBNET.ATG" +#line 2528 "VBNET.ATG" out ArrayList arrayModifiers) { -#line 2525 "VBNET.ATG" +#line 2530 "VBNET.ATG" arrayModifiers = new ArrayList(); int i = 0; while ( -#line 2528 "VBNET.ATG" +#line 2533 "VBNET.ATG" IsDims()) { Expect(25); if (la.kind == 12 || la.kind == 26) { RankList( -#line 2530 "VBNET.ATG" +#line 2535 "VBNET.ATG" out i); } -#line 2532 "VBNET.ATG" +#line 2537 "VBNET.ATG" arrayModifiers.Add(i); Expect(26); } -#line 2537 "VBNET.ATG" +#line 2542 "VBNET.ATG" if(arrayModifiers.Count == 0) { arrayModifiers = null; } @@ -4910,61 +4904,63 @@ out i); } void MemberInitializer( -#line 2365 "VBNET.ATG" -out NamedArgumentExpression memberInitializer) { - #line 2367 "VBNET.ATG" - memberInitializer = new NamedArgumentExpression(); +out MemberInitializerExpression memberInitializer) { + +#line 2369 "VBNET.ATG" + memberInitializer = new MemberInitializerExpression(); memberInitializer.StartLocation = la.Location; Expression initExpr = null; + bool isKey = false; string name = null; Expect(16); IdentifierOrKeyword( -#line 2372 "VBNET.ATG" +#line 2376 "VBNET.ATG" out name); Expect(10); Expr( -#line 2372 "VBNET.ATG" +#line 2376 "VBNET.ATG" out initExpr); -#line 2374 "VBNET.ATG" +#line 2378 "VBNET.ATG" memberInitializer.Name = name; memberInitializer.Expression = initExpr; + memberInitializer.IsKey = isKey; memberInitializer.EndLocation = t.EndLocation; } void FromOrAggregateQueryOperator( -#line 2054 "VBNET.ATG" +#line 2056 "VBNET.ATG" List middleClauses) { -#line 2056 "VBNET.ATG" +#line 2058 "VBNET.ATG" QueryExpressionFromClause fromClause = null; QueryExpressionAggregateClause aggregateClause = null; if (la.kind == 113) { FromQueryOperator( -#line 2059 "VBNET.ATG" +#line 2061 "VBNET.ATG" out fromClause); -#line 2060 "VBNET.ATG" +#line 2062 "VBNET.ATG" middleClauses.Add(fromClause); } else if (la.kind == 45) { AggregateQueryOperator( -#line 2061 "VBNET.ATG" +#line 2063 "VBNET.ATG" out aggregateClause); -#line 2062 "VBNET.ATG" +#line 2064 "VBNET.ATG" middleClauses.Add(aggregateClause); - } else SynErr(265); + } else SynErr(264); } void QueryOperator( -#line 2065 "VBNET.ATG" +#line 2067 "VBNET.ATG" List middleClauses) { -#line 2067 "VBNET.ATG" +#line 2069 "VBNET.ATG" QueryExpressionJoinVBClause joinClause = null; QueryExpressionGroupVBClause groupByClause = null; QueryExpressionPartitionVBClause partitionClause = null; @@ -4974,94 +4970,94 @@ List middleClauses) { if (la.kind == 113) { FromQueryOperator( -#line 2074 "VBNET.ATG" +#line 2076 "VBNET.ATG" out fromClause); -#line 2075 "VBNET.ATG" +#line 2077 "VBNET.ATG" middleClauses.Add(fromClause); } else if (la.kind == 45) { AggregateQueryOperator( -#line 2076 "VBNET.ATG" +#line 2078 "VBNET.ATG" out aggregateClause); -#line 2077 "VBNET.ATG" +#line 2079 "VBNET.ATG" middleClauses.Add(aggregateClause); } else if (la.kind == 182) { SelectQueryOperator( -#line 2078 "VBNET.ATG" +#line 2080 "VBNET.ATG" middleClauses); } else if (la.kind == 94) { DistinctQueryOperator( -#line 2079 "VBNET.ATG" +#line 2081 "VBNET.ATG" middleClauses); } else if (la.kind == 215) { WhereQueryOperator( -#line 2080 "VBNET.ATG" +#line 2082 "VBNET.ATG" middleClauses); } else if (la.kind == 162) { OrderByQueryOperator( -#line 2081 "VBNET.ATG" +#line 2083 "VBNET.ATG" middleClauses); } else if (la.kind == 188 || la.kind == 197) { PartitionQueryOperator( -#line 2082 "VBNET.ATG" +#line 2084 "VBNET.ATG" out partitionClause); -#line 2083 "VBNET.ATG" +#line 2085 "VBNET.ATG" middleClauses.Add(partitionClause); } else if (la.kind == 134) { LetQueryOperator( -#line 2084 "VBNET.ATG" +#line 2086 "VBNET.ATG" middleClauses); } else if (la.kind == 133) { JoinQueryOperator( -#line 2085 "VBNET.ATG" +#line 2087 "VBNET.ATG" out joinClause); -#line 2086 "VBNET.ATG" +#line 2088 "VBNET.ATG" middleClauses.Add(joinClause); } else if ( -#line 2087 "VBNET.ATG" +#line 2089 "VBNET.ATG" la.kind == Tokens.Group && Peek(1).kind == Tokens.Join) { GroupJoinQueryOperator( -#line 2087 "VBNET.ATG" +#line 2089 "VBNET.ATG" out groupJoinClause); -#line 2088 "VBNET.ATG" +#line 2090 "VBNET.ATG" middleClauses.Add(groupJoinClause); } else if (la.kind == 120) { GroupByQueryOperator( -#line 2089 "VBNET.ATG" +#line 2091 "VBNET.ATG" out groupByClause); -#line 2090 "VBNET.ATG" +#line 2092 "VBNET.ATG" middleClauses.Add(groupByClause); - } else SynErr(266); + } else SynErr(265); } void FromQueryOperator( -#line 2165 "VBNET.ATG" +#line 2167 "VBNET.ATG" out QueryExpressionFromClause fromClause) { -#line 2167 "VBNET.ATG" +#line 2169 "VBNET.ATG" fromClause = new QueryExpressionFromClause(); fromClause.StartLocation = la.Location; Expect(113); CollectionRangeVariableDeclarationList( -#line 2170 "VBNET.ATG" +#line 2172 "VBNET.ATG" fromClause.Sources); -#line 2172 "VBNET.ATG" +#line 2174 "VBNET.ATG" fromClause.EndLocation = t.EndLocation; } void AggregateQueryOperator( -#line 2234 "VBNET.ATG" +#line 2236 "VBNET.ATG" out QueryExpressionAggregateClause aggregateClause) { -#line 2236 "VBNET.ATG" +#line 2238 "VBNET.ATG" aggregateClause = new QueryExpressionAggregateClause(); aggregateClause.IntoVariables = new List(); aggregateClause.StartLocation = la.Location; @@ -5069,77 +5065,77 @@ out QueryExpressionAggregateClause aggregateClause) { Expect(45); CollectionRangeVariableDeclaration( -#line 2241 "VBNET.ATG" +#line 2243 "VBNET.ATG" out source); -#line 2243 "VBNET.ATG" +#line 2245 "VBNET.ATG" aggregateClause.Source = source; - while (StartOf(31)) { + while (StartOf(30)) { QueryOperator( -#line 2246 "VBNET.ATG" +#line 2248 "VBNET.ATG" aggregateClause.MiddleClauses); } Expect(130); ExpressionRangeVariableDeclarationList( -#line 2248 "VBNET.ATG" +#line 2250 "VBNET.ATG" aggregateClause.IntoVariables); -#line 2250 "VBNET.ATG" +#line 2252 "VBNET.ATG" aggregateClause.EndLocation = t.EndLocation; } void SelectQueryOperator( -#line 2176 "VBNET.ATG" +#line 2178 "VBNET.ATG" List middleClauses) { -#line 2178 "VBNET.ATG" +#line 2180 "VBNET.ATG" QueryExpressionSelectVBClause selectClause = new QueryExpressionSelectVBClause(); selectClause.StartLocation = la.Location; Expect(182); ExpressionRangeVariableDeclarationList( -#line 2181 "VBNET.ATG" +#line 2183 "VBNET.ATG" selectClause.Variables); -#line 2183 "VBNET.ATG" +#line 2185 "VBNET.ATG" selectClause.EndLocation = t.Location; middleClauses.Add(selectClause); } void DistinctQueryOperator( -#line 2188 "VBNET.ATG" +#line 2190 "VBNET.ATG" List middleClauses) { -#line 2190 "VBNET.ATG" +#line 2192 "VBNET.ATG" QueryExpressionDistinctClause distinctClause = new QueryExpressionDistinctClause(); distinctClause.StartLocation = la.Location; Expect(94); -#line 2195 "VBNET.ATG" +#line 2197 "VBNET.ATG" distinctClause.EndLocation = t.EndLocation; middleClauses.Add(distinctClause); } void WhereQueryOperator( -#line 2200 "VBNET.ATG" +#line 2202 "VBNET.ATG" List middleClauses) { -#line 2202 "VBNET.ATG" +#line 2204 "VBNET.ATG" QueryExpressionWhereClause whereClause = new QueryExpressionWhereClause(); whereClause.StartLocation = la.Location; Expression operand = null; Expect(215); Expr( -#line 2206 "VBNET.ATG" +#line 2208 "VBNET.ATG" out operand); -#line 2208 "VBNET.ATG" +#line 2210 "VBNET.ATG" whereClause.Condition = operand; whereClause.EndLocation = t.EndLocation; @@ -5148,10 +5144,10 @@ out operand); } void OrderByQueryOperator( -#line 2093 "VBNET.ATG" +#line 2095 "VBNET.ATG" List middleClauses) { -#line 2095 "VBNET.ATG" +#line 2097 "VBNET.ATG" QueryExpressionOrderClause orderClause = new QueryExpressionOrderClause(); orderClause.StartLocation = la.Location; List orderings = null; @@ -5159,10 +5155,10 @@ List middleClauses) { Expect(162); Expect(57); OrderExpressionList( -#line 2099 "VBNET.ATG" +#line 2101 "VBNET.ATG" out orderings); -#line 2101 "VBNET.ATG" +#line 2103 "VBNET.ATG" orderClause.Orderings = orderings; orderClause.EndLocation = t.EndLocation; middleClauses.Add(orderClause); @@ -5170,10 +5166,10 @@ out orderings); } void PartitionQueryOperator( -#line 2215 "VBNET.ATG" +#line 2217 "VBNET.ATG" out QueryExpressionPartitionVBClause partitionClause) { -#line 2217 "VBNET.ATG" +#line 2219 "VBNET.ATG" partitionClause = new QueryExpressionPartitionVBClause(); partitionClause.StartLocation = la.Location; Expression expr = null; @@ -5181,60 +5177,60 @@ out QueryExpressionPartitionVBClause partitionClause) { if (la.kind == 197) { lexer.NextToken(); -#line 2222 "VBNET.ATG" +#line 2224 "VBNET.ATG" partitionClause.PartitionType = QueryExpressionPartitionType.Take; if (la.kind == 216) { lexer.NextToken(); -#line 2223 "VBNET.ATG" +#line 2225 "VBNET.ATG" partitionClause.PartitionType = QueryExpressionPartitionType.TakeWhile; } } else if (la.kind == 188) { lexer.NextToken(); -#line 2224 "VBNET.ATG" +#line 2226 "VBNET.ATG" partitionClause.PartitionType = QueryExpressionPartitionType.Skip; if (la.kind == 216) { lexer.NextToken(); -#line 2225 "VBNET.ATG" +#line 2227 "VBNET.ATG" partitionClause.PartitionType = QueryExpressionPartitionType.SkipWhile; } - } else SynErr(267); + } else SynErr(266); Expr( -#line 2227 "VBNET.ATG" +#line 2229 "VBNET.ATG" out expr); -#line 2229 "VBNET.ATG" +#line 2231 "VBNET.ATG" partitionClause.Expression = expr; partitionClause.EndLocation = t.EndLocation; } void LetQueryOperator( -#line 2254 "VBNET.ATG" +#line 2256 "VBNET.ATG" List middleClauses) { -#line 2256 "VBNET.ATG" +#line 2258 "VBNET.ATG" QueryExpressionLetVBClause letClause = new QueryExpressionLetVBClause(); letClause.StartLocation = la.Location; Expect(134); ExpressionRangeVariableDeclarationList( -#line 2259 "VBNET.ATG" +#line 2261 "VBNET.ATG" letClause.Variables); -#line 2261 "VBNET.ATG" +#line 2263 "VBNET.ATG" letClause.EndLocation = t.EndLocation; middleClauses.Add(letClause); } void JoinQueryOperator( -#line 2298 "VBNET.ATG" +#line 2300 "VBNET.ATG" out QueryExpressionJoinVBClause joinClause) { -#line 2300 "VBNET.ATG" +#line 2302 "VBNET.ATG" joinClause = new QueryExpressionJoinVBClause(); joinClause.StartLocation = la.Location; CollectionRangeVariable joinVariable = null; @@ -5244,203 +5240,203 @@ out QueryExpressionJoinVBClause joinClause) { Expect(133); CollectionRangeVariableDeclaration( -#line 2307 "VBNET.ATG" +#line 2309 "VBNET.ATG" out joinVariable); -#line 2308 "VBNET.ATG" +#line 2310 "VBNET.ATG" joinClause.JoinVariable = joinVariable; if (la.kind == 133) { JoinQueryOperator( -#line 2310 "VBNET.ATG" +#line 2312 "VBNET.ATG" out subJoin); -#line 2311 "VBNET.ATG" +#line 2313 "VBNET.ATG" joinClause.SubJoin = subJoin; } Expect(157); JoinCondition( -#line 2314 "VBNET.ATG" +#line 2316 "VBNET.ATG" out condition); -#line 2315 "VBNET.ATG" +#line 2317 "VBNET.ATG" SafeAdd(joinClause, joinClause.Conditions, condition); while (la.kind == 47) { lexer.NextToken(); JoinCondition( -#line 2317 "VBNET.ATG" +#line 2319 "VBNET.ATG" out condition); -#line 2318 "VBNET.ATG" +#line 2320 "VBNET.ATG" SafeAdd(joinClause, joinClause.Conditions, condition); } -#line 2321 "VBNET.ATG" +#line 2323 "VBNET.ATG" joinClause.EndLocation = t.EndLocation; } void GroupJoinQueryOperator( -#line 2151 "VBNET.ATG" +#line 2153 "VBNET.ATG" out QueryExpressionGroupJoinVBClause groupJoinClause) { -#line 2153 "VBNET.ATG" +#line 2155 "VBNET.ATG" groupJoinClause = new QueryExpressionGroupJoinVBClause(); groupJoinClause.StartLocation = la.Location; QueryExpressionJoinVBClause joinClause = null; Expect(120); JoinQueryOperator( -#line 2157 "VBNET.ATG" +#line 2159 "VBNET.ATG" out joinClause); Expect(130); ExpressionRangeVariableDeclarationList( -#line 2158 "VBNET.ATG" +#line 2160 "VBNET.ATG" groupJoinClause.IntoVariables); -#line 2160 "VBNET.ATG" +#line 2162 "VBNET.ATG" groupJoinClause.JoinClause = joinClause; groupJoinClause.EndLocation = t.EndLocation; } void GroupByQueryOperator( -#line 2138 "VBNET.ATG" +#line 2140 "VBNET.ATG" out QueryExpressionGroupVBClause groupByClause) { -#line 2140 "VBNET.ATG" +#line 2142 "VBNET.ATG" groupByClause = new QueryExpressionGroupVBClause(); groupByClause.StartLocation = la.Location; Expect(120); ExpressionRangeVariableDeclarationList( -#line 2143 "VBNET.ATG" +#line 2145 "VBNET.ATG" groupByClause.GroupVariables); Expect(57); ExpressionRangeVariableDeclarationList( -#line 2144 "VBNET.ATG" +#line 2146 "VBNET.ATG" groupByClause.ByVariables); Expect(130); ExpressionRangeVariableDeclarationList( -#line 2145 "VBNET.ATG" +#line 2147 "VBNET.ATG" groupByClause.IntoVariables); -#line 2147 "VBNET.ATG" +#line 2149 "VBNET.ATG" groupByClause.EndLocation = t.EndLocation; } void OrderExpressionList( -#line 2107 "VBNET.ATG" +#line 2109 "VBNET.ATG" out List orderings) { -#line 2109 "VBNET.ATG" +#line 2111 "VBNET.ATG" orderings = new List(); QueryExpressionOrdering ordering = null; OrderExpression( -#line 2112 "VBNET.ATG" +#line 2114 "VBNET.ATG" out ordering); -#line 2113 "VBNET.ATG" +#line 2115 "VBNET.ATG" orderings.Add(ordering); while (la.kind == 12) { lexer.NextToken(); OrderExpression( -#line 2115 "VBNET.ATG" +#line 2117 "VBNET.ATG" out ordering); -#line 2116 "VBNET.ATG" +#line 2118 "VBNET.ATG" orderings.Add(ordering); } } void OrderExpression( -#line 2120 "VBNET.ATG" +#line 2122 "VBNET.ATG" out QueryExpressionOrdering ordering) { -#line 2122 "VBNET.ATG" +#line 2124 "VBNET.ATG" ordering = new QueryExpressionOrdering(); ordering.StartLocation = la.Location; ordering.Direction = QueryExpressionOrderingDirection.None; Expression orderExpr = null; Expr( -#line 2127 "VBNET.ATG" +#line 2129 "VBNET.ATG" out orderExpr); -#line 2129 "VBNET.ATG" +#line 2131 "VBNET.ATG" ordering.Criteria = orderExpr; if (la.kind == 51 || la.kind == 91) { if (la.kind == 51) { lexer.NextToken(); -#line 2132 "VBNET.ATG" +#line 2134 "VBNET.ATG" ordering.Direction = QueryExpressionOrderingDirection.Ascending; } else { lexer.NextToken(); -#line 2133 "VBNET.ATG" +#line 2135 "VBNET.ATG" ordering.Direction = QueryExpressionOrderingDirection.Descending; } } -#line 2135 "VBNET.ATG" +#line 2137 "VBNET.ATG" ordering.EndLocation = t.EndLocation; } void ExpressionRangeVariableDeclarationList( -#line 2266 "VBNET.ATG" +#line 2268 "VBNET.ATG" List variables) { -#line 2268 "VBNET.ATG" +#line 2270 "VBNET.ATG" ExpressionRangeVariable variable = null; ExpressionRangeVariableDeclaration( -#line 2270 "VBNET.ATG" +#line 2272 "VBNET.ATG" out variable); -#line 2271 "VBNET.ATG" +#line 2273 "VBNET.ATG" variables.Add(variable); while (la.kind == 12) { lexer.NextToken(); ExpressionRangeVariableDeclaration( -#line 2272 "VBNET.ATG" +#line 2274 "VBNET.ATG" out variable); -#line 2272 "VBNET.ATG" +#line 2274 "VBNET.ATG" variables.Add(variable); } } void CollectionRangeVariableDeclarationList( -#line 2325 "VBNET.ATG" +#line 2327 "VBNET.ATG" List rangeVariables) { -#line 2326 "VBNET.ATG" +#line 2328 "VBNET.ATG" CollectionRangeVariable variableDeclaration; CollectionRangeVariableDeclaration( -#line 2328 "VBNET.ATG" +#line 2330 "VBNET.ATG" out variableDeclaration); -#line 2329 "VBNET.ATG" +#line 2331 "VBNET.ATG" rangeVariables.Add(variableDeclaration); while (la.kind == 12) { lexer.NextToken(); CollectionRangeVariableDeclaration( -#line 2330 "VBNET.ATG" +#line 2332 "VBNET.ATG" out variableDeclaration); -#line 2330 "VBNET.ATG" +#line 2332 "VBNET.ATG" rangeVariables.Add(variableDeclaration); } } void CollectionRangeVariableDeclaration( -#line 2333 "VBNET.ATG" +#line 2335 "VBNET.ATG" out CollectionRangeVariable rangeVariable) { -#line 2335 "VBNET.ATG" +#line 2337 "VBNET.ATG" rangeVariable = new CollectionRangeVariable(); rangeVariable.StartLocation = la.Location; TypeReference typeName = null; @@ -5448,71 +5444,71 @@ out CollectionRangeVariable rangeVariable) { Identifier(); -#line 2340 "VBNET.ATG" +#line 2342 "VBNET.ATG" rangeVariable.Identifier = t.val; if (la.kind == 50) { lexer.NextToken(); TypeName( -#line 2341 "VBNET.ATG" +#line 2343 "VBNET.ATG" out typeName); -#line 2341 "VBNET.ATG" +#line 2343 "VBNET.ATG" rangeVariable.Type = typeName; } Expect(125); Expr( -#line 2342 "VBNET.ATG" +#line 2344 "VBNET.ATG" out inExpr); -#line 2344 "VBNET.ATG" +#line 2346 "VBNET.ATG" rangeVariable.Expression = inExpr; rangeVariable.EndLocation = t.EndLocation; } void ExpressionRangeVariableDeclaration( -#line 2275 "VBNET.ATG" +#line 2277 "VBNET.ATG" out ExpressionRangeVariable variable) { -#line 2277 "VBNET.ATG" +#line 2279 "VBNET.ATG" variable = new ExpressionRangeVariable(); variable.StartLocation = la.Location; Expression rhs = null; TypeReference typeName = null; if ( -#line 2283 "VBNET.ATG" +#line 2285 "VBNET.ATG" IsIdentifiedExpressionRange()) { Identifier(); -#line 2284 "VBNET.ATG" +#line 2286 "VBNET.ATG" variable.Identifier = t.val; if (la.kind == 50) { lexer.NextToken(); TypeName( -#line 2286 "VBNET.ATG" +#line 2288 "VBNET.ATG" out typeName); -#line 2287 "VBNET.ATG" +#line 2289 "VBNET.ATG" variable.Type = typeName; } Expect(10); } Expr( -#line 2291 "VBNET.ATG" +#line 2293 "VBNET.ATG" out rhs); -#line 2293 "VBNET.ATG" +#line 2295 "VBNET.ATG" variable.Expression = rhs; variable.EndLocation = t.EndLocation; } void JoinCondition( -#line 2349 "VBNET.ATG" +#line 2351 "VBNET.ATG" out QueryExpressionJoinConditionVB condition) { -#line 2351 "VBNET.ATG" +#line 2353 "VBNET.ATG" condition = new QueryExpressionJoinConditionVB(); condition.StartLocation = la.Location; @@ -5520,14 +5516,14 @@ out QueryExpressionJoinConditionVB condition) { Expression rhs = null; Expr( -#line 2357 "VBNET.ATG" +#line 2359 "VBNET.ATG" out lhs); Expect(103); Expr( -#line 2357 "VBNET.ATG" +#line 2359 "VBNET.ATG" out rhs); -#line 2359 "VBNET.ATG" +#line 2361 "VBNET.ATG" condition.LeftSide = lhs; condition.RightSide = rhs; condition.EndLocation = t.EndLocation; @@ -5535,94 +5531,94 @@ out rhs); } void Argument( -#line 2420 "VBNET.ATG" +#line 2425 "VBNET.ATG" out Expression argumentexpr) { -#line 2422 "VBNET.ATG" +#line 2427 "VBNET.ATG" Expression expr; argumentexpr = null; string name; if ( -#line 2426 "VBNET.ATG" +#line 2431 "VBNET.ATG" IsNamedAssign()) { Identifier(); -#line 2426 "VBNET.ATG" +#line 2431 "VBNET.ATG" name = t.val; Expect(11); Expect(10); Expr( -#line 2426 "VBNET.ATG" +#line 2431 "VBNET.ATG" out expr); -#line 2428 "VBNET.ATG" +#line 2433 "VBNET.ATG" argumentexpr = new NamedArgumentExpression(name, expr); - } else if (StartOf(24)) { + } else if (StartOf(29)) { Expr( -#line 2431 "VBNET.ATG" +#line 2436 "VBNET.ATG" out argumentexpr); - } else SynErr(268); + } else SynErr(267); } void QualIdentAndTypeArguments( -#line 2497 "VBNET.ATG" +#line 2502 "VBNET.ATG" out TypeReference typeref, bool canBeUnbound) { -#line 2498 "VBNET.ATG" +#line 2503 "VBNET.ATG" string name; typeref = null; Qualident( -#line 2500 "VBNET.ATG" +#line 2505 "VBNET.ATG" out name); -#line 2501 "VBNET.ATG" +#line 2506 "VBNET.ATG" typeref = new TypeReference(name); if ( -#line 2502 "VBNET.ATG" +#line 2507 "VBNET.ATG" la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of) { lexer.NextToken(); Expect(155); if ( -#line 2504 "VBNET.ATG" +#line 2509 "VBNET.ATG" canBeUnbound && (la.kind == Tokens.CloseParenthesis || la.kind == Tokens.Comma)) { -#line 2505 "VBNET.ATG" +#line 2510 "VBNET.ATG" typeref.GenericTypes.Add(NullTypeReference.Instance); while (la.kind == 12) { lexer.NextToken(); -#line 2506 "VBNET.ATG" +#line 2511 "VBNET.ATG" typeref.GenericTypes.Add(NullTypeReference.Instance); } } else if (StartOf(7)) { TypeArgumentList( -#line 2507 "VBNET.ATG" +#line 2512 "VBNET.ATG" typeref.GenericTypes); - } else SynErr(269); + } else SynErr(268); Expect(26); } } void RankList( -#line 2544 "VBNET.ATG" +#line 2549 "VBNET.ATG" out int i) { -#line 2545 "VBNET.ATG" +#line 2550 "VBNET.ATG" i = 0; while (la.kind == 12) { lexer.NextToken(); -#line 2546 "VBNET.ATG" +#line 2551 "VBNET.ATG" ++i; } } void Attribute( -#line 2585 "VBNET.ATG" +#line 2590 "VBNET.ATG" out ASTAttribute attribute) { -#line 2586 "VBNET.ATG" +#line 2591 "VBNET.ATG" string name; List positional = new List(); List named = new List(); @@ -5632,40 +5628,40 @@ out ASTAttribute attribute) { Expect(16); } Qualident( -#line 2591 "VBNET.ATG" +#line 2596 "VBNET.ATG" out name); if (la.kind == 25) { AttributeArguments( -#line 2592 "VBNET.ATG" +#line 2597 "VBNET.ATG" positional, named); } -#line 2594 "VBNET.ATG" +#line 2599 "VBNET.ATG" attribute = new ASTAttribute(name, positional, named); } void AttributeArguments( -#line 2599 "VBNET.ATG" +#line 2604 "VBNET.ATG" List positional, List named) { -#line 2601 "VBNET.ATG" +#line 2606 "VBNET.ATG" bool nameFound = false; string name = ""; Expression expr; Expect(25); if ( -#line 2607 "VBNET.ATG" +#line 2612 "VBNET.ATG" IsNotClosingParenthesis()) { if ( -#line 2609 "VBNET.ATG" +#line 2614 "VBNET.ATG" IsNamedAssign()) { -#line 2609 "VBNET.ATG" +#line 2614 "VBNET.ATG" nameFound = true; IdentifierOrKeyword( -#line 2610 "VBNET.ATG" +#line 2615 "VBNET.ATG" out name); if (la.kind == 11) { lexer.NextToken(); @@ -5673,10 +5669,10 @@ out name); Expect(10); } Expr( -#line 2612 "VBNET.ATG" +#line 2617 "VBNET.ATG" out expr); -#line 2614 "VBNET.ATG" +#line 2619 "VBNET.ATG" if (expr != null) { if (string.IsNullOrEmpty(name)) { positional.Add(expr); } else { named.Add(new NamedArgumentExpression(name, expr)); name = ""; } @@ -5685,28 +5681,28 @@ out expr); while (la.kind == 12) { lexer.NextToken(); if ( -#line 2622 "VBNET.ATG" +#line 2627 "VBNET.ATG" IsNamedAssign()) { -#line 2622 "VBNET.ATG" +#line 2627 "VBNET.ATG" nameFound = true; IdentifierOrKeyword( -#line 2623 "VBNET.ATG" +#line 2628 "VBNET.ATG" out name); if (la.kind == 11) { lexer.NextToken(); } Expect(10); - } else if (StartOf(24)) { + } else if (StartOf(29)) { -#line 2625 "VBNET.ATG" +#line 2630 "VBNET.ATG" if (nameFound) Error("no positional argument after named argument"); - } else SynErr(270); + } else SynErr(269); Expr( -#line 2626 "VBNET.ATG" +#line 2631 "VBNET.ATG" out expr); -#line 2626 "VBNET.ATG" +#line 2631 "VBNET.ATG" if (expr != null) { if(name == "") positional.Add(expr); else { named.Add(new NamedArgumentExpression(name, expr)); name = ""; } } @@ -5717,10 +5713,10 @@ out expr); } void FormalParameter( -#line 2683 "VBNET.ATG" +#line 2688 "VBNET.ATG" out ParameterDeclarationExpression p) { -#line 2685 "VBNET.ATG" +#line 2690 "VBNET.ATG" AttributeSection section; List attributes = new List(); TypeReference type = null; @@ -5731,36 +5727,36 @@ out ParameterDeclarationExpression p) { while (la.kind == 28) { AttributeSection( -#line 2694 "VBNET.ATG" +#line 2699 "VBNET.ATG" out section); -#line 2694 "VBNET.ATG" +#line 2699 "VBNET.ATG" attributes.Add(section); } - while (StartOf(35)) { + while (StartOf(34)) { ParameterModifier( -#line 2695 "VBNET.ATG" +#line 2700 "VBNET.ATG" mod); } Identifier(); -#line 2696 "VBNET.ATG" +#line 2701 "VBNET.ATG" string parameterName = t.val; if ( -#line 2697 "VBNET.ATG" +#line 2702 "VBNET.ATG" IsDims()) { ArrayTypeModifiers( -#line 2697 "VBNET.ATG" +#line 2702 "VBNET.ATG" out arrayModifiers); } if (la.kind == 50) { lexer.NextToken(); TypeName( -#line 2698 "VBNET.ATG" +#line 2703 "VBNET.ATG" out type); } -#line 2700 "VBNET.ATG" +#line 2705 "VBNET.ATG" if(type != null) { if (arrayModifiers != null) { if (type.RankSpecifier != null) { @@ -5776,11 +5772,11 @@ out type); if (la.kind == 10) { lexer.NextToken(); Expr( -#line 2712 "VBNET.ATG" +#line 2717 "VBNET.ATG" out expr); } -#line 2714 "VBNET.ATG" +#line 2719 "VBNET.ATG" mod.Check(); p = new ParameterDeclarationExpression(type, parameterName, mod.Modifier, expr); p.Attributes = attributes; @@ -5788,34 +5784,34 @@ out expr); } void ParameterModifier( -#line 3396 "VBNET.ATG" +#line 3401 "VBNET.ATG" ParamModifierList m) { if (la.kind == 59) { lexer.NextToken(); -#line 3397 "VBNET.ATG" +#line 3402 "VBNET.ATG" m.Add(ParameterModifiers.In); } else if (la.kind == 56) { lexer.NextToken(); -#line 3398 "VBNET.ATG" +#line 3403 "VBNET.ATG" m.Add(ParameterModifiers.Ref); } else if (la.kind == 160) { lexer.NextToken(); -#line 3399 "VBNET.ATG" +#line 3404 "VBNET.ATG" m.Add(ParameterModifiers.Optional); } else if (la.kind == 167) { lexer.NextToken(); -#line 3400 "VBNET.ATG" +#line 3405 "VBNET.ATG" m.Add(ParameterModifiers.Params); - } else SynErr(271); + } else SynErr(270); } void Statement() { -#line 2743 "VBNET.ATG" +#line 2748 "VBNET.ATG" Statement stmt = null; Location startPos = la.Location; string label = String.Empty; @@ -5823,27 +5819,27 @@ ParamModifierList m) { if (la.kind == 1 || la.kind == 11) { } else if ( -#line 2749 "VBNET.ATG" +#line 2754 "VBNET.ATG" IsLabel()) { LabelName( -#line 2749 "VBNET.ATG" +#line 2754 "VBNET.ATG" out label); -#line 2751 "VBNET.ATG" +#line 2756 "VBNET.ATG" compilationUnit.AddChild(new LabelStatement(t.val)); Expect(11); Statement(); - } else if (StartOf(36)) { + } else if (StartOf(35)) { EmbeddedStatement( -#line 2754 "VBNET.ATG" +#line 2759 "VBNET.ATG" out stmt); -#line 2754 "VBNET.ATG" +#line 2759 "VBNET.ATG" compilationUnit.AddChild(stmt); - } else SynErr(272); + } else SynErr(271); -#line 2757 "VBNET.ATG" +#line 2762 "VBNET.ATG" if (stmt != null) { stmt.StartLocation = startPos; stmt.EndLocation = t.Location; @@ -5852,30 +5848,30 @@ out stmt); } void LabelName( -#line 3172 "VBNET.ATG" +#line 3177 "VBNET.ATG" out string name) { -#line 3174 "VBNET.ATG" +#line 3179 "VBNET.ATG" name = String.Empty; if (StartOf(14)) { Identifier(); -#line 3176 "VBNET.ATG" +#line 3181 "VBNET.ATG" name = t.val; } else if (la.kind == 5) { lexer.NextToken(); -#line 3177 "VBNET.ATG" +#line 3182 "VBNET.ATG" name = t.val; - } else SynErr(273); + } else SynErr(272); } void EmbeddedStatement( -#line 2796 "VBNET.ATG" +#line 2801 "VBNET.ATG" out Statement statement) { -#line 2798 "VBNET.ATG" +#line 2803 "VBNET.ATG" Statement embeddedStatement = null; statement = null; Expression expr = null; @@ -5885,224 +5881,224 @@ out Statement statement) { if (la.kind == 107) { lexer.NextToken(); -#line 2804 "VBNET.ATG" +#line 2809 "VBNET.ATG" ExitType exitType = ExitType.None; switch (la.kind) { case 195: { lexer.NextToken(); -#line 2806 "VBNET.ATG" +#line 2811 "VBNET.ATG" exitType = ExitType.Sub; break; } case 114: { lexer.NextToken(); -#line 2808 "VBNET.ATG" +#line 2813 "VBNET.ATG" exitType = ExitType.Function; break; } case 171: { lexer.NextToken(); -#line 2810 "VBNET.ATG" +#line 2815 "VBNET.ATG" exitType = ExitType.Property; break; } case 95: { lexer.NextToken(); -#line 2812 "VBNET.ATG" +#line 2817 "VBNET.ATG" exitType = ExitType.Do; break; } case 111: { lexer.NextToken(); -#line 2814 "VBNET.ATG" +#line 2819 "VBNET.ATG" exitType = ExitType.For; break; } case 203: { lexer.NextToken(); -#line 2816 "VBNET.ATG" +#line 2821 "VBNET.ATG" exitType = ExitType.Try; break; } case 216: { lexer.NextToken(); -#line 2818 "VBNET.ATG" +#line 2823 "VBNET.ATG" exitType = ExitType.While; break; } case 182: { lexer.NextToken(); -#line 2820 "VBNET.ATG" +#line 2825 "VBNET.ATG" exitType = ExitType.Select; break; } - default: SynErr(274); break; + default: SynErr(273); break; } -#line 2822 "VBNET.ATG" +#line 2827 "VBNET.ATG" statement = new ExitStatement(exitType); } else if (la.kind == 203) { TryStatement( -#line 2823 "VBNET.ATG" +#line 2828 "VBNET.ATG" out statement); } else if (la.kind == 76) { lexer.NextToken(); -#line 2824 "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 2824 "VBNET.ATG" +#line 2829 "VBNET.ATG" continueType = ContinueType.Do; } else if (la.kind == 111) { lexer.NextToken(); -#line 2824 "VBNET.ATG" +#line 2829 "VBNET.ATG" continueType = ContinueType.For; } else { lexer.NextToken(); -#line 2824 "VBNET.ATG" +#line 2829 "VBNET.ATG" continueType = ContinueType.While; } } -#line 2824 "VBNET.ATG" +#line 2829 "VBNET.ATG" statement = new ContinueStatement(continueType); } else if (la.kind == 200) { lexer.NextToken(); - if (StartOf(24)) { + if (StartOf(29)) { Expr( -#line 2826 "VBNET.ATG" +#line 2831 "VBNET.ATG" out expr); } -#line 2826 "VBNET.ATG" +#line 2831 "VBNET.ATG" statement = new ThrowStatement(expr); } else if (la.kind == 180) { lexer.NextToken(); - if (StartOf(24)) { + if (StartOf(29)) { Expr( -#line 2828 "VBNET.ATG" +#line 2833 "VBNET.ATG" out expr); } -#line 2828 "VBNET.ATG" +#line 2833 "VBNET.ATG" statement = new ReturnStatement(expr); } else if (la.kind == 196) { lexer.NextToken(); Expr( -#line 2830 "VBNET.ATG" +#line 2835 "VBNET.ATG" out expr); EndOfStmt(); Block( -#line 2830 "VBNET.ATG" +#line 2835 "VBNET.ATG" out embeddedStatement); Expect(100); Expect(196); -#line 2831 "VBNET.ATG" +#line 2836 "VBNET.ATG" statement = new LockStatement(expr, embeddedStatement); } else if (la.kind == 174) { lexer.NextToken(); Identifier(); -#line 2833 "VBNET.ATG" +#line 2838 "VBNET.ATG" name = t.val; if (la.kind == 25) { lexer.NextToken(); - if (StartOf(37)) { + if (StartOf(36)) { ArgumentList( -#line 2834 "VBNET.ATG" +#line 2839 "VBNET.ATG" out p); } Expect(26); } -#line 2836 "VBNET.ATG" +#line 2841 "VBNET.ATG" statement = new RaiseEventStatement(name, p); } else if (la.kind == 218) { WithStatement( -#line 2839 "VBNET.ATG" +#line 2844 "VBNET.ATG" out statement); } else if (la.kind == 43) { lexer.NextToken(); -#line 2841 "VBNET.ATG" +#line 2846 "VBNET.ATG" Expression handlerExpr = null; Expr( -#line 2842 "VBNET.ATG" +#line 2847 "VBNET.ATG" out expr); Expect(12); Expr( -#line 2842 "VBNET.ATG" +#line 2847 "VBNET.ATG" out handlerExpr); -#line 2844 "VBNET.ATG" +#line 2849 "VBNET.ATG" statement = new AddHandlerStatement(expr, handlerExpr); } else if (la.kind == 178) { lexer.NextToken(); -#line 2847 "VBNET.ATG" +#line 2852 "VBNET.ATG" Expression handlerExpr = null; Expr( -#line 2848 "VBNET.ATG" +#line 2853 "VBNET.ATG" out expr); Expect(12); Expr( -#line 2848 "VBNET.ATG" +#line 2853 "VBNET.ATG" out handlerExpr); -#line 2850 "VBNET.ATG" +#line 2855 "VBNET.ATG" statement = new RemoveHandlerStatement(expr, handlerExpr); } else if (la.kind == 216) { lexer.NextToken(); Expr( -#line 2853 "VBNET.ATG" +#line 2858 "VBNET.ATG" out expr); EndOfStmt(); Block( -#line 2854 "VBNET.ATG" +#line 2859 "VBNET.ATG" out embeddedStatement); Expect(100); Expect(216); -#line 2856 "VBNET.ATG" +#line 2861 "VBNET.ATG" statement = new DoLoopStatement(expr, embeddedStatement, ConditionType.While, ConditionPosition.Start); } else if (la.kind == 95) { lexer.NextToken(); -#line 2861 "VBNET.ATG" +#line 2866 "VBNET.ATG" ConditionType conditionType = ConditionType.None; if (la.kind == 209 || la.kind == 216) { WhileOrUntil( -#line 2864 "VBNET.ATG" +#line 2869 "VBNET.ATG" out conditionType); Expr( -#line 2864 "VBNET.ATG" +#line 2869 "VBNET.ATG" out expr); EndOfStmt(); Block( -#line 2865 "VBNET.ATG" +#line 2870 "VBNET.ATG" out embeddedStatement); Expect(138); -#line 2868 "VBNET.ATG" +#line 2873 "VBNET.ATG" statement = new DoLoopStatement(expr, embeddedStatement, conditionType == ConditionType.While ? ConditionType.DoWhile : conditionType, @@ -6111,26 +6107,26 @@ out embeddedStatement); } else if (la.kind == 1 || la.kind == 11) { EndOfStmt(); Block( -#line 2875 "VBNET.ATG" +#line 2880 "VBNET.ATG" out embeddedStatement); Expect(138); if (la.kind == 209 || la.kind == 216) { WhileOrUntil( -#line 2876 "VBNET.ATG" +#line 2881 "VBNET.ATG" out conditionType); Expr( -#line 2876 "VBNET.ATG" +#line 2881 "VBNET.ATG" out expr); } -#line 2878 "VBNET.ATG" +#line 2883 "VBNET.ATG" statement = new DoLoopStatement(expr, embeddedStatement, conditionType, ConditionPosition.End); - } else SynErr(275); + } else SynErr(274); } else if (la.kind == 111) { lexer.NextToken(); -#line 2883 "VBNET.ATG" +#line 2888 "VBNET.ATG" Expression group = null; TypeReference typeReference; string typeName; @@ -6139,24 +6135,24 @@ out expr); if (la.kind == 97) { lexer.NextToken(); LoopControlVariable( -#line 2890 "VBNET.ATG" +#line 2895 "VBNET.ATG" out typeReference, out typeName); Expect(125); Expr( -#line 2891 "VBNET.ATG" +#line 2896 "VBNET.ATG" out group); EndOfStmt(); Block( -#line 2892 "VBNET.ATG" +#line 2897 "VBNET.ATG" out embeddedStatement); Expect(149); - if (StartOf(24)) { + if (StartOf(29)) { Expr( -#line 2893 "VBNET.ATG" +#line 2898 "VBNET.ATG" out expr); } -#line 2895 "VBNET.ATG" +#line 2900 "VBNET.ATG" statement = new ForeachStatement(typeReference, typeName, group, @@ -6166,9 +6162,9 @@ out expr); statement.EndLocation = t.EndLocation; - } else if (StartOf(38)) { + } else if (StartOf(37)) { -#line 2906 "VBNET.ATG" +#line 2911 "VBNET.ATG" Expression start = null; Expression end = null; Expression step = null; @@ -6177,59 +6173,59 @@ out expr); List nextExpressions = null; if ( -#line 2913 "VBNET.ATG" +#line 2918 "VBNET.ATG" IsLoopVariableDeclaration()) { LoopControlVariable( -#line 2914 "VBNET.ATG" +#line 2919 "VBNET.ATG" out typeReference, out typeName); } else { -#line 2916 "VBNET.ATG" +#line 2921 "VBNET.ATG" typeReference = null; typeName = null; SimpleExpr( -#line 2917 "VBNET.ATG" +#line 2922 "VBNET.ATG" out variableExpr); } Expect(10); Expr( -#line 2919 "VBNET.ATG" +#line 2924 "VBNET.ATG" out start); Expect(201); Expr( -#line 2919 "VBNET.ATG" +#line 2924 "VBNET.ATG" out end); if (la.kind == 190) { lexer.NextToken(); Expr( -#line 2919 "VBNET.ATG" +#line 2924 "VBNET.ATG" out step); } EndOfStmt(); Block( -#line 2920 "VBNET.ATG" +#line 2925 "VBNET.ATG" out embeddedStatement); Expect(149); - if (StartOf(24)) { + if (StartOf(29)) { Expr( -#line 2923 "VBNET.ATG" +#line 2928 "VBNET.ATG" out nextExpr); -#line 2925 "VBNET.ATG" +#line 2930 "VBNET.ATG" nextExpressions = new List(); nextExpressions.Add(nextExpr); while (la.kind == 12) { lexer.NextToken(); Expr( -#line 2928 "VBNET.ATG" +#line 2933 "VBNET.ATG" out nextExpr); -#line 2928 "VBNET.ATG" +#line 2933 "VBNET.ATG" nextExpressions.Add(nextExpr); } } -#line 2931 "VBNET.ATG" +#line 2936 "VBNET.ATG" statement = new ForNextStatement { TypeReference = typeReference, VariableName = typeName, @@ -6241,31 +6237,31 @@ out nextExpr); NextExpressions = nextExpressions }; - } else SynErr(276); + } else SynErr(275); } else if (la.kind == 105) { lexer.NextToken(); Expr( -#line 2944 "VBNET.ATG" +#line 2949 "VBNET.ATG" out expr); -#line 2944 "VBNET.ATG" +#line 2949 "VBNET.ATG" statement = new ErrorStatement(expr); } else if (la.kind == 176) { lexer.NextToken(); -#line 2946 "VBNET.ATG" +#line 2951 "VBNET.ATG" bool isPreserve = false; if (la.kind == 169) { lexer.NextToken(); -#line 2946 "VBNET.ATG" +#line 2951 "VBNET.ATG" isPreserve = true; } ReDimClause( -#line 2947 "VBNET.ATG" +#line 2952 "VBNET.ATG" out expr); -#line 2949 "VBNET.ATG" +#line 2954 "VBNET.ATG" ReDimStatement reDimStatement = new ReDimStatement(isPreserve); statement = reDimStatement; SafeAdd(reDimStatement, reDimStatement.ReDimClauses, expr as InvocationExpression); @@ -6273,48 +6269,48 @@ out expr); while (la.kind == 12) { lexer.NextToken(); ReDimClause( -#line 2953 "VBNET.ATG" +#line 2958 "VBNET.ATG" out expr); -#line 2954 "VBNET.ATG" +#line 2959 "VBNET.ATG" SafeAdd(reDimStatement, reDimStatement.ReDimClauses, expr as InvocationExpression); } } else if (la.kind == 104) { lexer.NextToken(); Expr( -#line 2958 "VBNET.ATG" +#line 2963 "VBNET.ATG" out expr); -#line 2960 "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 2963 "VBNET.ATG" +#line 2968 "VBNET.ATG" out expr); -#line 2963 "VBNET.ATG" +#line 2968 "VBNET.ATG" if (expr != null) { SafeAdd(eraseStatement, eraseStatement.Expressions, expr); } } -#line 2964 "VBNET.ATG" +#line 2969 "VBNET.ATG" statement = eraseStatement; } else if (la.kind == 191) { lexer.NextToken(); -#line 2966 "VBNET.ATG" +#line 2971 "VBNET.ATG" statement = new StopStatement(); } else if ( -#line 2968 "VBNET.ATG" +#line 2973 "VBNET.ATG" la.kind == Tokens.If) { Expect(122); -#line 2969 "VBNET.ATG" +#line 2974 "VBNET.ATG" Location ifStartLocation = t.Location; Expr( -#line 2969 "VBNET.ATG" +#line 2974 "VBNET.ATG" out expr); if (la.kind == 199) { lexer.NextToken(); @@ -6322,46 +6318,46 @@ out expr); if (la.kind == 1 || la.kind == 11) { EndOfStmt(); Block( -#line 2972 "VBNET.ATG" +#line 2977 "VBNET.ATG" out embeddedStatement); -#line 2974 "VBNET.ATG" +#line 2979 "VBNET.ATG" IfElseStatement ifStatement = new IfElseStatement(expr, embeddedStatement); ifStatement.StartLocation = ifStartLocation; Location elseIfStart; while (la.kind == 99 || -#line 2980 "VBNET.ATG" +#line 2985 "VBNET.ATG" IsElseIf()) { if ( -#line 2980 "VBNET.ATG" +#line 2985 "VBNET.ATG" IsElseIf()) { Expect(98); -#line 2980 "VBNET.ATG" +#line 2985 "VBNET.ATG" elseIfStart = t.Location; Expect(122); } else { lexer.NextToken(); -#line 2981 "VBNET.ATG" +#line 2986 "VBNET.ATG" elseIfStart = t.Location; } -#line 2983 "VBNET.ATG" +#line 2988 "VBNET.ATG" Expression condition = null; Statement block = null; Expr( -#line 2984 "VBNET.ATG" +#line 2989 "VBNET.ATG" out condition); if (la.kind == 199) { lexer.NextToken(); } EndOfStmt(); Block( -#line 2985 "VBNET.ATG" +#line 2990 "VBNET.ATG" out block); -#line 2987 "VBNET.ATG" +#line 2992 "VBNET.ATG" ElseIfSection elseIfSection = new ElseIfSection(condition, block); elseIfSection.StartLocation = elseIfStart; elseIfSection.EndLocation = t.Location; @@ -6375,123 +6371,123 @@ out block); EndOfStmt(); } Block( -#line 2996 "VBNET.ATG" +#line 3001 "VBNET.ATG" out embeddedStatement); -#line 2998 "VBNET.ATG" +#line 3003 "VBNET.ATG" ifStatement.FalseStatement.Add(embeddedStatement); } Expect(100); Expect(122); -#line 3002 "VBNET.ATG" +#line 3007 "VBNET.ATG" ifStatement.EndLocation = t.Location; statement = ifStatement; - } else if (StartOf(39)) { + } else if (StartOf(38)) { -#line 3007 "VBNET.ATG" +#line 3012 "VBNET.ATG" IfElseStatement ifStatement = new IfElseStatement(expr); ifStatement.StartLocation = ifStartLocation; SingleLineStatementList( -#line 3010 "VBNET.ATG" +#line 3015 "VBNET.ATG" ifStatement.TrueStatement); if (la.kind == 98) { lexer.NextToken(); - if (StartOf(39)) { + if (StartOf(38)) { SingleLineStatementList( -#line 3013 "VBNET.ATG" +#line 3018 "VBNET.ATG" ifStatement.FalseStatement); } } -#line 3015 "VBNET.ATG" +#line 3020 "VBNET.ATG" ifStatement.EndLocation = t.Location; statement = ifStatement; - } else SynErr(277); + } else SynErr(276); } else if (la.kind == 182) { lexer.NextToken(); if (la.kind == 61) { lexer.NextToken(); } Expr( -#line 3018 "VBNET.ATG" +#line 3023 "VBNET.ATG" out expr); EndOfStmt(); -#line 3019 "VBNET.ATG" +#line 3024 "VBNET.ATG" List selectSections = new List(); Statement block = null; while (la.kind == 61) { -#line 3023 "VBNET.ATG" +#line 3028 "VBNET.ATG" List caseClauses = null; Location caseLocation = la.Location; lexer.NextToken(); CaseClauses( -#line 3024 "VBNET.ATG" +#line 3029 "VBNET.ATG" out caseClauses); if ( -#line 3024 "VBNET.ATG" +#line 3029 "VBNET.ATG" IsNotStatementSeparator()) { lexer.NextToken(); } EndOfStmt(); -#line 3026 "VBNET.ATG" +#line 3031 "VBNET.ATG" SwitchSection selectSection = new SwitchSection(caseClauses); selectSection.StartLocation = caseLocation; Block( -#line 3029 "VBNET.ATG" +#line 3034 "VBNET.ATG" out block); -#line 3031 "VBNET.ATG" +#line 3036 "VBNET.ATG" selectSection.Children = block.Children; selectSection.EndLocation = t.EndLocation; selectSections.Add(selectSection); } -#line 3037 "VBNET.ATG" +#line 3042 "VBNET.ATG" statement = new SwitchStatement(expr, selectSections); Expect(100); Expect(182); } else if (la.kind == 157) { -#line 3040 "VBNET.ATG" +#line 3045 "VBNET.ATG" OnErrorStatement onErrorStatement = null; OnErrorStatement( -#line 3041 "VBNET.ATG" +#line 3046 "VBNET.ATG" out onErrorStatement); -#line 3041 "VBNET.ATG" +#line 3046 "VBNET.ATG" statement = onErrorStatement; } else if (la.kind == 119) { -#line 3042 "VBNET.ATG" +#line 3047 "VBNET.ATG" GotoStatement goToStatement = null; GotoStatement( -#line 3043 "VBNET.ATG" +#line 3048 "VBNET.ATG" out goToStatement); -#line 3043 "VBNET.ATG" +#line 3048 "VBNET.ATG" statement = goToStatement; } else if (la.kind == 179) { -#line 3044 "VBNET.ATG" +#line 3049 "VBNET.ATG" ResumeStatement resumeStatement = null; ResumeStatement( -#line 3045 "VBNET.ATG" +#line 3050 "VBNET.ATG" out resumeStatement); -#line 3045 "VBNET.ATG" +#line 3050 "VBNET.ATG" statement = resumeStatement; - } else if (StartOf(38)) { + } else if (StartOf(37)) { -#line 3048 "VBNET.ATG" +#line 3053 "VBNET.ATG" Expression val = null; AssignmentOperatorType op; @@ -6499,25 +6495,25 @@ out resumeStatement); la.kind == Tokens.Not || la.kind == Tokens.Times; SimpleExpr( -#line 3054 "VBNET.ATG" +#line 3059 "VBNET.ATG" out expr); - if (StartOf(40)) { + if (StartOf(39)) { AssignmentOperator( -#line 3056 "VBNET.ATG" +#line 3061 "VBNET.ATG" out op); Expr( -#line 3056 "VBNET.ATG" +#line 3061 "VBNET.ATG" out val); -#line 3056 "VBNET.ATG" +#line 3061 "VBNET.ATG" expr = new AssignmentExpression(expr, op, val); } else if (la.kind == 1 || la.kind == 11 || la.kind == 98) { -#line 3057 "VBNET.ATG" +#line 3062 "VBNET.ATG" if (mustBeAssignment) Error("error in assignment."); - } else SynErr(278); + } else SynErr(277); -#line 3060 "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) { @@ -6528,63 +6524,63 @@ out val); } else if (la.kind == 60) { lexer.NextToken(); SimpleExpr( -#line 3067 "VBNET.ATG" +#line 3072 "VBNET.ATG" out expr); -#line 3067 "VBNET.ATG" +#line 3072 "VBNET.ATG" statement = new ExpressionStatement(expr); } else if (la.kind == 211) { lexer.NextToken(); -#line 3069 "VBNET.ATG" +#line 3074 "VBNET.ATG" Statement block; if ( -#line 3070 "VBNET.ATG" +#line 3075 "VBNET.ATG" Peek(1).kind == Tokens.As) { -#line 3071 "VBNET.ATG" +#line 3076 "VBNET.ATG" LocalVariableDeclaration resourceAquisition = new LocalVariableDeclaration(Modifiers.None); VariableDeclarator( -#line 3072 "VBNET.ATG" +#line 3077 "VBNET.ATG" resourceAquisition.Variables); while (la.kind == 12) { lexer.NextToken(); VariableDeclarator( -#line 3074 "VBNET.ATG" +#line 3079 "VBNET.ATG" resourceAquisition.Variables); } Block( -#line 3076 "VBNET.ATG" +#line 3081 "VBNET.ATG" out block); -#line 3078 "VBNET.ATG" +#line 3083 "VBNET.ATG" statement = new UsingStatement(resourceAquisition, block); - } else if (StartOf(24)) { + } else if (StartOf(29)) { Expr( -#line 3080 "VBNET.ATG" +#line 3085 "VBNET.ATG" out expr); Block( -#line 3081 "VBNET.ATG" +#line 3086 "VBNET.ATG" out block); -#line 3082 "VBNET.ATG" +#line 3087 "VBNET.ATG" statement = new UsingStatement(new ExpressionStatement(expr), block); - } else SynErr(279); + } else SynErr(278); Expect(100); Expect(211); - } else if (StartOf(41)) { + } else if (StartOf(40)) { LocalDeclarationStatement( -#line 3085 "VBNET.ATG" +#line 3090 "VBNET.ATG" out statement); - } else SynErr(280); + } else SynErr(279); } void LocalDeclarationStatement( -#line 2765 "VBNET.ATG" +#line 2770 "VBNET.ATG" out Statement statement) { -#line 2767 "VBNET.ATG" +#line 2772 "VBNET.ATG" ModifierList m = new ModifierList(); LocalVariableDeclaration localVariableDeclaration; bool dimfound = false; @@ -6593,22 +6589,22 @@ out Statement statement) { if (la.kind == 75) { lexer.NextToken(); -#line 2773 "VBNET.ATG" +#line 2778 "VBNET.ATG" m.Add(Modifiers.Const, t.Location); } else if (la.kind == 189) { lexer.NextToken(); -#line 2774 "VBNET.ATG" +#line 2779 "VBNET.ATG" m.Add(Modifiers.Static, t.Location); } else { lexer.NextToken(); -#line 2775 "VBNET.ATG" +#line 2780 "VBNET.ATG" dimfound = true; } } -#line 2778 "VBNET.ATG" +#line 2783 "VBNET.ATG" if(dimfound && (m.Modifier & Modifiers.Const) != 0) { Error("Dim is not allowed on constants."); } @@ -6621,135 +6617,135 @@ out Statement statement) { localVariableDeclaration.StartLocation = t.Location; VariableDeclarator( -#line 2789 "VBNET.ATG" +#line 2794 "VBNET.ATG" localVariableDeclaration.Variables); while (la.kind == 12) { lexer.NextToken(); VariableDeclarator( -#line 2790 "VBNET.ATG" +#line 2795 "VBNET.ATG" localVariableDeclaration.Variables); } -#line 2792 "VBNET.ATG" +#line 2797 "VBNET.ATG" statement = localVariableDeclaration; } void TryStatement( -#line 3286 "VBNET.ATG" +#line 3291 "VBNET.ATG" out Statement tryStatement) { -#line 3288 "VBNET.ATG" +#line 3293 "VBNET.ATG" Statement blockStmt = null, finallyStmt = null;List catchClauses = null; Expect(203); EndOfStmt(); Block( -#line 3291 "VBNET.ATG" +#line 3296 "VBNET.ATG" out blockStmt); if (la.kind == 62 || la.kind == 100 || la.kind == 110) { CatchClauses( -#line 3292 "VBNET.ATG" +#line 3297 "VBNET.ATG" out catchClauses); } if (la.kind == 110) { lexer.NextToken(); EndOfStmt(); Block( -#line 3293 "VBNET.ATG" +#line 3298 "VBNET.ATG" out finallyStmt); } Expect(100); Expect(203); -#line 3296 "VBNET.ATG" +#line 3301 "VBNET.ATG" tryStatement = new TryCatchStatement(blockStmt, catchClauses, finallyStmt); } void WithStatement( -#line 3266 "VBNET.ATG" +#line 3271 "VBNET.ATG" out Statement withStatement) { -#line 3268 "VBNET.ATG" +#line 3273 "VBNET.ATG" Statement blockStmt = null; Expression expr = null; Expect(218); -#line 3271 "VBNET.ATG" +#line 3276 "VBNET.ATG" Location start = t.Location; Expr( -#line 3272 "VBNET.ATG" +#line 3277 "VBNET.ATG" out expr); EndOfStmt(); -#line 3274 "VBNET.ATG" +#line 3279 "VBNET.ATG" withStatement = new WithStatement(expr); withStatement.StartLocation = start; Block( -#line 3277 "VBNET.ATG" +#line 3282 "VBNET.ATG" out blockStmt); -#line 3279 "VBNET.ATG" +#line 3284 "VBNET.ATG" ((WithStatement)withStatement).Body = (BlockStatement)blockStmt; Expect(100); Expect(218); -#line 3282 "VBNET.ATG" +#line 3287 "VBNET.ATG" withStatement.EndLocation = t.Location; } void WhileOrUntil( -#line 3259 "VBNET.ATG" +#line 3264 "VBNET.ATG" out ConditionType conditionType) { -#line 3260 "VBNET.ATG" +#line 3265 "VBNET.ATG" conditionType = ConditionType.None; if (la.kind == 216) { lexer.NextToken(); -#line 3261 "VBNET.ATG" +#line 3266 "VBNET.ATG" conditionType = ConditionType.While; } else if (la.kind == 209) { lexer.NextToken(); -#line 3262 "VBNET.ATG" +#line 3267 "VBNET.ATG" conditionType = ConditionType.Until; - } else SynErr(281); + } else SynErr(280); } void LoopControlVariable( -#line 3102 "VBNET.ATG" +#line 3107 "VBNET.ATG" out TypeReference type, out string name) { -#line 3103 "VBNET.ATG" +#line 3108 "VBNET.ATG" ArrayList arrayModifiers = null; type = null; Qualident( -#line 3107 "VBNET.ATG" +#line 3112 "VBNET.ATG" out name); if ( -#line 3108 "VBNET.ATG" +#line 3113 "VBNET.ATG" IsDims()) { ArrayTypeModifiers( -#line 3108 "VBNET.ATG" +#line 3113 "VBNET.ATG" out arrayModifiers); } if (la.kind == 50) { lexer.NextToken(); TypeName( -#line 3109 "VBNET.ATG" +#line 3114 "VBNET.ATG" out type); -#line 3109 "VBNET.ATG" +#line 3114 "VBNET.ATG" if (name.IndexOf('.') > 0) { Error("No type def for 'for each' member indexer allowed."); } } -#line 3111 "VBNET.ATG" +#line 3116 "VBNET.ATG" if (type != null) { if(type.RankSpecifier != null && arrayModifiers != null) { Error("array rank only allowed one time"); @@ -6761,34 +6757,34 @@ out type); } void ReDimClause( -#line 3181 "VBNET.ATG" +#line 3186 "VBNET.ATG" out Expression expr) { SimpleNonInvocationExpression( -#line 3183 "VBNET.ATG" +#line 3188 "VBNET.ATG" out expr); ReDimClauseInternal( -#line 3184 "VBNET.ATG" +#line 3189 "VBNET.ATG" ref expr); } void SingleLineStatementList( -#line 3088 "VBNET.ATG" +#line 3093 "VBNET.ATG" List list) { -#line 3089 "VBNET.ATG" +#line 3094 "VBNET.ATG" Statement embeddedStatement = null; if (la.kind == 100) { lexer.NextToken(); -#line 3091 "VBNET.ATG" +#line 3096 "VBNET.ATG" embeddedStatement = new EndStatement(); - } else if (StartOf(36)) { + } else if (StartOf(35)) { EmbeddedStatement( -#line 3092 "VBNET.ATG" +#line 3097 "VBNET.ATG" out embeddedStatement); - } else SynErr(282); + } else SynErr(281); -#line 3093 "VBNET.ATG" +#line 3098 "VBNET.ATG" if (embeddedStatement != null) list.Add(embeddedStatement); while (la.kind == 11) { lexer.NextToken(); @@ -6798,62 +6794,62 @@ out embeddedStatement); if (la.kind == 100) { lexer.NextToken(); -#line 3095 "VBNET.ATG" +#line 3100 "VBNET.ATG" embeddedStatement = new EndStatement(); - } else if (StartOf(36)) { + } else if (StartOf(35)) { EmbeddedStatement( -#line 3096 "VBNET.ATG" +#line 3101 "VBNET.ATG" out embeddedStatement); - } else SynErr(283); + } else SynErr(282); -#line 3097 "VBNET.ATG" +#line 3102 "VBNET.ATG" if (embeddedStatement != null) list.Add(embeddedStatement); } } void CaseClauses( -#line 3219 "VBNET.ATG" +#line 3224 "VBNET.ATG" out List caseClauses) { -#line 3221 "VBNET.ATG" +#line 3226 "VBNET.ATG" caseClauses = new List(); CaseLabel caseClause = null; CaseClause( -#line 3224 "VBNET.ATG" +#line 3229 "VBNET.ATG" out caseClause); -#line 3224 "VBNET.ATG" +#line 3229 "VBNET.ATG" if (caseClause != null) { caseClauses.Add(caseClause); } while (la.kind == 12) { lexer.NextToken(); CaseClause( -#line 3225 "VBNET.ATG" +#line 3230 "VBNET.ATG" out caseClause); -#line 3225 "VBNET.ATG" +#line 3230 "VBNET.ATG" if (caseClause != null) { caseClauses.Add(caseClause); } } } void OnErrorStatement( -#line 3122 "VBNET.ATG" +#line 3127 "VBNET.ATG" out OnErrorStatement stmt) { -#line 3124 "VBNET.ATG" +#line 3129 "VBNET.ATG" stmt = null; GotoStatement goToStatement = null; Expect(157); Expect(105); if ( -#line 3130 "VBNET.ATG" +#line 3135 "VBNET.ATG" IsNegativeLabelName()) { Expect(119); Expect(18); Expect(5); -#line 3132 "VBNET.ATG" +#line 3137 "VBNET.ATG" long intLabel = Int64.Parse(t.val); if(intLabel != 1) { Error("invalid label in on error statement."); @@ -6862,10 +6858,10 @@ IsNegativeLabelName()) { } else if (la.kind == 119) { GotoStatement( -#line 3138 "VBNET.ATG" +#line 3143 "VBNET.ATG" out goToStatement); -#line 3140 "VBNET.ATG" +#line 3145 "VBNET.ATG" string val = goToStatement.Label; // if value is numeric, make sure that is 0 @@ -6882,88 +6878,88 @@ out goToStatement); lexer.NextToken(); Expect(149); -#line 3154 "VBNET.ATG" +#line 3159 "VBNET.ATG" stmt = new OnErrorStatement(new ResumeStatement(true)); - } else SynErr(284); + } else SynErr(283); } void GotoStatement( -#line 3160 "VBNET.ATG" +#line 3165 "VBNET.ATG" out GotoStatement goToStatement) { -#line 3162 "VBNET.ATG" +#line 3167 "VBNET.ATG" string label = String.Empty; Expect(119); LabelName( -#line 3165 "VBNET.ATG" +#line 3170 "VBNET.ATG" out label); -#line 3167 "VBNET.ATG" +#line 3172 "VBNET.ATG" goToStatement = new GotoStatement(label); } void ResumeStatement( -#line 3208 "VBNET.ATG" +#line 3213 "VBNET.ATG" out ResumeStatement resumeStatement) { -#line 3210 "VBNET.ATG" +#line 3215 "VBNET.ATG" resumeStatement = null; string label = String.Empty; if ( -#line 3213 "VBNET.ATG" +#line 3218 "VBNET.ATG" IsResumeNext()) { Expect(179); Expect(149); -#line 3214 "VBNET.ATG" +#line 3219 "VBNET.ATG" resumeStatement = new ResumeStatement(true); } else if (la.kind == 179) { lexer.NextToken(); - if (StartOf(42)) { + if (StartOf(41)) { LabelName( -#line 3215 "VBNET.ATG" +#line 3220 "VBNET.ATG" out label); } -#line 3215 "VBNET.ATG" +#line 3220 "VBNET.ATG" resumeStatement = new ResumeStatement(label); - } else SynErr(285); + } else SynErr(284); } void ReDimClauseInternal( -#line 3187 "VBNET.ATG" +#line 3192 "VBNET.ATG" ref Expression expr) { -#line 3188 "VBNET.ATG" +#line 3193 "VBNET.ATG" List arguments; bool canBeNormal; bool canBeRedim; string name; while (la.kind == 16 || -#line 3191 "VBNET.ATG" +#line 3196 "VBNET.ATG" la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of) { if (la.kind == 16) { lexer.NextToken(); IdentifierOrKeyword( -#line 3190 "VBNET.ATG" +#line 3195 "VBNET.ATG" out name); -#line 3190 "VBNET.ATG" +#line 3195 "VBNET.ATG" expr = new MemberReferenceExpression(expr, name); } else { InvocationExpression( -#line 3192 "VBNET.ATG" +#line 3197 "VBNET.ATG" ref expr); } } Expect(25); NormalOrReDimArgumentList( -#line 3195 "VBNET.ATG" +#line 3200 "VBNET.ATG" out arguments, out canBeNormal, out canBeRedim); Expect(26); -#line 3197 "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) { @@ -6975,10 +6971,10 @@ out arguments, out canBeNormal, out canBeRedim); } void CaseClause( -#line 3229 "VBNET.ATG" +#line 3234 "VBNET.ATG" out CaseLabel caseClause) { -#line 3231 "VBNET.ATG" +#line 3236 "VBNET.ATG" Expression expr = null; Expression sexpr = null; BinaryOperatorType op = BinaryOperatorType.None; @@ -6987,9 +6983,9 @@ out CaseLabel caseClause) { if (la.kind == 98) { lexer.NextToken(); -#line 3237 "VBNET.ATG" +#line 3242 "VBNET.ATG" caseClause = new CaseLabel(); - } else if (StartOf(43)) { + } else if (StartOf(42)) { if (la.kind == 131) { lexer.NextToken(); } @@ -6997,76 +6993,76 @@ out CaseLabel caseClause) { case 28: { lexer.NextToken(); -#line 3241 "VBNET.ATG" +#line 3246 "VBNET.ATG" op = BinaryOperatorType.LessThan; break; } case 27: { lexer.NextToken(); -#line 3242 "VBNET.ATG" +#line 3247 "VBNET.ATG" op = BinaryOperatorType.GreaterThan; break; } case 31: { lexer.NextToken(); -#line 3243 "VBNET.ATG" +#line 3248 "VBNET.ATG" op = BinaryOperatorType.LessThanOrEqual; break; } case 30: { lexer.NextToken(); -#line 3244 "VBNET.ATG" +#line 3249 "VBNET.ATG" op = BinaryOperatorType.GreaterThanOrEqual; break; } case 10: { lexer.NextToken(); -#line 3245 "VBNET.ATG" +#line 3250 "VBNET.ATG" op = BinaryOperatorType.Equality; break; } case 29: { lexer.NextToken(); -#line 3246 "VBNET.ATG" +#line 3251 "VBNET.ATG" op = BinaryOperatorType.InEquality; break; } - default: SynErr(286); break; + default: SynErr(285); break; } Expr( -#line 3248 "VBNET.ATG" +#line 3253 "VBNET.ATG" out expr); -#line 3250 "VBNET.ATG" +#line 3255 "VBNET.ATG" caseClause = new CaseLabel(op, expr); - } else if (StartOf(24)) { + } else if (StartOf(29)) { Expr( -#line 3252 "VBNET.ATG" +#line 3257 "VBNET.ATG" out expr); if (la.kind == 201) { lexer.NextToken(); Expr( -#line 3252 "VBNET.ATG" +#line 3257 "VBNET.ATG" out sexpr); } -#line 3254 "VBNET.ATG" +#line 3259 "VBNET.ATG" caseClause = new CaseLabel(expr, sexpr); - } else SynErr(287); + } else SynErr(286); } void CatchClauses( -#line 3301 "VBNET.ATG" +#line 3306 "VBNET.ATG" out List catchClauses) { -#line 3303 "VBNET.ATG" +#line 3308 "VBNET.ATG" catchClauses = new List(); TypeReference type = null; Statement blockStmt = null; @@ -7078,27 +7074,27 @@ out List catchClauses) { if (StartOf(14)) { Identifier(); -#line 3311 "VBNET.ATG" +#line 3316 "VBNET.ATG" name = t.val; if (la.kind == 50) { lexer.NextToken(); TypeName( -#line 3311 "VBNET.ATG" +#line 3316 "VBNET.ATG" out type); } } if (la.kind == 214) { lexer.NextToken(); Expr( -#line 3312 "VBNET.ATG" +#line 3317 "VBNET.ATG" out expr); } EndOfStmt(); Block( -#line 3314 "VBNET.ATG" +#line 3319 "VBNET.ATG" out blockStmt); -#line 3315 "VBNET.ATG" +#line 3320 "VBNET.ATG" catchClauses.Add(new CatchClause(type, name, blockStmt, expr)); } } @@ -7367,42 +7363,41 @@ out blockStmt); 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 252: s = "invalid AccessorDecls"; break; + case 253: s = "invalid EventAccessorDeclaration"; break; + case 254: s = "invalid OverloadableOperator"; break; + case 255: s = "invalid EventMemberSpecifier"; break; + case 256: s = "invalid AssignmentOperator"; break; + case 257: s = "invalid SimpleNonInvocationExpression"; break; case 258: s = "invalid SimpleNonInvocationExpression"; break; case 259: s = "invalid SimpleNonInvocationExpression"; break; case 260: s = "invalid SimpleNonInvocationExpression"; 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 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 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 EmbeddedStatement"; break; - case 281: s = "invalid WhileOrUntil"; break; + case 280: s = "invalid WhileOrUntil"; break; + case 281: s = "invalid SingleLineStatementList"; break; case 282: s = "invalid SingleLineStatementList"; break; - case 283: s = "invalid SingleLineStatementList"; break; - case 284: s = "invalid OnErrorStatement"; break; - case 285: s = "invalid ResumeStatement"; break; + case 283: s = "invalid OnErrorStatement"; break; + case 284: s = "invalid ResumeStatement"; break; + case 285: s = "invalid CaseClause"; break; case 286: s = "invalid CaseClause"; break; - case 287: s = "invalid CaseClause"; break; default: s = "error " + errorNumber; break; } @@ -7439,13 +7434,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,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,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,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}, {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,T, T,T,T,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,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,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}, diff --git a/src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG b/src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG index 13666fd09e..de0eb31970 100644 --- a/src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG +++ b/src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG @@ -367,9 +367,9 @@ NamespaceMemberDecl /* 4.9.1 */ TypeParameterList templates> -(. + =(. TemplateDefinition template; -.) = +.) [ IF (la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of) "(" "Of" TypeParameter @@ -1094,7 +1094,7 @@ StructureMemberDecl attributes> TypeName ) ] - [ "=" VariableInitializer ] + [ "=" Expr ] [ ImplementsClause ] EndOfStmt ( @@ -1488,7 +1488,7 @@ VariableDeclaratorPartAfterIdentifier fieldDeclaration } } .) - [ "=" VariableInitializer ] + [ "=" Expr ] ) (. VariableDeclaration varDecl = new VariableDeclaration(name, expr, type); @@ -1526,29 +1526,20 @@ InitializationRankList rank> } . -/* 9.6.3 */ -VariableInitializer - (. - initializerExpression = null; - .) = - Expr - | CollectionInitializer - . - /* 9.6.3.4 */ -CollectionInitializer +CollectionInitializer (. Expression expr = null; CollectionInitializerExpression initializer = new CollectionInitializerExpression(); .) = "{" [ - VariableInitializer + Expr (. if (expr != null) { initializer.CreateExpressions.Add(expr); } .) { - IF (NotFinalComma()) "," VariableInitializer + IF (NotFinalComma()) "," Expr (. if (expr != null) { initializer.CreateExpressions.Add(expr); } .) } ] @@ -1963,7 +1954,7 @@ ExponentiationExpr ObjectCreateExpression (. TypeReference type = null; - Expression initializer = null; + CollectionInitializerExpression initializer = null; List arguments = null; ArrayList dimensions = null; oce = null; @@ -1987,36 +1978,47 @@ ObjectCreateExpression 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); + ArrayCreateExpression ace = new ArrayCreateExpression(type, initializer); ace.Arguments = arguments; oce = ace; } .) [ - (. - NamedArgumentExpression memberInitializer = null; - .) - "With" - (. - CollectionInitializerExpression memberInitializers = new CollectionInitializerExpression(); - memberInitializers.StartLocation = la.Location; - .) - "{" - MemberInitializer - (. memberInitializers.CreateExpressions.Add(memberInitializer); .) - { "," + ( + (. + MemberInitializerExpression memberInitializer = null; + .) + "With" + (. + CollectionInitializerExpression memberInitializers = new CollectionInitializerExpression(); + memberInitializers.StartLocation = la.Location; + .) + "{" MemberInitializer (. memberInitializers.CreateExpressions.Add(memberInitializer); .) - } - "}" - (. - memberInitializers.EndLocation = t.Location; - if(oce is ObjectCreateExpression) - { - ((ObjectCreateExpression)oce).ObjectInitializer = memberInitializers; - } - .) + { "," + MemberInitializer + (. memberInitializers.CreateExpressions.Add(memberInitializer); .) + } + "}" + (. + memberInitializers.EndLocation = t.Location; + if(oce is ObjectCreateExpression) + { + ((ObjectCreateExpression)oce).ObjectInitializer = memberInitializers; + } + .) + ) + | + ( + "From" + CollectionInitializer + (. + if(oce is ObjectCreateExpression) + ((ObjectCreateExpression)oce).ObjectInitializer = initializer; + .) + ) ] . @@ -2362,17 +2364,20 @@ JoinCondition .) . -MemberInitializer +MemberInitializer (. - memberInitializer = new NamedArgumentExpression(); + memberInitializer = new MemberInitializerExpression(); memberInitializer.StartLocation = la.Location; Expression initExpr = null; + bool isKey = false; string name = null; .) = + /*[ "Key" (. isKey = true; .) ]*/ "." IdentifierOrKeyword "=" Expr (. memberInitializer.Name = name; memberInitializer.Expression = initExpr; + memberInitializer.IsKey = isKey; memberInitializer.EndLocation = t.EndLocation; .) . @@ -3332,7 +3337,7 @@ Qualident /* This production handles pseudo keywords that are needed in the grammar */ Identifier = IdentifierForFieldDeclaration - | "Custom" + | "Custom" . IdentifierForFieldDeclaration = diff --git a/src/Libraries/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetOutputVisitor.cs b/src/Libraries/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetOutputVisitor.cs index d3b47cf85a..82290c9af0 100644 --- a/src/Libraries/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetOutputVisitor.cs +++ b/src/Libraries/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetOutputVisitor.cs @@ -2647,7 +2647,10 @@ namespace ICSharpCode.NRefactory.PrettyPrinter CollectionInitializerExpression initializer = objectCreateExpression.ObjectInitializer; if (!initializer.IsNull) { outputFormatter.Space(); - outputFormatter.PrintToken(Tokens.With); + if (initializer.CreateExpressions.Any(ce => ce is NamedArgumentExpression)) + outputFormatter.PrintToken(Tokens.With); + else + outputFormatter.PrintToken(Tokens.From); outputFormatter.Space(); outputFormatter.PrintToken(Tokens.OpenCurlyBrace); outputFormatter.IndentationLevel++; diff --git a/src/Libraries/NRefactory/Project/Src/Visitors/AbstractASTVisitor.cs b/src/Libraries/NRefactory/Project/Src/Visitors/AbstractASTVisitor.cs index 37327f06ed..babdd0bbf5 100644 --- a/src/Libraries/NRefactory/Project/Src/Visitors/AbstractASTVisitor.cs +++ b/src/Libraries/NRefactory/Project/Src/Visitors/AbstractASTVisitor.cs @@ -625,6 +625,12 @@ namespace ICSharpCode.NRefactory.Visitors { return lockStatement.EmbeddedStatement.AcceptVisitor(this, data); } + public virtual object VisitMemberInitializerExpression(MemberInitializerExpression memberInitializerExpression, object data) { + Debug.Assert((memberInitializerExpression != null)); + Debug.Assert((memberInitializerExpression.Expression != null)); + return memberInitializerExpression.Expression.AcceptVisitor(this, data); + } + public virtual object VisitMemberReferenceExpression(MemberReferenceExpression memberReferenceExpression, object data) { Debug.Assert((memberReferenceExpression != null)); Debug.Assert((memberReferenceExpression.TargetObject != null)); diff --git a/src/Libraries/NRefactory/Project/Src/Visitors/AbstractAstTransformer.cs b/src/Libraries/NRefactory/Project/Src/Visitors/AbstractAstTransformer.cs index c799f9028a..c91116c79a 100644 --- a/src/Libraries/NRefactory/Project/Src/Visitors/AbstractAstTransformer.cs +++ b/src/Libraries/NRefactory/Project/Src/Visitors/AbstractAstTransformer.cs @@ -1120,6 +1120,15 @@ namespace ICSharpCode.NRefactory.Visitors { return null; } + public virtual object VisitMemberInitializerExpression(MemberInitializerExpression memberInitializerExpression, object data) { + Debug.Assert((memberInitializerExpression != null)); + Debug.Assert((memberInitializerExpression.Expression != null)); + nodeStack.Push(memberInitializerExpression.Expression); + memberInitializerExpression.Expression.AcceptVisitor(this, data); + memberInitializerExpression.Expression = ((Expression)(nodeStack.Pop())); + return null; + } + public virtual object VisitMemberReferenceExpression(MemberReferenceExpression memberReferenceExpression, object data) { Debug.Assert((memberReferenceExpression != null)); Debug.Assert((memberReferenceExpression.TargetObject != null)); diff --git a/src/Libraries/NRefactory/Project/Src/Visitors/NodeTrackingAstVisitor.cs b/src/Libraries/NRefactory/Project/Src/Visitors/NodeTrackingAstVisitor.cs index 888d15b2ae..9a169cdd04 100644 --- a/src/Libraries/NRefactory/Project/Src/Visitors/NodeTrackingAstVisitor.cs +++ b/src/Libraries/NRefactory/Project/Src/Visitors/NodeTrackingAstVisitor.cs @@ -451,6 +451,13 @@ namespace ICSharpCode.NRefactory.Visitors { return result; } + public sealed override object VisitMemberInitializerExpression(MemberInitializerExpression memberInitializerExpression, object data) { + this.BeginVisit(memberInitializerExpression); + object result = this.TrackedVisitMemberInitializerExpression(memberInitializerExpression, data); + this.EndVisit(memberInitializerExpression); + return result; + } + public sealed override object VisitMemberReferenceExpression(MemberReferenceExpression memberReferenceExpression, object data) { this.BeginVisit(memberReferenceExpression); object result = this.TrackedVisitMemberReferenceExpression(memberReferenceExpression, data); @@ -1132,6 +1139,10 @@ namespace ICSharpCode.NRefactory.Visitors { return base.VisitLockStatement(lockStatement, data); } + public virtual object TrackedVisitMemberInitializerExpression(MemberInitializerExpression memberInitializerExpression, object data) { + return base.VisitMemberInitializerExpression(memberInitializerExpression, data); + } + public virtual object TrackedVisitMemberReferenceExpression(MemberReferenceExpression memberReferenceExpression, object data) { return base.VisitMemberReferenceExpression(memberReferenceExpression, data); } diff --git a/src/Libraries/NRefactory/Project/Src/Visitors/NotImplementedAstVisitor.cs b/src/Libraries/NRefactory/Project/Src/Visitors/NotImplementedAstVisitor.cs index 306060c336..7a398aa60c 100644 --- a/src/Libraries/NRefactory/Project/Src/Visitors/NotImplementedAstVisitor.cs +++ b/src/Libraries/NRefactory/Project/Src/Visitors/NotImplementedAstVisitor.cs @@ -258,6 +258,10 @@ namespace ICSharpCode.NRefactory.Visitors { throw new global::System.NotImplementedException("LockStatement"); } + public virtual object VisitMemberInitializerExpression(MemberInitializerExpression memberInitializerExpression, object data) { + throw new global::System.NotImplementedException("MemberInitializerExpression"); + } + public virtual object VisitMemberReferenceExpression(MemberReferenceExpression memberReferenceExpression, object data) { throw new global::System.NotImplementedException("MemberReferenceExpression"); }