From 58dfc5abcedde59d47c6d1e674e86967401262a6 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Wed, 24 May 2006 19:13:44 +0000 Subject: [PATCH] Fixed SD2-813: If statement not parsed Fixed other small bugs. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1417 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Project/Src/CodeCompletion/BooResolver.cs | 10 +- .../Src/CodeCompletion/ResolveVisitor.cs | 7 + .../Boo/BooBinding/Test/ResolverTests.cs | 18 + .../Project/Src/Parser/CSharp/Parser.cs | 2070 +++++++++-------- .../Project/Src/Parser/CSharp/cs.ATG | 6 +- .../BinaryOperatorExpressionTests.cs | 8 + .../Base/Project/Src/Commands/FileCommands.cs | 2 +- .../AnonymousMethodReturnType.cs | 6 +- .../Converter/PrjxToSolutionProject.cs | 2 +- .../Project/Src/Project/Solution/Solution.cs | 9 +- .../LanguageBinding/LanguageBindingService.cs | 4 + .../Services/ProjectService/ProjectService.cs | 13 +- 12 files changed, 1107 insertions(+), 1048 deletions(-) diff --git a/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/BooResolver.cs b/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/BooResolver.cs index d38209faa0..1178de2963 100644 --- a/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/BooResolver.cs +++ b/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/BooResolver.cs @@ -103,6 +103,14 @@ namespace Grunwald.BooBinding.CodeCompletion callingMember = ResolveCurrentMember(olderClass); } } + if (callingMember != null) { + if (caretLine > callingMember.BodyRegion.EndLine) { + this.caretLine = callingMember.BodyRegion.EndLine; + this.caretColumn = callingMember.BodyRegion.EndColumn - 1; + } else if (caretLine == callingMember.BodyRegion.EndLine && caretColumn >= callingMember.BodyRegion.EndColumn) { + this.caretColumn = callingMember.BodyRegion.EndColumn - 1; + } + } return true; } @@ -197,7 +205,7 @@ namespace Grunwald.BooBinding.CodeCompletion return new NamespaceResolveResult(callingClass, callingMember, ""); } - ResolveResult rr = NRResolver.GetResultFromDeclarationLine(callingClass, callingMember as IMethodOrProperty, caretLine, caretColumn, expressionResult.Expression); + ResolveResult rr = NRResolver.GetResultFromDeclarationLine(callingClass, callingMember as IMethodOrProperty, this.caretLine, this.caretColumn, expressionResult.Expression); if (rr != null) return rr; AST.Expression expr; diff --git a/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/ResolveVisitor.cs b/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/ResolveVisitor.cs index 5f7616dee2..98859e8740 100644 --- a/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/ResolveVisitor.cs +++ b/src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/CodeCompletion/ResolveVisitor.cs @@ -84,6 +84,13 @@ namespace Grunwald.BooBinding.CodeCompletion void MakeMethodResult(IReturnType type, string methodName) { resolveResult = new MethodResolveResult(callingClass, resolver.CallingMember, type, methodName); + IMethod m = (resolveResult as MethodResolveResult).GetMethodIfSingleOverload(); + if (m != null) { + AnonymousMethodReturnType amrt = new AnonymousMethodReturnType(cu); + amrt.MethodReturnType = m.ReturnType; + amrt.MethodParameters = m.Parameters; + resolveResult.ResolvedType = amrt; + } } void MakeNamespaceResult(string namespaceName) diff --git a/src/AddIns/BackendBindings/Boo/BooBinding/Test/ResolverTests.cs b/src/AddIns/BackendBindings/Boo/BooBinding/Test/ResolverTests.cs index b41cebcdfe..364c9c6d10 100644 --- a/src/AddIns/BackendBindings/Boo/BooBinding/Test/ResolverTests.cs +++ b/src/AddIns/BackendBindings/Boo/BooBinding/Test/ResolverTests.cs @@ -6,6 +6,7 @@ */ using System; +using System.Collections; using System.Reflection; using NUnit.Framework; using ICSharpCode.Core; @@ -217,8 +218,25 @@ namespace Grunwald.BooBinding.Tests "\t\tif boo640b = boo640a as FieldInfo: /*640*/\n" + "\t\t\tprint boo640b\n" + "\t\n" + + "\tprint 'end of method'\n" + "\t/*1*/\n"; + [Test] + public void MyMethodCompletion() + { + MethodResolveResult rr = Resolve(regressionProg, "MyMethod", "/*1*/"); + ArrayList arr = rr.GetCompletionData(lastPC); + Assert.IsNotNull(arr); + bool beginInvoke = false; + bool invoke = false; + foreach (IMember m in arr) { + if (m.Name == "BeginInvoke") beginInvoke = true; + if (m.Name == "Invoke") invoke = true; + } + Assert.IsTrue(beginInvoke, "beginInvoke"); + Assert.IsTrue(invoke, "invoke"); + } + [Test] public void Boo629VariableScope() { diff --git a/src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs b/src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs index 6ca859f3cc..763a74e46f 100644 --- a/src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs +++ b/src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs @@ -352,7 +352,11 @@ bool SkipGeneric(ref Token pt) --braces; } else if (pt.kind == Tokens.LessThan) { ++braces; - } else if (pt.kind == Tokens.Semicolon || pt.kind == Tokens.OpenCurlyBrace || pt.kind == Tokens.CloseCurlyBrace || pt.kind == Tokens.EOF) { + } else if (pt.kind != Tokens.Identifier && pt.kind != Tokens.Comma + && pt.kind != Tokens.OpenSquareBracket && pt.kind != Tokens.CloseSquareBracket + && pt.kind != Tokens.Question + && !Tokens.TypeKW[pt.kind]) + { return false; } } @@ -538,14 +542,14 @@ bool WriteFullTypeName(StringBuilder b, Expression expr) void CS() { -#line 657 "cs.ATG" +#line 661 "cs.ATG" lexer.NextToken(); /* get the first token */ compilationUnit = new CompilationUnit(); while (la.kind == 120) { UsingDirective(); } while ( -#line 661 "cs.ATG" +#line 665 "cs.ATG" IsGlobalAttrTarget()) { GlobalAttributeSection(); } @@ -557,25 +561,25 @@ IsGlobalAttrTarget()) { void UsingDirective() { -#line 668 "cs.ATG" +#line 672 "cs.ATG" string qualident = null; TypeReference aliasedType = null; Expect(120); -#line 671 "cs.ATG" +#line 675 "cs.ATG" Point startPos = t.Location; Qualident( -#line 672 "cs.ATG" +#line 676 "cs.ATG" out qualident); if (la.kind == 3) { lexer.NextToken(); NonArrayType( -#line 673 "cs.ATG" +#line 677 "cs.ATG" out aliasedType); } Expect(11); -#line 675 "cs.ATG" +#line 679 "cs.ATG" if (qualident != null && qualident.Length > 0) { INode node; if (aliasedType != null) { @@ -593,11 +597,11 @@ out aliasedType); void GlobalAttributeSection() { Expect(18); -#line 691 "cs.ATG" +#line 695 "cs.ATG" Point startPos = t.Location; Expect(1); -#line 692 "cs.ATG" +#line 696 "cs.ATG" if (t.val != "assembly") Error("global attribute target specifier (\"assembly\") expected"); string attributeTarget = t.val; List attributes = new List(); @@ -605,20 +609,20 @@ out aliasedType); Expect(9); Attribute( -#line 697 "cs.ATG" +#line 701 "cs.ATG" out attribute); -#line 697 "cs.ATG" +#line 701 "cs.ATG" attributes.Add(attribute); while ( -#line 698 "cs.ATG" +#line 702 "cs.ATG" NotFinalComma()) { Expect(14); Attribute( -#line 698 "cs.ATG" +#line 702 "cs.ATG" out attribute); -#line 698 "cs.ATG" +#line 702 "cs.ATG" attributes.Add(attribute); } if (la.kind == 14) { @@ -626,7 +630,7 @@ out attribute); } Expect(19); -#line 700 "cs.ATG" +#line 704 "cs.ATG" AttributeSection section = new AttributeSection(attributeTarget, attributes); section.StartLocation = startPos; section.EndLocation = t.EndLocation; @@ -636,7 +640,7 @@ out attribute); void NamespaceMemberDecl() { -#line 791 "cs.ATG" +#line 795 "cs.ATG" AttributeSection section; List attributes = new List(); Modifiers m = new Modifiers(); @@ -645,13 +649,13 @@ out attribute); if (la.kind == 87) { lexer.NextToken(); -#line 797 "cs.ATG" +#line 801 "cs.ATG" Point startPos = t.Location; Qualident( -#line 798 "cs.ATG" +#line 802 "cs.ATG" out qualident); -#line 798 "cs.ATG" +#line 802 "cs.ATG" INode node = new NamespaceDeclaration(qualident); node.StartLocation = startPos; compilationUnit.AddChild(node); @@ -669,139 +673,139 @@ out qualident); lexer.NextToken(); } -#line 807 "cs.ATG" +#line 811 "cs.ATG" node.EndLocation = t.EndLocation; compilationUnit.BlockEnd(); } else if (StartOf(2)) { while (la.kind == 18) { AttributeSection( -#line 811 "cs.ATG" +#line 815 "cs.ATG" out section); -#line 811 "cs.ATG" +#line 815 "cs.ATG" attributes.Add(section); } while (StartOf(3)) { TypeModifier( -#line 812 "cs.ATG" +#line 816 "cs.ATG" m); } TypeDecl( -#line 813 "cs.ATG" +#line 817 "cs.ATG" m, attributes); } else SynErr(126); } void Qualident( -#line 935 "cs.ATG" +#line 939 "cs.ATG" out string qualident) { Expect(1); -#line 937 "cs.ATG" +#line 941 "cs.ATG" qualidentBuilder.Length = 0; qualidentBuilder.Append(t.val); while ( -#line 938 "cs.ATG" +#line 942 "cs.ATG" DotAndIdent()) { Expect(15); Expect(1); -#line 938 "cs.ATG" +#line 942 "cs.ATG" qualidentBuilder.Append('.'); qualidentBuilder.Append(t.val); } -#line 941 "cs.ATG" +#line 945 "cs.ATG" qualident = qualidentBuilder.ToString(); } void NonArrayType( -#line 1050 "cs.ATG" +#line 1054 "cs.ATG" out TypeReference type) { -#line 1052 "cs.ATG" +#line 1056 "cs.ATG" string name; int pointer = 0; type = null; if (la.kind == 1 || la.kind == 90 || la.kind == 107) { ClassType( -#line 1057 "cs.ATG" +#line 1061 "cs.ATG" out type, false); } else if (StartOf(4)) { SimpleType( -#line 1058 "cs.ATG" +#line 1062 "cs.ATG" out name); -#line 1058 "cs.ATG" +#line 1062 "cs.ATG" type = new TypeReference(name); } else if (la.kind == 122) { lexer.NextToken(); Expect(6); -#line 1059 "cs.ATG" +#line 1063 "cs.ATG" pointer = 1; type = new TypeReference("void"); } else SynErr(127); if (la.kind == 12) { NullableQuestionMark( -#line 1062 "cs.ATG" +#line 1066 "cs.ATG" ref type); } while ( -#line 1064 "cs.ATG" +#line 1068 "cs.ATG" IsPointer()) { Expect(6); -#line 1065 "cs.ATG" +#line 1069 "cs.ATG" ++pointer; } -#line 1067 "cs.ATG" +#line 1071 "cs.ATG" if (type != null) { type.PointerNestingLevel = pointer; } } void Attribute( -#line 707 "cs.ATG" +#line 711 "cs.ATG" out ASTAttribute attribute) { -#line 708 "cs.ATG" +#line 712 "cs.ATG" string qualident; string alias = null; if ( -#line 712 "cs.ATG" +#line 716 "cs.ATG" la.kind == Tokens.Identifier && Peek(1).kind == Tokens.DoubleColon) { lexer.NextToken(); -#line 713 "cs.ATG" +#line 717 "cs.ATG" alias = t.val; Expect(10); } Qualident( -#line 716 "cs.ATG" +#line 720 "cs.ATG" out qualident); -#line 717 "cs.ATG" +#line 721 "cs.ATG" List positional = new List(); List named = new List(); string name = (alias != null && alias != "global") ? alias + "." + qualident : qualident; if (la.kind == 20) { AttributeArguments( -#line 721 "cs.ATG" +#line 725 "cs.ATG" positional, named); } -#line 721 "cs.ATG" +#line 725 "cs.ATG" attribute = new ICSharpCode.NRefactory.Parser.AST.Attribute(name, positional, named); } void AttributeArguments( -#line 724 "cs.ATG" +#line 728 "cs.ATG" List positional, List named) { -#line 726 "cs.ATG" +#line 730 "cs.ATG" bool nameFound = false; string name = ""; Expression expr; @@ -809,22 +813,22 @@ List positional, List named) { Expect(20); if (StartOf(5)) { if ( -#line 734 "cs.ATG" +#line 738 "cs.ATG" IsAssignment()) { -#line 734 "cs.ATG" +#line 738 "cs.ATG" nameFound = true; lexer.NextToken(); -#line 735 "cs.ATG" +#line 739 "cs.ATG" name = t.val; Expect(3); } Expr( -#line 737 "cs.ATG" +#line 741 "cs.ATG" out expr); -#line 737 "cs.ATG" +#line 741 "cs.ATG" if (expr != null) {if(name == "") positional.Add(expr); else { named.Add(new NamedArgumentExpression(name, expr)); name = ""; } } @@ -832,26 +836,26 @@ out expr); while (la.kind == 14) { lexer.NextToken(); if ( -#line 745 "cs.ATG" +#line 749 "cs.ATG" IsAssignment()) { -#line 745 "cs.ATG" +#line 749 "cs.ATG" nameFound = true; Expect(1); -#line 746 "cs.ATG" +#line 750 "cs.ATG" name = t.val; Expect(3); } else if (StartOf(5)) { -#line 748 "cs.ATG" +#line 752 "cs.ATG" if (nameFound) Error("no positional argument after named argument"); } else SynErr(128); Expr( -#line 749 "cs.ATG" +#line 753 "cs.ATG" out expr); -#line 749 "cs.ATG" +#line 753 "cs.ATG" if (expr != null) { if(name == "") positional.Add(expr); else { named.Add(new NamedArgumentExpression(name, expr)); name = ""; } } @@ -862,70 +866,70 @@ out expr); } void Expr( -#line 2086 "cs.ATG" +#line 2090 "cs.ATG" out Expression expr) { -#line 2087 "cs.ATG" +#line 2091 "cs.ATG" expr = null; Expression expr1 = null, expr2 = null; AssignmentOperatorType op; UnaryExpr( -#line 2089 "cs.ATG" +#line 2093 "cs.ATG" out expr); if (StartOf(6)) { AssignmentOperator( -#line 2092 "cs.ATG" +#line 2096 "cs.ATG" out op); Expr( -#line 2092 "cs.ATG" +#line 2096 "cs.ATG" out expr1); -#line 2092 "cs.ATG" +#line 2096 "cs.ATG" expr = new AssignmentExpression(expr, op, expr1); } else if ( -#line 2093 "cs.ATG" +#line 2097 "cs.ATG" la.kind == Tokens.GreaterThan && Peek(1).kind == Tokens.GreaterEqual) { AssignmentOperator( -#line 2094 "cs.ATG" +#line 2098 "cs.ATG" out op); Expr( -#line 2094 "cs.ATG" +#line 2098 "cs.ATG" out expr1); -#line 2094 "cs.ATG" +#line 2098 "cs.ATG" expr = new AssignmentExpression(expr, op, expr1); } else if (StartOf(7)) { ConditionalOrExpr( -#line 2096 "cs.ATG" +#line 2100 "cs.ATG" ref expr); if (la.kind == 13) { lexer.NextToken(); Expr( -#line 2097 "cs.ATG" +#line 2101 "cs.ATG" out expr1); -#line 2097 "cs.ATG" +#line 2101 "cs.ATG" expr = new BinaryOperatorExpression(expr, BinaryOperatorType.NullCoalescing, expr1); } if (la.kind == 12) { lexer.NextToken(); Expr( -#line 2098 "cs.ATG" +#line 2102 "cs.ATG" out expr1); Expect(9); Expr( -#line 2098 "cs.ATG" +#line 2102 "cs.ATG" out expr2); -#line 2098 "cs.ATG" +#line 2102 "cs.ATG" expr = new ConditionalExpression(expr, expr1, expr2); } } else SynErr(129); } void AttributeSection( -#line 758 "cs.ATG" +#line 762 "cs.ATG" out AttributeSection section) { -#line 760 "cs.ATG" +#line 764 "cs.ATG" string attributeTarget = ""; List attributes = new List(); ASTAttribute attribute; @@ -933,25 +937,25 @@ out AttributeSection section) { Expect(18); -#line 766 "cs.ATG" +#line 770 "cs.ATG" Point startPos = t.Location; if ( -#line 767 "cs.ATG" +#line 771 "cs.ATG" IsLocalAttrTarget()) { if (la.kind == 68) { lexer.NextToken(); -#line 768 "cs.ATG" +#line 772 "cs.ATG" attributeTarget = "event"; } else if (la.kind == 100) { lexer.NextToken(); -#line 769 "cs.ATG" +#line 773 "cs.ATG" attributeTarget = "return"; } else { lexer.NextToken(); -#line 770 "cs.ATG" +#line 774 "cs.ATG" if (t.val != "field" || t.val != "method" || t.val != "module" || t.val != "param" || t.val != "property" || t.val != "type") @@ -963,20 +967,20 @@ IsLocalAttrTarget()) { Expect(9); } Attribute( -#line 780 "cs.ATG" +#line 784 "cs.ATG" out attribute); -#line 780 "cs.ATG" +#line 784 "cs.ATG" attributes.Add(attribute); while ( -#line 781 "cs.ATG" +#line 785 "cs.ATG" NotFinalComma()) { Expect(14); Attribute( -#line 781 "cs.ATG" +#line 785 "cs.ATG" out attribute); -#line 781 "cs.ATG" +#line 785 "cs.ATG" attributes.Add(attribute); } if (la.kind == 14) { @@ -984,7 +988,7 @@ out attribute); } Expect(19); -#line 783 "cs.ATG" +#line 787 "cs.ATG" section = new AttributeSection(attributeTarget, attributes); section.StartLocation = startPos; section.EndLocation = t.EndLocation; @@ -992,76 +996,76 @@ out attribute); } void TypeModifier( -#line 1137 "cs.ATG" +#line 1141 "cs.ATG" Modifiers m) { switch (la.kind) { case 88: { lexer.NextToken(); -#line 1139 "cs.ATG" +#line 1143 "cs.ATG" m.Add(Modifier.New, t.Location); break; } case 97: { lexer.NextToken(); -#line 1140 "cs.ATG" +#line 1144 "cs.ATG" m.Add(Modifier.Public, t.Location); break; } case 96: { lexer.NextToken(); -#line 1141 "cs.ATG" +#line 1145 "cs.ATG" m.Add(Modifier.Protected, t.Location); break; } case 83: { lexer.NextToken(); -#line 1142 "cs.ATG" +#line 1146 "cs.ATG" m.Add(Modifier.Internal, t.Location); break; } case 95: { lexer.NextToken(); -#line 1143 "cs.ATG" +#line 1147 "cs.ATG" m.Add(Modifier.Private, t.Location); break; } case 118: { lexer.NextToken(); -#line 1144 "cs.ATG" +#line 1148 "cs.ATG" m.Add(Modifier.Unsafe, t.Location); break; } case 48: { lexer.NextToken(); -#line 1145 "cs.ATG" +#line 1149 "cs.ATG" m.Add(Modifier.Abstract, t.Location); break; } case 102: { lexer.NextToken(); -#line 1146 "cs.ATG" +#line 1150 "cs.ATG" m.Add(Modifier.Sealed, t.Location); break; } case 106: { lexer.NextToken(); -#line 1147 "cs.ATG" +#line 1151 "cs.ATG" m.Add(Modifier.Static, t.Location); break; } case 1: { lexer.NextToken(); -#line 1148 "cs.ATG" +#line 1152 "cs.ATG" if (t.val == "partial") { m.Add(Modifier.Partial, t.Location); } else { Error("Unexpected identifier"); } break; } @@ -1070,10 +1074,10 @@ Modifiers m) { } void TypeDecl( -#line 816 "cs.ATG" +#line 820 "cs.ATG" Modifiers m, List attributes) { -#line 818 "cs.ATG" +#line 822 "cs.ATG" TypeReference type; List names; List p = new List(); @@ -1082,11 +1086,11 @@ Modifiers m, List attributes) { if (la.kind == 58) { -#line 824 "cs.ATG" +#line 828 "cs.ATG" m.Check(Modifier.Classes); lexer.NextToken(); -#line 825 "cs.ATG" +#line 829 "cs.ATG" TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes); templates = newType.Templates; compilationUnit.AddChild(newType); @@ -1097,48 +1101,48 @@ Modifiers m, List attributes) { Expect(1); -#line 833 "cs.ATG" +#line 837 "cs.ATG" newType.Name = t.val; if (la.kind == 23) { TypeParameterList( -#line 836 "cs.ATG" +#line 840 "cs.ATG" templates); } if (la.kind == 9) { ClassBase( -#line 838 "cs.ATG" +#line 842 "cs.ATG" out names); -#line 838 "cs.ATG" +#line 842 "cs.ATG" newType.BaseTypes = names; } while ( -#line 841 "cs.ATG" +#line 845 "cs.ATG" IdentIsWhere()) { TypeParameterConstraintsClause( -#line 841 "cs.ATG" +#line 845 "cs.ATG" templates); } -#line 843 "cs.ATG" +#line 847 "cs.ATG" newType.BodyStartLocation = t.EndLocation; ClassBody(); if (la.kind == 11) { lexer.NextToken(); } -#line 845 "cs.ATG" +#line 849 "cs.ATG" newType.EndLocation = t.Location; compilationUnit.BlockEnd(); } else if (StartOf(8)) { -#line 848 "cs.ATG" +#line 852 "cs.ATG" m.Check(Modifier.StructsInterfacesEnumsDelegates); if (la.kind == 108) { lexer.NextToken(); -#line 849 "cs.ATG" +#line 853 "cs.ATG" TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes); templates = newType.Templates; newType.StartLocation = m.GetDeclarationLocation(t.Location); @@ -1148,44 +1152,44 @@ templates); Expect(1); -#line 856 "cs.ATG" +#line 860 "cs.ATG" newType.Name = t.val; if (la.kind == 23) { TypeParameterList( -#line 859 "cs.ATG" +#line 863 "cs.ATG" templates); } if (la.kind == 9) { StructInterfaces( -#line 861 "cs.ATG" +#line 865 "cs.ATG" out names); -#line 861 "cs.ATG" +#line 865 "cs.ATG" newType.BaseTypes = names; } while ( -#line 864 "cs.ATG" +#line 868 "cs.ATG" IdentIsWhere()) { TypeParameterConstraintsClause( -#line 864 "cs.ATG" +#line 868 "cs.ATG" templates); } -#line 867 "cs.ATG" +#line 871 "cs.ATG" newType.BodyStartLocation = t.EndLocation; StructBody(); if (la.kind == 11) { lexer.NextToken(); } -#line 869 "cs.ATG" +#line 873 "cs.ATG" newType.EndLocation = t.Location; compilationUnit.BlockEnd(); } else if (la.kind == 82) { lexer.NextToken(); -#line 873 "cs.ATG" +#line 877 "cs.ATG" TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes); templates = newType.Templates; compilationUnit.AddChild(newType); @@ -1195,44 +1199,44 @@ templates); Expect(1); -#line 880 "cs.ATG" +#line 884 "cs.ATG" newType.Name = t.val; if (la.kind == 23) { TypeParameterList( -#line 883 "cs.ATG" +#line 887 "cs.ATG" templates); } if (la.kind == 9) { InterfaceBase( -#line 885 "cs.ATG" +#line 889 "cs.ATG" out names); -#line 885 "cs.ATG" +#line 889 "cs.ATG" newType.BaseTypes = names; } while ( -#line 888 "cs.ATG" +#line 892 "cs.ATG" IdentIsWhere()) { TypeParameterConstraintsClause( -#line 888 "cs.ATG" +#line 892 "cs.ATG" templates); } -#line 890 "cs.ATG" +#line 894 "cs.ATG" newType.BodyStartLocation = t.EndLocation; InterfaceBody(); if (la.kind == 11) { lexer.NextToken(); } -#line 892 "cs.ATG" +#line 896 "cs.ATG" newType.EndLocation = t.Location; compilationUnit.BlockEnd(); } else if (la.kind == 67) { lexer.NextToken(); -#line 896 "cs.ATG" +#line 900 "cs.ATG" TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes); compilationUnit.AddChild(newType); compilationUnit.BlockStart(newType); @@ -1241,81 +1245,81 @@ templates); Expect(1); -#line 902 "cs.ATG" +#line 906 "cs.ATG" newType.Name = t.val; if (la.kind == 9) { lexer.NextToken(); IntegralType( -#line 903 "cs.ATG" +#line 907 "cs.ATG" out name); -#line 903 "cs.ATG" +#line 907 "cs.ATG" newType.BaseTypes.Add(new TypeReference(name)); } -#line 905 "cs.ATG" +#line 909 "cs.ATG" newType.BodyStartLocation = t.EndLocation; EnumBody(); if (la.kind == 11) { lexer.NextToken(); } -#line 907 "cs.ATG" +#line 911 "cs.ATG" newType.EndLocation = t.Location; compilationUnit.BlockEnd(); } else { lexer.NextToken(); -#line 911 "cs.ATG" +#line 915 "cs.ATG" DelegateDeclaration delegateDeclr = new DelegateDeclaration(m.Modifier, attributes); templates = delegateDeclr.Templates; delegateDeclr.StartLocation = m.GetDeclarationLocation(t.Location); if ( -#line 915 "cs.ATG" +#line 919 "cs.ATG" NotVoidPointer()) { Expect(122); -#line 915 "cs.ATG" +#line 919 "cs.ATG" delegateDeclr.ReturnType = new TypeReference("void", 0, null); } else if (StartOf(9)) { Type( -#line 916 "cs.ATG" +#line 920 "cs.ATG" out type); -#line 916 "cs.ATG" +#line 920 "cs.ATG" delegateDeclr.ReturnType = type; } else SynErr(131); Expect(1); -#line 918 "cs.ATG" +#line 922 "cs.ATG" delegateDeclr.Name = t.val; if (la.kind == 23) { TypeParameterList( -#line 921 "cs.ATG" +#line 925 "cs.ATG" templates); } Expect(20); if (StartOf(10)) { FormalParameterList( -#line 923 "cs.ATG" +#line 927 "cs.ATG" p); -#line 923 "cs.ATG" +#line 927 "cs.ATG" delegateDeclr.Parameters = p; } Expect(21); while ( -#line 927 "cs.ATG" +#line 931 "cs.ATG" IdentIsWhere()) { TypeParameterConstraintsClause( -#line 927 "cs.ATG" +#line 931 "cs.ATG" templates); } Expect(11); -#line 929 "cs.ATG" +#line 933 "cs.ATG" delegateDeclr.EndLocation = t.Location; compilationUnit.AddChild(delegateDeclr); @@ -1324,90 +1328,90 @@ templates); } void TypeParameterList( -#line 2489 "cs.ATG" +#line 2493 "cs.ATG" List templates) { -#line 2491 "cs.ATG" +#line 2495 "cs.ATG" AttributeSection section; List attributes = new List(); Expect(23); while (la.kind == 18) { AttributeSection( -#line 2495 "cs.ATG" +#line 2499 "cs.ATG" out section); -#line 2495 "cs.ATG" +#line 2499 "cs.ATG" attributes.Add(section); } Expect(1); -#line 2496 "cs.ATG" +#line 2500 "cs.ATG" templates.Add(new TemplateDefinition(t.val, attributes)); while (la.kind == 14) { lexer.NextToken(); while (la.kind == 18) { AttributeSection( -#line 2497 "cs.ATG" +#line 2501 "cs.ATG" out section); -#line 2497 "cs.ATG" +#line 2501 "cs.ATG" attributes.Add(section); } Expect(1); -#line 2498 "cs.ATG" +#line 2502 "cs.ATG" templates.Add(new TemplateDefinition(t.val, attributes)); } Expect(22); } void ClassBase( -#line 944 "cs.ATG" +#line 948 "cs.ATG" out List names) { -#line 946 "cs.ATG" +#line 950 "cs.ATG" TypeReference typeRef; names = new List(); Expect(9); ClassType( -#line 950 "cs.ATG" +#line 954 "cs.ATG" out typeRef, false); -#line 950 "cs.ATG" +#line 954 "cs.ATG" if (typeRef != null) { names.Add(typeRef); } while (la.kind == 14) { lexer.NextToken(); TypeName( -#line 951 "cs.ATG" +#line 955 "cs.ATG" out typeRef, false); -#line 951 "cs.ATG" +#line 955 "cs.ATG" if (typeRef != null) { names.Add(typeRef); } } } void TypeParameterConstraintsClause( -#line 2502 "cs.ATG" +#line 2506 "cs.ATG" List templates) { -#line 2503 "cs.ATG" +#line 2507 "cs.ATG" string name = ""; TypeReference type; Expect(1); -#line 2505 "cs.ATG" +#line 2509 "cs.ATG" if (t.val != "where") Error("where expected"); Expect(1); -#line 2506 "cs.ATG" +#line 2510 "cs.ATG" name = t.val; Expect(9); TypeParameterConstraintsClauseBase( -#line 2508 "cs.ATG" +#line 2512 "cs.ATG" out type); -#line 2509 "cs.ATG" +#line 2513 "cs.ATG" TemplateDefinition td = null; foreach (TemplateDefinition d in templates) { if (d.Name == name) { @@ -1420,10 +1424,10 @@ out type); while (la.kind == 14) { lexer.NextToken(); TypeParameterConstraintsClauseBase( -#line 2518 "cs.ATG" +#line 2522 "cs.ATG" out type); -#line 2519 "cs.ATG" +#line 2523 "cs.ATG" td = null; foreach (TemplateDefinition d in templates) { if (d.Name == name) { @@ -1438,110 +1442,110 @@ out type); void ClassBody() { -#line 955 "cs.ATG" +#line 959 "cs.ATG" AttributeSection section; Expect(16); while (StartOf(11)) { -#line 958 "cs.ATG" +#line 962 "cs.ATG" List attributes = new List(); Modifiers m = new Modifiers(); while (la.kind == 18) { AttributeSection( -#line 961 "cs.ATG" +#line 965 "cs.ATG" out section); -#line 961 "cs.ATG" +#line 965 "cs.ATG" attributes.Add(section); } MemberModifiers( -#line 962 "cs.ATG" +#line 966 "cs.ATG" m); ClassMemberDecl( -#line 963 "cs.ATG" +#line 967 "cs.ATG" m, attributes); } Expect(17); } void StructInterfaces( -#line 968 "cs.ATG" +#line 972 "cs.ATG" out List names) { -#line 970 "cs.ATG" +#line 974 "cs.ATG" TypeReference typeRef; names = new List(); Expect(9); TypeName( -#line 974 "cs.ATG" +#line 978 "cs.ATG" out typeRef, false); -#line 974 "cs.ATG" +#line 978 "cs.ATG" if (typeRef != null) { names.Add(typeRef); } while (la.kind == 14) { lexer.NextToken(); TypeName( -#line 975 "cs.ATG" +#line 979 "cs.ATG" out typeRef, false); -#line 975 "cs.ATG" +#line 979 "cs.ATG" if (typeRef != null) { names.Add(typeRef); } } } void StructBody() { -#line 979 "cs.ATG" +#line 983 "cs.ATG" AttributeSection section; Expect(16); while (StartOf(12)) { -#line 982 "cs.ATG" +#line 986 "cs.ATG" List attributes = new List(); Modifiers m = new Modifiers(); while (la.kind == 18) { AttributeSection( -#line 985 "cs.ATG" +#line 989 "cs.ATG" out section); -#line 985 "cs.ATG" +#line 989 "cs.ATG" attributes.Add(section); } MemberModifiers( -#line 986 "cs.ATG" +#line 990 "cs.ATG" m); StructMemberDecl( -#line 987 "cs.ATG" +#line 991 "cs.ATG" m, attributes); } Expect(17); } void InterfaceBase( -#line 992 "cs.ATG" +#line 996 "cs.ATG" out List names) { -#line 994 "cs.ATG" +#line 998 "cs.ATG" TypeReference typeRef; names = new List(); Expect(9); TypeName( -#line 998 "cs.ATG" +#line 1002 "cs.ATG" out typeRef, false); -#line 998 "cs.ATG" +#line 1002 "cs.ATG" if (typeRef != null) { names.Add(typeRef); } while (la.kind == 14) { lexer.NextToken(); TypeName( -#line 999 "cs.ATG" +#line 1003 "cs.ATG" out typeRef, false); -#line 999 "cs.ATG" +#line 1003 "cs.ATG" if (typeRef != null) { names.Add(typeRef); } } } @@ -1555,72 +1559,72 @@ out typeRef, false); } void IntegralType( -#line 1159 "cs.ATG" +#line 1163 "cs.ATG" out string name) { -#line 1159 "cs.ATG" +#line 1163 "cs.ATG" name = ""; switch (la.kind) { case 101: { lexer.NextToken(); -#line 1161 "cs.ATG" +#line 1165 "cs.ATG" name = "sbyte"; break; } case 53: { lexer.NextToken(); -#line 1162 "cs.ATG" +#line 1166 "cs.ATG" name = "byte"; break; } case 103: { lexer.NextToken(); -#line 1163 "cs.ATG" +#line 1167 "cs.ATG" name = "short"; break; } case 119: { lexer.NextToken(); -#line 1164 "cs.ATG" +#line 1168 "cs.ATG" name = "ushort"; break; } case 81: { lexer.NextToken(); -#line 1165 "cs.ATG" +#line 1169 "cs.ATG" name = "int"; break; } case 115: { lexer.NextToken(); -#line 1166 "cs.ATG" +#line 1170 "cs.ATG" name = "uint"; break; } case 86: { lexer.NextToken(); -#line 1167 "cs.ATG" +#line 1171 "cs.ATG" name = "long"; break; } case 116: { lexer.NextToken(); -#line 1168 "cs.ATG" +#line 1172 "cs.ATG" name = "ulong"; break; } case 56: { lexer.NextToken(); -#line 1169 "cs.ATG" +#line 1173 "cs.ATG" name = "char"; break; } @@ -1630,25 +1634,25 @@ out string name) { void EnumBody() { -#line 1008 "cs.ATG" +#line 1012 "cs.ATG" FieldDeclaration f; Expect(16); if (la.kind == 1 || la.kind == 18) { EnumMemberDecl( -#line 1011 "cs.ATG" +#line 1015 "cs.ATG" out f); -#line 1011 "cs.ATG" +#line 1015 "cs.ATG" compilationUnit.AddChild(f); while ( -#line 1012 "cs.ATG" +#line 1016 "cs.ATG" NotFinalComma()) { Expect(14); EnumMemberDecl( -#line 1013 "cs.ATG" +#line 1017 "cs.ATG" out f); -#line 1013 "cs.ATG" +#line 1017 "cs.ATG" compilationUnit.AddChild(f); } if (la.kind == 14) { @@ -1659,36 +1663,36 @@ out f); } void Type( -#line 1018 "cs.ATG" +#line 1022 "cs.ATG" out TypeReference type) { TypeWithRestriction( -#line 1020 "cs.ATG" +#line 1024 "cs.ATG" out type, true, false); } void FormalParameterList( -#line 1081 "cs.ATG" +#line 1085 "cs.ATG" List parameter) { -#line 1084 "cs.ATG" +#line 1088 "cs.ATG" ParameterDeclarationExpression p; AttributeSection section; List attributes = new List(); while (la.kind == 18) { AttributeSection( -#line 1089 "cs.ATG" +#line 1093 "cs.ATG" out section); -#line 1089 "cs.ATG" +#line 1093 "cs.ATG" attributes.Add(section); } if (StartOf(14)) { FixedParameter( -#line 1091 "cs.ATG" +#line 1095 "cs.ATG" out p); -#line 1091 "cs.ATG" +#line 1095 "cs.ATG" bool paramsFound = false; p.Attributes = attributes; parameter.Add(p); @@ -1696,96 +1700,96 @@ out p); while (la.kind == 14) { lexer.NextToken(); -#line 1096 "cs.ATG" +#line 1100 "cs.ATG" attributes = new List(); if (paramsFound) Error("params array must be at end of parameter list"); while (la.kind == 18) { AttributeSection( -#line 1097 "cs.ATG" +#line 1101 "cs.ATG" out section); -#line 1097 "cs.ATG" +#line 1101 "cs.ATG" attributes.Add(section); } if (StartOf(14)) { FixedParameter( -#line 1099 "cs.ATG" +#line 1103 "cs.ATG" out p); -#line 1099 "cs.ATG" +#line 1103 "cs.ATG" p.Attributes = attributes; parameter.Add(p); } else if (la.kind == 94) { ParameterArray( -#line 1100 "cs.ATG" +#line 1104 "cs.ATG" out p); -#line 1100 "cs.ATG" +#line 1104 "cs.ATG" paramsFound = true; p.Attributes = attributes; parameter.Add(p); } else SynErr(134); } } else if (la.kind == 94) { ParameterArray( -#line 1103 "cs.ATG" +#line 1107 "cs.ATG" out p); -#line 1103 "cs.ATG" +#line 1107 "cs.ATG" p.Attributes = attributes; parameter.Add(p); } else SynErr(135); } void ClassType( -#line 1151 "cs.ATG" +#line 1155 "cs.ATG" out TypeReference typeRef, bool canBeUnbound) { -#line 1152 "cs.ATG" +#line 1156 "cs.ATG" TypeReference r; typeRef = null; if (la.kind == 1) { TypeName( -#line 1154 "cs.ATG" +#line 1158 "cs.ATG" out r, canBeUnbound); -#line 1154 "cs.ATG" +#line 1158 "cs.ATG" typeRef = r; } else if (la.kind == 90) { lexer.NextToken(); -#line 1155 "cs.ATG" +#line 1159 "cs.ATG" typeRef = new TypeReference("object"); } else if (la.kind == 107) { lexer.NextToken(); -#line 1156 "cs.ATG" +#line 1160 "cs.ATG" typeRef = new TypeReference("string"); } else SynErr(136); } void TypeName( -#line 2432 "cs.ATG" +#line 2436 "cs.ATG" out TypeReference typeRef, bool canBeUnbound) { -#line 2433 "cs.ATG" +#line 2437 "cs.ATG" List typeArguments = null; string alias = null; string qualident; if ( -#line 2438 "cs.ATG" +#line 2442 "cs.ATG" la.kind == Tokens.Identifier && Peek(1).kind == Tokens.DoubleColon) { lexer.NextToken(); -#line 2439 "cs.ATG" +#line 2443 "cs.ATG" alias = t.val; Expect(10); } Qualident( -#line 2442 "cs.ATG" +#line 2446 "cs.ATG" out qualident); if (la.kind == 23) { TypeArgumentList( -#line 2443 "cs.ATG" +#line 2447 "cs.ATG" out typeArguments, canBeUnbound); } -#line 2445 "cs.ATG" +#line 2449 "cs.ATG" if (alias == null) { typeRef = new TypeReference(qualident, typeArguments); } else if (alias == "global") { @@ -1796,129 +1800,129 @@ out typeArguments, canBeUnbound); } while ( -#line 2454 "cs.ATG" +#line 2458 "cs.ATG" DotAndIdent()) { Expect(15); -#line 2455 "cs.ATG" +#line 2459 "cs.ATG" typeArguments = null; Qualident( -#line 2456 "cs.ATG" +#line 2460 "cs.ATG" out qualident); if (la.kind == 23) { TypeArgumentList( -#line 2457 "cs.ATG" +#line 2461 "cs.ATG" out typeArguments, canBeUnbound); } -#line 2458 "cs.ATG" +#line 2462 "cs.ATG" typeRef = new InnerClassTypeReference(typeRef, qualident, typeArguments); } } void MemberModifiers( -#line 1172 "cs.ATG" +#line 1176 "cs.ATG" Modifiers m) { while (StartOf(15) || -#line 1189 "cs.ATG" +#line 1193 "cs.ATG" la.kind == Tokens.Identifier && la.val == "partial") { if (la.kind == 48) { lexer.NextToken(); -#line 1175 "cs.ATG" +#line 1179 "cs.ATG" m.Add(Modifier.Abstract, t.Location); } else if (la.kind == 70) { lexer.NextToken(); -#line 1176 "cs.ATG" +#line 1180 "cs.ATG" m.Add(Modifier.Extern, t.Location); } else if (la.kind == 83) { lexer.NextToken(); -#line 1177 "cs.ATG" +#line 1181 "cs.ATG" m.Add(Modifier.Internal, t.Location); } else if (la.kind == 88) { lexer.NextToken(); -#line 1178 "cs.ATG" +#line 1182 "cs.ATG" m.Add(Modifier.New, t.Location); } else if (la.kind == 93) { lexer.NextToken(); -#line 1179 "cs.ATG" +#line 1183 "cs.ATG" m.Add(Modifier.Override, t.Location); } else if (la.kind == 95) { lexer.NextToken(); -#line 1180 "cs.ATG" +#line 1184 "cs.ATG" m.Add(Modifier.Private, t.Location); } else if (la.kind == 96) { lexer.NextToken(); -#line 1181 "cs.ATG" +#line 1185 "cs.ATG" m.Add(Modifier.Protected, t.Location); } else if (la.kind == 97) { lexer.NextToken(); -#line 1182 "cs.ATG" +#line 1186 "cs.ATG" m.Add(Modifier.Public, t.Location); } else if (la.kind == 98) { lexer.NextToken(); -#line 1183 "cs.ATG" +#line 1187 "cs.ATG" m.Add(Modifier.ReadOnly, t.Location); } else if (la.kind == 102) { lexer.NextToken(); -#line 1184 "cs.ATG" +#line 1188 "cs.ATG" m.Add(Modifier.Sealed, t.Location); } else if (la.kind == 106) { lexer.NextToken(); -#line 1185 "cs.ATG" +#line 1189 "cs.ATG" m.Add(Modifier.Static, t.Location); } else if (la.kind == 118) { lexer.NextToken(); -#line 1186 "cs.ATG" +#line 1190 "cs.ATG" m.Add(Modifier.Unsafe, t.Location); } else if (la.kind == 121) { lexer.NextToken(); -#line 1187 "cs.ATG" +#line 1191 "cs.ATG" m.Add(Modifier.Virtual, t.Location); } else if (la.kind == 123) { lexer.NextToken(); -#line 1188 "cs.ATG" +#line 1192 "cs.ATG" m.Add(Modifier.Volatile, t.Location); } else { Expect(1); -#line 1190 "cs.ATG" +#line 1194 "cs.ATG" m.Add(Modifier.Partial, t.Location); } } } void ClassMemberDecl( -#line 1465 "cs.ATG" +#line 1469 "cs.ATG" Modifiers m, List attributes) { -#line 1466 "cs.ATG" +#line 1470 "cs.ATG" Statement stmt = null; if (StartOf(16)) { StructMemberDecl( -#line 1468 "cs.ATG" +#line 1472 "cs.ATG" m, attributes); } else if (la.kind == 27) { -#line 1469 "cs.ATG" +#line 1473 "cs.ATG" m.Check(Modifier.Destructors); Point startPos = t.Location; lexer.NextToken(); Expect(1); -#line 1470 "cs.ATG" +#line 1474 "cs.ATG" DestructorDeclaration d = new DestructorDeclaration(t.val, m.Modifier, attributes); d.Modifier = m.Modifier; d.StartLocation = m.GetDeclarationLocation(startPos); @@ -1926,17 +1930,17 @@ m, attributes); Expect(20); Expect(21); -#line 1474 "cs.ATG" +#line 1478 "cs.ATG" d.EndLocation = t.EndLocation; if (la.kind == 16) { Block( -#line 1474 "cs.ATG" +#line 1478 "cs.ATG" out stmt); } else if (la.kind == 11) { lexer.NextToken(); } else SynErr(137); -#line 1475 "cs.ATG" +#line 1479 "cs.ATG" d.Body = (BlockStatement)stmt; compilationUnit.AddChild(d); @@ -1944,10 +1948,10 @@ out stmt); } void StructMemberDecl( -#line 1195 "cs.ATG" +#line 1199 "cs.ATG" Modifiers m, List attributes) { -#line 1197 "cs.ATG" +#line 1201 "cs.ATG" string qualident = null; TypeReference type; Expression expr; @@ -1959,18 +1963,18 @@ Modifiers m, List attributes) { if (la.kind == 59) { -#line 1207 "cs.ATG" +#line 1211 "cs.ATG" m.Check(Modifier.Constants); lexer.NextToken(); -#line 1208 "cs.ATG" +#line 1212 "cs.ATG" Point startPos = t.Location; Type( -#line 1209 "cs.ATG" +#line 1213 "cs.ATG" out type); Expect(1); -#line 1209 "cs.ATG" +#line 1213 "cs.ATG" FieldDeclaration fd = new FieldDeclaration(attributes, type, m.Modifier | Modifier.Const); fd.StartLocation = m.GetDeclarationLocation(startPos); VariableDeclaration f = new VariableDeclaration(t.val); @@ -1978,72 +1982,72 @@ out type); Expect(3); Expr( -#line 1214 "cs.ATG" +#line 1218 "cs.ATG" out expr); -#line 1214 "cs.ATG" +#line 1218 "cs.ATG" f.Initializer = expr; while (la.kind == 14) { lexer.NextToken(); Expect(1); -#line 1215 "cs.ATG" +#line 1219 "cs.ATG" f = new VariableDeclaration(t.val); fd.Fields.Add(f); Expect(3); Expr( -#line 1218 "cs.ATG" +#line 1222 "cs.ATG" out expr); -#line 1218 "cs.ATG" +#line 1222 "cs.ATG" f.Initializer = expr; } Expect(11); -#line 1219 "cs.ATG" +#line 1223 "cs.ATG" fd.EndLocation = t.EndLocation; compilationUnit.AddChild(fd); } else if ( -#line 1223 "cs.ATG" +#line 1227 "cs.ATG" NotVoidPointer()) { -#line 1223 "cs.ATG" +#line 1227 "cs.ATG" m.Check(Modifier.PropertysEventsMethods); Expect(122); -#line 1224 "cs.ATG" +#line 1228 "cs.ATG" Point startPos = t.Location; if ( -#line 1225 "cs.ATG" +#line 1229 "cs.ATG" IsExplicitInterfaceImplementation()) { TypeName( -#line 1226 "cs.ATG" +#line 1230 "cs.ATG" out explicitInterface, false); -#line 1227 "cs.ATG" +#line 1231 "cs.ATG" if (la.kind != Tokens.Dot || Peek(1).kind != Tokens.This) { qualident = TypeReference.StripLastIdentifierFromType(ref explicitInterface); } } else if (la.kind == 1) { lexer.NextToken(); -#line 1230 "cs.ATG" +#line 1234 "cs.ATG" qualident = t.val; } else SynErr(139); if (la.kind == 23) { TypeParameterList( -#line 1233 "cs.ATG" +#line 1237 "cs.ATG" templates); } Expect(20); if (StartOf(10)) { FormalParameterList( -#line 1236 "cs.ATG" +#line 1240 "cs.ATG" p); } Expect(21); -#line 1237 "cs.ATG" +#line 1241 "cs.ATG" MethodDeclaration methodDeclaration = new MethodDeclaration(qualident, m.Modifier, new TypeReference("void"), @@ -2058,31 +2062,31 @@ p); compilationUnit.BlockStart(methodDeclaration); while ( -#line 1252 "cs.ATG" +#line 1256 "cs.ATG" IdentIsWhere()) { TypeParameterConstraintsClause( -#line 1252 "cs.ATG" +#line 1256 "cs.ATG" templates); } if (la.kind == 16) { Block( -#line 1254 "cs.ATG" +#line 1258 "cs.ATG" out stmt); } else if (la.kind == 11) { lexer.NextToken(); } else SynErr(140); -#line 1254 "cs.ATG" +#line 1258 "cs.ATG" compilationUnit.BlockEnd(); methodDeclaration.Body = (BlockStatement)stmt; } else if (la.kind == 68) { -#line 1258 "cs.ATG" +#line 1262 "cs.ATG" m.Check(Modifier.PropertysEventsMethods); lexer.NextToken(); -#line 1259 "cs.ATG" +#line 1263 "cs.ATG" EventDeclaration eventDecl = new EventDeclaration(null, null, m.Modifier, attributes, null); eventDecl.StartLocation = t.Location; compilationUnit.AddChild(eventDecl); @@ -2091,104 +2095,104 @@ out stmt); EventRemoveRegion removeBlock = null; Type( -#line 1266 "cs.ATG" +#line 1270 "cs.ATG" out type); -#line 1266 "cs.ATG" +#line 1270 "cs.ATG" eventDecl.TypeReference = type; if ( -#line 1267 "cs.ATG" +#line 1271 "cs.ATG" IsExplicitInterfaceImplementation()) { TypeName( -#line 1268 "cs.ATG" +#line 1272 "cs.ATG" out explicitInterface, false); -#line 1269 "cs.ATG" +#line 1273 "cs.ATG" qualident = TypeReference.StripLastIdentifierFromType(ref explicitInterface); -#line 1270 "cs.ATG" +#line 1274 "cs.ATG" eventDecl.InterfaceImplementations.Add(new InterfaceImplementation(explicitInterface, qualident)); } else if (la.kind == 1) { lexer.NextToken(); -#line 1272 "cs.ATG" +#line 1276 "cs.ATG" qualident = t.val; } else SynErr(141); -#line 1274 "cs.ATG" +#line 1278 "cs.ATG" eventDecl.Name = qualident; eventDecl.EndLocation = t.EndLocation; if (la.kind == 16) { lexer.NextToken(); -#line 1275 "cs.ATG" +#line 1279 "cs.ATG" eventDecl.BodyStart = t.Location; EventAccessorDecls( -#line 1276 "cs.ATG" +#line 1280 "cs.ATG" out addBlock, out removeBlock); Expect(17); -#line 1277 "cs.ATG" +#line 1281 "cs.ATG" eventDecl.BodyEnd = t.EndLocation; } if (la.kind == 11) { lexer.NextToken(); } -#line 1280 "cs.ATG" +#line 1284 "cs.ATG" compilationUnit.BlockEnd(); eventDecl.AddRegion = addBlock; eventDecl.RemoveRegion = removeBlock; } else if ( -#line 1286 "cs.ATG" +#line 1290 "cs.ATG" IdentAndLPar()) { -#line 1286 "cs.ATG" +#line 1290 "cs.ATG" m.Check(Modifier.Constructors | Modifier.StaticConstructors); Expect(1); -#line 1287 "cs.ATG" +#line 1291 "cs.ATG" string name = t.val; Point startPos = t.Location; Expect(20); if (StartOf(10)) { -#line 1287 "cs.ATG" +#line 1291 "cs.ATG" m.Check(Modifier.Constructors); FormalParameterList( -#line 1288 "cs.ATG" +#line 1292 "cs.ATG" p); } Expect(21); -#line 1290 "cs.ATG" +#line 1294 "cs.ATG" ConstructorInitializer init = null; if (la.kind == 9) { -#line 1291 "cs.ATG" +#line 1295 "cs.ATG" m.Check(Modifier.Constructors); ConstructorInitializer( -#line 1292 "cs.ATG" +#line 1296 "cs.ATG" out init); } -#line 1294 "cs.ATG" +#line 1298 "cs.ATG" ConstructorDeclaration cd = new ConstructorDeclaration(name, m.Modifier, p, init, attributes); cd.StartLocation = startPos; cd.EndLocation = t.EndLocation; if (la.kind == 16) { Block( -#line 1299 "cs.ATG" +#line 1303 "cs.ATG" out stmt); } else if (la.kind == 11) { lexer.NextToken(); } else SynErr(142); -#line 1299 "cs.ATG" +#line 1303 "cs.ATG" cd.Body = (BlockStatement)stmt; compilationUnit.AddChild(cd); } else if (la.kind == 69 || la.kind == 79) { -#line 1302 "cs.ATG" +#line 1306 "cs.ATG" m.Check(Modifier.Operators); if (m.isNone) Error("at least one modifier must be set"); bool isImplicit = true; @@ -2197,45 +2201,45 @@ out stmt); if (la.kind == 79) { lexer.NextToken(); -#line 1307 "cs.ATG" +#line 1311 "cs.ATG" startPos = t.Location; } else { lexer.NextToken(); -#line 1307 "cs.ATG" +#line 1311 "cs.ATG" isImplicit = false; startPos = t.Location; } Expect(91); Type( -#line 1308 "cs.ATG" +#line 1312 "cs.ATG" out type); -#line 1308 "cs.ATG" +#line 1312 "cs.ATG" TypeReference operatorType = type; Expect(20); Type( -#line 1309 "cs.ATG" +#line 1313 "cs.ATG" out type); Expect(1); -#line 1309 "cs.ATG" +#line 1313 "cs.ATG" string varName = t.val; Expect(21); -#line 1310 "cs.ATG" +#line 1314 "cs.ATG" Point endPos = t.Location; if (la.kind == 16) { Block( -#line 1311 "cs.ATG" +#line 1315 "cs.ATG" out stmt); } else if (la.kind == 11) { lexer.NextToken(); -#line 1311 "cs.ATG" +#line 1315 "cs.ATG" stmt = null; } else SynErr(143); -#line 1314 "cs.ATG" +#line 1318 "cs.ATG" List parameters = new List(); parameters.Add(new ParameterDeclarationExpression(type, varName)); OperatorDeclaration operatorDeclaration = new OperatorDeclaration(m.Modifier, @@ -2251,61 +2255,61 @@ out stmt); } else if (StartOf(17)) { TypeDecl( -#line 1330 "cs.ATG" +#line 1334 "cs.ATG" m, attributes); } else if (StartOf(9)) { Type( -#line 1332 "cs.ATG" +#line 1336 "cs.ATG" out type); -#line 1332 "cs.ATG" +#line 1336 "cs.ATG" Point startPos = t.Location; if (la.kind == 91) { -#line 1334 "cs.ATG" +#line 1338 "cs.ATG" OverloadableOperatorType op; m.Check(Modifier.Operators); if (m.isNone) Error("at least one modifier must be set"); lexer.NextToken(); OverloadableOperator( -#line 1338 "cs.ATG" +#line 1342 "cs.ATG" out op); -#line 1338 "cs.ATG" +#line 1342 "cs.ATG" TypeReference firstType, secondType = null; string secondName = null; Expect(20); Type( -#line 1339 "cs.ATG" +#line 1343 "cs.ATG" out firstType); Expect(1); -#line 1339 "cs.ATG" +#line 1343 "cs.ATG" string firstName = t.val; if (la.kind == 14) { lexer.NextToken(); Type( -#line 1340 "cs.ATG" +#line 1344 "cs.ATG" out secondType); Expect(1); -#line 1340 "cs.ATG" +#line 1344 "cs.ATG" secondName = t.val; } else if (la.kind == 21) { } else SynErr(144); -#line 1348 "cs.ATG" +#line 1352 "cs.ATG" Point endPos = t.Location; Expect(21); if (la.kind == 16) { Block( -#line 1349 "cs.ATG" +#line 1353 "cs.ATG" out stmt); } else if (la.kind == 11) { lexer.NextToken(); } else SynErr(145); -#line 1351 "cs.ATG" +#line 1355 "cs.ATG" List parameters = new List(); parameters.Add(new ParameterDeclarationExpression(firstType, firstName)); if (secondType != null) { @@ -2322,43 +2326,43 @@ out stmt); compilationUnit.AddChild(operatorDeclaration); } else if ( -#line 1368 "cs.ATG" +#line 1372 "cs.ATG" IsVarDecl()) { -#line 1368 "cs.ATG" +#line 1372 "cs.ATG" m.Check(Modifier.Fields); FieldDeclaration fd = new FieldDeclaration(attributes, type, m.Modifier); fd.StartLocation = m.GetDeclarationLocation(startPos); VariableDeclarator( -#line 1372 "cs.ATG" +#line 1376 "cs.ATG" variableDeclarators); while (la.kind == 14) { lexer.NextToken(); VariableDeclarator( -#line 1373 "cs.ATG" +#line 1377 "cs.ATG" variableDeclarators); } Expect(11); -#line 1374 "cs.ATG" +#line 1378 "cs.ATG" fd.EndLocation = t.EndLocation; fd.Fields = variableDeclarators; compilationUnit.AddChild(fd); } else if (la.kind == 110) { -#line 1377 "cs.ATG" +#line 1381 "cs.ATG" m.Check(Modifier.Indexers); lexer.NextToken(); Expect(18); FormalParameterList( -#line 1378 "cs.ATG" +#line 1382 "cs.ATG" p); Expect(19); -#line 1378 "cs.ATG" +#line 1382 "cs.ATG" Point endLocation = t.EndLocation; Expect(16); -#line 1379 "cs.ATG" +#line 1383 "cs.ATG" IndexerDeclaration indexer = new IndexerDeclaration(type, p, m.Modifier, attributes); indexer.StartLocation = startPos; indexer.EndLocation = endLocation; @@ -2367,58 +2371,58 @@ p); PropertySetRegion setRegion; AccessorDecls( -#line 1386 "cs.ATG" +#line 1390 "cs.ATG" out getRegion, out setRegion); Expect(17); -#line 1387 "cs.ATG" +#line 1391 "cs.ATG" indexer.BodyEnd = t.EndLocation; indexer.GetRegion = getRegion; indexer.SetRegion = setRegion; compilationUnit.AddChild(indexer); } else if ( -#line 1392 "cs.ATG" +#line 1396 "cs.ATG" la.kind == Tokens.Identifier) { if ( -#line 1393 "cs.ATG" +#line 1397 "cs.ATG" IsExplicitInterfaceImplementation()) { TypeName( -#line 1394 "cs.ATG" +#line 1398 "cs.ATG" out explicitInterface, false); -#line 1395 "cs.ATG" +#line 1399 "cs.ATG" if (la.kind != Tokens.Dot || Peek(1).kind != Tokens.This) { qualident = TypeReference.StripLastIdentifierFromType(ref explicitInterface); } } else if (la.kind == 1) { lexer.NextToken(); -#line 1398 "cs.ATG" +#line 1402 "cs.ATG" qualident = t.val; } else SynErr(146); -#line 1400 "cs.ATG" +#line 1404 "cs.ATG" Point qualIdentEndLocation = t.EndLocation; if (la.kind == 16 || la.kind == 20 || la.kind == 23) { if (la.kind == 20 || la.kind == 23) { -#line 1404 "cs.ATG" +#line 1408 "cs.ATG" m.Check(Modifier.PropertysEventsMethods); if (la.kind == 23) { TypeParameterList( -#line 1406 "cs.ATG" +#line 1410 "cs.ATG" templates); } Expect(20); if (StartOf(10)) { FormalParameterList( -#line 1407 "cs.ATG" +#line 1411 "cs.ATG" p); } Expect(21); -#line 1408 "cs.ATG" +#line 1412 "cs.ATG" MethodDeclaration methodDeclaration = new MethodDeclaration(qualident, m.Modifier, type, @@ -2432,26 +2436,26 @@ p); compilationUnit.AddChild(methodDeclaration); while ( -#line 1420 "cs.ATG" +#line 1424 "cs.ATG" IdentIsWhere()) { TypeParameterConstraintsClause( -#line 1420 "cs.ATG" +#line 1424 "cs.ATG" templates); } if (la.kind == 16) { Block( -#line 1421 "cs.ATG" +#line 1425 "cs.ATG" out stmt); } else if (la.kind == 11) { lexer.NextToken(); } else SynErr(147); -#line 1421 "cs.ATG" +#line 1425 "cs.ATG" methodDeclaration.Body = (BlockStatement)stmt; } else { lexer.NextToken(); -#line 1424 "cs.ATG" +#line 1428 "cs.ATG" PropertyDeclaration pDecl = new PropertyDeclaration(qualident, type, m.Modifier, attributes); if (explicitInterface != null) pDecl.InterfaceImplementations.Add(new InterfaceImplementation(explicitInterface, qualident)); @@ -2462,11 +2466,11 @@ out stmt); PropertySetRegion setRegion; AccessorDecls( -#line 1433 "cs.ATG" +#line 1437 "cs.ATG" out getRegion, out setRegion); Expect(17); -#line 1435 "cs.ATG" +#line 1439 "cs.ATG" pDecl.GetRegion = getRegion; pDecl.SetRegion = setRegion; pDecl.BodyEnd = t.EndLocation; @@ -2475,17 +2479,17 @@ out getRegion, out setRegion); } } else if (la.kind == 15) { -#line 1443 "cs.ATG" +#line 1447 "cs.ATG" m.Check(Modifier.Indexers); lexer.NextToken(); Expect(110); Expect(18); FormalParameterList( -#line 1444 "cs.ATG" +#line 1448 "cs.ATG" p); Expect(19); -#line 1445 "cs.ATG" +#line 1449 "cs.ATG" IndexerDeclaration indexer = new IndexerDeclaration(type, p, m.Modifier, attributes); indexer.StartLocation = m.GetDeclarationLocation(startPos); indexer.EndLocation = t.EndLocation; @@ -2496,14 +2500,14 @@ p); Expect(16); -#line 1453 "cs.ATG" +#line 1457 "cs.ATG" Point bodyStart = t.Location; AccessorDecls( -#line 1454 "cs.ATG" +#line 1458 "cs.ATG" out getRegion, out setRegion); Expect(17); -#line 1455 "cs.ATG" +#line 1459 "cs.ATG" indexer.BodyStart = bodyStart; indexer.BodyEnd = t.EndLocation; indexer.GetRegion = getRegion; @@ -2517,7 +2521,7 @@ out getRegion, out setRegion); void InterfaceMemberDecl() { -#line 1482 "cs.ATG" +#line 1486 "cs.ATG" TypeReference type; AttributeSection section; @@ -2532,51 +2536,51 @@ out getRegion, out setRegion); while (la.kind == 18) { AttributeSection( -#line 1495 "cs.ATG" +#line 1499 "cs.ATG" out section); -#line 1495 "cs.ATG" +#line 1499 "cs.ATG" attributes.Add(section); } if (la.kind == 88) { lexer.NextToken(); -#line 1496 "cs.ATG" +#line 1500 "cs.ATG" mod = Modifier.New; startLocation = t.Location; } if ( -#line 1499 "cs.ATG" +#line 1503 "cs.ATG" NotVoidPointer()) { Expect(122); -#line 1499 "cs.ATG" +#line 1503 "cs.ATG" if (startLocation.X == -1) startLocation = t.Location; Expect(1); -#line 1499 "cs.ATG" +#line 1503 "cs.ATG" name = t.val; if (la.kind == 23) { TypeParameterList( -#line 1500 "cs.ATG" +#line 1504 "cs.ATG" templates); } Expect(20); if (StartOf(10)) { FormalParameterList( -#line 1501 "cs.ATG" +#line 1505 "cs.ATG" parameters); } Expect(21); while ( -#line 1502 "cs.ATG" +#line 1506 "cs.ATG" IdentIsWhere()) { TypeParameterConstraintsClause( -#line 1502 "cs.ATG" +#line 1506 "cs.ATG" templates); } Expect(11); -#line 1504 "cs.ATG" +#line 1508 "cs.ATG" MethodDeclaration md = new MethodDeclaration(name, mod, new TypeReference("void"), parameters, attributes); md.StartLocation = startLocation; md.EndLocation = t.EndLocation; @@ -2586,39 +2590,39 @@ templates); } else if (StartOf(18)) { if (StartOf(9)) { Type( -#line 1511 "cs.ATG" +#line 1515 "cs.ATG" out type); -#line 1511 "cs.ATG" +#line 1515 "cs.ATG" if (startLocation.X == -1) startLocation = t.Location; if (la.kind == 1) { lexer.NextToken(); -#line 1513 "cs.ATG" +#line 1517 "cs.ATG" name = t.val; Point qualIdentEndLocation = t.EndLocation; if (la.kind == 20 || la.kind == 23) { if (la.kind == 23) { TypeParameterList( -#line 1517 "cs.ATG" +#line 1521 "cs.ATG" templates); } Expect(20); if (StartOf(10)) { FormalParameterList( -#line 1518 "cs.ATG" +#line 1522 "cs.ATG" parameters); } Expect(21); while ( -#line 1520 "cs.ATG" +#line 1524 "cs.ATG" IdentIsWhere()) { TypeParameterConstraintsClause( -#line 1520 "cs.ATG" +#line 1524 "cs.ATG" templates); } Expect(11); -#line 1521 "cs.ATG" +#line 1525 "cs.ATG" MethodDeclaration md = new MethodDeclaration(name, mod, type, parameters, attributes); md.StartLocation = startLocation; md.EndLocation = t.EndLocation; @@ -2627,72 +2631,72 @@ templates); } else if (la.kind == 16) { -#line 1528 "cs.ATG" +#line 1532 "cs.ATG" PropertyDeclaration pd = new PropertyDeclaration(name, type, mod, attributes); compilationUnit.AddChild(pd); lexer.NextToken(); -#line 1529 "cs.ATG" +#line 1533 "cs.ATG" Point bodyStart = t.Location; InterfaceAccessors( -#line 1529 "cs.ATG" +#line 1533 "cs.ATG" out getBlock, out setBlock); Expect(17); -#line 1529 "cs.ATG" +#line 1533 "cs.ATG" pd.GetRegion = getBlock; pd.SetRegion = setBlock; pd.StartLocation = startLocation; pd.EndLocation = qualIdentEndLocation; pd.BodyStart = bodyStart; pd.BodyEnd = t.EndLocation; } else SynErr(151); } else if (la.kind == 110) { lexer.NextToken(); Expect(18); FormalParameterList( -#line 1532 "cs.ATG" +#line 1536 "cs.ATG" parameters); Expect(19); -#line 1532 "cs.ATG" +#line 1536 "cs.ATG" Point bracketEndLocation = t.EndLocation; -#line 1532 "cs.ATG" +#line 1536 "cs.ATG" IndexerDeclaration id = new IndexerDeclaration(type, parameters, mod, attributes); compilationUnit.AddChild(id); Expect(16); -#line 1533 "cs.ATG" +#line 1537 "cs.ATG" Point bodyStart = t.Location; InterfaceAccessors( -#line 1533 "cs.ATG" +#line 1537 "cs.ATG" out getBlock, out setBlock); Expect(17); -#line 1533 "cs.ATG" +#line 1537 "cs.ATG" id.GetRegion = getBlock; id.SetRegion = setBlock; id.StartLocation = startLocation; id.EndLocation = bracketEndLocation; id.BodyStart = bodyStart; id.BodyEnd = t.EndLocation; } else SynErr(152); } else { lexer.NextToken(); -#line 1536 "cs.ATG" +#line 1540 "cs.ATG" if (startLocation.X == -1) startLocation = t.Location; Type( -#line 1536 "cs.ATG" +#line 1540 "cs.ATG" out type); Expect(1); -#line 1536 "cs.ATG" +#line 1540 "cs.ATG" EventDeclaration ed = new EventDeclaration(type, t.val, mod, attributes, null); compilationUnit.AddChild(ed); Expect(11); -#line 1539 "cs.ATG" +#line 1543 "cs.ATG" ed.StartLocation = startLocation; ed.EndLocation = t.EndLocation; } } else SynErr(153); } void EnumMemberDecl( -#line 1544 "cs.ATG" +#line 1548 "cs.ATG" out FieldDeclaration f) { -#line 1546 "cs.ATG" +#line 1550 "cs.ATG" Expression expr = null; List attributes = new List(); AttributeSection section = null; @@ -2700,15 +2704,15 @@ out FieldDeclaration f) { while (la.kind == 18) { AttributeSection( -#line 1552 "cs.ATG" +#line 1556 "cs.ATG" out section); -#line 1552 "cs.ATG" +#line 1556 "cs.ATG" attributes.Add(section); } Expect(1); -#line 1553 "cs.ATG" +#line 1557 "cs.ATG" f = new FieldDeclaration(attributes); varDecl = new VariableDeclaration(t.val); f.Fields.Add(varDecl); @@ -2717,78 +2721,78 @@ out section); if (la.kind == 3) { lexer.NextToken(); Expr( -#line 1558 "cs.ATG" +#line 1562 "cs.ATG" out expr); -#line 1558 "cs.ATG" +#line 1562 "cs.ATG" varDecl.Initializer = expr; } } void TypeWithRestriction( -#line 1023 "cs.ATG" +#line 1027 "cs.ATG" out TypeReference type, bool allowNullable, bool canBeUnbound) { -#line 1025 "cs.ATG" +#line 1029 "cs.ATG" string name; int pointer = 0; type = null; if (la.kind == 1 || la.kind == 90 || la.kind == 107) { ClassType( -#line 1030 "cs.ATG" +#line 1034 "cs.ATG" out type, canBeUnbound); } else if (StartOf(4)) { SimpleType( -#line 1031 "cs.ATG" +#line 1035 "cs.ATG" out name); -#line 1031 "cs.ATG" +#line 1035 "cs.ATG" type = new TypeReference(name); } else if (la.kind == 122) { lexer.NextToken(); Expect(6); -#line 1032 "cs.ATG" +#line 1036 "cs.ATG" pointer = 1; type = new TypeReference("void"); } else SynErr(154); -#line 1033 "cs.ATG" +#line 1037 "cs.ATG" List r = new List(); if ( -#line 1035 "cs.ATG" +#line 1039 "cs.ATG" allowNullable && la.kind == Tokens.Question) { NullableQuestionMark( -#line 1035 "cs.ATG" +#line 1039 "cs.ATG" ref type); } while ( -#line 1037 "cs.ATG" +#line 1041 "cs.ATG" IsPointerOrDims()) { -#line 1037 "cs.ATG" +#line 1041 "cs.ATG" int i = 0; if (la.kind == 6) { lexer.NextToken(); -#line 1038 "cs.ATG" +#line 1042 "cs.ATG" ++pointer; } else if (la.kind == 18) { lexer.NextToken(); while (la.kind == 14) { lexer.NextToken(); -#line 1039 "cs.ATG" +#line 1043 "cs.ATG" ++i; } Expect(19); -#line 1039 "cs.ATG" +#line 1043 "cs.ATG" r.Add(i); } else SynErr(155); } -#line 1042 "cs.ATG" +#line 1046 "cs.ATG" if (type != null) { type.RankSpecifier = r.ToArray(); type.PointerNestingLevel = pointer; @@ -2797,57 +2801,57 @@ IsPointerOrDims()) { } void SimpleType( -#line 1070 "cs.ATG" +#line 1074 "cs.ATG" out string name) { -#line 1071 "cs.ATG" +#line 1075 "cs.ATG" name = String.Empty; if (StartOf(19)) { IntegralType( -#line 1073 "cs.ATG" +#line 1077 "cs.ATG" out name); } else if (la.kind == 74) { lexer.NextToken(); -#line 1074 "cs.ATG" +#line 1078 "cs.ATG" name = "float"; } else if (la.kind == 65) { lexer.NextToken(); -#line 1075 "cs.ATG" +#line 1079 "cs.ATG" name = "double"; } else if (la.kind == 61) { lexer.NextToken(); -#line 1076 "cs.ATG" +#line 1080 "cs.ATG" name = "decimal"; } else if (la.kind == 51) { lexer.NextToken(); -#line 1077 "cs.ATG" +#line 1081 "cs.ATG" name = "bool"; } else SynErr(156); } void NullableQuestionMark( -#line 2463 "cs.ATG" +#line 2467 "cs.ATG" ref TypeReference typeRef) { -#line 2464 "cs.ATG" +#line 2468 "cs.ATG" List typeArguments = new List(1); Expect(12); -#line 2468 "cs.ATG" +#line 2472 "cs.ATG" if (typeRef != null) typeArguments.Add(typeRef); typeRef = new TypeReference("System.Nullable", typeArguments); } void FixedParameter( -#line 1107 "cs.ATG" +#line 1111 "cs.ATG" out ParameterDeclarationExpression p) { -#line 1109 "cs.ATG" +#line 1113 "cs.ATG" TypeReference type; ParamModifier mod = ParamModifier.In; System.Drawing.Point start = t.Location; @@ -2856,82 +2860,82 @@ out ParameterDeclarationExpression p) { if (la.kind == 99) { lexer.NextToken(); -#line 1115 "cs.ATG" +#line 1119 "cs.ATG" mod = ParamModifier.Ref; } else { lexer.NextToken(); -#line 1116 "cs.ATG" +#line 1120 "cs.ATG" mod = ParamModifier.Out; } } Type( -#line 1118 "cs.ATG" +#line 1122 "cs.ATG" out type); Expect(1); -#line 1118 "cs.ATG" +#line 1122 "cs.ATG" p = new ParameterDeclarationExpression(type, t.val, mod); p.StartLocation = start; p.EndLocation = t.Location; } void ParameterArray( -#line 1121 "cs.ATG" +#line 1125 "cs.ATG" out ParameterDeclarationExpression p) { -#line 1122 "cs.ATG" +#line 1126 "cs.ATG" TypeReference type; Expect(94); Type( -#line 1124 "cs.ATG" +#line 1128 "cs.ATG" out type); Expect(1); -#line 1124 "cs.ATG" +#line 1128 "cs.ATG" p = new ParameterDeclarationExpression(type, t.val, ParamModifier.Params); } void AccessorModifiers( -#line 1127 "cs.ATG" +#line 1131 "cs.ATG" out Modifiers m) { -#line 1128 "cs.ATG" +#line 1132 "cs.ATG" m = new Modifiers(); if (la.kind == 95) { lexer.NextToken(); -#line 1130 "cs.ATG" +#line 1134 "cs.ATG" m.Add(Modifier.Private, t.Location); } else if (la.kind == 96) { lexer.NextToken(); -#line 1131 "cs.ATG" +#line 1135 "cs.ATG" m.Add(Modifier.Protected, t.Location); if (la.kind == 83) { lexer.NextToken(); -#line 1132 "cs.ATG" +#line 1136 "cs.ATG" m.Add(Modifier.Internal, t.Location); } } else if (la.kind == 83) { lexer.NextToken(); -#line 1133 "cs.ATG" +#line 1137 "cs.ATG" m.Add(Modifier.Internal, t.Location); if (la.kind == 96) { lexer.NextToken(); -#line 1134 "cs.ATG" +#line 1138 "cs.ATG" m.Add(Modifier.Protected, t.Location); } } else SynErr(157); } void Block( -#line 1683 "cs.ATG" +#line 1687 "cs.ATG" out Statement stmt) { Expect(16); -#line 1685 "cs.ATG" +#line 1689 "cs.ATG" BlockStatement blockStmt = new BlockStatement(); blockStmt.StartLocation = t.EndLocation; compilationUnit.BlockStart(blockStmt); @@ -2942,7 +2946,7 @@ out Statement stmt) { } Expect(17); -#line 1692 "cs.ATG" +#line 1696 "cs.ATG" stmt = blockStmt; blockStmt.EndLocation = t.EndLocation; compilationUnit.BlockEnd(); @@ -2950,10 +2954,10 @@ out Statement stmt) { } void EventAccessorDecls( -#line 1618 "cs.ATG" +#line 1622 "cs.ATG" out EventAddRegion addBlock, out EventRemoveRegion removeBlock) { -#line 1619 "cs.ATG" +#line 1623 "cs.ATG" AttributeSection section; List attributes = new List(); Statement stmt; @@ -2962,102 +2966,102 @@ out EventAddRegion addBlock, out EventRemoveRegion removeBlock) { while (la.kind == 18) { AttributeSection( -#line 1626 "cs.ATG" +#line 1630 "cs.ATG" out section); -#line 1626 "cs.ATG" +#line 1630 "cs.ATG" attributes.Add(section); } if ( -#line 1628 "cs.ATG" +#line 1632 "cs.ATG" IdentIsAdd()) { -#line 1628 "cs.ATG" +#line 1632 "cs.ATG" addBlock = new EventAddRegion(attributes); AddAccessorDecl( -#line 1629 "cs.ATG" +#line 1633 "cs.ATG" out stmt); -#line 1629 "cs.ATG" +#line 1633 "cs.ATG" attributes = new List(); addBlock.Block = (BlockStatement)stmt; while (la.kind == 18) { AttributeSection( -#line 1630 "cs.ATG" +#line 1634 "cs.ATG" out section); -#line 1630 "cs.ATG" +#line 1634 "cs.ATG" attributes.Add(section); } RemoveAccessorDecl( -#line 1631 "cs.ATG" +#line 1635 "cs.ATG" out stmt); -#line 1631 "cs.ATG" +#line 1635 "cs.ATG" removeBlock = new EventRemoveRegion(attributes); removeBlock.Block = (BlockStatement)stmt; } else if ( -#line 1632 "cs.ATG" +#line 1636 "cs.ATG" IdentIsRemove()) { RemoveAccessorDecl( -#line 1633 "cs.ATG" +#line 1637 "cs.ATG" out stmt); -#line 1633 "cs.ATG" +#line 1637 "cs.ATG" removeBlock = new EventRemoveRegion(attributes); removeBlock.Block = (BlockStatement)stmt; attributes = new List(); while (la.kind == 18) { AttributeSection( -#line 1634 "cs.ATG" +#line 1638 "cs.ATG" out section); -#line 1634 "cs.ATG" +#line 1638 "cs.ATG" attributes.Add(section); } AddAccessorDecl( -#line 1635 "cs.ATG" +#line 1639 "cs.ATG" out stmt); -#line 1635 "cs.ATG" +#line 1639 "cs.ATG" addBlock = new EventAddRegion(attributes); addBlock.Block = (BlockStatement)stmt; } else if (la.kind == 1) { lexer.NextToken(); -#line 1636 "cs.ATG" +#line 1640 "cs.ATG" Error("add or remove accessor declaration expected"); } else SynErr(158); } void ConstructorInitializer( -#line 1714 "cs.ATG" +#line 1718 "cs.ATG" out ConstructorInitializer ci) { -#line 1715 "cs.ATG" +#line 1719 "cs.ATG" Expression expr; ci = new ConstructorInitializer(); Expect(9); if (la.kind == 50) { lexer.NextToken(); -#line 1719 "cs.ATG" +#line 1723 "cs.ATG" ci.ConstructorInitializerType = ConstructorInitializerType.Base; } else if (la.kind == 110) { lexer.NextToken(); -#line 1720 "cs.ATG" +#line 1724 "cs.ATG" ci.ConstructorInitializerType = ConstructorInitializerType.This; } else SynErr(159); Expect(20); if (StartOf(21)) { Argument( -#line 1723 "cs.ATG" +#line 1727 "cs.ATG" out expr); -#line 1723 "cs.ATG" +#line 1727 "cs.ATG" if (expr != null) { ci.Arguments.Add(expr); } while (la.kind == 14) { lexer.NextToken(); Argument( -#line 1723 "cs.ATG" +#line 1727 "cs.ATG" out expr); -#line 1723 "cs.ATG" +#line 1727 "cs.ATG" if (expr != null) { ci.Arguments.Add(expr); } } } @@ -3065,161 +3069,161 @@ out expr); } void OverloadableOperator( -#line 1737 "cs.ATG" +#line 1741 "cs.ATG" out OverloadableOperatorType op) { -#line 1738 "cs.ATG" +#line 1742 "cs.ATG" op = OverloadableOperatorType.None; switch (la.kind) { case 4: { lexer.NextToken(); -#line 1740 "cs.ATG" +#line 1744 "cs.ATG" op = OverloadableOperatorType.Add; break; } case 5: { lexer.NextToken(); -#line 1741 "cs.ATG" +#line 1745 "cs.ATG" op = OverloadableOperatorType.Subtract; break; } case 24: { lexer.NextToken(); -#line 1743 "cs.ATG" +#line 1747 "cs.ATG" op = OverloadableOperatorType.Not; break; } case 27: { lexer.NextToken(); -#line 1744 "cs.ATG" +#line 1748 "cs.ATG" op = OverloadableOperatorType.BitNot; break; } case 31: { lexer.NextToken(); -#line 1746 "cs.ATG" +#line 1750 "cs.ATG" op = OverloadableOperatorType.Increment; break; } case 32: { lexer.NextToken(); -#line 1747 "cs.ATG" +#line 1751 "cs.ATG" op = OverloadableOperatorType.Decrement; break; } case 112: { lexer.NextToken(); -#line 1749 "cs.ATG" +#line 1753 "cs.ATG" op = OverloadableOperatorType.True; break; } case 71: { lexer.NextToken(); -#line 1750 "cs.ATG" +#line 1754 "cs.ATG" op = OverloadableOperatorType.False; break; } case 6: { lexer.NextToken(); -#line 1752 "cs.ATG" +#line 1756 "cs.ATG" op = OverloadableOperatorType.Multiply; break; } case 7: { lexer.NextToken(); -#line 1753 "cs.ATG" +#line 1757 "cs.ATG" op = OverloadableOperatorType.Divide; break; } case 8: { lexer.NextToken(); -#line 1754 "cs.ATG" +#line 1758 "cs.ATG" op = OverloadableOperatorType.Modulus; break; } case 28: { lexer.NextToken(); -#line 1756 "cs.ATG" +#line 1760 "cs.ATG" op = OverloadableOperatorType.BitwiseAnd; break; } case 29: { lexer.NextToken(); -#line 1757 "cs.ATG" +#line 1761 "cs.ATG" op = OverloadableOperatorType.BitwiseOr; break; } case 30: { lexer.NextToken(); -#line 1758 "cs.ATG" +#line 1762 "cs.ATG" op = OverloadableOperatorType.ExclusiveOr; break; } case 37: { lexer.NextToken(); -#line 1760 "cs.ATG" +#line 1764 "cs.ATG" op = OverloadableOperatorType.ShiftLeft; break; } case 33: { lexer.NextToken(); -#line 1761 "cs.ATG" +#line 1765 "cs.ATG" op = OverloadableOperatorType.Equality; break; } case 34: { lexer.NextToken(); -#line 1762 "cs.ATG" +#line 1766 "cs.ATG" op = OverloadableOperatorType.InEquality; break; } case 23: { lexer.NextToken(); -#line 1763 "cs.ATG" +#line 1767 "cs.ATG" op = OverloadableOperatorType.LessThan; break; } case 35: { lexer.NextToken(); -#line 1764 "cs.ATG" +#line 1768 "cs.ATG" op = OverloadableOperatorType.GreaterThanOrEqual; break; } case 36: { lexer.NextToken(); -#line 1765 "cs.ATG" +#line 1769 "cs.ATG" op = OverloadableOperatorType.LessThanOrEqual; break; } case 22: { lexer.NextToken(); -#line 1766 "cs.ATG" +#line 1770 "cs.ATG" op = OverloadableOperatorType.GreaterThan; if (la.kind == 22) { lexer.NextToken(); -#line 1766 "cs.ATG" +#line 1770 "cs.ATG" op = OverloadableOperatorType.ShiftRight; } break; @@ -3229,34 +3233,34 @@ out OverloadableOperatorType op) { } void VariableDeclarator( -#line 1676 "cs.ATG" +#line 1680 "cs.ATG" List fieldDeclaration) { -#line 1677 "cs.ATG" +#line 1681 "cs.ATG" Expression expr = null; Expect(1); -#line 1679 "cs.ATG" +#line 1683 "cs.ATG" VariableDeclaration f = new VariableDeclaration(t.val); if (la.kind == 3) { lexer.NextToken(); VariableInitializer( -#line 1680 "cs.ATG" +#line 1684 "cs.ATG" out expr); -#line 1680 "cs.ATG" +#line 1684 "cs.ATG" f.Initializer = expr; } -#line 1680 "cs.ATG" +#line 1684 "cs.ATG" fieldDeclaration.Add(f); } void AccessorDecls( -#line 1562 "cs.ATG" +#line 1566 "cs.ATG" out PropertyGetRegion getBlock, out PropertySetRegion setBlock) { -#line 1564 "cs.ATG" +#line 1568 "cs.ATG" List attributes = new List(); AttributeSection section; getBlock = null; @@ -3265,96 +3269,96 @@ out PropertyGetRegion getBlock, out PropertySetRegion setBlock) { while (la.kind == 18) { AttributeSection( -#line 1571 "cs.ATG" +#line 1575 "cs.ATG" out section); -#line 1571 "cs.ATG" +#line 1575 "cs.ATG" attributes.Add(section); } if (la.kind == 83 || la.kind == 95 || la.kind == 96) { AccessorModifiers( -#line 1572 "cs.ATG" +#line 1576 "cs.ATG" out modifiers); } if ( -#line 1574 "cs.ATG" +#line 1578 "cs.ATG" IdentIsGet()) { GetAccessorDecl( -#line 1575 "cs.ATG" +#line 1579 "cs.ATG" out getBlock, attributes); -#line 1576 "cs.ATG" +#line 1580 "cs.ATG" if (modifiers != null) {getBlock.Modifier = modifiers.Modifier; } if (StartOf(22)) { -#line 1577 "cs.ATG" +#line 1581 "cs.ATG" attributes = new List(); modifiers = null; while (la.kind == 18) { AttributeSection( -#line 1578 "cs.ATG" +#line 1582 "cs.ATG" out section); -#line 1578 "cs.ATG" +#line 1582 "cs.ATG" attributes.Add(section); } if (la.kind == 83 || la.kind == 95 || la.kind == 96) { AccessorModifiers( -#line 1579 "cs.ATG" +#line 1583 "cs.ATG" out modifiers); } SetAccessorDecl( -#line 1580 "cs.ATG" +#line 1584 "cs.ATG" out setBlock, attributes); -#line 1581 "cs.ATG" +#line 1585 "cs.ATG" if (modifiers != null) {setBlock.Modifier = modifiers.Modifier; } } } else if ( -#line 1583 "cs.ATG" +#line 1587 "cs.ATG" IdentIsSet()) { SetAccessorDecl( -#line 1584 "cs.ATG" +#line 1588 "cs.ATG" out setBlock, attributes); -#line 1585 "cs.ATG" +#line 1589 "cs.ATG" if (modifiers != null) {setBlock.Modifier = modifiers.Modifier; } if (StartOf(22)) { -#line 1586 "cs.ATG" +#line 1590 "cs.ATG" attributes = new List(); modifiers = null; while (la.kind == 18) { AttributeSection( -#line 1587 "cs.ATG" +#line 1591 "cs.ATG" out section); -#line 1587 "cs.ATG" +#line 1591 "cs.ATG" attributes.Add(section); } if (la.kind == 83 || la.kind == 95 || la.kind == 96) { AccessorModifiers( -#line 1588 "cs.ATG" +#line 1592 "cs.ATG" out modifiers); } GetAccessorDecl( -#line 1589 "cs.ATG" +#line 1593 "cs.ATG" out getBlock, attributes); -#line 1590 "cs.ATG" +#line 1594 "cs.ATG" if (modifiers != null) {getBlock.Modifier = modifiers.Modifier; } } } else if (la.kind == 1) { lexer.NextToken(); -#line 1592 "cs.ATG" +#line 1596 "cs.ATG" Error("get or set accessor declaration expected"); } else SynErr(161); } void InterfaceAccessors( -#line 1640 "cs.ATG" +#line 1644 "cs.ATG" out PropertyGetRegion getBlock, out PropertySetRegion setBlock) { -#line 1642 "cs.ATG" +#line 1646 "cs.ATG" AttributeSection section; List attributes = new List(); getBlock = null; setBlock = null; @@ -3362,284 +3366,284 @@ out PropertyGetRegion getBlock, out PropertySetRegion setBlock) { while (la.kind == 18) { AttributeSection( -#line 1648 "cs.ATG" +#line 1652 "cs.ATG" out section); -#line 1648 "cs.ATG" +#line 1652 "cs.ATG" attributes.Add(section); } -#line 1649 "cs.ATG" +#line 1653 "cs.ATG" Point startLocation = la.Location; if ( -#line 1651 "cs.ATG" +#line 1655 "cs.ATG" IdentIsGet()) { Expect(1); -#line 1651 "cs.ATG" +#line 1655 "cs.ATG" getBlock = new PropertyGetRegion(null, attributes); } else if ( -#line 1652 "cs.ATG" +#line 1656 "cs.ATG" IdentIsSet()) { Expect(1); -#line 1652 "cs.ATG" +#line 1656 "cs.ATG" setBlock = new PropertySetRegion(null, attributes); } else if (la.kind == 1) { lexer.NextToken(); -#line 1653 "cs.ATG" +#line 1657 "cs.ATG" Error("set or get expected"); } else SynErr(162); Expect(11); -#line 1656 "cs.ATG" +#line 1660 "cs.ATG" if (getBlock != null) { getBlock.StartLocation = startLocation; getBlock.EndLocation = t.EndLocation; } if (setBlock != null) { setBlock.StartLocation = startLocation; setBlock.EndLocation = t.EndLocation; } attributes = new List(); if (la.kind == 1 || la.kind == 18) { while (la.kind == 18) { AttributeSection( -#line 1660 "cs.ATG" +#line 1664 "cs.ATG" out section); -#line 1660 "cs.ATG" +#line 1664 "cs.ATG" attributes.Add(section); } -#line 1661 "cs.ATG" +#line 1665 "cs.ATG" startLocation = la.Location; if ( -#line 1663 "cs.ATG" +#line 1667 "cs.ATG" IdentIsGet()) { Expect(1); -#line 1663 "cs.ATG" +#line 1667 "cs.ATG" if (getBlock != null) Error("get already declared"); else { getBlock = new PropertyGetRegion(null, attributes); lastBlock = getBlock; } } else if ( -#line 1666 "cs.ATG" +#line 1670 "cs.ATG" IdentIsSet()) { Expect(1); -#line 1666 "cs.ATG" +#line 1670 "cs.ATG" if (setBlock != null) Error("set already declared"); else { setBlock = new PropertySetRegion(null, attributes); lastBlock = setBlock; } } else if (la.kind == 1) { lexer.NextToken(); -#line 1669 "cs.ATG" +#line 1673 "cs.ATG" Error("set or get expected"); } else SynErr(163); Expect(11); -#line 1672 "cs.ATG" +#line 1676 "cs.ATG" if (lastBlock != null) { lastBlock.StartLocation = startLocation; lastBlock.EndLocation = t.EndLocation; } } } void GetAccessorDecl( -#line 1596 "cs.ATG" +#line 1600 "cs.ATG" out PropertyGetRegion getBlock, List attributes) { -#line 1597 "cs.ATG" +#line 1601 "cs.ATG" Statement stmt = null; Expect(1); -#line 1600 "cs.ATG" +#line 1604 "cs.ATG" if (t.val != "get") Error("get expected"); -#line 1601 "cs.ATG" +#line 1605 "cs.ATG" Point startLocation = t.Location; if (la.kind == 16) { Block( -#line 1602 "cs.ATG" +#line 1606 "cs.ATG" out stmt); } else if (la.kind == 11) { lexer.NextToken(); } else SynErr(164); -#line 1603 "cs.ATG" +#line 1607 "cs.ATG" getBlock = new PropertyGetRegion((BlockStatement)stmt, attributes); -#line 1604 "cs.ATG" +#line 1608 "cs.ATG" getBlock.StartLocation = startLocation; getBlock.EndLocation = t.EndLocation; } void SetAccessorDecl( -#line 1607 "cs.ATG" +#line 1611 "cs.ATG" out PropertySetRegion setBlock, List attributes) { -#line 1608 "cs.ATG" +#line 1612 "cs.ATG" Statement stmt = null; Expect(1); -#line 1611 "cs.ATG" +#line 1615 "cs.ATG" if (t.val != "set") Error("set expected"); -#line 1612 "cs.ATG" +#line 1616 "cs.ATG" Point startLocation = t.Location; if (la.kind == 16) { Block( -#line 1613 "cs.ATG" +#line 1617 "cs.ATG" out stmt); } else if (la.kind == 11) { lexer.NextToken(); } else SynErr(165); -#line 1614 "cs.ATG" +#line 1618 "cs.ATG" setBlock = new PropertySetRegion((BlockStatement)stmt, attributes); -#line 1615 "cs.ATG" +#line 1619 "cs.ATG" setBlock.StartLocation = startLocation; setBlock.EndLocation = t.EndLocation; } void AddAccessorDecl( -#line 1698 "cs.ATG" +#line 1702 "cs.ATG" out Statement stmt) { -#line 1699 "cs.ATG" +#line 1703 "cs.ATG" stmt = null; Expect(1); -#line 1702 "cs.ATG" +#line 1706 "cs.ATG" if (t.val != "add") Error("add expected"); Block( -#line 1703 "cs.ATG" +#line 1707 "cs.ATG" out stmt); } void RemoveAccessorDecl( -#line 1706 "cs.ATG" +#line 1710 "cs.ATG" out Statement stmt) { -#line 1707 "cs.ATG" +#line 1711 "cs.ATG" stmt = null; Expect(1); -#line 1710 "cs.ATG" +#line 1714 "cs.ATG" if (t.val != "remove") Error("remove expected"); Block( -#line 1711 "cs.ATG" +#line 1715 "cs.ATG" out stmt); } void VariableInitializer( -#line 1727 "cs.ATG" +#line 1731 "cs.ATG" out Expression initializerExpression) { -#line 1728 "cs.ATG" +#line 1732 "cs.ATG" TypeReference type = null; Expression expr = null; initializerExpression = null; if (StartOf(5)) { Expr( -#line 1730 "cs.ATG" +#line 1734 "cs.ATG" out initializerExpression); } else if (la.kind == 16) { ArrayInitializer( -#line 1731 "cs.ATG" +#line 1735 "cs.ATG" out initializerExpression); } else if (la.kind == 105) { lexer.NextToken(); Type( -#line 1732 "cs.ATG" +#line 1736 "cs.ATG" out type); Expect(18); Expr( -#line 1732 "cs.ATG" +#line 1736 "cs.ATG" out expr); Expect(19); -#line 1732 "cs.ATG" +#line 1736 "cs.ATG" initializerExpression = new StackAllocExpression(type, expr); } else if (la.kind == 62) { lexer.NextToken(); Expect(20); Type( -#line 1734 "cs.ATG" +#line 1738 "cs.ATG" out type); Expect(21); -#line 1734 "cs.ATG" +#line 1738 "cs.ATG" initializerExpression = new DefaultValueExpression(type); } else SynErr(166); } void Statement() { -#line 1846 "cs.ATG" +#line 1850 "cs.ATG" TypeReference type; Expression expr; Statement stmt = null; Point startPos = la.Location; if ( -#line 1854 "cs.ATG" +#line 1858 "cs.ATG" IsLabel()) { Expect(1); -#line 1854 "cs.ATG" +#line 1858 "cs.ATG" compilationUnit.AddChild(new LabelStatement(t.val)); Expect(9); Statement(); } else if (la.kind == 59) { lexer.NextToken(); Type( -#line 1857 "cs.ATG" +#line 1861 "cs.ATG" out type); -#line 1857 "cs.ATG" +#line 1861 "cs.ATG" LocalVariableDeclaration var = new LocalVariableDeclaration(type, Modifier.Const); string ident = null; var.StartLocation = t.Location; Expect(1); -#line 1858 "cs.ATG" +#line 1862 "cs.ATG" ident = t.val; Expect(3); Expr( -#line 1859 "cs.ATG" +#line 1863 "cs.ATG" out expr); -#line 1859 "cs.ATG" +#line 1863 "cs.ATG" var.Variables.Add(new VariableDeclaration(ident, expr)); while (la.kind == 14) { lexer.NextToken(); Expect(1); -#line 1860 "cs.ATG" +#line 1864 "cs.ATG" ident = t.val; Expect(3); Expr( -#line 1860 "cs.ATG" +#line 1864 "cs.ATG" out expr); -#line 1860 "cs.ATG" +#line 1864 "cs.ATG" var.Variables.Add(new VariableDeclaration(ident, expr)); } Expect(11); -#line 1861 "cs.ATG" +#line 1865 "cs.ATG" compilationUnit.AddChild(var); } else if ( -#line 1863 "cs.ATG" +#line 1867 "cs.ATG" IsLocalVarDecl()) { LocalVariableDecl( -#line 1863 "cs.ATG" +#line 1867 "cs.ATG" out stmt); Expect(11); -#line 1863 "cs.ATG" +#line 1867 "cs.ATG" compilationUnit.AddChild(stmt); } else if (StartOf(23)) { EmbeddedStatement( -#line 1864 "cs.ATG" +#line 1868 "cs.ATG" out stmt); -#line 1864 "cs.ATG" +#line 1868 "cs.ATG" compilationUnit.AddChild(stmt); } else SynErr(167); -#line 1870 "cs.ATG" +#line 1874 "cs.ATG" if (stmt != null) { stmt.StartLocation = startPos; stmt.EndLocation = t.EndLocation; @@ -3648,10 +3652,10 @@ out stmt); } void Argument( -#line 1769 "cs.ATG" +#line 1773 "cs.ATG" out Expression argumentexpr) { -#line 1771 "cs.ATG" +#line 1775 "cs.ATG" Expression expr; FieldDirection fd = FieldDirection.None; @@ -3659,48 +3663,48 @@ out Expression argumentexpr) { if (la.kind == 99) { lexer.NextToken(); -#line 1776 "cs.ATG" +#line 1780 "cs.ATG" fd = FieldDirection.Ref; } else { lexer.NextToken(); -#line 1777 "cs.ATG" +#line 1781 "cs.ATG" fd = FieldDirection.Out; } } Expr( -#line 1779 "cs.ATG" +#line 1783 "cs.ATG" out expr); -#line 1779 "cs.ATG" +#line 1783 "cs.ATG" argumentexpr = fd != FieldDirection.None ? argumentexpr = new DirectionExpression(fd, expr) : expr; } void ArrayInitializer( -#line 1799 "cs.ATG" +#line 1803 "cs.ATG" out Expression outExpr) { -#line 1801 "cs.ATG" +#line 1805 "cs.ATG" Expression expr = null; ArrayInitializerExpression initializer = new ArrayInitializerExpression(); Expect(16); if (StartOf(24)) { VariableInitializer( -#line 1806 "cs.ATG" +#line 1810 "cs.ATG" out expr); -#line 1807 "cs.ATG" +#line 1811 "cs.ATG" if (expr != null) { initializer.CreateExpressions.Add(expr); } while ( -#line 1808 "cs.ATG" +#line 1812 "cs.ATG" NotFinalComma()) { Expect(14); VariableInitializer( -#line 1809 "cs.ATG" +#line 1813 "cs.ATG" out expr); -#line 1810 "cs.ATG" +#line 1814 "cs.ATG" if (expr != null) { initializer.CreateExpressions.Add(expr); } } if (la.kind == 14) { @@ -3709,138 +3713,138 @@ out expr); } Expect(17); -#line 1814 "cs.ATG" +#line 1818 "cs.ATG" outExpr = initializer; } void AssignmentOperator( -#line 1782 "cs.ATG" +#line 1786 "cs.ATG" out AssignmentOperatorType op) { -#line 1783 "cs.ATG" +#line 1787 "cs.ATG" op = AssignmentOperatorType.None; if (la.kind == 3) { lexer.NextToken(); -#line 1785 "cs.ATG" +#line 1789 "cs.ATG" op = AssignmentOperatorType.Assign; } else if (la.kind == 38) { lexer.NextToken(); -#line 1786 "cs.ATG" +#line 1790 "cs.ATG" op = AssignmentOperatorType.Add; } else if (la.kind == 39) { lexer.NextToken(); -#line 1787 "cs.ATG" +#line 1791 "cs.ATG" op = AssignmentOperatorType.Subtract; } else if (la.kind == 40) { lexer.NextToken(); -#line 1788 "cs.ATG" +#line 1792 "cs.ATG" op = AssignmentOperatorType.Multiply; } else if (la.kind == 41) { lexer.NextToken(); -#line 1789 "cs.ATG" +#line 1793 "cs.ATG" op = AssignmentOperatorType.Divide; } else if (la.kind == 42) { lexer.NextToken(); -#line 1790 "cs.ATG" +#line 1794 "cs.ATG" op = AssignmentOperatorType.Modulus; } else if (la.kind == 43) { lexer.NextToken(); -#line 1791 "cs.ATG" +#line 1795 "cs.ATG" op = AssignmentOperatorType.BitwiseAnd; } else if (la.kind == 44) { lexer.NextToken(); -#line 1792 "cs.ATG" +#line 1796 "cs.ATG" op = AssignmentOperatorType.BitwiseOr; } else if (la.kind == 45) { lexer.NextToken(); -#line 1793 "cs.ATG" +#line 1797 "cs.ATG" op = AssignmentOperatorType.ExclusiveOr; } else if (la.kind == 46) { lexer.NextToken(); -#line 1794 "cs.ATG" +#line 1798 "cs.ATG" op = AssignmentOperatorType.ShiftLeft; } else if ( -#line 1795 "cs.ATG" +#line 1799 "cs.ATG" la.kind == Tokens.GreaterThan && Peek(1).kind == Tokens.GreaterEqual) { Expect(22); Expect(35); -#line 1796 "cs.ATG" +#line 1800 "cs.ATG" op = AssignmentOperatorType.ShiftRight; } else SynErr(168); } void LocalVariableDecl( -#line 1817 "cs.ATG" +#line 1821 "cs.ATG" out Statement stmt) { -#line 1819 "cs.ATG" +#line 1823 "cs.ATG" TypeReference type; VariableDeclaration var = null; LocalVariableDeclaration localVariableDeclaration; Type( -#line 1824 "cs.ATG" +#line 1828 "cs.ATG" out type); -#line 1824 "cs.ATG" +#line 1828 "cs.ATG" localVariableDeclaration = new LocalVariableDeclaration(type); localVariableDeclaration.StartLocation = t.Location; LocalVariableDeclarator( -#line 1825 "cs.ATG" +#line 1829 "cs.ATG" out var); -#line 1825 "cs.ATG" +#line 1829 "cs.ATG" localVariableDeclaration.Variables.Add(var); while (la.kind == 14) { lexer.NextToken(); LocalVariableDeclarator( -#line 1826 "cs.ATG" +#line 1830 "cs.ATG" out var); -#line 1826 "cs.ATG" +#line 1830 "cs.ATG" localVariableDeclaration.Variables.Add(var); } -#line 1827 "cs.ATG" +#line 1831 "cs.ATG" stmt = localVariableDeclaration; } void LocalVariableDeclarator( -#line 1830 "cs.ATG" +#line 1834 "cs.ATG" out VariableDeclaration var) { -#line 1831 "cs.ATG" +#line 1835 "cs.ATG" Expression expr = null; Expect(1); -#line 1834 "cs.ATG" +#line 1838 "cs.ATG" var = new VariableDeclaration(t.val); if (la.kind == 3) { lexer.NextToken(); VariableInitializer( -#line 1834 "cs.ATG" +#line 1838 "cs.ATG" out expr); -#line 1834 "cs.ATG" +#line 1838 "cs.ATG" var.Initializer = expr; } } void EmbeddedStatement( -#line 1877 "cs.ATG" +#line 1881 "cs.ATG" out Statement statement) { -#line 1879 "cs.ATG" +#line 1883 "cs.ATG" TypeReference type = null; Expression expr = null; Statement embeddedStatement = null; @@ -3848,57 +3852,57 @@ out Statement statement) { if (la.kind == 16) { Block( -#line 1885 "cs.ATG" +#line 1889 "cs.ATG" out statement); } else if (la.kind == 11) { lexer.NextToken(); -#line 1887 "cs.ATG" +#line 1891 "cs.ATG" statement = new EmptyStatement(); } else if ( -#line 1889 "cs.ATG" +#line 1893 "cs.ATG" UnCheckedAndLBrace()) { -#line 1889 "cs.ATG" +#line 1893 "cs.ATG" Statement block; bool isChecked = true; if (la.kind == 57) { lexer.NextToken(); } else if (la.kind == 117) { lexer.NextToken(); -#line 1890 "cs.ATG" +#line 1894 "cs.ATG" isChecked = false; } else SynErr(169); Block( -#line 1891 "cs.ATG" +#line 1895 "cs.ATG" out block); -#line 1891 "cs.ATG" +#line 1895 "cs.ATG" statement = isChecked ? (Statement)new CheckedStatement(block) : (Statement)new UncheckedStatement(block); } else if (la.kind == 78) { lexer.NextToken(); -#line 1893 "cs.ATG" +#line 1897 "cs.ATG" Statement elseStatement = null; Expect(20); Expr( -#line 1894 "cs.ATG" +#line 1898 "cs.ATG" out expr); Expect(21); EmbeddedStatement( -#line 1895 "cs.ATG" +#line 1899 "cs.ATG" out embeddedStatement); if (la.kind == 66) { lexer.NextToken(); EmbeddedStatement( -#line 1896 "cs.ATG" +#line 1900 "cs.ATG" out elseStatement); } -#line 1897 "cs.ATG" +#line 1901 "cs.ATG" statement = elseStatement != null ? new IfElseStatement(expr, embeddedStatement, elseStatement) : new IfElseStatement(expr, embeddedStatement); -#line 1898 "cs.ATG" +#line 1902 "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( @@ -3910,104 +3914,104 @@ out elseStatement); } else if (la.kind == 109) { lexer.NextToken(); -#line 1906 "cs.ATG" +#line 1910 "cs.ATG" List switchSections = new List(); SwitchSection switchSection; Expect(20); Expr( -#line 1907 "cs.ATG" +#line 1911 "cs.ATG" out expr); Expect(21); Expect(16); while (la.kind == 54 || la.kind == 62) { SwitchSection( -#line 1908 "cs.ATG" +#line 1912 "cs.ATG" out switchSection); -#line 1908 "cs.ATG" +#line 1912 "cs.ATG" switchSections.Add(switchSection); } Expect(17); -#line 1909 "cs.ATG" +#line 1913 "cs.ATG" statement = new SwitchStatement(expr, switchSections); } else if (la.kind == 124) { lexer.NextToken(); Expect(20); Expr( -#line 1911 "cs.ATG" +#line 1915 "cs.ATG" out expr); Expect(21); EmbeddedStatement( -#line 1913 "cs.ATG" +#line 1917 "cs.ATG" out embeddedStatement); -#line 1913 "cs.ATG" +#line 1917 "cs.ATG" statement = new DoLoopStatement(expr, embeddedStatement, ConditionType.While, ConditionPosition.Start); } else if (la.kind == 64) { lexer.NextToken(); EmbeddedStatement( -#line 1914 "cs.ATG" +#line 1918 "cs.ATG" out embeddedStatement); Expect(124); Expect(20); Expr( -#line 1915 "cs.ATG" +#line 1919 "cs.ATG" out expr); Expect(21); Expect(11); -#line 1915 "cs.ATG" +#line 1919 "cs.ATG" statement = new DoLoopStatement(expr, embeddedStatement, ConditionType.While, ConditionPosition.End); } else if (la.kind == 75) { lexer.NextToken(); -#line 1916 "cs.ATG" +#line 1920 "cs.ATG" List initializer = null; List iterator = null; Expect(20); if (StartOf(5)) { ForInitializer( -#line 1917 "cs.ATG" +#line 1921 "cs.ATG" out initializer); } Expect(11); if (StartOf(5)) { Expr( -#line 1918 "cs.ATG" +#line 1922 "cs.ATG" out expr); } Expect(11); if (StartOf(5)) { ForIterator( -#line 1919 "cs.ATG" +#line 1923 "cs.ATG" out iterator); } Expect(21); EmbeddedStatement( -#line 1920 "cs.ATG" +#line 1924 "cs.ATG" out embeddedStatement); -#line 1920 "cs.ATG" +#line 1924 "cs.ATG" statement = new ForStatement(initializer, expr, iterator, embeddedStatement); } else if (la.kind == 76) { lexer.NextToken(); Expect(20); Type( -#line 1921 "cs.ATG" +#line 1925 "cs.ATG" out type); Expect(1); -#line 1921 "cs.ATG" +#line 1925 "cs.ATG" string varName = t.val; Point start = t.Location; Expect(80); Expr( -#line 1922 "cs.ATG" +#line 1926 "cs.ATG" out expr); Expect(21); EmbeddedStatement( -#line 1923 "cs.ATG" +#line 1927 "cs.ATG" out embeddedStatement); -#line 1923 "cs.ATG" +#line 1927 "cs.ATG" statement = new ForeachStatement(type, varName , expr, embeddedStatement); statement.EndLocation = t.EndLocation; @@ -4015,34 +4019,34 @@ out embeddedStatement); lexer.NextToken(); Expect(11); -#line 1927 "cs.ATG" +#line 1931 "cs.ATG" statement = new BreakStatement(); } else if (la.kind == 60) { lexer.NextToken(); Expect(11); -#line 1928 "cs.ATG" +#line 1932 "cs.ATG" statement = new ContinueStatement(); } else if (la.kind == 77) { GotoStatement( -#line 1929 "cs.ATG" +#line 1933 "cs.ATG" out statement); } else if ( -#line 1930 "cs.ATG" +#line 1934 "cs.ATG" IsYieldStatement()) { Expect(1); if (la.kind == 100) { lexer.NextToken(); Expr( -#line 1930 "cs.ATG" +#line 1934 "cs.ATG" out expr); -#line 1930 "cs.ATG" +#line 1934 "cs.ATG" statement = new YieldStatement(new ReturnStatement(expr)); } else if (la.kind == 52) { lexer.NextToken(); -#line 1931 "cs.ATG" +#line 1935 "cs.ATG" statement = new YieldStatement(new BreakStatement()); } else SynErr(170); Expect(11); @@ -4050,488 +4054,488 @@ out expr); lexer.NextToken(); if (StartOf(5)) { Expr( -#line 1932 "cs.ATG" +#line 1936 "cs.ATG" out expr); } Expect(11); -#line 1932 "cs.ATG" +#line 1936 "cs.ATG" statement = new ReturnStatement(expr); } else if (la.kind == 111) { lexer.NextToken(); if (StartOf(5)) { Expr( -#line 1933 "cs.ATG" +#line 1937 "cs.ATG" out expr); } Expect(11); -#line 1933 "cs.ATG" +#line 1937 "cs.ATG" statement = new ThrowStatement(expr); } else if (StartOf(5)) { StatementExpr( -#line 1936 "cs.ATG" +#line 1940 "cs.ATG" out statement); Expect(11); } else if (la.kind == 113) { TryStatement( -#line 1938 "cs.ATG" +#line 1942 "cs.ATG" out statement); } else if (la.kind == 85) { lexer.NextToken(); Expect(20); Expr( -#line 1940 "cs.ATG" +#line 1944 "cs.ATG" out expr); Expect(21); EmbeddedStatement( -#line 1941 "cs.ATG" +#line 1945 "cs.ATG" out embeddedStatement); -#line 1941 "cs.ATG" +#line 1945 "cs.ATG" statement = new LockStatement(expr, embeddedStatement); } else if (la.kind == 120) { -#line 1943 "cs.ATG" +#line 1947 "cs.ATG" Statement resourceAcquisitionStmt = null; lexer.NextToken(); Expect(20); ResourceAcquisition( -#line 1945 "cs.ATG" +#line 1949 "cs.ATG" out resourceAcquisitionStmt); Expect(21); EmbeddedStatement( -#line 1946 "cs.ATG" +#line 1950 "cs.ATG" out embeddedStatement); -#line 1946 "cs.ATG" +#line 1950 "cs.ATG" statement = new UsingStatement(resourceAcquisitionStmt, embeddedStatement); } else if (la.kind == 118) { lexer.NextToken(); Block( -#line 1948 "cs.ATG" +#line 1952 "cs.ATG" out embeddedStatement); -#line 1948 "cs.ATG" +#line 1952 "cs.ATG" statement = new UnsafeStatement(embeddedStatement); } else if (la.kind == 73) { lexer.NextToken(); Expect(20); Type( -#line 1951 "cs.ATG" +#line 1955 "cs.ATG" out type); -#line 1951 "cs.ATG" +#line 1955 "cs.ATG" if (type.PointerNestingLevel == 0) Error("can only fix pointer types"); List pointerDeclarators = new List(1); Expect(1); -#line 1954 "cs.ATG" +#line 1958 "cs.ATG" string identifier = t.val; Expect(3); Expr( -#line 1955 "cs.ATG" +#line 1959 "cs.ATG" out expr); -#line 1955 "cs.ATG" +#line 1959 "cs.ATG" pointerDeclarators.Add(new VariableDeclaration(identifier, expr)); while (la.kind == 14) { lexer.NextToken(); Expect(1); -#line 1957 "cs.ATG" +#line 1961 "cs.ATG" identifier = t.val; Expect(3); Expr( -#line 1958 "cs.ATG" +#line 1962 "cs.ATG" out expr); -#line 1958 "cs.ATG" +#line 1962 "cs.ATG" pointerDeclarators.Add(new VariableDeclaration(identifier, expr)); } Expect(21); EmbeddedStatement( -#line 1960 "cs.ATG" +#line 1964 "cs.ATG" out embeddedStatement); -#line 1960 "cs.ATG" +#line 1964 "cs.ATG" statement = new FixedStatement(type, pointerDeclarators, embeddedStatement); } else SynErr(171); } void SwitchSection( -#line 1982 "cs.ATG" +#line 1986 "cs.ATG" out SwitchSection stmt) { -#line 1984 "cs.ATG" +#line 1988 "cs.ATG" SwitchSection switchSection = new SwitchSection(); CaseLabel label; SwitchLabel( -#line 1988 "cs.ATG" +#line 1992 "cs.ATG" out label); -#line 1988 "cs.ATG" +#line 1992 "cs.ATG" if (label != null) { switchSection.SwitchLabels.Add(label); } while (la.kind == 54 || la.kind == 62) { SwitchLabel( -#line 1990 "cs.ATG" +#line 1994 "cs.ATG" out label); -#line 1990 "cs.ATG" +#line 1994 "cs.ATG" if (label != null) { switchSection.SwitchLabels.Add(label); } } -#line 1992 "cs.ATG" +#line 1996 "cs.ATG" compilationUnit.BlockStart(switchSection); Statement(); while (StartOf(20)) { Statement(); } -#line 1995 "cs.ATG" +#line 1999 "cs.ATG" compilationUnit.BlockEnd(); stmt = switchSection; } void ForInitializer( -#line 1963 "cs.ATG" +#line 1967 "cs.ATG" out List initializer) { -#line 1965 "cs.ATG" +#line 1969 "cs.ATG" Statement stmt; initializer = new List(); if ( -#line 1969 "cs.ATG" +#line 1973 "cs.ATG" IsLocalVarDecl()) { LocalVariableDecl( -#line 1969 "cs.ATG" +#line 1973 "cs.ATG" out stmt); -#line 1969 "cs.ATG" +#line 1973 "cs.ATG" initializer.Add(stmt); } else if (StartOf(5)) { StatementExpr( -#line 1970 "cs.ATG" +#line 1974 "cs.ATG" out stmt); -#line 1970 "cs.ATG" +#line 1974 "cs.ATG" initializer.Add(stmt); while (la.kind == 14) { lexer.NextToken(); StatementExpr( -#line 1970 "cs.ATG" +#line 1974 "cs.ATG" out stmt); -#line 1970 "cs.ATG" +#line 1974 "cs.ATG" initializer.Add(stmt); } } else SynErr(172); } void ForIterator( -#line 1973 "cs.ATG" +#line 1977 "cs.ATG" out List iterator) { -#line 1975 "cs.ATG" +#line 1979 "cs.ATG" Statement stmt; iterator = new List(); StatementExpr( -#line 1979 "cs.ATG" +#line 1983 "cs.ATG" out stmt); -#line 1979 "cs.ATG" +#line 1983 "cs.ATG" iterator.Add(stmt); while (la.kind == 14) { lexer.NextToken(); StatementExpr( -#line 1979 "cs.ATG" +#line 1983 "cs.ATG" out stmt); -#line 1979 "cs.ATG" +#line 1983 "cs.ATG" iterator.Add(stmt); } } void GotoStatement( -#line 2050 "cs.ATG" +#line 2054 "cs.ATG" out Statement stmt) { -#line 2051 "cs.ATG" +#line 2055 "cs.ATG" Expression expr; stmt = null; Expect(77); if (la.kind == 1) { lexer.NextToken(); -#line 2055 "cs.ATG" +#line 2059 "cs.ATG" stmt = new GotoStatement(t.val); Expect(11); } else if (la.kind == 54) { lexer.NextToken(); Expr( -#line 2056 "cs.ATG" +#line 2060 "cs.ATG" out expr); Expect(11); -#line 2056 "cs.ATG" +#line 2060 "cs.ATG" stmt = new GotoCaseStatement(expr); } else if (la.kind == 62) { lexer.NextToken(); Expect(11); -#line 2057 "cs.ATG" +#line 2061 "cs.ATG" stmt = new GotoCaseStatement(null); } else SynErr(173); } void StatementExpr( -#line 2077 "cs.ATG" +#line 2081 "cs.ATG" out Statement stmt) { -#line 2078 "cs.ATG" +#line 2082 "cs.ATG" Expression expr; Expr( -#line 2080 "cs.ATG" +#line 2084 "cs.ATG" out expr); -#line 2083 "cs.ATG" +#line 2087 "cs.ATG" stmt = new StatementExpression(expr); } void TryStatement( -#line 2007 "cs.ATG" +#line 2011 "cs.ATG" out Statement tryStatement) { -#line 2009 "cs.ATG" +#line 2013 "cs.ATG" Statement blockStmt = null, finallyStmt = null; List catchClauses = null; Expect(113); Block( -#line 2013 "cs.ATG" +#line 2017 "cs.ATG" out blockStmt); if (la.kind == 55) { CatchClauses( -#line 2015 "cs.ATG" +#line 2019 "cs.ATG" out catchClauses); if (la.kind == 72) { lexer.NextToken(); Block( -#line 2015 "cs.ATG" +#line 2019 "cs.ATG" out finallyStmt); } } else if (la.kind == 72) { lexer.NextToken(); Block( -#line 2016 "cs.ATG" +#line 2020 "cs.ATG" out finallyStmt); } else SynErr(174); -#line 2019 "cs.ATG" +#line 2023 "cs.ATG" tryStatement = new TryCatchStatement(blockStmt, catchClauses, finallyStmt); } void ResourceAcquisition( -#line 2061 "cs.ATG" +#line 2065 "cs.ATG" out Statement stmt) { -#line 2063 "cs.ATG" +#line 2067 "cs.ATG" stmt = null; Expression expr; if ( -#line 2068 "cs.ATG" +#line 2072 "cs.ATG" IsLocalVarDecl()) { LocalVariableDecl( -#line 2068 "cs.ATG" +#line 2072 "cs.ATG" out stmt); } else if (StartOf(5)) { Expr( -#line 2069 "cs.ATG" +#line 2073 "cs.ATG" out expr); -#line 2073 "cs.ATG" +#line 2077 "cs.ATG" stmt = new StatementExpression(expr); } else SynErr(175); } void SwitchLabel( -#line 2000 "cs.ATG" +#line 2004 "cs.ATG" out CaseLabel label) { -#line 2001 "cs.ATG" +#line 2005 "cs.ATG" Expression expr = null; label = null; if (la.kind == 54) { lexer.NextToken(); Expr( -#line 2003 "cs.ATG" +#line 2007 "cs.ATG" out expr); Expect(9); -#line 2003 "cs.ATG" +#line 2007 "cs.ATG" label = new CaseLabel(expr); } else if (la.kind == 62) { lexer.NextToken(); Expect(9); -#line 2004 "cs.ATG" +#line 2008 "cs.ATG" label = new CaseLabel(); } else SynErr(176); } void CatchClauses( -#line 2024 "cs.ATG" +#line 2028 "cs.ATG" out List catchClauses) { -#line 2026 "cs.ATG" +#line 2030 "cs.ATG" catchClauses = new List(); Expect(55); -#line 2029 "cs.ATG" +#line 2033 "cs.ATG" string identifier; Statement stmt; TypeReference typeRef; if (la.kind == 16) { Block( -#line 2035 "cs.ATG" +#line 2039 "cs.ATG" out stmt); -#line 2035 "cs.ATG" +#line 2039 "cs.ATG" catchClauses.Add(new CatchClause(stmt)); } else if (la.kind == 20) { lexer.NextToken(); ClassType( -#line 2037 "cs.ATG" +#line 2041 "cs.ATG" out typeRef, false); -#line 2037 "cs.ATG" +#line 2041 "cs.ATG" identifier = null; if (la.kind == 1) { lexer.NextToken(); -#line 2038 "cs.ATG" +#line 2042 "cs.ATG" identifier = t.val; } Expect(21); Block( -#line 2039 "cs.ATG" +#line 2043 "cs.ATG" out stmt); -#line 2040 "cs.ATG" +#line 2044 "cs.ATG" catchClauses.Add(new CatchClause(typeRef, identifier, stmt)); while ( -#line 2041 "cs.ATG" +#line 2045 "cs.ATG" IsTypedCatch()) { Expect(55); Expect(20); ClassType( -#line 2041 "cs.ATG" +#line 2045 "cs.ATG" out typeRef, false); -#line 2041 "cs.ATG" +#line 2045 "cs.ATG" identifier = null; if (la.kind == 1) { lexer.NextToken(); -#line 2042 "cs.ATG" +#line 2046 "cs.ATG" identifier = t.val; } Expect(21); Block( -#line 2043 "cs.ATG" +#line 2047 "cs.ATG" out stmt); -#line 2044 "cs.ATG" +#line 2048 "cs.ATG" catchClauses.Add(new CatchClause(typeRef, identifier, stmt)); } if (la.kind == 55) { lexer.NextToken(); Block( -#line 2046 "cs.ATG" +#line 2050 "cs.ATG" out stmt); -#line 2046 "cs.ATG" +#line 2050 "cs.ATG" catchClauses.Add(new CatchClause(stmt)); } } else SynErr(177); } void UnaryExpr( -#line 2104 "cs.ATG" +#line 2108 "cs.ATG" out Expression uExpr) { -#line 2106 "cs.ATG" +#line 2110 "cs.ATG" TypeReference type = null; Expression expr; ArrayList expressions = new ArrayList(); uExpr = null; while (StartOf(25) || -#line 2128 "cs.ATG" +#line 2132 "cs.ATG" IsTypeCast()) { if (la.kind == 4) { lexer.NextToken(); -#line 2115 "cs.ATG" +#line 2119 "cs.ATG" expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Plus)); } else if (la.kind == 5) { lexer.NextToken(); -#line 2116 "cs.ATG" +#line 2120 "cs.ATG" expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Minus)); } else if (la.kind == 24) { lexer.NextToken(); -#line 2117 "cs.ATG" +#line 2121 "cs.ATG" expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Not)); } else if (la.kind == 27) { lexer.NextToken(); -#line 2118 "cs.ATG" +#line 2122 "cs.ATG" expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.BitNot)); } else if (la.kind == 6) { lexer.NextToken(); -#line 2119 "cs.ATG" +#line 2123 "cs.ATG" expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Star)); } else if (la.kind == 31) { lexer.NextToken(); -#line 2120 "cs.ATG" +#line 2124 "cs.ATG" expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Increment)); } else if (la.kind == 32) { lexer.NextToken(); -#line 2121 "cs.ATG" +#line 2125 "cs.ATG" expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Decrement)); } else if (la.kind == 28) { lexer.NextToken(); -#line 2122 "cs.ATG" +#line 2126 "cs.ATG" expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.BitWiseAnd)); } else { Expect(20); Type( -#line 2128 "cs.ATG" +#line 2132 "cs.ATG" out type); Expect(21); -#line 2128 "cs.ATG" +#line 2132 "cs.ATG" expressions.Add(new CastExpression(type)); } } PrimaryExpr( -#line 2132 "cs.ATG" +#line 2136 "cs.ATG" out expr); -#line 2132 "cs.ATG" +#line 2136 "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) { @@ -4549,33 +4553,33 @@ out expr); } void ConditionalOrExpr( -#line 2303 "cs.ATG" +#line 2307 "cs.ATG" ref Expression outExpr) { -#line 2304 "cs.ATG" +#line 2308 "cs.ATG" Expression expr; ConditionalAndExpr( -#line 2306 "cs.ATG" +#line 2310 "cs.ATG" ref outExpr); while (la.kind == 26) { lexer.NextToken(); UnaryExpr( -#line 2306 "cs.ATG" +#line 2310 "cs.ATG" out expr); ConditionalAndExpr( -#line 2306 "cs.ATG" +#line 2310 "cs.ATG" ref expr); -#line 2306 "cs.ATG" +#line 2310 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.LogicalOr, expr); } } void PrimaryExpr( -#line 2149 "cs.ATG" +#line 2153 "cs.ATG" out Expression pexpr) { -#line 2151 "cs.ATG" +#line 2155 "cs.ATG" TypeReference type = null; List typeList = null; bool isArrayCreation = false; @@ -4585,332 +4589,332 @@ out Expression pexpr) { if (la.kind == 112) { lexer.NextToken(); -#line 2159 "cs.ATG" +#line 2163 "cs.ATG" pexpr = new PrimitiveExpression(true, "true"); } else if (la.kind == 71) { lexer.NextToken(); -#line 2160 "cs.ATG" +#line 2164 "cs.ATG" pexpr = new PrimitiveExpression(false, "false"); } else if (la.kind == 89) { lexer.NextToken(); -#line 2161 "cs.ATG" +#line 2165 "cs.ATG" pexpr = new PrimitiveExpression(null, "null"); } else if (la.kind == 2) { lexer.NextToken(); -#line 2162 "cs.ATG" +#line 2166 "cs.ATG" pexpr = new PrimitiveExpression(t.literalValue, t.val); } else if ( -#line 2163 "cs.ATG" +#line 2167 "cs.ATG" la.kind == Tokens.Identifier && Peek(1).kind == Tokens.DoubleColon) { Expect(1); -#line 2164 "cs.ATG" +#line 2168 "cs.ATG" type = new TypeReference(t.val); Expect(10); -#line 2165 "cs.ATG" +#line 2169 "cs.ATG" pexpr = new TypeReferenceExpression(type); Expect(1); -#line 2166 "cs.ATG" +#line 2170 "cs.ATG" if (type.Type == "global") { type.IsGlobal = true; type.Type = (t.val ?? "?"); } else type.Type += "." + (t.val ?? "?"); } else if (la.kind == 1) { lexer.NextToken(); -#line 2168 "cs.ATG" +#line 2172 "cs.ATG" pexpr = new IdentifierExpression(t.val); } else if (la.kind == 20) { lexer.NextToken(); Expr( -#line 2170 "cs.ATG" +#line 2174 "cs.ATG" out expr); Expect(21); -#line 2170 "cs.ATG" +#line 2174 "cs.ATG" pexpr = new ParenthesizedExpression(expr); } else if (StartOf(26)) { -#line 2172 "cs.ATG" +#line 2176 "cs.ATG" string val = null; switch (la.kind) { case 51: { lexer.NextToken(); -#line 2174 "cs.ATG" +#line 2178 "cs.ATG" val = "bool"; break; } case 53: { lexer.NextToken(); -#line 2175 "cs.ATG" +#line 2179 "cs.ATG" val = "byte"; break; } case 56: { lexer.NextToken(); -#line 2176 "cs.ATG" +#line 2180 "cs.ATG" val = "char"; break; } case 61: { lexer.NextToken(); -#line 2177 "cs.ATG" +#line 2181 "cs.ATG" val = "decimal"; break; } case 65: { lexer.NextToken(); -#line 2178 "cs.ATG" +#line 2182 "cs.ATG" val = "double"; break; } case 74: { lexer.NextToken(); -#line 2179 "cs.ATG" +#line 2183 "cs.ATG" val = "float"; break; } case 81: { lexer.NextToken(); -#line 2180 "cs.ATG" +#line 2184 "cs.ATG" val = "int"; break; } case 86: { lexer.NextToken(); -#line 2181 "cs.ATG" +#line 2185 "cs.ATG" val = "long"; break; } case 90: { lexer.NextToken(); -#line 2182 "cs.ATG" +#line 2186 "cs.ATG" val = "object"; break; } case 101: { lexer.NextToken(); -#line 2183 "cs.ATG" +#line 2187 "cs.ATG" val = "sbyte"; break; } case 103: { lexer.NextToken(); -#line 2184 "cs.ATG" +#line 2188 "cs.ATG" val = "short"; break; } case 107: { lexer.NextToken(); -#line 2185 "cs.ATG" +#line 2189 "cs.ATG" val = "string"; break; } case 115: { lexer.NextToken(); -#line 2186 "cs.ATG" +#line 2190 "cs.ATG" val = "uint"; break; } case 116: { lexer.NextToken(); -#line 2187 "cs.ATG" +#line 2191 "cs.ATG" val = "ulong"; break; } case 119: { lexer.NextToken(); -#line 2188 "cs.ATG" +#line 2192 "cs.ATG" val = "ushort"; break; } } -#line 2189 "cs.ATG" +#line 2193 "cs.ATG" t.val = ""; Expect(15); Expect(1); -#line 2189 "cs.ATG" +#line 2193 "cs.ATG" pexpr = new FieldReferenceExpression(new TypeReferenceExpression(val), t.val); } else if (la.kind == 110) { lexer.NextToken(); -#line 2191 "cs.ATG" +#line 2195 "cs.ATG" pexpr = new ThisReferenceExpression(); } else if (la.kind == 50) { lexer.NextToken(); -#line 2193 "cs.ATG" +#line 2197 "cs.ATG" Expression retExpr = new BaseReferenceExpression(); if (la.kind == 15) { lexer.NextToken(); Expect(1); -#line 2195 "cs.ATG" +#line 2199 "cs.ATG" retExpr = new FieldReferenceExpression(retExpr, t.val); } else if (la.kind == 18) { lexer.NextToken(); Expr( -#line 2196 "cs.ATG" +#line 2200 "cs.ATG" out expr); -#line 2196 "cs.ATG" +#line 2200 "cs.ATG" List indices = new List(); if (expr != null) { indices.Add(expr); } while (la.kind == 14) { lexer.NextToken(); Expr( -#line 2197 "cs.ATG" +#line 2201 "cs.ATG" out expr); -#line 2197 "cs.ATG" +#line 2201 "cs.ATG" if (expr != null) { indices.Add(expr); } } Expect(19); -#line 2198 "cs.ATG" +#line 2202 "cs.ATG" retExpr = new IndexerExpression(retExpr, indices); } else SynErr(178); -#line 2199 "cs.ATG" +#line 2203 "cs.ATG" pexpr = retExpr; } else if (la.kind == 88) { lexer.NextToken(); NonArrayType( -#line 2200 "cs.ATG" +#line 2204 "cs.ATG" out type); -#line 2201 "cs.ATG" +#line 2205 "cs.ATG" List parameters = new List(); if (la.kind == 20) { lexer.NextToken(); -#line 2206 "cs.ATG" +#line 2210 "cs.ATG" ObjectCreateExpression oce = new ObjectCreateExpression(type, parameters); if (StartOf(21)) { Argument( -#line 2207 "cs.ATG" +#line 2211 "cs.ATG" out expr); -#line 2207 "cs.ATG" +#line 2211 "cs.ATG" if (expr != null) { parameters.Add(expr); } while (la.kind == 14) { lexer.NextToken(); Argument( -#line 2208 "cs.ATG" +#line 2212 "cs.ATG" out expr); -#line 2208 "cs.ATG" +#line 2212 "cs.ATG" if (expr != null) { parameters.Add(expr); } } } Expect(21); -#line 2210 "cs.ATG" +#line 2214 "cs.ATG" pexpr = oce; } else if (la.kind == 18) { lexer.NextToken(); -#line 2212 "cs.ATG" +#line 2216 "cs.ATG" isArrayCreation = true; ArrayCreateExpression ace = new ArrayCreateExpression(type); pexpr = ace; -#line 2213 "cs.ATG" +#line 2217 "cs.ATG" int dims = 0; List ranks = new List(); if (la.kind == 14 || la.kind == 19) { while (la.kind == 14) { lexer.NextToken(); -#line 2215 "cs.ATG" +#line 2219 "cs.ATG" dims += 1; } Expect(19); -#line 2216 "cs.ATG" +#line 2220 "cs.ATG" ranks.Add(dims); dims = 0; while (la.kind == 18) { lexer.NextToken(); while (la.kind == 14) { lexer.NextToken(); -#line 2217 "cs.ATG" +#line 2221 "cs.ATG" ++dims; } Expect(19); -#line 2217 "cs.ATG" +#line 2221 "cs.ATG" ranks.Add(dims); dims = 0; } -#line 2218 "cs.ATG" +#line 2222 "cs.ATG" ace.CreateType.RankSpecifier = ranks.ToArray(); ArrayInitializer( -#line 2219 "cs.ATG" +#line 2223 "cs.ATG" out expr); -#line 2219 "cs.ATG" +#line 2223 "cs.ATG" ace.ArrayInitializer = (ArrayInitializerExpression)expr; } else if (StartOf(5)) { Expr( -#line 2220 "cs.ATG" +#line 2224 "cs.ATG" out expr); -#line 2220 "cs.ATG" +#line 2224 "cs.ATG" if (expr != null) parameters.Add(expr); while (la.kind == 14) { lexer.NextToken(); -#line 2221 "cs.ATG" +#line 2225 "cs.ATG" dims += 1; Expr( -#line 2222 "cs.ATG" +#line 2226 "cs.ATG" out expr); -#line 2222 "cs.ATG" +#line 2226 "cs.ATG" if (expr != null) parameters.Add(expr); } Expect(19); -#line 2224 "cs.ATG" +#line 2228 "cs.ATG" ranks.Add(dims); ace.Arguments = parameters; dims = 0; while (la.kind == 18) { lexer.NextToken(); while (la.kind == 14) { lexer.NextToken(); -#line 2225 "cs.ATG" +#line 2229 "cs.ATG" ++dims; } Expect(19); -#line 2225 "cs.ATG" +#line 2229 "cs.ATG" ranks.Add(dims); dims = 0; } -#line 2226 "cs.ATG" +#line 2230 "cs.ATG" ace.CreateType.RankSpecifier = ranks.ToArray(); if (la.kind == 16) { ArrayInitializer( -#line 2227 "cs.ATG" +#line 2231 "cs.ATG" out expr); -#line 2227 "cs.ATG" +#line 2231 "cs.ATG" ace.ArrayInitializer = (ArrayInitializerExpression)expr; } } else SynErr(179); @@ -4919,204 +4923,204 @@ out expr); lexer.NextToken(); Expect(20); if ( -#line 2232 "cs.ATG" +#line 2236 "cs.ATG" NotVoidPointer()) { Expect(122); -#line 2232 "cs.ATG" +#line 2236 "cs.ATG" type = new TypeReference("void"); } else if (StartOf(9)) { TypeWithRestriction( -#line 2233 "cs.ATG" +#line 2237 "cs.ATG" out type, true, true); } else SynErr(181); Expect(21); -#line 2234 "cs.ATG" +#line 2238 "cs.ATG" pexpr = new TypeOfExpression(type); } else if ( -#line 2236 "cs.ATG" +#line 2240 "cs.ATG" la.kind == Tokens.Default && Peek(1).kind == Tokens.OpenParenthesis) { Expect(62); Expect(20); Type( -#line 2238 "cs.ATG" +#line 2242 "cs.ATG" out type); Expect(21); -#line 2238 "cs.ATG" +#line 2242 "cs.ATG" pexpr = new DefaultValueExpression(type); } else if (la.kind == 104) { lexer.NextToken(); Expect(20); Type( -#line 2239 "cs.ATG" +#line 2243 "cs.ATG" out type); Expect(21); -#line 2239 "cs.ATG" +#line 2243 "cs.ATG" pexpr = new SizeOfExpression(type); } else if (la.kind == 57) { lexer.NextToken(); Expect(20); Expr( -#line 2240 "cs.ATG" +#line 2244 "cs.ATG" out expr); Expect(21); -#line 2240 "cs.ATG" +#line 2244 "cs.ATG" pexpr = new CheckedExpression(expr); } else if (la.kind == 117) { lexer.NextToken(); Expect(20); Expr( -#line 2241 "cs.ATG" +#line 2245 "cs.ATG" out expr); Expect(21); -#line 2241 "cs.ATG" +#line 2245 "cs.ATG" pexpr = new UncheckedExpression(expr); } else if (la.kind == 63) { lexer.NextToken(); AnonymousMethodExpr( -#line 2242 "cs.ATG" +#line 2246 "cs.ATG" out expr); -#line 2242 "cs.ATG" +#line 2246 "cs.ATG" pexpr = expr; } else SynErr(182); while (StartOf(27) || -#line 2253 "cs.ATG" +#line 2257 "cs.ATG" IsGenericFollowedBy(Tokens.Dot) && IsTypeReferenceExpression(pexpr) || -#line 2262 "cs.ATG" +#line 2266 "cs.ATG" IsGenericFollowedBy(Tokens.OpenParenthesis)) { if (la.kind == 31 || la.kind == 32) { if (la.kind == 31) { lexer.NextToken(); -#line 2246 "cs.ATG" +#line 2250 "cs.ATG" pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostIncrement); } else if (la.kind == 32) { lexer.NextToken(); -#line 2247 "cs.ATG" +#line 2251 "cs.ATG" pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostDecrement); } else SynErr(183); } else if (la.kind == 47) { lexer.NextToken(); Expect(1); -#line 2250 "cs.ATG" +#line 2254 "cs.ATG" pexpr = new PointerReferenceExpression(pexpr, t.val); } else if (la.kind == 15) { lexer.NextToken(); Expect(1); -#line 2251 "cs.ATG" +#line 2255 "cs.ATG" pexpr = new FieldReferenceExpression(pexpr, t.val); } else if ( -#line 2253 "cs.ATG" +#line 2257 "cs.ATG" IsGenericFollowedBy(Tokens.Dot) && IsTypeReferenceExpression(pexpr)) { TypeArgumentList( -#line 2254 "cs.ATG" +#line 2258 "cs.ATG" out typeList, false); Expect(15); Expect(1); -#line 2256 "cs.ATG" +#line 2260 "cs.ATG" pexpr = new FieldReferenceExpression(GetTypeReferenceExpression(pexpr, typeList), t.val); } else if (la.kind == 20) { lexer.NextToken(); -#line 2258 "cs.ATG" +#line 2262 "cs.ATG" List parameters = new List(); if (StartOf(21)) { Argument( -#line 2259 "cs.ATG" +#line 2263 "cs.ATG" out expr); -#line 2259 "cs.ATG" +#line 2263 "cs.ATG" if (expr != null) {parameters.Add(expr);} while (la.kind == 14) { lexer.NextToken(); Argument( -#line 2260 "cs.ATG" +#line 2264 "cs.ATG" out expr); -#line 2260 "cs.ATG" +#line 2264 "cs.ATG" if (expr != null) {parameters.Add(expr);} } } Expect(21); -#line 2261 "cs.ATG" +#line 2265 "cs.ATG" pexpr = new InvocationExpression(pexpr, parameters); } else if ( -#line 2262 "cs.ATG" +#line 2266 "cs.ATG" IsGenericFollowedBy(Tokens.OpenParenthesis)) { TypeArgumentList( -#line 2262 "cs.ATG" +#line 2266 "cs.ATG" out typeList, false); Expect(20); -#line 2263 "cs.ATG" +#line 2267 "cs.ATG" List parameters = new List(); if (StartOf(21)) { Argument( -#line 2264 "cs.ATG" +#line 2268 "cs.ATG" out expr); -#line 2264 "cs.ATG" +#line 2268 "cs.ATG" if (expr != null) {parameters.Add(expr);} while (la.kind == 14) { lexer.NextToken(); Argument( -#line 2265 "cs.ATG" +#line 2269 "cs.ATG" out expr); -#line 2265 "cs.ATG" +#line 2269 "cs.ATG" if (expr != null) {parameters.Add(expr);} } } Expect(21); -#line 2266 "cs.ATG" +#line 2270 "cs.ATG" pexpr = new InvocationExpression(pexpr, parameters, typeList); } else { -#line 2268 "cs.ATG" +#line 2272 "cs.ATG" if (isArrayCreation) Error("element access not allow on array creation"); List indices = new List(); lexer.NextToken(); Expr( -#line 2271 "cs.ATG" +#line 2275 "cs.ATG" out expr); -#line 2271 "cs.ATG" +#line 2275 "cs.ATG" if (expr != null) { indices.Add(expr); } while (la.kind == 14) { lexer.NextToken(); Expr( -#line 2272 "cs.ATG" +#line 2276 "cs.ATG" out expr); -#line 2272 "cs.ATG" +#line 2276 "cs.ATG" if (expr != null) { indices.Add(expr); } } Expect(19); -#line 2273 "cs.ATG" +#line 2277 "cs.ATG" pexpr = new IndexerExpression(pexpr, indices); } } } void AnonymousMethodExpr( -#line 2277 "cs.ATG" +#line 2281 "cs.ATG" out Expression outExpr) { -#line 2279 "cs.ATG" +#line 2283 "cs.ATG" AnonymousMethodExpression expr = new AnonymousMethodExpression(); expr.StartLocation = t.Location; Statement stmt; @@ -5127,74 +5131,74 @@ out Expression outExpr) { lexer.NextToken(); if (StartOf(10)) { FormalParameterList( -#line 2288 "cs.ATG" +#line 2292 "cs.ATG" p); -#line 2288 "cs.ATG" +#line 2292 "cs.ATG" expr.Parameters = p; } Expect(21); } -#line 2293 "cs.ATG" +#line 2297 "cs.ATG" if (compilationUnit != null) { Block( -#line 2294 "cs.ATG" +#line 2298 "cs.ATG" out stmt); -#line 2294 "cs.ATG" +#line 2298 "cs.ATG" expr.Body = (BlockStatement)stmt; -#line 2295 "cs.ATG" +#line 2299 "cs.ATG" } else { Expect(16); -#line 2297 "cs.ATG" +#line 2301 "cs.ATG" lexer.SkipCurrentBlock(); Expect(17); -#line 2299 "cs.ATG" +#line 2303 "cs.ATG" } -#line 2300 "cs.ATG" +#line 2304 "cs.ATG" expr.EndLocation = t.Location; } void TypeArgumentList( -#line 2473 "cs.ATG" +#line 2477 "cs.ATG" out List types, bool canBeUnbound) { -#line 2475 "cs.ATG" +#line 2479 "cs.ATG" types = new List(); TypeReference type = null; Expect(23); if ( -#line 2480 "cs.ATG" +#line 2484 "cs.ATG" canBeUnbound && (la.kind == Tokens.GreaterThan || la.kind == Tokens.Comma)) { -#line 2481 "cs.ATG" +#line 2485 "cs.ATG" types.Add(TypeReference.Null); while (la.kind == 14) { lexer.NextToken(); -#line 2482 "cs.ATG" +#line 2486 "cs.ATG" types.Add(TypeReference.Null); } } else if (StartOf(9)) { Type( -#line 2483 "cs.ATG" +#line 2487 "cs.ATG" out type); -#line 2483 "cs.ATG" +#line 2487 "cs.ATG" types.Add(type); while (la.kind == 14) { lexer.NextToken(); Type( -#line 2484 "cs.ATG" +#line 2488 "cs.ATG" out type); -#line 2484 "cs.ATG" +#line 2488 "cs.ATG" types.Add(type); } } else SynErr(184); @@ -5202,206 +5206,206 @@ out type); } void ConditionalAndExpr( -#line 2309 "cs.ATG" +#line 2313 "cs.ATG" ref Expression outExpr) { -#line 2310 "cs.ATG" +#line 2314 "cs.ATG" Expression expr; InclusiveOrExpr( -#line 2312 "cs.ATG" +#line 2316 "cs.ATG" ref outExpr); while (la.kind == 25) { lexer.NextToken(); UnaryExpr( -#line 2312 "cs.ATG" +#line 2316 "cs.ATG" out expr); InclusiveOrExpr( -#line 2312 "cs.ATG" +#line 2316 "cs.ATG" ref expr); -#line 2312 "cs.ATG" +#line 2316 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.LogicalAnd, expr); } } void InclusiveOrExpr( -#line 2315 "cs.ATG" +#line 2319 "cs.ATG" ref Expression outExpr) { -#line 2316 "cs.ATG" +#line 2320 "cs.ATG" Expression expr; ExclusiveOrExpr( -#line 2318 "cs.ATG" +#line 2322 "cs.ATG" ref outExpr); while (la.kind == 29) { lexer.NextToken(); UnaryExpr( -#line 2318 "cs.ATG" +#line 2322 "cs.ATG" out expr); ExclusiveOrExpr( -#line 2318 "cs.ATG" +#line 2322 "cs.ATG" ref expr); -#line 2318 "cs.ATG" +#line 2322 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.BitwiseOr, expr); } } void ExclusiveOrExpr( -#line 2321 "cs.ATG" +#line 2325 "cs.ATG" ref Expression outExpr) { -#line 2322 "cs.ATG" +#line 2326 "cs.ATG" Expression expr; AndExpr( -#line 2324 "cs.ATG" +#line 2328 "cs.ATG" ref outExpr); while (la.kind == 30) { lexer.NextToken(); UnaryExpr( -#line 2324 "cs.ATG" +#line 2328 "cs.ATG" out expr); AndExpr( -#line 2324 "cs.ATG" +#line 2328 "cs.ATG" ref expr); -#line 2324 "cs.ATG" +#line 2328 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.ExclusiveOr, expr); } } void AndExpr( -#line 2327 "cs.ATG" +#line 2331 "cs.ATG" ref Expression outExpr) { -#line 2328 "cs.ATG" +#line 2332 "cs.ATG" Expression expr; EqualityExpr( -#line 2330 "cs.ATG" +#line 2334 "cs.ATG" ref outExpr); while (la.kind == 28) { lexer.NextToken(); UnaryExpr( -#line 2330 "cs.ATG" +#line 2334 "cs.ATG" out expr); EqualityExpr( -#line 2330 "cs.ATG" +#line 2334 "cs.ATG" ref expr); -#line 2330 "cs.ATG" +#line 2334 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.BitwiseAnd, expr); } } void EqualityExpr( -#line 2333 "cs.ATG" +#line 2337 "cs.ATG" ref Expression outExpr) { -#line 2335 "cs.ATG" +#line 2339 "cs.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; RelationalExpr( -#line 2339 "cs.ATG" +#line 2343 "cs.ATG" ref outExpr); while (la.kind == 33 || la.kind == 34) { if (la.kind == 34) { lexer.NextToken(); -#line 2342 "cs.ATG" +#line 2346 "cs.ATG" op = BinaryOperatorType.InEquality; } else { lexer.NextToken(); -#line 2343 "cs.ATG" +#line 2347 "cs.ATG" op = BinaryOperatorType.Equality; } UnaryExpr( -#line 2345 "cs.ATG" +#line 2349 "cs.ATG" out expr); RelationalExpr( -#line 2345 "cs.ATG" +#line 2349 "cs.ATG" ref expr); -#line 2345 "cs.ATG" +#line 2349 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } } void RelationalExpr( -#line 2349 "cs.ATG" +#line 2353 "cs.ATG" ref Expression outExpr) { -#line 2351 "cs.ATG" +#line 2355 "cs.ATG" TypeReference type; Expression expr; BinaryOperatorType op = BinaryOperatorType.None; ShiftExpr( -#line 2356 "cs.ATG" +#line 2360 "cs.ATG" ref outExpr); while (StartOf(28)) { if (StartOf(29)) { if (la.kind == 23) { lexer.NextToken(); -#line 2358 "cs.ATG" +#line 2362 "cs.ATG" op = BinaryOperatorType.LessThan; } else if (la.kind == 22) { lexer.NextToken(); -#line 2359 "cs.ATG" +#line 2363 "cs.ATG" op = BinaryOperatorType.GreaterThan; } else if (la.kind == 36) { lexer.NextToken(); -#line 2360 "cs.ATG" +#line 2364 "cs.ATG" op = BinaryOperatorType.LessThanOrEqual; } else if (la.kind == 35) { lexer.NextToken(); -#line 2361 "cs.ATG" +#line 2365 "cs.ATG" op = BinaryOperatorType.GreaterThanOrEqual; } else SynErr(185); UnaryExpr( -#line 2363 "cs.ATG" +#line 2367 "cs.ATG" out expr); ShiftExpr( -#line 2364 "cs.ATG" +#line 2368 "cs.ATG" ref expr); -#line 2365 "cs.ATG" +#line 2369 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } else { if (la.kind == 84) { lexer.NextToken(); TypeWithRestriction( -#line 2368 "cs.ATG" +#line 2372 "cs.ATG" out type, false, false); if ( -#line 2369 "cs.ATG" +#line 2373 "cs.ATG" la.kind == Tokens.Question && Tokens.CastFollower[Peek(1).kind] == false) { NullableQuestionMark( -#line 2370 "cs.ATG" +#line 2374 "cs.ATG" ref type); } -#line 2371 "cs.ATG" +#line 2375 "cs.ATG" outExpr = new TypeOfIsExpression(outExpr, type); } else if (la.kind == 49) { lexer.NextToken(); TypeWithRestriction( -#line 2373 "cs.ATG" +#line 2377 "cs.ATG" out type, false, false); if ( -#line 2374 "cs.ATG" +#line 2378 "cs.ATG" la.kind == Tokens.Question && Tokens.CastFollower[Peek(1).kind] == false) { NullableQuestionMark( -#line 2375 "cs.ATG" +#line 2379 "cs.ATG" ref type); } -#line 2376 "cs.ATG" +#line 2380 "cs.ATG" outExpr = new CastExpression(type, outExpr, CastType.TryCast); } else SynErr(186); } @@ -5409,83 +5413,83 @@ ref type); } void ShiftExpr( -#line 2381 "cs.ATG" +#line 2385 "cs.ATG" ref Expression outExpr) { -#line 2383 "cs.ATG" +#line 2387 "cs.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; AdditiveExpr( -#line 2387 "cs.ATG" +#line 2391 "cs.ATG" ref outExpr); while (la.kind == 37 || -#line 2390 "cs.ATG" +#line 2394 "cs.ATG" IsShiftRight()) { if (la.kind == 37) { lexer.NextToken(); -#line 2389 "cs.ATG" +#line 2393 "cs.ATG" op = BinaryOperatorType.ShiftLeft; } else { Expect(22); Expect(22); -#line 2391 "cs.ATG" +#line 2395 "cs.ATG" op = BinaryOperatorType.ShiftRight; } UnaryExpr( -#line 2394 "cs.ATG" +#line 2398 "cs.ATG" out expr); AdditiveExpr( -#line 2394 "cs.ATG" +#line 2398 "cs.ATG" ref expr); -#line 2394 "cs.ATG" +#line 2398 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } } void AdditiveExpr( -#line 2398 "cs.ATG" +#line 2402 "cs.ATG" ref Expression outExpr) { -#line 2400 "cs.ATG" +#line 2404 "cs.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; MultiplicativeExpr( -#line 2404 "cs.ATG" +#line 2408 "cs.ATG" ref outExpr); while (la.kind == 4 || la.kind == 5) { if (la.kind == 4) { lexer.NextToken(); -#line 2407 "cs.ATG" +#line 2411 "cs.ATG" op = BinaryOperatorType.Add; } else { lexer.NextToken(); -#line 2408 "cs.ATG" +#line 2412 "cs.ATG" op = BinaryOperatorType.Subtract; } UnaryExpr( -#line 2410 "cs.ATG" +#line 2414 "cs.ATG" out expr); MultiplicativeExpr( -#line 2410 "cs.ATG" +#line 2414 "cs.ATG" ref expr); -#line 2410 "cs.ATG" +#line 2414 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } } void MultiplicativeExpr( -#line 2414 "cs.ATG" +#line 2418 "cs.ATG" ref Expression outExpr) { -#line 2416 "cs.ATG" +#line 2420 "cs.ATG" Expression expr; BinaryOperatorType op = BinaryOperatorType.None; @@ -5493,57 +5497,57 @@ ref Expression outExpr) { if (la.kind == 6) { lexer.NextToken(); -#line 2422 "cs.ATG" +#line 2426 "cs.ATG" op = BinaryOperatorType.Multiply; } else if (la.kind == 7) { lexer.NextToken(); -#line 2423 "cs.ATG" +#line 2427 "cs.ATG" op = BinaryOperatorType.Divide; } else { lexer.NextToken(); -#line 2424 "cs.ATG" +#line 2428 "cs.ATG" op = BinaryOperatorType.Modulus; } UnaryExpr( -#line 2426 "cs.ATG" +#line 2430 "cs.ATG" out expr); -#line 2426 "cs.ATG" +#line 2430 "cs.ATG" outExpr = new BinaryOperatorExpression(outExpr, op, expr); } } void TypeParameterConstraintsClauseBase( -#line 2530 "cs.ATG" +#line 2534 "cs.ATG" out TypeReference type) { -#line 2531 "cs.ATG" +#line 2535 "cs.ATG" TypeReference t; type = null; if (la.kind == 108) { lexer.NextToken(); -#line 2533 "cs.ATG" +#line 2537 "cs.ATG" type = new TypeReference("struct"); } else if (la.kind == 58) { lexer.NextToken(); -#line 2534 "cs.ATG" +#line 2538 "cs.ATG" type = new TypeReference("struct"); } else if (la.kind == 88) { lexer.NextToken(); Expect(20); Expect(21); -#line 2535 "cs.ATG" +#line 2539 "cs.ATG" type = new TypeReference("struct"); } else if (StartOf(9)) { Type( -#line 2536 "cs.ATG" +#line 2540 "cs.ATG" out t); -#line 2536 "cs.ATG" +#line 2540 "cs.ATG" type = t; } else SynErr(187); } diff --git a/src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG b/src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG index 3965a9f8f3..5095ded641 100644 --- a/src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG +++ b/src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG @@ -335,7 +335,11 @@ bool SkipGeneric(ref Token pt) --braces; } else if (pt.kind == Tokens.LessThan) { ++braces; - } else if (pt.kind == Tokens.Semicolon || pt.kind == Tokens.OpenCurlyBrace || pt.kind == Tokens.CloseCurlyBrace || pt.kind == Tokens.EOF) { + } else if (pt.kind != Tokens.Identifier && pt.kind != Tokens.Comma + && pt.kind != Tokens.OpenSquareBracket && pt.kind != Tokens.CloseSquareBracket + && pt.kind != Tokens.Question + && !Tokens.TypeKW[pt.kind]) + { return false; } } diff --git a/src/Libraries/NRefactory/Test/Parser/Expressions/BinaryOperatorExpressionTests.cs b/src/Libraries/NRefactory/Test/Parser/Expressions/BinaryOperatorExpressionTests.cs index 5702d3da57..511564d45e 100644 --- a/src/Libraries/NRefactory/Test/Parser/Expressions/BinaryOperatorExpressionTests.cs +++ b/src/Libraries/NRefactory/Test/Parser/Expressions/BinaryOperatorExpressionTests.cs @@ -235,6 +235,14 @@ namespace ICSharpCode.NRefactory.Tests.AST { CSharpTestBinaryOperatorExpressionTest("a ?? b", BinaryOperatorType.NullCoalescing); } + + [Test] + public void CSharpLessThanOrGreaterTest() + { + const string expr = "i1 < 0 || i1 > (Count - 1)"; + BinaryOperatorExpression boe = ParseUtilCSharp.ParseExpression(expr); + Assert.AreEqual(BinaryOperatorType.LogicalOr, boe.Op); + } #endregion #region VB.NET diff --git a/src/Main/Base/Project/Src/Commands/FileCommands.cs b/src/Main/Base/Project/Src/Commands/FileCommands.cs index 002448379f..408b8c92c5 100644 --- a/src/Main/Base/Project/Src/Commands/FileCommands.cs +++ b/src/Main/Base/Project/Src/Commands/FileCommands.cs @@ -159,7 +159,7 @@ namespace ICSharpCode.SharpDevelop.Commands { public static void SaveAll() { - foreach (IViewContent content in WorkbenchSingleton.Workbench.ViewContentCollection) { + foreach (IViewContent content in WorkbenchSingleton.Workbench.ViewContentCollection.ToArray()) { if (content.IsViewOnly) { continue; } diff --git a/src/Main/Base/Project/Src/Dom/Implementations/AnonymousMethodReturnType.cs b/src/Main/Base/Project/Src/Dom/Implementations/AnonymousMethodReturnType.cs index 7e33697378..1014cb20fd 100644 --- a/src/Main/Base/Project/Src/Dom/Implementations/AnonymousMethodReturnType.cs +++ b/src/Main/Base/Project/Src/Dom/Implementations/AnonymousMethodReturnType.cs @@ -18,7 +18,7 @@ namespace ICSharpCode.SharpDevelop.Dom public sealed class AnonymousMethodReturnType : ProxyReturnType { IReturnType returnType; - List parameters = new List(); + IList parameters = new List(); ICompilationUnit cu; public AnonymousMethodReturnType(ICompilationUnit cu) @@ -45,6 +45,10 @@ namespace ICSharpCode.SharpDevelop.Dom get { return parameters; } + set { + if (value == null) throw new ArgumentNullException("value"); + parameters = value; + } } public override bool IsDefaultReturnType { diff --git a/src/Main/Base/Project/Src/Project/Converter/PrjxToSolutionProject.cs b/src/Main/Base/Project/Src/Project/Converter/PrjxToSolutionProject.cs index d4183be344..afa492fed0 100644 --- a/src/Main/Base/Project/Src/Project/Converter/PrjxToSolutionProject.cs +++ b/src/Main/Base/Project/Src/Project/Converter/PrjxToSolutionProject.cs @@ -167,7 +167,7 @@ namespace ICSharpCode.SharpDevelop.Project.Converter public string Negate(string booleanString) { - return (!bool.Parse(booleanString)).ToString(); + return "false".Equals(booleanString, StringComparison.OrdinalIgnoreCase).ToString(); } public string GetFileName(string fileName) diff --git a/src/Main/Base/Project/Src/Project/Solution/Solution.cs b/src/Main/Base/Project/Src/Project/Solution/Solution.cs index c2970b23db..a34d983a5c 100644 --- a/src/Main/Base/Project/Src/Project/Solution/Solution.cs +++ b/src/Main/Base/Project/Src/Project/Solution/Solution.cs @@ -213,10 +213,15 @@ namespace ICSharpCode.SharpDevelop.Project return null; } - public void Save() { - Save(fileName); + try { + Save(fileName); + } catch (IOException ex) { + MessageService.ShowError("Could not save " + fileName + ":\n" + ex.Message); + } catch (UnauthorizedAccessException ex) { + MessageService.ShowError("Could not save " + fileName + ":\n" + ex.Message + "\n\nEnsure the file is writable."); + } } public SolutionFolder CreateFolder(string folderName) diff --git a/src/Main/Base/Project/Src/Services/LanguageBinding/LanguageBindingService.cs b/src/Main/Base/Project/Src/Services/LanguageBinding/LanguageBindingService.cs index a6ca2db6ab..3de63835d7 100644 --- a/src/Main/Base/Project/Src/Services/LanguageBinding/LanguageBindingService.cs +++ b/src/Main/Base/Project/Src/Services/LanguageBinding/LanguageBindingService.cs @@ -95,6 +95,10 @@ namespace ICSharpCode.Core MessageService.ShowError("Error loading " + location + ":\n" + ex.Message); newProject = new UnknownProject(location, title); newProject.TypeGuid = projectTypeGuid; + } catch (UnauthorizedAccessException ex) { + MessageService.ShowError("Error loading " + location + ":\n" + ex.Message); + newProject = new UnknownProject(location, title); + newProject.TypeGuid = projectTypeGuid; } } else { newProject = new UnknownProject(location, title); diff --git a/src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs b/src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs index 00504bd70c..90fd60973a 100644 --- a/src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs +++ b/src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs @@ -287,12 +287,7 @@ namespace ICSharpCode.SharpDevelop.Project ILanguageBinding binding = LanguageBindingService.GetBindingPerProjectFile(fileName); IProject project; if (binding != null) { - try { - project = LanguageBindingService.LoadProject(fileName, solution.Name); - } catch (UnauthorizedAccessException ex) { - MessageService.ShowError(ex.Message); - return; - } + project = LanguageBindingService.LoadProject(fileName, solution.Name); } else { MessageService.ShowError(StringParser.Parse("${res:ICSharpCode.SharpDevelop.Commands.OpenCombine.InvalidProjectOrCombine}", new string[,] {{"FileName", fileName}})); return; @@ -311,9 +306,11 @@ namespace ICSharpCode.SharpDevelop.Project } } solution.FixSolutionConfiguration(new IProject[] { project }); - solution.Save(solutionFile); - LoadSolution(solutionFile); + if (FileUtility.ObservedSave((NamedFileOperationDelegate)solution.Save, solutionFile) == FileOperationResult.OK) { + // only load when saved succesfully + LoadSolution(solutionFile); + } } public static void SaveSolution()