Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Krüger <mkrueger@novell.com>2009-08-24 14:31:51 +0400
committerMike Krüger <mkrueger@novell.com>2009-08-24 14:31:51 +0400
commit6db909ac728b304824b6980e457d4bd4362f484e (patch)
treea6055ff7993c8fe13af7ae689bbb0733c202db7e /main/contrib
parente4c1214e992b3eca5e209b54f654e208329440a3 (diff)
* Src/Location.cs:
* Src/Ast/Enums.cs: * Src/Ast/INode.cs: * Src/Lexer/Token.cs: * Src/IAstVisitor.cs: * Src/Lexer/ILexer.cs: * Src/Ast/Generated.cs: * Src/Parser/Errors.cs: * Src/SnippetParser.cs: * Src/ParserFactory.cs: * Src/Ast/INullable.cs: * Src/Parser/IParser.cs: * Src/Ast/AbstractNode.cs: * Src/Parser/CSharp/cs.ATG: * Src/Ast/TypeReference.cs: * Src/Lexer/LookupTable.cs: * Src/Lexer/VBNet/Lexer.cs: * Src/OperatorPrecedence.cs: * Src/Lexer/CSharp/Lexer.cs: * Src/Lexer/VBNet/Tokens.cs: * Src/Lexer/AbstractLexer.cs: * Src/Parser/VBNet/VBNET.ATG: * Src/Parser/ModifierList.cs: * Src/Lexer/CSharp/Tokens.cs: * Src/Parser/VBNet/Parser.cs: * Src/Parser/CSharp/Parser.cs: * Src/Lexer/Special/Comment.cs: * Src/Parser/AbstractParser.cs: * Src/Ast/General/Statement.cs: * Src/Lexer/Special/ISpecial.cs: * Src/Ast/General/Expression.cs: * Src/Lexer/Special/BlankLine.cs: * Src/Parser/VBNet/VBNetParser.cs: * Src/Lexer/Special/TagComment.cs: * Src/Lexer/Special/CommentType.cs: * Src/Visitors/SetParentVisitor.cs: * Src/Ast/General/BlockStatement.cs: * Src/Parser/CSharp/CSharpParser.cs: * Src/AstBuilder/StatementBuilder.cs: * Src/Visitors/AbstractASTVisitor.cs: * Src/Visitors/ConvertVisitorBase.cs: * Src/Visitors/LookupTableVisitor.cs: * Src/Ast/General/CompilationUnit.cs: * Src/Lexer/Special/SpecialTracker.cs: * Src/Visitors/PrefixFieldsVisitor.cs: * Src/AstBuilder/ExpressionBuilder.cs: * Src/Visitors/CodeDOMOutputVisitor.cs: * Src/Visitors/ToVBNetConvertVisitor.cs: * Src/Parser/VBNet/ParamModifierList.cs: * Src/EnvironmentInformationProvider.cs: * Src/PrettyPrinter/IOutputAstVisitor.cs: * Src/Visitors/NodeTrackingAstVisitor.cs: * Src/Visitors/ToCSharpConvertVisitor.cs: * Src/Ast/General/PrimitiveExpression.cs: * Src/Visitors/AbstractAstTransformer.cs: * Src/Visitors/RenameIdentifierVisitor.cs: * Src/Visitors/NotImplementedAstVisitor.cs: * Src/PrettyPrinter/SpecialNodesInserter.cs: * Src/Lexer/CSharp/ConditionalCompilation.cs: * Src/Ast/General/LocalVariableDeclaration.cs: * Src/PrettyPrinter/CSharp/OutputFormatter.cs: * Src/Lexer/Special/PreProcessingDirective.cs: * Src/PrettyPrinter/AbstractOutputFormatter.cs: * Src/Visitors/VBNetConstructsConvertVisitor.cs: * Src/Visitors/CodeDOMVerboseOutputGenerator.cs: * Src/PrettyPrinter/VBNet/VBNetOutputVisitor.cs: * Src/PrettyPrinter/CSharp/PrettyPrintOptions.cs: * Src/Visitors/CSharpConstructsConvertVisitor.cs: * Src/PrettyPrinter/VBNet/VBNetOutputFormatter.cs: * Src/PrettyPrinter/AbstractPrettyPrintOptions.cs: * Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs: * Src/Visitors/ToVBNetRenameConflictingVariables.cs: * Src/PrettyPrinter/VBNet/VBNetPrettyPrintOptions.cs: Fixed "Bug 533666 - if/else not properly formatted" and updated nrefactory to the latest version. svn path=/trunk/monodevelop/; revision=140490
Diffstat (limited to 'main/contrib')
-rw-r--r--main/contrib/NRefactory/Project/ChangeLog78
-rw-r--r--main/contrib/NRefactory/Project/Src/Ast/AbstractNode.cs152
-rw-r--r--main/contrib/NRefactory/Project/Src/Ast/Enums.cs783
-rw-r--r--main/contrib/NRefactory/Project/Src/Ast/General/BlockStatement.cs126
-rw-r--r--main/contrib/NRefactory/Project/Src/Ast/General/CompilationUnit.cs120
-rw-r--r--main/contrib/NRefactory/Project/Src/Ast/General/Expression.cs214
-rw-r--r--main/contrib/NRefactory/Project/Src/Ast/General/LocalVariableDeclaration.cs206
-rw-r--r--main/contrib/NRefactory/Project/Src/Ast/General/PrimitiveExpression.cs114
-rw-r--r--main/contrib/NRefactory/Project/Src/Ast/General/Statement.cs132
-rw-r--r--main/contrib/NRefactory/Project/Src/Ast/Generated.cs10876
-rw-r--r--main/contrib/NRefactory/Project/Src/Ast/INode.cs110
-rw-r--r--main/contrib/NRefactory/Project/Src/Ast/INullable.cs32
-rw-r--r--main/contrib/NRefactory/Project/Src/Ast/TypeReference.cs890
-rw-r--r--main/contrib/NRefactory/Project/Src/AstBuilder/ExpressionBuilder.cs196
-rw-r--r--main/contrib/NRefactory/Project/Src/AstBuilder/StatementBuilder.cs118
-rw-r--r--main/contrib/NRefactory/Project/Src/EnvironmentInformationProvider.cs52
-rw-r--r--main/contrib/NRefactory/Project/Src/IAstVisitor.cs524
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/AbstractLexer.cs2
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/CSharp/ConditionalCompilation.cs180
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/CSharp/Lexer.cs2
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/CSharp/Tokens.cs706
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/ILexer.cs2
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/LookupTable.cs240
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/Special/BlankLine.cs46
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/Special/Comment.cs126
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/Special/CommentType.cs36
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/Special/ISpecial.cs112
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/Special/PreProcessingDirective.cs320
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/Special/SpecialTracker.cs160
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/Special/TagComment.cs66
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/Token.cs210
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/VBNet/Lexer.cs1522
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/VBNet/Tokens.cs970
-rw-r--r--main/contrib/NRefactory/Project/Src/Location.cs250
-rw-r--r--main/contrib/NRefactory/Project/Src/OperatorPrecedence.cs176
-rw-r--r--main/contrib/NRefactory/Project/Src/Parser/AbstractParser.cs220
-rw-r--r--main/contrib/NRefactory/Project/Src/Parser/CSharp/CSharpParser.cs67
-rw-r--r--main/contrib/NRefactory/Project/Src/Parser/CSharp/Parser.cs968
-rw-r--r--main/contrib/NRefactory/Project/Src/Parser/CSharp/cs.ATG38
-rw-r--r--main/contrib/NRefactory/Project/Src/Parser/Errors.cs108
-rw-r--r--main/contrib/NRefactory/Project/Src/Parser/IParser.cs84
-rw-r--r--main/contrib/NRefactory/Project/Src/Parser/ModifierList.cs146
-rw-r--r--main/contrib/NRefactory/Project/Src/Parser/VBNet/ParamModifierList.cs106
-rw-r--r--main/contrib/NRefactory/Project/Src/Parser/VBNet/Parser.cs14810
-rw-r--r--main/contrib/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG6812
-rw-r--r--main/contrib/NRefactory/Project/Src/Parser/VBNet/VBNetParser.cs650
-rw-r--r--main/contrib/NRefactory/Project/Src/ParserFactory.cs124
-rw-r--r--main/contrib/NRefactory/Project/Src/PrettyPrinter/AbstractOutputFormatter.cs3
-rw-r--r--main/contrib/NRefactory/Project/Src/PrettyPrinter/AbstractPrettyPrintOptions.cs92
-rw-r--r--main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs141
-rw-r--r--main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/OutputFormatter.cs2
-rw-r--r--main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/PrettyPrintOptions.cs51
-rw-r--r--main/contrib/NRefactory/Project/Src/PrettyPrinter/IOutputAstVisitor.cs112
-rw-r--r--main/contrib/NRefactory/Project/Src/PrettyPrinter/SpecialNodesInserter.cs292
-rw-r--r--main/contrib/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetOutputFormatter.cs154
-rw-r--r--main/contrib/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetOutputVisitor.cs6066
-rw-r--r--main/contrib/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetPrettyPrintOptions.cs44
-rw-r--r--main/contrib/NRefactory/Project/Src/SnippetParser.cs292
-rw-r--r--main/contrib/NRefactory/Project/Src/Visitors/AbstractASTVisitor.cs2020
-rw-r--r--main/contrib/NRefactory/Project/Src/Visitors/AbstractAstTransformer.cs2756
-rw-r--r--main/contrib/NRefactory/Project/Src/Visitors/CSharpConstructsConvertVisitor.cs468
-rw-r--r--main/contrib/NRefactory/Project/Src/Visitors/CodeDOMOutputVisitor.cs3415
-rw-r--r--main/contrib/NRefactory/Project/Src/Visitors/CodeDOMVerboseOutputGenerator.cs720
-rw-r--r--main/contrib/NRefactory/Project/Src/Visitors/ConvertVisitorBase.cs56
-rw-r--r--main/contrib/NRefactory/Project/Src/Visitors/LookupTableVisitor.cs14
-rw-r--r--main/contrib/NRefactory/Project/Src/Visitors/NodeTrackingAstVisitor.cs2736
-rw-r--r--main/contrib/NRefactory/Project/Src/Visitors/NotImplementedAstVisitor.cs1014
-rw-r--r--main/contrib/NRefactory/Project/Src/Visitors/PrefixFieldsVisitor.cs294
-rw-r--r--main/contrib/NRefactory/Project/Src/Visitors/RenameIdentifierVisitor.cs130
-rw-r--r--main/contrib/NRefactory/Project/Src/Visitors/SetParentVisitor.cs74
-rw-r--r--main/contrib/NRefactory/Project/Src/Visitors/ToCSharpConvertVisitor.cs508
-rw-r--r--main/contrib/NRefactory/Project/Src/Visitors/ToVBNetConvertVisitor.cs734
-rw-r--r--main/contrib/NRefactory/Project/Src/Visitors/ToVBNetRenameConflictingVariables.cs182
-rw-r--r--main/contrib/NRefactory/Project/Src/Visitors/VBNetConstructsConvertVisitor.cs1014
74 files changed, 33777 insertions, 33589 deletions
diff --git a/main/contrib/NRefactory/Project/ChangeLog b/main/contrib/NRefactory/Project/ChangeLog
index b2d23c7660..e3ad13db23 100644
--- a/main/contrib/NRefactory/Project/ChangeLog
+++ b/main/contrib/NRefactory/Project/ChangeLog
@@ -1,3 +1,81 @@
+2009-08-24 Mike Krüger <mkrueger@novell.com>
+
+ * Src/Location.cs:
+ * Src/Ast/Enums.cs:
+ * Src/Ast/INode.cs:
+ * Src/Lexer/Token.cs:
+ * Src/IAstVisitor.cs:
+ * Src/Lexer/ILexer.cs:
+ * Src/Ast/Generated.cs:
+ * Src/Parser/Errors.cs:
+ * Src/SnippetParser.cs:
+ * Src/ParserFactory.cs:
+ * Src/Ast/INullable.cs:
+ * Src/Parser/IParser.cs:
+ * Src/Ast/AbstractNode.cs:
+ * Src/Parser/CSharp/cs.ATG:
+ * Src/Ast/TypeReference.cs:
+ * Src/Lexer/LookupTable.cs:
+ * Src/Lexer/VBNet/Lexer.cs:
+ * Src/OperatorPrecedence.cs:
+ * Src/Lexer/CSharp/Lexer.cs:
+ * Src/Lexer/VBNet/Tokens.cs:
+ * Src/Lexer/AbstractLexer.cs:
+ * Src/Parser/VBNet/VBNET.ATG:
+ * Src/Parser/ModifierList.cs:
+ * Src/Lexer/CSharp/Tokens.cs:
+ * Src/Parser/VBNet/Parser.cs:
+ * Src/Parser/CSharp/Parser.cs:
+ * Src/Lexer/Special/Comment.cs:
+ * Src/Parser/AbstractParser.cs:
+ * Src/Ast/General/Statement.cs:
+ * Src/Lexer/Special/ISpecial.cs:
+ * Src/Ast/General/Expression.cs:
+ * Src/Lexer/Special/BlankLine.cs:
+ * Src/Parser/VBNet/VBNetParser.cs:
+ * Src/Lexer/Special/TagComment.cs:
+ * Src/Lexer/Special/CommentType.cs:
+ * Src/Visitors/SetParentVisitor.cs:
+ * Src/Ast/General/BlockStatement.cs:
+ * Src/Parser/CSharp/CSharpParser.cs:
+ * Src/AstBuilder/StatementBuilder.cs:
+ * Src/Visitors/AbstractASTVisitor.cs:
+ * Src/Visitors/ConvertVisitorBase.cs:
+ * Src/Visitors/LookupTableVisitor.cs:
+ * Src/Ast/General/CompilationUnit.cs:
+ * Src/Lexer/Special/SpecialTracker.cs:
+ * Src/Visitors/PrefixFieldsVisitor.cs:
+ * Src/AstBuilder/ExpressionBuilder.cs:
+ * Src/Visitors/CodeDOMOutputVisitor.cs:
+ * Src/Visitors/ToVBNetConvertVisitor.cs:
+ * Src/Parser/VBNet/ParamModifierList.cs:
+ * Src/EnvironmentInformationProvider.cs:
+ * Src/PrettyPrinter/IOutputAstVisitor.cs:
+ * Src/Visitors/NodeTrackingAstVisitor.cs:
+ * Src/Visitors/ToCSharpConvertVisitor.cs:
+ * Src/Ast/General/PrimitiveExpression.cs:
+ * Src/Visitors/AbstractAstTransformer.cs:
+ * Src/Visitors/RenameIdentifierVisitor.cs:
+ * Src/Visitors/NotImplementedAstVisitor.cs:
+ * Src/PrettyPrinter/SpecialNodesInserter.cs:
+ * Src/Lexer/CSharp/ConditionalCompilation.cs:
+ * Src/Ast/General/LocalVariableDeclaration.cs:
+ * Src/PrettyPrinter/CSharp/OutputFormatter.cs:
+ * Src/Lexer/Special/PreProcessingDirective.cs:
+ * Src/PrettyPrinter/AbstractOutputFormatter.cs:
+ * Src/Visitors/VBNetConstructsConvertVisitor.cs:
+ * Src/Visitors/CodeDOMVerboseOutputGenerator.cs:
+ * Src/PrettyPrinter/VBNet/VBNetOutputVisitor.cs:
+ * Src/PrettyPrinter/CSharp/PrettyPrintOptions.cs:
+ * Src/Visitors/CSharpConstructsConvertVisitor.cs:
+ * Src/PrettyPrinter/VBNet/VBNetOutputFormatter.cs:
+ * Src/PrettyPrinter/AbstractPrettyPrintOptions.cs:
+ * Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs:
+ * Src/Visitors/ToVBNetRenameConflictingVariables.cs:
+ * Src/PrettyPrinter/VBNet/VBNetPrettyPrintOptions.cs: Fixed
+ "Bug 533666 - if/else not properly formatted" and updated
+ nrefactory to the latest version.
+
2009-07-24 Mike Krüger <mkrueger@novell.com>
* Src/Visitors/LookupTableVisitor.cs: Lookup table visitor
diff --git a/main/contrib/NRefactory/Project/Src/Ast/AbstractNode.cs b/main/contrib/NRefactory/Project/Src/Ast/AbstractNode.cs
index 1beafe8354..1b8c8ab274 100644
--- a/main/contrib/NRefactory/Project/Src/Ast/AbstractNode.cs
+++ b/main/contrib/NRefactory/Project/Src/Ast/AbstractNode.cs
@@ -1,76 +1,76 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 2708 $</version>
-// </file>
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Text;
-
-namespace ICSharpCode.NRefactory.Ast
-{
- public abstract class AbstractNode : INode
- {
- List<INode> children = new List<INode>();
-
- public INode Parent { get; set; }
- public Location StartLocation { get; set; }
- public Location EndLocation { get; set; }
- public object UserData { get; set; }
-
- public List<INode> Children {
- get {
- return children;
- }
- set {
- Debug.Assert(value != null);
- children = value;
- }
- }
-
- public virtual void AddChild(INode childNode)
- {
- Debug.Assert(childNode != null);
- children.Add(childNode);
- }
-
- public abstract object AcceptVisitor(IAstVisitor visitor, object data);
-
- public virtual object AcceptChildren(IAstVisitor visitor, object data)
- {
- foreach (INode child in children) {
- Debug.Assert(child != null);
- child.AcceptVisitor(visitor, data);
- }
- return data;
- }
-
- public static string GetCollectionString(ICollection collection)
- {
- StringBuilder output = new StringBuilder();
- output.Append('{');
-
- if (collection != null) {
- IEnumerator en = collection.GetEnumerator();
- bool isFirst = true;
- while (en.MoveNext()) {
- if (!isFirst) {
- output.Append(", ");
- } else {
- isFirst = false;
- }
- output.Append(en.Current == null ? "<null>" : en.Current.ToString());
- }
- } else {
- return "null";
- }
-
- output.Append('}');
- return output.ToString();
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Text;
+
+namespace ICSharpCode.NRefactory.Ast
+{
+ public abstract class AbstractNode : INode
+ {
+ List<INode> children = new List<INode>();
+
+ public INode Parent { get; set; }
+ public Location StartLocation { get; set; }
+ public Location EndLocation { get; set; }
+ public object UserData { get; set; }
+
+ public List<INode> Children {
+ get {
+ return children;
+ }
+ set {
+ Debug.Assert(value != null);
+ children = value;
+ }
+ }
+
+ public virtual void AddChild(INode childNode)
+ {
+ Debug.Assert(childNode != null);
+ children.Add(childNode);
+ }
+
+ public abstract object AcceptVisitor(IAstVisitor visitor, object data);
+
+ public virtual object AcceptChildren(IAstVisitor visitor, object data)
+ {
+ foreach (INode child in children) {
+ Debug.Assert(child != null);
+ child.AcceptVisitor(visitor, data);
+ }
+ return data;
+ }
+
+ public static string GetCollectionString(ICollection collection)
+ {
+ StringBuilder output = new StringBuilder();
+ output.Append('{');
+
+ if (collection != null) {
+ IEnumerator en = collection.GetEnumerator();
+ bool isFirst = true;
+ while (en.MoveNext()) {
+ if (!isFirst) {
+ output.Append(", ");
+ } else {
+ isFirst = false;
+ }
+ output.Append(en.Current == null ? "<null>" : en.Current.ToString());
+ }
+ } else {
+ return "null";
+ }
+
+ output.Append('}');
+ return output.ToString();
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Ast/Enums.cs b/main/contrib/NRefactory/Project/Src/Ast/Enums.cs
index 787600da2a..4d5c7229ad 100644
--- a/main/contrib/NRefactory/Project/Src/Ast/Enums.cs
+++ b/main/contrib/NRefactory/Project/Src/Ast/Enums.cs
@@ -1,390 +1,393 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 3403 $</version>
-// </file>
-
-using System;
-
-namespace ICSharpCode.NRefactory.Ast
-{
- [Flags]
- public enum Modifiers
- {
- None = 0x0000,
-
- // Access
- Private = 0x0001,
- /// <summary>C# 'internal', VB 'Friend'</summary>
- Internal = 0x0002,
- Protected = 0x0004,
- Public = 0x0008,
- Dim = 0x0010, // VB.NET SPECIFIC, for fields/local variables only
-
- // Scope
- Abstract = 0x0010, // == MustOverride/MustInherit
- Virtual = 0x0020,
- Sealed = 0x0040,
- /// <summary>C# 'static', VB 'Shared'</summary>
- Static = 0x0080,
- Override = 0x0100,
- /// <summary>For fields: readonly (c# and vb), for properties: get-only (vb)</summary>
- ReadOnly = 0x0200,
- Const = 0x0400,
- /// <summary>C# 'new', VB 'Shadows'</summary>
- New = 0x0800,
- Partial = 0x1000,
-
- // Special
- Extern = 0x2000,
- Volatile = 0x4000,
- Unsafe = 0x8000,
- Overloads = 0x10000, // VB specific
- WithEvents = 0x20000, // VB specific
- Default = 0x40000, // VB specific
- Fixed = 0x80000, // C# specific (fixed size arrays in unsafe structs)
-
- /// <summary>Generated code, not part of parsed code</summary>
- Synthetic = 0x200000,
- /// <summary>Only for VB properties.</summary>
- WriteOnly = 0x400000, // VB specific
-
- Visibility = Private | Public | Protected | Internal,
- Classes = New | Visibility | Abstract | Sealed | Partial | Static,
- VBModules = Visibility,
- VBStructures = Visibility | New,
- VBEnums = Visibility | New,
- VBInterfacs = Visibility | New,
- VBDelegates = Visibility | New,
- VBMethods = Visibility | New | Static | Virtual | Sealed | Abstract | Override | Overloads,
- VBExternalMethods = Visibility | New | Overloads,
- VBEvents = Visibility | New | Overloads,
- VBProperties = VBMethods | Default | ReadOnly | WriteOnly,
- VBCustomEvents = Visibility | New | Overloads,
- VBOperators = Public | Static | Overloads | New,
-
-
- // this is not documented in the spec
- VBInterfaceEvents = New,
- VBInterfaceMethods = New | Overloads,
- VBInterfaceProperties = New | Overloads | ReadOnly | WriteOnly | Default,
- VBInterfaceEnums = New,
-
- Fields = New | Visibility | Static | ReadOnly | Volatile | Fixed,
- PropertysEventsMethods = New | Visibility | Static | Virtual | Sealed | Override | Abstract | Extern,
- Indexers = New | Visibility | Virtual | Sealed | Override | Abstract | Extern,
- Operators = Public | Static | Extern,
- Constants = New | Visibility,
- StructsInterfacesEnumsDelegates = New | Visibility | Partial,
- StaticConstructors = Extern | Static | Unsafe,
- Destructors = Extern | Unsafe,
- Constructors = Visibility | Extern,
- }
-
- public enum ClassType
- {
- Class,
- Module,
- Interface,
- Struct,
- Enum
- }
-
- public enum ParentType
- {
- ClassOrStruct,
- InterfaceOrEnum,
- Namespace,
- Unknown
- }
-
- public enum FieldDirection
- {
- None,
- In,
- Out,
- Ref
- }
-
- [Flags]
- public enum ParameterModifiers
- {
- // Values must be the same as in SharpDevelop's ParameterModifiers
- None = 0,
- In = 1,
- Out = 2,
- Ref = 4,
- Params = 8,
- Optional = 16
- }
-
- public enum AssignmentOperatorType
- {
- None,
- Assign,
-
- Add,
- Subtract,
- Multiply,
- Divide,
- Modulus,
-
- Power, // (VB only)
- DivideInteger, // (VB only)
- ConcatString, // (VB only)
-
- ShiftLeft,
- ShiftRight,
-
- BitwiseAnd,
- BitwiseOr,
- ExclusiveOr,
- }
-
- public enum BinaryOperatorType
- {
- None,
-
- /// <summary>'&amp;' in C#, 'And' in VB.</summary>
- BitwiseAnd,
- /// <summary>'|' in C#, 'Or' in VB.</summary>
- BitwiseOr,
- /// <summary>'&amp;&amp;' in C#, 'AndAlso' in VB.</summary>
- LogicalAnd,
- /// <summary>'||' in C#, 'OrElse' in VB.</summary>
- LogicalOr,
- /// <summary>'^' in C#, 'Xor' in VB.</summary>
- ExclusiveOr,
-
- /// <summary>&gt;</summary>
- GreaterThan,
- /// <summary>&gt;=</summary>
- GreaterThanOrEqual,
- /// <summary>'==' in C#, '=' in VB.</summary>
- Equality,
- /// <summary>'!=' in C#, '&lt;&gt;' in VB.</summary>
- InEquality,
- /// <summary>&lt;</summary>
- LessThan,
- /// <summary>&lt;=</summary>
- LessThanOrEqual,
-
- /// <summary>+</summary>
- Add,
- /// <summary>-</summary>
- Subtract,
- /// <summary>*</summary>
- Multiply,
- /// <summary>/</summary>
- Divide,
- /// <summary>'%' in C#, 'Mod' in VB.</summary>
- Modulus,
- /// <summary>VB-only: \</summary>
- DivideInteger,
- /// <summary>VB-only: ^</summary>
- Power,
- /// <summary>VB-only: &amp;</summary>
- Concat,
-
- /// <summary>C#: &lt;&lt;</summary>
- ShiftLeft,
- /// <summary>C#: &gt;&gt;</summary>
- ShiftRight,
- /// <summary>VB-only: Is</summary>
- ReferenceEquality,
- /// <summary>VB-only: IsNot</summary>
- ReferenceInequality,
-
- /// <summary>VB-only: Like</summary>
- Like,
- /// <summary>
- /// C#: ??
- /// VB: IF(x, y)
- /// </summary>
- NullCoalescing,
-
- /// <summary>VB-only: !</summary>
- DictionaryAccess
- }
-
- public enum CastType
- {
- /// <summary>
- /// direct cast (C#, VB "DirectCast")
- /// </summary>
- Cast,
- /// <summary>
- /// try cast (C# "as", VB "TryCast")
- /// </summary>
- TryCast,
- /// <summary>
- /// converting cast (VB "CType")
- /// </summary>
- Conversion,
- /// <summary>
- /// primitive converting cast (VB "CString" etc.)
- /// </summary>
- PrimitiveConversion
- }
-
- public enum UnaryOperatorType
- {
- None,
- Not,
- BitNot,
-
- Minus,
- Plus,
-
- Increment,
- Decrement,
-
- PostIncrement,
- PostDecrement,
-
- /// <summary>Dereferencing pointer</summary>
- Dereference,
- /// <summary>Get address of</summary>
- AddressOf
- }
-
- public enum ContinueType
- {
- None,
- Do,
- For,
- While
- }
-
- public enum ConditionType
- {
- None,
- Until,
- While,
- DoWhile
- }
-
- public enum ConditionPosition
- {
- None,
- Start,
- End
- }
-
- public enum ExitType
- {
- None,
- Sub,
- Function,
- Property,
- Do,
- For,
- While,
- Select,
- Try
- }
-
- public enum ConstructorInitializerType
- {
- None,
- Base,
- This
- }
-
- public enum ConversionType
- {
- None,
- Implicit,
- Explicit
- }
-
- public enum OverloadableOperatorType
- {
- None,
-
- Add,
- Subtract,
- Multiply,
- Divide,
- Modulus,
- Concat,
-
- Not,
- BitNot,
-
- BitwiseAnd,
- BitwiseOr,
- ExclusiveOr,
-
- ShiftLeft,
- ShiftRight,
-
- GreaterThan,
- GreaterThanOrEqual,
- Equality,
- InEquality,
- LessThan,
- LessThanOrEqual,
-
- Increment,
- Decrement,
-
- IsTrue,
- IsFalse,
-
- // VB specific
- Like,
- Power,
- CType,
- DivideInteger
- }
-
- ///<summary>
- /// Charset types, used in external methods
- /// declarations (VB only).
- ///</summary>
- public enum CharsetModifier
- {
- None,
- Auto,
- Unicode,
- Ansi
- }
-
- ///<summary>
- /// Compare type, used in the <c>Option Compare</c>
- /// pragma (VB only).
- ///</summary>
- public enum OptionType
- {
- None,
- Explicit,
- Strict,
- CompareBinary,
- CompareText,
- Infer
- }
-
- /// <summary>
- /// Specifies the ordering direction of a QueryExpressionOrdering node.
- /// </summary>
- public enum QueryExpressionOrderingDirection
- {
- None,
- Ascending,
- Descending
- }
-
- /// <summary>
- /// Specifies the partition type for a VB.NET
- /// query expression.
- /// </summary>
- public enum QueryExpressionPartitionType
- {
- Take,
- TakeWhile,
- Skip,
- SkipWhile
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
+// <version>$Revision: 4740 $</version>
+// </file>
+
+using System;
+
+namespace ICSharpCode.NRefactory.Ast
+{
+ [Flags]
+ public enum Modifiers
+ {
+ None = 0x0000,
+
+ // Access
+ Private = 0x0001,
+ /// <summary>C# 'internal', VB 'Friend'</summary>
+ Internal = 0x0002,
+ Protected = 0x0004,
+ Public = 0x0008,
+ Dim = 0x0010, // VB.NET SPECIFIC, for fields/local variables only
+
+ // Scope
+ Abstract = 0x0010, // == MustOverride/MustInherit
+ Virtual = 0x0020,
+ Sealed = 0x0040,
+ /// <summary>C# 'static', VB 'Shared'</summary>
+ Static = 0x0080,
+ Override = 0x0100,
+ /// <summary>For fields: readonly (c# and vb), for properties: get-only (vb)</summary>
+ ReadOnly = 0x0200,
+ Const = 0x0400,
+ /// <summary>C# 'new', VB 'Shadows'</summary>
+ New = 0x0800,
+ Partial = 0x1000,
+
+ // Special
+ Extern = 0x2000,
+ Volatile = 0x4000,
+ Unsafe = 0x8000,
+ Overloads = 0x10000, // VB specific
+ WithEvents = 0x20000, // VB specific
+ Default = 0x40000, // VB specific
+ Fixed = 0x80000, // C# specific (fixed size arrays in unsafe structs)
+
+ /// <summary>Generated code, not part of parsed code</summary>
+ Synthetic = 0x200000,
+ /// <summary>Only for VB properties.</summary>
+ WriteOnly = 0x400000, // VB specific
+
+ Visibility = Private | Public | Protected | Internal,
+ Classes = New | Visibility | Abstract | Sealed | Partial | Static,
+ VBModules = Visibility,
+ VBStructures = Visibility | New,
+ VBEnums = Visibility | New,
+ VBInterfacs = Visibility | New,
+ VBDelegates = Visibility | New,
+ VBMethods = Visibility | New | Static | Virtual | Sealed | Abstract | Override | Overloads,
+ VBExternalMethods = Visibility | New | Overloads,
+ VBEvents = Visibility | New | Overloads,
+ VBProperties = VBMethods | Default | ReadOnly | WriteOnly,
+ VBCustomEvents = Visibility | New | Overloads,
+ VBOperators = Public | Static | Overloads | New,
+
+
+ // this is not documented in the spec
+ VBInterfaceEvents = New,
+ VBInterfaceMethods = New | Overloads,
+ VBInterfaceProperties = New | Overloads | ReadOnly | WriteOnly | Default,
+ VBInterfaceEnums = New,
+
+ Fields = New | Visibility | Static | ReadOnly | Volatile | Fixed,
+ PropertysEventsMethods = New | Visibility | Static | Virtual | Sealed | Override | Abstract | Extern,
+ Indexers = New | Visibility | Virtual | Sealed | Override | Abstract | Extern,
+ Operators = Public | Static | Extern,
+ Constants = New | Visibility,
+ StructsInterfacesEnumsDelegates = New | Visibility | Partial,
+ StaticConstructors = Extern | Static | Unsafe,
+ Destructors = Extern | Unsafe,
+ Constructors = Visibility | Extern,
+ }
+
+ public enum ClassType
+ {
+ Class,
+ Module,
+ Interface,
+ Struct,
+ Enum
+ }
+
+ public enum ParentType
+ {
+ ClassOrStruct,
+ InterfaceOrEnum,
+ Namespace,
+ Unknown
+ }
+
+ public enum FieldDirection
+ {
+ None,
+ In,
+ Out,
+ Ref
+ }
+
+ [Flags]
+ public enum ParameterModifiers
+ {
+ // Values must be the same as in SharpDevelop's ParameterModifiers
+ None = 0,
+ In = 1,
+ Out = 2,
+ Ref = 4,
+ Params = 8,
+ Optional = 16
+ }
+
+ public enum AssignmentOperatorType
+ {
+ None,
+ Assign,
+
+ Add,
+ Subtract,
+ Multiply,
+ Divide,
+ Modulus,
+
+ Power, // (VB only)
+ DivideInteger, // (VB only)
+ ConcatString, // (VB only)
+
+ ShiftLeft,
+ ShiftRight,
+
+ BitwiseAnd,
+ BitwiseOr,
+ ExclusiveOr,
+ }
+
+ public enum BinaryOperatorType
+ {
+ None,
+
+ /// <summary>'&amp;' in C#, 'And' in VB.</summary>
+ BitwiseAnd,
+ /// <summary>'|' in C#, 'Or' in VB.</summary>
+ BitwiseOr,
+ /// <summary>'&amp;&amp;' in C#, 'AndAlso' in VB.</summary>
+ LogicalAnd,
+ /// <summary>'||' in C#, 'OrElse' in VB.</summary>
+ LogicalOr,
+ /// <summary>'^' in C#, 'Xor' in VB.</summary>
+ ExclusiveOr,
+
+ /// <summary>&gt;</summary>
+ GreaterThan,
+ /// <summary>&gt;=</summary>
+ GreaterThanOrEqual,
+ /// <summary>'==' in C#, '=' in VB.</summary>
+ Equality,
+ /// <summary>'!=' in C#, '&lt;&gt;' in VB.</summary>
+ InEquality,
+ /// <summary>&lt;</summary>
+ LessThan,
+ /// <summary>&lt;=</summary>
+ LessThanOrEqual,
+
+ /// <summary>+</summary>
+ Add,
+ /// <summary>-</summary>
+ Subtract,
+ /// <summary>*</summary>
+ Multiply,
+ /// <summary>/</summary>
+ Divide,
+ /// <summary>'%' in C#, 'Mod' in VB.</summary>
+ Modulus,
+ /// <summary>VB-only: \</summary>
+ DivideInteger,
+ /// <summary>VB-only: ^</summary>
+ Power,
+ /// <summary>VB-only: &amp;</summary>
+ Concat,
+
+ /// <summary>C#: &lt;&lt;</summary>
+ ShiftLeft,
+ /// <summary>C#: &gt;&gt;</summary>
+ ShiftRight,
+ /// <summary>VB-only: Is</summary>
+ ReferenceEquality,
+ /// <summary>VB-only: IsNot</summary>
+ ReferenceInequality,
+
+ /// <summary>VB-only: Like</summary>
+ Like,
+ /// <summary>
+ /// C#: ??
+ /// VB: IF(x, y)
+ /// </summary>
+ NullCoalescing,
+
+ /// <summary>VB-only: !</summary>
+ DictionaryAccess
+ }
+
+ public enum CastType
+ {
+ /// <summary>
+ /// direct cast (C#, VB "DirectCast")
+ /// </summary>
+ Cast,
+ /// <summary>
+ /// try cast (C# "as", VB "TryCast")
+ /// </summary>
+ TryCast,
+ /// <summary>
+ /// converting cast (VB "CType")
+ /// </summary>
+ Conversion,
+ /// <summary>
+ /// primitive converting cast (VB "CString" etc.)
+ /// </summary>
+ PrimitiveConversion
+ }
+
+ public enum UnaryOperatorType
+ {
+ None,
+ Not,
+ BitNot,
+
+ Minus,
+ Plus,
+
+ Increment,
+ Decrement,
+
+ PostIncrement,
+ PostDecrement,
+
+ /// <summary>Dereferencing pointer</summary>
+ Dereference,
+ /// <summary>Get address of</summary>
+ AddressOf
+ }
+
+ public enum ContinueType
+ {
+ None,
+ Do,
+ For,
+ While
+ }
+
+ public enum ConditionType
+ {
+ None,
+ Until,
+ While,
+ DoWhile
+ }
+
+ public enum ConditionPosition
+ {
+ None,
+ Start,
+ End
+ }
+
+ public enum ExitType
+ {
+ None,
+ Sub,
+ Function,
+ Property,
+ Do,
+ For,
+ While,
+ Select,
+ Try
+ }
+
+ public enum ConstructorInitializerType
+ {
+ None,
+ Base,
+ This
+ }
+
+ public enum ConversionType
+ {
+ None,
+ Implicit,
+ Explicit
+ }
+
+ public enum OverloadableOperatorType
+ {
+ None,
+
+ Add,
+ Subtract,
+ Multiply,
+ Divide,
+ Modulus,
+ Concat,
+
+ UnaryPlus,
+ UnaryMinus,
+
+ Not,
+ BitNot,
+
+ BitwiseAnd,
+ BitwiseOr,
+ ExclusiveOr,
+
+ ShiftLeft,
+ ShiftRight,
+
+ GreaterThan,
+ GreaterThanOrEqual,
+ Equality,
+ InEquality,
+ LessThan,
+ LessThanOrEqual,
+
+ Increment,
+ Decrement,
+
+ IsTrue,
+ IsFalse,
+
+ // VB specific
+ Like,
+ Power,
+ CType,
+ DivideInteger
+ }
+
+ ///<summary>
+ /// Charset types, used in external methods
+ /// declarations (VB only).
+ ///</summary>
+ public enum CharsetModifier
+ {
+ None,
+ Auto,
+ Unicode,
+ Ansi
+ }
+
+ ///<summary>
+ /// Compare type, used in the <c>Option Compare</c>
+ /// pragma (VB only).
+ ///</summary>
+ public enum OptionType
+ {
+ None,
+ Explicit,
+ Strict,
+ CompareBinary,
+ CompareText,
+ Infer
+ }
+
+ /// <summary>
+ /// Specifies the ordering direction of a QueryExpressionOrdering node.
+ /// </summary>
+ public enum QueryExpressionOrderingDirection
+ {
+ None,
+ Ascending,
+ Descending
+ }
+
+ /// <summary>
+ /// Specifies the partition type for a VB.NET
+ /// query expression.
+ /// </summary>
+ public enum QueryExpressionPartitionType
+ {
+ Take,
+ TakeWhile,
+ Skip,
+ SkipWhile
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Ast/General/BlockStatement.cs b/main/contrib/NRefactory/Project/Src/Ast/General/BlockStatement.cs
index 2ce0ba5f00..2f0238a286 100644
--- a/main/contrib/NRefactory/Project/Src/Ast/General/BlockStatement.cs
+++ b/main/contrib/NRefactory/Project/Src/Ast/General/BlockStatement.cs
@@ -1,63 +1,63 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="none" email=""/>
-// <version>$Revision: 2191 $</version>
-// </file>
-
-using System;
-
-namespace ICSharpCode.NRefactory.Ast
-{
- public class BlockStatement : Statement
- {
- // Children in C#: LabelStatement, LocalVariableDeclaration, Statement
- // Children in VB: LabelStatement, EndStatement, Statement
-
- public static new BlockStatement Null {
- get {
- return NullBlockStatement.Instance;
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data)
- {
- return visitor.VisitBlockStatement(this, data);
- }
-
- public override string ToString()
- {
- return String.Format("[BlockStatement: Children={0}]",
- GetCollectionString(base.Children));
- }
- }
-
- internal sealed class NullBlockStatement : BlockStatement
- {
- public static readonly NullBlockStatement Instance = new NullBlockStatement();
-
- public override bool IsNull {
- get {
- return true;
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data)
- {
- return data;
- }
- public override object AcceptChildren(IAstVisitor visitor, object data)
- {
- return data;
- }
- public override void AddChild(INode childNode)
- {
- throw new InvalidOperationException();
- }
-
- public override string ToString()
- {
- return String.Format("[NullBlockStatement]");
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="none" email=""/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+
+namespace ICSharpCode.NRefactory.Ast
+{
+ public class BlockStatement : Statement
+ {
+ // Children in C#: LabelStatement, LocalVariableDeclaration, Statement
+ // Children in VB: LabelStatement, EndStatement, Statement
+
+ public static new BlockStatement Null {
+ get {
+ return NullBlockStatement.Instance;
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data)
+ {
+ return visitor.VisitBlockStatement(this, data);
+ }
+
+ public override string ToString()
+ {
+ return String.Format("[BlockStatement: Children={0}]",
+ GetCollectionString(base.Children));
+ }
+ }
+
+ internal sealed class NullBlockStatement : BlockStatement
+ {
+ public static readonly NullBlockStatement Instance = new NullBlockStatement();
+
+ public override bool IsNull {
+ get {
+ return true;
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data)
+ {
+ return data;
+ }
+ public override object AcceptChildren(IAstVisitor visitor, object data)
+ {
+ return data;
+ }
+ public override void AddChild(INode childNode)
+ {
+ throw new InvalidOperationException();
+ }
+
+ public override string ToString()
+ {
+ return String.Format("[NullBlockStatement]");
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Ast/General/CompilationUnit.cs b/main/contrib/NRefactory/Project/Src/Ast/General/CompilationUnit.cs
index dc27166dc1..ac2ecc8f0e 100644
--- a/main/contrib/NRefactory/Project/Src/Ast/General/CompilationUnit.cs
+++ b/main/contrib/NRefactory/Project/Src/Ast/General/CompilationUnit.cs
@@ -1,60 +1,60 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1965 $</version>
-// </file>
-
-using System;
-using System.Collections;
-
-namespace ICSharpCode.NRefactory.Ast
-{
- public class CompilationUnit : AbstractNode
- {
- // Children in C#: UsingAliasDeclaration, UsingDeclaration, AttributeSection, NamespaceDeclaration
- // Children in VB: OptionStatements, ImportsStatement, AttributeSection, NamespaceDeclaration
-
- Stack blockStack = new Stack();
-
- public CompilationUnit()
- {
- blockStack.Push(this);
- }
-
- public void BlockStart(INode block)
- {
- blockStack.Push(block);
- }
-
- public void BlockEnd()
- {
- blockStack.Pop();
- }
-
- public INode CurrentBock {
- get {
- return blockStack.Count > 0 ? (INode)blockStack.Peek() : null;
- }
- }
-
- public override void AddChild(INode childNode)
- {
- if (childNode != null) {
- INode parent = (INode)blockStack.Peek();
- parent.Children.Add(childNode);
- childNode.Parent = parent;
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data)
- {
- return visitor.VisitCompilationUnit(this, data);
- }
-
- public override string ToString()
- {
- return String.Format("[CompilationUnit]");
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+using System.Collections;
+
+namespace ICSharpCode.NRefactory.Ast
+{
+ public class CompilationUnit : AbstractNode
+ {
+ // Children in C#: UsingAliasDeclaration, UsingDeclaration, AttributeSection, NamespaceDeclaration
+ // Children in VB: OptionStatements, ImportsStatement, AttributeSection, NamespaceDeclaration
+
+ Stack blockStack = new Stack();
+
+ public CompilationUnit()
+ {
+ blockStack.Push(this);
+ }
+
+ public void BlockStart(INode block)
+ {
+ blockStack.Push(block);
+ }
+
+ public void BlockEnd()
+ {
+ blockStack.Pop();
+ }
+
+ public INode CurrentBock {
+ get {
+ return blockStack.Count > 0 ? (INode)blockStack.Peek() : null;
+ }
+ }
+
+ public override void AddChild(INode childNode)
+ {
+ if (childNode != null) {
+ INode parent = (INode)blockStack.Peek();
+ parent.Children.Add(childNode);
+ childNode.Parent = parent;
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data)
+ {
+ return visitor.VisitCompilationUnit(this, data);
+ }
+
+ public override string ToString()
+ {
+ return String.Format("[CompilationUnit]");
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Ast/General/Expression.cs b/main/contrib/NRefactory/Project/Src/Ast/General/Expression.cs
index ed1ec4a066..56da9dcb0f 100644
--- a/main/contrib/NRefactory/Project/Src/Ast/General/Expression.cs
+++ b/main/contrib/NRefactory/Project/Src/Ast/General/Expression.cs
@@ -1,107 +1,107 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 2202 $</version>
-// </file>
-
-using System;
-
-namespace ICSharpCode.NRefactory.Ast
-{
- public abstract class Expression : AbstractNode, INullable
- {
- public static Expression Null {
- get {
- return NullExpression.Instance;
- }
- }
-
- public virtual bool IsNull {
- get {
- return false;
- }
- }
-
- public static Expression CheckNull(Expression expression)
- {
- return expression == null ? NullExpression.Instance : expression;
- }
-
- /// <summary>
- /// Returns the existing expression plus the specified integer value.
- /// The old <paramref name="expr"/> object is not modified, but might be a subobject on the new expression
- /// (and thus its parent property is modified).
- /// </summary>
- public static Expression AddInteger(Expression expr, int value)
- {
- PrimitiveExpression pe = expr as PrimitiveExpression;
- if (pe != null && pe.Value is int) {
- int newVal = (int)pe.Value + value;
- return new PrimitiveExpression(newVal, newVal.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
- }
- BinaryOperatorExpression boe = expr as BinaryOperatorExpression;
- if (boe != null && boe.Op == BinaryOperatorType.Add) {
- // clone boe:
- boe = new BinaryOperatorExpression(boe.Left, boe.Op, boe.Right);
-
- boe.Right = AddInteger(boe.Right, value);
- if (boe.Right is PrimitiveExpression && ((PrimitiveExpression)boe.Right).Value is int) {
- int newVal = (int)((PrimitiveExpression)boe.Right).Value;
- if (newVal == 0) {
- return boe.Left;
- } else if (newVal < 0) {
- ((PrimitiveExpression)boe.Right).Value = -newVal;
- boe.Op = BinaryOperatorType.Subtract;
- }
- }
- return boe;
- }
- if (boe != null && boe.Op == BinaryOperatorType.Subtract) {
- pe = boe.Right as PrimitiveExpression;
- if (pe != null && pe.Value is int) {
- int newVal = (int)pe.Value - value;
- if (newVal == 0)
- return boe.Left;
-
- // clone boe:
- boe = new BinaryOperatorExpression(boe.Left, boe.Op, boe.Right);
-
- if (newVal < 0) {
- newVal = -newVal;
- boe.Op = BinaryOperatorType.Add;
- }
- boe.Right = new PrimitiveExpression(newVal, newVal.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
- return boe;
- }
- }
- BinaryOperatorType opType = BinaryOperatorType.Add;
- if (value < 0) {
- value = -value;
- opType = BinaryOperatorType.Subtract;
- }
- return new BinaryOperatorExpression(expr, opType, new PrimitiveExpression(value, value.ToString(System.Globalization.NumberFormatInfo.InvariantInfo)));
- }
- }
-
- internal sealed class NullExpression : Expression
- {
- internal static readonly NullExpression Instance = new NullExpression();
-
- public override bool IsNull {
- get {
- return true;
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data)
- {
- return null;
- }
-
- public override string ToString()
- {
- return String.Format("[NullExpression]");
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+
+namespace ICSharpCode.NRefactory.Ast
+{
+ public abstract class Expression : AbstractNode, INullable
+ {
+ public static Expression Null {
+ get {
+ return NullExpression.Instance;
+ }
+ }
+
+ public virtual bool IsNull {
+ get {
+ return false;
+ }
+ }
+
+ public static Expression CheckNull(Expression expression)
+ {
+ return expression == null ? NullExpression.Instance : expression;
+ }
+
+ /// <summary>
+ /// Returns the existing expression plus the specified integer value.
+ /// The old <paramref name="expr"/> object is not modified, but might be a subobject on the new expression
+ /// (and thus its parent property is modified).
+ /// </summary>
+ public static Expression AddInteger(Expression expr, int value)
+ {
+ PrimitiveExpression pe = expr as PrimitiveExpression;
+ if (pe != null && pe.Value is int) {
+ int newVal = (int)pe.Value + value;
+ return new PrimitiveExpression(newVal, newVal.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
+ }
+ BinaryOperatorExpression boe = expr as BinaryOperatorExpression;
+ if (boe != null && boe.Op == BinaryOperatorType.Add) {
+ // clone boe:
+ boe = new BinaryOperatorExpression(boe.Left, boe.Op, boe.Right);
+
+ boe.Right = AddInteger(boe.Right, value);
+ if (boe.Right is PrimitiveExpression && ((PrimitiveExpression)boe.Right).Value is int) {
+ int newVal = (int)((PrimitiveExpression)boe.Right).Value;
+ if (newVal == 0) {
+ return boe.Left;
+ } else if (newVal < 0) {
+ ((PrimitiveExpression)boe.Right).Value = -newVal;
+ boe.Op = BinaryOperatorType.Subtract;
+ }
+ }
+ return boe;
+ }
+ if (boe != null && boe.Op == BinaryOperatorType.Subtract) {
+ pe = boe.Right as PrimitiveExpression;
+ if (pe != null && pe.Value is int) {
+ int newVal = (int)pe.Value - value;
+ if (newVal == 0)
+ return boe.Left;
+
+ // clone boe:
+ boe = new BinaryOperatorExpression(boe.Left, boe.Op, boe.Right);
+
+ if (newVal < 0) {
+ newVal = -newVal;
+ boe.Op = BinaryOperatorType.Add;
+ }
+ boe.Right = new PrimitiveExpression(newVal, newVal.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
+ return boe;
+ }
+ }
+ BinaryOperatorType opType = BinaryOperatorType.Add;
+ if (value < 0) {
+ value = -value;
+ opType = BinaryOperatorType.Subtract;
+ }
+ return new BinaryOperatorExpression(expr, opType, new PrimitiveExpression(value, value.ToString(System.Globalization.NumberFormatInfo.InvariantInfo)));
+ }
+ }
+
+ internal sealed class NullExpression : Expression
+ {
+ internal static readonly NullExpression Instance = new NullExpression();
+
+ public override bool IsNull {
+ get {
+ return true;
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data)
+ {
+ return null;
+ }
+
+ public override string ToString()
+ {
+ return String.Format("[NullExpression]");
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Ast/General/LocalVariableDeclaration.cs b/main/contrib/NRefactory/Project/Src/Ast/General/LocalVariableDeclaration.cs
index 0fa295f015..7cbb18846f 100644
--- a/main/contrib/NRefactory/Project/Src/Ast/General/LocalVariableDeclaration.cs
+++ b/main/contrib/NRefactory/Project/Src/Ast/General/LocalVariableDeclaration.cs
@@ -1,103 +1,103 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="none" email=""/>
-// <version>$Revision: 3717 $</version>
-// </file>
-
-using System;
-using System.Collections.Generic;
-
-namespace ICSharpCode.NRefactory.Ast
-{
- public class LocalVariableDeclaration : Statement
- {
- TypeReference typeReference;
- Modifiers modifier = Modifiers.None;
- List<VariableDeclaration> variables = new List<VariableDeclaration>();
-
- public TypeReference TypeReference {
- get {
- return typeReference;
- }
- set {
- typeReference = TypeReference.CheckNull(value);
- if (!typeReference.IsNull) typeReference.Parent = this;
- }
- }
-
- public Modifiers Modifier {
- get {
- return modifier;
- }
- set {
- modifier = value;
- }
- }
-
- public List<VariableDeclaration> Variables {
- get {
- return variables;
- }
- }
-
- public TypeReference GetTypeForVariable(int variableIndex)
- {
- if (!typeReference.IsNull) {
- return typeReference;
- }
-
- for (int i = variableIndex; i < Variables.Count;++i) {
- if (!((VariableDeclaration)Variables[i]).TypeReference.IsNull) {
- return ((VariableDeclaration)Variables[i]).TypeReference;
- }
- }
- return null;
- }
-
- public LocalVariableDeclaration(VariableDeclaration declaration) : this(TypeReference.Null)
- {
- Variables.Add(declaration);
- }
-
- public LocalVariableDeclaration(TypeReference typeReference)
- {
- this.TypeReference = typeReference;
- }
-
- public LocalVariableDeclaration(TypeReference typeReference, Modifiers modifier)
- {
- this.TypeReference = typeReference;
- this.modifier = modifier;
- }
-
- public LocalVariableDeclaration(Modifiers modifier)
- {
- this.typeReference = TypeReference.Null;
- this.modifier = modifier;
- }
-
- public VariableDeclaration GetVariableDeclaration(string variableName)
- {
- foreach (VariableDeclaration variableDeclaration in variables) {
- if (variableDeclaration.Name == variableName) {
- return variableDeclaration;
- }
- }
- return null;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data)
- {
- return visitor.VisitLocalVariableDeclaration(this, data);
- }
-
- public override string ToString()
- {
- return String.Format("[LocalVariableDeclaration: Type={0}, Modifier ={1} Variables={2}]",
- typeReference,
- modifier,
- GetCollectionString(variables));
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="none" email=""/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+using System.Collections.Generic;
+
+namespace ICSharpCode.NRefactory.Ast
+{
+ public class LocalVariableDeclaration : Statement
+ {
+ TypeReference typeReference;
+ Modifiers modifier = Modifiers.None;
+ List<VariableDeclaration> variables = new List<VariableDeclaration>();
+
+ public TypeReference TypeReference {
+ get {
+ return typeReference;
+ }
+ set {
+ typeReference = TypeReference.CheckNull(value);
+ if (!typeReference.IsNull) typeReference.Parent = this;
+ }
+ }
+
+ public Modifiers Modifier {
+ get {
+ return modifier;
+ }
+ set {
+ modifier = value;
+ }
+ }
+
+ public List<VariableDeclaration> Variables {
+ get {
+ return variables;
+ }
+ }
+
+ public TypeReference GetTypeForVariable(int variableIndex)
+ {
+ if (!typeReference.IsNull) {
+ return typeReference;
+ }
+
+ for (int i = variableIndex; i < Variables.Count;++i) {
+ if (!((VariableDeclaration)Variables[i]).TypeReference.IsNull) {
+ return ((VariableDeclaration)Variables[i]).TypeReference;
+ }
+ }
+ return null;
+ }
+
+ public LocalVariableDeclaration(VariableDeclaration declaration) : this(TypeReference.Null)
+ {
+ Variables.Add(declaration);
+ }
+
+ public LocalVariableDeclaration(TypeReference typeReference)
+ {
+ this.TypeReference = typeReference;
+ }
+
+ public LocalVariableDeclaration(TypeReference typeReference, Modifiers modifier)
+ {
+ this.TypeReference = typeReference;
+ this.modifier = modifier;
+ }
+
+ public LocalVariableDeclaration(Modifiers modifier)
+ {
+ this.typeReference = TypeReference.Null;
+ this.modifier = modifier;
+ }
+
+ public VariableDeclaration GetVariableDeclaration(string variableName)
+ {
+ foreach (VariableDeclaration variableDeclaration in variables) {
+ if (variableDeclaration.Name == variableName) {
+ return variableDeclaration;
+ }
+ }
+ return null;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data)
+ {
+ return visitor.VisitLocalVariableDeclaration(this, data);
+ }
+
+ public override string ToString()
+ {
+ return String.Format("[LocalVariableDeclaration: Type={0}, Modifier ={1} Variables={2}]",
+ typeReference,
+ modifier,
+ GetCollectionString(variables));
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Ast/General/PrimitiveExpression.cs b/main/contrib/NRefactory/Project/Src/Ast/General/PrimitiveExpression.cs
index 16a303020b..7dfac88de6 100644
--- a/main/contrib/NRefactory/Project/Src/Ast/General/PrimitiveExpression.cs
+++ b/main/contrib/NRefactory/Project/Src/Ast/General/PrimitiveExpression.cs
@@ -1,57 +1,57 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="none" email=""/>
-// <version>$Revision: 3832 $</version>
-// </file>
-
-using ICSharpCode.NRefactory.PrettyPrinter;
-using System;
-
-namespace ICSharpCode.NRefactory.Ast
-{
- public class PrimitiveExpression : Expression
- {
- string stringValue;
-
- public Parser.LiteralFormat LiteralFormat { get; set; }
- public object Value { get; set; }
-
- public string StringValue {
- get {
- if (stringValue == null)
- return CSharpOutputVisitor.ToCSharpString(this);
- else
- return stringValue;
- }
- set {
- stringValue = value == null ? String.Empty : value;
- }
- }
-
- public PrimitiveExpression(object val)
- {
- this.Value = val;
- }
-
- public PrimitiveExpression(object val, string stringValue)
- {
- this.Value = val;
- this.StringValue = stringValue;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data)
- {
- return visitor.VisitPrimitiveExpression(this, data);
- }
-
- public override string ToString()
- {
- return String.Format("[PrimitiveExpression: Value={1}, ValueType={2}, StringValue={0}]",
- this.StringValue,
- this.Value,
- this.Value == null ? "null" : this.Value.GetType().FullName
- );
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="none" email=""/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using ICSharpCode.NRefactory.PrettyPrinter;
+using System;
+
+namespace ICSharpCode.NRefactory.Ast
+{
+ public class PrimitiveExpression : Expression
+ {
+ string stringValue;
+
+ public Parser.LiteralFormat LiteralFormat { get; set; }
+ public object Value { get; set; }
+
+ public string StringValue {
+ get {
+ if (stringValue == null)
+ return CSharpOutputVisitor.ToCSharpString(this);
+ else
+ return stringValue;
+ }
+ set {
+ stringValue = value == null ? String.Empty : value;
+ }
+ }
+
+ public PrimitiveExpression(object val)
+ {
+ this.Value = val;
+ }
+
+ public PrimitiveExpression(object val, string stringValue)
+ {
+ this.Value = val;
+ this.StringValue = stringValue;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data)
+ {
+ return visitor.VisitPrimitiveExpression(this, data);
+ }
+
+ public override string ToString()
+ {
+ return String.Format("[PrimitiveExpression: Value={1}, ValueType={2}, StringValue={0}]",
+ this.StringValue,
+ this.Value,
+ this.Value == null ? "null" : this.Value.GetType().FullName
+ );
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Ast/General/Statement.cs b/main/contrib/NRefactory/Project/Src/Ast/General/Statement.cs
index 5d553135d9..6ceb4cff7d 100644
--- a/main/contrib/NRefactory/Project/Src/Ast/General/Statement.cs
+++ b/main/contrib/NRefactory/Project/Src/Ast/General/Statement.cs
@@ -1,66 +1,66 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 2191 $</version>
-// </file>
-
-using System;
-
-namespace ICSharpCode.NRefactory.Ast
-{
- public abstract class Statement : AbstractNode, INullable
- {
- public static Statement Null {
- get {
- return NullStatement.Instance;
- }
- }
-
- public virtual bool IsNull {
- get {
- return false;
- }
- }
-
- public static Statement CheckNull(Statement statement)
- {
- return statement ?? NullStatement.Instance;
- }
- }
-
- public abstract class StatementWithEmbeddedStatement : Statement
- {
- Statement embeddedStatement;
-
- public Statement EmbeddedStatement {
- get {
- return embeddedStatement;
- }
- set {
- embeddedStatement = Statement.CheckNull(value);
- if (value != null)
- value.Parent = this;
- }
- }
- }
-
- internal sealed class NullStatement : Statement
- {
- public static readonly NullStatement Instance = new NullStatement();
-
- public override bool IsNull {
- get { return true; }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data)
- {
- return data;
- }
-
- public override string ToString()
- {
- return String.Format("[NullStatement]");
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+
+namespace ICSharpCode.NRefactory.Ast
+{
+ public abstract class Statement : AbstractNode, INullable
+ {
+ public static Statement Null {
+ get {
+ return NullStatement.Instance;
+ }
+ }
+
+ public virtual bool IsNull {
+ get {
+ return false;
+ }
+ }
+
+ public static Statement CheckNull(Statement statement)
+ {
+ return statement ?? NullStatement.Instance;
+ }
+ }
+
+ public abstract class StatementWithEmbeddedStatement : Statement
+ {
+ Statement embeddedStatement;
+
+ public Statement EmbeddedStatement {
+ get {
+ return embeddedStatement;
+ }
+ set {
+ embeddedStatement = Statement.CheckNull(value);
+ if (value != null)
+ value.Parent = this;
+ }
+ }
+ }
+
+ internal sealed class NullStatement : Statement
+ {
+ public static readonly NullStatement Instance = new NullStatement();
+
+ public override bool IsNull {
+ get { return true; }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data)
+ {
+ return data;
+ }
+
+ public override string ToString()
+ {
+ return String.Format("[NullStatement]");
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Ast/Generated.cs b/main/contrib/NRefactory/Project/Src/Ast/Generated.cs
index 50834a6b5e..e0a5e9f504 100644
--- a/main/contrib/NRefactory/Project/Src/Ast/Generated.cs
+++ b/main/contrib/NRefactory/Project/Src/Ast/Generated.cs
@@ -1,5438 +1,5438 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:2.0.50727.3053
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace ICSharpCode.NRefactory.Ast {
- using System;
- using System.Collections.Generic;
-
-
- public class AddHandlerStatement : Statement {
-
- Expression eventExpression;
-
- Expression handlerExpression;
-
- public Expression EventExpression {
- get {
- return eventExpression;
- }
- set {
- eventExpression = value ?? Expression.Null;
- if (!eventExpression.IsNull) eventExpression.Parent = this;
- }
- }
-
- public Expression HandlerExpression {
- get {
- return handlerExpression;
- }
- set {
- handlerExpression = value ?? Expression.Null;
- if (!handlerExpression.IsNull) handlerExpression.Parent = this;
- }
- }
-
- public AddHandlerStatement(Expression eventExpression, Expression handlerExpression) {
- EventExpression = eventExpression;
- HandlerExpression = handlerExpression;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitAddHandlerStatement(this, data);
- }
-
- public override string ToString() {
- return string.Format("[AddHandlerStatement EventExpression={0} HandlerExpression={1}]", EventExpression, HandlerExpression);
- }
- }
-
- public class AddressOfExpression : Expression {
-
- Expression expression;
-
- public Expression Expression {
- get {
- return expression;
- }
- set {
- expression = value ?? Expression.Null;
- if (!expression.IsNull) expression.Parent = this;
- }
- }
-
- public AddressOfExpression(Expression expression) {
- Expression = expression;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitAddressOfExpression(this, data);
- }
-
- public override string ToString() {
- return string.Format("[AddressOfExpression Expression={0}]", Expression);
- }
- }
-
- public class AnonymousMethodExpression : Expression {
-
- List<ParameterDeclarationExpression> parameters;
-
- BlockStatement body;
-
- bool hasParameterList;
-
- public List<ParameterDeclarationExpression> Parameters {
- get {
- return parameters;
- }
- set {
- parameters = value ?? new List<ParameterDeclarationExpression>();
- }
- }
-
- public BlockStatement Body {
- get {
- return body;
- }
- set {
- body = value ?? BlockStatement.Null;
- if (!body.IsNull) body.Parent = this;
- }
- }
-
- public bool HasParameterList {
- get {
- return hasParameterList;
- }
- set {
- hasParameterList = value;
- }
- }
-
- public AnonymousMethodExpression() {
- parameters = new List<ParameterDeclarationExpression>();
- body = BlockStatement.Null;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitAnonymousMethodExpression(this, data);
- }
-
- public override string ToString() {
- return string.Format("[AnonymousMethodExpression Parameters={0} Body={1} HasParameterList={2}]", GetCollectionString(Parameters), Body, HasParameterList);
- }
- }
-
- public class ArrayCreateExpression : Expression {
-
- TypeReference createType;
-
- List<Expression> arguments;
-
- CollectionInitializerExpression arrayInitializer;
-
- public TypeReference CreateType {
- get {
- return createType;
- }
- set {
- createType = value ?? TypeReference.Null;
- if (!createType.IsNull) createType.Parent = this;
- }
- }
-
- public List<Expression> Arguments {
- get {
- return arguments;
- }
- set {
- arguments = value ?? new List<Expression>();
- }
- }
-
- public CollectionInitializerExpression ArrayInitializer {
- get {
- return arrayInitializer;
- }
- set {
- arrayInitializer = value ?? CollectionInitializerExpression.Null;
- if (!arrayInitializer.IsNull) arrayInitializer.Parent = this;
- }
- }
-
- public ArrayCreateExpression(TypeReference createType) {
- CreateType = createType;
- arguments = new List<Expression>();
- arrayInitializer = CollectionInitializerExpression.Null;
- }
-
- public ArrayCreateExpression(TypeReference createType, List<Expression> arguments) {
- CreateType = createType;
- Arguments = arguments;
- arrayInitializer = CollectionInitializerExpression.Null;
- }
-
- public ArrayCreateExpression(TypeReference createType, CollectionInitializerExpression arrayInitializer) {
- CreateType = createType;
- ArrayInitializer = arrayInitializer;
- arguments = new List<Expression>();
- }
-
- public bool IsImplicitlyTyped {
- get {
- return createType.IsNull || string.IsNullOrEmpty(createType.Type);
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitArrayCreateExpression(this, data);
- }
-
- public override string ToString() {
- return string.Format("[ArrayCreateExpression CreateType={0} Arguments={1} ArrayInitializer={2}]", CreateType, GetCollectionString(Arguments), ArrayInitializer);
- }
- }
-
- public class AssignmentExpression : Expression {
-
- Expression left;
-
- AssignmentOperatorType op;
-
- Expression right;
-
- public Expression Left {
- get {
- return left;
- }
- set {
- left = value ?? Expression.Null;
- if (!left.IsNull) left.Parent = this;
- }
- }
-
- public AssignmentOperatorType Op {
- get {
- return op;
- }
- set {
- op = value;
- }
- }
-
- public Expression Right {
- get {
- return right;
- }
- set {
- right = value ?? Expression.Null;
- if (!right.IsNull) right.Parent = this;
- }
- }
-
- public AssignmentExpression(Expression left, AssignmentOperatorType op, Expression right) {
- Left = left;
- Op = op;
- Right = right;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitAssignmentExpression(this, data);
- }
-
- public override string ToString() {
- return string.Format("[AssignmentExpression Left={0} Op={1} Right={2}]", Left, Op, Right);
- }
- }
-
- public class Attribute : AbstractNode {
-
- string name;
-
- List<Expression> positionalArguments;
-
- List<NamedArgumentExpression> namedArguments;
-
- public string Name {
- get {
- return name;
- }
- set {
- name = value ?? "";
- }
- }
-
- public List<Expression> PositionalArguments {
- get {
- return positionalArguments;
- }
- set {
- positionalArguments = value ?? new List<Expression>();
- }
- }
-
- public List<NamedArgumentExpression> NamedArguments {
- get {
- return namedArguments;
- }
- set {
- namedArguments = value ?? new List<NamedArgumentExpression>();
- }
- }
-
- public Attribute() {
- name = "";
- positionalArguments = new List<Expression>();
- namedArguments = new List<NamedArgumentExpression>();
- }
-
- public Attribute(string name, List<Expression> positionalArguments, List<NamedArgumentExpression> namedArguments) {
- Name = name;
- PositionalArguments = positionalArguments;
- NamedArguments = namedArguments;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitAttribute(this, data);
- }
-
- public override string ToString() {
- return string.Format("[Attribute Name={0} PositionalArguments={1} NamedArguments={2}]", Name, GetCollectionString(PositionalArguments), GetCollectionString(NamedArguments));
- }
- }
-
- public abstract class AttributedNode : AbstractNode {
-
- List<AttributeSection> attributes;
-
- Modifiers modifier;
-
- public List<AttributeSection> Attributes {
- get {
- return attributes;
- }
- set {
- attributes = value ?? new List<AttributeSection>();
- }
- }
-
- public Modifiers Modifier {
- get {
- return modifier;
- }
- set {
- modifier = value;
- }
- }
-
- protected AttributedNode() {
- attributes = new List<AttributeSection>();
- }
-
- protected AttributedNode(List<AttributeSection> attributes) {
- Attributes = attributes;
- }
-
- protected AttributedNode(Modifiers modifier, List<AttributeSection> attributes) {
- Modifier = modifier;
- Attributes = attributes;
- }
- }
-
- public class AttributeSection : AbstractNode {
-
- string attributeTarget;
-
- List<ICSharpCode.NRefactory.Ast.Attribute> attributes;
-
- public string AttributeTarget {
- get {
- return attributeTarget;
- }
- set {
- attributeTarget = value ?? "";
- }
- }
-
- public List<ICSharpCode.NRefactory.Ast.Attribute> Attributes {
- get {
- return attributes;
- }
- set {
- attributes = value ?? new List<Attribute>();
- }
- }
-
- public AttributeSection() {
- attributeTarget = "";
- attributes = new List<Attribute>();
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitAttributeSection(this, data);
- }
-
- public override string ToString() {
- return string.Format("[AttributeSection AttributeTarget={0} Attributes={1}]", AttributeTarget, GetCollectionString(Attributes));
- }
- }
-
- public class BaseReferenceExpression : Expression {
-
- public BaseReferenceExpression() {
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitBaseReferenceExpression(this, data);
- }
-
- public override string ToString() {
- return "[BaseReferenceExpression]";
- }
- }
-
- public class BinaryOperatorExpression : Expression {
-
- Expression left;
-
- BinaryOperatorType op;
-
- Expression right;
-
- public Expression Left {
- get {
- return left;
- }
- set {
- left = value ?? Expression.Null;
- if (!left.IsNull) left.Parent = this;
- }
- }
-
- public BinaryOperatorType Op {
- get {
- return op;
- }
- set {
- op = value;
- }
- }
-
- public Expression Right {
- get {
- return right;
- }
- set {
- right = value ?? Expression.Null;
- if (!right.IsNull) right.Parent = this;
- }
- }
-
- public BinaryOperatorExpression() {
- left = Expression.Null;
- right = Expression.Null;
- }
-
- public BinaryOperatorExpression(Expression left, BinaryOperatorType op, Expression right) {
- Left = left;
- Op = op;
- Right = right;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitBinaryOperatorExpression(this, data);
- }
-
- public override string ToString() {
- return string.Format("[BinaryOperatorExpression Left={0} Op={1} Right={2}]", Left, Op, Right);
- }
- }
-
- public class BreakStatement : Statement {
-
- public BreakStatement() {
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitBreakStatement(this, data);
- }
-
- public override string ToString() {
- return "[BreakStatement]";
- }
- }
-
- public class CaseLabel : AbstractNode {
-
- Expression label;
-
- BinaryOperatorType binaryOperatorType;
-
- Expression toExpression;
-
- public Expression Label {
- get {
- return label;
- }
- set {
- label = value ?? Expression.Null;
- if (!label.IsNull) label.Parent = this;
- }
- }
-
- public BinaryOperatorType BinaryOperatorType {
- get {
- return binaryOperatorType;
- }
- set {
- binaryOperatorType = value;
- }
- }
-
- public Expression ToExpression {
- get {
- return toExpression;
- }
- set {
- toExpression = value ?? Expression.Null;
- if (!toExpression.IsNull) toExpression.Parent = this;
- }
- }
-
- public CaseLabel() {
- label = Expression.Null;
- toExpression = Expression.Null;
- }
-
- public CaseLabel(Expression label) {
- Label = label;
- toExpression = Expression.Null;
- }
-
- public CaseLabel(Expression label, Expression toExpression) {
- Label = label;
- ToExpression = toExpression;
- }
-
- public CaseLabel(BinaryOperatorType binaryOperatorType, Expression label) {
- BinaryOperatorType = binaryOperatorType;
- Label = label;
- toExpression = Expression.Null;
- }
-
- public bool IsDefault {
- get {
- return label.IsNull;
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitCaseLabel(this, data);
- }
-
- public override string ToString() {
- return string.Format("[CaseLabel Label={0} BinaryOperatorType={1} ToExpression={2}]", Label, BinaryOperatorType, ToExpression);
- }
- }
-
- public class CastExpression : Expression {
-
- TypeReference castTo;
-
- Expression expression;
-
- CastType castType;
-
- public TypeReference CastTo {
- get {
- return castTo;
- }
- set {
- castTo = value ?? TypeReference.Null;
- if (!castTo.IsNull) castTo.Parent = this;
- }
- }
-
- public Expression Expression {
- get {
- return expression;
- }
- set {
- expression = value ?? Expression.Null;
- if (!expression.IsNull) expression.Parent = this;
- }
- }
-
- public CastType CastType {
- get {
- return castType;
- }
- set {
- castType = value;
- }
- }
-
- public CastExpression(TypeReference castTo) {
- CastTo = castTo;
- expression = Expression.Null;
- }
-
- public CastExpression(TypeReference castTo, Expression expression, CastType castType) {
- CastTo = castTo;
- Expression = expression;
- CastType = castType;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitCastExpression(this, data);
- }
-
- public override string ToString() {
- return string.Format("[CastExpression CastTo={0} Expression={1} CastType={2}]", CastTo, Expression, CastType);
- }
- }
-
- public class CatchClause : AbstractNode {
-
- TypeReference typeReference;
-
- string variableName;
-
- Statement statementBlock;
-
- Expression condition;
-
- public TypeReference TypeReference {
- get {
- return typeReference;
- }
- set {
- typeReference = value ?? TypeReference.Null;
- if (!typeReference.IsNull) typeReference.Parent = this;
- }
- }
-
- public string VariableName {
- get {
- return variableName;
- }
- set {
- variableName = value ?? "";
- }
- }
-
- public Statement StatementBlock {
- get {
- return statementBlock;
- }
- set {
- statementBlock = value ?? Statement.Null;
- if (!statementBlock.IsNull) statementBlock.Parent = this;
- }
- }
-
- public Expression Condition {
- get {
- return condition;
- }
- set {
- condition = value ?? Expression.Null;
- if (!condition.IsNull) condition.Parent = this;
- }
- }
-
- public CatchClause(TypeReference typeReference, string variableName, Statement statementBlock) {
- TypeReference = typeReference;
- VariableName = variableName;
- StatementBlock = statementBlock;
- condition = Expression.Null;
- }
-
- public CatchClause(TypeReference typeReference, string variableName, Statement statementBlock, Expression condition) {
- TypeReference = typeReference;
- VariableName = variableName;
- StatementBlock = statementBlock;
- Condition = condition;
- }
-
- public CatchClause(Statement statementBlock) {
- StatementBlock = statementBlock;
- typeReference = TypeReference.Null;
- variableName = "";
- condition = Expression.Null;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitCatchClause(this, data);
- }
-
- public override string ToString() {
- return string.Format("[CatchClause TypeReference={0} VariableName={1} StatementBlock={2} Condition={3}]" +
- "", TypeReference, VariableName, StatementBlock, Condition);
- }
- }
-
- public class CheckedExpression : Expression {
-
- Expression expression;
-
- public Expression Expression {
- get {
- return expression;
- }
- set {
- expression = value ?? Expression.Null;
- if (!expression.IsNull) expression.Parent = this;
- }
- }
-
- public CheckedExpression(Expression expression) {
- Expression = expression;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitCheckedExpression(this, data);
- }
-
- public override string ToString() {
- return string.Format("[CheckedExpression Expression={0}]", Expression);
- }
- }
-
- public class CheckedStatement : Statement {
-
- Statement block;
-
- public Statement Block {
- get {
- return block;
- }
- set {
- block = value ?? Statement.Null;
- if (!block.IsNull) block.Parent = this;
- }
- }
-
- public CheckedStatement(Statement block) {
- Block = block;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitCheckedStatement(this, data);
- }
-
- public override string ToString() {
- return string.Format("[CheckedStatement Block={0}]", Block);
- }
- }
-
- public class ClassReferenceExpression : Expression {
-
- public ClassReferenceExpression() {
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitClassReferenceExpression(this, data);
- }
-
- public override string ToString() {
- return "[ClassReferenceExpression]";
- }
- }
-
- public class CollectionInitializerExpression : Expression {
-
- List<Expression> createExpressions;
-
- public List<Expression> CreateExpressions {
- get {
- return createExpressions;
- }
- set {
- createExpressions = value ?? new List<Expression>();
- }
- }
-
- public CollectionInitializerExpression() {
- createExpressions = new List<Expression>();
- }
-
- public CollectionInitializerExpression(List<Expression> createExpressions) {
- CreateExpressions = createExpressions;
- }
-
- public new static CollectionInitializerExpression Null {
- get {
- return NullCollectionInitializerExpression.Instance;
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitCollectionInitializerExpression(this, data);
- }
-
- public override string ToString() {
- return string.Format("[CollectionInitializerExpression CreateExpressions={0}]", GetCollectionString(CreateExpressions));
- }
- }
-
- internal sealed class NullCollectionInitializerExpression : CollectionInitializerExpression {
-
- internal static NullCollectionInitializerExpression Instance = new NullCollectionInitializerExpression();
-
- public override bool IsNull {
- get {
- return true;
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return null;
- }
-
- public override string ToString() {
- return "[NullCollectionInitializerExpression]";
- }
- }
-
- public class ConditionalExpression : Expression {
-
- Expression condition;
-
- Expression trueExpression;
-
- Expression falseExpression;
-
- public Expression Condition {
- get {
- return condition;
- }
- set {
- condition = value ?? Expression.Null;
- if (!condition.IsNull) condition.Parent = this;
- }
- }
-
- public Expression TrueExpression {
- get {
- return trueExpression;
- }
- set {
- trueExpression = value ?? Expression.Null;
- if (!trueExpression.IsNull) trueExpression.Parent = this;
- }
- }
-
- public Expression FalseExpression {
- get {
- return falseExpression;
- }
- set {
- falseExpression = value ?? Expression.Null;
- if (!falseExpression.IsNull) falseExpression.Parent = this;
- }
- }
-
- public ConditionalExpression() {
- condition = Expression.Null;
- trueExpression = Expression.Null;
- falseExpression = Expression.Null;
- }
-
- public ConditionalExpression(Expression condition, Expression trueExpression, Expression falseExpression) {
- Condition = condition;
- TrueExpression = trueExpression;
- FalseExpression = falseExpression;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitConditionalExpression(this, data);
- }
-
- public override string ToString() {
- return string.Format("[ConditionalExpression Condition={0} TrueExpression={1} FalseExpression={2}]", Condition, TrueExpression, FalseExpression);
- }
- }
-
- public class ConstructorDeclaration : ParametrizedNode {
-
- ConstructorInitializer constructorInitializer;
-
- BlockStatement body;
-
- public ConstructorInitializer ConstructorInitializer {
- get {
- return constructorInitializer;
- }
- set {
- constructorInitializer = value ?? ConstructorInitializer.Null;
- if (!constructorInitializer.IsNull) constructorInitializer.Parent = this;
- }
- }
-
- public BlockStatement Body {
- get {
- return body;
- }
- set {
- body = value ?? BlockStatement.Null;
- if (!body.IsNull) body.Parent = this;
- }
- }
-
- public ConstructorDeclaration(string name, Modifiers modifier, List<ParameterDeclarationExpression> parameters, List<AttributeSection> attributes) {
- Name = name;
- Modifier = modifier;
- Parameters = parameters;
- Attributes = attributes;
- constructorInitializer = ConstructorInitializer.Null;
- body = BlockStatement.Null;
- }
-
- public ConstructorDeclaration(string name, Modifiers modifier, List<ParameterDeclarationExpression> parameters, ConstructorInitializer constructorInitializer, List<AttributeSection> attributes) {
- Name = name;
- Modifier = modifier;
- Parameters = parameters;
- ConstructorInitializer = constructorInitializer;
- Attributes = attributes;
- body = BlockStatement.Null;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitConstructorDeclaration(this, data);
- }
-
- public override string ToString() {
- return string.Format("[ConstructorDeclaration ConstructorInitializer={0} Body={1} Name={2} Parameters={" +
- "3} Attributes={4} Modifier={5}]", ConstructorInitializer, Body, Name, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier);
- }
- }
-
- public class ConstructorInitializer : AbstractNode, INullable {
-
- ConstructorInitializerType constructorInitializerType;
-
- List<Expression> arguments;
-
- public ConstructorInitializerType ConstructorInitializerType {
- get {
- return constructorInitializerType;
- }
- set {
- constructorInitializerType = value;
- }
- }
-
- public List<Expression> Arguments {
- get {
- return arguments;
- }
- set {
- arguments = value ?? new List<Expression>();
- }
- }
-
- public ConstructorInitializer() {
- arguments = new List<Expression>();
- }
-
- public virtual bool IsNull {
- get {
- return false;
- }
- }
-
- public static ConstructorInitializer Null {
- get {
- return NullConstructorInitializer.Instance;
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitConstructorInitializer(this, data);
- }
-
- public override string ToString() {
- return string.Format("[ConstructorInitializer ConstructorInitializerType={0} Arguments={1}]", ConstructorInitializerType, GetCollectionString(Arguments));
- }
- }
-
- internal sealed class NullConstructorInitializer : ConstructorInitializer {
-
- internal static NullConstructorInitializer Instance = new NullConstructorInitializer();
-
- public override bool IsNull {
- get {
- return true;
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return null;
- }
-
- public override string ToString() {
- return "[NullConstructorInitializer]";
- }
- }
-
- public class ContinueStatement : Statement {
-
- ContinueType continueType;
-
- public ContinueType ContinueType {
- get {
- return continueType;
- }
- set {
- continueType = value;
- }
- }
-
- public ContinueStatement() {
- }
-
- public ContinueStatement(ContinueType continueType) {
- ContinueType = continueType;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitContinueStatement(this, data);
- }
-
- public override string ToString() {
- return string.Format("[ContinueStatement ContinueType={0}]", ContinueType);
- }
- }
-
- public class DeclareDeclaration : ParametrizedNode {
-
- string alias;
-
- string library;
-
- CharsetModifier charset;
-
- TypeReference typeReference;
-
- public string Alias {
- get {
- return alias;
- }
- set {
- alias = value ?? "";
- }
- }
-
- public string Library {
- get {
- return library;
- }
- set {
- library = value ?? "";
- }
- }
-
- public CharsetModifier Charset {
- get {
- return charset;
- }
- set {
- charset = value;
- }
- }
-
- public TypeReference TypeReference {
- get {
- return typeReference;
- }
- set {
- typeReference = value ?? TypeReference.Null;
- if (!typeReference.IsNull) typeReference.Parent = this;
- }
- }
-
- public DeclareDeclaration(string name, Modifiers modifier, TypeReference typeReference, List<ParameterDeclarationExpression> parameters, List<AttributeSection> attributes, string library, string alias, CharsetModifier charset) {
- Name = name;
- Modifier = modifier;
- TypeReference = typeReference;
- Parameters = parameters;
- Attributes = attributes;
- Library = library;
- Alias = alias;
- Charset = charset;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitDeclareDeclaration(this, data);
- }
-
- public override string ToString() {
- return string.Format("[DeclareDeclaration Alias={0} Library={1} Charset={2} TypeReference={3} Name={4} " +
- "Parameters={5} Attributes={6} Modifier={7}]", Alias, Library, Charset, TypeReference, Name, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier);
- }
- }
-
- public class DefaultValueExpression : Expression {
-
- TypeReference typeReference;
-
- public TypeReference TypeReference {
- get {
- return typeReference;
- }
- set {
- typeReference = value ?? TypeReference.Null;
- if (!typeReference.IsNull) typeReference.Parent = this;
- }
- }
-
- public DefaultValueExpression(TypeReference typeReference) {
- TypeReference = typeReference;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitDefaultValueExpression(this, data);
- }
-
- public override string ToString() {
- return string.Format("[DefaultValueExpression TypeReference={0}]", TypeReference);
- }
- }
-
- public class DelegateDeclaration : AttributedNode {
-
- string name;
-
- TypeReference returnType;
-
- List<ParameterDeclarationExpression> parameters;
-
- List<TemplateDefinition> templates;
-
- public string Name {
- get {
- return name;
- }
- set {
- name = string.IsNullOrEmpty(value) ? "?" : value;
- }
- }
-
- public TypeReference ReturnType {
- get {
- return returnType;
- }
- set {
- returnType = value ?? TypeReference.Null;
- if (!returnType.IsNull) returnType.Parent = this;
- }
- }
-
- public List<ParameterDeclarationExpression> Parameters {
- get {
- return parameters;
- }
- set {
- parameters = value ?? new List<ParameterDeclarationExpression>();
- }
- }
-
- public List<TemplateDefinition> Templates {
- get {
- return templates;
- }
- set {
- templates = value ?? new List<TemplateDefinition>();
- }
- }
-
- public DelegateDeclaration(Modifiers modifier, List<AttributeSection> attributes) {
- Modifier = modifier;
- Attributes = attributes;
- name = "?";
- returnType = TypeReference.Null;
- parameters = new List<ParameterDeclarationExpression>();
- templates = new List<TemplateDefinition>();
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitDelegateDeclaration(this, data);
- }
-
- public override string ToString() {
- return string.Format("[DelegateDeclaration Name={0} ReturnType={1} Parameters={2} Templates={3} Attribu" +
- "tes={4} Modifier={5}]", Name, ReturnType, GetCollectionString(Parameters), GetCollectionString(Templates), GetCollectionString(Attributes), Modifier);
- }
- }
-
- public class DestructorDeclaration : AttributedNode {
-
- string name;
-
- BlockStatement body;
-
- public string Name {
- get {
- return name;
- }
- set {
- name = value ?? "";
- }
- }
-
- public BlockStatement Body {
- get {
- return body;
- }
- set {
- body = value ?? BlockStatement.Null;
- if (!body.IsNull) body.Parent = this;
- }
- }
-
- public DestructorDeclaration(string name, Modifiers modifier, List<AttributeSection> attributes) {
- Name = name;
- Modifier = modifier;
- Attributes = attributes;
- body = BlockStatement.Null;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitDestructorDeclaration(this, data);
- }
-
- public override string ToString() {
- return string.Format("[DestructorDeclaration Name={0} Body={1} Attributes={2} Modifier={3}]", Name, Body, GetCollectionString(Attributes), Modifier);
- }
- }
-
- public class DirectionExpression : Expression {
-
- FieldDirection fieldDirection;
-
- Expression expression;
-
- public FieldDirection FieldDirection {
- get {
- return fieldDirection;
- }
- set {
- fieldDirection = value;
- }
- }
-
- public Expression Expression {
- get {
- return expression;
- }
- set {
- expression = value ?? Expression.Null;
- if (!expression.IsNull) expression.Parent = this;
- }
- }
-
- public DirectionExpression(FieldDirection fieldDirection, Expression expression) {
- FieldDirection = fieldDirection;
- Expression = expression;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitDirectionExpression(this, data);
- }
-
- public override string ToString() {
- return string.Format("[DirectionExpression FieldDirection={0} Expression={1}]", FieldDirection, Expression);
- }
- }
-
- public class DoLoopStatement : StatementWithEmbeddedStatement {
-
- Expression condition;
-
- ConditionType conditionType;
-
- ConditionPosition conditionPosition;
-
- public Expression Condition {
- get {
- return condition;
- }
- set {
- condition = value ?? Expression.Null;
- if (!condition.IsNull) condition.Parent = this;
- }
- }
-
- public ConditionType ConditionType {
- get {
- return conditionType;
- }
- set {
- conditionType = value;
- }
- }
-
- public ConditionPosition ConditionPosition {
- get {
- return conditionPosition;
- }
- set {
- conditionPosition = value;
- }
- }
-
- public DoLoopStatement(Expression condition, Statement embeddedStatement, ConditionType conditionType, ConditionPosition conditionPosition) {
- Condition = condition;
- EmbeddedStatement = embeddedStatement;
- ConditionType = conditionType;
- ConditionPosition = conditionPosition;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitDoLoopStatement(this, data);
- }
-
- public override string ToString() {
- return string.Format("[DoLoopStatement Condition={0} ConditionType={1} ConditionPosition={2} EmbeddedSt" +
- "atement={3}]", Condition, ConditionType, ConditionPosition, EmbeddedStatement);
- }
- }
-
- public class ElseIfSection : StatementWithEmbeddedStatement {
-
- Expression condition;
-
- public Expression Condition {
- get {
- return condition;
- }
- set {
- condition = value ?? Expression.Null;
- if (!condition.IsNull) condition.Parent = this;
- }
- }
-
- public ElseIfSection(Expression condition, Statement embeddedStatement) {
- Condition = condition;
- EmbeddedStatement = embeddedStatement;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitElseIfSection(this, data);
- }
-
- public override string ToString() {
- return string.Format("[ElseIfSection Condition={0} EmbeddedStatement={1}]", Condition, EmbeddedStatement);
- }
- }
-
- public class EmptyStatement : Statement {
-
- public EmptyStatement() {
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitEmptyStatement(this, data);
- }
-
- public override string ToString() {
- return "[EmptyStatement]";
- }
- }
-
- public class EndStatement : Statement {
-
- public EndStatement() {
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitEndStatement(this, data);
- }
-
- public override string ToString() {
- return "[EndStatement]";
- }
- }
-
- public class EraseStatement : Statement {
-
- List<Expression> expressions;
-
- public List<Expression> Expressions {
- get {
- return expressions;
- }
- set {
- expressions = value ?? new List<Expression>();
- }
- }
-
- public EraseStatement() {
- expressions = new List<Expression>();
- }
-
- public EraseStatement(List<Expression> expressions) {
- Expressions = expressions;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitEraseStatement(this, data);
- }
-
- public override string ToString() {
- return string.Format("[EraseStatement Expressions={0}]", GetCollectionString(Expressions));
- }
- }
-
- public class ErrorStatement : Statement {
-
- Expression expression;
-
- public Expression Expression {
- get {
- return expression;
- }
- set {
- expression = value ?? Expression.Null;
- if (!expression.IsNull) expression.Parent = this;
- }
- }
-
- public ErrorStatement(Expression expression) {
- Expression = expression;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitErrorStatement(this, data);
- }
-
- public override string ToString() {
- return string.Format("[ErrorStatement Expression={0}]", Expression);
- }
- }
-
- public class EventAddRegion : EventAddRemoveRegion {
-
- public EventAddRegion(List<AttributeSection> attributes) :
- base(attributes) {
- }
-
- public static EventAddRegion Null {
- get {
- return NullEventAddRegion.Instance;
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitEventAddRegion(this, data);
- }
-
- public override string ToString() {
- return string.Format("[EventAddRegion Block={0} Parameters={1} Attributes={2} Modifier={3}]", Block, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier);
- }
- }
-
- internal sealed class NullEventAddRegion : EventAddRegion {
-
- private NullEventAddRegion() :
- base(null) {
- }
-
- internal static NullEventAddRegion Instance = new NullEventAddRegion();
-
- public override bool IsNull {
- get {
- return true;
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return null;
- }
-
- public override string ToString() {
- return "[NullEventAddRegion]";
- }
- }
-
- public abstract class EventAddRemoveRegion : AttributedNode, INullable {
-
- BlockStatement block;
-
- List<ParameterDeclarationExpression> parameters;
-
- public BlockStatement Block {
- get {
- return block;
- }
- set {
- block = value ?? BlockStatement.Null;
- if (!block.IsNull) block.Parent = this;
- }
- }
-
- public List<ParameterDeclarationExpression> Parameters {
- get {
- return parameters;
- }
- set {
- parameters = value ?? new List<ParameterDeclarationExpression>();
- }
- }
-
- protected EventAddRemoveRegion(List<AttributeSection> attributes) {
- Attributes = attributes;
- block = BlockStatement.Null;
- parameters = new List<ParameterDeclarationExpression>();
- }
-
- public virtual bool IsNull {
- get {
- return false;
- }
- }
- }
-
- public class EventDeclaration : MemberNode {
-
- EventAddRegion addRegion;
-
- EventRemoveRegion removeRegion;
-
- EventRaiseRegion raiseRegion;
-
- Location bodyStart;
-
- Location bodyEnd;
-
- Expression initializer;
-
- public EventAddRegion AddRegion {
- get {
- return addRegion;
- }
- set {
- addRegion = value ?? EventAddRegion.Null;
- if (!addRegion.IsNull) addRegion.Parent = this;
- }
- }
-
- public EventRemoveRegion RemoveRegion {
- get {
- return removeRegion;
- }
- set {
- removeRegion = value ?? EventRemoveRegion.Null;
- if (!removeRegion.IsNull) removeRegion.Parent = this;
- }
- }
-
- public EventRaiseRegion RaiseRegion {
- get {
- return raiseRegion;
- }
- set {
- raiseRegion = value ?? EventRaiseRegion.Null;
- if (!raiseRegion.IsNull) raiseRegion.Parent = this;
- }
- }
-
- public Location BodyStart {
- get {
- return bodyStart;
- }
- set {
- bodyStart = value;
- }
- }
-
- public Location BodyEnd {
- get {
- return bodyEnd;
- }
- set {
- bodyEnd = value;
- }
- }
-
- public Expression Initializer {
- get {
- return initializer;
- }
- set {
- initializer = value ?? Expression.Null;
- if (!initializer.IsNull) initializer.Parent = this;
- }
- }
-
- public EventDeclaration() {
- addRegion = EventAddRegion.Null;
- removeRegion = EventRemoveRegion.Null;
- raiseRegion = EventRaiseRegion.Null;
- bodyStart = Location.Empty;
- bodyEnd = Location.Empty;
- initializer = Expression.Null;
- }
-
- public bool HasRemoveRegion {
- get {
- return !removeRegion.IsNull;
- }
- }
-
- public bool HasRaiseRegion {
- get {
- return !raiseRegion.IsNull;
- }
- }
-
- public bool HasAddRegion {
- get {
- return !addRegion.IsNull;
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitEventDeclaration(this, data);
- }
-
- public override string ToString() {
- return string.Format("[EventDeclaration AddRegion={0} RemoveRegion={1} RaiseRegion={2} BodyStart={3} Bo" +
- "dyEnd={4} Initializer={5} InterfaceImplementations={6} TypeReference={7} Name={8" +
- "} Parameters={9} Attributes={10} Modifier={11}]", AddRegion, RemoveRegion, RaiseRegion, BodyStart, BodyEnd, Initializer, GetCollectionString(InterfaceImplementations), TypeReference, Name, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier);
- }
- }
-
- public class EventRaiseRegion : EventAddRemoveRegion {
-
- public EventRaiseRegion(List<AttributeSection> attributes) :
- base(attributes) {
- }
-
- public static EventRaiseRegion Null {
- get {
- return NullEventRaiseRegion.Instance;
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitEventRaiseRegion(this, data);
- }
-
- public override string ToString() {
- return string.Format("[EventRaiseRegion Block={0} Parameters={1} Attributes={2} Modifier={3}]", Block, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier);
- }
- }
-
- internal sealed class NullEventRaiseRegion : EventRaiseRegion {
-
- private NullEventRaiseRegion() :
- base(null) {
- }
-
- internal static NullEventRaiseRegion Instance = new NullEventRaiseRegion();
-
- public override bool IsNull {
- get {
- return true;
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return null;
- }
-
- public override string ToString() {
- return "[NullEventRaiseRegion]";
- }
- }
-
- public class EventRemoveRegion : EventAddRemoveRegion {
-
- public EventRemoveRegion(List<AttributeSection> attributes) :
- base(attributes) {
- }
-
- public static EventRemoveRegion Null {
- get {
- return NullEventRemoveRegion.Instance;
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitEventRemoveRegion(this, data);
- }
-
- public override string ToString() {
- return string.Format("[EventRemoveRegion Block={0} Parameters={1} Attributes={2} Modifier={3}]", Block, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier);
- }
- }
-
- internal sealed class NullEventRemoveRegion : EventRemoveRegion {
-
- private NullEventRemoveRegion() :
- base(null) {
- }
-
- internal static NullEventRemoveRegion Instance = new NullEventRemoveRegion();
-
- public override bool IsNull {
- get {
- return true;
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return null;
- }
-
- public override string ToString() {
- return "[NullEventRemoveRegion]";
- }
- }
-
- public class ExitStatement : Statement {
-
- ExitType exitType;
-
- public ExitType ExitType {
- get {
- return exitType;
- }
- set {
- exitType = value;
- }
- }
-
- public ExitStatement(ExitType exitType) {
- ExitType = exitType;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitExitStatement(this, data);
- }
-
- public override string ToString() {
- return string.Format("[ExitStatement ExitType={0}]", ExitType);
- }
- }
-
- public class ExpressionRangeVariable : AbstractNode, INullable {
-
- string identifier;
-
- Expression expression;
-
- TypeReference type;
-
- public string Identifier {
- get {
- return identifier;
- }
- set {
- identifier = value ?? "";
- }
- }
-
- public Expression Expression {
- get {
- return expression;
- }
- set {
- expression = value ?? Expression.Null;
- if (!expression.IsNull) expression.Parent = this;
- }
- }
-
- public TypeReference Type {
- get {
- return type;
- }
- set {
- type = value ?? TypeReference.Null;
- if (!type.IsNull) type.Parent = this;
- }
- }
-
- public ExpressionRangeVariable() {
- identifier = "";
- expression = Expression.Null;
- type = TypeReference.Null;
- }
-
- public virtual bool IsNull {
- get {
- return false;
- }
- }
-
- public static ExpressionRangeVariable Null {
- get {
- return NullExpressionRangeVariable.Instance;
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitExpressionRangeVariable(this, data);
- }
-
- public override string ToString() {
- return string.Format("[ExpressionRangeVariable Identifier={0} Expression={1} Type={2}]", Identifier, Expression, Type);
- }
- }
-
- internal sealed class NullExpressionRangeVariable : ExpressionRangeVariable {
-
- internal static NullExpressionRangeVariable Instance = new NullExpressionRangeVariable();
-
- public override bool IsNull {
- get {
- return true;
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return null;
- }
-
- public override string ToString() {
- return "[NullExpressionRangeVariable]";
- }
- }
-
- public class ExpressionStatement : Statement {
-
- Expression expression;
-
- public Expression Expression {
- get {
- return expression;
- }
- set {
- expression = value ?? Expression.Null;
- if (!expression.IsNull) expression.Parent = this;
- }
- }
-
- public ExpressionStatement(Expression expression) {
- Expression = expression;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitExpressionStatement(this, data);
- }
-
- public override string ToString() {
- return string.Format("[ExpressionStatement Expression={0}]", Expression);
- }
- }
-
- public class ExternAliasDirective : AbstractNode {
-
- string name;
-
- public string Name {
- get {
- return name;
- }
- set {
- name = value ?? "";
- }
- }
-
- public ExternAliasDirective() {
- name = "";
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitExternAliasDirective(this, data);
- }
-
- public override string ToString() {
- return string.Format("[ExternAliasDirective Name={0}]", Name);
- }
- }
-
- public class FieldDeclaration : AttributedNode {
-
- TypeReference typeReference;
-
- List<VariableDeclaration> fields;
-
- public TypeReference TypeReference {
- get {
- return typeReference;
- }
- set {
- typeReference = value ?? TypeReference.Null;
- if (!typeReference.IsNull) typeReference.Parent = this;
- }
- }
-
- public List<VariableDeclaration> Fields {
- get {
- return fields;
- }
- set {
- fields = value ?? new List<VariableDeclaration>();
- }
- }
-
- public FieldDeclaration(List<AttributeSection> attributes) {
- Attributes = attributes;
- typeReference = TypeReference.Null;
- fields = new List<VariableDeclaration>();
- }
-
- public FieldDeclaration(List<AttributeSection> attributes, TypeReference typeReference, Modifiers modifier) {
- Attributes = attributes;
- TypeReference = typeReference;
- Modifier = modifier;
- fields = new List<VariableDeclaration>();
- }
-
-
- public VariableDeclaration GetVariableDeclaration(string variableName)
- {
- foreach (VariableDeclaration variableDeclaration in Fields) {
- if (variableDeclaration.Name == variableName) {
- return variableDeclaration;
- }
- }
- return null;
- }
-
-
- public TypeReference GetTypeForField(int fieldIndex)
- {
- if (!typeReference.IsNull) {
- return typeReference;
- }
- return ((VariableDeclaration)Fields[fieldIndex]).TypeReference;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitFieldDeclaration(this, data);
- }
-
- public override string ToString() {
- return string.Format("[FieldDeclaration TypeReference={0} Fields={1} Attributes={2} Modifier={3}]", TypeReference, GetCollectionString(Fields), GetCollectionString(Attributes), Modifier);
- }
- }
-
- public class FixedStatement : StatementWithEmbeddedStatement {
-
- Statement pointerDeclaration;
-
- public Statement PointerDeclaration {
- get {
- return pointerDeclaration;
- }
- set {
- pointerDeclaration = value ?? Statement.Null;
- if (!pointerDeclaration.IsNull) pointerDeclaration.Parent = this;
- }
- }
-
- public FixedStatement(Statement pointerDeclaration, Statement embeddedStatement) {
- PointerDeclaration = pointerDeclaration;
- EmbeddedStatement = embeddedStatement;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitFixedStatement(this, data);
- }
-
- public override string ToString() {
- return string.Format("[FixedStatement PointerDeclaration={0} EmbeddedStatement={1}]", PointerDeclaration, EmbeddedStatement);
- }
- }
-
- public class ForeachStatement : StatementWithEmbeddedStatement {
-
- TypeReference typeReference;
-
- string variableName;
-
- Expression expression;
-
- Expression nextExpression;
-
- public TypeReference TypeReference {
- get {
- return typeReference;
- }
- set {
- typeReference = value ?? TypeReference.Null;
- if (!typeReference.IsNull) typeReference.Parent = this;
- }
- }
-
- public string VariableName {
- get {
- return variableName;
- }
- set {
- variableName = value ?? "";
- }
- }
-
- public Expression Expression {
- get {
- return expression;
- }
- set {
- expression = value ?? Expression.Null;
- if (!expression.IsNull) expression.Parent = this;
- }
- }
-
- public Expression NextExpression {
- get {
- return nextExpression;
- }
- set {
- nextExpression = value ?? Expression.Null;
- if (!nextExpression.IsNull) nextExpression.Parent = this;
- }
- }
-
- public ForeachStatement(TypeReference typeReference, string variableName, Expression expression, Statement embeddedStatement) {
- TypeReference = typeReference;
- VariableName = variableName;
- Expression = expression;
- EmbeddedStatement = embeddedStatement;
- nextExpression = Expression.Null;
- }
-
- public ForeachStatement(TypeReference typeReference, string variableName, Expression expression, Statement embeddedStatement, Expression nextExpression) {
- TypeReference = typeReference;
- VariableName = variableName;
- Expression = expression;
- EmbeddedStatement = embeddedStatement;
- NextExpression = nextExpression;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitForeachStatement(this, data);
- }
-
- public override string ToString() {
- return string.Format("[ForeachStatement TypeReference={0} VariableName={1} Expression={2} NextExpressio" +
- "n={3} EmbeddedStatement={4}]", TypeReference, VariableName, Expression, NextExpression, EmbeddedStatement);
- }
- }
-
- public class ForNextStatement : StatementWithEmbeddedStatement {
-
- Expression start;
-
- Expression end;
-
- Expression step;
-
- List<Expression> nextExpressions;
-
- TypeReference typeReference;
-
- string variableName;
-
- Expression loopVariableExpression;
-
- public Expression Start {
- get {
- return start;
- }
- set {
- start = value ?? Expression.Null;
- if (!start.IsNull) start.Parent = this;
- }
- }
-
- public Expression End {
- get {
- return end;
- }
- set {
- end = value ?? Expression.Null;
- if (!end.IsNull) end.Parent = this;
- }
- }
-
- public Expression Step {
- get {
- return step;
- }
- set {
- step = value ?? Expression.Null;
- if (!step.IsNull) step.Parent = this;
- }
- }
-
- public List<Expression> NextExpressions {
- get {
- return nextExpressions;
- }
- set {
- nextExpressions = value ?? new List<Expression>();
- }
- }
-
- public TypeReference TypeReference {
- get {
- return typeReference;
- }
- set {
- typeReference = value ?? TypeReference.Null;
- if (!typeReference.IsNull) typeReference.Parent = this;
- }
- }
-
- public string VariableName {
- get {
- return variableName;
- }
- set {
- variableName = value ?? "";
- }
- }
-
- public Expression LoopVariableExpression {
- get {
- return loopVariableExpression;
- }
- set {
- loopVariableExpression = value ?? Expression.Null;
- if (!loopVariableExpression.IsNull) loopVariableExpression.Parent = this;
- }
- }
-
- public ForNextStatement() {
- start = Expression.Null;
- end = Expression.Null;
- step = Expression.Null;
- nextExpressions = new List<Expression>();
- typeReference = TypeReference.Null;
- variableName = "";
- loopVariableExpression = Expression.Null;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitForNextStatement(this, data);
- }
-
- public override string ToString() {
- return string.Format("[ForNextStatement Start={0} End={1} Step={2} NextExpressions={3} TypeReference={4" +
- "} VariableName={5} LoopVariableExpression={6} EmbeddedStatement={7}]", Start, End, Step, GetCollectionString(NextExpressions), TypeReference, VariableName, LoopVariableExpression, EmbeddedStatement);
- }
- }
-
- public class ForStatement : StatementWithEmbeddedStatement {
-
- List<Statement> initializers;
-
- Expression condition;
-
- List<Statement> iterator;
-
- public List<Statement> Initializers {
- get {
- return initializers;
- }
- set {
- initializers = value ?? new List<Statement>();
- }
- }
-
- public Expression Condition {
- get {
- return condition;
- }
- set {
- condition = value ?? Expression.Null;
- if (!condition.IsNull) condition.Parent = this;
- }
- }
-
- public List<Statement> Iterator {
- get {
- return iterator;
- }
- set {
- iterator = value ?? new List<Statement>();
- }
- }
-
- public ForStatement(List<Statement> initializers, Expression condition, List<Statement> iterator, Statement embeddedStatement) {
- Initializers = initializers;
- Condition = condition;
- Iterator = iterator;
- EmbeddedStatement = embeddedStatement;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitForStatement(this, data);
- }
-
- public override string ToString() {
- return string.Format("[ForStatement Initializers={0} Condition={1} Iterator={2} EmbeddedStatement={3}]", GetCollectionString(Initializers), Condition, GetCollectionString(Iterator), EmbeddedStatement);
- }
- }
-
- public class GotoCaseStatement : Statement {
-
- Expression expression;
-
- public Expression Expression {
- get {
- return expression;
- }
- set {
- expression = value ?? Expression.Null;
- if (!expression.IsNull) expression.Parent = this;
- }
- }
-
- public GotoCaseStatement(Expression expression) {
- Expression = expression;
- }
-
- public bool IsDefaultCase {
- get {
- return expression.IsNull;
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitGotoCaseStatement(this, data);
- }
-
- public override string ToString() {
- return string.Format("[GotoCaseStatement Expression={0}]", Expression);
- }
- }
-
- public class GotoStatement : Statement {
-
- string label;
-
- public string Label {
- get {
- return label;
- }
- set {
- label = value ?? "";
- }
- }
-
- public GotoStatement(string label) {
- Label = label;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitGotoStatement(this, data);
- }
-
- public override string ToString() {
- return string.Format("[GotoStatement Label={0}]", Label);
- }
- }
-
- public class IdentifierExpression : Expression {
-
- string identifier;
-
- List<TypeReference> typeArguments;
-
- public string Identifier {
- get {
- return identifier;
- }
- set {
- identifier = value ?? "";
- }
- }
-
- public List<TypeReference> TypeArguments {
- get {
- return typeArguments;
- }
- set {
- typeArguments = value ?? new List<TypeReference>();
- }
- }
-
- public IdentifierExpression(string identifier) {
- Identifier = identifier;
- typeArguments = new List<TypeReference>();
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitIdentifierExpression(this, data);
- }
-
- public override string ToString() {
- return string.Format("[IdentifierExpression Identifier={0} TypeArguments={1}]", Identifier, GetCollectionString(TypeArguments));
- }
- }
-
- public class IfElseStatement : Statement {
-
- Expression condition;
-
- List<Statement> trueStatement;
-
- List<Statement> falseStatement;
-
- List<ElseIfSection> elseIfSections;
-
- public Expression Condition {
- get {
- return condition;
- }
- set {
- condition = value ?? Expression.Null;
- if (!condition.IsNull) condition.Parent = this;
- }
- }
-
- public List<Statement> TrueStatement {
- get {
- return trueStatement;
- }
- set {
- trueStatement = value ?? new List<Statement>();
- }
- }
-
- public List<Statement> FalseStatement {
- get {
- return falseStatement;
- }
- set {
- falseStatement = value ?? new List<Statement>();
- }
- }
-
- public List<ElseIfSection> ElseIfSections {
- get {
- return elseIfSections;
- }
- set {
- elseIfSections = value ?? new List<ElseIfSection>();
- }
- }
-
- public IfElseStatement(Expression condition) {
- Condition = condition;
- trueStatement = new List<Statement>();
- falseStatement = new List<Statement>();
- elseIfSections = new List<ElseIfSection>();
- }
-
-
- public IfElseStatement(Expression condition, Statement trueStatement)
- : this(condition) {
- this.trueStatement.Add(Statement.CheckNull(trueStatement));
- if (trueStatement != null) trueStatement.Parent = this;
- }
-
-
- public IfElseStatement(Expression condition, Statement trueStatement, Statement falseStatement)
- : this(condition) {
- this.trueStatement.Add(Statement.CheckNull(trueStatement));
- this.falseStatement.Add(Statement.CheckNull(falseStatement));
- if (trueStatement != null) trueStatement.Parent = this;
- if (falseStatement != null) falseStatement.Parent = this;
- }
-
- public bool HasElseStatements {
- get {
- return falseStatement.Count > 0;
- }
- }
-
- public bool HasElseIfSections {
- get {
- return elseIfSections.Count > 0;
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitIfElseStatement(this, data);
- }
-
- public override string ToString() {
- return string.Format("[IfElseStatement Condition={0} TrueStatement={1} FalseStatement={2} ElseIfSection" +
- "s={3}]", Condition, GetCollectionString(TrueStatement), GetCollectionString(FalseStatement), GetCollectionString(ElseIfSections));
- }
- }
-
- public class IndexerDeclaration : AttributedNode {
-
- List<ParameterDeclarationExpression> parameters;
-
- List<InterfaceImplementation> interfaceImplementations;
-
- TypeReference typeReference;
-
- Location bodyStart;
-
- Location bodyEnd;
-
- PropertyGetRegion getRegion;
-
- PropertySetRegion setRegion;
-
- public List<ParameterDeclarationExpression> Parameters {
- get {
- return parameters;
- }
- set {
- parameters = value ?? new List<ParameterDeclarationExpression>();
- }
- }
-
- public List<InterfaceImplementation> InterfaceImplementations {
- get {
- return interfaceImplementations;
- }
- set {
- interfaceImplementations = value ?? new List<InterfaceImplementation>();
- }
- }
-
- public TypeReference TypeReference {
- get {
- return typeReference;
- }
- set {
- typeReference = value ?? TypeReference.Null;
- if (!typeReference.IsNull) typeReference.Parent = this;
- }
- }
-
- public Location BodyStart {
- get {
- return bodyStart;
- }
- set {
- bodyStart = value;
- }
- }
-
- public Location BodyEnd {
- get {
- return bodyEnd;
- }
- set {
- bodyEnd = value;
- }
- }
-
- public PropertyGetRegion GetRegion {
- get {
- return getRegion;
- }
- set {
- getRegion = value ?? PropertyGetRegion.Null;
- if (!getRegion.IsNull) getRegion.Parent = this;
- }
- }
-
- public PropertySetRegion SetRegion {
- get {
- return setRegion;
- }
- set {
- setRegion = value ?? PropertySetRegion.Null;
- if (!setRegion.IsNull) setRegion.Parent = this;
- }
- }
-
- public IndexerDeclaration(Modifiers modifier, List<ParameterDeclarationExpression> parameters, List<AttributeSection> attributes) {
- Modifier = modifier;
- Parameters = parameters;
- Attributes = attributes;
- interfaceImplementations = new List<InterfaceImplementation>();
- typeReference = TypeReference.Null;
- bodyStart = Location.Empty;
- bodyEnd = Location.Empty;
- getRegion = PropertyGetRegion.Null;
- setRegion = PropertySetRegion.Null;
- }
-
- public IndexerDeclaration(TypeReference typeReference, List<ParameterDeclarationExpression> parameters, Modifiers modifier, List<AttributeSection> attributes) {
- TypeReference = typeReference;
- Parameters = parameters;
- Modifier = modifier;
- Attributes = attributes;
- interfaceImplementations = new List<InterfaceImplementation>();
- bodyStart = Location.Empty;
- bodyEnd = Location.Empty;
- getRegion = PropertyGetRegion.Null;
- setRegion = PropertySetRegion.Null;
- }
-
- public bool IsReadOnly {
- get {
- return HasGetRegion && !HasSetRegion;
- }
- }
-
- public bool HasSetRegion {
- get {
- return !setRegion.IsNull;
- }
- }
-
- public bool HasGetRegion {
- get {
- return !getRegion.IsNull;
- }
- }
-
- public bool IsWriteOnly {
- get {
- return !HasGetRegion && HasSetRegion;
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitIndexerDeclaration(this, data);
- }
-
- public override string ToString() {
- return string.Format("[IndexerDeclaration Parameters={0} InterfaceImplementations={1} TypeReference={2}" +
- " BodyStart={3} BodyEnd={4} GetRegion={5} SetRegion={6} Attributes={7} Modifier={" +
- "8}]", GetCollectionString(Parameters), GetCollectionString(InterfaceImplementations), TypeReference, BodyStart, BodyEnd, GetRegion, SetRegion, GetCollectionString(Attributes), Modifier);
- }
- }
-
- public class IndexerExpression : Expression {
-
- Expression targetObject;
-
- List<Expression> indexes;
-
- public Expression TargetObject {
- get {
- return targetObject;
- }
- set {
- targetObject = value ?? Expression.Null;
- if (!targetObject.IsNull) targetObject.Parent = this;
- }
- }
-
- public List<Expression> Indexes {
- get {
- return indexes;
- }
- set {
- indexes = value ?? new List<Expression>();
- }
- }
-
- public IndexerExpression(Expression targetObject, List<Expression> indexes) {
- TargetObject = targetObject;
- Indexes = indexes;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitIndexerExpression(this, data);
- }
-
- public override string ToString() {
- return string.Format("[IndexerExpression TargetObject={0} Indexes={1}]", TargetObject, GetCollectionString(Indexes));
- }
- }
-
- public class InterfaceImplementation : AbstractNode {
-
- TypeReference interfaceType;
-
- string memberName;
-
- public TypeReference InterfaceType {
- get {
- return interfaceType;
- }
- set {
- interfaceType = value ?? TypeReference.Null;
- if (!interfaceType.IsNull) interfaceType.Parent = this;
- }
- }
-
- public string MemberName {
- get {
- return memberName;
- }
- set {
- memberName = string.IsNullOrEmpty(value) ? "?" : value;
- }
- }
-
- public InterfaceImplementation(TypeReference interfaceType, string memberName) {
- InterfaceType = interfaceType;
- MemberName = memberName;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitInterfaceImplementation(this, data);
- }
-
- public override string ToString() {
- return string.Format("[InterfaceImplementation InterfaceType={0} MemberName={1}]", InterfaceType, MemberName);
- }
- }
-
- public class InvocationExpression : Expression {
-
- Expression targetObject;
-
- List<Expression> arguments;
-
- public Expression TargetObject {
- get {
- return targetObject;
- }
- set {
- targetObject = value ?? Expression.Null;
- if (!targetObject.IsNull) targetObject.Parent = this;
- }
- }
-
- public List<Expression> Arguments {
- get {
- return arguments;
- }
- set {
- arguments = value ?? new List<Expression>();
- }
- }
-
- public InvocationExpression(Expression targetObject) {
- TargetObject = targetObject;
- arguments = new List<Expression>();
- }
-
- public InvocationExpression(Expression targetObject, List<Expression> arguments) {
- TargetObject = targetObject;
- Arguments = arguments;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitInvocationExpression(this, data);
- }
-
- public override string ToString() {
- return string.Format("[InvocationExpression TargetObject={0} Arguments={1}]", TargetObject, GetCollectionString(Arguments));
- }
- }
-
- public class LabelStatement : Statement {
-
- string label;
-
- public string Label {
- get {
- return label;
- }
- set {
- label = value ?? "";
- }
- }
-
- public LabelStatement(string label) {
- Label = label;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitLabelStatement(this, data);
- }
-
- public override string ToString() {
- return string.Format("[LabelStatement Label={0}]", Label);
- }
- }
-
- public class LambdaExpression : Expression {
-
- List<ParameterDeclarationExpression> parameters;
-
- BlockStatement statementBody;
-
- Expression expressionBody;
-
- public List<ParameterDeclarationExpression> Parameters {
- get {
- return parameters;
- }
- set {
- parameters = value ?? new List<ParameterDeclarationExpression>();
- }
- }
-
- public BlockStatement StatementBody {
- get {
- return statementBody;
- }
- set {
- statementBody = value ?? BlockStatement.Null;
- if (!statementBody.IsNull) statementBody.Parent = this;
- }
- }
-
- public Expression ExpressionBody {
- get {
- return expressionBody;
- }
- set {
- expressionBody = value ?? Expression.Null;
- if (!expressionBody.IsNull) expressionBody.Parent = this;
- }
- }
-
- public LambdaExpression() {
- parameters = new List<ParameterDeclarationExpression>();
- statementBody = BlockStatement.Null;
- expressionBody = Expression.Null;
- }
-
-public Location ExtendedEndLocation { get; set; }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitLambdaExpression(this, data);
- }
-
- public override string ToString() {
- return string.Format("[LambdaExpression Parameters={0} StatementBody={1} ExpressionBody={2}]", GetCollectionString(Parameters), StatementBody, ExpressionBody);
- }
- }
-
- public class LockStatement : StatementWithEmbeddedStatement {
-
- Expression lockExpression;
-
- public Expression LockExpression {
- get {
- return lockExpression;
- }
- set {
- lockExpression = value ?? Expression.Null;
- if (!lockExpression.IsNull) lockExpression.Parent = this;
- }
- }
-
- public LockStatement(Expression lockExpression, Statement embeddedStatement) {
- LockExpression = lockExpression;
- EmbeddedStatement = embeddedStatement;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitLockStatement(this, data);
- }
-
- public override string ToString() {
- return string.Format("[LockStatement LockExpression={0} EmbeddedStatement={1}]", LockExpression, EmbeddedStatement);
- }
- }
-
- public abstract class MemberNode : ParametrizedNode {
-
- List<InterfaceImplementation> interfaceImplementations;
-
- TypeReference typeReference;
-
- public List<InterfaceImplementation> InterfaceImplementations {
- get {
- return interfaceImplementations;
- }
- set {
- interfaceImplementations = value ?? new List<InterfaceImplementation>();
- }
- }
-
- public TypeReference TypeReference {
- get {
- return typeReference;
- }
- set {
- typeReference = value ?? TypeReference.Null;
- if (!typeReference.IsNull) typeReference.Parent = this;
- }
- }
-
- protected MemberNode() {
- interfaceImplementations = new List<InterfaceImplementation>();
- typeReference = TypeReference.Null;
- }
-
- protected MemberNode(Modifiers modifier, List<AttributeSection> attributes, string name, List<ParameterDeclarationExpression> parameters) {
- Modifier = modifier;
- Attributes = attributes;
- Name = name;
- Parameters = parameters;
- interfaceImplementations = new List<InterfaceImplementation>();
- typeReference = TypeReference.Null;
- }
- }
-
- public class MemberReferenceExpression : Expression {
-
- Expression targetObject;
-
- string memberName;
-
- List<TypeReference> typeArguments;
-
- public Expression TargetObject {
- get {
- return targetObject;
- }
- set {
- targetObject = value ?? Expression.Null;
- if (!targetObject.IsNull) targetObject.Parent = this;
- }
- }
-
- public string MemberName {
- get {
- return memberName;
- }
- set {
- memberName = value ?? "";
- }
- }
-
- public List<TypeReference> TypeArguments {
- get {
- return typeArguments;
- }
- set {
- typeArguments = value ?? new List<TypeReference>();
- }
- }
-
- public MemberReferenceExpression(Expression targetObject, string memberName) {
- TargetObject = targetObject;
- MemberName = memberName;
- typeArguments = new List<TypeReference>();
- }
-
-[Obsolete] public string FieldName { get { return MemberName; } set { MemberName = value; } }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitMemberReferenceExpression(this, data);
- }
-
- public override string ToString() {
- return string.Format("[MemberReferenceExpression TargetObject={0} MemberName={1} TypeArguments={2}]", TargetObject, MemberName, GetCollectionString(TypeArguments));
- }
- }
-
- public class MethodDeclaration : MemberNode {
-
- BlockStatement body;
-
- List<string> handlesClause;
-
- List<TemplateDefinition> templates;
-
- bool isExtensionMethod;
-
- public BlockStatement Body {
- get {
- return body;
- }
- set {
- body = value ?? BlockStatement.Null;
- if (!body.IsNull) body.Parent = this;
- }
- }
-
- public List<string> HandlesClause {
- get {
- return handlesClause;
- }
- set {
- handlesClause = value ?? new List<String>();
- }
- }
-
- public List<TemplateDefinition> Templates {
- get {
- return templates;
- }
- set {
- templates = value ?? new List<TemplateDefinition>();
- }
- }
-
- public bool IsExtensionMethod {
- get {
- return isExtensionMethod;
- }
- set {
- isExtensionMethod = value;
- }
- }
-
- public MethodDeclaration() {
- body = BlockStatement.Null;
- handlesClause = new List<String>();
- templates = new List<TemplateDefinition>();
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitMethodDeclaration(this, data);
- }
-
- public override string ToString() {
- return string.Format("[MethodDeclaration Body={0} HandlesClause={1} Templates={2} IsExtensionMethod={3}" +
- " InterfaceImplementations={4} TypeReference={5} Name={6} Parameters={7} Attribut" +
- "es={8} Modifier={9}]", Body, GetCollectionString(HandlesClause), GetCollectionString(Templates), IsExtensionMethod, GetCollectionString(InterfaceImplementations), TypeReference, Name, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier);
- }
- }
-
- public class NamedArgumentExpression : Expression {
-
- string name;
-
- Expression expression;
-
- public string Name {
- get {
- return name;
- }
- set {
- name = value ?? "";
- }
- }
-
- public Expression Expression {
- get {
- return expression;
- }
- set {
- expression = value ?? Expression.Null;
- if (!expression.IsNull) expression.Parent = this;
- }
- }
-
- public NamedArgumentExpression() {
- name = "";
- expression = Expression.Null;
- }
-
- public NamedArgumentExpression(string name, Expression expression) {
- Name = name;
- Expression = expression;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitNamedArgumentExpression(this, data);
- }
-
- public override string ToString() {
- return string.Format("[NamedArgumentExpression Name={0} Expression={1}]", Name, Expression);
- }
- }
-
- public class NamespaceDeclaration : AbstractNode {
-
- string name;
-
- public string Name {
- get {
- return name;
- }
- set {
- name = value ?? "";
- }
- }
-
- public NamespaceDeclaration(string name) {
- Name = name;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitNamespaceDeclaration(this, data);
- }
-
- public override string ToString() {
- return string.Format("[NamespaceDeclaration Name={0}]", Name);
- }
- }
-
- public class ObjectCreateExpression : Expression {
-
- TypeReference createType;
-
- List<Expression> parameters;
-
- CollectionInitializerExpression objectInitializer;
-
- public TypeReference CreateType {
- get {
- return createType;
- }
- set {
- createType = value ?? TypeReference.Null;
- if (!createType.IsNull) createType.Parent = this;
- }
- }
-
- public List<Expression> Parameters {
- get {
- return parameters;
- }
- set {
- parameters = value ?? new List<Expression>();
- }
- }
-
- public CollectionInitializerExpression ObjectInitializer {
- get {
- return objectInitializer;
- }
- set {
- objectInitializer = value ?? CollectionInitializerExpression.Null;
- if (!objectInitializer.IsNull) objectInitializer.Parent = this;
- }
- }
-
- public ObjectCreateExpression(TypeReference createType, List<Expression> parameters) {
- CreateType = createType;
- Parameters = parameters;
- objectInitializer = CollectionInitializerExpression.Null;
- }
-
- public bool IsAnonymousType {
- get {
- return createType.IsNull || string.IsNullOrEmpty(createType.Type);
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitObjectCreateExpression(this, data);
- }
-
- public override string ToString() {
- return string.Format("[ObjectCreateExpression CreateType={0} Parameters={1} ObjectInitializer={2}]", CreateType, GetCollectionString(Parameters), ObjectInitializer);
- }
- }
-
- public class OnErrorStatement : StatementWithEmbeddedStatement {
-
- public OnErrorStatement(Statement embeddedStatement) {
- EmbeddedStatement = embeddedStatement;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitOnErrorStatement(this, data);
- }
-
- public override string ToString() {
- return string.Format("[OnErrorStatement EmbeddedStatement={0}]", EmbeddedStatement);
- }
- }
-
- public class OperatorDeclaration : MethodDeclaration {
-
- ConversionType conversionType;
-
- List<AttributeSection> returnTypeAttributes;
-
- OverloadableOperatorType overloadableOperator;
-
- public ConversionType ConversionType {
- get {
- return conversionType;
- }
- set {
- conversionType = value;
- }
- }
-
- public List<AttributeSection> ReturnTypeAttributes {
- get {
- return returnTypeAttributes;
- }
- set {
- returnTypeAttributes = value ?? new List<AttributeSection>();
- }
- }
-
- public OverloadableOperatorType OverloadableOperator {
- get {
- return overloadableOperator;
- }
- set {
- overloadableOperator = value;
- }
- }
-
- public OperatorDeclaration() {
- returnTypeAttributes = new List<AttributeSection>();
- }
-
- public bool IsConversionOperator {
- get {
- return conversionType != ConversionType.None;
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitOperatorDeclaration(this, data);
- }
-
- public override string ToString() {
- return string.Format("[OperatorDeclaration ConversionType={0} ReturnTypeAttributes={1} OverloadableOper" +
- "ator={2} Body={3} HandlesClause={4} Templates={5} IsExtensionMethod={6} Interfac" +
- "eImplementations={7} TypeReference={8} Name={9} Parameters={10} Attributes={11} " +
- "Modifier={12}]", ConversionType, GetCollectionString(ReturnTypeAttributes), OverloadableOperator, Body, GetCollectionString(HandlesClause), GetCollectionString(Templates), IsExtensionMethod, GetCollectionString(InterfaceImplementations), TypeReference, Name, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier);
- }
- }
-
- public class OptionDeclaration : AbstractNode {
-
- OptionType optionType;
-
- bool optionValue;
-
- public OptionType OptionType {
- get {
- return optionType;
- }
- set {
- optionType = value;
- }
- }
-
- public bool OptionValue {
- get {
- return optionValue;
- }
- set {
- optionValue = value;
- }
- }
-
- public OptionDeclaration(OptionType optionType, bool optionValue) {
- OptionType = optionType;
- OptionValue = optionValue;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitOptionDeclaration(this, data);
- }
-
- public override string ToString() {
- return string.Format("[OptionDeclaration OptionType={0} OptionValue={1}]", OptionType, OptionValue);
- }
- }
-
- public class ParameterDeclarationExpression : Expression {
-
- List<AttributeSection> attributes;
-
- string parameterName;
-
- TypeReference typeReference;
-
- ParameterModifiers paramModifier;
-
- Expression defaultValue;
-
- public List<AttributeSection> Attributes {
- get {
- return attributes;
- }
- set {
- attributes = value ?? new List<AttributeSection>();
- }
- }
-
- public string ParameterName {
- get {
- return parameterName;
- }
- set {
- parameterName = string.IsNullOrEmpty(value) ? "?" : value;
- }
- }
-
- public TypeReference TypeReference {
- get {
- return typeReference;
- }
- set {
- typeReference = value ?? TypeReference.Null;
- if (!typeReference.IsNull) typeReference.Parent = this;
- }
- }
-
- public ParameterModifiers ParamModifier {
- get {
- return paramModifier;
- }
- set {
- paramModifier = value;
- }
- }
-
- public Expression DefaultValue {
- get {
- return defaultValue;
- }
- set {
- defaultValue = value ?? Expression.Null;
- if (!defaultValue.IsNull) defaultValue.Parent = this;
- }
- }
-
- public ParameterDeclarationExpression(TypeReference typeReference, string parameterName) {
- TypeReference = typeReference;
- ParameterName = parameterName;
- attributes = new List<AttributeSection>();
- defaultValue = Expression.Null;
- }
-
- public ParameterDeclarationExpression(TypeReference typeReference, string parameterName, ParameterModifiers paramModifier) {
- TypeReference = typeReference;
- ParameterName = parameterName;
- ParamModifier = paramModifier;
- attributes = new List<AttributeSection>();
- defaultValue = Expression.Null;
- }
-
- public ParameterDeclarationExpression(TypeReference typeReference, string parameterName, ParameterModifiers paramModifier, Expression defaultValue) {
- TypeReference = typeReference;
- ParameterName = parameterName;
- ParamModifier = paramModifier;
- DefaultValue = defaultValue;
- attributes = new List<AttributeSection>();
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitParameterDeclarationExpression(this, data);
- }
-
- public override string ToString() {
- return string.Format("[ParameterDeclarationExpression Attributes={0} ParameterName={1} TypeReference={2" +
- "} ParamModifier={3} DefaultValue={4}]", GetCollectionString(Attributes), ParameterName, TypeReference, ParamModifier, DefaultValue);
- }
- }
-
- public abstract class ParametrizedNode : AttributedNode {
-
- string name;
-
- List<ParameterDeclarationExpression> parameters;
-
- public string Name {
- get {
- return name;
- }
- set {
- name = value ?? "";
- }
- }
-
- public List<ParameterDeclarationExpression> Parameters {
- get {
- return parameters;
- }
- set {
- parameters = value ?? new List<ParameterDeclarationExpression>();
- }
- }
-
- protected ParametrizedNode() {
- name = "";
- parameters = new List<ParameterDeclarationExpression>();
- }
-
- protected ParametrizedNode(Modifiers modifier, List<AttributeSection> attributes, string name, List<ParameterDeclarationExpression> parameters) {
- Modifier = modifier;
- Attributes = attributes;
- Name = name;
- Parameters = parameters;
- }
- }
-
- public class ParenthesizedExpression : Expression {
-
- Expression expression;
-
- public Expression Expression {
- get {
- return expression;
- }
- set {
- expression = value ?? Expression.Null;
- if (!expression.IsNull) expression.Parent = this;
- }
- }
-
- public ParenthesizedExpression(Expression expression) {
- Expression = expression;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitParenthesizedExpression(this, data);
- }
-
- public override string ToString() {
- return string.Format("[ParenthesizedExpression Expression={0}]", Expression);
- }
- }
-
- public class PointerReferenceExpression : Expression {
-
- Expression targetObject;
-
- string memberName;
-
- List<TypeReference> typeArguments;
-
- public Expression TargetObject {
- get {
- return targetObject;
- }
- set {
- targetObject = value ?? Expression.Null;
- if (!targetObject.IsNull) targetObject.Parent = this;
- }
- }
-
- public string MemberName {
- get {
- return memberName;
- }
- set {
- memberName = value ?? "";
- }
- }
-
- public List<TypeReference> TypeArguments {
- get {
- return typeArguments;
- }
- set {
- typeArguments = value ?? new List<TypeReference>();
- }
- }
-
- public PointerReferenceExpression(Expression targetObject, string memberName) {
- TargetObject = targetObject;
- MemberName = memberName;
- typeArguments = new List<TypeReference>();
- }
-
-[Obsolete] public string Identifier { get { return MemberName; } set { MemberName = value; } }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitPointerReferenceExpression(this, data);
- }
-
- public override string ToString() {
- return string.Format("[PointerReferenceExpression TargetObject={0} MemberName={1} TypeArguments={2}]", TargetObject, MemberName, GetCollectionString(TypeArguments));
- }
- }
-
- public class PropertyDeclaration : MemberNode {
-
- Location bodyStart;
-
- Location bodyEnd;
-
- PropertyGetRegion getRegion;
-
- PropertySetRegion setRegion;
-
- public Location BodyStart {
- get {
- return bodyStart;
- }
- set {
- bodyStart = value;
- }
- }
-
- public Location BodyEnd {
- get {
- return bodyEnd;
- }
- set {
- bodyEnd = value;
- }
- }
-
- public PropertyGetRegion GetRegion {
- get {
- return getRegion;
- }
- set {
- getRegion = value ?? PropertyGetRegion.Null;
- if (!getRegion.IsNull) getRegion.Parent = this;
- }
- }
-
- public PropertySetRegion SetRegion {
- get {
- return setRegion;
- }
- set {
- setRegion = value ?? PropertySetRegion.Null;
- if (!setRegion.IsNull) setRegion.Parent = this;
- }
- }
-
- public PropertyDeclaration(Modifiers modifier, List<AttributeSection> attributes, string name, List<ParameterDeclarationExpression> parameters) {
- Modifier = modifier;
- Attributes = attributes;
- Name = name;
- Parameters = parameters;
- bodyStart = Location.Empty;
- bodyEnd = Location.Empty;
- getRegion = PropertyGetRegion.Null;
- setRegion = PropertySetRegion.Null;
- }
-
- public bool HasGetRegion {
- get {
- return !getRegion.IsNull;
- }
- }
-
- public bool HasSetRegion {
- get {
- return !setRegion.IsNull;
- }
- }
-
- public bool IsReadOnly {
- get {
- return HasGetRegion && !HasSetRegion;
- }
- }
-
-
- internal PropertyDeclaration(string name, TypeReference typeReference, Modifiers modifier, List<AttributeSection> attributes) : this(modifier, attributes, name, null)
- {
- this.TypeReference = typeReference;
- if ((modifier & Modifiers.ReadOnly) != Modifiers.ReadOnly) {
- this.SetRegion = new PropertySetRegion(null, null);
- }
- if ((modifier & Modifiers.WriteOnly) != Modifiers.WriteOnly) {
- this.GetRegion = new PropertyGetRegion(null, null);
- }
- }
-
- public bool IsWriteOnly {
- get {
- return !HasGetRegion && HasSetRegion;
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitPropertyDeclaration(this, data);
- }
-
- public override string ToString() {
- return string.Format("[PropertyDeclaration BodyStart={0} BodyEnd={1} GetRegion={2} SetRegion={3} Interf" +
- "aceImplementations={4} TypeReference={5} Name={6} Parameters={7} Attributes={8} " +
- "Modifier={9}]", BodyStart, BodyEnd, GetRegion, SetRegion, GetCollectionString(InterfaceImplementations), TypeReference, Name, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier);
- }
- }
-
- public class PropertyGetRegion : PropertyGetSetRegion {
-
- public PropertyGetRegion(BlockStatement block, List<AttributeSection> attributes) :
- base(block, attributes) {
- }
-
- public static PropertyGetRegion Null {
- get {
- return NullPropertyGetRegion.Instance;
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitPropertyGetRegion(this, data);
- }
-
- public override string ToString() {
- return string.Format("[PropertyGetRegion Block={0} Attributes={1} Modifier={2}]", Block, GetCollectionString(Attributes), Modifier);
- }
- }
-
- internal sealed class NullPropertyGetRegion : PropertyGetRegion {
-
- private NullPropertyGetRegion() :
- base(null, null) {
- }
-
- internal static NullPropertyGetRegion Instance = new NullPropertyGetRegion();
-
- public override bool IsNull {
- get {
- return true;
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return null;
- }
-
- public override string ToString() {
- return "[NullPropertyGetRegion]";
- }
- }
-
- public abstract class PropertyGetSetRegion : AttributedNode, INullable {
-
- BlockStatement block;
-
- public BlockStatement Block {
- get {
- return block;
- }
- set {
- block = value ?? BlockStatement.Null;
- if (!block.IsNull) block.Parent = this;
- }
- }
-
- protected PropertyGetSetRegion(BlockStatement block, List<AttributeSection> attributes) {
- Block = block;
- Attributes = attributes;
- }
-
- public virtual bool IsNull {
- get {
- return false;
- }
- }
- }
-
- public class PropertySetRegion : PropertyGetSetRegion {
-
- List<ParameterDeclarationExpression> parameters;
-
- public List<ParameterDeclarationExpression> Parameters {
- get {
- return parameters;
- }
- set {
- parameters = value ?? new List<ParameterDeclarationExpression>();
- }
- }
-
- public PropertySetRegion(BlockStatement block, List<AttributeSection> attributes) :
- base(block, attributes) {
- parameters = new List<ParameterDeclarationExpression>();
- }
-
- public static PropertySetRegion Null {
- get {
- return NullPropertySetRegion.Instance;
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitPropertySetRegion(this, data);
- }
-
- public override string ToString() {
- return string.Format("[PropertySetRegion Parameters={0} Block={1} Attributes={2} Modifier={3}]", GetCollectionString(Parameters), Block, GetCollectionString(Attributes), Modifier);
- }
- }
-
- internal sealed class NullPropertySetRegion : PropertySetRegion {
-
- private NullPropertySetRegion() :
- base(null, null) {
- }
-
- internal static NullPropertySetRegion Instance = new NullPropertySetRegion();
-
- public override bool IsNull {
- get {
- return true;
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return null;
- }
-
- public override string ToString() {
- return "[NullPropertySetRegion]";
- }
- }
-
- public class QueryExpression : Expression {
-
- QueryExpressionFromClause fromClause;
-
- bool isQueryContinuation;
-
- List<QueryExpressionClause> middleClauses;
-
- QueryExpressionClause selectOrGroupClause;
-
- public QueryExpressionFromClause FromClause {
- get {
- return fromClause;
- }
- set {
- fromClause = value ?? QueryExpressionFromClause.Null;
- if (!fromClause.IsNull) fromClause.Parent = this;
- }
- }
-
- public bool IsQueryContinuation {
- get {
- return isQueryContinuation;
- }
- set {
- isQueryContinuation = value;
- }
- }
-
- public List<QueryExpressionClause> MiddleClauses {
- get {
- return middleClauses;
- }
- set {
- middleClauses = value ?? new List<QueryExpressionClause>();
- }
- }
-
- public QueryExpressionClause SelectOrGroupClause {
- get {
- return selectOrGroupClause;
- }
- set {
- selectOrGroupClause = value ?? QueryExpressionClause.Null;
- if (!selectOrGroupClause.IsNull) selectOrGroupClause.Parent = this;
- }
- }
-
- public QueryExpression() {
- fromClause = QueryExpressionFromClause.Null;
- middleClauses = new List<QueryExpressionClause>();
- selectOrGroupClause = QueryExpressionClause.Null;
- }
-
- public new static QueryExpression Null {
- get {
- return NullQueryExpression.Instance;
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitQueryExpression(this, data);
- }
-
- public override string ToString() {
- return string.Format("[QueryExpression FromClause={0} IsQueryContinuation={1} MiddleClauses={2} SelectO" +
- "rGroupClause={3}]", FromClause, IsQueryContinuation, GetCollectionString(MiddleClauses), SelectOrGroupClause);
- }
- }
-
- internal sealed class NullQueryExpression : QueryExpression {
-
- internal static NullQueryExpression Instance = new NullQueryExpression();
-
- public override bool IsNull {
- get {
- return true;
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return null;
- }
-
- public override string ToString() {
- return "[NullQueryExpression]";
- }
- }
-
- public class QueryExpressionAggregateClause : QueryExpressionClause {
-
- QueryExpressionFromClause fromClause;
-
- List<QueryExpressionClause> middleClauses;
-
- List<ExpressionRangeVariable> intoVariables;
-
- public QueryExpressionFromClause FromClause {
- get {
- return fromClause;
- }
- set {
- fromClause = value ?? QueryExpressionFromClause.Null;
- if (!fromClause.IsNull) fromClause.Parent = this;
- }
- }
-
- public List<QueryExpressionClause> MiddleClauses {
- get {
- return middleClauses;
- }
- set {
- middleClauses = value ?? new List<QueryExpressionClause>();
- }
- }
-
- public List<ExpressionRangeVariable> IntoVariables {
- get {
- return intoVariables;
- }
- set {
- intoVariables = value ?? new List<ExpressionRangeVariable>();
- }
- }
-
- public QueryExpressionAggregateClause() {
- fromClause = QueryExpressionFromClause.Null;
- middleClauses = new List<QueryExpressionClause>();
- intoVariables = new List<ExpressionRangeVariable>();
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitQueryExpressionAggregateClause(this, data);
- }
-
- public override string ToString() {
- return string.Format("[QueryExpressionAggregateClause FromClause={0} MiddleClauses={1} IntoVariables={2" +
- "}]", FromClause, GetCollectionString(MiddleClauses), GetCollectionString(IntoVariables));
- }
- }
-
- public abstract class QueryExpressionClause : AbstractNode, INullable {
-
- protected QueryExpressionClause() {
- }
-
- public virtual bool IsNull {
- get {
- return false;
- }
- }
-
- public static QueryExpressionClause Null {
- get {
- return NullQueryExpressionClause.Instance;
- }
- }
- }
-
- internal sealed class NullQueryExpressionClause : QueryExpressionClause {
-
- internal static NullQueryExpressionClause Instance = new NullQueryExpressionClause();
-
- public override bool IsNull {
- get {
- return true;
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return null;
- }
-
- public override string ToString() {
- return "[NullQueryExpressionClause]";
- }
- }
-
- public class QueryExpressionDistinctClause : QueryExpressionClause {
-
- public QueryExpressionDistinctClause() {
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitQueryExpressionDistinctClause(this, data);
- }
-
- public override string ToString() {
- return "[QueryExpressionDistinctClause]";
- }
- }
-
- public class QueryExpressionFromClause : QueryExpressionFromOrJoinClause {
-
- public QueryExpressionFromClause() {
- }
-
- public new static QueryExpressionFromClause Null {
- get {
- return NullQueryExpressionFromClause.Instance;
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitQueryExpressionFromClause(this, data);
- }
-
- public override string ToString() {
- return string.Format("[QueryExpressionFromClause Type={0} Identifier={1} InExpression={2}]", Type, Identifier, InExpression);
- }
- }
-
- internal sealed class NullQueryExpressionFromClause : QueryExpressionFromClause {
-
- internal static NullQueryExpressionFromClause Instance = new NullQueryExpressionFromClause();
-
- public override bool IsNull {
- get {
- return true;
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return null;
- }
-
- public override string ToString() {
- return "[NullQueryExpressionFromClause]";
- }
- }
-
- public abstract class QueryExpressionFromOrJoinClause : QueryExpressionClause {
-
- TypeReference type;
-
- string identifier;
-
- Expression inExpression;
-
- public TypeReference Type {
- get {
- return type;
- }
- set {
- type = value ?? TypeReference.Null;
- if (!type.IsNull) type.Parent = this;
- }
- }
-
- public string Identifier {
- get {
- return identifier;
- }
- set {
- identifier = string.IsNullOrEmpty(value) ? "?" : value;
- }
- }
-
- public Expression InExpression {
- get {
- return inExpression;
- }
- set {
- inExpression = value ?? Expression.Null;
- if (!inExpression.IsNull) inExpression.Parent = this;
- }
- }
-
- protected QueryExpressionFromOrJoinClause() {
- type = TypeReference.Null;
- identifier = "?";
- inExpression = Expression.Null;
- }
- }
-
- public class QueryExpressionGroupClause : QueryExpressionClause {
-
- Expression projection;
-
- Expression groupBy;
-
- public Expression Projection {
- get {
- return projection;
- }
- set {
- projection = value ?? Expression.Null;
- if (!projection.IsNull) projection.Parent = this;
- }
- }
-
- public Expression GroupBy {
- get {
- return groupBy;
- }
- set {
- groupBy = value ?? Expression.Null;
- if (!groupBy.IsNull) groupBy.Parent = this;
- }
- }
-
- public QueryExpressionGroupClause() {
- projection = Expression.Null;
- groupBy = Expression.Null;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitQueryExpressionGroupClause(this, data);
- }
-
- public override string ToString() {
- return string.Format("[QueryExpressionGroupClause Projection={0} GroupBy={1}]", Projection, GroupBy);
- }
- }
-
- public class QueryExpressionGroupJoinVBClause : QueryExpressionClause {
-
- QueryExpressionJoinVBClause joinClause;
-
- List<ExpressionRangeVariable> intoVariables;
-
- public QueryExpressionJoinVBClause JoinClause {
- get {
- return joinClause;
- }
- set {
- joinClause = value ?? QueryExpressionJoinVBClause.Null;
- if (!joinClause.IsNull) joinClause.Parent = this;
- }
- }
-
- public List<ExpressionRangeVariable> IntoVariables {
- get {
- return intoVariables;
- }
- set {
- intoVariables = value ?? new List<ExpressionRangeVariable>();
- }
- }
-
- public QueryExpressionGroupJoinVBClause() {
- joinClause = QueryExpressionJoinVBClause.Null;
- intoVariables = new List<ExpressionRangeVariable>();
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitQueryExpressionGroupJoinVBClause(this, data);
- }
-
- public override string ToString() {
- return string.Format("[QueryExpressionGroupJoinVBClause JoinClause={0} IntoVariables={1}]", JoinClause, GetCollectionString(IntoVariables));
- }
- }
-
- public class QueryExpressionGroupVBClause : QueryExpressionClause {
-
- List<ExpressionRangeVariable> groupVariables;
-
- List<ExpressionRangeVariable> byVariables;
-
- List<ExpressionRangeVariable> intoVariables;
-
- public List<ExpressionRangeVariable> GroupVariables {
- get {
- return groupVariables;
- }
- set {
- groupVariables = value ?? new List<ExpressionRangeVariable>();
- }
- }
-
- public List<ExpressionRangeVariable> ByVariables {
- get {
- return byVariables;
- }
- set {
- byVariables = value ?? new List<ExpressionRangeVariable>();
- }
- }
-
- public List<ExpressionRangeVariable> IntoVariables {
- get {
- return intoVariables;
- }
- set {
- intoVariables = value ?? new List<ExpressionRangeVariable>();
- }
- }
-
- public QueryExpressionGroupVBClause() {
- groupVariables = new List<ExpressionRangeVariable>();
- byVariables = new List<ExpressionRangeVariable>();
- intoVariables = new List<ExpressionRangeVariable>();
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitQueryExpressionGroupVBClause(this, data);
- }
-
- public override string ToString() {
- return string.Format("[QueryExpressionGroupVBClause GroupVariables={0} ByVariables={1} IntoVariables={2" +
- "}]", GetCollectionString(GroupVariables), GetCollectionString(ByVariables), GetCollectionString(IntoVariables));
- }
- }
-
- public class QueryExpressionJoinClause : QueryExpressionFromOrJoinClause {
-
- Expression onExpression;
-
- Expression equalsExpression;
-
- string intoIdentifier;
-
- public Expression OnExpression {
- get {
- return onExpression;
- }
- set {
- onExpression = value ?? Expression.Null;
- if (!onExpression.IsNull) onExpression.Parent = this;
- }
- }
-
- public Expression EqualsExpression {
- get {
- return equalsExpression;
- }
- set {
- equalsExpression = value ?? Expression.Null;
- if (!equalsExpression.IsNull) equalsExpression.Parent = this;
- }
- }
-
- public string IntoIdentifier {
- get {
- return intoIdentifier;
- }
- set {
- intoIdentifier = value ?? "";
- }
- }
-
- public QueryExpressionJoinClause() {
- onExpression = Expression.Null;
- equalsExpression = Expression.Null;
- intoIdentifier = "";
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitQueryExpressionJoinClause(this, data);
- }
-
- public override string ToString() {
- return string.Format("[QueryExpressionJoinClause OnExpression={0} EqualsExpression={1} IntoIdentifier={" +
- "2} Type={3} Identifier={4} InExpression={5}]", OnExpression, EqualsExpression, IntoIdentifier, Type, Identifier, InExpression);
- }
- }
-
- public class QueryExpressionJoinConditionVB : AbstractNode {
-
- Expression leftSide;
-
- Expression rightSide;
-
- public Expression LeftSide {
- get {
- return leftSide;
- }
- set {
- leftSide = value ?? Expression.Null;
- if (!leftSide.IsNull) leftSide.Parent = this;
- }
- }
-
- public Expression RightSide {
- get {
- return rightSide;
- }
- set {
- rightSide = value ?? Expression.Null;
- if (!rightSide.IsNull) rightSide.Parent = this;
- }
- }
-
- public QueryExpressionJoinConditionVB() {
- leftSide = Expression.Null;
- rightSide = Expression.Null;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitQueryExpressionJoinConditionVB(this, data);
- }
-
- public override string ToString() {
- return string.Format("[QueryExpressionJoinConditionVB LeftSide={0} RightSide={1}]", LeftSide, RightSide);
- }
- }
-
- public class QueryExpressionJoinVBClause : QueryExpressionClause {
-
- QueryExpressionFromClause joinVariable;
-
- QueryExpressionJoinVBClause subJoin;
-
- List<QueryExpressionJoinConditionVB> conditions;
-
- public QueryExpressionFromClause JoinVariable {
- get {
- return joinVariable;
- }
- set {
- joinVariable = value ?? QueryExpressionFromClause.Null;
- if (!joinVariable.IsNull) joinVariable.Parent = this;
- }
- }
-
- public QueryExpressionJoinVBClause SubJoin {
- get {
- return subJoin;
- }
- set {
- subJoin = value ?? QueryExpressionJoinVBClause.Null;
- if (!subJoin.IsNull) subJoin.Parent = this;
- }
- }
-
- public List<QueryExpressionJoinConditionVB> Conditions {
- get {
- return conditions;
- }
- set {
- conditions = value ?? new List<QueryExpressionJoinConditionVB>();
- }
- }
-
- public QueryExpressionJoinVBClause() {
- joinVariable = QueryExpressionFromClause.Null;
- subJoin = QueryExpressionJoinVBClause.Null;
- conditions = new List<QueryExpressionJoinConditionVB>();
- }
-
- public new static QueryExpressionJoinVBClause Null {
- get {
- return NullQueryExpressionJoinVBClause.Instance;
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitQueryExpressionJoinVBClause(this, data);
- }
-
- public override string ToString() {
- return string.Format("[QueryExpressionJoinVBClause JoinVariable={0} SubJoin={1} Conditions={2}]", JoinVariable, SubJoin, GetCollectionString(Conditions));
- }
- }
-
- internal sealed class NullQueryExpressionJoinVBClause : QueryExpressionJoinVBClause {
-
- internal static NullQueryExpressionJoinVBClause Instance = new NullQueryExpressionJoinVBClause();
-
- public override bool IsNull {
- get {
- return true;
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return null;
- }
-
- public override string ToString() {
- return "[NullQueryExpressionJoinVBClause]";
- }
- }
-
- public class QueryExpressionLetClause : QueryExpressionClause {
-
- string identifier;
-
- Expression expression;
-
- public string Identifier {
- get {
- return identifier;
- }
- set {
- identifier = string.IsNullOrEmpty(value) ? "?" : value;
- }
- }
-
- public Expression Expression {
- get {
- return expression;
- }
- set {
- expression = value ?? Expression.Null;
- if (!expression.IsNull) expression.Parent = this;
- }
- }
-
- public QueryExpressionLetClause() {
- identifier = "?";
- expression = Expression.Null;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitQueryExpressionLetClause(this, data);
- }
-
- public override string ToString() {
- return string.Format("[QueryExpressionLetClause Identifier={0} Expression={1}]", Identifier, Expression);
- }
- }
-
- public class QueryExpressionLetVBClause : QueryExpressionClause {
-
- List<ExpressionRangeVariable> variables;
-
- public List<ExpressionRangeVariable> Variables {
- get {
- return variables;
- }
- set {
- variables = value ?? new List<ExpressionRangeVariable>();
- }
- }
-
- public QueryExpressionLetVBClause() {
- variables = new List<ExpressionRangeVariable>();
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitQueryExpressionLetVBClause(this, data);
- }
-
- public override string ToString() {
- return string.Format("[QueryExpressionLetVBClause Variables={0}]", GetCollectionString(Variables));
- }
- }
-
- public class QueryExpressionOrderClause : QueryExpressionClause {
-
- List<QueryExpressionOrdering> orderings;
-
- public List<QueryExpressionOrdering> Orderings {
- get {
- return orderings;
- }
- set {
- orderings = value ?? new List<QueryExpressionOrdering>();
- }
- }
-
- public QueryExpressionOrderClause() {
- orderings = new List<QueryExpressionOrdering>();
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitQueryExpressionOrderClause(this, data);
- }
-
- public override string ToString() {
- return string.Format("[QueryExpressionOrderClause Orderings={0}]", GetCollectionString(Orderings));
- }
- }
-
- public class QueryExpressionOrdering : AbstractNode {
-
- Expression criteria;
-
- QueryExpressionOrderingDirection direction;
-
- public Expression Criteria {
- get {
- return criteria;
- }
- set {
- criteria = value ?? Expression.Null;
- if (!criteria.IsNull) criteria.Parent = this;
- }
- }
-
- public QueryExpressionOrderingDirection Direction {
- get {
- return direction;
- }
- set {
- direction = value;
- }
- }
-
- public QueryExpressionOrdering() {
- criteria = Expression.Null;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitQueryExpressionOrdering(this, data);
- }
-
- public override string ToString() {
- return string.Format("[QueryExpressionOrdering Criteria={0} Direction={1}]", Criteria, Direction);
- }
- }
-
- public class QueryExpressionPartitionVBClause : QueryExpressionClause {
-
- Expression expression;
-
- QueryExpressionPartitionType partitionType;
-
- public Expression Expression {
- get {
- return expression;
- }
- set {
- expression = value ?? Expression.Null;
- if (!expression.IsNull) expression.Parent = this;
- }
- }
-
- public QueryExpressionPartitionType PartitionType {
- get {
- return partitionType;
- }
- set {
- partitionType = value;
- }
- }
-
- public QueryExpressionPartitionVBClause() {
- expression = Expression.Null;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitQueryExpressionPartitionVBClause(this, data);
- }
-
- public override string ToString() {
- return string.Format("[QueryExpressionPartitionVBClause Expression={0} PartitionType={1}]", Expression, PartitionType);
- }
- }
-
- public class QueryExpressionSelectClause : QueryExpressionClause {
-
- Expression projection;
-
- public Expression Projection {
- get {
- return projection;
- }
- set {
- projection = value ?? Expression.Null;
- if (!projection.IsNull) projection.Parent = this;
- }
- }
-
- public QueryExpressionSelectClause() {
- projection = Expression.Null;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitQueryExpressionSelectClause(this, data);
- }
-
- public override string ToString() {
- return string.Format("[QueryExpressionSelectClause Projection={0}]", Projection);
- }
- }
-
- public class QueryExpressionSelectVBClause : QueryExpressionClause {
-
- List<ExpressionRangeVariable> variables;
-
- public List<ExpressionRangeVariable> Variables {
- get {
- return variables;
- }
- set {
- variables = value ?? new List<ExpressionRangeVariable>();
- }
- }
-
- public QueryExpressionSelectVBClause() {
- variables = new List<ExpressionRangeVariable>();
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitQueryExpressionSelectVBClause(this, data);
- }
-
- public override string ToString() {
- return string.Format("[QueryExpressionSelectVBClause Variables={0}]", GetCollectionString(Variables));
- }
- }
-
- public class QueryExpressionWhereClause : QueryExpressionClause {
-
- Expression condition;
-
- public Expression Condition {
- get {
- return condition;
- }
- set {
- condition = value ?? Expression.Null;
- if (!condition.IsNull) condition.Parent = this;
- }
- }
-
- public QueryExpressionWhereClause() {
- condition = Expression.Null;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitQueryExpressionWhereClause(this, data);
- }
-
- public override string ToString() {
- return string.Format("[QueryExpressionWhereClause Condition={0}]", Condition);
- }
- }
-
- public class RaiseEventStatement : Statement {
-
- string eventName;
-
- List<Expression> arguments;
-
- public string EventName {
- get {
- return eventName;
- }
- set {
- eventName = value ?? "";
- }
- }
-
- public List<Expression> Arguments {
- get {
- return arguments;
- }
- set {
- arguments = value ?? new List<Expression>();
- }
- }
-
- public RaiseEventStatement(string eventName, List<Expression> arguments) {
- EventName = eventName;
- Arguments = arguments;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitRaiseEventStatement(this, data);
- }
-
- public override string ToString() {
- return string.Format("[RaiseEventStatement EventName={0} Arguments={1}]", EventName, GetCollectionString(Arguments));
- }
- }
-
- public class ReDimStatement : Statement {
-
- List<InvocationExpression> reDimClauses;
-
- bool isPreserve;
-
- public List<InvocationExpression> ReDimClauses {
- get {
- return reDimClauses;
- }
- set {
- reDimClauses = value ?? new List<InvocationExpression>();
- }
- }
-
- public bool IsPreserve {
- get {
- return isPreserve;
- }
- set {
- isPreserve = value;
- }
- }
-
- public ReDimStatement(bool isPreserve) {
- IsPreserve = isPreserve;
- reDimClauses = new List<InvocationExpression>();
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitReDimStatement(this, data);
- }
-
- public override string ToString() {
- return string.Format("[ReDimStatement ReDimClauses={0} IsPreserve={1}]", GetCollectionString(ReDimClauses), IsPreserve);
- }
- }
-
- public class RemoveHandlerStatement : Statement {
-
- Expression eventExpression;
-
- Expression handlerExpression;
-
- public Expression EventExpression {
- get {
- return eventExpression;
- }
- set {
- eventExpression = value ?? Expression.Null;
- if (!eventExpression.IsNull) eventExpression.Parent = this;
- }
- }
-
- public Expression HandlerExpression {
- get {
- return handlerExpression;
- }
- set {
- handlerExpression = value ?? Expression.Null;
- if (!handlerExpression.IsNull) handlerExpression.Parent = this;
- }
- }
-
- public RemoveHandlerStatement(Expression eventExpression, Expression handlerExpression) {
- EventExpression = eventExpression;
- HandlerExpression = handlerExpression;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitRemoveHandlerStatement(this, data);
- }
-
- public override string ToString() {
- return string.Format("[RemoveHandlerStatement EventExpression={0} HandlerExpression={1}]", EventExpression, HandlerExpression);
- }
- }
-
- public class ResumeStatement : Statement {
-
- string labelName;
-
- bool isResumeNext;
-
- public string LabelName {
- get {
- return labelName;
- }
- set {
- labelName = value ?? "";
- }
- }
-
- public bool IsResumeNext {
- get {
- return isResumeNext;
- }
- set {
- isResumeNext = value;
- }
- }
-
- public ResumeStatement(bool isResumeNext) {
- IsResumeNext = isResumeNext;
- labelName = "";
- }
-
- public ResumeStatement(string labelName) {
- LabelName = labelName;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitResumeStatement(this, data);
- }
-
- public override string ToString() {
- return string.Format("[ResumeStatement LabelName={0} IsResumeNext={1}]", LabelName, IsResumeNext);
- }
- }
-
- public class ReturnStatement : Statement {
-
- Expression expression;
-
- public Expression Expression {
- get {
- return expression;
- }
- set {
- expression = value ?? Expression.Null;
- if (!expression.IsNull) expression.Parent = this;
- }
- }
-
- public ReturnStatement(Expression expression) {
- Expression = expression;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitReturnStatement(this, data);
- }
-
- public override string ToString() {
- return string.Format("[ReturnStatement Expression={0}]", Expression);
- }
- }
-
- public class SizeOfExpression : Expression {
-
- TypeReference typeReference;
-
- public TypeReference TypeReference {
- get {
- return typeReference;
- }
- set {
- typeReference = value ?? TypeReference.Null;
- if (!typeReference.IsNull) typeReference.Parent = this;
- }
- }
-
- public SizeOfExpression(TypeReference typeReference) {
- TypeReference = typeReference;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitSizeOfExpression(this, data);
- }
-
- public override string ToString() {
- return string.Format("[SizeOfExpression TypeReference={0}]", TypeReference);
- }
- }
-
- public class StackAllocExpression : Expression {
-
- TypeReference typeReference;
-
- Expression expression;
-
- public TypeReference TypeReference {
- get {
- return typeReference;
- }
- set {
- typeReference = value ?? TypeReference.Null;
- if (!typeReference.IsNull) typeReference.Parent = this;
- }
- }
-
- public Expression Expression {
- get {
- return expression;
- }
- set {
- expression = value ?? Expression.Null;
- if (!expression.IsNull) expression.Parent = this;
- }
- }
-
- public StackAllocExpression(TypeReference typeReference, Expression expression) {
- TypeReference = typeReference;
- Expression = expression;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitStackAllocExpression(this, data);
- }
-
- public override string ToString() {
- return string.Format("[StackAllocExpression TypeReference={0} Expression={1}]", TypeReference, Expression);
- }
- }
-
- public class StopStatement : Statement {
-
- public StopStatement() {
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitStopStatement(this, data);
- }
-
- public override string ToString() {
- return "[StopStatement]";
- }
- }
-
- public class SwitchSection : BlockStatement {
-
- List<CaseLabel> switchLabels;
-
- public List<CaseLabel> SwitchLabels {
- get {
- return switchLabels;
- }
- set {
- switchLabels = value ?? new List<CaseLabel>();
- }
- }
-
- public SwitchSection() {
- switchLabels = new List<CaseLabel>();
- }
-
- public SwitchSection(List<CaseLabel> switchLabels) {
- SwitchLabels = switchLabels;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitSwitchSection(this, data);
- }
-
- public override string ToString() {
- return string.Format("[SwitchSection SwitchLabels={0}]", GetCollectionString(SwitchLabels));
- }
- }
-
- public class SwitchStatement : Statement {
-
- Expression switchExpression;
-
- List<SwitchSection> switchSections;
-
- public Expression SwitchExpression {
- get {
- return switchExpression;
- }
- set {
- switchExpression = value ?? Expression.Null;
- if (!switchExpression.IsNull) switchExpression.Parent = this;
- }
- }
-
- public List<SwitchSection> SwitchSections {
- get {
- return switchSections;
- }
- set {
- switchSections = value ?? new List<SwitchSection>();
- }
- }
-
- public SwitchStatement(Expression switchExpression, List<SwitchSection> switchSections) {
- SwitchExpression = switchExpression;
- SwitchSections = switchSections;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitSwitchStatement(this, data);
- }
-
- public override string ToString() {
- return string.Format("[SwitchStatement SwitchExpression={0} SwitchSections={1}]", SwitchExpression, GetCollectionString(SwitchSections));
- }
- }
-
- public class TemplateDefinition : AttributedNode {
-
- string name;
-
- List<TypeReference> bases;
-
- public string Name {
- get {
- return name;
- }
- set {
- name = string.IsNullOrEmpty(value) ? "?" : value;
- }
- }
-
- public List<TypeReference> Bases {
- get {
- return bases;
- }
- set {
- bases = value ?? new List<TypeReference>();
- }
- }
-
- public TemplateDefinition(string name, List<AttributeSection> attributes) {
- Name = name;
- Attributes = attributes;
- bases = new List<TypeReference>();
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitTemplateDefinition(this, data);
- }
-
- public override string ToString() {
- return string.Format("[TemplateDefinition Name={0} Bases={1} Attributes={2} Modifier={3}]", Name, GetCollectionString(Bases), GetCollectionString(Attributes), Modifier);
- }
- }
-
- public class ThisReferenceExpression : Expression {
-
- public ThisReferenceExpression() {
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitThisReferenceExpression(this, data);
- }
-
- public override string ToString() {
- return "[ThisReferenceExpression]";
- }
- }
-
- public class ThrowStatement : Statement {
-
- Expression expression;
-
- public Expression Expression {
- get {
- return expression;
- }
- set {
- expression = value ?? Expression.Null;
- if (!expression.IsNull) expression.Parent = this;
- }
- }
-
- public ThrowStatement(Expression expression) {
- Expression = expression;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitThrowStatement(this, data);
- }
-
- public override string ToString() {
- return string.Format("[ThrowStatement Expression={0}]", Expression);
- }
- }
-
- public class TryCatchStatement : Statement {
-
- Statement statementBlock;
-
- List<CatchClause> catchClauses;
-
- Statement finallyBlock;
-
- public Statement StatementBlock {
- get {
- return statementBlock;
- }
- set {
- statementBlock = value ?? Statement.Null;
- if (!statementBlock.IsNull) statementBlock.Parent = this;
- }
- }
-
- public List<CatchClause> CatchClauses {
- get {
- return catchClauses;
- }
- set {
- catchClauses = value ?? new List<CatchClause>();
- }
- }
-
- public Statement FinallyBlock {
- get {
- return finallyBlock;
- }
- set {
- finallyBlock = value ?? Statement.Null;
- if (!finallyBlock.IsNull) finallyBlock.Parent = this;
- }
- }
-
- public TryCatchStatement(Statement statementBlock, List<CatchClause> catchClauses, Statement finallyBlock) {
- StatementBlock = statementBlock;
- CatchClauses = catchClauses;
- FinallyBlock = finallyBlock;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitTryCatchStatement(this, data);
- }
-
- public override string ToString() {
- return string.Format("[TryCatchStatement StatementBlock={0} CatchClauses={1} FinallyBlock={2}]", StatementBlock, GetCollectionString(CatchClauses), FinallyBlock);
- }
- }
-
- public class TypeDeclaration : AttributedNode {
-
- string name;
-
- ClassType type;
-
- List<TypeReference> baseTypes;
-
- List<TemplateDefinition> templates;
-
- Location bodyStartLocation;
-
- public string Name {
- get {
- return name;
- }
- set {
- name = value ?? "";
- }
- }
-
- public ClassType Type {
- get {
- return type;
- }
- set {
- type = value;
- }
- }
-
- public List<TypeReference> BaseTypes {
- get {
- return baseTypes;
- }
- set {
- baseTypes = value ?? new List<TypeReference>();
- }
- }
-
- public List<TemplateDefinition> Templates {
- get {
- return templates;
- }
- set {
- templates = value ?? new List<TemplateDefinition>();
- }
- }
-
- public Location BodyStartLocation {
- get {
- return bodyStartLocation;
- }
- set {
- bodyStartLocation = value;
- }
- }
-
- public TypeDeclaration(Modifiers modifier, List<AttributeSection> attributes) {
- Modifier = modifier;
- Attributes = attributes;
- name = "";
- baseTypes = new List<TypeReference>();
- templates = new List<TemplateDefinition>();
- bodyStartLocation = Location.Empty;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitTypeDeclaration(this, data);
- }
-
- public override string ToString() {
- return string.Format("[TypeDeclaration Name={0} Type={1} BaseTypes={2} Templates={3} BodyStartLocation=" +
- "{4} Attributes={5} Modifier={6}]", Name, Type, GetCollectionString(BaseTypes), GetCollectionString(Templates), BodyStartLocation, GetCollectionString(Attributes), Modifier);
- }
- }
-
- public class TypeOfExpression : Expression {
-
- TypeReference typeReference;
-
- public TypeReference TypeReference {
- get {
- return typeReference;
- }
- set {
- typeReference = value ?? TypeReference.Null;
- if (!typeReference.IsNull) typeReference.Parent = this;
- }
- }
-
- public TypeOfExpression(TypeReference typeReference) {
- TypeReference = typeReference;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitTypeOfExpression(this, data);
- }
-
- public override string ToString() {
- return string.Format("[TypeOfExpression TypeReference={0}]", TypeReference);
- }
- }
-
- public class TypeOfIsExpression : Expression {
-
- Expression expression;
-
- TypeReference typeReference;
-
- public Expression Expression {
- get {
- return expression;
- }
- set {
- expression = value ?? Expression.Null;
- if (!expression.IsNull) expression.Parent = this;
- }
- }
-
- public TypeReference TypeReference {
- get {
- return typeReference;
- }
- set {
- typeReference = value ?? TypeReference.Null;
- if (!typeReference.IsNull) typeReference.Parent = this;
- }
- }
-
- public TypeOfIsExpression(Expression expression, TypeReference typeReference) {
- Expression = expression;
- TypeReference = typeReference;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitTypeOfIsExpression(this, data);
- }
-
- public override string ToString() {
- return string.Format("[TypeOfIsExpression Expression={0} TypeReference={1}]", Expression, TypeReference);
- }
- }
-
- public class TypeReferenceExpression : Expression {
-
- TypeReference typeReference;
-
- public TypeReference TypeReference {
- get {
- return typeReference;
- }
- set {
- typeReference = value ?? TypeReference.Null;
- if (!typeReference.IsNull) typeReference.Parent = this;
- }
- }
-
- public TypeReferenceExpression(TypeReference typeReference) {
- TypeReference = typeReference;
- }
-
-[Obsolete] public TypeReferenceExpression(string typeName) : this(new TypeReference(typeName)) {}
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitTypeReferenceExpression(this, data);
- }
-
- public override string ToString() {
- return string.Format("[TypeReferenceExpression TypeReference={0}]", TypeReference);
- }
- }
-
- public class UnaryOperatorExpression : Expression {
-
- UnaryOperatorType op;
-
- Expression expression;
-
- public UnaryOperatorType Op {
- get {
- return op;
- }
- set {
- op = value;
- }
- }
-
- public Expression Expression {
- get {
- return expression;
- }
- set {
- expression = value ?? Expression.Null;
- if (!expression.IsNull) expression.Parent = this;
- }
- }
-
- public UnaryOperatorExpression(UnaryOperatorType op) {
- Op = op;
- expression = Expression.Null;
- }
-
- public UnaryOperatorExpression(Expression expression, UnaryOperatorType op) {
- Expression = expression;
- Op = op;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitUnaryOperatorExpression(this, data);
- }
-
- public override string ToString() {
- return string.Format("[UnaryOperatorExpression Op={0} Expression={1}]", Op, Expression);
- }
- }
-
- public class UncheckedExpression : Expression {
-
- Expression expression;
-
- public Expression Expression {
- get {
- return expression;
- }
- set {
- expression = value ?? Expression.Null;
- if (!expression.IsNull) expression.Parent = this;
- }
- }
-
- public UncheckedExpression(Expression expression) {
- Expression = expression;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitUncheckedExpression(this, data);
- }
-
- public override string ToString() {
- return string.Format("[UncheckedExpression Expression={0}]", Expression);
- }
- }
-
- public class UncheckedStatement : Statement {
-
- Statement block;
-
- public Statement Block {
- get {
- return block;
- }
- set {
- block = value ?? Statement.Null;
- if (!block.IsNull) block.Parent = this;
- }
- }
-
- public UncheckedStatement(Statement block) {
- Block = block;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitUncheckedStatement(this, data);
- }
-
- public override string ToString() {
- return string.Format("[UncheckedStatement Block={0}]", Block);
- }
- }
-
- public class UnsafeStatement : Statement {
-
- Statement block;
-
- public Statement Block {
- get {
- return block;
- }
- set {
- block = value ?? Statement.Null;
- if (!block.IsNull) block.Parent = this;
- }
- }
-
- public UnsafeStatement(Statement block) {
- Block = block;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitUnsafeStatement(this, data);
- }
-
- public override string ToString() {
- return string.Format("[UnsafeStatement Block={0}]", Block);
- }
- }
-
- public class Using : AbstractNode {
-
- string name;
-
- TypeReference alias;
-
- public string Name {
- get {
- return name;
- }
- set {
- name = string.IsNullOrEmpty(value) ? "?" : value;
- }
- }
-
- public TypeReference Alias {
- get {
- return alias;
- }
- set {
- alias = value ?? TypeReference.Null;
- if (!alias.IsNull) alias.Parent = this;
- }
- }
-
- public Using(string name) {
- Name = name;
- alias = TypeReference.Null;
- }
-
- public Using(string name, TypeReference alias) {
- Name = name;
- Alias = alias;
- }
-
- public bool IsAlias {
- get {
- return !alias.IsNull;
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitUsing(this, data);
- }
-
- public override string ToString() {
- return string.Format("[Using Name={0} Alias={1}]", Name, Alias);
- }
- }
-
- public class UsingDeclaration : AbstractNode {
-
- List<Using> usings;
-
- public List<Using> Usings {
- get {
- return usings;
- }
- set {
- usings = value ?? new List<Using>();
- }
- }
-
- public UsingDeclaration(List<Using> usings) {
- Usings = usings;
- }
-
-public UsingDeclaration(string @namespace) : this(@namespace, null) {}
-
-public UsingDeclaration(string @namespace, TypeReference alias) { usings = new List<Using>(1); usings.Add(new Using(@namespace, alias)); }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitUsingDeclaration(this, data);
- }
-
- public override string ToString() {
- return string.Format("[UsingDeclaration Usings={0}]", GetCollectionString(Usings));
- }
- }
-
- public class UsingStatement : StatementWithEmbeddedStatement {
-
- Statement resourceAcquisition;
-
- public Statement ResourceAcquisition {
- get {
- return resourceAcquisition;
- }
- set {
- resourceAcquisition = value ?? Statement.Null;
- if (!resourceAcquisition.IsNull) resourceAcquisition.Parent = this;
- }
- }
-
- public UsingStatement(Statement resourceAcquisition, Statement embeddedStatement) {
- ResourceAcquisition = resourceAcquisition;
- EmbeddedStatement = embeddedStatement;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitUsingStatement(this, data);
- }
-
- public override string ToString() {
- return string.Format("[UsingStatement ResourceAcquisition={0} EmbeddedStatement={1}]", ResourceAcquisition, EmbeddedStatement);
- }
- }
-
- public class VariableDeclaration : AbstractNode {
-
- string name;
-
- Expression initializer;
-
- TypeReference typeReference;
-
- Expression fixedArrayInitialization;
-
- public string Name {
- get {
- return name;
- }
- set {
- name = value ?? "";
- }
- }
-
- public Expression Initializer {
- get {
- return initializer;
- }
- set {
- initializer = value ?? Expression.Null;
- if (!initializer.IsNull) initializer.Parent = this;
- }
- }
-
- public TypeReference TypeReference {
- get {
- return typeReference;
- }
- set {
- typeReference = value ?? TypeReference.Null;
- if (!typeReference.IsNull) typeReference.Parent = this;
- }
- }
-
- public Expression FixedArrayInitialization {
- get {
- return fixedArrayInitialization;
- }
- set {
- fixedArrayInitialization = value ?? Expression.Null;
- if (!fixedArrayInitialization.IsNull) fixedArrayInitialization.Parent = this;
- }
- }
-
- public VariableDeclaration(string name) {
- Name = name;
- initializer = Expression.Null;
- typeReference = TypeReference.Null;
- fixedArrayInitialization = Expression.Null;
- }
-
- public VariableDeclaration(string name, Expression initializer) {
- Name = name;
- Initializer = initializer;
- typeReference = TypeReference.Null;
- fixedArrayInitialization = Expression.Null;
- }
-
- public VariableDeclaration(string name, Expression initializer, TypeReference typeReference) {
- Name = name;
- Initializer = initializer;
- TypeReference = typeReference;
- fixedArrayInitialization = Expression.Null;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitVariableDeclaration(this, data);
- }
-
- public override string ToString() {
- return string.Format("[VariableDeclaration Name={0} Initializer={1} TypeReference={2} FixedArrayInitial" +
- "ization={3}]", Name, Initializer, TypeReference, FixedArrayInitialization);
- }
- }
-
- public class WithStatement : Statement {
-
- Expression expression;
-
- BlockStatement body;
-
- public Expression Expression {
- get {
- return expression;
- }
- set {
- expression = value ?? Expression.Null;
- if (!expression.IsNull) expression.Parent = this;
- }
- }
-
- public BlockStatement Body {
- get {
- return body;
- }
- set {
- body = value ?? BlockStatement.Null;
- if (!body.IsNull) body.Parent = this;
- }
- }
-
- public WithStatement(Expression expression) {
- Expression = expression;
- body = BlockStatement.Null;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitWithStatement(this, data);
- }
-
- public override string ToString() {
- return string.Format("[WithStatement Expression={0} Body={1}]", Expression, Body);
- }
- }
-
- public class YieldStatement : Statement {
-
- Statement statement;
-
- public Statement Statement {
- get {
- return statement;
- }
- set {
- statement = value ?? Statement.Null;
- if (!statement.IsNull) statement.Parent = this;
- }
- }
-
- public YieldStatement(Statement statement) {
- Statement = statement;
- }
-
- public bool IsYieldBreak {
- get {
- return statement is BreakStatement;
- }
- }
-
- public bool IsYieldReturn {
- get {
- return statement is ReturnStatement;
- }
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data) {
- return visitor.VisitYieldStatement(this, data);
- }
-
- public override string ToString() {
- return string.Format("[YieldStatement Statement={0}]", Statement);
- }
- }
-}
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.3053
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace ICSharpCode.NRefactory.Ast {
+ using System;
+ using System.Collections.Generic;
+
+
+ public class AddHandlerStatement : Statement {
+
+ Expression eventExpression;
+
+ Expression handlerExpression;
+
+ public Expression EventExpression {
+ get {
+ return eventExpression;
+ }
+ set {
+ eventExpression = value ?? Expression.Null;
+ if (!eventExpression.IsNull) eventExpression.Parent = this;
+ }
+ }
+
+ public Expression HandlerExpression {
+ get {
+ return handlerExpression;
+ }
+ set {
+ handlerExpression = value ?? Expression.Null;
+ if (!handlerExpression.IsNull) handlerExpression.Parent = this;
+ }
+ }
+
+ public AddHandlerStatement(Expression eventExpression, Expression handlerExpression) {
+ EventExpression = eventExpression;
+ HandlerExpression = handlerExpression;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitAddHandlerStatement(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[AddHandlerStatement EventExpression={0} HandlerExpression={1}]", EventExpression, HandlerExpression);
+ }
+ }
+
+ public class AddressOfExpression : Expression {
+
+ Expression expression;
+
+ public Expression Expression {
+ get {
+ return expression;
+ }
+ set {
+ expression = value ?? Expression.Null;
+ if (!expression.IsNull) expression.Parent = this;
+ }
+ }
+
+ public AddressOfExpression(Expression expression) {
+ Expression = expression;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitAddressOfExpression(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[AddressOfExpression Expression={0}]", Expression);
+ }
+ }
+
+ public class AnonymousMethodExpression : Expression {
+
+ List<ParameterDeclarationExpression> parameters;
+
+ BlockStatement body;
+
+ bool hasParameterList;
+
+ public List<ParameterDeclarationExpression> Parameters {
+ get {
+ return parameters;
+ }
+ set {
+ parameters = value ?? new List<ParameterDeclarationExpression>();
+ }
+ }
+
+ public BlockStatement Body {
+ get {
+ return body;
+ }
+ set {
+ body = value ?? BlockStatement.Null;
+ if (!body.IsNull) body.Parent = this;
+ }
+ }
+
+ public bool HasParameterList {
+ get {
+ return hasParameterList;
+ }
+ set {
+ hasParameterList = value;
+ }
+ }
+
+ public AnonymousMethodExpression() {
+ parameters = new List<ParameterDeclarationExpression>();
+ body = BlockStatement.Null;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitAnonymousMethodExpression(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[AnonymousMethodExpression Parameters={0} Body={1} HasParameterList={2}]", GetCollectionString(Parameters), Body, HasParameterList);
+ }
+ }
+
+ public class ArrayCreateExpression : Expression {
+
+ TypeReference createType;
+
+ List<Expression> arguments;
+
+ CollectionInitializerExpression arrayInitializer;
+
+ public TypeReference CreateType {
+ get {
+ return createType;
+ }
+ set {
+ createType = value ?? TypeReference.Null;
+ if (!createType.IsNull) createType.Parent = this;
+ }
+ }
+
+ public List<Expression> Arguments {
+ get {
+ return arguments;
+ }
+ set {
+ arguments = value ?? new List<Expression>();
+ }
+ }
+
+ public CollectionInitializerExpression ArrayInitializer {
+ get {
+ return arrayInitializer;
+ }
+ set {
+ arrayInitializer = value ?? CollectionInitializerExpression.Null;
+ if (!arrayInitializer.IsNull) arrayInitializer.Parent = this;
+ }
+ }
+
+ public ArrayCreateExpression(TypeReference createType) {
+ CreateType = createType;
+ arguments = new List<Expression>();
+ arrayInitializer = CollectionInitializerExpression.Null;
+ }
+
+ public ArrayCreateExpression(TypeReference createType, List<Expression> arguments) {
+ CreateType = createType;
+ Arguments = arguments;
+ arrayInitializer = CollectionInitializerExpression.Null;
+ }
+
+ public ArrayCreateExpression(TypeReference createType, CollectionInitializerExpression arrayInitializer) {
+ CreateType = createType;
+ ArrayInitializer = arrayInitializer;
+ arguments = new List<Expression>();
+ }
+
+ public bool IsImplicitlyTyped {
+ get {
+ return createType.IsNull || string.IsNullOrEmpty(createType.Type);
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitArrayCreateExpression(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[ArrayCreateExpression CreateType={0} Arguments={1} ArrayInitializer={2}]", CreateType, GetCollectionString(Arguments), ArrayInitializer);
+ }
+ }
+
+ public class AssignmentExpression : Expression {
+
+ Expression left;
+
+ AssignmentOperatorType op;
+
+ Expression right;
+
+ public Expression Left {
+ get {
+ return left;
+ }
+ set {
+ left = value ?? Expression.Null;
+ if (!left.IsNull) left.Parent = this;
+ }
+ }
+
+ public AssignmentOperatorType Op {
+ get {
+ return op;
+ }
+ set {
+ op = value;
+ }
+ }
+
+ public Expression Right {
+ get {
+ return right;
+ }
+ set {
+ right = value ?? Expression.Null;
+ if (!right.IsNull) right.Parent = this;
+ }
+ }
+
+ public AssignmentExpression(Expression left, AssignmentOperatorType op, Expression right) {
+ Left = left;
+ Op = op;
+ Right = right;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitAssignmentExpression(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[AssignmentExpression Left={0} Op={1} Right={2}]", Left, Op, Right);
+ }
+ }
+
+ public class Attribute : AbstractNode {
+
+ string name;
+
+ List<Expression> positionalArguments;
+
+ List<NamedArgumentExpression> namedArguments;
+
+ public string Name {
+ get {
+ return name;
+ }
+ set {
+ name = value ?? "";
+ }
+ }
+
+ public List<Expression> PositionalArguments {
+ get {
+ return positionalArguments;
+ }
+ set {
+ positionalArguments = value ?? new List<Expression>();
+ }
+ }
+
+ public List<NamedArgumentExpression> NamedArguments {
+ get {
+ return namedArguments;
+ }
+ set {
+ namedArguments = value ?? new List<NamedArgumentExpression>();
+ }
+ }
+
+ public Attribute() {
+ name = "";
+ positionalArguments = new List<Expression>();
+ namedArguments = new List<NamedArgumentExpression>();
+ }
+
+ public Attribute(string name, List<Expression> positionalArguments, List<NamedArgumentExpression> namedArguments) {
+ Name = name;
+ PositionalArguments = positionalArguments;
+ NamedArguments = namedArguments;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitAttribute(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[Attribute Name={0} PositionalArguments={1} NamedArguments={2}]", Name, GetCollectionString(PositionalArguments), GetCollectionString(NamedArguments));
+ }
+ }
+
+ public abstract class AttributedNode : AbstractNode {
+
+ List<AttributeSection> attributes;
+
+ Modifiers modifier;
+
+ public List<AttributeSection> Attributes {
+ get {
+ return attributes;
+ }
+ set {
+ attributes = value ?? new List<AttributeSection>();
+ }
+ }
+
+ public Modifiers Modifier {
+ get {
+ return modifier;
+ }
+ set {
+ modifier = value;
+ }
+ }
+
+ protected AttributedNode() {
+ attributes = new List<AttributeSection>();
+ }
+
+ protected AttributedNode(List<AttributeSection> attributes) {
+ Attributes = attributes;
+ }
+
+ protected AttributedNode(Modifiers modifier, List<AttributeSection> attributes) {
+ Modifier = modifier;
+ Attributes = attributes;
+ }
+ }
+
+ public class AttributeSection : AbstractNode {
+
+ string attributeTarget;
+
+ List<ICSharpCode.NRefactory.Ast.Attribute> attributes;
+
+ public string AttributeTarget {
+ get {
+ return attributeTarget;
+ }
+ set {
+ attributeTarget = value ?? "";
+ }
+ }
+
+ public List<ICSharpCode.NRefactory.Ast.Attribute> Attributes {
+ get {
+ return attributes;
+ }
+ set {
+ attributes = value ?? new List<Attribute>();
+ }
+ }
+
+ public AttributeSection() {
+ attributeTarget = "";
+ attributes = new List<Attribute>();
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitAttributeSection(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[AttributeSection AttributeTarget={0} Attributes={1}]", AttributeTarget, GetCollectionString(Attributes));
+ }
+ }
+
+ public class BaseReferenceExpression : Expression {
+
+ public BaseReferenceExpression() {
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitBaseReferenceExpression(this, data);
+ }
+
+ public override string ToString() {
+ return "[BaseReferenceExpression]";
+ }
+ }
+
+ public class BinaryOperatorExpression : Expression {
+
+ Expression left;
+
+ BinaryOperatorType op;
+
+ Expression right;
+
+ public Expression Left {
+ get {
+ return left;
+ }
+ set {
+ left = value ?? Expression.Null;
+ if (!left.IsNull) left.Parent = this;
+ }
+ }
+
+ public BinaryOperatorType Op {
+ get {
+ return op;
+ }
+ set {
+ op = value;
+ }
+ }
+
+ public Expression Right {
+ get {
+ return right;
+ }
+ set {
+ right = value ?? Expression.Null;
+ if (!right.IsNull) right.Parent = this;
+ }
+ }
+
+ public BinaryOperatorExpression() {
+ left = Expression.Null;
+ right = Expression.Null;
+ }
+
+ public BinaryOperatorExpression(Expression left, BinaryOperatorType op, Expression right) {
+ Left = left;
+ Op = op;
+ Right = right;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitBinaryOperatorExpression(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[BinaryOperatorExpression Left={0} Op={1} Right={2}]", Left, Op, Right);
+ }
+ }
+
+ public class BreakStatement : Statement {
+
+ public BreakStatement() {
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitBreakStatement(this, data);
+ }
+
+ public override string ToString() {
+ return "[BreakStatement]";
+ }
+ }
+
+ public class CaseLabel : AbstractNode {
+
+ Expression label;
+
+ BinaryOperatorType binaryOperatorType;
+
+ Expression toExpression;
+
+ public Expression Label {
+ get {
+ return label;
+ }
+ set {
+ label = value ?? Expression.Null;
+ if (!label.IsNull) label.Parent = this;
+ }
+ }
+
+ public BinaryOperatorType BinaryOperatorType {
+ get {
+ return binaryOperatorType;
+ }
+ set {
+ binaryOperatorType = value;
+ }
+ }
+
+ public Expression ToExpression {
+ get {
+ return toExpression;
+ }
+ set {
+ toExpression = value ?? Expression.Null;
+ if (!toExpression.IsNull) toExpression.Parent = this;
+ }
+ }
+
+ public CaseLabel() {
+ label = Expression.Null;
+ toExpression = Expression.Null;
+ }
+
+ public CaseLabel(Expression label) {
+ Label = label;
+ toExpression = Expression.Null;
+ }
+
+ public CaseLabel(Expression label, Expression toExpression) {
+ Label = label;
+ ToExpression = toExpression;
+ }
+
+ public CaseLabel(BinaryOperatorType binaryOperatorType, Expression label) {
+ BinaryOperatorType = binaryOperatorType;
+ Label = label;
+ toExpression = Expression.Null;
+ }
+
+ public bool IsDefault {
+ get {
+ return label.IsNull;
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitCaseLabel(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[CaseLabel Label={0} BinaryOperatorType={1} ToExpression={2}]", Label, BinaryOperatorType, ToExpression);
+ }
+ }
+
+ public class CastExpression : Expression {
+
+ TypeReference castTo;
+
+ Expression expression;
+
+ CastType castType;
+
+ public TypeReference CastTo {
+ get {
+ return castTo;
+ }
+ set {
+ castTo = value ?? TypeReference.Null;
+ if (!castTo.IsNull) castTo.Parent = this;
+ }
+ }
+
+ public Expression Expression {
+ get {
+ return expression;
+ }
+ set {
+ expression = value ?? Expression.Null;
+ if (!expression.IsNull) expression.Parent = this;
+ }
+ }
+
+ public CastType CastType {
+ get {
+ return castType;
+ }
+ set {
+ castType = value;
+ }
+ }
+
+ public CastExpression(TypeReference castTo) {
+ CastTo = castTo;
+ expression = Expression.Null;
+ }
+
+ public CastExpression(TypeReference castTo, Expression expression, CastType castType) {
+ CastTo = castTo;
+ Expression = expression;
+ CastType = castType;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitCastExpression(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[CastExpression CastTo={0} Expression={1} CastType={2}]", CastTo, Expression, CastType);
+ }
+ }
+
+ public class CatchClause : AbstractNode {
+
+ TypeReference typeReference;
+
+ string variableName;
+
+ Statement statementBlock;
+
+ Expression condition;
+
+ public TypeReference TypeReference {
+ get {
+ return typeReference;
+ }
+ set {
+ typeReference = value ?? TypeReference.Null;
+ if (!typeReference.IsNull) typeReference.Parent = this;
+ }
+ }
+
+ public string VariableName {
+ get {
+ return variableName;
+ }
+ set {
+ variableName = value ?? "";
+ }
+ }
+
+ public Statement StatementBlock {
+ get {
+ return statementBlock;
+ }
+ set {
+ statementBlock = value ?? Statement.Null;
+ if (!statementBlock.IsNull) statementBlock.Parent = this;
+ }
+ }
+
+ public Expression Condition {
+ get {
+ return condition;
+ }
+ set {
+ condition = value ?? Expression.Null;
+ if (!condition.IsNull) condition.Parent = this;
+ }
+ }
+
+ public CatchClause(TypeReference typeReference, string variableName, Statement statementBlock) {
+ TypeReference = typeReference;
+ VariableName = variableName;
+ StatementBlock = statementBlock;
+ condition = Expression.Null;
+ }
+
+ public CatchClause(TypeReference typeReference, string variableName, Statement statementBlock, Expression condition) {
+ TypeReference = typeReference;
+ VariableName = variableName;
+ StatementBlock = statementBlock;
+ Condition = condition;
+ }
+
+ public CatchClause(Statement statementBlock) {
+ StatementBlock = statementBlock;
+ typeReference = TypeReference.Null;
+ variableName = "";
+ condition = Expression.Null;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitCatchClause(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[CatchClause TypeReference={0} VariableName={1} StatementBlock={2} Condition={3}]" +
+ "", TypeReference, VariableName, StatementBlock, Condition);
+ }
+ }
+
+ public class CheckedExpression : Expression {
+
+ Expression expression;
+
+ public Expression Expression {
+ get {
+ return expression;
+ }
+ set {
+ expression = value ?? Expression.Null;
+ if (!expression.IsNull) expression.Parent = this;
+ }
+ }
+
+ public CheckedExpression(Expression expression) {
+ Expression = expression;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitCheckedExpression(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[CheckedExpression Expression={0}]", Expression);
+ }
+ }
+
+ public class CheckedStatement : Statement {
+
+ Statement block;
+
+ public Statement Block {
+ get {
+ return block;
+ }
+ set {
+ block = value ?? Statement.Null;
+ if (!block.IsNull) block.Parent = this;
+ }
+ }
+
+ public CheckedStatement(Statement block) {
+ Block = block;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitCheckedStatement(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[CheckedStatement Block={0}]", Block);
+ }
+ }
+
+ public class ClassReferenceExpression : Expression {
+
+ public ClassReferenceExpression() {
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitClassReferenceExpression(this, data);
+ }
+
+ public override string ToString() {
+ return "[ClassReferenceExpression]";
+ }
+ }
+
+ public class CollectionInitializerExpression : Expression {
+
+ List<Expression> createExpressions;
+
+ public List<Expression> CreateExpressions {
+ get {
+ return createExpressions;
+ }
+ set {
+ createExpressions = value ?? new List<Expression>();
+ }
+ }
+
+ public CollectionInitializerExpression() {
+ createExpressions = new List<Expression>();
+ }
+
+ public CollectionInitializerExpression(List<Expression> createExpressions) {
+ CreateExpressions = createExpressions;
+ }
+
+ public new static CollectionInitializerExpression Null {
+ get {
+ return NullCollectionInitializerExpression.Instance;
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitCollectionInitializerExpression(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[CollectionInitializerExpression CreateExpressions={0}]", GetCollectionString(CreateExpressions));
+ }
+ }
+
+ internal sealed class NullCollectionInitializerExpression : CollectionInitializerExpression {
+
+ internal static NullCollectionInitializerExpression Instance = new NullCollectionInitializerExpression();
+
+ public override bool IsNull {
+ get {
+ return true;
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return null;
+ }
+
+ public override string ToString() {
+ return "[NullCollectionInitializerExpression]";
+ }
+ }
+
+ public class ConditionalExpression : Expression {
+
+ Expression condition;
+
+ Expression trueExpression;
+
+ Expression falseExpression;
+
+ public Expression Condition {
+ get {
+ return condition;
+ }
+ set {
+ condition = value ?? Expression.Null;
+ if (!condition.IsNull) condition.Parent = this;
+ }
+ }
+
+ public Expression TrueExpression {
+ get {
+ return trueExpression;
+ }
+ set {
+ trueExpression = value ?? Expression.Null;
+ if (!trueExpression.IsNull) trueExpression.Parent = this;
+ }
+ }
+
+ public Expression FalseExpression {
+ get {
+ return falseExpression;
+ }
+ set {
+ falseExpression = value ?? Expression.Null;
+ if (!falseExpression.IsNull) falseExpression.Parent = this;
+ }
+ }
+
+ public ConditionalExpression() {
+ condition = Expression.Null;
+ trueExpression = Expression.Null;
+ falseExpression = Expression.Null;
+ }
+
+ public ConditionalExpression(Expression condition, Expression trueExpression, Expression falseExpression) {
+ Condition = condition;
+ TrueExpression = trueExpression;
+ FalseExpression = falseExpression;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitConditionalExpression(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[ConditionalExpression Condition={0} TrueExpression={1} FalseExpression={2}]", Condition, TrueExpression, FalseExpression);
+ }
+ }
+
+ public class ConstructorDeclaration : ParametrizedNode {
+
+ ConstructorInitializer constructorInitializer;
+
+ BlockStatement body;
+
+ public ConstructorInitializer ConstructorInitializer {
+ get {
+ return constructorInitializer;
+ }
+ set {
+ constructorInitializer = value ?? ConstructorInitializer.Null;
+ if (!constructorInitializer.IsNull) constructorInitializer.Parent = this;
+ }
+ }
+
+ public BlockStatement Body {
+ get {
+ return body;
+ }
+ set {
+ body = value ?? BlockStatement.Null;
+ if (!body.IsNull) body.Parent = this;
+ }
+ }
+
+ public ConstructorDeclaration(string name, Modifiers modifier, List<ParameterDeclarationExpression> parameters, List<AttributeSection> attributes) {
+ Name = name;
+ Modifier = modifier;
+ Parameters = parameters;
+ Attributes = attributes;
+ constructorInitializer = ConstructorInitializer.Null;
+ body = BlockStatement.Null;
+ }
+
+ public ConstructorDeclaration(string name, Modifiers modifier, List<ParameterDeclarationExpression> parameters, ConstructorInitializer constructorInitializer, List<AttributeSection> attributes) {
+ Name = name;
+ Modifier = modifier;
+ Parameters = parameters;
+ ConstructorInitializer = constructorInitializer;
+ Attributes = attributes;
+ body = BlockStatement.Null;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitConstructorDeclaration(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[ConstructorDeclaration ConstructorInitializer={0} Body={1} Name={2} Parameters={" +
+ "3} Attributes={4} Modifier={5}]", ConstructorInitializer, Body, Name, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier);
+ }
+ }
+
+ public class ConstructorInitializer : AbstractNode, INullable {
+
+ ConstructorInitializerType constructorInitializerType;
+
+ List<Expression> arguments;
+
+ public ConstructorInitializerType ConstructorInitializerType {
+ get {
+ return constructorInitializerType;
+ }
+ set {
+ constructorInitializerType = value;
+ }
+ }
+
+ public List<Expression> Arguments {
+ get {
+ return arguments;
+ }
+ set {
+ arguments = value ?? new List<Expression>();
+ }
+ }
+
+ public ConstructorInitializer() {
+ arguments = new List<Expression>();
+ }
+
+ public virtual bool IsNull {
+ get {
+ return false;
+ }
+ }
+
+ public static ConstructorInitializer Null {
+ get {
+ return NullConstructorInitializer.Instance;
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitConstructorInitializer(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[ConstructorInitializer ConstructorInitializerType={0} Arguments={1}]", ConstructorInitializerType, GetCollectionString(Arguments));
+ }
+ }
+
+ internal sealed class NullConstructorInitializer : ConstructorInitializer {
+
+ internal static NullConstructorInitializer Instance = new NullConstructorInitializer();
+
+ public override bool IsNull {
+ get {
+ return true;
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return null;
+ }
+
+ public override string ToString() {
+ return "[NullConstructorInitializer]";
+ }
+ }
+
+ public class ContinueStatement : Statement {
+
+ ContinueType continueType;
+
+ public ContinueType ContinueType {
+ get {
+ return continueType;
+ }
+ set {
+ continueType = value;
+ }
+ }
+
+ public ContinueStatement() {
+ }
+
+ public ContinueStatement(ContinueType continueType) {
+ ContinueType = continueType;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitContinueStatement(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[ContinueStatement ContinueType={0}]", ContinueType);
+ }
+ }
+
+ public class DeclareDeclaration : ParametrizedNode {
+
+ string alias;
+
+ string library;
+
+ CharsetModifier charset;
+
+ TypeReference typeReference;
+
+ public string Alias {
+ get {
+ return alias;
+ }
+ set {
+ alias = value ?? "";
+ }
+ }
+
+ public string Library {
+ get {
+ return library;
+ }
+ set {
+ library = value ?? "";
+ }
+ }
+
+ public CharsetModifier Charset {
+ get {
+ return charset;
+ }
+ set {
+ charset = value;
+ }
+ }
+
+ public TypeReference TypeReference {
+ get {
+ return typeReference;
+ }
+ set {
+ typeReference = value ?? TypeReference.Null;
+ if (!typeReference.IsNull) typeReference.Parent = this;
+ }
+ }
+
+ public DeclareDeclaration(string name, Modifiers modifier, TypeReference typeReference, List<ParameterDeclarationExpression> parameters, List<AttributeSection> attributes, string library, string alias, CharsetModifier charset) {
+ Name = name;
+ Modifier = modifier;
+ TypeReference = typeReference;
+ Parameters = parameters;
+ Attributes = attributes;
+ Library = library;
+ Alias = alias;
+ Charset = charset;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitDeclareDeclaration(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[DeclareDeclaration Alias={0} Library={1} Charset={2} TypeReference={3} Name={4} " +
+ "Parameters={5} Attributes={6} Modifier={7}]", Alias, Library, Charset, TypeReference, Name, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier);
+ }
+ }
+
+ public class DefaultValueExpression : Expression {
+
+ TypeReference typeReference;
+
+ public TypeReference TypeReference {
+ get {
+ return typeReference;
+ }
+ set {
+ typeReference = value ?? TypeReference.Null;
+ if (!typeReference.IsNull) typeReference.Parent = this;
+ }
+ }
+
+ public DefaultValueExpression(TypeReference typeReference) {
+ TypeReference = typeReference;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitDefaultValueExpression(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[DefaultValueExpression TypeReference={0}]", TypeReference);
+ }
+ }
+
+ public class DelegateDeclaration : AttributedNode {
+
+ string name;
+
+ TypeReference returnType;
+
+ List<ParameterDeclarationExpression> parameters;
+
+ List<TemplateDefinition> templates;
+
+ public string Name {
+ get {
+ return name;
+ }
+ set {
+ name = string.IsNullOrEmpty(value) ? "?" : value;
+ }
+ }
+
+ public TypeReference ReturnType {
+ get {
+ return returnType;
+ }
+ set {
+ returnType = value ?? TypeReference.Null;
+ if (!returnType.IsNull) returnType.Parent = this;
+ }
+ }
+
+ public List<ParameterDeclarationExpression> Parameters {
+ get {
+ return parameters;
+ }
+ set {
+ parameters = value ?? new List<ParameterDeclarationExpression>();
+ }
+ }
+
+ public List<TemplateDefinition> Templates {
+ get {
+ return templates;
+ }
+ set {
+ templates = value ?? new List<TemplateDefinition>();
+ }
+ }
+
+ public DelegateDeclaration(Modifiers modifier, List<AttributeSection> attributes) {
+ Modifier = modifier;
+ Attributes = attributes;
+ name = "?";
+ returnType = TypeReference.Null;
+ parameters = new List<ParameterDeclarationExpression>();
+ templates = new List<TemplateDefinition>();
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitDelegateDeclaration(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[DelegateDeclaration Name={0} ReturnType={1} Parameters={2} Templates={3} Attribu" +
+ "tes={4} Modifier={5}]", Name, ReturnType, GetCollectionString(Parameters), GetCollectionString(Templates), GetCollectionString(Attributes), Modifier);
+ }
+ }
+
+ public class DestructorDeclaration : AttributedNode {
+
+ string name;
+
+ BlockStatement body;
+
+ public string Name {
+ get {
+ return name;
+ }
+ set {
+ name = value ?? "";
+ }
+ }
+
+ public BlockStatement Body {
+ get {
+ return body;
+ }
+ set {
+ body = value ?? BlockStatement.Null;
+ if (!body.IsNull) body.Parent = this;
+ }
+ }
+
+ public DestructorDeclaration(string name, Modifiers modifier, List<AttributeSection> attributes) {
+ Name = name;
+ Modifier = modifier;
+ Attributes = attributes;
+ body = BlockStatement.Null;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitDestructorDeclaration(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[DestructorDeclaration Name={0} Body={1} Attributes={2} Modifier={3}]", Name, Body, GetCollectionString(Attributes), Modifier);
+ }
+ }
+
+ public class DirectionExpression : Expression {
+
+ FieldDirection fieldDirection;
+
+ Expression expression;
+
+ public FieldDirection FieldDirection {
+ get {
+ return fieldDirection;
+ }
+ set {
+ fieldDirection = value;
+ }
+ }
+
+ public Expression Expression {
+ get {
+ return expression;
+ }
+ set {
+ expression = value ?? Expression.Null;
+ if (!expression.IsNull) expression.Parent = this;
+ }
+ }
+
+ public DirectionExpression(FieldDirection fieldDirection, Expression expression) {
+ FieldDirection = fieldDirection;
+ Expression = expression;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitDirectionExpression(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[DirectionExpression FieldDirection={0} Expression={1}]", FieldDirection, Expression);
+ }
+ }
+
+ public class DoLoopStatement : StatementWithEmbeddedStatement {
+
+ Expression condition;
+
+ ConditionType conditionType;
+
+ ConditionPosition conditionPosition;
+
+ public Expression Condition {
+ get {
+ return condition;
+ }
+ set {
+ condition = value ?? Expression.Null;
+ if (!condition.IsNull) condition.Parent = this;
+ }
+ }
+
+ public ConditionType ConditionType {
+ get {
+ return conditionType;
+ }
+ set {
+ conditionType = value;
+ }
+ }
+
+ public ConditionPosition ConditionPosition {
+ get {
+ return conditionPosition;
+ }
+ set {
+ conditionPosition = value;
+ }
+ }
+
+ public DoLoopStatement(Expression condition, Statement embeddedStatement, ConditionType conditionType, ConditionPosition conditionPosition) {
+ Condition = condition;
+ EmbeddedStatement = embeddedStatement;
+ ConditionType = conditionType;
+ ConditionPosition = conditionPosition;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitDoLoopStatement(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[DoLoopStatement Condition={0} ConditionType={1} ConditionPosition={2} EmbeddedSt" +
+ "atement={3}]", Condition, ConditionType, ConditionPosition, EmbeddedStatement);
+ }
+ }
+
+ public class ElseIfSection : StatementWithEmbeddedStatement {
+
+ Expression condition;
+
+ public Expression Condition {
+ get {
+ return condition;
+ }
+ set {
+ condition = value ?? Expression.Null;
+ if (!condition.IsNull) condition.Parent = this;
+ }
+ }
+
+ public ElseIfSection(Expression condition, Statement embeddedStatement) {
+ Condition = condition;
+ EmbeddedStatement = embeddedStatement;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitElseIfSection(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[ElseIfSection Condition={0} EmbeddedStatement={1}]", Condition, EmbeddedStatement);
+ }
+ }
+
+ public class EmptyStatement : Statement {
+
+ public EmptyStatement() {
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitEmptyStatement(this, data);
+ }
+
+ public override string ToString() {
+ return "[EmptyStatement]";
+ }
+ }
+
+ public class EndStatement : Statement {
+
+ public EndStatement() {
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitEndStatement(this, data);
+ }
+
+ public override string ToString() {
+ return "[EndStatement]";
+ }
+ }
+
+ public class EraseStatement : Statement {
+
+ List<Expression> expressions;
+
+ public List<Expression> Expressions {
+ get {
+ return expressions;
+ }
+ set {
+ expressions = value ?? new List<Expression>();
+ }
+ }
+
+ public EraseStatement() {
+ expressions = new List<Expression>();
+ }
+
+ public EraseStatement(List<Expression> expressions) {
+ Expressions = expressions;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitEraseStatement(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[EraseStatement Expressions={0}]", GetCollectionString(Expressions));
+ }
+ }
+
+ public class ErrorStatement : Statement {
+
+ Expression expression;
+
+ public Expression Expression {
+ get {
+ return expression;
+ }
+ set {
+ expression = value ?? Expression.Null;
+ if (!expression.IsNull) expression.Parent = this;
+ }
+ }
+
+ public ErrorStatement(Expression expression) {
+ Expression = expression;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitErrorStatement(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[ErrorStatement Expression={0}]", Expression);
+ }
+ }
+
+ public class EventAddRegion : EventAddRemoveRegion {
+
+ public EventAddRegion(List<AttributeSection> attributes) :
+ base(attributes) {
+ }
+
+ public static EventAddRegion Null {
+ get {
+ return NullEventAddRegion.Instance;
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitEventAddRegion(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[EventAddRegion Block={0} Parameters={1} Attributes={2} Modifier={3}]", Block, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier);
+ }
+ }
+
+ internal sealed class NullEventAddRegion : EventAddRegion {
+
+ private NullEventAddRegion() :
+ base(null) {
+ }
+
+ internal static NullEventAddRegion Instance = new NullEventAddRegion();
+
+ public override bool IsNull {
+ get {
+ return true;
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return null;
+ }
+
+ public override string ToString() {
+ return "[NullEventAddRegion]";
+ }
+ }
+
+ public abstract class EventAddRemoveRegion : AttributedNode, INullable {
+
+ BlockStatement block;
+
+ List<ParameterDeclarationExpression> parameters;
+
+ public BlockStatement Block {
+ get {
+ return block;
+ }
+ set {
+ block = value ?? BlockStatement.Null;
+ if (!block.IsNull) block.Parent = this;
+ }
+ }
+
+ public List<ParameterDeclarationExpression> Parameters {
+ get {
+ return parameters;
+ }
+ set {
+ parameters = value ?? new List<ParameterDeclarationExpression>();
+ }
+ }
+
+ protected EventAddRemoveRegion(List<AttributeSection> attributes) {
+ Attributes = attributes;
+ block = BlockStatement.Null;
+ parameters = new List<ParameterDeclarationExpression>();
+ }
+
+ public virtual bool IsNull {
+ get {
+ return false;
+ }
+ }
+ }
+
+ public class EventDeclaration : MemberNode {
+
+ EventAddRegion addRegion;
+
+ EventRemoveRegion removeRegion;
+
+ EventRaiseRegion raiseRegion;
+
+ Location bodyStart;
+
+ Location bodyEnd;
+
+ Expression initializer;
+
+ public EventAddRegion AddRegion {
+ get {
+ return addRegion;
+ }
+ set {
+ addRegion = value ?? EventAddRegion.Null;
+ if (!addRegion.IsNull) addRegion.Parent = this;
+ }
+ }
+
+ public EventRemoveRegion RemoveRegion {
+ get {
+ return removeRegion;
+ }
+ set {
+ removeRegion = value ?? EventRemoveRegion.Null;
+ if (!removeRegion.IsNull) removeRegion.Parent = this;
+ }
+ }
+
+ public EventRaiseRegion RaiseRegion {
+ get {
+ return raiseRegion;
+ }
+ set {
+ raiseRegion = value ?? EventRaiseRegion.Null;
+ if (!raiseRegion.IsNull) raiseRegion.Parent = this;
+ }
+ }
+
+ public Location BodyStart {
+ get {
+ return bodyStart;
+ }
+ set {
+ bodyStart = value;
+ }
+ }
+
+ public Location BodyEnd {
+ get {
+ return bodyEnd;
+ }
+ set {
+ bodyEnd = value;
+ }
+ }
+
+ public Expression Initializer {
+ get {
+ return initializer;
+ }
+ set {
+ initializer = value ?? Expression.Null;
+ if (!initializer.IsNull) initializer.Parent = this;
+ }
+ }
+
+ public EventDeclaration() {
+ addRegion = EventAddRegion.Null;
+ removeRegion = EventRemoveRegion.Null;
+ raiseRegion = EventRaiseRegion.Null;
+ bodyStart = Location.Empty;
+ bodyEnd = Location.Empty;
+ initializer = Expression.Null;
+ }
+
+ public bool HasRemoveRegion {
+ get {
+ return !removeRegion.IsNull;
+ }
+ }
+
+ public bool HasRaiseRegion {
+ get {
+ return !raiseRegion.IsNull;
+ }
+ }
+
+ public bool HasAddRegion {
+ get {
+ return !addRegion.IsNull;
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitEventDeclaration(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[EventDeclaration AddRegion={0} RemoveRegion={1} RaiseRegion={2} BodyStart={3} Bo" +
+ "dyEnd={4} Initializer={5} InterfaceImplementations={6} TypeReference={7} Name={8" +
+ "} Parameters={9} Attributes={10} Modifier={11}]", AddRegion, RemoveRegion, RaiseRegion, BodyStart, BodyEnd, Initializer, GetCollectionString(InterfaceImplementations), TypeReference, Name, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier);
+ }
+ }
+
+ public class EventRaiseRegion : EventAddRemoveRegion {
+
+ public EventRaiseRegion(List<AttributeSection> attributes) :
+ base(attributes) {
+ }
+
+ public static EventRaiseRegion Null {
+ get {
+ return NullEventRaiseRegion.Instance;
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitEventRaiseRegion(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[EventRaiseRegion Block={0} Parameters={1} Attributes={2} Modifier={3}]", Block, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier);
+ }
+ }
+
+ internal sealed class NullEventRaiseRegion : EventRaiseRegion {
+
+ private NullEventRaiseRegion() :
+ base(null) {
+ }
+
+ internal static NullEventRaiseRegion Instance = new NullEventRaiseRegion();
+
+ public override bool IsNull {
+ get {
+ return true;
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return null;
+ }
+
+ public override string ToString() {
+ return "[NullEventRaiseRegion]";
+ }
+ }
+
+ public class EventRemoveRegion : EventAddRemoveRegion {
+
+ public EventRemoveRegion(List<AttributeSection> attributes) :
+ base(attributes) {
+ }
+
+ public static EventRemoveRegion Null {
+ get {
+ return NullEventRemoveRegion.Instance;
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitEventRemoveRegion(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[EventRemoveRegion Block={0} Parameters={1} Attributes={2} Modifier={3}]", Block, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier);
+ }
+ }
+
+ internal sealed class NullEventRemoveRegion : EventRemoveRegion {
+
+ private NullEventRemoveRegion() :
+ base(null) {
+ }
+
+ internal static NullEventRemoveRegion Instance = new NullEventRemoveRegion();
+
+ public override bool IsNull {
+ get {
+ return true;
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return null;
+ }
+
+ public override string ToString() {
+ return "[NullEventRemoveRegion]";
+ }
+ }
+
+ public class ExitStatement : Statement {
+
+ ExitType exitType;
+
+ public ExitType ExitType {
+ get {
+ return exitType;
+ }
+ set {
+ exitType = value;
+ }
+ }
+
+ public ExitStatement(ExitType exitType) {
+ ExitType = exitType;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitExitStatement(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[ExitStatement ExitType={0}]", ExitType);
+ }
+ }
+
+ public class ExpressionRangeVariable : AbstractNode, INullable {
+
+ string identifier;
+
+ Expression expression;
+
+ TypeReference type;
+
+ public string Identifier {
+ get {
+ return identifier;
+ }
+ set {
+ identifier = value ?? "";
+ }
+ }
+
+ public Expression Expression {
+ get {
+ return expression;
+ }
+ set {
+ expression = value ?? Expression.Null;
+ if (!expression.IsNull) expression.Parent = this;
+ }
+ }
+
+ public TypeReference Type {
+ get {
+ return type;
+ }
+ set {
+ type = value ?? TypeReference.Null;
+ if (!type.IsNull) type.Parent = this;
+ }
+ }
+
+ public ExpressionRangeVariable() {
+ identifier = "";
+ expression = Expression.Null;
+ type = TypeReference.Null;
+ }
+
+ public virtual bool IsNull {
+ get {
+ return false;
+ }
+ }
+
+ public static ExpressionRangeVariable Null {
+ get {
+ return NullExpressionRangeVariable.Instance;
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitExpressionRangeVariable(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[ExpressionRangeVariable Identifier={0} Expression={1} Type={2}]", Identifier, Expression, Type);
+ }
+ }
+
+ internal sealed class NullExpressionRangeVariable : ExpressionRangeVariable {
+
+ internal static NullExpressionRangeVariable Instance = new NullExpressionRangeVariable();
+
+ public override bool IsNull {
+ get {
+ return true;
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return null;
+ }
+
+ public override string ToString() {
+ return "[NullExpressionRangeVariable]";
+ }
+ }
+
+ public class ExpressionStatement : Statement {
+
+ Expression expression;
+
+ public Expression Expression {
+ get {
+ return expression;
+ }
+ set {
+ expression = value ?? Expression.Null;
+ if (!expression.IsNull) expression.Parent = this;
+ }
+ }
+
+ public ExpressionStatement(Expression expression) {
+ Expression = expression;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitExpressionStatement(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[ExpressionStatement Expression={0}]", Expression);
+ }
+ }
+
+ public class ExternAliasDirective : AbstractNode {
+
+ string name;
+
+ public string Name {
+ get {
+ return name;
+ }
+ set {
+ name = value ?? "";
+ }
+ }
+
+ public ExternAliasDirective() {
+ name = "";
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitExternAliasDirective(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[ExternAliasDirective Name={0}]", Name);
+ }
+ }
+
+ public class FieldDeclaration : AttributedNode {
+
+ TypeReference typeReference;
+
+ List<VariableDeclaration> fields;
+
+ public TypeReference TypeReference {
+ get {
+ return typeReference;
+ }
+ set {
+ typeReference = value ?? TypeReference.Null;
+ if (!typeReference.IsNull) typeReference.Parent = this;
+ }
+ }
+
+ public List<VariableDeclaration> Fields {
+ get {
+ return fields;
+ }
+ set {
+ fields = value ?? new List<VariableDeclaration>();
+ }
+ }
+
+ public FieldDeclaration(List<AttributeSection> attributes) {
+ Attributes = attributes;
+ typeReference = TypeReference.Null;
+ fields = new List<VariableDeclaration>();
+ }
+
+ public FieldDeclaration(List<AttributeSection> attributes, TypeReference typeReference, Modifiers modifier) {
+ Attributes = attributes;
+ TypeReference = typeReference;
+ Modifier = modifier;
+ fields = new List<VariableDeclaration>();
+ }
+
+
+ public VariableDeclaration GetVariableDeclaration(string variableName)
+ {
+ foreach (VariableDeclaration variableDeclaration in Fields) {
+ if (variableDeclaration.Name == variableName) {
+ return variableDeclaration;
+ }
+ }
+ return null;
+ }
+
+
+ public TypeReference GetTypeForField(int fieldIndex)
+ {
+ if (!typeReference.IsNull) {
+ return typeReference;
+ }
+ return ((VariableDeclaration)Fields[fieldIndex]).TypeReference;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitFieldDeclaration(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[FieldDeclaration TypeReference={0} Fields={1} Attributes={2} Modifier={3}]", TypeReference, GetCollectionString(Fields), GetCollectionString(Attributes), Modifier);
+ }
+ }
+
+ public class FixedStatement : StatementWithEmbeddedStatement {
+
+ Statement pointerDeclaration;
+
+ public Statement PointerDeclaration {
+ get {
+ return pointerDeclaration;
+ }
+ set {
+ pointerDeclaration = value ?? Statement.Null;
+ if (!pointerDeclaration.IsNull) pointerDeclaration.Parent = this;
+ }
+ }
+
+ public FixedStatement(Statement pointerDeclaration, Statement embeddedStatement) {
+ PointerDeclaration = pointerDeclaration;
+ EmbeddedStatement = embeddedStatement;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitFixedStatement(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[FixedStatement PointerDeclaration={0} EmbeddedStatement={1}]", PointerDeclaration, EmbeddedStatement);
+ }
+ }
+
+ public class ForeachStatement : StatementWithEmbeddedStatement {
+
+ TypeReference typeReference;
+
+ string variableName;
+
+ Expression expression;
+
+ Expression nextExpression;
+
+ public TypeReference TypeReference {
+ get {
+ return typeReference;
+ }
+ set {
+ typeReference = value ?? TypeReference.Null;
+ if (!typeReference.IsNull) typeReference.Parent = this;
+ }
+ }
+
+ public string VariableName {
+ get {
+ return variableName;
+ }
+ set {
+ variableName = value ?? "";
+ }
+ }
+
+ public Expression Expression {
+ get {
+ return expression;
+ }
+ set {
+ expression = value ?? Expression.Null;
+ if (!expression.IsNull) expression.Parent = this;
+ }
+ }
+
+ public Expression NextExpression {
+ get {
+ return nextExpression;
+ }
+ set {
+ nextExpression = value ?? Expression.Null;
+ if (!nextExpression.IsNull) nextExpression.Parent = this;
+ }
+ }
+
+ public ForeachStatement(TypeReference typeReference, string variableName, Expression expression, Statement embeddedStatement) {
+ TypeReference = typeReference;
+ VariableName = variableName;
+ Expression = expression;
+ EmbeddedStatement = embeddedStatement;
+ nextExpression = Expression.Null;
+ }
+
+ public ForeachStatement(TypeReference typeReference, string variableName, Expression expression, Statement embeddedStatement, Expression nextExpression) {
+ TypeReference = typeReference;
+ VariableName = variableName;
+ Expression = expression;
+ EmbeddedStatement = embeddedStatement;
+ NextExpression = nextExpression;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitForeachStatement(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[ForeachStatement TypeReference={0} VariableName={1} Expression={2} NextExpressio" +
+ "n={3} EmbeddedStatement={4}]", TypeReference, VariableName, Expression, NextExpression, EmbeddedStatement);
+ }
+ }
+
+ public class ForNextStatement : StatementWithEmbeddedStatement {
+
+ Expression start;
+
+ Expression end;
+
+ Expression step;
+
+ List<Expression> nextExpressions;
+
+ TypeReference typeReference;
+
+ string variableName;
+
+ Expression loopVariableExpression;
+
+ public Expression Start {
+ get {
+ return start;
+ }
+ set {
+ start = value ?? Expression.Null;
+ if (!start.IsNull) start.Parent = this;
+ }
+ }
+
+ public Expression End {
+ get {
+ return end;
+ }
+ set {
+ end = value ?? Expression.Null;
+ if (!end.IsNull) end.Parent = this;
+ }
+ }
+
+ public Expression Step {
+ get {
+ return step;
+ }
+ set {
+ step = value ?? Expression.Null;
+ if (!step.IsNull) step.Parent = this;
+ }
+ }
+
+ public List<Expression> NextExpressions {
+ get {
+ return nextExpressions;
+ }
+ set {
+ nextExpressions = value ?? new List<Expression>();
+ }
+ }
+
+ public TypeReference TypeReference {
+ get {
+ return typeReference;
+ }
+ set {
+ typeReference = value ?? TypeReference.Null;
+ if (!typeReference.IsNull) typeReference.Parent = this;
+ }
+ }
+
+ public string VariableName {
+ get {
+ return variableName;
+ }
+ set {
+ variableName = value ?? "";
+ }
+ }
+
+ public Expression LoopVariableExpression {
+ get {
+ return loopVariableExpression;
+ }
+ set {
+ loopVariableExpression = value ?? Expression.Null;
+ if (!loopVariableExpression.IsNull) loopVariableExpression.Parent = this;
+ }
+ }
+
+ public ForNextStatement() {
+ start = Expression.Null;
+ end = Expression.Null;
+ step = Expression.Null;
+ nextExpressions = new List<Expression>();
+ typeReference = TypeReference.Null;
+ variableName = "";
+ loopVariableExpression = Expression.Null;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitForNextStatement(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[ForNextStatement Start={0} End={1} Step={2} NextExpressions={3} TypeReference={4" +
+ "} VariableName={5} LoopVariableExpression={6} EmbeddedStatement={7}]", Start, End, Step, GetCollectionString(NextExpressions), TypeReference, VariableName, LoopVariableExpression, EmbeddedStatement);
+ }
+ }
+
+ public class ForStatement : StatementWithEmbeddedStatement {
+
+ List<Statement> initializers;
+
+ Expression condition;
+
+ List<Statement> iterator;
+
+ public List<Statement> Initializers {
+ get {
+ return initializers;
+ }
+ set {
+ initializers = value ?? new List<Statement>();
+ }
+ }
+
+ public Expression Condition {
+ get {
+ return condition;
+ }
+ set {
+ condition = value ?? Expression.Null;
+ if (!condition.IsNull) condition.Parent = this;
+ }
+ }
+
+ public List<Statement> Iterator {
+ get {
+ return iterator;
+ }
+ set {
+ iterator = value ?? new List<Statement>();
+ }
+ }
+
+ public ForStatement(List<Statement> initializers, Expression condition, List<Statement> iterator, Statement embeddedStatement) {
+ Initializers = initializers;
+ Condition = condition;
+ Iterator = iterator;
+ EmbeddedStatement = embeddedStatement;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitForStatement(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[ForStatement Initializers={0} Condition={1} Iterator={2} EmbeddedStatement={3}]", GetCollectionString(Initializers), Condition, GetCollectionString(Iterator), EmbeddedStatement);
+ }
+ }
+
+ public class GotoCaseStatement : Statement {
+
+ Expression expression;
+
+ public Expression Expression {
+ get {
+ return expression;
+ }
+ set {
+ expression = value ?? Expression.Null;
+ if (!expression.IsNull) expression.Parent = this;
+ }
+ }
+
+ public GotoCaseStatement(Expression expression) {
+ Expression = expression;
+ }
+
+ public bool IsDefaultCase {
+ get {
+ return expression.IsNull;
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitGotoCaseStatement(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[GotoCaseStatement Expression={0}]", Expression);
+ }
+ }
+
+ public class GotoStatement : Statement {
+
+ string label;
+
+ public string Label {
+ get {
+ return label;
+ }
+ set {
+ label = value ?? "";
+ }
+ }
+
+ public GotoStatement(string label) {
+ Label = label;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitGotoStatement(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[GotoStatement Label={0}]", Label);
+ }
+ }
+
+ public class IdentifierExpression : Expression {
+
+ string identifier;
+
+ List<TypeReference> typeArguments;
+
+ public string Identifier {
+ get {
+ return identifier;
+ }
+ set {
+ identifier = value ?? "";
+ }
+ }
+
+ public List<TypeReference> TypeArguments {
+ get {
+ return typeArguments;
+ }
+ set {
+ typeArguments = value ?? new List<TypeReference>();
+ }
+ }
+
+ public IdentifierExpression(string identifier) {
+ Identifier = identifier;
+ typeArguments = new List<TypeReference>();
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitIdentifierExpression(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[IdentifierExpression Identifier={0} TypeArguments={1}]", Identifier, GetCollectionString(TypeArguments));
+ }
+ }
+
+ public class IfElseStatement : Statement {
+
+ Expression condition;
+
+ List<Statement> trueStatement;
+
+ List<Statement> falseStatement;
+
+ List<ElseIfSection> elseIfSections;
+
+ public Expression Condition {
+ get {
+ return condition;
+ }
+ set {
+ condition = value ?? Expression.Null;
+ if (!condition.IsNull) condition.Parent = this;
+ }
+ }
+
+ public List<Statement> TrueStatement {
+ get {
+ return trueStatement;
+ }
+ set {
+ trueStatement = value ?? new List<Statement>();
+ }
+ }
+
+ public List<Statement> FalseStatement {
+ get {
+ return falseStatement;
+ }
+ set {
+ falseStatement = value ?? new List<Statement>();
+ }
+ }
+
+ public List<ElseIfSection> ElseIfSections {
+ get {
+ return elseIfSections;
+ }
+ set {
+ elseIfSections = value ?? new List<ElseIfSection>();
+ }
+ }
+
+ public IfElseStatement(Expression condition) {
+ Condition = condition;
+ trueStatement = new List<Statement>();
+ falseStatement = new List<Statement>();
+ elseIfSections = new List<ElseIfSection>();
+ }
+
+
+ public IfElseStatement(Expression condition, Statement trueStatement)
+ : this(condition) {
+ this.trueStatement.Add(Statement.CheckNull(trueStatement));
+ if (trueStatement != null) trueStatement.Parent = this;
+ }
+
+
+ public IfElseStatement(Expression condition, Statement trueStatement, Statement falseStatement)
+ : this(condition) {
+ this.trueStatement.Add(Statement.CheckNull(trueStatement));
+ this.falseStatement.Add(Statement.CheckNull(falseStatement));
+ if (trueStatement != null) trueStatement.Parent = this;
+ if (falseStatement != null) falseStatement.Parent = this;
+ }
+
+ public bool HasElseStatements {
+ get {
+ return falseStatement.Count > 0;
+ }
+ }
+
+ public bool HasElseIfSections {
+ get {
+ return elseIfSections.Count > 0;
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitIfElseStatement(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[IfElseStatement Condition={0} TrueStatement={1} FalseStatement={2} ElseIfSection" +
+ "s={3}]", Condition, GetCollectionString(TrueStatement), GetCollectionString(FalseStatement), GetCollectionString(ElseIfSections));
+ }
+ }
+
+ public class IndexerDeclaration : AttributedNode {
+
+ List<ParameterDeclarationExpression> parameters;
+
+ List<InterfaceImplementation> interfaceImplementations;
+
+ TypeReference typeReference;
+
+ Location bodyStart;
+
+ Location bodyEnd;
+
+ PropertyGetRegion getRegion;
+
+ PropertySetRegion setRegion;
+
+ public List<ParameterDeclarationExpression> Parameters {
+ get {
+ return parameters;
+ }
+ set {
+ parameters = value ?? new List<ParameterDeclarationExpression>();
+ }
+ }
+
+ public List<InterfaceImplementation> InterfaceImplementations {
+ get {
+ return interfaceImplementations;
+ }
+ set {
+ interfaceImplementations = value ?? new List<InterfaceImplementation>();
+ }
+ }
+
+ public TypeReference TypeReference {
+ get {
+ return typeReference;
+ }
+ set {
+ typeReference = value ?? TypeReference.Null;
+ if (!typeReference.IsNull) typeReference.Parent = this;
+ }
+ }
+
+ public Location BodyStart {
+ get {
+ return bodyStart;
+ }
+ set {
+ bodyStart = value;
+ }
+ }
+
+ public Location BodyEnd {
+ get {
+ return bodyEnd;
+ }
+ set {
+ bodyEnd = value;
+ }
+ }
+
+ public PropertyGetRegion GetRegion {
+ get {
+ return getRegion;
+ }
+ set {
+ getRegion = value ?? PropertyGetRegion.Null;
+ if (!getRegion.IsNull) getRegion.Parent = this;
+ }
+ }
+
+ public PropertySetRegion SetRegion {
+ get {
+ return setRegion;
+ }
+ set {
+ setRegion = value ?? PropertySetRegion.Null;
+ if (!setRegion.IsNull) setRegion.Parent = this;
+ }
+ }
+
+ public IndexerDeclaration(Modifiers modifier, List<ParameterDeclarationExpression> parameters, List<AttributeSection> attributes) {
+ Modifier = modifier;
+ Parameters = parameters;
+ Attributes = attributes;
+ interfaceImplementations = new List<InterfaceImplementation>();
+ typeReference = TypeReference.Null;
+ bodyStart = Location.Empty;
+ bodyEnd = Location.Empty;
+ getRegion = PropertyGetRegion.Null;
+ setRegion = PropertySetRegion.Null;
+ }
+
+ public IndexerDeclaration(TypeReference typeReference, List<ParameterDeclarationExpression> parameters, Modifiers modifier, List<AttributeSection> attributes) {
+ TypeReference = typeReference;
+ Parameters = parameters;
+ Modifier = modifier;
+ Attributes = attributes;
+ interfaceImplementations = new List<InterfaceImplementation>();
+ bodyStart = Location.Empty;
+ bodyEnd = Location.Empty;
+ getRegion = PropertyGetRegion.Null;
+ setRegion = PropertySetRegion.Null;
+ }
+
+ public bool IsReadOnly {
+ get {
+ return HasGetRegion && !HasSetRegion;
+ }
+ }
+
+ public bool HasSetRegion {
+ get {
+ return !setRegion.IsNull;
+ }
+ }
+
+ public bool HasGetRegion {
+ get {
+ return !getRegion.IsNull;
+ }
+ }
+
+ public bool IsWriteOnly {
+ get {
+ return !HasGetRegion && HasSetRegion;
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitIndexerDeclaration(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[IndexerDeclaration Parameters={0} InterfaceImplementations={1} TypeReference={2}" +
+ " BodyStart={3} BodyEnd={4} GetRegion={5} SetRegion={6} Attributes={7} Modifier={" +
+ "8}]", GetCollectionString(Parameters), GetCollectionString(InterfaceImplementations), TypeReference, BodyStart, BodyEnd, GetRegion, SetRegion, GetCollectionString(Attributes), Modifier);
+ }
+ }
+
+ public class IndexerExpression : Expression {
+
+ Expression targetObject;
+
+ List<Expression> indexes;
+
+ public Expression TargetObject {
+ get {
+ return targetObject;
+ }
+ set {
+ targetObject = value ?? Expression.Null;
+ if (!targetObject.IsNull) targetObject.Parent = this;
+ }
+ }
+
+ public List<Expression> Indexes {
+ get {
+ return indexes;
+ }
+ set {
+ indexes = value ?? new List<Expression>();
+ }
+ }
+
+ public IndexerExpression(Expression targetObject, List<Expression> indexes) {
+ TargetObject = targetObject;
+ Indexes = indexes;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitIndexerExpression(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[IndexerExpression TargetObject={0} Indexes={1}]", TargetObject, GetCollectionString(Indexes));
+ }
+ }
+
+ public class InterfaceImplementation : AbstractNode {
+
+ TypeReference interfaceType;
+
+ string memberName;
+
+ public TypeReference InterfaceType {
+ get {
+ return interfaceType;
+ }
+ set {
+ interfaceType = value ?? TypeReference.Null;
+ if (!interfaceType.IsNull) interfaceType.Parent = this;
+ }
+ }
+
+ public string MemberName {
+ get {
+ return memberName;
+ }
+ set {
+ memberName = string.IsNullOrEmpty(value) ? "?" : value;
+ }
+ }
+
+ public InterfaceImplementation(TypeReference interfaceType, string memberName) {
+ InterfaceType = interfaceType;
+ MemberName = memberName;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitInterfaceImplementation(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[InterfaceImplementation InterfaceType={0} MemberName={1}]", InterfaceType, MemberName);
+ }
+ }
+
+ public class InvocationExpression : Expression {
+
+ Expression targetObject;
+
+ List<Expression> arguments;
+
+ public Expression TargetObject {
+ get {
+ return targetObject;
+ }
+ set {
+ targetObject = value ?? Expression.Null;
+ if (!targetObject.IsNull) targetObject.Parent = this;
+ }
+ }
+
+ public List<Expression> Arguments {
+ get {
+ return arguments;
+ }
+ set {
+ arguments = value ?? new List<Expression>();
+ }
+ }
+
+ public InvocationExpression(Expression targetObject) {
+ TargetObject = targetObject;
+ arguments = new List<Expression>();
+ }
+
+ public InvocationExpression(Expression targetObject, List<Expression> arguments) {
+ TargetObject = targetObject;
+ Arguments = arguments;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitInvocationExpression(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[InvocationExpression TargetObject={0} Arguments={1}]", TargetObject, GetCollectionString(Arguments));
+ }
+ }
+
+ public class LabelStatement : Statement {
+
+ string label;
+
+ public string Label {
+ get {
+ return label;
+ }
+ set {
+ label = value ?? "";
+ }
+ }
+
+ public LabelStatement(string label) {
+ Label = label;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitLabelStatement(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[LabelStatement Label={0}]", Label);
+ }
+ }
+
+ public class LambdaExpression : Expression {
+
+ List<ParameterDeclarationExpression> parameters;
+
+ BlockStatement statementBody;
+
+ Expression expressionBody;
+
+ public List<ParameterDeclarationExpression> Parameters {
+ get {
+ return parameters;
+ }
+ set {
+ parameters = value ?? new List<ParameterDeclarationExpression>();
+ }
+ }
+
+ public BlockStatement StatementBody {
+ get {
+ return statementBody;
+ }
+ set {
+ statementBody = value ?? BlockStatement.Null;
+ if (!statementBody.IsNull) statementBody.Parent = this;
+ }
+ }
+
+ public Expression ExpressionBody {
+ get {
+ return expressionBody;
+ }
+ set {
+ expressionBody = value ?? Expression.Null;
+ if (!expressionBody.IsNull) expressionBody.Parent = this;
+ }
+ }
+
+ public LambdaExpression() {
+ parameters = new List<ParameterDeclarationExpression>();
+ statementBody = BlockStatement.Null;
+ expressionBody = Expression.Null;
+ }
+
+public Location ExtendedEndLocation { get; set; }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitLambdaExpression(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[LambdaExpression Parameters={0} StatementBody={1} ExpressionBody={2}]", GetCollectionString(Parameters), StatementBody, ExpressionBody);
+ }
+ }
+
+ public class LockStatement : StatementWithEmbeddedStatement {
+
+ Expression lockExpression;
+
+ public Expression LockExpression {
+ get {
+ return lockExpression;
+ }
+ set {
+ lockExpression = value ?? Expression.Null;
+ if (!lockExpression.IsNull) lockExpression.Parent = this;
+ }
+ }
+
+ public LockStatement(Expression lockExpression, Statement embeddedStatement) {
+ LockExpression = lockExpression;
+ EmbeddedStatement = embeddedStatement;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitLockStatement(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[LockStatement LockExpression={0} EmbeddedStatement={1}]", LockExpression, EmbeddedStatement);
+ }
+ }
+
+ public abstract class MemberNode : ParametrizedNode {
+
+ List<InterfaceImplementation> interfaceImplementations;
+
+ TypeReference typeReference;
+
+ public List<InterfaceImplementation> InterfaceImplementations {
+ get {
+ return interfaceImplementations;
+ }
+ set {
+ interfaceImplementations = value ?? new List<InterfaceImplementation>();
+ }
+ }
+
+ public TypeReference TypeReference {
+ get {
+ return typeReference;
+ }
+ set {
+ typeReference = value ?? TypeReference.Null;
+ if (!typeReference.IsNull) typeReference.Parent = this;
+ }
+ }
+
+ protected MemberNode() {
+ interfaceImplementations = new List<InterfaceImplementation>();
+ typeReference = TypeReference.Null;
+ }
+
+ protected MemberNode(Modifiers modifier, List<AttributeSection> attributes, string name, List<ParameterDeclarationExpression> parameters) {
+ Modifier = modifier;
+ Attributes = attributes;
+ Name = name;
+ Parameters = parameters;
+ interfaceImplementations = new List<InterfaceImplementation>();
+ typeReference = TypeReference.Null;
+ }
+ }
+
+ public class MemberReferenceExpression : Expression {
+
+ Expression targetObject;
+
+ string memberName;
+
+ List<TypeReference> typeArguments;
+
+ public Expression TargetObject {
+ get {
+ return targetObject;
+ }
+ set {
+ targetObject = value ?? Expression.Null;
+ if (!targetObject.IsNull) targetObject.Parent = this;
+ }
+ }
+
+ public string MemberName {
+ get {
+ return memberName;
+ }
+ set {
+ memberName = value ?? "";
+ }
+ }
+
+ public List<TypeReference> TypeArguments {
+ get {
+ return typeArguments;
+ }
+ set {
+ typeArguments = value ?? new List<TypeReference>();
+ }
+ }
+
+ public MemberReferenceExpression(Expression targetObject, string memberName) {
+ TargetObject = targetObject;
+ MemberName = memberName;
+ typeArguments = new List<TypeReference>();
+ }
+
+[Obsolete] public string FieldName { get { return MemberName; } set { MemberName = value; } }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitMemberReferenceExpression(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[MemberReferenceExpression TargetObject={0} MemberName={1} TypeArguments={2}]", TargetObject, MemberName, GetCollectionString(TypeArguments));
+ }
+ }
+
+ public class MethodDeclaration : MemberNode {
+
+ BlockStatement body;
+
+ List<string> handlesClause;
+
+ List<TemplateDefinition> templates;
+
+ bool isExtensionMethod;
+
+ public BlockStatement Body {
+ get {
+ return body;
+ }
+ set {
+ body = value ?? BlockStatement.Null;
+ if (!body.IsNull) body.Parent = this;
+ }
+ }
+
+ public List<string> HandlesClause {
+ get {
+ return handlesClause;
+ }
+ set {
+ handlesClause = value ?? new List<String>();
+ }
+ }
+
+ public List<TemplateDefinition> Templates {
+ get {
+ return templates;
+ }
+ set {
+ templates = value ?? new List<TemplateDefinition>();
+ }
+ }
+
+ public bool IsExtensionMethod {
+ get {
+ return isExtensionMethod;
+ }
+ set {
+ isExtensionMethod = value;
+ }
+ }
+
+ public MethodDeclaration() {
+ body = BlockStatement.Null;
+ handlesClause = new List<String>();
+ templates = new List<TemplateDefinition>();
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitMethodDeclaration(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[MethodDeclaration Body={0} HandlesClause={1} Templates={2} IsExtensionMethod={3}" +
+ " InterfaceImplementations={4} TypeReference={5} Name={6} Parameters={7} Attribut" +
+ "es={8} Modifier={9}]", Body, GetCollectionString(HandlesClause), GetCollectionString(Templates), IsExtensionMethod, GetCollectionString(InterfaceImplementations), TypeReference, Name, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier);
+ }
+ }
+
+ public class NamedArgumentExpression : Expression {
+
+ string name;
+
+ Expression expression;
+
+ public string Name {
+ get {
+ return name;
+ }
+ set {
+ name = value ?? "";
+ }
+ }
+
+ public Expression Expression {
+ get {
+ return expression;
+ }
+ set {
+ expression = value ?? Expression.Null;
+ if (!expression.IsNull) expression.Parent = this;
+ }
+ }
+
+ public NamedArgumentExpression() {
+ name = "";
+ expression = Expression.Null;
+ }
+
+ public NamedArgumentExpression(string name, Expression expression) {
+ Name = name;
+ Expression = expression;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitNamedArgumentExpression(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[NamedArgumentExpression Name={0} Expression={1}]", Name, Expression);
+ }
+ }
+
+ public class NamespaceDeclaration : AbstractNode {
+
+ string name;
+
+ public string Name {
+ get {
+ return name;
+ }
+ set {
+ name = value ?? "";
+ }
+ }
+
+ public NamespaceDeclaration(string name) {
+ Name = name;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitNamespaceDeclaration(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[NamespaceDeclaration Name={0}]", Name);
+ }
+ }
+
+ public class ObjectCreateExpression : Expression {
+
+ TypeReference createType;
+
+ List<Expression> parameters;
+
+ CollectionInitializerExpression objectInitializer;
+
+ public TypeReference CreateType {
+ get {
+ return createType;
+ }
+ set {
+ createType = value ?? TypeReference.Null;
+ if (!createType.IsNull) createType.Parent = this;
+ }
+ }
+
+ public List<Expression> Parameters {
+ get {
+ return parameters;
+ }
+ set {
+ parameters = value ?? new List<Expression>();
+ }
+ }
+
+ public CollectionInitializerExpression ObjectInitializer {
+ get {
+ return objectInitializer;
+ }
+ set {
+ objectInitializer = value ?? CollectionInitializerExpression.Null;
+ if (!objectInitializer.IsNull) objectInitializer.Parent = this;
+ }
+ }
+
+ public ObjectCreateExpression(TypeReference createType, List<Expression> parameters) {
+ CreateType = createType;
+ Parameters = parameters;
+ objectInitializer = CollectionInitializerExpression.Null;
+ }
+
+ public bool IsAnonymousType {
+ get {
+ return createType.IsNull || string.IsNullOrEmpty(createType.Type);
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitObjectCreateExpression(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[ObjectCreateExpression CreateType={0} Parameters={1} ObjectInitializer={2}]", CreateType, GetCollectionString(Parameters), ObjectInitializer);
+ }
+ }
+
+ public class OnErrorStatement : StatementWithEmbeddedStatement {
+
+ public OnErrorStatement(Statement embeddedStatement) {
+ EmbeddedStatement = embeddedStatement;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitOnErrorStatement(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[OnErrorStatement EmbeddedStatement={0}]", EmbeddedStatement);
+ }
+ }
+
+ public class OperatorDeclaration : MethodDeclaration {
+
+ ConversionType conversionType;
+
+ List<AttributeSection> returnTypeAttributes;
+
+ OverloadableOperatorType overloadableOperator;
+
+ public ConversionType ConversionType {
+ get {
+ return conversionType;
+ }
+ set {
+ conversionType = value;
+ }
+ }
+
+ public List<AttributeSection> ReturnTypeAttributes {
+ get {
+ return returnTypeAttributes;
+ }
+ set {
+ returnTypeAttributes = value ?? new List<AttributeSection>();
+ }
+ }
+
+ public OverloadableOperatorType OverloadableOperator {
+ get {
+ return overloadableOperator;
+ }
+ set {
+ overloadableOperator = value;
+ }
+ }
+
+ public OperatorDeclaration() {
+ returnTypeAttributes = new List<AttributeSection>();
+ }
+
+ public bool IsConversionOperator {
+ get {
+ return conversionType != ConversionType.None;
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitOperatorDeclaration(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[OperatorDeclaration ConversionType={0} ReturnTypeAttributes={1} OverloadableOper" +
+ "ator={2} Body={3} HandlesClause={4} Templates={5} IsExtensionMethod={6} Interfac" +
+ "eImplementations={7} TypeReference={8} Name={9} Parameters={10} Attributes={11} " +
+ "Modifier={12}]", ConversionType, GetCollectionString(ReturnTypeAttributes), OverloadableOperator, Body, GetCollectionString(HandlesClause), GetCollectionString(Templates), IsExtensionMethod, GetCollectionString(InterfaceImplementations), TypeReference, Name, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier);
+ }
+ }
+
+ public class OptionDeclaration : AbstractNode {
+
+ OptionType optionType;
+
+ bool optionValue;
+
+ public OptionType OptionType {
+ get {
+ return optionType;
+ }
+ set {
+ optionType = value;
+ }
+ }
+
+ public bool OptionValue {
+ get {
+ return optionValue;
+ }
+ set {
+ optionValue = value;
+ }
+ }
+
+ public OptionDeclaration(OptionType optionType, bool optionValue) {
+ OptionType = optionType;
+ OptionValue = optionValue;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitOptionDeclaration(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[OptionDeclaration OptionType={0} OptionValue={1}]", OptionType, OptionValue);
+ }
+ }
+
+ public class ParameterDeclarationExpression : Expression {
+
+ List<AttributeSection> attributes;
+
+ string parameterName;
+
+ TypeReference typeReference;
+
+ ParameterModifiers paramModifier;
+
+ Expression defaultValue;
+
+ public List<AttributeSection> Attributes {
+ get {
+ return attributes;
+ }
+ set {
+ attributes = value ?? new List<AttributeSection>();
+ }
+ }
+
+ public string ParameterName {
+ get {
+ return parameterName;
+ }
+ set {
+ parameterName = string.IsNullOrEmpty(value) ? "?" : value;
+ }
+ }
+
+ public TypeReference TypeReference {
+ get {
+ return typeReference;
+ }
+ set {
+ typeReference = value ?? TypeReference.Null;
+ if (!typeReference.IsNull) typeReference.Parent = this;
+ }
+ }
+
+ public ParameterModifiers ParamModifier {
+ get {
+ return paramModifier;
+ }
+ set {
+ paramModifier = value;
+ }
+ }
+
+ public Expression DefaultValue {
+ get {
+ return defaultValue;
+ }
+ set {
+ defaultValue = value ?? Expression.Null;
+ if (!defaultValue.IsNull) defaultValue.Parent = this;
+ }
+ }
+
+ public ParameterDeclarationExpression(TypeReference typeReference, string parameterName) {
+ TypeReference = typeReference;
+ ParameterName = parameterName;
+ attributes = new List<AttributeSection>();
+ defaultValue = Expression.Null;
+ }
+
+ public ParameterDeclarationExpression(TypeReference typeReference, string parameterName, ParameterModifiers paramModifier) {
+ TypeReference = typeReference;
+ ParameterName = parameterName;
+ ParamModifier = paramModifier;
+ attributes = new List<AttributeSection>();
+ defaultValue = Expression.Null;
+ }
+
+ public ParameterDeclarationExpression(TypeReference typeReference, string parameterName, ParameterModifiers paramModifier, Expression defaultValue) {
+ TypeReference = typeReference;
+ ParameterName = parameterName;
+ ParamModifier = paramModifier;
+ DefaultValue = defaultValue;
+ attributes = new List<AttributeSection>();
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitParameterDeclarationExpression(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[ParameterDeclarationExpression Attributes={0} ParameterName={1} TypeReference={2" +
+ "} ParamModifier={3} DefaultValue={4}]", GetCollectionString(Attributes), ParameterName, TypeReference, ParamModifier, DefaultValue);
+ }
+ }
+
+ public abstract class ParametrizedNode : AttributedNode {
+
+ string name;
+
+ List<ParameterDeclarationExpression> parameters;
+
+ public string Name {
+ get {
+ return name;
+ }
+ set {
+ name = value ?? "";
+ }
+ }
+
+ public List<ParameterDeclarationExpression> Parameters {
+ get {
+ return parameters;
+ }
+ set {
+ parameters = value ?? new List<ParameterDeclarationExpression>();
+ }
+ }
+
+ protected ParametrizedNode() {
+ name = "";
+ parameters = new List<ParameterDeclarationExpression>();
+ }
+
+ protected ParametrizedNode(Modifiers modifier, List<AttributeSection> attributes, string name, List<ParameterDeclarationExpression> parameters) {
+ Modifier = modifier;
+ Attributes = attributes;
+ Name = name;
+ Parameters = parameters;
+ }
+ }
+
+ public class ParenthesizedExpression : Expression {
+
+ Expression expression;
+
+ public Expression Expression {
+ get {
+ return expression;
+ }
+ set {
+ expression = value ?? Expression.Null;
+ if (!expression.IsNull) expression.Parent = this;
+ }
+ }
+
+ public ParenthesizedExpression(Expression expression) {
+ Expression = expression;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitParenthesizedExpression(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[ParenthesizedExpression Expression={0}]", Expression);
+ }
+ }
+
+ public class PointerReferenceExpression : Expression {
+
+ Expression targetObject;
+
+ string memberName;
+
+ List<TypeReference> typeArguments;
+
+ public Expression TargetObject {
+ get {
+ return targetObject;
+ }
+ set {
+ targetObject = value ?? Expression.Null;
+ if (!targetObject.IsNull) targetObject.Parent = this;
+ }
+ }
+
+ public string MemberName {
+ get {
+ return memberName;
+ }
+ set {
+ memberName = value ?? "";
+ }
+ }
+
+ public List<TypeReference> TypeArguments {
+ get {
+ return typeArguments;
+ }
+ set {
+ typeArguments = value ?? new List<TypeReference>();
+ }
+ }
+
+ public PointerReferenceExpression(Expression targetObject, string memberName) {
+ TargetObject = targetObject;
+ MemberName = memberName;
+ typeArguments = new List<TypeReference>();
+ }
+
+[Obsolete] public string Identifier { get { return MemberName; } set { MemberName = value; } }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitPointerReferenceExpression(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[PointerReferenceExpression TargetObject={0} MemberName={1} TypeArguments={2}]", TargetObject, MemberName, GetCollectionString(TypeArguments));
+ }
+ }
+
+ public class PropertyDeclaration : MemberNode {
+
+ Location bodyStart;
+
+ Location bodyEnd;
+
+ PropertyGetRegion getRegion;
+
+ PropertySetRegion setRegion;
+
+ public Location BodyStart {
+ get {
+ return bodyStart;
+ }
+ set {
+ bodyStart = value;
+ }
+ }
+
+ public Location BodyEnd {
+ get {
+ return bodyEnd;
+ }
+ set {
+ bodyEnd = value;
+ }
+ }
+
+ public PropertyGetRegion GetRegion {
+ get {
+ return getRegion;
+ }
+ set {
+ getRegion = value ?? PropertyGetRegion.Null;
+ if (!getRegion.IsNull) getRegion.Parent = this;
+ }
+ }
+
+ public PropertySetRegion SetRegion {
+ get {
+ return setRegion;
+ }
+ set {
+ setRegion = value ?? PropertySetRegion.Null;
+ if (!setRegion.IsNull) setRegion.Parent = this;
+ }
+ }
+
+ public PropertyDeclaration(Modifiers modifier, List<AttributeSection> attributes, string name, List<ParameterDeclarationExpression> parameters) {
+ Modifier = modifier;
+ Attributes = attributes;
+ Name = name;
+ Parameters = parameters;
+ bodyStart = Location.Empty;
+ bodyEnd = Location.Empty;
+ getRegion = PropertyGetRegion.Null;
+ setRegion = PropertySetRegion.Null;
+ }
+
+ public bool HasGetRegion {
+ get {
+ return !getRegion.IsNull;
+ }
+ }
+
+ public bool HasSetRegion {
+ get {
+ return !setRegion.IsNull;
+ }
+ }
+
+ public bool IsReadOnly {
+ get {
+ return HasGetRegion && !HasSetRegion;
+ }
+ }
+
+
+ internal PropertyDeclaration(string name, TypeReference typeReference, Modifiers modifier, List<AttributeSection> attributes) : this(modifier, attributes, name, null)
+ {
+ this.TypeReference = typeReference;
+ if ((modifier & Modifiers.ReadOnly) != Modifiers.ReadOnly) {
+ this.SetRegion = new PropertySetRegion(null, null);
+ }
+ if ((modifier & Modifiers.WriteOnly) != Modifiers.WriteOnly) {
+ this.GetRegion = new PropertyGetRegion(null, null);
+ }
+ }
+
+ public bool IsWriteOnly {
+ get {
+ return !HasGetRegion && HasSetRegion;
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitPropertyDeclaration(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[PropertyDeclaration BodyStart={0} BodyEnd={1} GetRegion={2} SetRegion={3} Interf" +
+ "aceImplementations={4} TypeReference={5} Name={6} Parameters={7} Attributes={8} " +
+ "Modifier={9}]", BodyStart, BodyEnd, GetRegion, SetRegion, GetCollectionString(InterfaceImplementations), TypeReference, Name, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier);
+ }
+ }
+
+ public class PropertyGetRegion : PropertyGetSetRegion {
+
+ public PropertyGetRegion(BlockStatement block, List<AttributeSection> attributes) :
+ base(block, attributes) {
+ }
+
+ public static PropertyGetRegion Null {
+ get {
+ return NullPropertyGetRegion.Instance;
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitPropertyGetRegion(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[PropertyGetRegion Block={0} Attributes={1} Modifier={2}]", Block, GetCollectionString(Attributes), Modifier);
+ }
+ }
+
+ internal sealed class NullPropertyGetRegion : PropertyGetRegion {
+
+ private NullPropertyGetRegion() :
+ base(null, null) {
+ }
+
+ internal static NullPropertyGetRegion Instance = new NullPropertyGetRegion();
+
+ public override bool IsNull {
+ get {
+ return true;
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return null;
+ }
+
+ public override string ToString() {
+ return "[NullPropertyGetRegion]";
+ }
+ }
+
+ public abstract class PropertyGetSetRegion : AttributedNode, INullable {
+
+ BlockStatement block;
+
+ public BlockStatement Block {
+ get {
+ return block;
+ }
+ set {
+ block = value ?? BlockStatement.Null;
+ if (!block.IsNull) block.Parent = this;
+ }
+ }
+
+ protected PropertyGetSetRegion(BlockStatement block, List<AttributeSection> attributes) {
+ Block = block;
+ Attributes = attributes;
+ }
+
+ public virtual bool IsNull {
+ get {
+ return false;
+ }
+ }
+ }
+
+ public class PropertySetRegion : PropertyGetSetRegion {
+
+ List<ParameterDeclarationExpression> parameters;
+
+ public List<ParameterDeclarationExpression> Parameters {
+ get {
+ return parameters;
+ }
+ set {
+ parameters = value ?? new List<ParameterDeclarationExpression>();
+ }
+ }
+
+ public PropertySetRegion(BlockStatement block, List<AttributeSection> attributes) :
+ base(block, attributes) {
+ parameters = new List<ParameterDeclarationExpression>();
+ }
+
+ public static PropertySetRegion Null {
+ get {
+ return NullPropertySetRegion.Instance;
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitPropertySetRegion(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[PropertySetRegion Parameters={0} Block={1} Attributes={2} Modifier={3}]", GetCollectionString(Parameters), Block, GetCollectionString(Attributes), Modifier);
+ }
+ }
+
+ internal sealed class NullPropertySetRegion : PropertySetRegion {
+
+ private NullPropertySetRegion() :
+ base(null, null) {
+ }
+
+ internal static NullPropertySetRegion Instance = new NullPropertySetRegion();
+
+ public override bool IsNull {
+ get {
+ return true;
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return null;
+ }
+
+ public override string ToString() {
+ return "[NullPropertySetRegion]";
+ }
+ }
+
+ public class QueryExpression : Expression {
+
+ QueryExpressionFromClause fromClause;
+
+ bool isQueryContinuation;
+
+ List<QueryExpressionClause> middleClauses;
+
+ QueryExpressionClause selectOrGroupClause;
+
+ public QueryExpressionFromClause FromClause {
+ get {
+ return fromClause;
+ }
+ set {
+ fromClause = value ?? QueryExpressionFromClause.Null;
+ if (!fromClause.IsNull) fromClause.Parent = this;
+ }
+ }
+
+ public bool IsQueryContinuation {
+ get {
+ return isQueryContinuation;
+ }
+ set {
+ isQueryContinuation = value;
+ }
+ }
+
+ public List<QueryExpressionClause> MiddleClauses {
+ get {
+ return middleClauses;
+ }
+ set {
+ middleClauses = value ?? new List<QueryExpressionClause>();
+ }
+ }
+
+ public QueryExpressionClause SelectOrGroupClause {
+ get {
+ return selectOrGroupClause;
+ }
+ set {
+ selectOrGroupClause = value ?? QueryExpressionClause.Null;
+ if (!selectOrGroupClause.IsNull) selectOrGroupClause.Parent = this;
+ }
+ }
+
+ public QueryExpression() {
+ fromClause = QueryExpressionFromClause.Null;
+ middleClauses = new List<QueryExpressionClause>();
+ selectOrGroupClause = QueryExpressionClause.Null;
+ }
+
+ public new static QueryExpression Null {
+ get {
+ return NullQueryExpression.Instance;
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitQueryExpression(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[QueryExpression FromClause={0} IsQueryContinuation={1} MiddleClauses={2} SelectO" +
+ "rGroupClause={3}]", FromClause, IsQueryContinuation, GetCollectionString(MiddleClauses), SelectOrGroupClause);
+ }
+ }
+
+ internal sealed class NullQueryExpression : QueryExpression {
+
+ internal static NullQueryExpression Instance = new NullQueryExpression();
+
+ public override bool IsNull {
+ get {
+ return true;
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return null;
+ }
+
+ public override string ToString() {
+ return "[NullQueryExpression]";
+ }
+ }
+
+ public class QueryExpressionAggregateClause : QueryExpressionClause {
+
+ QueryExpressionFromClause fromClause;
+
+ List<QueryExpressionClause> middleClauses;
+
+ List<ExpressionRangeVariable> intoVariables;
+
+ public QueryExpressionFromClause FromClause {
+ get {
+ return fromClause;
+ }
+ set {
+ fromClause = value ?? QueryExpressionFromClause.Null;
+ if (!fromClause.IsNull) fromClause.Parent = this;
+ }
+ }
+
+ public List<QueryExpressionClause> MiddleClauses {
+ get {
+ return middleClauses;
+ }
+ set {
+ middleClauses = value ?? new List<QueryExpressionClause>();
+ }
+ }
+
+ public List<ExpressionRangeVariable> IntoVariables {
+ get {
+ return intoVariables;
+ }
+ set {
+ intoVariables = value ?? new List<ExpressionRangeVariable>();
+ }
+ }
+
+ public QueryExpressionAggregateClause() {
+ fromClause = QueryExpressionFromClause.Null;
+ middleClauses = new List<QueryExpressionClause>();
+ intoVariables = new List<ExpressionRangeVariable>();
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitQueryExpressionAggregateClause(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[QueryExpressionAggregateClause FromClause={0} MiddleClauses={1} IntoVariables={2" +
+ "}]", FromClause, GetCollectionString(MiddleClauses), GetCollectionString(IntoVariables));
+ }
+ }
+
+ public abstract class QueryExpressionClause : AbstractNode, INullable {
+
+ protected QueryExpressionClause() {
+ }
+
+ public virtual bool IsNull {
+ get {
+ return false;
+ }
+ }
+
+ public static QueryExpressionClause Null {
+ get {
+ return NullQueryExpressionClause.Instance;
+ }
+ }
+ }
+
+ internal sealed class NullQueryExpressionClause : QueryExpressionClause {
+
+ internal static NullQueryExpressionClause Instance = new NullQueryExpressionClause();
+
+ public override bool IsNull {
+ get {
+ return true;
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return null;
+ }
+
+ public override string ToString() {
+ return "[NullQueryExpressionClause]";
+ }
+ }
+
+ public class QueryExpressionDistinctClause : QueryExpressionClause {
+
+ public QueryExpressionDistinctClause() {
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitQueryExpressionDistinctClause(this, data);
+ }
+
+ public override string ToString() {
+ return "[QueryExpressionDistinctClause]";
+ }
+ }
+
+ public class QueryExpressionFromClause : QueryExpressionFromOrJoinClause {
+
+ public QueryExpressionFromClause() {
+ }
+
+ public new static QueryExpressionFromClause Null {
+ get {
+ return NullQueryExpressionFromClause.Instance;
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitQueryExpressionFromClause(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[QueryExpressionFromClause Type={0} Identifier={1} InExpression={2}]", Type, Identifier, InExpression);
+ }
+ }
+
+ internal sealed class NullQueryExpressionFromClause : QueryExpressionFromClause {
+
+ internal static NullQueryExpressionFromClause Instance = new NullQueryExpressionFromClause();
+
+ public override bool IsNull {
+ get {
+ return true;
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return null;
+ }
+
+ public override string ToString() {
+ return "[NullQueryExpressionFromClause]";
+ }
+ }
+
+ public abstract class QueryExpressionFromOrJoinClause : QueryExpressionClause {
+
+ TypeReference type;
+
+ string identifier;
+
+ Expression inExpression;
+
+ public TypeReference Type {
+ get {
+ return type;
+ }
+ set {
+ type = value ?? TypeReference.Null;
+ if (!type.IsNull) type.Parent = this;
+ }
+ }
+
+ public string Identifier {
+ get {
+ return identifier;
+ }
+ set {
+ identifier = string.IsNullOrEmpty(value) ? "?" : value;
+ }
+ }
+
+ public Expression InExpression {
+ get {
+ return inExpression;
+ }
+ set {
+ inExpression = value ?? Expression.Null;
+ if (!inExpression.IsNull) inExpression.Parent = this;
+ }
+ }
+
+ protected QueryExpressionFromOrJoinClause() {
+ type = TypeReference.Null;
+ identifier = "?";
+ inExpression = Expression.Null;
+ }
+ }
+
+ public class QueryExpressionGroupClause : QueryExpressionClause {
+
+ Expression projection;
+
+ Expression groupBy;
+
+ public Expression Projection {
+ get {
+ return projection;
+ }
+ set {
+ projection = value ?? Expression.Null;
+ if (!projection.IsNull) projection.Parent = this;
+ }
+ }
+
+ public Expression GroupBy {
+ get {
+ return groupBy;
+ }
+ set {
+ groupBy = value ?? Expression.Null;
+ if (!groupBy.IsNull) groupBy.Parent = this;
+ }
+ }
+
+ public QueryExpressionGroupClause() {
+ projection = Expression.Null;
+ groupBy = Expression.Null;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitQueryExpressionGroupClause(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[QueryExpressionGroupClause Projection={0} GroupBy={1}]", Projection, GroupBy);
+ }
+ }
+
+ public class QueryExpressionGroupJoinVBClause : QueryExpressionClause {
+
+ QueryExpressionJoinVBClause joinClause;
+
+ List<ExpressionRangeVariable> intoVariables;
+
+ public QueryExpressionJoinVBClause JoinClause {
+ get {
+ return joinClause;
+ }
+ set {
+ joinClause = value ?? QueryExpressionJoinVBClause.Null;
+ if (!joinClause.IsNull) joinClause.Parent = this;
+ }
+ }
+
+ public List<ExpressionRangeVariable> IntoVariables {
+ get {
+ return intoVariables;
+ }
+ set {
+ intoVariables = value ?? new List<ExpressionRangeVariable>();
+ }
+ }
+
+ public QueryExpressionGroupJoinVBClause() {
+ joinClause = QueryExpressionJoinVBClause.Null;
+ intoVariables = new List<ExpressionRangeVariable>();
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitQueryExpressionGroupJoinVBClause(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[QueryExpressionGroupJoinVBClause JoinClause={0} IntoVariables={1}]", JoinClause, GetCollectionString(IntoVariables));
+ }
+ }
+
+ public class QueryExpressionGroupVBClause : QueryExpressionClause {
+
+ List<ExpressionRangeVariable> groupVariables;
+
+ List<ExpressionRangeVariable> byVariables;
+
+ List<ExpressionRangeVariable> intoVariables;
+
+ public List<ExpressionRangeVariable> GroupVariables {
+ get {
+ return groupVariables;
+ }
+ set {
+ groupVariables = value ?? new List<ExpressionRangeVariable>();
+ }
+ }
+
+ public List<ExpressionRangeVariable> ByVariables {
+ get {
+ return byVariables;
+ }
+ set {
+ byVariables = value ?? new List<ExpressionRangeVariable>();
+ }
+ }
+
+ public List<ExpressionRangeVariable> IntoVariables {
+ get {
+ return intoVariables;
+ }
+ set {
+ intoVariables = value ?? new List<ExpressionRangeVariable>();
+ }
+ }
+
+ public QueryExpressionGroupVBClause() {
+ groupVariables = new List<ExpressionRangeVariable>();
+ byVariables = new List<ExpressionRangeVariable>();
+ intoVariables = new List<ExpressionRangeVariable>();
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitQueryExpressionGroupVBClause(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[QueryExpressionGroupVBClause GroupVariables={0} ByVariables={1} IntoVariables={2" +
+ "}]", GetCollectionString(GroupVariables), GetCollectionString(ByVariables), GetCollectionString(IntoVariables));
+ }
+ }
+
+ public class QueryExpressionJoinClause : QueryExpressionFromOrJoinClause {
+
+ Expression onExpression;
+
+ Expression equalsExpression;
+
+ string intoIdentifier;
+
+ public Expression OnExpression {
+ get {
+ return onExpression;
+ }
+ set {
+ onExpression = value ?? Expression.Null;
+ if (!onExpression.IsNull) onExpression.Parent = this;
+ }
+ }
+
+ public Expression EqualsExpression {
+ get {
+ return equalsExpression;
+ }
+ set {
+ equalsExpression = value ?? Expression.Null;
+ if (!equalsExpression.IsNull) equalsExpression.Parent = this;
+ }
+ }
+
+ public string IntoIdentifier {
+ get {
+ return intoIdentifier;
+ }
+ set {
+ intoIdentifier = value ?? "";
+ }
+ }
+
+ public QueryExpressionJoinClause() {
+ onExpression = Expression.Null;
+ equalsExpression = Expression.Null;
+ intoIdentifier = "";
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitQueryExpressionJoinClause(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[QueryExpressionJoinClause OnExpression={0} EqualsExpression={1} IntoIdentifier={" +
+ "2} Type={3} Identifier={4} InExpression={5}]", OnExpression, EqualsExpression, IntoIdentifier, Type, Identifier, InExpression);
+ }
+ }
+
+ public class QueryExpressionJoinConditionVB : AbstractNode {
+
+ Expression leftSide;
+
+ Expression rightSide;
+
+ public Expression LeftSide {
+ get {
+ return leftSide;
+ }
+ set {
+ leftSide = value ?? Expression.Null;
+ if (!leftSide.IsNull) leftSide.Parent = this;
+ }
+ }
+
+ public Expression RightSide {
+ get {
+ return rightSide;
+ }
+ set {
+ rightSide = value ?? Expression.Null;
+ if (!rightSide.IsNull) rightSide.Parent = this;
+ }
+ }
+
+ public QueryExpressionJoinConditionVB() {
+ leftSide = Expression.Null;
+ rightSide = Expression.Null;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitQueryExpressionJoinConditionVB(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[QueryExpressionJoinConditionVB LeftSide={0} RightSide={1}]", LeftSide, RightSide);
+ }
+ }
+
+ public class QueryExpressionJoinVBClause : QueryExpressionClause {
+
+ QueryExpressionFromClause joinVariable;
+
+ QueryExpressionJoinVBClause subJoin;
+
+ List<QueryExpressionJoinConditionVB> conditions;
+
+ public QueryExpressionFromClause JoinVariable {
+ get {
+ return joinVariable;
+ }
+ set {
+ joinVariable = value ?? QueryExpressionFromClause.Null;
+ if (!joinVariable.IsNull) joinVariable.Parent = this;
+ }
+ }
+
+ public QueryExpressionJoinVBClause SubJoin {
+ get {
+ return subJoin;
+ }
+ set {
+ subJoin = value ?? QueryExpressionJoinVBClause.Null;
+ if (!subJoin.IsNull) subJoin.Parent = this;
+ }
+ }
+
+ public List<QueryExpressionJoinConditionVB> Conditions {
+ get {
+ return conditions;
+ }
+ set {
+ conditions = value ?? new List<QueryExpressionJoinConditionVB>();
+ }
+ }
+
+ public QueryExpressionJoinVBClause() {
+ joinVariable = QueryExpressionFromClause.Null;
+ subJoin = QueryExpressionJoinVBClause.Null;
+ conditions = new List<QueryExpressionJoinConditionVB>();
+ }
+
+ public new static QueryExpressionJoinVBClause Null {
+ get {
+ return NullQueryExpressionJoinVBClause.Instance;
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitQueryExpressionJoinVBClause(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[QueryExpressionJoinVBClause JoinVariable={0} SubJoin={1} Conditions={2}]", JoinVariable, SubJoin, GetCollectionString(Conditions));
+ }
+ }
+
+ internal sealed class NullQueryExpressionJoinVBClause : QueryExpressionJoinVBClause {
+
+ internal static NullQueryExpressionJoinVBClause Instance = new NullQueryExpressionJoinVBClause();
+
+ public override bool IsNull {
+ get {
+ return true;
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return null;
+ }
+
+ public override string ToString() {
+ return "[NullQueryExpressionJoinVBClause]";
+ }
+ }
+
+ public class QueryExpressionLetClause : QueryExpressionClause {
+
+ string identifier;
+
+ Expression expression;
+
+ public string Identifier {
+ get {
+ return identifier;
+ }
+ set {
+ identifier = string.IsNullOrEmpty(value) ? "?" : value;
+ }
+ }
+
+ public Expression Expression {
+ get {
+ return expression;
+ }
+ set {
+ expression = value ?? Expression.Null;
+ if (!expression.IsNull) expression.Parent = this;
+ }
+ }
+
+ public QueryExpressionLetClause() {
+ identifier = "?";
+ expression = Expression.Null;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitQueryExpressionLetClause(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[QueryExpressionLetClause Identifier={0} Expression={1}]", Identifier, Expression);
+ }
+ }
+
+ public class QueryExpressionLetVBClause : QueryExpressionClause {
+
+ List<ExpressionRangeVariable> variables;
+
+ public List<ExpressionRangeVariable> Variables {
+ get {
+ return variables;
+ }
+ set {
+ variables = value ?? new List<ExpressionRangeVariable>();
+ }
+ }
+
+ public QueryExpressionLetVBClause() {
+ variables = new List<ExpressionRangeVariable>();
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitQueryExpressionLetVBClause(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[QueryExpressionLetVBClause Variables={0}]", GetCollectionString(Variables));
+ }
+ }
+
+ public class QueryExpressionOrderClause : QueryExpressionClause {
+
+ List<QueryExpressionOrdering> orderings;
+
+ public List<QueryExpressionOrdering> Orderings {
+ get {
+ return orderings;
+ }
+ set {
+ orderings = value ?? new List<QueryExpressionOrdering>();
+ }
+ }
+
+ public QueryExpressionOrderClause() {
+ orderings = new List<QueryExpressionOrdering>();
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitQueryExpressionOrderClause(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[QueryExpressionOrderClause Orderings={0}]", GetCollectionString(Orderings));
+ }
+ }
+
+ public class QueryExpressionOrdering : AbstractNode {
+
+ Expression criteria;
+
+ QueryExpressionOrderingDirection direction;
+
+ public Expression Criteria {
+ get {
+ return criteria;
+ }
+ set {
+ criteria = value ?? Expression.Null;
+ if (!criteria.IsNull) criteria.Parent = this;
+ }
+ }
+
+ public QueryExpressionOrderingDirection Direction {
+ get {
+ return direction;
+ }
+ set {
+ direction = value;
+ }
+ }
+
+ public QueryExpressionOrdering() {
+ criteria = Expression.Null;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitQueryExpressionOrdering(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[QueryExpressionOrdering Criteria={0} Direction={1}]", Criteria, Direction);
+ }
+ }
+
+ public class QueryExpressionPartitionVBClause : QueryExpressionClause {
+
+ Expression expression;
+
+ QueryExpressionPartitionType partitionType;
+
+ public Expression Expression {
+ get {
+ return expression;
+ }
+ set {
+ expression = value ?? Expression.Null;
+ if (!expression.IsNull) expression.Parent = this;
+ }
+ }
+
+ public QueryExpressionPartitionType PartitionType {
+ get {
+ return partitionType;
+ }
+ set {
+ partitionType = value;
+ }
+ }
+
+ public QueryExpressionPartitionVBClause() {
+ expression = Expression.Null;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitQueryExpressionPartitionVBClause(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[QueryExpressionPartitionVBClause Expression={0} PartitionType={1}]", Expression, PartitionType);
+ }
+ }
+
+ public class QueryExpressionSelectClause : QueryExpressionClause {
+
+ Expression projection;
+
+ public Expression Projection {
+ get {
+ return projection;
+ }
+ set {
+ projection = value ?? Expression.Null;
+ if (!projection.IsNull) projection.Parent = this;
+ }
+ }
+
+ public QueryExpressionSelectClause() {
+ projection = Expression.Null;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitQueryExpressionSelectClause(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[QueryExpressionSelectClause Projection={0}]", Projection);
+ }
+ }
+
+ public class QueryExpressionSelectVBClause : QueryExpressionClause {
+
+ List<ExpressionRangeVariable> variables;
+
+ public List<ExpressionRangeVariable> Variables {
+ get {
+ return variables;
+ }
+ set {
+ variables = value ?? new List<ExpressionRangeVariable>();
+ }
+ }
+
+ public QueryExpressionSelectVBClause() {
+ variables = new List<ExpressionRangeVariable>();
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitQueryExpressionSelectVBClause(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[QueryExpressionSelectVBClause Variables={0}]", GetCollectionString(Variables));
+ }
+ }
+
+ public class QueryExpressionWhereClause : QueryExpressionClause {
+
+ Expression condition;
+
+ public Expression Condition {
+ get {
+ return condition;
+ }
+ set {
+ condition = value ?? Expression.Null;
+ if (!condition.IsNull) condition.Parent = this;
+ }
+ }
+
+ public QueryExpressionWhereClause() {
+ condition = Expression.Null;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitQueryExpressionWhereClause(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[QueryExpressionWhereClause Condition={0}]", Condition);
+ }
+ }
+
+ public class RaiseEventStatement : Statement {
+
+ string eventName;
+
+ List<Expression> arguments;
+
+ public string EventName {
+ get {
+ return eventName;
+ }
+ set {
+ eventName = value ?? "";
+ }
+ }
+
+ public List<Expression> Arguments {
+ get {
+ return arguments;
+ }
+ set {
+ arguments = value ?? new List<Expression>();
+ }
+ }
+
+ public RaiseEventStatement(string eventName, List<Expression> arguments) {
+ EventName = eventName;
+ Arguments = arguments;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitRaiseEventStatement(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[RaiseEventStatement EventName={0} Arguments={1}]", EventName, GetCollectionString(Arguments));
+ }
+ }
+
+ public class ReDimStatement : Statement {
+
+ List<InvocationExpression> reDimClauses;
+
+ bool isPreserve;
+
+ public List<InvocationExpression> ReDimClauses {
+ get {
+ return reDimClauses;
+ }
+ set {
+ reDimClauses = value ?? new List<InvocationExpression>();
+ }
+ }
+
+ public bool IsPreserve {
+ get {
+ return isPreserve;
+ }
+ set {
+ isPreserve = value;
+ }
+ }
+
+ public ReDimStatement(bool isPreserve) {
+ IsPreserve = isPreserve;
+ reDimClauses = new List<InvocationExpression>();
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitReDimStatement(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[ReDimStatement ReDimClauses={0} IsPreserve={1}]", GetCollectionString(ReDimClauses), IsPreserve);
+ }
+ }
+
+ public class RemoveHandlerStatement : Statement {
+
+ Expression eventExpression;
+
+ Expression handlerExpression;
+
+ public Expression EventExpression {
+ get {
+ return eventExpression;
+ }
+ set {
+ eventExpression = value ?? Expression.Null;
+ if (!eventExpression.IsNull) eventExpression.Parent = this;
+ }
+ }
+
+ public Expression HandlerExpression {
+ get {
+ return handlerExpression;
+ }
+ set {
+ handlerExpression = value ?? Expression.Null;
+ if (!handlerExpression.IsNull) handlerExpression.Parent = this;
+ }
+ }
+
+ public RemoveHandlerStatement(Expression eventExpression, Expression handlerExpression) {
+ EventExpression = eventExpression;
+ HandlerExpression = handlerExpression;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitRemoveHandlerStatement(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[RemoveHandlerStatement EventExpression={0} HandlerExpression={1}]", EventExpression, HandlerExpression);
+ }
+ }
+
+ public class ResumeStatement : Statement {
+
+ string labelName;
+
+ bool isResumeNext;
+
+ public string LabelName {
+ get {
+ return labelName;
+ }
+ set {
+ labelName = value ?? "";
+ }
+ }
+
+ public bool IsResumeNext {
+ get {
+ return isResumeNext;
+ }
+ set {
+ isResumeNext = value;
+ }
+ }
+
+ public ResumeStatement(bool isResumeNext) {
+ IsResumeNext = isResumeNext;
+ labelName = "";
+ }
+
+ public ResumeStatement(string labelName) {
+ LabelName = labelName;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitResumeStatement(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[ResumeStatement LabelName={0} IsResumeNext={1}]", LabelName, IsResumeNext);
+ }
+ }
+
+ public class ReturnStatement : Statement {
+
+ Expression expression;
+
+ public Expression Expression {
+ get {
+ return expression;
+ }
+ set {
+ expression = value ?? Expression.Null;
+ if (!expression.IsNull) expression.Parent = this;
+ }
+ }
+
+ public ReturnStatement(Expression expression) {
+ Expression = expression;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitReturnStatement(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[ReturnStatement Expression={0}]", Expression);
+ }
+ }
+
+ public class SizeOfExpression : Expression {
+
+ TypeReference typeReference;
+
+ public TypeReference TypeReference {
+ get {
+ return typeReference;
+ }
+ set {
+ typeReference = value ?? TypeReference.Null;
+ if (!typeReference.IsNull) typeReference.Parent = this;
+ }
+ }
+
+ public SizeOfExpression(TypeReference typeReference) {
+ TypeReference = typeReference;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitSizeOfExpression(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[SizeOfExpression TypeReference={0}]", TypeReference);
+ }
+ }
+
+ public class StackAllocExpression : Expression {
+
+ TypeReference typeReference;
+
+ Expression expression;
+
+ public TypeReference TypeReference {
+ get {
+ return typeReference;
+ }
+ set {
+ typeReference = value ?? TypeReference.Null;
+ if (!typeReference.IsNull) typeReference.Parent = this;
+ }
+ }
+
+ public Expression Expression {
+ get {
+ return expression;
+ }
+ set {
+ expression = value ?? Expression.Null;
+ if (!expression.IsNull) expression.Parent = this;
+ }
+ }
+
+ public StackAllocExpression(TypeReference typeReference, Expression expression) {
+ TypeReference = typeReference;
+ Expression = expression;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitStackAllocExpression(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[StackAllocExpression TypeReference={0} Expression={1}]", TypeReference, Expression);
+ }
+ }
+
+ public class StopStatement : Statement {
+
+ public StopStatement() {
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitStopStatement(this, data);
+ }
+
+ public override string ToString() {
+ return "[StopStatement]";
+ }
+ }
+
+ public class SwitchSection : BlockStatement {
+
+ List<CaseLabel> switchLabels;
+
+ public List<CaseLabel> SwitchLabels {
+ get {
+ return switchLabels;
+ }
+ set {
+ switchLabels = value ?? new List<CaseLabel>();
+ }
+ }
+
+ public SwitchSection() {
+ switchLabels = new List<CaseLabel>();
+ }
+
+ public SwitchSection(List<CaseLabel> switchLabels) {
+ SwitchLabels = switchLabels;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitSwitchSection(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[SwitchSection SwitchLabels={0}]", GetCollectionString(SwitchLabels));
+ }
+ }
+
+ public class SwitchStatement : Statement {
+
+ Expression switchExpression;
+
+ List<SwitchSection> switchSections;
+
+ public Expression SwitchExpression {
+ get {
+ return switchExpression;
+ }
+ set {
+ switchExpression = value ?? Expression.Null;
+ if (!switchExpression.IsNull) switchExpression.Parent = this;
+ }
+ }
+
+ public List<SwitchSection> SwitchSections {
+ get {
+ return switchSections;
+ }
+ set {
+ switchSections = value ?? new List<SwitchSection>();
+ }
+ }
+
+ public SwitchStatement(Expression switchExpression, List<SwitchSection> switchSections) {
+ SwitchExpression = switchExpression;
+ SwitchSections = switchSections;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitSwitchStatement(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[SwitchStatement SwitchExpression={0} SwitchSections={1}]", SwitchExpression, GetCollectionString(SwitchSections));
+ }
+ }
+
+ public class TemplateDefinition : AttributedNode {
+
+ string name;
+
+ List<TypeReference> bases;
+
+ public string Name {
+ get {
+ return name;
+ }
+ set {
+ name = string.IsNullOrEmpty(value) ? "?" : value;
+ }
+ }
+
+ public List<TypeReference> Bases {
+ get {
+ return bases;
+ }
+ set {
+ bases = value ?? new List<TypeReference>();
+ }
+ }
+
+ public TemplateDefinition(string name, List<AttributeSection> attributes) {
+ Name = name;
+ Attributes = attributes;
+ bases = new List<TypeReference>();
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitTemplateDefinition(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[TemplateDefinition Name={0} Bases={1} Attributes={2} Modifier={3}]", Name, GetCollectionString(Bases), GetCollectionString(Attributes), Modifier);
+ }
+ }
+
+ public class ThisReferenceExpression : Expression {
+
+ public ThisReferenceExpression() {
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitThisReferenceExpression(this, data);
+ }
+
+ public override string ToString() {
+ return "[ThisReferenceExpression]";
+ }
+ }
+
+ public class ThrowStatement : Statement {
+
+ Expression expression;
+
+ public Expression Expression {
+ get {
+ return expression;
+ }
+ set {
+ expression = value ?? Expression.Null;
+ if (!expression.IsNull) expression.Parent = this;
+ }
+ }
+
+ public ThrowStatement(Expression expression) {
+ Expression = expression;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitThrowStatement(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[ThrowStatement Expression={0}]", Expression);
+ }
+ }
+
+ public class TryCatchStatement : Statement {
+
+ Statement statementBlock;
+
+ List<CatchClause> catchClauses;
+
+ Statement finallyBlock;
+
+ public Statement StatementBlock {
+ get {
+ return statementBlock;
+ }
+ set {
+ statementBlock = value ?? Statement.Null;
+ if (!statementBlock.IsNull) statementBlock.Parent = this;
+ }
+ }
+
+ public List<CatchClause> CatchClauses {
+ get {
+ return catchClauses;
+ }
+ set {
+ catchClauses = value ?? new List<CatchClause>();
+ }
+ }
+
+ public Statement FinallyBlock {
+ get {
+ return finallyBlock;
+ }
+ set {
+ finallyBlock = value ?? Statement.Null;
+ if (!finallyBlock.IsNull) finallyBlock.Parent = this;
+ }
+ }
+
+ public TryCatchStatement(Statement statementBlock, List<CatchClause> catchClauses, Statement finallyBlock) {
+ StatementBlock = statementBlock;
+ CatchClauses = catchClauses;
+ FinallyBlock = finallyBlock;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitTryCatchStatement(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[TryCatchStatement StatementBlock={0} CatchClauses={1} FinallyBlock={2}]", StatementBlock, GetCollectionString(CatchClauses), FinallyBlock);
+ }
+ }
+
+ public class TypeDeclaration : AttributedNode {
+
+ string name;
+
+ ClassType type;
+
+ List<TypeReference> baseTypes;
+
+ List<TemplateDefinition> templates;
+
+ Location bodyStartLocation;
+
+ public string Name {
+ get {
+ return name;
+ }
+ set {
+ name = value ?? "";
+ }
+ }
+
+ public ClassType Type {
+ get {
+ return type;
+ }
+ set {
+ type = value;
+ }
+ }
+
+ public List<TypeReference> BaseTypes {
+ get {
+ return baseTypes;
+ }
+ set {
+ baseTypes = value ?? new List<TypeReference>();
+ }
+ }
+
+ public List<TemplateDefinition> Templates {
+ get {
+ return templates;
+ }
+ set {
+ templates = value ?? new List<TemplateDefinition>();
+ }
+ }
+
+ public Location BodyStartLocation {
+ get {
+ return bodyStartLocation;
+ }
+ set {
+ bodyStartLocation = value;
+ }
+ }
+
+ public TypeDeclaration(Modifiers modifier, List<AttributeSection> attributes) {
+ Modifier = modifier;
+ Attributes = attributes;
+ name = "";
+ baseTypes = new List<TypeReference>();
+ templates = new List<TemplateDefinition>();
+ bodyStartLocation = Location.Empty;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitTypeDeclaration(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[TypeDeclaration Name={0} Type={1} BaseTypes={2} Templates={3} BodyStartLocation=" +
+ "{4} Attributes={5} Modifier={6}]", Name, Type, GetCollectionString(BaseTypes), GetCollectionString(Templates), BodyStartLocation, GetCollectionString(Attributes), Modifier);
+ }
+ }
+
+ public class TypeOfExpression : Expression {
+
+ TypeReference typeReference;
+
+ public TypeReference TypeReference {
+ get {
+ return typeReference;
+ }
+ set {
+ typeReference = value ?? TypeReference.Null;
+ if (!typeReference.IsNull) typeReference.Parent = this;
+ }
+ }
+
+ public TypeOfExpression(TypeReference typeReference) {
+ TypeReference = typeReference;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitTypeOfExpression(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[TypeOfExpression TypeReference={0}]", TypeReference);
+ }
+ }
+
+ public class TypeOfIsExpression : Expression {
+
+ Expression expression;
+
+ TypeReference typeReference;
+
+ public Expression Expression {
+ get {
+ return expression;
+ }
+ set {
+ expression = value ?? Expression.Null;
+ if (!expression.IsNull) expression.Parent = this;
+ }
+ }
+
+ public TypeReference TypeReference {
+ get {
+ return typeReference;
+ }
+ set {
+ typeReference = value ?? TypeReference.Null;
+ if (!typeReference.IsNull) typeReference.Parent = this;
+ }
+ }
+
+ public TypeOfIsExpression(Expression expression, TypeReference typeReference) {
+ Expression = expression;
+ TypeReference = typeReference;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitTypeOfIsExpression(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[TypeOfIsExpression Expression={0} TypeReference={1}]", Expression, TypeReference);
+ }
+ }
+
+ public class TypeReferenceExpression : Expression {
+
+ TypeReference typeReference;
+
+ public TypeReference TypeReference {
+ get {
+ return typeReference;
+ }
+ set {
+ typeReference = value ?? TypeReference.Null;
+ if (!typeReference.IsNull) typeReference.Parent = this;
+ }
+ }
+
+ public TypeReferenceExpression(TypeReference typeReference) {
+ TypeReference = typeReference;
+ }
+
+[Obsolete] public TypeReferenceExpression(string typeName) : this(new TypeReference(typeName)) {}
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitTypeReferenceExpression(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[TypeReferenceExpression TypeReference={0}]", TypeReference);
+ }
+ }
+
+ public class UnaryOperatorExpression : Expression {
+
+ UnaryOperatorType op;
+
+ Expression expression;
+
+ public UnaryOperatorType Op {
+ get {
+ return op;
+ }
+ set {
+ op = value;
+ }
+ }
+
+ public Expression Expression {
+ get {
+ return expression;
+ }
+ set {
+ expression = value ?? Expression.Null;
+ if (!expression.IsNull) expression.Parent = this;
+ }
+ }
+
+ public UnaryOperatorExpression(UnaryOperatorType op) {
+ Op = op;
+ expression = Expression.Null;
+ }
+
+ public UnaryOperatorExpression(Expression expression, UnaryOperatorType op) {
+ Expression = expression;
+ Op = op;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitUnaryOperatorExpression(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[UnaryOperatorExpression Op={0} Expression={1}]", Op, Expression);
+ }
+ }
+
+ public class UncheckedExpression : Expression {
+
+ Expression expression;
+
+ public Expression Expression {
+ get {
+ return expression;
+ }
+ set {
+ expression = value ?? Expression.Null;
+ if (!expression.IsNull) expression.Parent = this;
+ }
+ }
+
+ public UncheckedExpression(Expression expression) {
+ Expression = expression;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitUncheckedExpression(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[UncheckedExpression Expression={0}]", Expression);
+ }
+ }
+
+ public class UncheckedStatement : Statement {
+
+ Statement block;
+
+ public Statement Block {
+ get {
+ return block;
+ }
+ set {
+ block = value ?? Statement.Null;
+ if (!block.IsNull) block.Parent = this;
+ }
+ }
+
+ public UncheckedStatement(Statement block) {
+ Block = block;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitUncheckedStatement(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[UncheckedStatement Block={0}]", Block);
+ }
+ }
+
+ public class UnsafeStatement : Statement {
+
+ Statement block;
+
+ public Statement Block {
+ get {
+ return block;
+ }
+ set {
+ block = value ?? Statement.Null;
+ if (!block.IsNull) block.Parent = this;
+ }
+ }
+
+ public UnsafeStatement(Statement block) {
+ Block = block;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitUnsafeStatement(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[UnsafeStatement Block={0}]", Block);
+ }
+ }
+
+ public class Using : AbstractNode {
+
+ string name;
+
+ TypeReference alias;
+
+ public string Name {
+ get {
+ return name;
+ }
+ set {
+ name = string.IsNullOrEmpty(value) ? "?" : value;
+ }
+ }
+
+ public TypeReference Alias {
+ get {
+ return alias;
+ }
+ set {
+ alias = value ?? TypeReference.Null;
+ if (!alias.IsNull) alias.Parent = this;
+ }
+ }
+
+ public Using(string name) {
+ Name = name;
+ alias = TypeReference.Null;
+ }
+
+ public Using(string name, TypeReference alias) {
+ Name = name;
+ Alias = alias;
+ }
+
+ public bool IsAlias {
+ get {
+ return !alias.IsNull;
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitUsing(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[Using Name={0} Alias={1}]", Name, Alias);
+ }
+ }
+
+ public class UsingDeclaration : AbstractNode {
+
+ List<Using> usings;
+
+ public List<Using> Usings {
+ get {
+ return usings;
+ }
+ set {
+ usings = value ?? new List<Using>();
+ }
+ }
+
+ public UsingDeclaration(List<Using> usings) {
+ Usings = usings;
+ }
+
+public UsingDeclaration(string @namespace) : this(@namespace, null) {}
+
+public UsingDeclaration(string @namespace, TypeReference alias) { usings = new List<Using>(1); usings.Add(new Using(@namespace, alias)); }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitUsingDeclaration(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[UsingDeclaration Usings={0}]", GetCollectionString(Usings));
+ }
+ }
+
+ public class UsingStatement : StatementWithEmbeddedStatement {
+
+ Statement resourceAcquisition;
+
+ public Statement ResourceAcquisition {
+ get {
+ return resourceAcquisition;
+ }
+ set {
+ resourceAcquisition = value ?? Statement.Null;
+ if (!resourceAcquisition.IsNull) resourceAcquisition.Parent = this;
+ }
+ }
+
+ public UsingStatement(Statement resourceAcquisition, Statement embeddedStatement) {
+ ResourceAcquisition = resourceAcquisition;
+ EmbeddedStatement = embeddedStatement;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitUsingStatement(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[UsingStatement ResourceAcquisition={0} EmbeddedStatement={1}]", ResourceAcquisition, EmbeddedStatement);
+ }
+ }
+
+ public class VariableDeclaration : AbstractNode {
+
+ string name;
+
+ Expression initializer;
+
+ TypeReference typeReference;
+
+ Expression fixedArrayInitialization;
+
+ public string Name {
+ get {
+ return name;
+ }
+ set {
+ name = value ?? "";
+ }
+ }
+
+ public Expression Initializer {
+ get {
+ return initializer;
+ }
+ set {
+ initializer = value ?? Expression.Null;
+ if (!initializer.IsNull) initializer.Parent = this;
+ }
+ }
+
+ public TypeReference TypeReference {
+ get {
+ return typeReference;
+ }
+ set {
+ typeReference = value ?? TypeReference.Null;
+ if (!typeReference.IsNull) typeReference.Parent = this;
+ }
+ }
+
+ public Expression FixedArrayInitialization {
+ get {
+ return fixedArrayInitialization;
+ }
+ set {
+ fixedArrayInitialization = value ?? Expression.Null;
+ if (!fixedArrayInitialization.IsNull) fixedArrayInitialization.Parent = this;
+ }
+ }
+
+ public VariableDeclaration(string name) {
+ Name = name;
+ initializer = Expression.Null;
+ typeReference = TypeReference.Null;
+ fixedArrayInitialization = Expression.Null;
+ }
+
+ public VariableDeclaration(string name, Expression initializer) {
+ Name = name;
+ Initializer = initializer;
+ typeReference = TypeReference.Null;
+ fixedArrayInitialization = Expression.Null;
+ }
+
+ public VariableDeclaration(string name, Expression initializer, TypeReference typeReference) {
+ Name = name;
+ Initializer = initializer;
+ TypeReference = typeReference;
+ fixedArrayInitialization = Expression.Null;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitVariableDeclaration(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[VariableDeclaration Name={0} Initializer={1} TypeReference={2} FixedArrayInitial" +
+ "ization={3}]", Name, Initializer, TypeReference, FixedArrayInitialization);
+ }
+ }
+
+ public class WithStatement : Statement {
+
+ Expression expression;
+
+ BlockStatement body;
+
+ public Expression Expression {
+ get {
+ return expression;
+ }
+ set {
+ expression = value ?? Expression.Null;
+ if (!expression.IsNull) expression.Parent = this;
+ }
+ }
+
+ public BlockStatement Body {
+ get {
+ return body;
+ }
+ set {
+ body = value ?? BlockStatement.Null;
+ if (!body.IsNull) body.Parent = this;
+ }
+ }
+
+ public WithStatement(Expression expression) {
+ Expression = expression;
+ body = BlockStatement.Null;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitWithStatement(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[WithStatement Expression={0} Body={1}]", Expression, Body);
+ }
+ }
+
+ public class YieldStatement : Statement {
+
+ Statement statement;
+
+ public Statement Statement {
+ get {
+ return statement;
+ }
+ set {
+ statement = value ?? Statement.Null;
+ if (!statement.IsNull) statement.Parent = this;
+ }
+ }
+
+ public YieldStatement(Statement statement) {
+ Statement = statement;
+ }
+
+ public bool IsYieldBreak {
+ get {
+ return statement is BreakStatement;
+ }
+ }
+
+ public bool IsYieldReturn {
+ get {
+ return statement is ReturnStatement;
+ }
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data) {
+ return visitor.VisitYieldStatement(this, data);
+ }
+
+ public override string ToString() {
+ return string.Format("[YieldStatement Statement={0}]", Statement);
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Ast/INode.cs b/main/contrib/NRefactory/Project/Src/Ast/INode.cs
index 860d8e5988..92d5ef04a0 100644
--- a/main/contrib/NRefactory/Project/Src/Ast/INode.cs
+++ b/main/contrib/NRefactory/Project/Src/Ast/INode.cs
@@ -1,55 +1,55 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 2708 $</version>
-// </file>
-
-using System;
-using System.Collections.Generic;
-
-namespace ICSharpCode.NRefactory.Ast
-{
- public interface INode
- {
- INode Parent {
- get;
- set;
- }
-
- List<INode> Children {
- get;
- }
-
- Location StartLocation {
- get;
- set;
- }
-
- Location EndLocation {
- get;
- set;
- }
-
- object UserData {
- get;
- set;
- }
-
- /// <summary>
- /// Visits all children
- /// </summary>
- /// <param name="visitor">The visitor to accept</param>
- /// <param name="data">Additional data for the visitor</param>
- /// <returns>The paremeter <paramref name="data"/></returns>
- object AcceptChildren(IAstVisitor visitor, object data);
-
- /// <summary>
- /// Accept the visitor
- /// </summary>
- /// <param name="visitor">The visitor to accept</param>
- /// <param name="data">Additional data for the visitor</param>
- /// <returns>The value the visitor returns after the visit</returns>
- object AcceptVisitor(IAstVisitor visitor, object data);
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+using System.Collections.Generic;
+
+namespace ICSharpCode.NRefactory.Ast
+{
+ public interface INode
+ {
+ INode Parent {
+ get;
+ set;
+ }
+
+ List<INode> Children {
+ get;
+ }
+
+ Location StartLocation {
+ get;
+ set;
+ }
+
+ Location EndLocation {
+ get;
+ set;
+ }
+
+ object UserData {
+ get;
+ set;
+ }
+
+ /// <summary>
+ /// Visits all children
+ /// </summary>
+ /// <param name="visitor">The visitor to accept</param>
+ /// <param name="data">Additional data for the visitor</param>
+ /// <returns>The paremeter <paramref name="data"/></returns>
+ object AcceptChildren(IAstVisitor visitor, object data);
+
+ /// <summary>
+ /// Accept the visitor
+ /// </summary>
+ /// <param name="visitor">The visitor to accept</param>
+ /// <param name="data">Additional data for the visitor</param>
+ /// <returns>The value the visitor returns after the visit</returns>
+ object AcceptVisitor(IAstVisitor visitor, object data);
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Ast/INullable.cs b/main/contrib/NRefactory/Project/Src/Ast/INullable.cs
index d591c1a776..7111803490 100644
--- a/main/contrib/NRefactory/Project/Src/Ast/INullable.cs
+++ b/main/contrib/NRefactory/Project/Src/Ast/INullable.cs
@@ -1,16 +1,16 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Andrea Paatz" email="andrea@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-namespace ICSharpCode.NRefactory.Ast
-{
- public interface INullable
- {
- bool IsNull {
- get;
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Andrea Paatz" email="andrea@icsharpcode.net"/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+namespace ICSharpCode.NRefactory.Ast
+{
+ public interface INullable
+ {
+ bool IsNull {
+ get;
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Ast/TypeReference.cs b/main/contrib/NRefactory/Project/Src/Ast/TypeReference.cs
index 42ffc88cbe..8d9100c4e6 100644
--- a/main/contrib/NRefactory/Project/Src/Ast/TypeReference.cs
+++ b/main/contrib/NRefactory/Project/Src/Ast/TypeReference.cs
@@ -1,445 +1,445 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 3787 $</version>
-// </file>
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Globalization;
-using System.Runtime.InteropServices;
-using System.Text;
-
-namespace ICSharpCode.NRefactory.Ast
-{
- public class TypeReference : AbstractNode, INullable, ICloneable
- {
- public static readonly TypeReference StructConstraint = new TypeReference("constraint: struct");
- public static readonly TypeReference ClassConstraint = new TypeReference("constraint: class");
- public static readonly TypeReference NewConstraint = new TypeReference("constraint: new");
-
- string type = "";
- int pointerNestingLevel;
- int[] rankSpecifier;
- List<TypeReference> genericTypes = new List<TypeReference>();
-
- #region Static primitive type list
- static Dictionary<string, string> types = new Dictionary<string, string>();
- static Dictionary<string, string> vbtypes = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);
- static Dictionary<string, string> typesReverse = new Dictionary<string, string>();
- static Dictionary<string, string> vbtypesReverse = new Dictionary<string, string>();
-
- static TypeReference()
- {
- // C# types
- types.Add("bool", "System.Boolean");
- types.Add("byte", "System.Byte");
- types.Add("char", "System.Char");
- types.Add("decimal", "System.Decimal");
- types.Add("double", "System.Double");
- types.Add("float", "System.Single");
- types.Add("int", "System.Int32");
- types.Add("long", "System.Int64");
- types.Add("object", "System.Object");
- types.Add("sbyte", "System.SByte");
- types.Add("short", "System.Int16");
- types.Add("string", "System.String");
- types.Add("uint", "System.UInt32");
- types.Add("ulong", "System.UInt64");
- types.Add("ushort", "System.UInt16");
- types.Add("void", "System.Void");
-
- // VB.NET types
- vbtypes.Add("Boolean", "System.Boolean");
- vbtypes.Add("Byte", "System.Byte");
- vbtypes.Add("SByte", "System.SByte");
- vbtypes.Add("Date", "System.DateTime");
- vbtypes.Add("Char", "System.Char");
- vbtypes.Add("Decimal", "System.Decimal");
- vbtypes.Add("Double", "System.Double");
- vbtypes.Add("Single", "System.Single");
- vbtypes.Add("Integer", "System.Int32");
- vbtypes.Add("Long", "System.Int64");
- vbtypes.Add("UInteger","System.UInt32");
- vbtypes.Add("ULong", "System.UInt64");
- vbtypes.Add("Object", "System.Object");
- vbtypes.Add("Short", "System.Int16");
- vbtypes.Add("UShort", "System.UInt16");
- vbtypes.Add("String", "System.String");
-
- foreach (KeyValuePair<string, string> pair in types) {
- typesReverse.Add(pair.Value, pair.Key);
- }
- foreach (KeyValuePair<string, string> pair in vbtypes) {
- vbtypesReverse.Add(pair.Value, pair.Key);
- }
- }
-
- /// <summary>
- /// Gets a shortname=>full name dictionary of C# types.
- /// </summary>
- public static IDictionary<string, string> PrimitiveTypesCSharp {
- get { return types; }
- }
-
- /// <summary>
- /// Gets a shortname=>full name dictionary of VB types.
- /// </summary>
- public static IDictionary<string, string> PrimitiveTypesVB {
- get { return vbtypes; }
- }
-
- /// <summary>
- /// Gets a full name=>shortname dictionary of C# types.
- /// </summary>
- public static IDictionary<string, string> PrimitiveTypesCSharpReverse {
- get { return typesReverse; }
- }
-
- /// <summary>
- /// Gets a full name=>shortname dictionary of VB types.
- /// </summary>
- public static IDictionary<string, string> PrimitiveTypesVBReverse {
- get { return vbtypesReverse; }
- }
-
-
- static string GetSystemType(string type)
- {
- if (types == null) return type;
-
- string systemType;
- if (types.TryGetValue(type, out systemType)) {
- return systemType;
- }
- if (vbtypes.TryGetValue(type, out systemType)) {
- return systemType;
- }
- return type;
- }
- #endregion
-
- object ICloneable.Clone()
- {
- return this.Clone();
- }
-
- public virtual TypeReference Clone()
- {
- TypeReference c = new TypeReference(type);
- CopyFields(this, c);
- return c;
- }
-
- /// <summary>
- /// Copies the pointerNestingLevel, RankSpecifier, GenericTypes and IsGlobal flag
- /// from <paramref name="from"/> to <paramref name="to"/>.
- /// </summary>
- /// <remarks>
- /// If <paramref name="to"/> already contains generics, the new generics are appended to the list.
- /// </remarks>
- protected static void CopyFields(TypeReference from, TypeReference to)
- {
- to.pointerNestingLevel = from.pointerNestingLevel;
- if (from.rankSpecifier != null) {
- to.rankSpecifier = (int[])from.rankSpecifier.Clone();
- }
- foreach (TypeReference r in from.genericTypes) {
- to.genericTypes.Add(r.Clone());
- }
- to.IsGlobal = from.IsGlobal;
- to.IsKeyword = from.IsKeyword;
- }
-
- public string Type {
- get {
- return type;
- }
- set {
- Debug.Assert(value != null);
- type = value ?? "?";
- }
- }
-
- /// <summary>
- /// Removes the last identifier from the type.
- /// e.g. "System.String.Length" becomes "System.String" or
- /// "System.Collections.IEnumerable(of string).Current" becomes "System.Collections.IEnumerable(of string)"
- /// This is used for explicit interface implementation in VB.
- /// </summary>
- public static string StripLastIdentifierFromType(ref TypeReference tr)
- {
- if (tr is InnerClassTypeReference && ((InnerClassTypeReference)tr).Type.IndexOf('.') < 0) {
- string ident = ((InnerClassTypeReference)tr).Type;
- tr = ((InnerClassTypeReference)tr).BaseType;
- return ident;
- } else {
- int pos = tr.Type.LastIndexOf('.');
- if (pos < 0)
- return tr.Type;
- string ident = tr.Type.Substring(pos + 1);
- tr.Type = tr.Type.Substring(0, pos);
- return ident;
- }
- }
-
- [Obsolete("Use 'Type' instead - it now contains the SystemType for primitive types.")]
- public string SystemType {
- get {
- return this.Type;
- }
- }
-
- public int PointerNestingLevel {
- get {
- return pointerNestingLevel;
- }
- set {
- Debug.Assert(this.IsNull == false);
- pointerNestingLevel = value;
- }
- }
-
- /// <summary>
- /// The rank of the array type.
- /// For "object[]", this is { 0 }; for "object[,]", it is {1}.
- /// For "object[,][,,][]", it is {1, 2, 0}.
- /// For non-array types, this property is null or {}.
- /// </summary>
- public int[] RankSpecifier {
- get {
- return rankSpecifier;
- }
- set {
- Debug.Assert(this.IsNull == false);
- rankSpecifier = value;
- }
- }
-
- public List<TypeReference> GenericTypes {
- get {
- return genericTypes;
- }
- }
-
- public bool IsArrayType {
- get {
- return rankSpecifier != null && rankSpecifier.Length > 0;
- }
- }
-
- public static TypeReference CheckNull(TypeReference typeReference)
- {
- return typeReference ?? NullTypeReference.Instance;
- }
-
- public static TypeReference Null {
- get {
- return NullTypeReference.Instance;
- }
- }
-
- public virtual bool IsNull {
- get {
- return false;
- }
- }
-
- /// <summary>
- /// Gets/Sets if the type reference had a "global::" prefix.
- /// </summary>
- public bool IsGlobal {
- get; set;
- }
-
- /// <summary>
- /// Gets/Sets if the type reference was using a language keyword.
- /// </summary>
- public bool IsKeyword {
- get; set;
- }
-
- public TypeReference(string type)
- {
- this.Type = type;
- }
-
- [Obsolete("Type and SystemType are no longer distinguished - use the (string type, bool isKeyword) constructor instead!")]
- public TypeReference(string type, string systemType)
- {
- this.Type = systemType;
- this.IsKeyword = type != systemType;
- }
-
- public TypeReference(string type, bool isKeyword)
- {
- this.Type = type;
- this.IsKeyword = isKeyword;
- }
-
- public TypeReference(string type, List<TypeReference> genericTypes) : this(type)
- {
- if (genericTypes != null) {
- this.genericTypes = genericTypes;
- }
- }
-
- public TypeReference(string type, int[] rankSpecifier) : this(type, 0, rankSpecifier)
- {
- }
-
- public TypeReference(string type, int pointerNestingLevel, int[] rankSpecifier) : this(type, pointerNestingLevel, rankSpecifier, null)
- {
- }
-
- public TypeReference(string type, int pointerNestingLevel, int[] rankSpecifier, List<TypeReference> genericTypes)
- {
- Debug.Assert(type != null);
- this.type = type;
- this.pointerNestingLevel = pointerNestingLevel;
- this.rankSpecifier = rankSpecifier;
- if (genericTypes != null) {
- this.genericTypes = genericTypes;
- }
- }
-
- protected TypeReference()
- {}
-
- public override object AcceptVisitor(IAstVisitor visitor, object data)
- {
- return visitor.VisitTypeReference(this, data);
- }
-
- public override string ToString()
- {
- StringBuilder b = new StringBuilder(type);
- if (genericTypes != null && genericTypes.Count > 0) {
- b.Append('<');
- for (int i = 0; i < genericTypes.Count; i++) {
- if (i > 0) b.Append(',');
- b.Append(genericTypes[i].ToString());
- }
- b.Append('>');
- }
- if (pointerNestingLevel > 0) {
- b.Append('*', pointerNestingLevel);
- }
- if (IsArrayType) {
- foreach (int rank in rankSpecifier) {
- b.Append('[');
- if (rank < 0)
- b.Append('`', -rank);
- else
- b.Append(',', rank);
- b.Append(']');
- }
- }
- return b.ToString();
- }
-
- public static bool AreEqualReferences(TypeReference a, TypeReference b)
- {
- if (a == b) return true;
- if (a == null || b == null) return false;
- if (a is InnerClassTypeReference) a = ((InnerClassTypeReference)a).CombineToNormalTypeReference();
- if (b is InnerClassTypeReference) b = ((InnerClassTypeReference)b).CombineToNormalTypeReference();
- if (a.type != b.type) return false;
- if (a.IsKeyword != b.IsKeyword) return false;
- if (a.IsGlobal != b.IsGlobal) return false;
- if (a.pointerNestingLevel != b.pointerNestingLevel) return false;
- if (a.IsArrayType != b.IsArrayType) return false;
- if (a.IsArrayType) {
- if (a.rankSpecifier.Length != b.rankSpecifier.Length) return false;
- for (int i = 0; i < a.rankSpecifier.Length; i++) {
- if (a.rankSpecifier[i] != b.rankSpecifier[i]) return false;
- }
- }
- if (a.genericTypes.Count != b.genericTypes.Count) return false;
- for (int i = 0; i < a.genericTypes.Count; i++) {
- if (!AreEqualReferences(a.genericTypes[i], b.genericTypes[i]))
- return false;
- }
- return true;
- }
- }
-
- internal sealed class NullTypeReference : TypeReference
- {
- public static readonly NullTypeReference Instance = new NullTypeReference();
- public override bool IsNull {
- get {
- return true;
- }
- }
- public override TypeReference Clone()
- {
- return this;
- }
- public override object AcceptVisitor(IAstVisitor visitor, object data)
- {
- return null;
- }
-
- public override string ToString()
- {
- return String.Format("[NullTypeReference]");
- }
- }
-
- /// <summary>
- /// We need this special type reference for cases like
- /// OuterClass(Of T1).InnerClass(Of T2) (in expression or type context)
- /// or Dictionary(Of String, NamespaceStruct).KeyCollection (in type context, otherwise it's a
- /// MemberReferenceExpression)
- /// </summary>
- public class InnerClassTypeReference: TypeReference
- {
- TypeReference baseType;
-
- public TypeReference BaseType {
- get { return baseType; }
- set { baseType = value; }
- }
-
- public override TypeReference Clone()
- {
- InnerClassTypeReference c = new InnerClassTypeReference(baseType.Clone(), Type, new List<TypeReference>());
- CopyFields(this, c);
- return c;
- }
-
- public InnerClassTypeReference(TypeReference outerClass, string innerType, List<TypeReference> innerGenericTypes)
- : base(innerType, innerGenericTypes)
- {
- this.baseType = outerClass;
- }
-
- public override object AcceptVisitor(IAstVisitor visitor, object data)
- {
- return visitor.VisitInnerClassTypeReference(this, data);
- }
-
- /// <summary>
- /// Creates a type reference where all type parameters are specified for the innermost class.
- /// Namespace.OuterClass(of string).InnerClass(of integer).InnerInnerClass
- /// becomes Namespace.OuterClass.InnerClass.InnerInnerClass(of string, integer)
- /// </summary>
- public TypeReference CombineToNormalTypeReference()
- {
- TypeReference tr = (baseType is InnerClassTypeReference)
- ? ((InnerClassTypeReference)baseType).CombineToNormalTypeReference()
- : baseType.Clone();
- CopyFields(this, tr);
- tr.Type += "." + Type;
- return tr;
- }
-
- public override string ToString()
- {
- return "[InnerClassTypeReference: (" + baseType.ToString() + ")." + base.ToString() + "]";
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Globalization;
+using System.Runtime.InteropServices;
+using System.Text;
+
+namespace ICSharpCode.NRefactory.Ast
+{
+ public class TypeReference : AbstractNode, INullable, ICloneable
+ {
+ public static readonly TypeReference StructConstraint = new TypeReference("constraint: struct");
+ public static readonly TypeReference ClassConstraint = new TypeReference("constraint: class");
+ public static readonly TypeReference NewConstraint = new TypeReference("constraint: new");
+
+ string type = "";
+ int pointerNestingLevel;
+ int[] rankSpecifier;
+ List<TypeReference> genericTypes = new List<TypeReference>();
+
+ #region Static primitive type list
+ static Dictionary<string, string> types = new Dictionary<string, string>();
+ static Dictionary<string, string> vbtypes = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);
+ static Dictionary<string, string> typesReverse = new Dictionary<string, string>();
+ static Dictionary<string, string> vbtypesReverse = new Dictionary<string, string>();
+
+ static TypeReference()
+ {
+ // C# types
+ types.Add("bool", "System.Boolean");
+ types.Add("byte", "System.Byte");
+ types.Add("char", "System.Char");
+ types.Add("decimal", "System.Decimal");
+ types.Add("double", "System.Double");
+ types.Add("float", "System.Single");
+ types.Add("int", "System.Int32");
+ types.Add("long", "System.Int64");
+ types.Add("object", "System.Object");
+ types.Add("sbyte", "System.SByte");
+ types.Add("short", "System.Int16");
+ types.Add("string", "System.String");
+ types.Add("uint", "System.UInt32");
+ types.Add("ulong", "System.UInt64");
+ types.Add("ushort", "System.UInt16");
+ types.Add("void", "System.Void");
+
+ // VB.NET types
+ vbtypes.Add("Boolean", "System.Boolean");
+ vbtypes.Add("Byte", "System.Byte");
+ vbtypes.Add("SByte", "System.SByte");
+ vbtypes.Add("Date", "System.DateTime");
+ vbtypes.Add("Char", "System.Char");
+ vbtypes.Add("Decimal", "System.Decimal");
+ vbtypes.Add("Double", "System.Double");
+ vbtypes.Add("Single", "System.Single");
+ vbtypes.Add("Integer", "System.Int32");
+ vbtypes.Add("Long", "System.Int64");
+ vbtypes.Add("UInteger","System.UInt32");
+ vbtypes.Add("ULong", "System.UInt64");
+ vbtypes.Add("Object", "System.Object");
+ vbtypes.Add("Short", "System.Int16");
+ vbtypes.Add("UShort", "System.UInt16");
+ vbtypes.Add("String", "System.String");
+
+ foreach (KeyValuePair<string, string> pair in types) {
+ typesReverse.Add(pair.Value, pair.Key);
+ }
+ foreach (KeyValuePair<string, string> pair in vbtypes) {
+ vbtypesReverse.Add(pair.Value, pair.Key);
+ }
+ }
+
+ /// <summary>
+ /// Gets a shortname=>full name dictionary of C# types.
+ /// </summary>
+ public static IDictionary<string, string> PrimitiveTypesCSharp {
+ get { return types; }
+ }
+
+ /// <summary>
+ /// Gets a shortname=>full name dictionary of VB types.
+ /// </summary>
+ public static IDictionary<string, string> PrimitiveTypesVB {
+ get { return vbtypes; }
+ }
+
+ /// <summary>
+ /// Gets a full name=>shortname dictionary of C# types.
+ /// </summary>
+ public static IDictionary<string, string> PrimitiveTypesCSharpReverse {
+ get { return typesReverse; }
+ }
+
+ /// <summary>
+ /// Gets a full name=>shortname dictionary of VB types.
+ /// </summary>
+ public static IDictionary<string, string> PrimitiveTypesVBReverse {
+ get { return vbtypesReverse; }
+ }
+
+
+ static string GetSystemType(string type)
+ {
+ if (types == null) return type;
+
+ string systemType;
+ if (types.TryGetValue(type, out systemType)) {
+ return systemType;
+ }
+ if (vbtypes.TryGetValue(type, out systemType)) {
+ return systemType;
+ }
+ return type;
+ }
+ #endregion
+
+ object ICloneable.Clone()
+ {
+ return this.Clone();
+ }
+
+ public virtual TypeReference Clone()
+ {
+ TypeReference c = new TypeReference(type);
+ CopyFields(this, c);
+ return c;
+ }
+
+ /// <summary>
+ /// Copies the pointerNestingLevel, RankSpecifier, GenericTypes and IsGlobal flag
+ /// from <paramref name="from"/> to <paramref name="to"/>.
+ /// </summary>
+ /// <remarks>
+ /// If <paramref name="to"/> already contains generics, the new generics are appended to the list.
+ /// </remarks>
+ protected static void CopyFields(TypeReference from, TypeReference to)
+ {
+ to.pointerNestingLevel = from.pointerNestingLevel;
+ if (from.rankSpecifier != null) {
+ to.rankSpecifier = (int[])from.rankSpecifier.Clone();
+ }
+ foreach (TypeReference r in from.genericTypes) {
+ to.genericTypes.Add(r.Clone());
+ }
+ to.IsGlobal = from.IsGlobal;
+ to.IsKeyword = from.IsKeyword;
+ }
+
+ public string Type {
+ get {
+ return type;
+ }
+ set {
+ Debug.Assert(value != null);
+ type = value ?? "?";
+ }
+ }
+
+ /// <summary>
+ /// Removes the last identifier from the type.
+ /// e.g. "System.String.Length" becomes "System.String" or
+ /// "System.Collections.IEnumerable(of string).Current" becomes "System.Collections.IEnumerable(of string)"
+ /// This is used for explicit interface implementation in VB.
+ /// </summary>
+ public static string StripLastIdentifierFromType(ref TypeReference tr)
+ {
+ if (tr is InnerClassTypeReference && ((InnerClassTypeReference)tr).Type.IndexOf('.') < 0) {
+ string ident = ((InnerClassTypeReference)tr).Type;
+ tr = ((InnerClassTypeReference)tr).BaseType;
+ return ident;
+ } else {
+ int pos = tr.Type.LastIndexOf('.');
+ if (pos < 0)
+ return tr.Type;
+ string ident = tr.Type.Substring(pos + 1);
+ tr.Type = tr.Type.Substring(0, pos);
+ return ident;
+ }
+ }
+
+ [Obsolete("Use 'Type' instead - it now contains the SystemType for primitive types.")]
+ public string SystemType {
+ get {
+ return this.Type;
+ }
+ }
+
+ public int PointerNestingLevel {
+ get {
+ return pointerNestingLevel;
+ }
+ set {
+ Debug.Assert(this.IsNull == false);
+ pointerNestingLevel = value;
+ }
+ }
+
+ /// <summary>
+ /// The rank of the array type.
+ /// For "object[]", this is { 0 }; for "object[,]", it is {1}.
+ /// For "object[,][,,][]", it is {1, 2, 0}.
+ /// For non-array types, this property is null or {}.
+ /// </summary>
+ public int[] RankSpecifier {
+ get {
+ return rankSpecifier;
+ }
+ set {
+ Debug.Assert(this.IsNull == false);
+ rankSpecifier = value;
+ }
+ }
+
+ public List<TypeReference> GenericTypes {
+ get {
+ return genericTypes;
+ }
+ }
+
+ public bool IsArrayType {
+ get {
+ return rankSpecifier != null && rankSpecifier.Length > 0;
+ }
+ }
+
+ public static TypeReference CheckNull(TypeReference typeReference)
+ {
+ return typeReference ?? NullTypeReference.Instance;
+ }
+
+ public static TypeReference Null {
+ get {
+ return NullTypeReference.Instance;
+ }
+ }
+
+ public virtual bool IsNull {
+ get {
+ return false;
+ }
+ }
+
+ /// <summary>
+ /// Gets/Sets if the type reference had a "global::" prefix.
+ /// </summary>
+ public bool IsGlobal {
+ get; set;
+ }
+
+ /// <summary>
+ /// Gets/Sets if the type reference was using a language keyword.
+ /// </summary>
+ public bool IsKeyword {
+ get; set;
+ }
+
+ public TypeReference(string type)
+ {
+ this.Type = type;
+ }
+
+ [Obsolete("Type and SystemType are no longer distinguished - use the (string type, bool isKeyword) constructor instead!")]
+ public TypeReference(string type, string systemType)
+ {
+ this.Type = systemType;
+ this.IsKeyword = type != systemType;
+ }
+
+ public TypeReference(string type, bool isKeyword)
+ {
+ this.Type = type;
+ this.IsKeyword = isKeyword;
+ }
+
+ public TypeReference(string type, List<TypeReference> genericTypes) : this(type)
+ {
+ if (genericTypes != null) {
+ this.genericTypes = genericTypes;
+ }
+ }
+
+ public TypeReference(string type, int[] rankSpecifier) : this(type, 0, rankSpecifier)
+ {
+ }
+
+ public TypeReference(string type, int pointerNestingLevel, int[] rankSpecifier) : this(type, pointerNestingLevel, rankSpecifier, null)
+ {
+ }
+
+ public TypeReference(string type, int pointerNestingLevel, int[] rankSpecifier, List<TypeReference> genericTypes)
+ {
+ Debug.Assert(type != null);
+ this.type = type;
+ this.pointerNestingLevel = pointerNestingLevel;
+ this.rankSpecifier = rankSpecifier;
+ if (genericTypes != null) {
+ this.genericTypes = genericTypes;
+ }
+ }
+
+ protected TypeReference()
+ {}
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data)
+ {
+ return visitor.VisitTypeReference(this, data);
+ }
+
+ public override string ToString()
+ {
+ StringBuilder b = new StringBuilder(type);
+ if (genericTypes != null && genericTypes.Count > 0) {
+ b.Append('<');
+ for (int i = 0; i < genericTypes.Count; i++) {
+ if (i > 0) b.Append(',');
+ b.Append(genericTypes[i].ToString());
+ }
+ b.Append('>');
+ }
+ if (pointerNestingLevel > 0) {
+ b.Append('*', pointerNestingLevel);
+ }
+ if (IsArrayType) {
+ foreach (int rank in rankSpecifier) {
+ b.Append('[');
+ if (rank < 0)
+ b.Append('`', -rank);
+ else
+ b.Append(',', rank);
+ b.Append(']');
+ }
+ }
+ return b.ToString();
+ }
+
+ public static bool AreEqualReferences(TypeReference a, TypeReference b)
+ {
+ if (a == b) return true;
+ if (a == null || b == null) return false;
+ if (a is InnerClassTypeReference) a = ((InnerClassTypeReference)a).CombineToNormalTypeReference();
+ if (b is InnerClassTypeReference) b = ((InnerClassTypeReference)b).CombineToNormalTypeReference();
+ if (a.type != b.type) return false;
+ if (a.IsKeyword != b.IsKeyword) return false;
+ if (a.IsGlobal != b.IsGlobal) return false;
+ if (a.pointerNestingLevel != b.pointerNestingLevel) return false;
+ if (a.IsArrayType != b.IsArrayType) return false;
+ if (a.IsArrayType) {
+ if (a.rankSpecifier.Length != b.rankSpecifier.Length) return false;
+ for (int i = 0; i < a.rankSpecifier.Length; i++) {
+ if (a.rankSpecifier[i] != b.rankSpecifier[i]) return false;
+ }
+ }
+ if (a.genericTypes.Count != b.genericTypes.Count) return false;
+ for (int i = 0; i < a.genericTypes.Count; i++) {
+ if (!AreEqualReferences(a.genericTypes[i], b.genericTypes[i]))
+ return false;
+ }
+ return true;
+ }
+ }
+
+ internal sealed class NullTypeReference : TypeReference
+ {
+ public static readonly NullTypeReference Instance = new NullTypeReference();
+ public override bool IsNull {
+ get {
+ return true;
+ }
+ }
+ public override TypeReference Clone()
+ {
+ return this;
+ }
+ public override object AcceptVisitor(IAstVisitor visitor, object data)
+ {
+ return null;
+ }
+
+ public override string ToString()
+ {
+ return String.Format("[NullTypeReference]");
+ }
+ }
+
+ /// <summary>
+ /// We need this special type reference for cases like
+ /// OuterClass(Of T1).InnerClass(Of T2) (in expression or type context)
+ /// or Dictionary(Of String, NamespaceStruct).KeyCollection (in type context, otherwise it's a
+ /// MemberReferenceExpression)
+ /// </summary>
+ public class InnerClassTypeReference: TypeReference
+ {
+ TypeReference baseType;
+
+ public TypeReference BaseType {
+ get { return baseType; }
+ set { baseType = value; }
+ }
+
+ public override TypeReference Clone()
+ {
+ InnerClassTypeReference c = new InnerClassTypeReference(baseType.Clone(), Type, new List<TypeReference>());
+ CopyFields(this, c);
+ return c;
+ }
+
+ public InnerClassTypeReference(TypeReference outerClass, string innerType, List<TypeReference> innerGenericTypes)
+ : base(innerType, innerGenericTypes)
+ {
+ this.baseType = outerClass;
+ }
+
+ public override object AcceptVisitor(IAstVisitor visitor, object data)
+ {
+ return visitor.VisitInnerClassTypeReference(this, data);
+ }
+
+ /// <summary>
+ /// Creates a type reference where all type parameters are specified for the innermost class.
+ /// Namespace.OuterClass(of string).InnerClass(of integer).InnerInnerClass
+ /// becomes Namespace.OuterClass.InnerClass.InnerInnerClass(of string, integer)
+ /// </summary>
+ public TypeReference CombineToNormalTypeReference()
+ {
+ TypeReference tr = (baseType is InnerClassTypeReference)
+ ? ((InnerClassTypeReference)baseType).CombineToNormalTypeReference()
+ : baseType.Clone();
+ CopyFields(this, tr);
+ tr.Type += "." + Type;
+ return tr;
+ }
+
+ public override string ToString()
+ {
+ return "[InnerClassTypeReference: (" + baseType.ToString() + ")." + base.ToString() + "]";
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/AstBuilder/ExpressionBuilder.cs b/main/contrib/NRefactory/Project/Src/AstBuilder/ExpressionBuilder.cs
index 5c1a3dab47..e5ee5cef9b 100644
--- a/main/contrib/NRefactory/Project/Src/AstBuilder/ExpressionBuilder.cs
+++ b/main/contrib/NRefactory/Project/Src/AstBuilder/ExpressionBuilder.cs
@@ -1,98 +1,98 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <author name="Daniel Grunwald"/>
-// <version>$Revision: 3832 $</version>
-// </file>
-
-using System;
-using System.Collections.Generic;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.AstBuilder
-{
- #if NET35
- /// <summary>
- /// Extension methods for NRefactory.Ast.Expression.
- /// </summary>
- public static class ExpressionBuilder
- {
- public static IdentifierExpression Identifier(string identifier)
- {
- return new IdentifierExpression(identifier);
- }
-
- public static MemberReferenceExpression Member(this Expression targetObject, string memberName)
- {
- if (targetObject == null)
- throw new ArgumentNullException("targetObject");
- return new MemberReferenceExpression(targetObject, memberName);
- }
-
- public static InvocationExpression Call(this Expression callTarget, string methodName, params Expression[] arguments)
- {
- if (callTarget == null)
- throw new ArgumentNullException("callTarget");
- return Call(Member(callTarget, methodName), arguments);
- }
-
- public static InvocationExpression Call(this Expression callTarget, params Expression[] arguments)
- {
- if (callTarget == null)
- throw new ArgumentNullException("callTarget");
- if (arguments == null)
- throw new ArgumentNullException("arguments");
- return new InvocationExpression(callTarget, new List<Expression>(arguments));
- }
-
- public static ObjectCreateExpression New(this TypeReference createType, params Expression[] arguments)
- {
- if (createType == null)
- throw new ArgumentNullException("createType");
- if (arguments == null)
- throw new ArgumentNullException("arguments");
- return new ObjectCreateExpression(createType, new List<Expression>(arguments));
- }
-
- public static Expression CreateDefaultValueForType(TypeReference type)
- {
- if (type != null && !type.IsArrayType) {
- switch (type.Type) {
- case "System.SByte":
- case "System.Byte":
- case "System.Int16":
- case "System.UInt16":
- case "System.Int32":
- case "System.UInt32":
- case "System.Int64":
- case "System.UInt64":
- case "System.Single":
- case "System.Double":
- return new PrimitiveExpression(0, "0");
- case "System.Char":
- return new PrimitiveExpression('\0', "'\\0'");
- case "System.Object":
- case "System.String":
- return new PrimitiveExpression(null, "null");
- case "System.Boolean":
- return new PrimitiveExpression(false, "false");
- default:
- return new DefaultValueExpression(type);
- }
- } else {
- return new PrimitiveExpression(null, "null");
- }
- }
-
- /// <summary>
- /// Just calls the BinaryOperatorExpression constructor,
- /// but being an extension method; this allows for a nicer
- /// infix syntax in some cases.
- /// </summary>
- public static BinaryOperatorExpression Operator(this Expression left, BinaryOperatorType op, Expression right)
- {
- return new BinaryOperatorExpression(left, op, right);
- }
- }
- #endif
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <author name="Daniel Grunwald"/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+using System.Collections.Generic;
+using ICSharpCode.NRefactory.Ast;
+
+namespace ICSharpCode.NRefactory.AstBuilder
+{
+ #if NET35
+ /// <summary>
+ /// Extension methods for NRefactory.Ast.Expression.
+ /// </summary>
+ public static class ExpressionBuilder
+ {
+ public static IdentifierExpression Identifier(string identifier)
+ {
+ return new IdentifierExpression(identifier);
+ }
+
+ public static MemberReferenceExpression Member(this Expression targetObject, string memberName)
+ {
+ if (targetObject == null)
+ throw new ArgumentNullException("targetObject");
+ return new MemberReferenceExpression(targetObject, memberName);
+ }
+
+ public static InvocationExpression Call(this Expression callTarget, string methodName, params Expression[] arguments)
+ {
+ if (callTarget == null)
+ throw new ArgumentNullException("callTarget");
+ return Call(Member(callTarget, methodName), arguments);
+ }
+
+ public static InvocationExpression Call(this Expression callTarget, params Expression[] arguments)
+ {
+ if (callTarget == null)
+ throw new ArgumentNullException("callTarget");
+ if (arguments == null)
+ throw new ArgumentNullException("arguments");
+ return new InvocationExpression(callTarget, new List<Expression>(arguments));
+ }
+
+ public static ObjectCreateExpression New(this TypeReference createType, params Expression[] arguments)
+ {
+ if (createType == null)
+ throw new ArgumentNullException("createType");
+ if (arguments == null)
+ throw new ArgumentNullException("arguments");
+ return new ObjectCreateExpression(createType, new List<Expression>(arguments));
+ }
+
+ public static Expression CreateDefaultValueForType(TypeReference type)
+ {
+ if (type != null && !type.IsArrayType) {
+ switch (type.Type) {
+ case "System.SByte":
+ case "System.Byte":
+ case "System.Int16":
+ case "System.UInt16":
+ case "System.Int32":
+ case "System.UInt32":
+ case "System.Int64":
+ case "System.UInt64":
+ case "System.Single":
+ case "System.Double":
+ return new PrimitiveExpression(0, "0");
+ case "System.Char":
+ return new PrimitiveExpression('\0', "'\\0'");
+ case "System.Object":
+ case "System.String":
+ return new PrimitiveExpression(null, "null");
+ case "System.Boolean":
+ return new PrimitiveExpression(false, "false");
+ default:
+ return new DefaultValueExpression(type);
+ }
+ } else {
+ return new PrimitiveExpression(null, "null");
+ }
+ }
+
+ /// <summary>
+ /// Just calls the BinaryOperatorExpression constructor,
+ /// but being an extension method; this allows for a nicer
+ /// infix syntax in some cases.
+ /// </summary>
+ public static BinaryOperatorExpression Operator(this Expression left, BinaryOperatorType op, Expression right)
+ {
+ return new BinaryOperatorExpression(left, op, right);
+ }
+ }
+ #endif
+}
diff --git a/main/contrib/NRefactory/Project/Src/AstBuilder/StatementBuilder.cs b/main/contrib/NRefactory/Project/Src/AstBuilder/StatementBuilder.cs
index d580e721d1..0d0ded5c23 100644
--- a/main/contrib/NRefactory/Project/Src/AstBuilder/StatementBuilder.cs
+++ b/main/contrib/NRefactory/Project/Src/AstBuilder/StatementBuilder.cs
@@ -1,59 +1,59 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <author name="Daniel Grunwald"/>
-// <version>$Revision: 3832 $</version>
-// </file>
-
-using System;
-using System.Collections.Generic;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.AstBuilder
-{
- /// <summary>
- /// Extension methods for NRefactory.Ast.Expression.
- /// </summary>
- public static class StatementBuilder
- {
- public static void AddStatement(this BlockStatement block, Statement statement)
- {
- if (block == null)
- throw new ArgumentNullException("block");
- if (statement == null)
- throw new ArgumentNullException("statement");
- block.AddChild(statement);
- statement.Parent = block;
- }
-
- public static void AddStatement(this BlockStatement block, Expression expressionStatement)
- {
- if (expressionStatement == null)
- throw new ArgumentNullException("expressionStatement");
- AddStatement(block, new ExpressionStatement(expressionStatement));
- }
-
- public static void Throw(this BlockStatement block, Expression expression)
- {
- if (expression == null)
- throw new ArgumentNullException("expression");
- AddStatement(block, new ThrowStatement(expression));
- }
-
- public static void Return(this BlockStatement block, Expression expression)
- {
- if (expression == null)
- throw new ArgumentNullException("expression");
- AddStatement(block, new ReturnStatement(expression));
- }
-
- public static void Assign(this BlockStatement block, Expression left, Expression right)
- {
- if (left == null)
- throw new ArgumentNullException("left");
- if (right == null)
- throw new ArgumentNullException("right");
- AddStatement(block, new AssignmentExpression(left, AssignmentOperatorType.Assign, right));
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <author name="Daniel Grunwald"/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+using System.Collections.Generic;
+using ICSharpCode.NRefactory.Ast;
+
+namespace ICSharpCode.NRefactory.AstBuilder
+{
+ /// <summary>
+ /// Extension methods for NRefactory.Ast.Expression.
+ /// </summary>
+ public static class StatementBuilder
+ {
+ public static void AddStatement(this BlockStatement block, Statement statement)
+ {
+ if (block == null)
+ throw new ArgumentNullException("block");
+ if (statement == null)
+ throw new ArgumentNullException("statement");
+ block.AddChild(statement);
+ statement.Parent = block;
+ }
+
+ public static void AddStatement(this BlockStatement block, Expression expressionStatement)
+ {
+ if (expressionStatement == null)
+ throw new ArgumentNullException("expressionStatement");
+ AddStatement(block, new ExpressionStatement(expressionStatement));
+ }
+
+ public static void Throw(this BlockStatement block, Expression expression)
+ {
+ if (expression == null)
+ throw new ArgumentNullException("expression");
+ AddStatement(block, new ThrowStatement(expression));
+ }
+
+ public static void Return(this BlockStatement block, Expression expression)
+ {
+ if (expression == null)
+ throw new ArgumentNullException("expression");
+ AddStatement(block, new ReturnStatement(expression));
+ }
+
+ public static void Assign(this BlockStatement block, Expression left, Expression right)
+ {
+ if (left == null)
+ throw new ArgumentNullException("left");
+ if (right == null)
+ throw new ArgumentNullException("right");
+ AddStatement(block, new AssignmentExpression(left, AssignmentOperatorType.Assign, right));
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/EnvironmentInformationProvider.cs b/main/contrib/NRefactory/Project/Src/EnvironmentInformationProvider.cs
index 7c1fd46737..a52d0b7677 100644
--- a/main/contrib/NRefactory/Project/Src/EnvironmentInformationProvider.cs
+++ b/main/contrib/NRefactory/Project/Src/EnvironmentInformationProvider.cs
@@ -1,26 +1,26 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 2195 $</version>
-// </file>
-
-using System;
-
-namespace ICSharpCode.NRefactory
-{
- public interface IEnvironmentInformationProvider
- {
- bool HasField(string fullTypeName, int typeParameterCount, string fieldName);
- }
-
- sealed class DummyEnvironmentInformationProvider : IEnvironmentInformationProvider
- {
- internal static readonly IEnvironmentInformationProvider Instance = new DummyEnvironmentInformationProvider();
-
- public bool HasField(string fullTypeName, int typeParameterCount, string fieldName)
- {
- return false;
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+
+namespace ICSharpCode.NRefactory
+{
+ public interface IEnvironmentInformationProvider
+ {
+ bool HasField(string fullTypeName, int typeParameterCount, string fieldName);
+ }
+
+ sealed class DummyEnvironmentInformationProvider : IEnvironmentInformationProvider
+ {
+ internal static readonly IEnvironmentInformationProvider Instance = new DummyEnvironmentInformationProvider();
+
+ public bool HasField(string fullTypeName, int typeParameterCount, string fieldName)
+ {
+ return false;
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/IAstVisitor.cs b/main/contrib/NRefactory/Project/Src/IAstVisitor.cs
index 1f1fe448ca..0af26f5ea6 100644
--- a/main/contrib/NRefactory/Project/Src/IAstVisitor.cs
+++ b/main/contrib/NRefactory/Project/Src/IAstVisitor.cs
@@ -1,262 +1,262 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:2.0.50727.3053
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace ICSharpCode.NRefactory {
- using System;
- using ICSharpCode.NRefactory.Ast;
-
-
- public interface IAstVisitor {
-
- object VisitAddHandlerStatement(AddHandlerStatement addHandlerStatement, object data);
-
- object VisitAddressOfExpression(AddressOfExpression addressOfExpression, object data);
-
- object VisitAnonymousMethodExpression(AnonymousMethodExpression anonymousMethodExpression, object data);
-
- object VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object data);
-
- object VisitAssignmentExpression(AssignmentExpression assignmentExpression, object data);
-
- object VisitAttribute(ICSharpCode.NRefactory.Ast.Attribute attribute, object data);
-
- object VisitAttributeSection(AttributeSection attributeSection, object data);
-
- object VisitBaseReferenceExpression(BaseReferenceExpression baseReferenceExpression, object data);
-
- object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data);
-
- object VisitBlockStatement(BlockStatement blockStatement, object data);
-
- object VisitBreakStatement(BreakStatement breakStatement, object data);
-
- object VisitCaseLabel(CaseLabel caseLabel, object data);
-
- object VisitCastExpression(CastExpression castExpression, object data);
-
- object VisitCatchClause(CatchClause catchClause, object data);
-
- object VisitCheckedExpression(CheckedExpression checkedExpression, object data);
-
- object VisitCheckedStatement(CheckedStatement checkedStatement, object data);
-
- object VisitClassReferenceExpression(ClassReferenceExpression classReferenceExpression, object data);
-
- object VisitCollectionInitializerExpression(CollectionInitializerExpression collectionInitializerExpression, object data);
-
- object VisitCompilationUnit(CompilationUnit compilationUnit, object data);
-
- object VisitConditionalExpression(ConditionalExpression conditionalExpression, object data);
-
- object VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data);
-
- object VisitConstructorInitializer(ConstructorInitializer constructorInitializer, object data);
-
- object VisitContinueStatement(ContinueStatement continueStatement, object data);
-
- object VisitDeclareDeclaration(DeclareDeclaration declareDeclaration, object data);
-
- object VisitDefaultValueExpression(DefaultValueExpression defaultValueExpression, object data);
-
- object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data);
-
- object VisitDestructorDeclaration(DestructorDeclaration destructorDeclaration, object data);
-
- object VisitDirectionExpression(DirectionExpression directionExpression, object data);
-
- object VisitDoLoopStatement(DoLoopStatement doLoopStatement, object data);
-
- object VisitElseIfSection(ElseIfSection elseIfSection, object data);
-
- object VisitEmptyStatement(EmptyStatement emptyStatement, object data);
-
- object VisitEndStatement(EndStatement endStatement, object data);
-
- object VisitEraseStatement(EraseStatement eraseStatement, object data);
-
- object VisitErrorStatement(ErrorStatement errorStatement, object data);
-
- object VisitEventAddRegion(EventAddRegion eventAddRegion, object data);
-
- object VisitEventDeclaration(EventDeclaration eventDeclaration, object data);
-
- object VisitEventRaiseRegion(EventRaiseRegion eventRaiseRegion, object data);
-
- object VisitEventRemoveRegion(EventRemoveRegion eventRemoveRegion, object data);
-
- object VisitExitStatement(ExitStatement exitStatement, object data);
-
- object VisitExpressionRangeVariable(ExpressionRangeVariable expressionRangeVariable, object data);
-
- object VisitExpressionStatement(ExpressionStatement expressionStatement, object data);
-
- object VisitExternAliasDirective(ExternAliasDirective externAliasDirective, object data);
-
- object VisitFieldDeclaration(FieldDeclaration fieldDeclaration, object data);
-
- object VisitFixedStatement(FixedStatement fixedStatement, object data);
-
- object VisitForeachStatement(ForeachStatement foreachStatement, object data);
-
- object VisitForNextStatement(ForNextStatement forNextStatement, object data);
-
- object VisitForStatement(ForStatement forStatement, object data);
-
- object VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, object data);
-
- object VisitGotoStatement(GotoStatement gotoStatement, object data);
-
- object VisitIdentifierExpression(IdentifierExpression identifierExpression, object data);
-
- object VisitIfElseStatement(IfElseStatement ifElseStatement, object data);
-
- object VisitIndexerDeclaration(IndexerDeclaration indexerDeclaration, object data);
-
- object VisitIndexerExpression(IndexerExpression indexerExpression, object data);
-
- object VisitInnerClassTypeReference(InnerClassTypeReference innerClassTypeReference, object data);
-
- object VisitInterfaceImplementation(InterfaceImplementation interfaceImplementation, object data);
-
- object VisitInvocationExpression(InvocationExpression invocationExpression, object data);
-
- object VisitLabelStatement(LabelStatement labelStatement, object data);
-
- object VisitLambdaExpression(LambdaExpression lambdaExpression, object data);
-
- object VisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data);
-
- object VisitLockStatement(LockStatement lockStatement, object data);
-
- object VisitMemberReferenceExpression(MemberReferenceExpression memberReferenceExpression, object data);
-
- object VisitMethodDeclaration(MethodDeclaration methodDeclaration, object data);
-
- object VisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression, object data);
-
- object VisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, object data);
-
- object VisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression, object data);
-
- object VisitOnErrorStatement(OnErrorStatement onErrorStatement, object data);
-
- object VisitOperatorDeclaration(OperatorDeclaration operatorDeclaration, object data);
-
- object VisitOptionDeclaration(OptionDeclaration optionDeclaration, object data);
-
- object VisitParameterDeclarationExpression(ParameterDeclarationExpression parameterDeclarationExpression, object data);
-
- object VisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression, object data);
-
- object VisitPointerReferenceExpression(PointerReferenceExpression pointerReferenceExpression, object data);
-
- object VisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data);
-
- object VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration, object data);
-
- object VisitPropertyGetRegion(PropertyGetRegion propertyGetRegion, object data);
-
- object VisitPropertySetRegion(PropertySetRegion propertySetRegion, object data);
-
- object VisitQueryExpression(QueryExpression queryExpression, object data);
-
- object VisitQueryExpressionAggregateClause(QueryExpressionAggregateClause queryExpressionAggregateClause, object data);
-
- object VisitQueryExpressionDistinctClause(QueryExpressionDistinctClause queryExpressionDistinctClause, object data);
-
- object VisitQueryExpressionFromClause(QueryExpressionFromClause queryExpressionFromClause, object data);
-
- object VisitQueryExpressionGroupClause(QueryExpressionGroupClause queryExpressionGroupClause, object data);
-
- object VisitQueryExpressionGroupJoinVBClause(QueryExpressionGroupJoinVBClause queryExpressionGroupJoinVBClause, object data);
-
- object VisitQueryExpressionGroupVBClause(QueryExpressionGroupVBClause queryExpressionGroupVBClause, object data);
-
- object VisitQueryExpressionJoinClause(QueryExpressionJoinClause queryExpressionJoinClause, object data);
-
- object VisitQueryExpressionJoinConditionVB(QueryExpressionJoinConditionVB queryExpressionJoinConditionVB, object data);
-
- object VisitQueryExpressionJoinVBClause(QueryExpressionJoinVBClause queryExpressionJoinVBClause, object data);
-
- object VisitQueryExpressionLetClause(QueryExpressionLetClause queryExpressionLetClause, object data);
-
- object VisitQueryExpressionLetVBClause(QueryExpressionLetVBClause queryExpressionLetVBClause, object data);
-
- object VisitQueryExpressionOrderClause(QueryExpressionOrderClause queryExpressionOrderClause, object data);
-
- object VisitQueryExpressionOrdering(QueryExpressionOrdering queryExpressionOrdering, object data);
-
- object VisitQueryExpressionPartitionVBClause(QueryExpressionPartitionVBClause queryExpressionPartitionVBClause, object data);
-
- object VisitQueryExpressionSelectClause(QueryExpressionSelectClause queryExpressionSelectClause, object data);
-
- object VisitQueryExpressionSelectVBClause(QueryExpressionSelectVBClause queryExpressionSelectVBClause, object data);
-
- object VisitQueryExpressionWhereClause(QueryExpressionWhereClause queryExpressionWhereClause, object data);
-
- object VisitRaiseEventStatement(RaiseEventStatement raiseEventStatement, object data);
-
- object VisitReDimStatement(ReDimStatement reDimStatement, object data);
-
- object VisitRemoveHandlerStatement(RemoveHandlerStatement removeHandlerStatement, object data);
-
- object VisitResumeStatement(ResumeStatement resumeStatement, object data);
-
- object VisitReturnStatement(ReturnStatement returnStatement, object data);
-
- object VisitSizeOfExpression(SizeOfExpression sizeOfExpression, object data);
-
- object VisitStackAllocExpression(StackAllocExpression stackAllocExpression, object data);
-
- object VisitStopStatement(StopStatement stopStatement, object data);
-
- object VisitSwitchSection(SwitchSection switchSection, object data);
-
- object VisitSwitchStatement(SwitchStatement switchStatement, object data);
-
- object VisitTemplateDefinition(TemplateDefinition templateDefinition, object data);
-
- object VisitThisReferenceExpression(ThisReferenceExpression thisReferenceExpression, object data);
-
- object VisitThrowStatement(ThrowStatement throwStatement, object data);
-
- object VisitTryCatchStatement(TryCatchStatement tryCatchStatement, object data);
-
- object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data);
-
- object VisitTypeOfExpression(TypeOfExpression typeOfExpression, object data);
-
- object VisitTypeOfIsExpression(TypeOfIsExpression typeOfIsExpression, object data);
-
- object VisitTypeReference(TypeReference typeReference, object data);
-
- object VisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, object data);
-
- object VisitUnaryOperatorExpression(UnaryOperatorExpression unaryOperatorExpression, object data);
-
- object VisitUncheckedExpression(UncheckedExpression uncheckedExpression, object data);
-
- object VisitUncheckedStatement(UncheckedStatement uncheckedStatement, object data);
-
- object VisitUnsafeStatement(UnsafeStatement unsafeStatement, object data);
-
- object VisitUsing(Using @using, object data);
-
- object VisitUsingDeclaration(UsingDeclaration usingDeclaration, object data);
-
- object VisitUsingStatement(UsingStatement usingStatement, object data);
-
- object VisitVariableDeclaration(VariableDeclaration variableDeclaration, object data);
-
- object VisitWithStatement(WithStatement withStatement, object data);
-
- object VisitYieldStatement(YieldStatement yieldStatement, object data);
- }
-}
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.3053
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace ICSharpCode.NRefactory {
+ using System;
+ using ICSharpCode.NRefactory.Ast;
+
+
+ public interface IAstVisitor {
+
+ object VisitAddHandlerStatement(AddHandlerStatement addHandlerStatement, object data);
+
+ object VisitAddressOfExpression(AddressOfExpression addressOfExpression, object data);
+
+ object VisitAnonymousMethodExpression(AnonymousMethodExpression anonymousMethodExpression, object data);
+
+ object VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object data);
+
+ object VisitAssignmentExpression(AssignmentExpression assignmentExpression, object data);
+
+ object VisitAttribute(ICSharpCode.NRefactory.Ast.Attribute attribute, object data);
+
+ object VisitAttributeSection(AttributeSection attributeSection, object data);
+
+ object VisitBaseReferenceExpression(BaseReferenceExpression baseReferenceExpression, object data);
+
+ object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data);
+
+ object VisitBlockStatement(BlockStatement blockStatement, object data);
+
+ object VisitBreakStatement(BreakStatement breakStatement, object data);
+
+ object VisitCaseLabel(CaseLabel caseLabel, object data);
+
+ object VisitCastExpression(CastExpression castExpression, object data);
+
+ object VisitCatchClause(CatchClause catchClause, object data);
+
+ object VisitCheckedExpression(CheckedExpression checkedExpression, object data);
+
+ object VisitCheckedStatement(CheckedStatement checkedStatement, object data);
+
+ object VisitClassReferenceExpression(ClassReferenceExpression classReferenceExpression, object data);
+
+ object VisitCollectionInitializerExpression(CollectionInitializerExpression collectionInitializerExpression, object data);
+
+ object VisitCompilationUnit(CompilationUnit compilationUnit, object data);
+
+ object VisitConditionalExpression(ConditionalExpression conditionalExpression, object data);
+
+ object VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data);
+
+ object VisitConstructorInitializer(ConstructorInitializer constructorInitializer, object data);
+
+ object VisitContinueStatement(ContinueStatement continueStatement, object data);
+
+ object VisitDeclareDeclaration(DeclareDeclaration declareDeclaration, object data);
+
+ object VisitDefaultValueExpression(DefaultValueExpression defaultValueExpression, object data);
+
+ object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data);
+
+ object VisitDestructorDeclaration(DestructorDeclaration destructorDeclaration, object data);
+
+ object VisitDirectionExpression(DirectionExpression directionExpression, object data);
+
+ object VisitDoLoopStatement(DoLoopStatement doLoopStatement, object data);
+
+ object VisitElseIfSection(ElseIfSection elseIfSection, object data);
+
+ object VisitEmptyStatement(EmptyStatement emptyStatement, object data);
+
+ object VisitEndStatement(EndStatement endStatement, object data);
+
+ object VisitEraseStatement(EraseStatement eraseStatement, object data);
+
+ object VisitErrorStatement(ErrorStatement errorStatement, object data);
+
+ object VisitEventAddRegion(EventAddRegion eventAddRegion, object data);
+
+ object VisitEventDeclaration(EventDeclaration eventDeclaration, object data);
+
+ object VisitEventRaiseRegion(EventRaiseRegion eventRaiseRegion, object data);
+
+ object VisitEventRemoveRegion(EventRemoveRegion eventRemoveRegion, object data);
+
+ object VisitExitStatement(ExitStatement exitStatement, object data);
+
+ object VisitExpressionRangeVariable(ExpressionRangeVariable expressionRangeVariable, object data);
+
+ object VisitExpressionStatement(ExpressionStatement expressionStatement, object data);
+
+ object VisitExternAliasDirective(ExternAliasDirective externAliasDirective, object data);
+
+ object VisitFieldDeclaration(FieldDeclaration fieldDeclaration, object data);
+
+ object VisitFixedStatement(FixedStatement fixedStatement, object data);
+
+ object VisitForeachStatement(ForeachStatement foreachStatement, object data);
+
+ object VisitForNextStatement(ForNextStatement forNextStatement, object data);
+
+ object VisitForStatement(ForStatement forStatement, object data);
+
+ object VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, object data);
+
+ object VisitGotoStatement(GotoStatement gotoStatement, object data);
+
+ object VisitIdentifierExpression(IdentifierExpression identifierExpression, object data);
+
+ object VisitIfElseStatement(IfElseStatement ifElseStatement, object data);
+
+ object VisitIndexerDeclaration(IndexerDeclaration indexerDeclaration, object data);
+
+ object VisitIndexerExpression(IndexerExpression indexerExpression, object data);
+
+ object VisitInnerClassTypeReference(InnerClassTypeReference innerClassTypeReference, object data);
+
+ object VisitInterfaceImplementation(InterfaceImplementation interfaceImplementation, object data);
+
+ object VisitInvocationExpression(InvocationExpression invocationExpression, object data);
+
+ object VisitLabelStatement(LabelStatement labelStatement, object data);
+
+ object VisitLambdaExpression(LambdaExpression lambdaExpression, object data);
+
+ object VisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data);
+
+ object VisitLockStatement(LockStatement lockStatement, object data);
+
+ object VisitMemberReferenceExpression(MemberReferenceExpression memberReferenceExpression, object data);
+
+ object VisitMethodDeclaration(MethodDeclaration methodDeclaration, object data);
+
+ object VisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression, object data);
+
+ object VisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, object data);
+
+ object VisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression, object data);
+
+ object VisitOnErrorStatement(OnErrorStatement onErrorStatement, object data);
+
+ object VisitOperatorDeclaration(OperatorDeclaration operatorDeclaration, object data);
+
+ object VisitOptionDeclaration(OptionDeclaration optionDeclaration, object data);
+
+ object VisitParameterDeclarationExpression(ParameterDeclarationExpression parameterDeclarationExpression, object data);
+
+ object VisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression, object data);
+
+ object VisitPointerReferenceExpression(PointerReferenceExpression pointerReferenceExpression, object data);
+
+ object VisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data);
+
+ object VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration, object data);
+
+ object VisitPropertyGetRegion(PropertyGetRegion propertyGetRegion, object data);
+
+ object VisitPropertySetRegion(PropertySetRegion propertySetRegion, object data);
+
+ object VisitQueryExpression(QueryExpression queryExpression, object data);
+
+ object VisitQueryExpressionAggregateClause(QueryExpressionAggregateClause queryExpressionAggregateClause, object data);
+
+ object VisitQueryExpressionDistinctClause(QueryExpressionDistinctClause queryExpressionDistinctClause, object data);
+
+ object VisitQueryExpressionFromClause(QueryExpressionFromClause queryExpressionFromClause, object data);
+
+ object VisitQueryExpressionGroupClause(QueryExpressionGroupClause queryExpressionGroupClause, object data);
+
+ object VisitQueryExpressionGroupJoinVBClause(QueryExpressionGroupJoinVBClause queryExpressionGroupJoinVBClause, object data);
+
+ object VisitQueryExpressionGroupVBClause(QueryExpressionGroupVBClause queryExpressionGroupVBClause, object data);
+
+ object VisitQueryExpressionJoinClause(QueryExpressionJoinClause queryExpressionJoinClause, object data);
+
+ object VisitQueryExpressionJoinConditionVB(QueryExpressionJoinConditionVB queryExpressionJoinConditionVB, object data);
+
+ object VisitQueryExpressionJoinVBClause(QueryExpressionJoinVBClause queryExpressionJoinVBClause, object data);
+
+ object VisitQueryExpressionLetClause(QueryExpressionLetClause queryExpressionLetClause, object data);
+
+ object VisitQueryExpressionLetVBClause(QueryExpressionLetVBClause queryExpressionLetVBClause, object data);
+
+ object VisitQueryExpressionOrderClause(QueryExpressionOrderClause queryExpressionOrderClause, object data);
+
+ object VisitQueryExpressionOrdering(QueryExpressionOrdering queryExpressionOrdering, object data);
+
+ object VisitQueryExpressionPartitionVBClause(QueryExpressionPartitionVBClause queryExpressionPartitionVBClause, object data);
+
+ object VisitQueryExpressionSelectClause(QueryExpressionSelectClause queryExpressionSelectClause, object data);
+
+ object VisitQueryExpressionSelectVBClause(QueryExpressionSelectVBClause queryExpressionSelectVBClause, object data);
+
+ object VisitQueryExpressionWhereClause(QueryExpressionWhereClause queryExpressionWhereClause, object data);
+
+ object VisitRaiseEventStatement(RaiseEventStatement raiseEventStatement, object data);
+
+ object VisitReDimStatement(ReDimStatement reDimStatement, object data);
+
+ object VisitRemoveHandlerStatement(RemoveHandlerStatement removeHandlerStatement, object data);
+
+ object VisitResumeStatement(ResumeStatement resumeStatement, object data);
+
+ object VisitReturnStatement(ReturnStatement returnStatement, object data);
+
+ object VisitSizeOfExpression(SizeOfExpression sizeOfExpression, object data);
+
+ object VisitStackAllocExpression(StackAllocExpression stackAllocExpression, object data);
+
+ object VisitStopStatement(StopStatement stopStatement, object data);
+
+ object VisitSwitchSection(SwitchSection switchSection, object data);
+
+ object VisitSwitchStatement(SwitchStatement switchStatement, object data);
+
+ object VisitTemplateDefinition(TemplateDefinition templateDefinition, object data);
+
+ object VisitThisReferenceExpression(ThisReferenceExpression thisReferenceExpression, object data);
+
+ object VisitThrowStatement(ThrowStatement throwStatement, object data);
+
+ object VisitTryCatchStatement(TryCatchStatement tryCatchStatement, object data);
+
+ object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data);
+
+ object VisitTypeOfExpression(TypeOfExpression typeOfExpression, object data);
+
+ object VisitTypeOfIsExpression(TypeOfIsExpression typeOfIsExpression, object data);
+
+ object VisitTypeReference(TypeReference typeReference, object data);
+
+ object VisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, object data);
+
+ object VisitUnaryOperatorExpression(UnaryOperatorExpression unaryOperatorExpression, object data);
+
+ object VisitUncheckedExpression(UncheckedExpression uncheckedExpression, object data);
+
+ object VisitUncheckedStatement(UncheckedStatement uncheckedStatement, object data);
+
+ object VisitUnsafeStatement(UnsafeStatement unsafeStatement, object data);
+
+ object VisitUsing(Using @using, object data);
+
+ object VisitUsingDeclaration(UsingDeclaration usingDeclaration, object data);
+
+ object VisitUsingStatement(UsingStatement usingStatement, object data);
+
+ object VisitVariableDeclaration(VariableDeclaration variableDeclaration, object data);
+
+ object VisitWithStatement(WithStatement withStatement, object data);
+
+ object VisitYieldStatement(YieldStatement yieldStatement, object data);
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Lexer/AbstractLexer.cs b/main/contrib/NRefactory/Project/Src/Lexer/AbstractLexer.cs
index c34a7e64da..3dd0f01bb1 100644
--- a/main/contrib/NRefactory/Project/Src/Lexer/AbstractLexer.cs
+++ b/main/contrib/NRefactory/Project/Src/Lexer/AbstractLexer.cs
@@ -2,7 +2,7 @@
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 3867 $</version>
+// <version>$Revision: 4482 $</version>
// </file>
using System;
diff --git a/main/contrib/NRefactory/Project/Src/Lexer/CSharp/ConditionalCompilation.cs b/main/contrib/NRefactory/Project/Src/Lexer/CSharp/ConditionalCompilation.cs
index 0d816afda5..a4c9b92548 100644
--- a/main/contrib/NRefactory/Project/Src/Lexer/CSharp/ConditionalCompilation.cs
+++ b/main/contrib/NRefactory/Project/Src/Lexer/CSharp/ConditionalCompilation.cs
@@ -1,90 +1,90 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald"/>
-// <version>$Revision$</version>
-// </file>
-
-using System;
-using System.Collections.Generic;
-using ICSharpCode.NRefactory.Ast;
-using ICSharpCode.NRefactory.Visitors;
-
-namespace ICSharpCode.NRefactory.Parser.CSharp
-{
- public sealed class ConditionalCompilation : AbstractAstVisitor
- {
- static readonly object SymbolDefined = new object();
- Dictionary<string, object> symbols = new Dictionary<string, object>();
-
- public IDictionary<string, object> Symbols {
- get { return symbols; }
- }
-
- public void Define(string symbol)
- {
- symbols[symbol] = SymbolDefined;
- }
-
- public void Undefine(string symbol)
- {
- symbols.Remove(symbol);
- }
-
- public bool Evaluate(Expression condition)
- {
- return condition.AcceptVisitor(this, null) == SymbolDefined;
- }
-
- public override object VisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data)
- {
- if (primitiveExpression.Value is bool)
- return (bool)primitiveExpression.Value ? SymbolDefined : null;
- else
- return null;
- }
-
- public override object VisitIdentifierExpression(IdentifierExpression identifierExpression, object data)
- {
- return symbols.ContainsKey(identifierExpression.Identifier) ? SymbolDefined : null;
- }
-
- public override object VisitUnaryOperatorExpression(UnaryOperatorExpression unaryOperatorExpression, object data)
- {
- if (unaryOperatorExpression.Op == UnaryOperatorType.Not) {
- return unaryOperatorExpression.Expression.AcceptVisitor(this, data) == SymbolDefined ? null : SymbolDefined;
- } else {
- return null;
- }
- }
-
- public override object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data)
- {
- bool lhs = binaryOperatorExpression.Left.AcceptVisitor(this, data) == SymbolDefined;
- bool rhs = binaryOperatorExpression.Right.AcceptVisitor(this, data) == SymbolDefined;
- bool result;
- switch (binaryOperatorExpression.Op) {
- case BinaryOperatorType.LogicalAnd:
- result = lhs && rhs;
- break;
- case BinaryOperatorType.LogicalOr:
- result = lhs || rhs;
- break;
- case BinaryOperatorType.Equality:
- result = lhs == rhs;
- break;
- case BinaryOperatorType.InEquality:
- result = lhs != rhs;
- break;
- default:
- return null;
- }
- return result ? SymbolDefined : null;
- }
-
- public override object VisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression, object data)
- {
- return parenthesizedExpression.Expression.AcceptVisitor(this, data);
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Daniel Grunwald"/>
+// <version>$Revision$</version>
+// </file>
+
+using System;
+using System.Collections.Generic;
+using ICSharpCode.NRefactory.Ast;
+using ICSharpCode.NRefactory.Visitors;
+
+namespace ICSharpCode.NRefactory.Parser.CSharp
+{
+ public sealed class ConditionalCompilation : AbstractAstVisitor
+ {
+ static readonly object SymbolDefined = new object();
+ Dictionary<string, object> symbols = new Dictionary<string, object>();
+
+ public IDictionary<string, object> Symbols {
+ get { return symbols; }
+ }
+
+ public void Define(string symbol)
+ {
+ symbols[symbol] = SymbolDefined;
+ }
+
+ public void Undefine(string symbol)
+ {
+ symbols.Remove(symbol);
+ }
+
+ public bool Evaluate(Expression condition)
+ {
+ return condition.AcceptVisitor(this, null) == SymbolDefined;
+ }
+
+ public override object VisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data)
+ {
+ if (primitiveExpression.Value is bool)
+ return (bool)primitiveExpression.Value ? SymbolDefined : null;
+ else
+ return null;
+ }
+
+ public override object VisitIdentifierExpression(IdentifierExpression identifierExpression, object data)
+ {
+ return symbols.ContainsKey(identifierExpression.Identifier) ? SymbolDefined : null;
+ }
+
+ public override object VisitUnaryOperatorExpression(UnaryOperatorExpression unaryOperatorExpression, object data)
+ {
+ if (unaryOperatorExpression.Op == UnaryOperatorType.Not) {
+ return unaryOperatorExpression.Expression.AcceptVisitor(this, data) == SymbolDefined ? null : SymbolDefined;
+ } else {
+ return null;
+ }
+ }
+
+ public override object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data)
+ {
+ bool lhs = binaryOperatorExpression.Left.AcceptVisitor(this, data) == SymbolDefined;
+ bool rhs = binaryOperatorExpression.Right.AcceptVisitor(this, data) == SymbolDefined;
+ bool result;
+ switch (binaryOperatorExpression.Op) {
+ case BinaryOperatorType.LogicalAnd:
+ result = lhs && rhs;
+ break;
+ case BinaryOperatorType.LogicalOr:
+ result = lhs || rhs;
+ break;
+ case BinaryOperatorType.Equality:
+ result = lhs == rhs;
+ break;
+ case BinaryOperatorType.InEquality:
+ result = lhs != rhs;
+ break;
+ default:
+ return null;
+ }
+ return result ? SymbolDefined : null;
+ }
+
+ public override object VisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression, object data)
+ {
+ return parenthesizedExpression.Expression.AcceptVisitor(this, data);
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Lexer/CSharp/Lexer.cs b/main/contrib/NRefactory/Project/Src/Lexer/CSharp/Lexer.cs
index 1a1d2367e1..f76f74b67b 100644
--- a/main/contrib/NRefactory/Project/Src/Lexer/CSharp/Lexer.cs
+++ b/main/contrib/NRefactory/Project/Src/Lexer/CSharp/Lexer.cs
@@ -2,7 +2,7 @@
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Andrea Paatz" email="andrea@icsharpcode.net"/>
-// <version>$Revision: 3866 $</version>
+// <version>$Revision: 4482 $</version>
// </file>
using System;
diff --git a/main/contrib/NRefactory/Project/Src/Lexer/CSharp/Tokens.cs b/main/contrib/NRefactory/Project/Src/Lexer/CSharp/Tokens.cs
index ca2f54c1d7..e5f855f495 100644
--- a/main/contrib/NRefactory/Project/Src/Lexer/CSharp/Tokens.cs
+++ b/main/contrib/NRefactory/Project/Src/Lexer/CSharp/Tokens.cs
@@ -1,353 +1,353 @@
-// this file was autogenerated by a tool.
-using System;
-using System.Collections;
-
-namespace ICSharpCode.NRefactory.Parser.CSharp
-{
- public static class Tokens
- {
- // ----- terminal classes -----
- public const int EOF = 0;
- public const int Identifier = 1;
- public const int Literal = 2;
-
- // ----- special character -----
- public const int Assign = 3;
- public const int Plus = 4;
- public const int Minus = 5;
- public const int Times = 6;
- public const int Div = 7;
- public const int Mod = 8;
- public const int Colon = 9;
- public const int DoubleColon = 10;
- public const int Semicolon = 11;
- public const int Question = 12;
- public const int DoubleQuestion = 13;
- public const int Comma = 14;
- public const int Dot = 15;
- public const int OpenCurlyBrace = 16;
- public const int CloseCurlyBrace = 17;
- public const int OpenSquareBracket = 18;
- public const int CloseSquareBracket = 19;
- public const int OpenParenthesis = 20;
- public const int CloseParenthesis = 21;
- public const int GreaterThan = 22;
- public const int LessThan = 23;
- public const int Not = 24;
- public const int LogicalAnd = 25;
- public const int LogicalOr = 26;
- public const int BitwiseComplement = 27;
- public const int BitwiseAnd = 28;
- public const int BitwiseOr = 29;
- public const int Xor = 30;
- public const int Increment = 31;
- public const int Decrement = 32;
- public const int Equal = 33;
- public const int NotEqual = 34;
- public const int GreaterEqual = 35;
- public const int LessEqual = 36;
- public const int ShiftLeft = 37;
- public const int PlusAssign = 38;
- public const int MinusAssign = 39;
- public const int TimesAssign = 40;
- public const int DivAssign = 41;
- public const int ModAssign = 42;
- public const int BitwiseAndAssign = 43;
- public const int BitwiseOrAssign = 44;
- public const int XorAssign = 45;
- public const int ShiftLeftAssign = 46;
- public const int Pointer = 47;
- public const int LambdaArrow = 48;
-
- // ----- keywords -----
- public const int Abstract = 49;
- public const int As = 50;
- public const int Base = 51;
- public const int Bool = 52;
- public const int Break = 53;
- public const int Byte = 54;
- public const int Case = 55;
- public const int Catch = 56;
- public const int Char = 57;
- public const int Checked = 58;
- public const int Class = 59;
- public const int Const = 60;
- public const int Continue = 61;
- public const int Decimal = 62;
- public const int Default = 63;
- public const int Delegate = 64;
- public const int Do = 65;
- public const int Double = 66;
- public const int Else = 67;
- public const int Enum = 68;
- public const int Event = 69;
- public const int Explicit = 70;
- public const int Extern = 71;
- public const int False = 72;
- public const int Finally = 73;
- public const int Fixed = 74;
- public const int Float = 75;
- public const int For = 76;
- public const int Foreach = 77;
- public const int Goto = 78;
- public const int If = 79;
- public const int Implicit = 80;
- public const int In = 81;
- public const int Int = 82;
- public const int Interface = 83;
- public const int Internal = 84;
- public const int Is = 85;
- public const int Lock = 86;
- public const int Long = 87;
- public const int Namespace = 88;
- public const int New = 89;
- public const int Null = 90;
- public const int Object = 91;
- public const int Operator = 92;
- public const int Out = 93;
- public const int Override = 94;
- public const int Params = 95;
- public const int Private = 96;
- public const int Protected = 97;
- public const int Public = 98;
- public const int Readonly = 99;
- public const int Ref = 100;
- public const int Return = 101;
- public const int Sbyte = 102;
- public const int Sealed = 103;
- public const int Short = 104;
- public const int Sizeof = 105;
- public const int Stackalloc = 106;
- public const int Static = 107;
- public const int String = 108;
- public const int Struct = 109;
- public const int Switch = 110;
- public const int This = 111;
- public const int Throw = 112;
- public const int True = 113;
- public const int Try = 114;
- public const int Typeof = 115;
- public const int Uint = 116;
- public const int Ulong = 117;
- public const int Unchecked = 118;
- public const int Unsafe = 119;
- public const int Ushort = 120;
- public const int Using = 121;
- public const int Virtual = 122;
- public const int Void = 123;
- public const int Volatile = 124;
- public const int While = 125;
- public const int Partial = 126;
- public const int Where = 127;
- public const int Get = 128;
- public const int Set = 129;
- public const int Add = 130;
- public const int Remove = 131;
- public const int Yield = 132;
- public const int Select = 133;
- public const int Group = 134;
- public const int By = 135;
- public const int Into = 136;
- public const int From = 137;
- public const int Ascending = 138;
- public const int Descending = 139;
- public const int Orderby = 140;
- public const int Let = 141;
- public const int Join = 142;
- public const int On = 143;
- new public const int Equals = 144;
-
- public const int MaxToken = 145;
- static BitArray NewSet(params int[] values)
- {
- BitArray bitArray = new BitArray(MaxToken);
- foreach (int val in values) {
- bitArray[val] = true;
- }
- return bitArray;
- }
- public static BitArray IdentifierTokens = NewSet(Identifier, Partial, Where, Get, Set, Add, Remove, Yield, Select, Group, By, Into, From, Ascending, Descending, Orderby, Let, Join, On, Equals);
- public static BitArray OverloadableUnaryOp = NewSet(Minus, Not, BitwiseComplement, Increment, Decrement, True, False);
- public static BitArray OverloadableBinaryOp = NewSet(Plus, Minus, Times, Div, Mod, BitwiseAnd, BitwiseOr, Xor, ShiftLeft, Equal, NotEqual, GreaterThan, LessThan, GreaterEqual, LessEqual);
- public static BitArray TypeKW = NewSet(Char, Bool, Object, String, Sbyte, Byte, Short, Ushort, Int, Uint, Long, Ulong, Float, Double, Decimal);
- public static BitArray UnaryHead = NewSet(Plus, Minus, Not, BitwiseComplement, Times, Increment, Decrement, BitwiseAnd);
- public static BitArray AssnStartOp = NewSet(Plus, Minus, Not, BitwiseComplement, Times);
- public static BitArray CastFollower = NewSet(Char, Bool, Object, String, Sbyte, Byte, Short, Ushort, Int, Uint, Long, Ulong, Float, Double, Decimal, Identifier, Partial, Where, Get, Set, Add, Remove, Yield, Select, Group, By, Into, From, Ascending, Descending, Orderby, Let, Join, On, Equals, Void, Literal, OpenParenthesis, BitwiseComplement, Not, Base, Delegate, False, New, Null, Sizeof, This, True, Typeof, Checked, Unchecked, From);
- public static BitArray AssgnOps = NewSet(Assign, PlusAssign, MinusAssign, TimesAssign, DivAssign, ModAssign, BitwiseAndAssign, BitwiseOrAssign, ShiftLeftAssign);
- public static BitArray UnaryOp = NewSet(Plus, Minus, Not, BitwiseComplement, Times, Increment, Decrement, BitwiseAnd);
- public static BitArray TypeDeclarationKW = NewSet(Class, Interface, Struct, Enum, Delegate);
- public static BitArray GenericFollower = NewSet(OpenParenthesis, CloseParenthesis, CloseSquareBracket, CloseCurlyBrace, Colon, Semicolon, Comma, Dot, Question, Equal, NotEqual);
- public static BitArray ValidInsideTypeName = NewSet(Identifier, Partial, Where, Get, Set, Add, Remove, Yield, Select, Group, By, Into, From, Ascending, Descending, Orderby, Let, Join, On, Equals, Char, Bool, Object, String, Sbyte, Byte, Short, Ushort, Int, Uint, Long, Ulong, Float, Double, Decimal, LessThan, GreaterThan, Dot, Question, OpenSquareBracket, Comma, CloseSquareBracket, Times, DoubleColon);
- public static BitArray KCCClassModifiers = NewSet(Abstract, Sealed, Static, Unsafe, Partial);
- public static BitArray KCCTypeDeclarationStart = NewSet(Public, Internal, Class, Interface, Struct, Enum, Delegate, Abstract, Sealed, Static, Unsafe, Partial);
- public static BitArray KCCMemberVisibilityModifiers = NewSet(Protected, Private, Public, Internal);
- public static BitArray SimpleTypeName = NewSet(Char, Bool, Object, String, Sbyte, Byte, Short, Ushort, Int, Uint, Long, Ulong, Float, Double, Decimal, Identifier, Partial, Where, Get, Set, Add, Remove, Yield, Select, Group, By, Into, From, Ascending, Descending, Orderby, Let, Join, On, Equals, Void);
- public static BitArray GlobalLevel = NewSet(Namespace, Using, Extern, Public, Internal, Class, Interface, Struct, Enum, Delegate, Abstract, Sealed, Static, Unsafe, Partial);
- public static BitArray ExpressionStart = NewSet(Base, Delegate, False, New, Null, Sizeof, This, True, Typeof, Checked, Unchecked, From, Default);
- public static BitArray ExpressionContent = NewSet(As, Is, Out, Ref, In);
- public static BitArray InterfaceLevel = NewSet(Event);
- public static BitArray TypeLevel = NewSet(Public, Internal, Class, Interface, Struct, Enum, Delegate, Abstract, Sealed, Static, Unsafe, Partial, Protected, Private, Public, Internal, Const, Event, Explicit, Extern, Fixed, Implicit, New, Operator, Override, Readonly, Virtual, Volatile);
- public static BitArray StatementStart = NewSet(Base, Delegate, False, New, Null, Sizeof, This, True, Typeof, Checked, Unchecked, From, As, Is, Out, Ref, In, Break, Case, Catch, Checked, Unchecked, Const, Continue, Default, Do, Else, Finally, Fixed, For, Foreach, Goto, If, Lock, Return, Stackalloc, Switch, Throw, Try, Unsafe, Using, While, Yield);
- public static BitArray QueryExpressionClauseStart = NewSet(From, Let, Where, Join, Orderby, Group, Select);
- public static BitArray InPropertyDeclaration = NewSet(Protected, Private, Public, Internal, Get, Set);
- public static BitArray InEventDeclaration = NewSet(Add, Remove);
-
- static string[] tokenList = new string[] {
- // ----- terminal classes -----
- "<EOF>",
- "<Identifier>",
- "<Literal>",
- // ----- special character -----
- "=",
- "+",
- "-",
- "*",
- "/",
- "%",
- ":",
- "::",
- ";",
- "?",
- "??",
- ",",
- ".",
- "{",
- "}",
- "[",
- "]",
- "(",
- ")",
- ">",
- "<",
- "!",
- "&&",
- "||",
- "~",
- "&",
- "|",
- "^",
- "++",
- "--",
- "==",
- "!=",
- ">=",
- "<=",
- "<<",
- "+=",
- "-=",
- "*=",
- "/=",
- "%=",
- "&=",
- "|=",
- "^=",
- "<<=",
- "->",
- "=>",
- // ----- keywords -----
- "abstract",
- "as",
- "base",
- "bool",
- "break",
- "byte",
- "case",
- "catch",
- "char",
- "checked",
- "class",
- "const",
- "continue",
- "decimal",
- "default",
- "delegate",
- "do",
- "double",
- "else",
- "enum",
- "event",
- "explicit",
- "extern",
- "false",
- "finally",
- "fixed",
- "float",
- "for",
- "foreach",
- "goto",
- "if",
- "implicit",
- "in",
- "int",
- "interface",
- "internal",
- "is",
- "lock",
- "long",
- "namespace",
- "new",
- "null",
- "object",
- "operator",
- "out",
- "override",
- "params",
- "private",
- "protected",
- "public",
- "readonly",
- "ref",
- "return",
- "sbyte",
- "sealed",
- "short",
- "sizeof",
- "stackalloc",
- "static",
- "string",
- "struct",
- "switch",
- "this",
- "throw",
- "true",
- "try",
- "typeof",
- "uint",
- "ulong",
- "unchecked",
- "unsafe",
- "ushort",
- "using",
- "virtual",
- "void",
- "volatile",
- "while",
- "partial",
- "where",
- "get",
- "set",
- "add",
- "remove",
- "yield",
- "select",
- "group",
- "by",
- "into",
- "from",
- "ascending",
- "descending",
- "orderby",
- "let",
- "join",
- "on",
- "equals",
- };
- public static string GetTokenString(int token)
- {
- if (token >= 0 && token < tokenList.Length) {
- return tokenList[token];
- }
- throw new System.NotSupportedException("Unknown token:" + token);
- }
- }
-}
+// this file was autogenerated by a tool.
+using System;
+using System.Collections;
+
+namespace ICSharpCode.NRefactory.Parser.CSharp
+{
+ public static class Tokens
+ {
+ // ----- terminal classes -----
+ public const int EOF = 0;
+ public const int Identifier = 1;
+ public const int Literal = 2;
+
+ // ----- special character -----
+ public const int Assign = 3;
+ public const int Plus = 4;
+ public const int Minus = 5;
+ public const int Times = 6;
+ public const int Div = 7;
+ public const int Mod = 8;
+ public const int Colon = 9;
+ public const int DoubleColon = 10;
+ public const int Semicolon = 11;
+ public const int Question = 12;
+ public const int DoubleQuestion = 13;
+ public const int Comma = 14;
+ public const int Dot = 15;
+ public const int OpenCurlyBrace = 16;
+ public const int CloseCurlyBrace = 17;
+ public const int OpenSquareBracket = 18;
+ public const int CloseSquareBracket = 19;
+ public const int OpenParenthesis = 20;
+ public const int CloseParenthesis = 21;
+ public const int GreaterThan = 22;
+ public const int LessThan = 23;
+ public const int Not = 24;
+ public const int LogicalAnd = 25;
+ public const int LogicalOr = 26;
+ public const int BitwiseComplement = 27;
+ public const int BitwiseAnd = 28;
+ public const int BitwiseOr = 29;
+ public const int Xor = 30;
+ public const int Increment = 31;
+ public const int Decrement = 32;
+ public const int Equal = 33;
+ public const int NotEqual = 34;
+ public const int GreaterEqual = 35;
+ public const int LessEqual = 36;
+ public const int ShiftLeft = 37;
+ public const int PlusAssign = 38;
+ public const int MinusAssign = 39;
+ public const int TimesAssign = 40;
+ public const int DivAssign = 41;
+ public const int ModAssign = 42;
+ public const int BitwiseAndAssign = 43;
+ public const int BitwiseOrAssign = 44;
+ public const int XorAssign = 45;
+ public const int ShiftLeftAssign = 46;
+ public const int Pointer = 47;
+ public const int LambdaArrow = 48;
+
+ // ----- keywords -----
+ public const int Abstract = 49;
+ public const int As = 50;
+ public const int Base = 51;
+ public const int Bool = 52;
+ public const int Break = 53;
+ public const int Byte = 54;
+ public const int Case = 55;
+ public const int Catch = 56;
+ public const int Char = 57;
+ public const int Checked = 58;
+ public const int Class = 59;
+ public const int Const = 60;
+ public const int Continue = 61;
+ public const int Decimal = 62;
+ public const int Default = 63;
+ public const int Delegate = 64;
+ public const int Do = 65;
+ public const int Double = 66;
+ public const int Else = 67;
+ public const int Enum = 68;
+ public const int Event = 69;
+ public const int Explicit = 70;
+ public const int Extern = 71;
+ public const int False = 72;
+ public const int Finally = 73;
+ public const int Fixed = 74;
+ public const int Float = 75;
+ public const int For = 76;
+ public const int Foreach = 77;
+ public const int Goto = 78;
+ public const int If = 79;
+ public const int Implicit = 80;
+ public const int In = 81;
+ public const int Int = 82;
+ public const int Interface = 83;
+ public const int Internal = 84;
+ public const int Is = 85;
+ public const int Lock = 86;
+ public const int Long = 87;
+ public const int Namespace = 88;
+ public const int New = 89;
+ public const int Null = 90;
+ public const int Object = 91;
+ public const int Operator = 92;
+ public const int Out = 93;
+ public const int Override = 94;
+ public const int Params = 95;
+ public const int Private = 96;
+ public const int Protected = 97;
+ public const int Public = 98;
+ public const int Readonly = 99;
+ public const int Ref = 100;
+ public const int Return = 101;
+ public const int Sbyte = 102;
+ public const int Sealed = 103;
+ public const int Short = 104;
+ public const int Sizeof = 105;
+ public const int Stackalloc = 106;
+ public const int Static = 107;
+ public const int String = 108;
+ public const int Struct = 109;
+ public const int Switch = 110;
+ public const int This = 111;
+ public const int Throw = 112;
+ public const int True = 113;
+ public const int Try = 114;
+ public const int Typeof = 115;
+ public const int Uint = 116;
+ public const int Ulong = 117;
+ public const int Unchecked = 118;
+ public const int Unsafe = 119;
+ public const int Ushort = 120;
+ public const int Using = 121;
+ public const int Virtual = 122;
+ public const int Void = 123;
+ public const int Volatile = 124;
+ public const int While = 125;
+ public const int Partial = 126;
+ public const int Where = 127;
+ public const int Get = 128;
+ public const int Set = 129;
+ public const int Add = 130;
+ public const int Remove = 131;
+ public const int Yield = 132;
+ public const int Select = 133;
+ public const int Group = 134;
+ public const int By = 135;
+ public const int Into = 136;
+ public const int From = 137;
+ public const int Ascending = 138;
+ public const int Descending = 139;
+ public const int Orderby = 140;
+ public const int Let = 141;
+ public const int Join = 142;
+ public const int On = 143;
+ new public const int Equals = 144;
+
+ public const int MaxToken = 145;
+ static BitArray NewSet(params int[] values)
+ {
+ BitArray bitArray = new BitArray(MaxToken);
+ foreach (int val in values) {
+ bitArray[val] = true;
+ }
+ return bitArray;
+ }
+ public static BitArray IdentifierTokens = NewSet(Identifier, Partial, Where, Get, Set, Add, Remove, Yield, Select, Group, By, Into, From, Ascending, Descending, Orderby, Let, Join, On, Equals);
+ public static BitArray OverloadableUnaryOp = NewSet(Minus, Not, BitwiseComplement, Increment, Decrement, True, False);
+ public static BitArray OverloadableBinaryOp = NewSet(Plus, Minus, Times, Div, Mod, BitwiseAnd, BitwiseOr, Xor, ShiftLeft, Equal, NotEqual, GreaterThan, LessThan, GreaterEqual, LessEqual);
+ public static BitArray TypeKW = NewSet(Char, Bool, Object, String, Sbyte, Byte, Short, Ushort, Int, Uint, Long, Ulong, Float, Double, Decimal);
+ public static BitArray UnaryHead = NewSet(Plus, Minus, Not, BitwiseComplement, Times, Increment, Decrement, BitwiseAnd);
+ public static BitArray AssnStartOp = NewSet(Plus, Minus, Not, BitwiseComplement, Times);
+ public static BitArray CastFollower = NewSet(Char, Bool, Object, String, Sbyte, Byte, Short, Ushort, Int, Uint, Long, Ulong, Float, Double, Decimal, Identifier, Partial, Where, Get, Set, Add, Remove, Yield, Select, Group, By, Into, From, Ascending, Descending, Orderby, Let, Join, On, Equals, Void, Literal, OpenParenthesis, BitwiseComplement, Not, Base, Delegate, False, New, Null, Sizeof, This, True, Typeof, Checked, Unchecked, From);
+ public static BitArray AssgnOps = NewSet(Assign, PlusAssign, MinusAssign, TimesAssign, DivAssign, ModAssign, BitwiseAndAssign, BitwiseOrAssign, ShiftLeftAssign);
+ public static BitArray UnaryOp = NewSet(Plus, Minus, Not, BitwiseComplement, Times, Increment, Decrement, BitwiseAnd);
+ public static BitArray TypeDeclarationKW = NewSet(Class, Interface, Struct, Enum, Delegate);
+ public static BitArray GenericFollower = NewSet(OpenParenthesis, CloseParenthesis, CloseSquareBracket, CloseCurlyBrace, Colon, Semicolon, Comma, Dot, Question, Equal, NotEqual);
+ public static BitArray ValidInsideTypeName = NewSet(Identifier, Partial, Where, Get, Set, Add, Remove, Yield, Select, Group, By, Into, From, Ascending, Descending, Orderby, Let, Join, On, Equals, Char, Bool, Object, String, Sbyte, Byte, Short, Ushort, Int, Uint, Long, Ulong, Float, Double, Decimal, LessThan, GreaterThan, Dot, Question, OpenSquareBracket, Comma, CloseSquareBracket, Times, DoubleColon);
+ public static BitArray KCCClassModifiers = NewSet(Abstract, Sealed, Static, Unsafe, Partial);
+ public static BitArray KCCTypeDeclarationStart = NewSet(Public, Internal, Class, Interface, Struct, Enum, Delegate, Abstract, Sealed, Static, Unsafe, Partial);
+ public static BitArray KCCMemberVisibilityModifiers = NewSet(Protected, Private, Public, Internal);
+ public static BitArray SimpleTypeName = NewSet(Char, Bool, Object, String, Sbyte, Byte, Short, Ushort, Int, Uint, Long, Ulong, Float, Double, Decimal, Identifier, Partial, Where, Get, Set, Add, Remove, Yield, Select, Group, By, Into, From, Ascending, Descending, Orderby, Let, Join, On, Equals, Void);
+ public static BitArray GlobalLevel = NewSet(Namespace, Using, Extern, Public, Internal, Class, Interface, Struct, Enum, Delegate, Abstract, Sealed, Static, Unsafe, Partial);
+ public static BitArray ExpressionStart = NewSet(Base, Delegate, False, New, Null, Sizeof, This, True, Typeof, Checked, Unchecked, From, Default);
+ public static BitArray ExpressionContent = NewSet(As, Is, Out, Ref, In);
+ public static BitArray InterfaceLevel = NewSet(Event);
+ public static BitArray TypeLevel = NewSet(Public, Internal, Class, Interface, Struct, Enum, Delegate, Abstract, Sealed, Static, Unsafe, Partial, Protected, Private, Public, Internal, Const, Event, Explicit, Extern, Fixed, Implicit, New, Operator, Override, Readonly, Virtual, Volatile);
+ public static BitArray StatementStart = NewSet(Base, Delegate, False, New, Null, Sizeof, This, True, Typeof, Checked, Unchecked, From, As, Is, Out, Ref, In, Break, Case, Catch, Checked, Unchecked, Const, Continue, Default, Do, Else, Finally, Fixed, For, Foreach, Goto, If, Lock, Return, Stackalloc, Switch, Throw, Try, Unsafe, Using, While, Yield);
+ public static BitArray QueryExpressionClauseStart = NewSet(From, Let, Where, Join, Orderby, Group, Select);
+ public static BitArray InPropertyDeclaration = NewSet(Protected, Private, Public, Internal, Get, Set);
+ public static BitArray InEventDeclaration = NewSet(Add, Remove);
+
+ static string[] tokenList = new string[] {
+ // ----- terminal classes -----
+ "<EOF>",
+ "<Identifier>",
+ "<Literal>",
+ // ----- special character -----
+ "=",
+ "+",
+ "-",
+ "*",
+ "/",
+ "%",
+ ":",
+ "::",
+ ";",
+ "?",
+ "??",
+ ",",
+ ".",
+ "{",
+ "}",
+ "[",
+ "]",
+ "(",
+ ")",
+ ">",
+ "<",
+ "!",
+ "&&",
+ "||",
+ "~",
+ "&",
+ "|",
+ "^",
+ "++",
+ "--",
+ "==",
+ "!=",
+ ">=",
+ "<=",
+ "<<",
+ "+=",
+ "-=",
+ "*=",
+ "/=",
+ "%=",
+ "&=",
+ "|=",
+ "^=",
+ "<<=",
+ "->",
+ "=>",
+ // ----- keywords -----
+ "abstract",
+ "as",
+ "base",
+ "bool",
+ "break",
+ "byte",
+ "case",
+ "catch",
+ "char",
+ "checked",
+ "class",
+ "const",
+ "continue",
+ "decimal",
+ "default",
+ "delegate",
+ "do",
+ "double",
+ "else",
+ "enum",
+ "event",
+ "explicit",
+ "extern",
+ "false",
+ "finally",
+ "fixed",
+ "float",
+ "for",
+ "foreach",
+ "goto",
+ "if",
+ "implicit",
+ "in",
+ "int",
+ "interface",
+ "internal",
+ "is",
+ "lock",
+ "long",
+ "namespace",
+ "new",
+ "null",
+ "object",
+ "operator",
+ "out",
+ "override",
+ "params",
+ "private",
+ "protected",
+ "public",
+ "readonly",
+ "ref",
+ "return",
+ "sbyte",
+ "sealed",
+ "short",
+ "sizeof",
+ "stackalloc",
+ "static",
+ "string",
+ "struct",
+ "switch",
+ "this",
+ "throw",
+ "true",
+ "try",
+ "typeof",
+ "uint",
+ "ulong",
+ "unchecked",
+ "unsafe",
+ "ushort",
+ "using",
+ "virtual",
+ "void",
+ "volatile",
+ "while",
+ "partial",
+ "where",
+ "get",
+ "set",
+ "add",
+ "remove",
+ "yield",
+ "select",
+ "group",
+ "by",
+ "into",
+ "from",
+ "ascending",
+ "descending",
+ "orderby",
+ "let",
+ "join",
+ "on",
+ "equals",
+ };
+ public static string GetTokenString(int token)
+ {
+ if (token >= 0 && token < tokenList.Length) {
+ return tokenList[token];
+ }
+ throw new System.NotSupportedException("Unknown token:" + token);
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Lexer/ILexer.cs b/main/contrib/NRefactory/Project/Src/Lexer/ILexer.cs
index fa70589ba5..16bee29788 100644
--- a/main/contrib/NRefactory/Project/Src/Lexer/ILexer.cs
+++ b/main/contrib/NRefactory/Project/Src/Lexer/ILexer.cs
@@ -2,7 +2,7 @@
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 2972 $</version>
+// <version>$Revision: 4482 $</version>
// </file>
using System;
diff --git a/main/contrib/NRefactory/Project/Src/Lexer/LookupTable.cs b/main/contrib/NRefactory/Project/Src/Lexer/LookupTable.cs
index 445705f2ac..2ca5585eec 100644
--- a/main/contrib/NRefactory/Project/Src/Lexer/LookupTable.cs
+++ b/main/contrib/NRefactory/Project/Src/Lexer/LookupTable.cs
@@ -1,120 +1,120 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1965 $</version>
-// </file>
-
-using System;
-using System.Globalization;
-
-namespace ICSharpCode.NRefactory.Parser
-{
- /// <summary>
- /// This class implements a keyword map. It implements a digital search trees (tries) to find
- /// a word.
- /// </summary>
- internal class LookupTable
- {
- Node root = new Node(-1, null);
- bool casesensitive;
- int length;
-
- /// <value>
- /// The number of elements in the table
- /// </value>
- public int Count {
- get {
- return length;
- }
- }
-
- /// <summary>
- /// Inserts an int in the tree, under keyword
- /// </summary>
- public int this[string keyword] {
- get {
- Node next = root;
-
- if (!casesensitive) {
- keyword = keyword.ToUpper(CultureInfo.InvariantCulture);
- }
-
- for (int i = 0; i < keyword.Length; ++i) {
- int index = ((int)keyword[i]) % 256;
- next = next.leaf[index];
-
- if (next == null) {
- return -1;
- }
-
- if (keyword == next.word) {
- return next.val;
- }
- }
- return -1;
- }
- set {
- Node node = root;
- Node next = root;
-
- if (!casesensitive) {
- keyword = keyword.ToUpper(CultureInfo.InvariantCulture);
- }
-
- ++length;
-
- // insert word into the tree
- for (int i = 0; i < keyword.Length; ++i) {
- int index = ((int)keyword[i]) % 256; // index of curchar
- bool d = keyword[i] == '\\';
-
- next = next.leaf[index]; // get node to this index
-
- if (next == null) { // no node created -> insert word here
- node.leaf[index] = new Node(value, keyword);
- break;
- }
-
- if (next.word != null && next.word.Length != i) { // node there, take node content and insert them again
- string tmpword = next.word; // this word will be inserted 1 level deeper (better, don't need too much
- int tmpval = next.val; // string comparisons for finding.)
- next.val = -1;
- next.word = null;
- this[tmpword] = tmpval;
- }
-
- if (i == keyword.Length - 1) { // end of keyword reached, insert node there, if a node was here it was
- next.word = keyword; // reinserted, if it has the same length (keyword EQUALS this word) it will be overwritten
- next.val = value;
- break;
- }
-
- node = next;
- }
- }
- }
-
- /// <summary>
- /// Creates a new instance of <see cref="LookupTable"/>
- /// </summary>
- public LookupTable(bool casesensitive)
- {
- this.casesensitive = casesensitive;
- }
-
- class Node
- {
- public Node(int val, string word)
- {
- this.word = word;
- this.val = val;
- }
-
- public string word;
- public int val;
-
- public Node[] leaf = new Node[256];
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+using System.Globalization;
+
+namespace ICSharpCode.NRefactory.Parser
+{
+ /// <summary>
+ /// This class implements a keyword map. It implements a digital search trees (tries) to find
+ /// a word.
+ /// </summary>
+ internal class LookupTable
+ {
+ Node root = new Node(-1, null);
+ bool casesensitive;
+ int length;
+
+ /// <value>
+ /// The number of elements in the table
+ /// </value>
+ public int Count {
+ get {
+ return length;
+ }
+ }
+
+ /// <summary>
+ /// Inserts an int in the tree, under keyword
+ /// </summary>
+ public int this[string keyword] {
+ get {
+ Node next = root;
+
+ if (!casesensitive) {
+ keyword = keyword.ToUpper(CultureInfo.InvariantCulture);
+ }
+
+ for (int i = 0; i < keyword.Length; ++i) {
+ int index = ((int)keyword[i]) % 256;
+ next = next.leaf[index];
+
+ if (next == null) {
+ return -1;
+ }
+
+ if (keyword == next.word) {
+ return next.val;
+ }
+ }
+ return -1;
+ }
+ set {
+ Node node = root;
+ Node next = root;
+
+ if (!casesensitive) {
+ keyword = keyword.ToUpper(CultureInfo.InvariantCulture);
+ }
+
+ ++length;
+
+ // insert word into the tree
+ for (int i = 0; i < keyword.Length; ++i) {
+ int index = ((int)keyword[i]) % 256; // index of curchar
+ bool d = keyword[i] == '\\';
+
+ next = next.leaf[index]; // get node to this index
+
+ if (next == null) { // no node created -> insert word here
+ node.leaf[index] = new Node(value, keyword);
+ break;
+ }
+
+ if (next.word != null && next.word.Length != i) { // node there, take node content and insert them again
+ string tmpword = next.word; // this word will be inserted 1 level deeper (better, don't need too much
+ int tmpval = next.val; // string comparisons for finding.)
+ next.val = -1;
+ next.word = null;
+ this[tmpword] = tmpval;
+ }
+
+ if (i == keyword.Length - 1) { // end of keyword reached, insert node there, if a node was here it was
+ next.word = keyword; // reinserted, if it has the same length (keyword EQUALS this word) it will be overwritten
+ next.val = value;
+ break;
+ }
+
+ node = next;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Creates a new instance of <see cref="LookupTable"/>
+ /// </summary>
+ public LookupTable(bool casesensitive)
+ {
+ this.casesensitive = casesensitive;
+ }
+
+ class Node
+ {
+ public Node(int val, string word)
+ {
+ this.word = word;
+ this.val = val;
+ }
+
+ public string word;
+ public int val;
+
+ public Node[] leaf = new Node[256];
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Lexer/Special/BlankLine.cs b/main/contrib/NRefactory/Project/Src/Lexer/Special/BlankLine.cs
index 92000c9d58..a8e3f7d8ff 100644
--- a/main/contrib/NRefactory/Project/Src/Lexer/Special/BlankLine.cs
+++ b/main/contrib/NRefactory/Project/Src/Lexer/Special/BlankLine.cs
@@ -1,23 +1,23 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="none" email=""/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-
-namespace ICSharpCode.NRefactory
-{
- public class BlankLine : AbstractSpecial
- {
- public BlankLine(Location point) : base(point)
- {
- }
-
- public override object AcceptVisitor(ISpecialVisitor visitor, object data)
- {
- return visitor.Visit(this, data);
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="none" email=""/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+
+namespace ICSharpCode.NRefactory
+{
+ public class BlankLine : AbstractSpecial
+ {
+ public BlankLine(Location point) : base(point)
+ {
+ }
+
+ public override object AcceptVisitor(ISpecialVisitor visitor, object data)
+ {
+ return visitor.Visit(this, data);
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Lexer/Special/Comment.cs b/main/contrib/NRefactory/Project/Src/Lexer/Special/Comment.cs
index ac5c8e529c..610bf57ae7 100644
--- a/main/contrib/NRefactory/Project/Src/Lexer/Special/Comment.cs
+++ b/main/contrib/NRefactory/Project/Src/Lexer/Special/Comment.cs
@@ -1,63 +1,63 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="none" email=""/>
-// <version>$Revision: 1965M $</version>
-// </file>
-
-using System;
-
-namespace ICSharpCode.NRefactory
-{
- public class Comment : AbstractSpecial
- {
- CommentType commentType;
- string comment;
-
- public CommentType CommentType {
- get {
- return commentType;
- }
- set {
- commentType = value;
- }
- }
-
- public string CommentText {
- get {
- return comment;
- }
- set {
- comment = value;
- }
- }
-
- /// <value>
- /// Is true, when the comment is at line start or only whitespaces
- /// between line and comment start.
- /// </value>
- public bool CommentStartsLine {
- get;
- set;
- }
-
- public Comment(CommentType commentType, string comment, bool commentStartsLine, Location startPosition, Location endPosition)
- : base(startPosition, endPosition)
- {
- this.commentType = commentType;
- this.comment = comment;
- this.CommentStartsLine = commentStartsLine;
- }
-
- public override string ToString()
- {
- return String.Format("[{0}: Type = {1}, Text = {2}, Start = {3}, End = {4}]",
- GetType().Name, CommentType, CommentText, StartPosition, EndPosition);
- }
-
- public override object AcceptVisitor(ISpecialVisitor visitor, object data)
- {
- return visitor.Visit(this, data);
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="none" email=""/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+
+namespace ICSharpCode.NRefactory
+{
+ public class Comment : AbstractSpecial
+ {
+ CommentType commentType;
+ string comment;
+
+ public CommentType CommentType {
+ get {
+ return commentType;
+ }
+ set {
+ commentType = value;
+ }
+ }
+
+ public string CommentText {
+ get {
+ return comment;
+ }
+ set {
+ comment = value;
+ }
+ }
+
+ /// <value>
+ /// Is true, when the comment is at line start or only whitespaces
+ /// between line and comment start.
+ /// </value>
+ public bool CommentStartsLine {
+ get;
+ set;
+ }
+
+ public Comment(CommentType commentType, string comment, bool commentStartsLine, Location startPosition, Location endPosition)
+ : base(startPosition, endPosition)
+ {
+ this.commentType = commentType;
+ this.comment = comment;
+ this.CommentStartsLine = commentStartsLine;
+ }
+
+ public override string ToString()
+ {
+ return String.Format("[{0}: Type = {1}, Text = {2}, Start = {3}, End = {4}]",
+ GetType().Name, CommentType, CommentText, StartPosition, EndPosition);
+ }
+
+ public override object AcceptVisitor(ISpecialVisitor visitor, object data)
+ {
+ return visitor.Visit(this, data);
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Lexer/Special/CommentType.cs b/main/contrib/NRefactory/Project/Src/Lexer/Special/CommentType.cs
index 6feba71bb7..62396861c4 100644
--- a/main/contrib/NRefactory/Project/Src/Lexer/Special/CommentType.cs
+++ b/main/contrib/NRefactory/Project/Src/Lexer/Special/CommentType.cs
@@ -1,18 +1,18 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="none" email=""/>
-// <version>$Revision: 1965 $</version>
-// </file>
-
-using System;
-
-namespace ICSharpCode.NRefactory
-{
- public enum CommentType
- {
- Block,
- SingleLine,
- Documentation
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="none" email=""/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+
+namespace ICSharpCode.NRefactory
+{
+ public enum CommentType
+ {
+ Block,
+ SingleLine,
+ Documentation
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Lexer/Special/ISpecial.cs b/main/contrib/NRefactory/Project/Src/Lexer/Special/ISpecial.cs
index 9e3287f67c..428b860476 100644
--- a/main/contrib/NRefactory/Project/Src/Lexer/Special/ISpecial.cs
+++ b/main/contrib/NRefactory/Project/Src/Lexer/Special/ISpecial.cs
@@ -1,56 +1,56 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 2972 $</version>
-// </file>
-
-using System;
-
-namespace ICSharpCode.NRefactory
-{
- /// <summary>
- /// Interface for all specials.
- /// </summary>
- public interface ISpecial
- {
- Location StartPosition { get; }
- Location EndPosition { get; }
-
- object AcceptVisitor(ISpecialVisitor visitor, object data);
- }
-
- public interface ISpecialVisitor
- {
- object Visit(ISpecial special, object data);
- object Visit(BlankLine special, object data);
- object Visit(Comment special, object data);
- object Visit(PreprocessingDirective special, object data);
- }
-
- public abstract class AbstractSpecial : ISpecial
- {
- public abstract object AcceptVisitor(ISpecialVisitor visitor, object data);
-
- protected AbstractSpecial(Location position)
- {
- this.StartPosition = position;
- this.EndPosition = position;
- }
-
- protected AbstractSpecial(Location startPosition, Location endPosition)
- {
- this.StartPosition = startPosition;
- this.EndPosition = endPosition;
- }
-
- public Location StartPosition { get; set; }
- public Location EndPosition { get; set; }
-
- public override string ToString()
- {
- return String.Format("[{0}: Start = {1}, End = {2}]",
- GetType().Name, StartPosition, EndPosition);
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+
+namespace ICSharpCode.NRefactory
+{
+ /// <summary>
+ /// Interface for all specials.
+ /// </summary>
+ public interface ISpecial
+ {
+ Location StartPosition { get; }
+ Location EndPosition { get; }
+
+ object AcceptVisitor(ISpecialVisitor visitor, object data);
+ }
+
+ public interface ISpecialVisitor
+ {
+ object Visit(ISpecial special, object data);
+ object Visit(BlankLine special, object data);
+ object Visit(Comment special, object data);
+ object Visit(PreprocessingDirective special, object data);
+ }
+
+ public abstract class AbstractSpecial : ISpecial
+ {
+ public abstract object AcceptVisitor(ISpecialVisitor visitor, object data);
+
+ protected AbstractSpecial(Location position)
+ {
+ this.StartPosition = position;
+ this.EndPosition = position;
+ }
+
+ protected AbstractSpecial(Location startPosition, Location endPosition)
+ {
+ this.StartPosition = startPosition;
+ this.EndPosition = endPosition;
+ }
+
+ public Location StartPosition { get; set; }
+ public Location EndPosition { get; set; }
+
+ public override string ToString()
+ {
+ return String.Format("[{0}: Start = {1}, End = {2}]",
+ GetType().Name, StartPosition, EndPosition);
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Lexer/Special/PreProcessingDirective.cs b/main/contrib/NRefactory/Project/Src/Lexer/Special/PreProcessingDirective.cs
index 85a00d717a..fedaee1780 100644
--- a/main/contrib/NRefactory/Project/Src/Lexer/Special/PreProcessingDirective.cs
+++ b/main/contrib/NRefactory/Project/Src/Lexer/Special/PreProcessingDirective.cs
@@ -1,160 +1,160 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="none" email=""/>
-// <version>$Revision: 3831M $</version>
-// </file>
-
-using System;
-using System.Collections.Generic;
-
-namespace ICSharpCode.NRefactory
-{
- public class PreprocessingDirective : AbstractSpecial
- {
- #region Conversion C# <-> VB
- public static void VBToCSharp(IList<ISpecial> list)
- {
- for (int i = 0; i < list.Count; ++i) {
- if (list[i] is PreprocessingDirective)
- list[i] = VBToCSharp((PreprocessingDirective)list[i]);
- }
- }
-
- public static PreprocessingDirective VBToCSharp(PreprocessingDirective dir)
- {
- string cmd = dir.Cmd;
- string arg = dir.Arg;
- if (cmd.Equals("#End", StringComparison.InvariantCultureIgnoreCase)) {
- if (arg.ToLowerInvariant().StartsWith("region")) {
- cmd = "#endregion";
- arg = "";
- } else if ("if".Equals(arg, StringComparison.InvariantCultureIgnoreCase)) {
- cmd = "#endif";
- arg = "";
- }
- } else if (cmd.Equals("#Region", StringComparison.InvariantCultureIgnoreCase)) {
- cmd = "#region";
- } else if (cmd.Equals("#If", StringComparison.InvariantCultureIgnoreCase)) {
- cmd = "#if";
- if (arg.ToLowerInvariant().EndsWith(" then"))
- arg = arg.Substring(0, arg.Length - 5);
- } else if (cmd.Equals("#Else", StringComparison.InvariantCultureIgnoreCase)) {
- if (dir.Expression != null)
- cmd = "#elif";
- else
- cmd = "#else";
- } else if (cmd.Equals("#ElseIf", StringComparison.InvariantCultureIgnoreCase)) {
- cmd = "#elif";
- }
- return new PreprocessingDirective(cmd, arg, dir.StartPosition, dir.EndPosition) {
- Expression = dir.Expression
- };
- }
-
- public static void CSharpToVB(List<ISpecial> list)
- {
- for (int i = 0; i < list.Count; ++i) {
- if (list[i] is PreprocessingDirective)
- list[i] = CSharpToVB((PreprocessingDirective)list[i]);
- }
- }
-
- public static PreprocessingDirective CSharpToVB(PreprocessingDirective dir)
- {
- string cmd = dir.Cmd;
- string arg = dir.Arg;
- switch (cmd) {
- case "#region":
- cmd = "#Region";
- if (!arg.StartsWith("\"")) {
- arg = "\"" + arg.Trim() + "\"";
- }
- break;
- case "#endregion":
- cmd = "#End";
- arg = "Region";
- break;
- case "#endif":
- cmd = "#End";
- arg = "If";
- break;
- case "#if":
- arg += " Then";
- break;
- }
- if (cmd.Length > 1) {
- cmd = cmd.Substring(0, 2).ToUpperInvariant() + cmd.Substring(2);
- }
- return new PreprocessingDirective(cmd, arg, dir.StartPosition, dir.EndPosition) {
- Expression = dir.Expression
- };
- }
- #endregion
-
- string cmd;
- string arg;
- Ast.Expression expression = Ast.Expression.Null;
-
- /// <summary>
- /// Gets the directive name, including '#'.
- /// </summary>
- public string Cmd {
- get {
- return cmd;
- }
- set {
- cmd = value ?? string.Empty;
- }
- }
-
- /// <summary>
- /// Gets the directive argument.
- /// </summary>
- public string Arg {
- get {
- return arg;
- }
- set {
- arg = value ?? string.Empty;
- }
- }
-
- /// <summary>
- /// Gets/sets the expression (for directives that take an expression, e.g. #if and #elif).
- /// </summary>
- public Ast.Expression Expression {
- get { return expression; }
- set { expression = value ?? Ast.Expression.Null; }
- }
-
- /// <value>
- /// The end position of the pre processor directive line.
- /// May be != EndPosition.
- /// </value>
- public Location LastLineEnd {
- get;
- set;
- }
-
-
- public override string ToString()
- {
- return String.Format("[PreProcessingDirective: Cmd = {0}, Arg = {1}]",
- Cmd,
- Arg);
- }
-
- public PreprocessingDirective(string cmd, string arg, Location start, Location end)
- : base(start, end)
- {
- this.Cmd = cmd;
- this.Arg = arg;
- }
-
- public override object AcceptVisitor(ISpecialVisitor visitor, object data)
- {
- return visitor.Visit(this, data);
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="none" email=""/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+using System.Collections.Generic;
+
+namespace ICSharpCode.NRefactory
+{
+ public class PreprocessingDirective : AbstractSpecial
+ {
+ #region Conversion C# <-> VB
+ public static void VBToCSharp(IList<ISpecial> list)
+ {
+ for (int i = 0; i < list.Count; ++i) {
+ if (list[i] is PreprocessingDirective)
+ list[i] = VBToCSharp((PreprocessingDirective)list[i]);
+ }
+ }
+
+ public static PreprocessingDirective VBToCSharp(PreprocessingDirective dir)
+ {
+ string cmd = dir.Cmd;
+ string arg = dir.Arg;
+ if (cmd.Equals("#End", StringComparison.InvariantCultureIgnoreCase)) {
+ if (arg.ToLowerInvariant().StartsWith("region")) {
+ cmd = "#endregion";
+ arg = "";
+ } else if ("if".Equals(arg, StringComparison.InvariantCultureIgnoreCase)) {
+ cmd = "#endif";
+ arg = "";
+ }
+ } else if (cmd.Equals("#Region", StringComparison.InvariantCultureIgnoreCase)) {
+ cmd = "#region";
+ } else if (cmd.Equals("#If", StringComparison.InvariantCultureIgnoreCase)) {
+ cmd = "#if";
+ if (arg.ToLowerInvariant().EndsWith(" then"))
+ arg = arg.Substring(0, arg.Length - 5);
+ } else if (cmd.Equals("#Else", StringComparison.InvariantCultureIgnoreCase)) {
+ if (dir.Expression != null)
+ cmd = "#elif";
+ else
+ cmd = "#else";
+ } else if (cmd.Equals("#ElseIf", StringComparison.InvariantCultureIgnoreCase)) {
+ cmd = "#elif";
+ }
+ return new PreprocessingDirective(cmd, arg, dir.StartPosition, dir.EndPosition) {
+ Expression = dir.Expression
+ };
+ }
+
+ public static void CSharpToVB(List<ISpecial> list)
+ {
+ for (int i = 0; i < list.Count; ++i) {
+ if (list[i] is PreprocessingDirective)
+ list[i] = CSharpToVB((PreprocessingDirective)list[i]);
+ }
+ }
+
+ public static PreprocessingDirective CSharpToVB(PreprocessingDirective dir)
+ {
+ string cmd = dir.Cmd;
+ string arg = dir.Arg;
+ switch (cmd) {
+ case "#region":
+ cmd = "#Region";
+ if (!arg.StartsWith("\"")) {
+ arg = "\"" + arg.Trim() + "\"";
+ }
+ break;
+ case "#endregion":
+ cmd = "#End";
+ arg = "Region";
+ break;
+ case "#endif":
+ cmd = "#End";
+ arg = "If";
+ break;
+ case "#if":
+ arg += " Then";
+ break;
+ }
+ if (cmd.Length > 1) {
+ cmd = cmd.Substring(0, 2).ToUpperInvariant() + cmd.Substring(2);
+ }
+ return new PreprocessingDirective(cmd, arg, dir.StartPosition, dir.EndPosition) {
+ Expression = dir.Expression
+ };
+ }
+ #endregion
+
+ string cmd;
+ string arg;
+ Ast.Expression expression = Ast.Expression.Null;
+
+ /// <summary>
+ /// Gets the directive name, including '#'.
+ /// </summary>
+ public string Cmd {
+ get {
+ return cmd;
+ }
+ set {
+ cmd = value ?? string.Empty;
+ }
+ }
+
+ /// <summary>
+ /// Gets the directive argument.
+ /// </summary>
+ public string Arg {
+ get {
+ return arg;
+ }
+ set {
+ arg = value ?? string.Empty;
+ }
+ }
+
+ /// <summary>
+ /// Gets/sets the expression (for directives that take an expression, e.g. #if and #elif).
+ /// </summary>
+ public Ast.Expression Expression {
+ get { return expression; }
+ set { expression = value ?? Ast.Expression.Null; }
+ }
+
+ /// <value>
+ /// The end position of the pre processor directive line.
+ /// May be != EndPosition.
+ /// </value>
+ public Location LastLineEnd {
+ get;
+ set;
+ }
+
+
+ public override string ToString()
+ {
+ return String.Format("[PreProcessingDirective: Cmd = {0}, Arg = {1}]",
+ Cmd,
+ Arg);
+ }
+
+ public PreprocessingDirective(string cmd, string arg, Location start, Location end)
+ : base(start, end)
+ {
+ this.Cmd = cmd;
+ this.Arg = arg;
+ }
+
+ public override object AcceptVisitor(ISpecialVisitor visitor, object data)
+ {
+ return visitor.Visit(this, data);
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Lexer/Special/SpecialTracker.cs b/main/contrib/NRefactory/Project/Src/Lexer/Special/SpecialTracker.cs
index 5f417e6d0b..2f1723f85b 100644
--- a/main/contrib/NRefactory/Project/Src/Lexer/Special/SpecialTracker.cs
+++ b/main/contrib/NRefactory/Project/Src/Lexer/Special/SpecialTracker.cs
@@ -1,80 +1,80 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="none" email=""/>
-// <version>$Revision: 2972M $</version>
-// </file>
-
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace ICSharpCode.NRefactory.Parser
-{
- public class SpecialTracker
- {
- List<ISpecial> currentSpecials = new List<ISpecial>();
-
- CommentType currentCommentType;
- StringBuilder sb = new StringBuilder();
- Location startPosition;
- bool commentStartsLine;
-
- public List<ISpecial> CurrentSpecials {
- get {
- return currentSpecials;
- }
- }
-
- public void InformToken(int kind)
- {
-
- }
-
- /// <summary>
- /// Gets the specials from the SpecialTracker and resets the lists.
- /// </summary>
- public List<ISpecial> RetrieveSpecials()
- {
- List<ISpecial> tmp = currentSpecials;
- currentSpecials = new List<ISpecial>();
- return tmp;
- }
-
- public void AddEndOfLine(Location point)
- {
- currentSpecials.Add(new BlankLine(point));
- }
-
- public void AddPreprocessingDirective(PreprocessingDirective directive)
- {
- if (directive == null)
- throw new ArgumentNullException("directive");
- currentSpecials.Add(directive);
- }
-
- // used for comment tracking
- public void StartComment(CommentType commentType, bool commentStartsLine, Location startPosition)
- {
- this.currentCommentType = commentType;
- this.startPosition = startPosition;
- this.sb.Length = 0;
- this.commentStartsLine = commentStartsLine;
- }
-
- public void AddChar(char c)
- {
- sb.Append(c);
- }
-
- public void AddString(string s)
- {
- sb.Append(s);
- }
-
- public void FinishComment(Location endPosition)
- {
- currentSpecials.Add(new Comment(currentCommentType, sb.ToString(), commentStartsLine, startPosition, endPosition));
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="none" email=""/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ICSharpCode.NRefactory.Parser
+{
+ public class SpecialTracker
+ {
+ List<ISpecial> currentSpecials = new List<ISpecial>();
+
+ CommentType currentCommentType;
+ StringBuilder sb = new StringBuilder();
+ Location startPosition;
+ bool commentStartsLine;
+
+ public List<ISpecial> CurrentSpecials {
+ get {
+ return currentSpecials;
+ }
+ }
+
+ public void InformToken(int kind)
+ {
+
+ }
+
+ /// <summary>
+ /// Gets the specials from the SpecialTracker and resets the lists.
+ /// </summary>
+ public List<ISpecial> RetrieveSpecials()
+ {
+ List<ISpecial> tmp = currentSpecials;
+ currentSpecials = new List<ISpecial>();
+ return tmp;
+ }
+
+ public void AddEndOfLine(Location point)
+ {
+ currentSpecials.Add(new BlankLine(point));
+ }
+
+ public void AddPreprocessingDirective(PreprocessingDirective directive)
+ {
+ if (directive == null)
+ throw new ArgumentNullException("directive");
+ currentSpecials.Add(directive);
+ }
+
+ // used for comment tracking
+ public void StartComment(CommentType commentType, bool commentStartsLine, Location startPosition)
+ {
+ this.currentCommentType = commentType;
+ this.startPosition = startPosition;
+ this.sb.Length = 0;
+ this.commentStartsLine = commentStartsLine;
+ }
+
+ public void AddChar(char c)
+ {
+ sb.Append(c);
+ }
+
+ public void AddString(string s)
+ {
+ sb.Append(s);
+ }
+
+ public void FinishComment(Location endPosition)
+ {
+ currentSpecials.Add(new Comment(currentCommentType, sb.ToString(), commentStartsLine, startPosition, endPosition));
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Lexer/Special/TagComment.cs b/main/contrib/NRefactory/Project/Src/Lexer/Special/TagComment.cs
index c00e6733e6..4af7c656b2 100644
--- a/main/contrib/NRefactory/Project/Src/Lexer/Special/TagComment.cs
+++ b/main/contrib/NRefactory/Project/Src/Lexer/Special/TagComment.cs
@@ -1,33 +1,33 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="none" email=""/>
-// <version>$Revision: 1965M $</version>
-// </file>
-
-using System;
-
-namespace ICSharpCode.NRefactory.Parser
-{
- /// <summary>
- /// Description of TagComment.
- /// </summary>
- public class TagComment : Comment
- {
- string tag;
-
- public string Tag {
- get {
- return tag;
- }
- set {
- tag = value;
- }
- }
-
- public TagComment(string tag, string comment, bool commentStartsLine, Location startPosition, Location endPosition) : base(CommentType.SingleLine, comment, commentStartsLine, startPosition, endPosition)
- {
- this.tag = tag;
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="none" email=""/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+
+namespace ICSharpCode.NRefactory.Parser
+{
+ /// <summary>
+ /// Description of TagComment.
+ /// </summary>
+ public class TagComment : Comment
+ {
+ string tag;
+
+ public string Tag {
+ get {
+ return tag;
+ }
+ set {
+ tag = value;
+ }
+ }
+
+ public TagComment(string tag, string comment, bool commentStartsLine, Location startPosition, Location endPosition) : base(CommentType.SingleLine, comment, commentStartsLine, startPosition, endPosition)
+ {
+ this.tag = tag;
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Lexer/Token.cs b/main/contrib/NRefactory/Project/Src/Lexer/Token.cs
index 1f808ccfba..05289e1e3f 100644
--- a/main/contrib/NRefactory/Project/Src/Lexer/Token.cs
+++ b/main/contrib/NRefactory/Project/Src/Lexer/Token.cs
@@ -1,105 +1,105 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 3715 $</version>
-// </file>
-
-using System;
-
-namespace ICSharpCode.NRefactory.Parser
-{
- public enum LiteralFormat : byte
- {
- None,
- DecimalNumber,
- HexadecimalNumber,
- OctalNumber,
- StringLiteral,
- VerbatimStringLiteral,
- CharLiteral,
- DateTimeLiteral
- }
-
- public class Token
- {
- internal readonly int kind;
-
- internal readonly int col;
- internal readonly int line;
-
- internal readonly LiteralFormat literalFormat;
- internal readonly object literalValue;
- internal readonly string val;
- internal Token next;
- readonly Location endLocation;
-
- public int Kind {
- get { return kind; }
- }
-
- public LiteralFormat LiteralFormat {
- get { return literalFormat; }
- }
-
- public object LiteralValue {
- get { return literalValue; }
- }
-
- public string Value {
- get { return val; }
- }
-
- public Location EndLocation {
- get { return endLocation; }
- }
-
- public Location Location {
- get {
- return new Location(col, line);
- }
- }
-
- public Token(int kind) : this(kind, 0, 0)
- {
- }
-
- public Token(int kind, int col, int line) : this (kind, col, line, null)
- {
- }
-
- public Token(int kind, int col, int line, string val)
- {
- this.kind = kind;
- this.col = col;
- this.line = line;
- this.val = val;
- this.endLocation = new Location(col + (string.IsNullOrEmpty(val) ? 1 : val.Length), line);
- }
-
- internal Token(int kind, int x, int y, string val, object literalValue, LiteralFormat literalFormat)
- : this(kind, new Location(x, y), new Location(x + val.Length, y), val, literalValue, literalFormat)
- {
- }
-
- public Token(int kind, Location startLocation, Location endLocation, string val, object literalValue, LiteralFormat literalFormat)
- {
- this.kind = kind;
- this.col = startLocation.Column;
- this.line = startLocation.Line;
- this.endLocation = endLocation;
- this.val = val;
- this.literalValue = literalValue;
- this.literalFormat = literalFormat;
- }
-
- public override string ToString()
- {
- return string.Format("[C# {0}/VB {1} Location={3} EndLocation={4} val={5}]",
- CSharp.Tokens.GetTokenString(kind),
- VB.Tokens.GetTokenString(kind),
- Location, EndLocation, val);
-
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+
+namespace ICSharpCode.NRefactory.Parser
+{
+ public enum LiteralFormat : byte
+ {
+ None,
+ DecimalNumber,
+ HexadecimalNumber,
+ OctalNumber,
+ StringLiteral,
+ VerbatimStringLiteral,
+ CharLiteral,
+ DateTimeLiteral
+ }
+
+ public class Token
+ {
+ internal readonly int kind;
+
+ internal readonly int col;
+ internal readonly int line;
+
+ internal readonly LiteralFormat literalFormat;
+ internal readonly object literalValue;
+ internal readonly string val;
+ internal Token next;
+ readonly Location endLocation;
+
+ public int Kind {
+ get { return kind; }
+ }
+
+ public LiteralFormat LiteralFormat {
+ get { return literalFormat; }
+ }
+
+ public object LiteralValue {
+ get { return literalValue; }
+ }
+
+ public string Value {
+ get { return val; }
+ }
+
+ public Location EndLocation {
+ get { return endLocation; }
+ }
+
+ public Location Location {
+ get {
+ return new Location(col, line);
+ }
+ }
+
+ public Token(int kind) : this(kind, 0, 0)
+ {
+ }
+
+ public Token(int kind, int col, int line) : this (kind, col, line, null)
+ {
+ }
+
+ public Token(int kind, int col, int line, string val)
+ {
+ this.kind = kind;
+ this.col = col;
+ this.line = line;
+ this.val = val;
+ this.endLocation = new Location(col + (string.IsNullOrEmpty(val) ? 1 : val.Length), line);
+ }
+
+ internal Token(int kind, int x, int y, string val, object literalValue, LiteralFormat literalFormat)
+ : this(kind, new Location(x, y), new Location(x + val.Length, y), val, literalValue, literalFormat)
+ {
+ }
+
+ public Token(int kind, Location startLocation, Location endLocation, string val, object literalValue, LiteralFormat literalFormat)
+ {
+ this.kind = kind;
+ this.col = startLocation.Column;
+ this.line = startLocation.Line;
+ this.endLocation = endLocation;
+ this.val = val;
+ this.literalValue = literalValue;
+ this.literalFormat = literalFormat;
+ }
+
+ public override string ToString()
+ {
+ return string.Format("[C# {0}/VB {1} Location={3} EndLocation={4} val={5}]",
+ CSharp.Tokens.GetTokenString(kind),
+ VB.Tokens.GetTokenString(kind),
+ Location, EndLocation, val);
+
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Lexer/VBNet/Lexer.cs b/main/contrib/NRefactory/Project/Src/Lexer/VBNet/Lexer.cs
index 7e02fedfc7..483795dc43 100644
--- a/main/contrib/NRefactory/Project/Src/Lexer/VBNet/Lexer.cs
+++ b/main/contrib/NRefactory/Project/Src/Lexer/VBNet/Lexer.cs
@@ -1,761 +1,761 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Andrea Paatz" email="andrea@icsharpcode.net"/>
-// <version>$Revision: 3717M $</version>
-// </file>
-
-using System;
-using System.Globalization;
-using System.IO;
-using System.Text;
-
-namespace ICSharpCode.NRefactory.Parser.VB
-{
- internal sealed class Lexer : AbstractLexer
- {
- bool lineEnd = true;
- bool isAtLineBegin = false; // TODO: handle line begin, if neccessarry
-
- public Lexer(TextReader reader) : base(reader)
- {
- }
-
- public override Token NextToken()
- {
- if (curToken == null) { // first call of NextToken()
- curToken = Next();
- specialTracker.InformToken(curToken.kind);
- //Console.WriteLine("Tok:" + Tokens.GetTokenString(curToken.kind) + " --- " + curToken.val);
- return curToken;
- }
-
- lastToken = curToken;
-
- if (curToken.next == null) {
- curToken.next = Next();
- specialTracker.InformToken(curToken.next.kind);
- }
-
- curToken = curToken.next;
-
- if (curToken.kind == Tokens.EOF && !(lastToken.kind == Tokens.EOL)) { // be sure that before EOF there is an EOL token
- curToken = new Token(Tokens.EOL, curToken.col, curToken.line, "\n");
- specialTracker.InformToken(curToken.kind);
- curToken.next = new Token(Tokens.EOF, curToken.col, curToken.line, "\n");
- specialTracker.InformToken(curToken.next.kind);
- }
- //Console.WriteLine("Tok:" + Tokens.GetTokenString(curToken.kind) + " --- " + curToken.val);
- return curToken;
- }
-
- bool misreadExclamationMarkAsTypeCharacter;
-
- protected override Token Next()
- {
- if (misreadExclamationMarkAsTypeCharacter) {
- misreadExclamationMarkAsTypeCharacter = false;
- return new Token(Tokens.ExclamationMark, Col - 1, Line);
- }
- unchecked {
- while (true) {
- Location startLocation = new Location(Col, Line);
- int nextChar = ReaderRead();
- if (nextChar == -1)
- return new Token(Tokens.EOF);
- char ch = (char)nextChar;
- if (Char.IsWhiteSpace(ch)) {
- if (HandleLineEnd(ch)) {
- if (lineEnd) {
- // second line end before getting to a token
- // -> here was a blank line
- specialTracker.AddEndOfLine(startLocation);
- } else {
- lineEnd = true;
- return new Token(Tokens.EOL, startLocation, new Location(Col, Line), null, null, LiteralFormat.None);
- }
- }
- continue;
- }
- if (ch == '_') {
- if (ReaderPeek() == -1) {
- errors.Error(Line, Col, String.Format("No EOF expected after _"));
- return new Token(Tokens.EOF);
- }
- if (!Char.IsWhiteSpace((char)ReaderPeek())) {
- int x = Col - 1;
- int y = Line;
- string s = ReadIdent('_');
- lineEnd = false;
- return new Token(Tokens.Identifier, x, y, s);
- }
- ch = (char)ReaderRead();
-
- bool oldLineEnd = lineEnd;
- lineEnd = false;
- while (Char.IsWhiteSpace(ch)) {
- if (HandleLineEnd(ch)) {
- lineEnd = true;
- break;
- }
- if (ReaderPeek() != -1) {
- ch = (char)ReaderRead();
- } else {
- errors.Error(Line, Col, String.Format("No EOF expected after _"));
- return new Token(Tokens.EOF);
- }
- }
- if (!lineEnd) {
- errors.Error(Line, Col, String.Format("Return expected"));
- }
- lineEnd = oldLineEnd;
- continue;
- }
-
- if (ch == '#') {
- while (Char.IsWhiteSpace((char)ReaderPeek())) {
- ReaderRead();
- }
- if (Char.IsDigit((char)ReaderPeek())) {
- int x = Col - 1;
- int y = Line;
- string s = ReadDate();
- DateTime time = new DateTime(1, 1, 1, 0, 0, 0);
- try {
- time = DateTime.Parse(s, System.Globalization.CultureInfo.InvariantCulture, DateTimeStyles.NoCurrentDateDefault);
- } catch (Exception e) {
- errors.Error(Line, Col, String.Format("Invalid date time {0}", e));
- }
- return new Token(Tokens.LiteralDate, x, y, s, time, LiteralFormat.DateTimeLiteral);
- } else {
- ReadPreprocessorDirective();
- continue;
- }
- }
-
- if (ch == '[') { // Identifier
- lineEnd = false;
- if (ReaderPeek() == -1) {
- errors.Error(Line, Col, String.Format("Identifier expected"));
- }
- ch = (char)ReaderRead();
- if (ch == ']' || Char.IsWhiteSpace(ch)) {
- errors.Error(Line, Col, String.Format("Identifier expected"));
- }
- int x = Col - 1;
- int y = Line;
- string s = ReadIdent(ch);
- if (ReaderPeek() == -1) {
- errors.Error(Line, Col, String.Format("']' expected"));
- }
- ch = (char)ReaderRead();
- if (!(ch == ']')) {
- errors.Error(Line, Col, String.Format("']' expected"));
- }
- return new Token(Tokens.Identifier, x, y, s);
- }
- if (Char.IsLetter(ch)) {
- int x = Col - 1;
- int y = Line;
- char typeCharacter;
- string s = ReadIdent(ch, out typeCharacter);
- if (typeCharacter == '\0') {
- int keyWordToken = Keywords.GetToken(s);
- if (keyWordToken >= 0) {
- // handle 'REM' comments
- if (keyWordToken == Tokens.Rem) {
- ReadComment();
- if (!lineEnd) {
- lineEnd = true;
- return new Token(Tokens.EOL, Col, Line, "\n");
- }
- continue;
- }
-
- lineEnd = false;
- return new Token(keyWordToken, x, y, s);
- }
- }
-
- lineEnd = false;
- return new Token(Tokens.Identifier, x, y, s);
-
- }
- if (Char.IsDigit(ch)) {
- lineEnd = false;
- return ReadDigit(ch, Col - 1);
- }
- if (ch == '&') {
- lineEnd = false;
- if (ReaderPeek() == -1) {
- return ReadOperator('&');
- }
- ch = (char)ReaderPeek();
- if (Char.ToUpper(ch, CultureInfo.InvariantCulture) == 'H' || Char.ToUpper(ch, CultureInfo.InvariantCulture) == 'O') {
- return ReadDigit('&', Col - 1);
- }
- return ReadOperator('&');
- }
- if (ch == '\'' || ch == '\u2018' || ch == '\u2019') {
- int x = Col - 1;
- int y = Line;
- ReadComment();
- if (!lineEnd) {
- lineEnd = true;
- return new Token(Tokens.EOL, x, y, "\n");
- }
- continue;
- }
- if (ch == '"') {
- lineEnd = false;
- int x = Col - 1;
- int y = Line;
- string s = ReadString();
- if (ReaderPeek() != -1 && (ReaderPeek() == 'C' || ReaderPeek() == 'c')) {
- ReaderRead();
- if (s.Length != 1) {
- errors.Error(Line, Col, String.Format("Chars can only have Length 1 "));
- }
- if (s.Length == 0) {
- s = "\0";
- }
- return new Token(Tokens.LiteralCharacter, x, y, '"' + s + "\"C", s[0], LiteralFormat.CharLiteral);
- }
- return new Token(Tokens.LiteralString, x, y, '"' + s + '"', s, LiteralFormat.StringLiteral);
- }
- Token token = ReadOperator(ch);
- if (token != null) {
- lineEnd = false;
- return token;
- }
- errors.Error(Line, Col, String.Format("Unknown char({0}) which can't be read", ch));
- }
- }
- }
-
- string ReadIdent(char ch)
- {
- char typeCharacter;
- return ReadIdent(ch, out typeCharacter);
- }
-
- string ReadIdent(char ch, out char typeCharacter)
- {
- typeCharacter = '\0';
-
- sb.Length = 0;
- sb.Append(ch);
- int peek;
- while ((peek = ReaderPeek()) != -1 && (Char.IsLetterOrDigit(ch = (char)peek) || ch == '_')) {
- ReaderRead();
- sb.Append(ch.ToString());
- }
- if (peek == -1) {
- return sb.ToString();
- }
-
- if ("%&@!#$".IndexOf((char)peek) != -1) {
- typeCharacter = (char)peek;
- ReaderRead();
- if (typeCharacter == '!') {
- peek = ReaderPeek();
- if (peek != -1 && (peek == '_' || peek == '[' || char.IsLetter((char)peek))) {
- misreadExclamationMarkAsTypeCharacter = true;
- }
- }
- }
- return sb.ToString();
- }
-
- char PeekUpperChar()
- {
- return Char.ToUpper((char)ReaderPeek(), CultureInfo.InvariantCulture);
- }
-
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1818:DoNotConcatenateStringsInsideLoops")]
- Token ReadDigit(char ch, int x)
- {
- sb.Length = 0;
- sb.Append(ch);
-
- int y = Line;
- string digit = "";
- if (ch != '&') {
- digit += ch;
- }
-
- bool ishex = false;
- bool isokt = false;
- bool issingle = false;
- bool isdouble = false;
- bool isdecimal = false;
-
- if (ReaderPeek() == -1) {
- if (ch == '&') {
- errors.Error(Line, Col, String.Format("digit expected"));
- }
- return new Token(Tokens.LiteralInteger, x, y, sb.ToString() ,ch - '0', LiteralFormat.DecimalNumber);
- }
- if (ch == '.') {
- if (Char.IsDigit((char)ReaderPeek())) {
- isdouble = true; // double is default
- if (ishex || isokt) {
- errors.Error(Line, Col, String.Format("No hexadecimal or oktadecimal floating point values allowed"));
- }
- while (ReaderPeek() != -1 && Char.IsDigit((char)ReaderPeek())){ // read decimal digits beyond the dot
- digit += (char)ReaderRead();
- }
- }
- } else if (ch == '&' && PeekUpperChar() == 'H') {
- const string hex = "0123456789ABCDEF";
- sb.Append((char)ReaderRead()); // skip 'H'
- while (ReaderPeek() != -1 && hex.IndexOf(PeekUpperChar()) != -1) {
- ch = (char)ReaderRead();
- sb.Append(ch);
- digit += Char.ToUpper(ch, CultureInfo.InvariantCulture);
- }
- ishex = true;
- } else if (ReaderPeek() != -1 && ch == '&' && PeekUpperChar() == 'O') {
- const string okt = "01234567";
- sb.Append((char)ReaderRead()); // skip 'O'
- while (ReaderPeek() != -1 && okt.IndexOf(PeekUpperChar()) != -1) {
- ch = (char)ReaderRead();
- sb.Append(ch);
- digit += Char.ToUpper(ch, CultureInfo.InvariantCulture);
- }
- isokt = true;
- } else {
- while (ReaderPeek() != -1 && Char.IsDigit((char)ReaderPeek())) {
- ch = (char)ReaderRead();;
- digit += ch;
- sb.Append(ch);
- }
- }
-
- if (digit.Length == 0) {
- errors.Error(Line, Col, String.Format("digit expected"));
- return new Token(Tokens.LiteralInteger, x, y, sb.ToString(), 0, LiteralFormat.DecimalNumber);
- }
-
- if (ReaderPeek() != -1 && "%&SILU".IndexOf(PeekUpperChar()) != -1 || ishex || isokt) {
- bool unsigned = false;
- if (ReaderPeek() != -1) {
- ch = (char)ReaderPeek();
- sb.Append(ch);
- ch = Char.ToUpper(ch, CultureInfo.InvariantCulture);
- unsigned = ch == 'U';
- if (unsigned) {
- ReaderRead(); // read the U
- ch = (char)ReaderPeek();
- sb.Append(ch);
- ch = Char.ToUpper(ch, CultureInfo.InvariantCulture);
- if (ch != 'I' && ch != 'L' && ch != 'S') {
- errors.Error(Line, Col, "Invalid type character: U" + ch);
- }
- }
- }
- try {
- if (isokt) {
- ReaderRead();
- ulong number = 0L;
- for (int i = 0; i < digit.Length; ++i) {
- number = number * 8 + digit[i] - '0';
- }
- if (ch == 'S') {
- if (unsigned)
- return new Token(Tokens.LiteralInteger, x, y, sb.ToString(), (ushort)number, LiteralFormat.OctalNumber);
- else
- return new Token(Tokens.LiteralInteger, x, y, sb.ToString(), (short)number, LiteralFormat.OctalNumber);
- } else if (ch == '%' || ch == 'I') {
- if (unsigned)
- return new Token(Tokens.LiteralInteger, x, y, sb.ToString(), (uint)number, LiteralFormat.OctalNumber);
- else
- return new Token(Tokens.LiteralInteger, x, y, sb.ToString(), (int)number, LiteralFormat.OctalNumber);
- } else if (ch == '&' || ch == 'L') {
- if (unsigned)
- return new Token(Tokens.LiteralInteger, x, y, sb.ToString(), (ulong)number, LiteralFormat.OctalNumber);
- else
- return new Token(Tokens.LiteralInteger, x, y, sb.ToString(), (long)number, LiteralFormat.OctalNumber);
- } else {
- if (number > uint.MaxValue) {
- return new Token(Tokens.LiteralInteger, x, y, sb.ToString(), unchecked((long)number), LiteralFormat.OctalNumber);
- } else {
- return new Token(Tokens.LiteralInteger, x, y, sb.ToString(), unchecked((int)number), LiteralFormat.OctalNumber);
- }
- }
- }
- LiteralFormat literalFormat = ishex ? LiteralFormat.HexadecimalNumber : LiteralFormat.DecimalNumber;
- if (ch == 'S') {
- ReaderRead();
- if (unsigned)
- return new Token(Tokens.LiteralInteger, x, y, sb.ToString(), UInt16.Parse(digit, ishex ? NumberStyles.HexNumber : NumberStyles.Number), literalFormat);
- else
- return new Token(Tokens.LiteralInteger, x, y, sb.ToString(), Int16.Parse(digit, ishex ? NumberStyles.HexNumber : NumberStyles.Number), literalFormat);
- } else if (ch == '%' || ch == 'I') {
- ReaderRead();
- if (unsigned)
- return new Token(Tokens.LiteralInteger, x, y, sb.ToString(), UInt32.Parse(digit, ishex ? NumberStyles.HexNumber : NumberStyles.Number), literalFormat);
- else
- return new Token(Tokens.LiteralInteger, x, y, sb.ToString(), Int32.Parse(digit, ishex ? NumberStyles.HexNumber : NumberStyles.Number), literalFormat);
- } else if (ch == '&' || ch == 'L') {
- ReaderRead();
- if (unsigned)
- return new Token(Tokens.LiteralInteger, x, y, sb.ToString(), UInt64.Parse(digit, ishex ? NumberStyles.HexNumber : NumberStyles.Number), literalFormat);
- else
- return new Token(Tokens.LiteralInteger, x, y, sb.ToString(), Int64.Parse(digit, ishex ? NumberStyles.HexNumber : NumberStyles.Number), literalFormat);
- } else if (ishex) {
- ulong number = UInt64.Parse(digit, NumberStyles.HexNumber);
- if (number > uint.MaxValue) {
- return new Token(Tokens.LiteralInteger, x, y, sb.ToString(), unchecked((long)number), literalFormat);
- } else {
- return new Token(Tokens.LiteralInteger, x, y, sb.ToString(), unchecked((int)number), literalFormat);
- }
- }
- } catch (OverflowException ex) {
- errors.Error(Line, Col, ex.Message);
- return new Token(Tokens.LiteralInteger, x, y, sb.ToString(), 0, LiteralFormat.None);
- }
- }
- Token nextToken = null; // if we accedently read a 'dot'
- if (!isdouble && ReaderPeek() == '.') { // read floating point number
- ReaderRead();
- if (ReaderPeek() != -1 && Char.IsDigit((char)ReaderPeek())) {
- isdouble = true; // double is default
- if (ishex || isokt) {
- errors.Error(Line, Col, String.Format("No hexadecimal or oktadecimal floating point values allowed"));
- }
- digit += '.';
- while (ReaderPeek() != -1 && Char.IsDigit((char)ReaderPeek())){ // read decimal digits beyond the dot
- digit += (char)ReaderRead();
- }
- } else {
- nextToken = new Token(Tokens.Dot, Col - 1, Line);
- }
- }
-
- if (ReaderPeek() != -1 && PeekUpperChar() == 'E') { // read exponent
- isdouble = true;
- digit += (char)ReaderRead();
- if (ReaderPeek() != -1 && (ReaderPeek() == '-' || ReaderPeek() == '+')) {
- digit += (char)ReaderRead();
- }
- while (ReaderPeek() != -1 && Char.IsDigit((char)ReaderPeek())) { // read exponent value
- digit += (char)ReaderRead();
- }
- }
-
- if (ReaderPeek() != -1) {
- switch (PeekUpperChar()) {
- case 'R':
- case '#':
- ReaderRead();
- isdouble = true;
- break;
- case 'D':
- case '@':
- ReaderRead();
- isdecimal = true;
- break;
- case 'F':
- case '!':
- ReaderRead();
- issingle = true;
- break;
- }
- }
-
- try {
- if (issingle) {
- return new Token(Tokens.LiteralSingle, x, y, sb.ToString(), Single.Parse(digit, CultureInfo.InvariantCulture), LiteralFormat.DecimalNumber);
- }
- if (isdecimal) {
- return new Token(Tokens.LiteralDecimal, x, y, sb.ToString(), Decimal.Parse(digit, NumberStyles.Currency | NumberStyles.AllowExponent, CultureInfo.InvariantCulture), LiteralFormat.DecimalNumber);
- }
- if (isdouble) {
- return new Token(Tokens.LiteralDouble, x, y, sb.ToString(), Double.Parse(digit, CultureInfo.InvariantCulture), LiteralFormat.DecimalNumber);
- }
- } catch (FormatException) {
- errors.Error(Line, Col, String.Format("{0} is not a parseable number", digit));
- if (issingle)
- return new Token(Tokens.LiteralSingle, x, y, sb.ToString(), 0f, LiteralFormat.DecimalNumber);
- if (isdecimal)
- return new Token(Tokens.LiteralDecimal, x, y, sb.ToString(), 0m, LiteralFormat.DecimalNumber);
- if (isdouble)
- return new Token(Tokens.LiteralDouble, x, y, sb.ToString(), 0.0, LiteralFormat.DecimalNumber);
- }
- Token token;
- try {
- token = new Token(Tokens.LiteralInteger, x, y, sb.ToString(), Int32.Parse(digit, ishex ? NumberStyles.HexNumber : NumberStyles.Number), ishex ? LiteralFormat.HexadecimalNumber : LiteralFormat.DecimalNumber);
- } catch (Exception) {
- try {
- token = new Token(Tokens.LiteralInteger, x, y, sb.ToString(), Int64.Parse(digit, ishex ? NumberStyles.HexNumber : NumberStyles.Number), ishex ? LiteralFormat.HexadecimalNumber : LiteralFormat.DecimalNumber);
- } catch (FormatException) {
- errors.Error(Line, Col, String.Format("{0} is not a parseable number", digit));
- // fallback, when nothing helps :)
- token = new Token(Tokens.LiteralInteger, x, y, sb.ToString(), 0, LiteralFormat.DecimalNumber);
- } catch (OverflowException) {
- errors.Error(Line, Col, String.Format("{0} is too long for a integer literal", digit));
- // fallback, when nothing helps :)
- token = new Token(Tokens.LiteralInteger, x, y, sb.ToString(), 0, LiteralFormat.DecimalNumber);
- }
- }
- token.next = nextToken;
- return token;
- }
-
- void ReadPreprocessorDirective()
- {
- Location start = new Location(Col - 1, Line);
- string directive = ReadIdent('#');
- string argument = ReadToEndOfLine();
- this.specialTracker.AddPreprocessingDirective(new PreprocessingDirective(directive, argument.Trim(), start, new Location(start.Column + directive.Length + argument.Length, start.Line)));
- }
-
- string ReadDate()
- {
- char ch = '\0';
- sb.Length = 0;
- int nextChar;
- while ((nextChar = ReaderRead()) != -1) {
- ch = (char)nextChar;
- if (ch == '#') {
- break;
- } else if (ch == '\n') {
- errors.Error(Line, Col, String.Format("No return allowed inside Date literal"));
- } else {
- sb.Append(ch);
- }
- }
- if (ch != '#') {
- errors.Error(Line, Col, String.Format("End of File reached before Date literal terminated"));
- }
- return sb.ToString();
- }
-
- string ReadString()
- {
- char ch = '\0';
- sb.Length = 0;
- int nextChar;
- while ((nextChar = ReaderRead()) != -1) {
- ch = (char)nextChar;
- if (ch == '"') {
- if (ReaderPeek() != -1 && ReaderPeek() == '"') {
- sb.Append('"');
- ReaderRead();
- } else {
- break;
- }
- } else if (ch == '\n') {
- errors.Error(Line, Col, String.Format("No return allowed inside String literal"));
- } else {
- sb.Append(ch);
- }
- }
- if (ch != '"') {
- errors.Error(Line, Col, String.Format("End of File reached before String terminated "));
- }
- return sb.ToString();
- }
-
- void ReadComment()
- {
- Location startPos = new Location(Col, Line);
- sb.Length = 0;
- StringBuilder curWord = specialCommentHash != null ? new StringBuilder() : null;
- int missingApostrophes = 2; // no. of ' missing until it is a documentation comment
- int nextChar;
- while ((nextChar = ReaderRead()) != -1) {
- char ch = (char)nextChar;
-
- if (HandleLineEnd(ch)) {
- break;
- }
-
- sb.Append(ch);
-
- if (missingApostrophes > 0) {
- if (ch == '\'' || ch == '\u2018' || ch == '\u2019') {
- if (--missingApostrophes == 0) {
- specialTracker.StartComment(CommentType.Documentation, isAtLineBegin, startPos);
- sb.Length = 0;
- }
- } else {
- specialTracker.StartComment(CommentType.SingleLine, isAtLineBegin, startPos);
- missingApostrophes = 0;
- }
- }
-
- if (specialCommentHash != null) {
- if (Char.IsLetter(ch)) {
- curWord.Append(ch);
- } else {
- string tag = curWord.ToString();
- curWord.Length = 0;
- if (specialCommentHash.ContainsKey(tag)) {
- Location p = new Location(Col, Line);
- string comment = ch + ReadToEndOfLine();
- this.TagComments.Add(new TagComment(tag, comment, isAtLineBegin, p, new Location(Col, Line)));
- sb.Append(comment);
- break;
- }
- }
- }
- }
- if (missingApostrophes > 0) {
- specialTracker.StartComment(CommentType.SingleLine, isAtLineBegin, startPos);
- }
- specialTracker.AddString(sb.ToString());
- specialTracker.FinishComment(new Location(Col, Line));
- }
-
- Token ReadOperator(char ch)
- {
- int x = Col - 1;
- int y = Line;
- switch(ch) {
- case '+':
- switch (ReaderPeek()) {
- case '=':
- ReaderRead();
- return new Token(Tokens.PlusAssign, x, y);
- default:
- break;
- }
- return new Token(Tokens.Plus, x, y);
- case '-':
- switch (ReaderPeek()) {
- case '=':
- ReaderRead();
- return new Token(Tokens.MinusAssign, x, y);
- default:
- break;
- }
- return new Token(Tokens.Minus, x, y);
- case '*':
- switch (ReaderPeek()) {
- case '=':
- ReaderRead();
- return new Token(Tokens.TimesAssign, x, y);
- default:
- break;
- }
- return new Token(Tokens.Times, x, y, "*");
- case '/':
- switch (ReaderPeek()) {
- case '=':
- ReaderRead();
- return new Token(Tokens.DivAssign, x, y);
- default:
- break;
- }
- return new Token(Tokens.Div, x, y);
- case '\\':
- switch (ReaderPeek()) {
- case '=':
- ReaderRead();
- return new Token(Tokens.DivIntegerAssign, x, y);
- default:
- break;
- }
- return new Token(Tokens.DivInteger, x, y);
- case '&':
- switch (ReaderPeek()) {
- case '=':
- ReaderRead();
- return new Token(Tokens.ConcatStringAssign, x, y);
- default:
- break;
- }
- return new Token(Tokens.ConcatString, x, y);
- case '^':
- switch (ReaderPeek()) {
- case '=':
- ReaderRead();
- return new Token(Tokens.PowerAssign, x, y);
- default:
- break;
- }
- return new Token(Tokens.Power, x, y);
- case ':':
- return new Token(Tokens.Colon, x, y);
- case '=':
- return new Token(Tokens.Assign, x, y);
- case '<':
- switch (ReaderPeek()) {
- case '=':
- ReaderRead();
- return new Token(Tokens.LessEqual, x, y);
- case '>':
- ReaderRead();
- return new Token(Tokens.NotEqual, x, y);
- case '<':
- ReaderRead();
- switch (ReaderPeek()) {
- case '=':
- ReaderRead();
- return new Token(Tokens.ShiftLeftAssign, x, y);
- default:
- break;
- }
- return new Token(Tokens.ShiftLeft, x, y);
- }
- return new Token(Tokens.LessThan, x, y);
- case '>':
- switch (ReaderPeek()) {
- case '=':
- ReaderRead();
- return new Token(Tokens.GreaterEqual, x, y);
- case '>':
- ReaderRead();
- if (ReaderPeek() != -1) {
- switch (ReaderPeek()) {
- case '=':
- ReaderRead();
- return new Token(Tokens.ShiftRightAssign, x, y);
- default:
- break;
- }
- }
- return new Token(Tokens.ShiftRight, x, y);
- }
- return new Token(Tokens.GreaterThan, x, y);
- case ',':
- return new Token(Tokens.Comma, x, y);
- case '.':
- // Prevent OverflowException when Peek returns -1
- int tmp = ReaderPeek();
- if (tmp > 0 && Char.IsDigit((char)tmp)) {
- return ReadDigit('.', Col);
- }
- return new Token(Tokens.Dot, x, y);
- case '(':
- return new Token(Tokens.OpenParenthesis, x, y);
- case ')':
- return new Token(Tokens.CloseParenthesis, x, y);
- case '{':
- return new Token(Tokens.OpenCurlyBrace, x, y);
- case '}':
- return new Token(Tokens.CloseCurlyBrace, x, y);
- case '?':
- return new Token(Tokens.QuestionMark, x, y);
- case '!':
- return new Token(Tokens.ExclamationMark, x, y);
- }
- return null;
- }
-
- public override void SkipCurrentBlock(int targetToken)
- {
- int lastKind = -1;
- int kind = base.lastToken.kind;
- while (kind != Tokens.EOF &&
- !(lastKind == Tokens.End && kind == targetToken))
- {
- lastKind = kind;
- NextToken();
- kind = lastToken.kind;
- }
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Andrea Paatz" email="andrea@icsharpcode.net"/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+using System.Globalization;
+using System.IO;
+using System.Text;
+
+namespace ICSharpCode.NRefactory.Parser.VB
+{
+ internal sealed class Lexer : AbstractLexer
+ {
+ bool lineEnd = true;
+ bool isAtLineBegin = false; // TODO: handle line begin, if neccessarry
+
+ public Lexer(TextReader reader) : base(reader)
+ {
+ }
+
+ public override Token NextToken()
+ {
+ if (curToken == null) { // first call of NextToken()
+ curToken = Next();
+ specialTracker.InformToken(curToken.kind);
+ //Console.WriteLine("Tok:" + Tokens.GetTokenString(curToken.kind) + " --- " + curToken.val);
+ return curToken;
+ }
+
+ lastToken = curToken;
+
+ if (curToken.next == null) {
+ curToken.next = Next();
+ specialTracker.InformToken(curToken.next.kind);
+ }
+
+ curToken = curToken.next;
+
+ if (curToken.kind == Tokens.EOF && !(lastToken.kind == Tokens.EOL)) { // be sure that before EOF there is an EOL token
+ curToken = new Token(Tokens.EOL, curToken.col, curToken.line, "\n");
+ specialTracker.InformToken(curToken.kind);
+ curToken.next = new Token(Tokens.EOF, curToken.col, curToken.line, "\n");
+ specialTracker.InformToken(curToken.next.kind);
+ }
+ //Console.WriteLine("Tok:" + Tokens.GetTokenString(curToken.kind) + " --- " + curToken.val);
+ return curToken;
+ }
+
+ bool misreadExclamationMarkAsTypeCharacter;
+
+ protected override Token Next()
+ {
+ if (misreadExclamationMarkAsTypeCharacter) {
+ misreadExclamationMarkAsTypeCharacter = false;
+ return new Token(Tokens.ExclamationMark, Col - 1, Line);
+ }
+ unchecked {
+ while (true) {
+ Location startLocation = new Location(Col, Line);
+ int nextChar = ReaderRead();
+ if (nextChar == -1)
+ return new Token(Tokens.EOF);
+ char ch = (char)nextChar;
+ if (Char.IsWhiteSpace(ch)) {
+ if (HandleLineEnd(ch)) {
+ if (lineEnd) {
+ // second line end before getting to a token
+ // -> here was a blank line
+ specialTracker.AddEndOfLine(startLocation);
+ } else {
+ lineEnd = true;
+ return new Token(Tokens.EOL, startLocation, new Location(Col, Line), null, null, LiteralFormat.None);
+ }
+ }
+ continue;
+ }
+ if (ch == '_') {
+ if (ReaderPeek() == -1) {
+ errors.Error(Line, Col, String.Format("No EOF expected after _"));
+ return new Token(Tokens.EOF);
+ }
+ if (!Char.IsWhiteSpace((char)ReaderPeek())) {
+ int x = Col - 1;
+ int y = Line;
+ string s = ReadIdent('_');
+ lineEnd = false;
+ return new Token(Tokens.Identifier, x, y, s);
+ }
+ ch = (char)ReaderRead();
+
+ bool oldLineEnd = lineEnd;
+ lineEnd = false;
+ while (Char.IsWhiteSpace(ch)) {
+ if (HandleLineEnd(ch)) {
+ lineEnd = true;
+ break;
+ }
+ if (ReaderPeek() != -1) {
+ ch = (char)ReaderRead();
+ } else {
+ errors.Error(Line, Col, String.Format("No EOF expected after _"));
+ return new Token(Tokens.EOF);
+ }
+ }
+ if (!lineEnd) {
+ errors.Error(Line, Col, String.Format("Return expected"));
+ }
+ lineEnd = oldLineEnd;
+ continue;
+ }
+
+ if (ch == '#') {
+ while (Char.IsWhiteSpace((char)ReaderPeek())) {
+ ReaderRead();
+ }
+ if (Char.IsDigit((char)ReaderPeek())) {
+ int x = Col - 1;
+ int y = Line;
+ string s = ReadDate();
+ DateTime time = new DateTime(1, 1, 1, 0, 0, 0);
+ try {
+ time = DateTime.Parse(s, System.Globalization.CultureInfo.InvariantCulture, DateTimeStyles.NoCurrentDateDefault);
+ } catch (Exception e) {
+ errors.Error(Line, Col, String.Format("Invalid date time {0}", e));
+ }
+ return new Token(Tokens.LiteralDate, x, y, s, time, LiteralFormat.DateTimeLiteral);
+ } else {
+ ReadPreprocessorDirective();
+ continue;
+ }
+ }
+
+ if (ch == '[') { // Identifier
+ lineEnd = false;
+ if (ReaderPeek() == -1) {
+ errors.Error(Line, Col, String.Format("Identifier expected"));
+ }
+ ch = (char)ReaderRead();
+ if (ch == ']' || Char.IsWhiteSpace(ch)) {
+ errors.Error(Line, Col, String.Format("Identifier expected"));
+ }
+ int x = Col - 1;
+ int y = Line;
+ string s = ReadIdent(ch);
+ if (ReaderPeek() == -1) {
+ errors.Error(Line, Col, String.Format("']' expected"));
+ }
+ ch = (char)ReaderRead();
+ if (!(ch == ']')) {
+ errors.Error(Line, Col, String.Format("']' expected"));
+ }
+ return new Token(Tokens.Identifier, x, y, s);
+ }
+ if (Char.IsLetter(ch)) {
+ int x = Col - 1;
+ int y = Line;
+ char typeCharacter;
+ string s = ReadIdent(ch, out typeCharacter);
+ if (typeCharacter == '\0') {
+ int keyWordToken = Keywords.GetToken(s);
+ if (keyWordToken >= 0) {
+ // handle 'REM' comments
+ if (keyWordToken == Tokens.Rem) {
+ ReadComment();
+ if (!lineEnd) {
+ lineEnd = true;
+ return new Token(Tokens.EOL, Col, Line, "\n");
+ }
+ continue;
+ }
+
+ lineEnd = false;
+ return new Token(keyWordToken, x, y, s);
+ }
+ }
+
+ lineEnd = false;
+ return new Token(Tokens.Identifier, x, y, s);
+
+ }
+ if (Char.IsDigit(ch)) {
+ lineEnd = false;
+ return ReadDigit(ch, Col - 1);
+ }
+ if (ch == '&') {
+ lineEnd = false;
+ if (ReaderPeek() == -1) {
+ return ReadOperator('&');
+ }
+ ch = (char)ReaderPeek();
+ if (Char.ToUpper(ch, CultureInfo.InvariantCulture) == 'H' || Char.ToUpper(ch, CultureInfo.InvariantCulture) == 'O') {
+ return ReadDigit('&', Col - 1);
+ }
+ return ReadOperator('&');
+ }
+ if (ch == '\'' || ch == '\u2018' || ch == '\u2019') {
+ int x = Col - 1;
+ int y = Line;
+ ReadComment();
+ if (!lineEnd) {
+ lineEnd = true;
+ return new Token(Tokens.EOL, x, y, "\n");
+ }
+ continue;
+ }
+ if (ch == '"') {
+ lineEnd = false;
+ int x = Col - 1;
+ int y = Line;
+ string s = ReadString();
+ if (ReaderPeek() != -1 && (ReaderPeek() == 'C' || ReaderPeek() == 'c')) {
+ ReaderRead();
+ if (s.Length != 1) {
+ errors.Error(Line, Col, String.Format("Chars can only have Length 1 "));
+ }
+ if (s.Length == 0) {
+ s = "\0";
+ }
+ return new Token(Tokens.LiteralCharacter, x, y, '"' + s + "\"C", s[0], LiteralFormat.CharLiteral);
+ }
+ return new Token(Tokens.LiteralString, x, y, '"' + s + '"', s, LiteralFormat.StringLiteral);
+ }
+ Token token = ReadOperator(ch);
+ if (token != null) {
+ lineEnd = false;
+ return token;
+ }
+ errors.Error(Line, Col, String.Format("Unknown char({0}) which can't be read", ch));
+ }
+ }
+ }
+
+ string ReadIdent(char ch)
+ {
+ char typeCharacter;
+ return ReadIdent(ch, out typeCharacter);
+ }
+
+ string ReadIdent(char ch, out char typeCharacter)
+ {
+ typeCharacter = '\0';
+
+ sb.Length = 0;
+ sb.Append(ch);
+ int peek;
+ while ((peek = ReaderPeek()) != -1 && (Char.IsLetterOrDigit(ch = (char)peek) || ch == '_')) {
+ ReaderRead();
+ sb.Append(ch.ToString());
+ }
+ if (peek == -1) {
+ return sb.ToString();
+ }
+
+ if ("%&@!#$".IndexOf((char)peek) != -1) {
+ typeCharacter = (char)peek;
+ ReaderRead();
+ if (typeCharacter == '!') {
+ peek = ReaderPeek();
+ if (peek != -1 && (peek == '_' || peek == '[' || char.IsLetter((char)peek))) {
+ misreadExclamationMarkAsTypeCharacter = true;
+ }
+ }
+ }
+ return sb.ToString();
+ }
+
+ char PeekUpperChar()
+ {
+ return Char.ToUpper((char)ReaderPeek(), CultureInfo.InvariantCulture);
+ }
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1818:DoNotConcatenateStringsInsideLoops")]
+ Token ReadDigit(char ch, int x)
+ {
+ sb.Length = 0;
+ sb.Append(ch);
+
+ int y = Line;
+ string digit = "";
+ if (ch != '&') {
+ digit += ch;
+ }
+
+ bool ishex = false;
+ bool isokt = false;
+ bool issingle = false;
+ bool isdouble = false;
+ bool isdecimal = false;
+
+ if (ReaderPeek() == -1) {
+ if (ch == '&') {
+ errors.Error(Line, Col, String.Format("digit expected"));
+ }
+ return new Token(Tokens.LiteralInteger, x, y, sb.ToString() ,ch - '0', LiteralFormat.DecimalNumber);
+ }
+ if (ch == '.') {
+ if (Char.IsDigit((char)ReaderPeek())) {
+ isdouble = true; // double is default
+ if (ishex || isokt) {
+ errors.Error(Line, Col, String.Format("No hexadecimal or oktadecimal floating point values allowed"));
+ }
+ while (ReaderPeek() != -1 && Char.IsDigit((char)ReaderPeek())){ // read decimal digits beyond the dot
+ digit += (char)ReaderRead();
+ }
+ }
+ } else if (ch == '&' && PeekUpperChar() == 'H') {
+ const string hex = "0123456789ABCDEF";
+ sb.Append((char)ReaderRead()); // skip 'H'
+ while (ReaderPeek() != -1 && hex.IndexOf(PeekUpperChar()) != -1) {
+ ch = (char)ReaderRead();
+ sb.Append(ch);
+ digit += Char.ToUpper(ch, CultureInfo.InvariantCulture);
+ }
+ ishex = true;
+ } else if (ReaderPeek() != -1 && ch == '&' && PeekUpperChar() == 'O') {
+ const string okt = "01234567";
+ sb.Append((char)ReaderRead()); // skip 'O'
+ while (ReaderPeek() != -1 && okt.IndexOf(PeekUpperChar()) != -1) {
+ ch = (char)ReaderRead();
+ sb.Append(ch);
+ digit += Char.ToUpper(ch, CultureInfo.InvariantCulture);
+ }
+ isokt = true;
+ } else {
+ while (ReaderPeek() != -1 && Char.IsDigit((char)ReaderPeek())) {
+ ch = (char)ReaderRead();;
+ digit += ch;
+ sb.Append(ch);
+ }
+ }
+
+ if (digit.Length == 0) {
+ errors.Error(Line, Col, String.Format("digit expected"));
+ return new Token(Tokens.LiteralInteger, x, y, sb.ToString(), 0, LiteralFormat.DecimalNumber);
+ }
+
+ if (ReaderPeek() != -1 && "%&SILU".IndexOf(PeekUpperChar()) != -1 || ishex || isokt) {
+ bool unsigned = false;
+ if (ReaderPeek() != -1) {
+ ch = (char)ReaderPeek();
+ sb.Append(ch);
+ ch = Char.ToUpper(ch, CultureInfo.InvariantCulture);
+ unsigned = ch == 'U';
+ if (unsigned) {
+ ReaderRead(); // read the U
+ ch = (char)ReaderPeek();
+ sb.Append(ch);
+ ch = Char.ToUpper(ch, CultureInfo.InvariantCulture);
+ if (ch != 'I' && ch != 'L' && ch != 'S') {
+ errors.Error(Line, Col, "Invalid type character: U" + ch);
+ }
+ }
+ }
+ try {
+ if (isokt) {
+ ReaderRead();
+ ulong number = 0L;
+ for (int i = 0; i < digit.Length; ++i) {
+ number = number * 8 + digit[i] - '0';
+ }
+ if (ch == 'S') {
+ if (unsigned)
+ return new Token(Tokens.LiteralInteger, x, y, sb.ToString(), (ushort)number, LiteralFormat.OctalNumber);
+ else
+ return new Token(Tokens.LiteralInteger, x, y, sb.ToString(), (short)number, LiteralFormat.OctalNumber);
+ } else if (ch == '%' || ch == 'I') {
+ if (unsigned)
+ return new Token(Tokens.LiteralInteger, x, y, sb.ToString(), (uint)number, LiteralFormat.OctalNumber);
+ else
+ return new Token(Tokens.LiteralInteger, x, y, sb.ToString(), (int)number, LiteralFormat.OctalNumber);
+ } else if (ch == '&' || ch == 'L') {
+ if (unsigned)
+ return new Token(Tokens.LiteralInteger, x, y, sb.ToString(), (ulong)number, LiteralFormat.OctalNumber);
+ else
+ return new Token(Tokens.LiteralInteger, x, y, sb.ToString(), (long)number, LiteralFormat.OctalNumber);
+ } else {
+ if (number > uint.MaxValue) {
+ return new Token(Tokens.LiteralInteger, x, y, sb.ToString(), unchecked((long)number), LiteralFormat.OctalNumber);
+ } else {
+ return new Token(Tokens.LiteralInteger, x, y, sb.ToString(), unchecked((int)number), LiteralFormat.OctalNumber);
+ }
+ }
+ }
+ LiteralFormat literalFormat = ishex ? LiteralFormat.HexadecimalNumber : LiteralFormat.DecimalNumber;
+ if (ch == 'S') {
+ ReaderRead();
+ if (unsigned)
+ return new Token(Tokens.LiteralInteger, x, y, sb.ToString(), UInt16.Parse(digit, ishex ? NumberStyles.HexNumber : NumberStyles.Number), literalFormat);
+ else
+ return new Token(Tokens.LiteralInteger, x, y, sb.ToString(), Int16.Parse(digit, ishex ? NumberStyles.HexNumber : NumberStyles.Number), literalFormat);
+ } else if (ch == '%' || ch == 'I') {
+ ReaderRead();
+ if (unsigned)
+ return new Token(Tokens.LiteralInteger, x, y, sb.ToString(), UInt32.Parse(digit, ishex ? NumberStyles.HexNumber : NumberStyles.Number), literalFormat);
+ else
+ return new Token(Tokens.LiteralInteger, x, y, sb.ToString(), Int32.Parse(digit, ishex ? NumberStyles.HexNumber : NumberStyles.Number), literalFormat);
+ } else if (ch == '&' || ch == 'L') {
+ ReaderRead();
+ if (unsigned)
+ return new Token(Tokens.LiteralInteger, x, y, sb.ToString(), UInt64.Parse(digit, ishex ? NumberStyles.HexNumber : NumberStyles.Number), literalFormat);
+ else
+ return new Token(Tokens.LiteralInteger, x, y, sb.ToString(), Int64.Parse(digit, ishex ? NumberStyles.HexNumber : NumberStyles.Number), literalFormat);
+ } else if (ishex) {
+ ulong number = UInt64.Parse(digit, NumberStyles.HexNumber);
+ if (number > uint.MaxValue) {
+ return new Token(Tokens.LiteralInteger, x, y, sb.ToString(), unchecked((long)number), literalFormat);
+ } else {
+ return new Token(Tokens.LiteralInteger, x, y, sb.ToString(), unchecked((int)number), literalFormat);
+ }
+ }
+ } catch (OverflowException ex) {
+ errors.Error(Line, Col, ex.Message);
+ return new Token(Tokens.LiteralInteger, x, y, sb.ToString(), 0, LiteralFormat.None);
+ }
+ }
+ Token nextToken = null; // if we accedently read a 'dot'
+ if (!isdouble && ReaderPeek() == '.') { // read floating point number
+ ReaderRead();
+ if (ReaderPeek() != -1 && Char.IsDigit((char)ReaderPeek())) {
+ isdouble = true; // double is default
+ if (ishex || isokt) {
+ errors.Error(Line, Col, String.Format("No hexadecimal or oktadecimal floating point values allowed"));
+ }
+ digit += '.';
+ while (ReaderPeek() != -1 && Char.IsDigit((char)ReaderPeek())){ // read decimal digits beyond the dot
+ digit += (char)ReaderRead();
+ }
+ } else {
+ nextToken = new Token(Tokens.Dot, Col - 1, Line);
+ }
+ }
+
+ if (ReaderPeek() != -1 && PeekUpperChar() == 'E') { // read exponent
+ isdouble = true;
+ digit += (char)ReaderRead();
+ if (ReaderPeek() != -1 && (ReaderPeek() == '-' || ReaderPeek() == '+')) {
+ digit += (char)ReaderRead();
+ }
+ while (ReaderPeek() != -1 && Char.IsDigit((char)ReaderPeek())) { // read exponent value
+ digit += (char)ReaderRead();
+ }
+ }
+
+ if (ReaderPeek() != -1) {
+ switch (PeekUpperChar()) {
+ case 'R':
+ case '#':
+ ReaderRead();
+ isdouble = true;
+ break;
+ case 'D':
+ case '@':
+ ReaderRead();
+ isdecimal = true;
+ break;
+ case 'F':
+ case '!':
+ ReaderRead();
+ issingle = true;
+ break;
+ }
+ }
+
+ try {
+ if (issingle) {
+ return new Token(Tokens.LiteralSingle, x, y, sb.ToString(), Single.Parse(digit, CultureInfo.InvariantCulture), LiteralFormat.DecimalNumber);
+ }
+ if (isdecimal) {
+ return new Token(Tokens.LiteralDecimal, x, y, sb.ToString(), Decimal.Parse(digit, NumberStyles.Currency | NumberStyles.AllowExponent, CultureInfo.InvariantCulture), LiteralFormat.DecimalNumber);
+ }
+ if (isdouble) {
+ return new Token(Tokens.LiteralDouble, x, y, sb.ToString(), Double.Parse(digit, CultureInfo.InvariantCulture), LiteralFormat.DecimalNumber);
+ }
+ } catch (FormatException) {
+ errors.Error(Line, Col, String.Format("{0} is not a parseable number", digit));
+ if (issingle)
+ return new Token(Tokens.LiteralSingle, x, y, sb.ToString(), 0f, LiteralFormat.DecimalNumber);
+ if (isdecimal)
+ return new Token(Tokens.LiteralDecimal, x, y, sb.ToString(), 0m, LiteralFormat.DecimalNumber);
+ if (isdouble)
+ return new Token(Tokens.LiteralDouble, x, y, sb.ToString(), 0.0, LiteralFormat.DecimalNumber);
+ }
+ Token token;
+ try {
+ token = new Token(Tokens.LiteralInteger, x, y, sb.ToString(), Int32.Parse(digit, ishex ? NumberStyles.HexNumber : NumberStyles.Number), ishex ? LiteralFormat.HexadecimalNumber : LiteralFormat.DecimalNumber);
+ } catch (Exception) {
+ try {
+ token = new Token(Tokens.LiteralInteger, x, y, sb.ToString(), Int64.Parse(digit, ishex ? NumberStyles.HexNumber : NumberStyles.Number), ishex ? LiteralFormat.HexadecimalNumber : LiteralFormat.DecimalNumber);
+ } catch (FormatException) {
+ errors.Error(Line, Col, String.Format("{0} is not a parseable number", digit));
+ // fallback, when nothing helps :)
+ token = new Token(Tokens.LiteralInteger, x, y, sb.ToString(), 0, LiteralFormat.DecimalNumber);
+ } catch (OverflowException) {
+ errors.Error(Line, Col, String.Format("{0} is too long for a integer literal", digit));
+ // fallback, when nothing helps :)
+ token = new Token(Tokens.LiteralInteger, x, y, sb.ToString(), 0, LiteralFormat.DecimalNumber);
+ }
+ }
+ token.next = nextToken;
+ return token;
+ }
+
+ void ReadPreprocessorDirective()
+ {
+ Location start = new Location(Col - 1, Line);
+ string directive = ReadIdent('#');
+ string argument = ReadToEndOfLine();
+ this.specialTracker.AddPreprocessingDirective(new PreprocessingDirective(directive, argument.Trim(), start, new Location(start.Column + directive.Length + argument.Length, start.Line)));
+ }
+
+ string ReadDate()
+ {
+ char ch = '\0';
+ sb.Length = 0;
+ int nextChar;
+ while ((nextChar = ReaderRead()) != -1) {
+ ch = (char)nextChar;
+ if (ch == '#') {
+ break;
+ } else if (ch == '\n') {
+ errors.Error(Line, Col, String.Format("No return allowed inside Date literal"));
+ } else {
+ sb.Append(ch);
+ }
+ }
+ if (ch != '#') {
+ errors.Error(Line, Col, String.Format("End of File reached before Date literal terminated"));
+ }
+ return sb.ToString();
+ }
+
+ string ReadString()
+ {
+ char ch = '\0';
+ sb.Length = 0;
+ int nextChar;
+ while ((nextChar = ReaderRead()) != -1) {
+ ch = (char)nextChar;
+ if (ch == '"') {
+ if (ReaderPeek() != -1 && ReaderPeek() == '"') {
+ sb.Append('"');
+ ReaderRead();
+ } else {
+ break;
+ }
+ } else if (ch == '\n') {
+ errors.Error(Line, Col, String.Format("No return allowed inside String literal"));
+ } else {
+ sb.Append(ch);
+ }
+ }
+ if (ch != '"') {
+ errors.Error(Line, Col, String.Format("End of File reached before String terminated "));
+ }
+ return sb.ToString();
+ }
+
+ void ReadComment()
+ {
+ Location startPos = new Location(Col, Line);
+ sb.Length = 0;
+ StringBuilder curWord = specialCommentHash != null ? new StringBuilder() : null;
+ int missingApostrophes = 2; // no. of ' missing until it is a documentation comment
+ int nextChar;
+ while ((nextChar = ReaderRead()) != -1) {
+ char ch = (char)nextChar;
+
+ if (HandleLineEnd(ch)) {
+ break;
+ }
+
+ sb.Append(ch);
+
+ if (missingApostrophes > 0) {
+ if (ch == '\'' || ch == '\u2018' || ch == '\u2019') {
+ if (--missingApostrophes == 0) {
+ specialTracker.StartComment(CommentType.Documentation, isAtLineBegin, startPos);
+ sb.Length = 0;
+ }
+ } else {
+ specialTracker.StartComment(CommentType.SingleLine, isAtLineBegin, startPos);
+ missingApostrophes = 0;
+ }
+ }
+
+ if (specialCommentHash != null) {
+ if (Char.IsLetter(ch)) {
+ curWord.Append(ch);
+ } else {
+ string tag = curWord.ToString();
+ curWord.Length = 0;
+ if (specialCommentHash.ContainsKey(tag)) {
+ Location p = new Location(Col, Line);
+ string comment = ch + ReadToEndOfLine();
+ this.TagComments.Add(new TagComment(tag, comment, isAtLineBegin, p, new Location(Col, Line)));
+ sb.Append(comment);
+ break;
+ }
+ }
+ }
+ }
+ if (missingApostrophes > 0) {
+ specialTracker.StartComment(CommentType.SingleLine, isAtLineBegin, startPos);
+ }
+ specialTracker.AddString(sb.ToString());
+ specialTracker.FinishComment(new Location(Col, Line));
+ }
+
+ Token ReadOperator(char ch)
+ {
+ int x = Col - 1;
+ int y = Line;
+ switch(ch) {
+ case '+':
+ switch (ReaderPeek()) {
+ case '=':
+ ReaderRead();
+ return new Token(Tokens.PlusAssign, x, y);
+ default:
+ break;
+ }
+ return new Token(Tokens.Plus, x, y);
+ case '-':
+ switch (ReaderPeek()) {
+ case '=':
+ ReaderRead();
+ return new Token(Tokens.MinusAssign, x, y);
+ default:
+ break;
+ }
+ return new Token(Tokens.Minus, x, y);
+ case '*':
+ switch (ReaderPeek()) {
+ case '=':
+ ReaderRead();
+ return new Token(Tokens.TimesAssign, x, y);
+ default:
+ break;
+ }
+ return new Token(Tokens.Times, x, y, "*");
+ case '/':
+ switch (ReaderPeek()) {
+ case '=':
+ ReaderRead();
+ return new Token(Tokens.DivAssign, x, y);
+ default:
+ break;
+ }
+ return new Token(Tokens.Div, x, y);
+ case '\\':
+ switch (ReaderPeek()) {
+ case '=':
+ ReaderRead();
+ return new Token(Tokens.DivIntegerAssign, x, y);
+ default:
+ break;
+ }
+ return new Token(Tokens.DivInteger, x, y);
+ case '&':
+ switch (ReaderPeek()) {
+ case '=':
+ ReaderRead();
+ return new Token(Tokens.ConcatStringAssign, x, y);
+ default:
+ break;
+ }
+ return new Token(Tokens.ConcatString, x, y);
+ case '^':
+ switch (ReaderPeek()) {
+ case '=':
+ ReaderRead();
+ return new Token(Tokens.PowerAssign, x, y);
+ default:
+ break;
+ }
+ return new Token(Tokens.Power, x, y);
+ case ':':
+ return new Token(Tokens.Colon, x, y);
+ case '=':
+ return new Token(Tokens.Assign, x, y);
+ case '<':
+ switch (ReaderPeek()) {
+ case '=':
+ ReaderRead();
+ return new Token(Tokens.LessEqual, x, y);
+ case '>':
+ ReaderRead();
+ return new Token(Tokens.NotEqual, x, y);
+ case '<':
+ ReaderRead();
+ switch (ReaderPeek()) {
+ case '=':
+ ReaderRead();
+ return new Token(Tokens.ShiftLeftAssign, x, y);
+ default:
+ break;
+ }
+ return new Token(Tokens.ShiftLeft, x, y);
+ }
+ return new Token(Tokens.LessThan, x, y);
+ case '>':
+ switch (ReaderPeek()) {
+ case '=':
+ ReaderRead();
+ return new Token(Tokens.GreaterEqual, x, y);
+ case '>':
+ ReaderRead();
+ if (ReaderPeek() != -1) {
+ switch (ReaderPeek()) {
+ case '=':
+ ReaderRead();
+ return new Token(Tokens.ShiftRightAssign, x, y);
+ default:
+ break;
+ }
+ }
+ return new Token(Tokens.ShiftRight, x, y);
+ }
+ return new Token(Tokens.GreaterThan, x, y);
+ case ',':
+ return new Token(Tokens.Comma, x, y);
+ case '.':
+ // Prevent OverflowException when Peek returns -1
+ int tmp = ReaderPeek();
+ if (tmp > 0 && Char.IsDigit((char)tmp)) {
+ return ReadDigit('.', Col);
+ }
+ return new Token(Tokens.Dot, x, y);
+ case '(':
+ return new Token(Tokens.OpenParenthesis, x, y);
+ case ')':
+ return new Token(Tokens.CloseParenthesis, x, y);
+ case '{':
+ return new Token(Tokens.OpenCurlyBrace, x, y);
+ case '}':
+ return new Token(Tokens.CloseCurlyBrace, x, y);
+ case '?':
+ return new Token(Tokens.QuestionMark, x, y);
+ case '!':
+ return new Token(Tokens.ExclamationMark, x, y);
+ }
+ return null;
+ }
+
+ public override void SkipCurrentBlock(int targetToken)
+ {
+ int lastKind = -1;
+ int kind = base.lastToken.kind;
+ while (kind != Tokens.EOF &&
+ !(lastKind == Tokens.End && kind == targetToken))
+ {
+ lastKind = kind;
+ NextToken();
+ kind = lastToken.kind;
+ }
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Lexer/VBNet/Tokens.cs b/main/contrib/NRefactory/Project/Src/Lexer/VBNet/Tokens.cs
index 83606a4e8d..9807c7b07c 100644
--- a/main/contrib/NRefactory/Project/Src/Lexer/VBNet/Tokens.cs
+++ b/main/contrib/NRefactory/Project/Src/Lexer/VBNet/Tokens.cs
@@ -1,485 +1,485 @@
-// this file was autogenerated by a tool.
-using System;
-using System.Collections;
-
-namespace ICSharpCode.NRefactory.Parser.VB
-{
- public static class Tokens
- {
- // ----- terminal classes -----
- public const int EOF = 0;
- public const int EOL = 1;
- public const int Identifier = 2;
- public const int LiteralString = 3;
- public const int LiteralCharacter = 4;
- public const int LiteralInteger = 5;
- public const int LiteralDouble = 6;
- public const int LiteralSingle = 7;
- public const int LiteralDecimal = 8;
- public const int LiteralDate = 9;
-
- // ----- special character -----
- public const int Assign = 10;
- public const int Colon = 11;
- public const int Comma = 12;
- public const int ConcatString = 13;
- public const int Div = 14;
- public const int DivInteger = 15;
- public const int Dot = 16;
- public const int ExclamationMark = 17;
- public const int Minus = 18;
- public const int Plus = 19;
- public const int Power = 20;
- public const int QuestionMark = 21;
- public const int Times = 22;
- public const int OpenCurlyBrace = 23;
- public const int CloseCurlyBrace = 24;
- public const int OpenParenthesis = 25;
- public const int CloseParenthesis = 26;
- public const int GreaterThan = 27;
- public const int LessThan = 28;
- public const int NotEqual = 29;
- public const int GreaterEqual = 30;
- public const int LessEqual = 31;
- public const int ShiftLeft = 32;
- public const int ShiftRight = 33;
- public const int PlusAssign = 34;
- public const int PowerAssign = 35;
- public const int MinusAssign = 36;
- public const int TimesAssign = 37;
- public const int DivAssign = 38;
- public const int DivIntegerAssign = 39;
- public const int ShiftLeftAssign = 40;
- public const int ShiftRightAssign = 41;
- public const int ConcatStringAssign = 42;
-
- // ----- keywords -----
- public const int AddHandler = 43;
- public const int AddressOf = 44;
- public const int Aggregate = 45;
- public const int Alias = 46;
- public const int And = 47;
- public const int AndAlso = 48;
- public const int Ansi = 49;
- public const int As = 50;
- public const int Ascending = 51;
- public const int Assembly = 52;
- public const int Auto = 53;
- public const int Binary = 54;
- public const int Boolean = 55;
- public const int ByRef = 56;
- public const int By = 57;
- public const int Byte = 58;
- public const int ByVal = 59;
- public const int Call = 60;
- public const int Case = 61;
- public const int Catch = 62;
- public const int CBool = 63;
- public const int CByte = 64;
- public const int CChar = 65;
- public const int CDate = 66;
- public const int CDbl = 67;
- public const int CDec = 68;
- public const int Char = 69;
- public const int CInt = 70;
- public const int Class = 71;
- public const int CLng = 72;
- public const int CObj = 73;
- public const int Compare = 74;
- public const int Const = 75;
- public const int Continue = 76;
- public const int CSByte = 77;
- public const int CShort = 78;
- public const int CSng = 79;
- public const int CStr = 80;
- public const int CType = 81;
- public const int CUInt = 82;
- public const int CULng = 83;
- public const int CUShort = 84;
- public const int Custom = 85;
- public const int Date = 86;
- public const int Decimal = 87;
- public const int Declare = 88;
- public const int Default = 89;
- public const int Delegate = 90;
- public const int Descending = 91;
- public const int Dim = 92;
- public const int DirectCast = 93;
- public const int Distinct = 94;
- public const int Do = 95;
- public const int Double = 96;
- public const int Each = 97;
- public const int Else = 98;
- public const int ElseIf = 99;
- public const int End = 100;
- public const int EndIf = 101;
- public const int Enum = 102;
- new public const int Equals = 103;
- public const int Erase = 104;
- public const int Error = 105;
- public const int Event = 106;
- public const int Exit = 107;
- public const int Explicit = 108;
- public const int False = 109;
- public const int Finally = 110;
- public const int For = 111;
- public const int Friend = 112;
- public const int From = 113;
- public const int Function = 114;
- public const int Get = 115;
- new public const int GetType = 116;
- public const int Global = 117;
- public const int GoSub = 118;
- public const int GoTo = 119;
- public const int Group = 120;
- public const int Handles = 121;
- public const int If = 122;
- public const int Implements = 123;
- public const int Imports = 124;
- public const int In = 125;
- public const int Infer = 126;
- public const int Inherits = 127;
- public const int Integer = 128;
- public const int Interface = 129;
- public const int Into = 130;
- public const int Is = 131;
- public const int IsNot = 132;
- public const int Join = 133;
- public const int Let = 134;
- public const int Lib = 135;
- public const int Like = 136;
- public const int Long = 137;
- public const int Loop = 138;
- public const int Me = 139;
- public const int Mod = 140;
- public const int Module = 141;
- public const int MustInherit = 142;
- public const int MustOverride = 143;
- public const int MyBase = 144;
- public const int MyClass = 145;
- public const int Namespace = 146;
- public const int Narrowing = 147;
- public const int New = 148;
- public const int Next = 149;
- public const int Not = 150;
- public const int Nothing = 151;
- public const int NotInheritable = 152;
- public const int NotOverridable = 153;
- public const int Object = 154;
- public const int Of = 155;
- public const int Off = 156;
- public const int On = 157;
- public const int Operator = 158;
- public const int Option = 159;
- public const int Optional = 160;
- public const int Or = 161;
- public const int Order = 162;
- public const int OrElse = 163;
- public const int Overloads = 164;
- public const int Overridable = 165;
- public const int Overrides = 166;
- public const int ParamArray = 167;
- public const int Partial = 168;
- public const int Preserve = 169;
- public const int Private = 170;
- public const int Property = 171;
- public const int Protected = 172;
- public const int Public = 173;
- public const int RaiseEvent = 174;
- public const int ReadOnly = 175;
- public const int ReDim = 176;
- public const int Rem = 177;
- public const int RemoveHandler = 178;
- public const int Resume = 179;
- public const int Return = 180;
- public const int SByte = 181;
- public const int Select = 182;
- public const int Set = 183;
- public const int Shadows = 184;
- public const int Shared = 185;
- public const int Short = 186;
- public const int Single = 187;
- public const int Skip = 188;
- public const int Static = 189;
- public const int Step = 190;
- public const int Stop = 191;
- public const int Strict = 192;
- public const int String = 193;
- public const int Structure = 194;
- public const int Sub = 195;
- public const int SyncLock = 196;
- public const int Take = 197;
- public const int Text = 198;
- public const int Then = 199;
- public const int Throw = 200;
- public const int To = 201;
- public const int True = 202;
- public const int Try = 203;
- public const int TryCast = 204;
- public const int TypeOf = 205;
- public const int UInteger = 206;
- public const int ULong = 207;
- public const int Unicode = 208;
- public const int Until = 209;
- public const int UShort = 210;
- public const int Using = 211;
- public const int Variant = 212;
- public const int Wend = 213;
- public const int When = 214;
- public const int Where = 215;
- public const int While = 216;
- public const int Widening = 217;
- public const int With = 218;
- public const int WithEvents = 219;
- public const int WriteOnly = 220;
- public const int Xor = 221;
-
- public const int MaxToken = 222;
- static BitArray NewSet(params int[] values)
- {
- BitArray bitArray = new BitArray(MaxToken);
- foreach (int val in values) {
- bitArray[val] = true;
- }
- return bitArray;
- }
- public static BitArray Null = NewSet(Nothing);
- public static BitArray BlockSucc = NewSet(Case, Catch, Else, ElseIf, End, Finally, Loop, Next);
- public static BitArray IdentifierTokens = NewSet(Text, Binary, Compare, Assembly, Ansi, Auto, Preserve, Unicode, Until, Off, Explicit, Infer, From, Join, Equals, Distinct, Where, Take, Skip, Order, By, Ascending, Descending, Group, Into, Aggregate);
-
- static string[] tokenList = new string[] {
- // ----- terminal classes -----
- "<EOF>",
- "<EOL>",
- "<Identifier>",
- "<LiteralString>",
- "<LiteralCharacter>",
- "<LiteralInteger>",
- "<LiteralDouble>",
- "<LiteralSingle>",
- "<LiteralDecimal>",
- "<LiteralDate>",
- // ----- special character -----
- "=",
- ":",
- ",",
- "&",
- "/",
- "\\",
- ".",
- "!",
- "-",
- "+",
- "^",
- "?",
- "*",
- "{",
- "}",
- "(",
- ")",
- ">",
- "<",
- "<>",
- ">=",
- "<=",
- "<<",
- ">>",
- "+=",
- "^=",
- "-=",
- "*=",
- "/=",
- "\\=",
- "<<=",
- ">>=",
- "&=",
- // ----- keywords -----
- "AddHandler",
- "AddressOf",
- "Aggregate",
- "Alias",
- "And",
- "AndAlso",
- "Ansi",
- "As",
- "Ascending",
- "Assembly",
- "Auto",
- "Binary",
- "Boolean",
- "ByRef",
- "By",
- "Byte",
- "ByVal",
- "Call",
- "Case",
- "Catch",
- "CBool",
- "CByte",
- "CChar",
- "CDate",
- "CDbl",
- "CDec",
- "Char",
- "CInt",
- "Class",
- "CLng",
- "CObj",
- "Compare",
- "Const",
- "Continue",
- "CSByte",
- "CShort",
- "CSng",
- "CStr",
- "CType",
- "CUInt",
- "CULng",
- "CUShort",
- "Custom",
- "Date",
- "Decimal",
- "Declare",
- "Default",
- "Delegate",
- "Descending",
- "Dim",
- "DirectCast",
- "Distinct",
- "Do",
- "Double",
- "Each",
- "Else",
- "ElseIf",
- "End",
- "EndIf",
- "Enum",
- "Equals",
- "Erase",
- "Error",
- "Event",
- "Exit",
- "Explicit",
- "False",
- "Finally",
- "For",
- "Friend",
- "From",
- "Function",
- "Get",
- "GetType",
- "Global",
- "GoSub",
- "GoTo",
- "Group",
- "Handles",
- "If",
- "Implements",
- "Imports",
- "In",
- "Infer",
- "Inherits",
- "Integer",
- "Interface",
- "Into",
- "Is",
- "IsNot",
- "Join",
- "Let",
- "Lib",
- "Like",
- "Long",
- "Loop",
- "Me",
- "Mod",
- "Module",
- "MustInherit",
- "MustOverride",
- "MyBase",
- "MyClass",
- "Namespace",
- "Narrowing",
- "New",
- "Next",
- "Not",
- "Nothing",
- "NotInheritable",
- "NotOverridable",
- "Object",
- "Of",
- "Off",
- "On",
- "Operator",
- "Option",
- "Optional",
- "Or",
- "Order",
- "OrElse",
- "Overloads",
- "Overridable",
- "Overrides",
- "ParamArray",
- "Partial",
- "Preserve",
- "Private",
- "Property",
- "Protected",
- "Public",
- "RaiseEvent",
- "ReadOnly",
- "ReDim",
- "Rem",
- "RemoveHandler",
- "Resume",
- "Return",
- "SByte",
- "Select",
- "Set",
- "Shadows",
- "Shared",
- "Short",
- "Single",
- "Skip",
- "Static",
- "Step",
- "Stop",
- "Strict",
- "String",
- "Structure",
- "Sub",
- "SyncLock",
- "Take",
- "Text",
- "Then",
- "Throw",
- "To",
- "True",
- "Try",
- "TryCast",
- "TypeOf",
- "UInteger",
- "ULong",
- "Unicode",
- "Until",
- "UShort",
- "Using",
- "Variant",
- "Wend",
- "When",
- "Where",
- "While",
- "Widening",
- "With",
- "WithEvents",
- "WriteOnly",
- "Xor",
- };
- public static string GetTokenString(int token)
- {
- if (token >= 0 && token < tokenList.Length) {
- return tokenList[token];
- }
- throw new System.NotSupportedException("Unknown token:" + token);
- }
- }
-}
+// this file was autogenerated by a tool.
+using System;
+using System.Collections;
+
+namespace ICSharpCode.NRefactory.Parser.VB
+{
+ public static class Tokens
+ {
+ // ----- terminal classes -----
+ public const int EOF = 0;
+ public const int EOL = 1;
+ public const int Identifier = 2;
+ public const int LiteralString = 3;
+ public const int LiteralCharacter = 4;
+ public const int LiteralInteger = 5;
+ public const int LiteralDouble = 6;
+ public const int LiteralSingle = 7;
+ public const int LiteralDecimal = 8;
+ public const int LiteralDate = 9;
+
+ // ----- special character -----
+ public const int Assign = 10;
+ public const int Colon = 11;
+ public const int Comma = 12;
+ public const int ConcatString = 13;
+ public const int Div = 14;
+ public const int DivInteger = 15;
+ public const int Dot = 16;
+ public const int ExclamationMark = 17;
+ public const int Minus = 18;
+ public const int Plus = 19;
+ public const int Power = 20;
+ public const int QuestionMark = 21;
+ public const int Times = 22;
+ public const int OpenCurlyBrace = 23;
+ public const int CloseCurlyBrace = 24;
+ public const int OpenParenthesis = 25;
+ public const int CloseParenthesis = 26;
+ public const int GreaterThan = 27;
+ public const int LessThan = 28;
+ public const int NotEqual = 29;
+ public const int GreaterEqual = 30;
+ public const int LessEqual = 31;
+ public const int ShiftLeft = 32;
+ public const int ShiftRight = 33;
+ public const int PlusAssign = 34;
+ public const int PowerAssign = 35;
+ public const int MinusAssign = 36;
+ public const int TimesAssign = 37;
+ public const int DivAssign = 38;
+ public const int DivIntegerAssign = 39;
+ public const int ShiftLeftAssign = 40;
+ public const int ShiftRightAssign = 41;
+ public const int ConcatStringAssign = 42;
+
+ // ----- keywords -----
+ public const int AddHandler = 43;
+ public const int AddressOf = 44;
+ public const int Aggregate = 45;
+ public const int Alias = 46;
+ public const int And = 47;
+ public const int AndAlso = 48;
+ public const int Ansi = 49;
+ public const int As = 50;
+ public const int Ascending = 51;
+ public const int Assembly = 52;
+ public const int Auto = 53;
+ public const int Binary = 54;
+ public const int Boolean = 55;
+ public const int ByRef = 56;
+ public const int By = 57;
+ public const int Byte = 58;
+ public const int ByVal = 59;
+ public const int Call = 60;
+ public const int Case = 61;
+ public const int Catch = 62;
+ public const int CBool = 63;
+ public const int CByte = 64;
+ public const int CChar = 65;
+ public const int CDate = 66;
+ public const int CDbl = 67;
+ public const int CDec = 68;
+ public const int Char = 69;
+ public const int CInt = 70;
+ public const int Class = 71;
+ public const int CLng = 72;
+ public const int CObj = 73;
+ public const int Compare = 74;
+ public const int Const = 75;
+ public const int Continue = 76;
+ public const int CSByte = 77;
+ public const int CShort = 78;
+ public const int CSng = 79;
+ public const int CStr = 80;
+ public const int CType = 81;
+ public const int CUInt = 82;
+ public const int CULng = 83;
+ public const int CUShort = 84;
+ public const int Custom = 85;
+ public const int Date = 86;
+ public const int Decimal = 87;
+ public const int Declare = 88;
+ public const int Default = 89;
+ public const int Delegate = 90;
+ public const int Descending = 91;
+ public const int Dim = 92;
+ public const int DirectCast = 93;
+ public const int Distinct = 94;
+ public const int Do = 95;
+ public const int Double = 96;
+ public const int Each = 97;
+ public const int Else = 98;
+ public const int ElseIf = 99;
+ public const int End = 100;
+ public const int EndIf = 101;
+ public const int Enum = 102;
+ new public const int Equals = 103;
+ public const int Erase = 104;
+ public const int Error = 105;
+ public const int Event = 106;
+ public const int Exit = 107;
+ public const int Explicit = 108;
+ public const int False = 109;
+ public const int Finally = 110;
+ public const int For = 111;
+ public const int Friend = 112;
+ public const int From = 113;
+ public const int Function = 114;
+ public const int Get = 115;
+ new public const int GetType = 116;
+ public const int Global = 117;
+ public const int GoSub = 118;
+ public const int GoTo = 119;
+ public const int Group = 120;
+ public const int Handles = 121;
+ public const int If = 122;
+ public const int Implements = 123;
+ public const int Imports = 124;
+ public const int In = 125;
+ public const int Infer = 126;
+ public const int Inherits = 127;
+ public const int Integer = 128;
+ public const int Interface = 129;
+ public const int Into = 130;
+ public const int Is = 131;
+ public const int IsNot = 132;
+ public const int Join = 133;
+ public const int Let = 134;
+ public const int Lib = 135;
+ public const int Like = 136;
+ public const int Long = 137;
+ public const int Loop = 138;
+ public const int Me = 139;
+ public const int Mod = 140;
+ public const int Module = 141;
+ public const int MustInherit = 142;
+ public const int MustOverride = 143;
+ public const int MyBase = 144;
+ public const int MyClass = 145;
+ public const int Namespace = 146;
+ public const int Narrowing = 147;
+ public const int New = 148;
+ public const int Next = 149;
+ public const int Not = 150;
+ public const int Nothing = 151;
+ public const int NotInheritable = 152;
+ public const int NotOverridable = 153;
+ public const int Object = 154;
+ public const int Of = 155;
+ public const int Off = 156;
+ public const int On = 157;
+ public const int Operator = 158;
+ public const int Option = 159;
+ public const int Optional = 160;
+ public const int Or = 161;
+ public const int Order = 162;
+ public const int OrElse = 163;
+ public const int Overloads = 164;
+ public const int Overridable = 165;
+ public const int Overrides = 166;
+ public const int ParamArray = 167;
+ public const int Partial = 168;
+ public const int Preserve = 169;
+ public const int Private = 170;
+ public const int Property = 171;
+ public const int Protected = 172;
+ public const int Public = 173;
+ public const int RaiseEvent = 174;
+ public const int ReadOnly = 175;
+ public const int ReDim = 176;
+ public const int Rem = 177;
+ public const int RemoveHandler = 178;
+ public const int Resume = 179;
+ public const int Return = 180;
+ public const int SByte = 181;
+ public const int Select = 182;
+ public const int Set = 183;
+ public const int Shadows = 184;
+ public const int Shared = 185;
+ public const int Short = 186;
+ public const int Single = 187;
+ public const int Skip = 188;
+ public const int Static = 189;
+ public const int Step = 190;
+ public const int Stop = 191;
+ public const int Strict = 192;
+ public const int String = 193;
+ public const int Structure = 194;
+ public const int Sub = 195;
+ public const int SyncLock = 196;
+ public const int Take = 197;
+ public const int Text = 198;
+ public const int Then = 199;
+ public const int Throw = 200;
+ public const int To = 201;
+ public const int True = 202;
+ public const int Try = 203;
+ public const int TryCast = 204;
+ public const int TypeOf = 205;
+ public const int UInteger = 206;
+ public const int ULong = 207;
+ public const int Unicode = 208;
+ public const int Until = 209;
+ public const int UShort = 210;
+ public const int Using = 211;
+ public const int Variant = 212;
+ public const int Wend = 213;
+ public const int When = 214;
+ public const int Where = 215;
+ public const int While = 216;
+ public const int Widening = 217;
+ public const int With = 218;
+ public const int WithEvents = 219;
+ public const int WriteOnly = 220;
+ public const int Xor = 221;
+
+ public const int MaxToken = 222;
+ static BitArray NewSet(params int[] values)
+ {
+ BitArray bitArray = new BitArray(MaxToken);
+ foreach (int val in values) {
+ bitArray[val] = true;
+ }
+ return bitArray;
+ }
+ public static BitArray Null = NewSet(Nothing);
+ public static BitArray BlockSucc = NewSet(Case, Catch, Else, ElseIf, End, Finally, Loop, Next);
+ public static BitArray IdentifierTokens = NewSet(Text, Binary, Compare, Assembly, Ansi, Auto, Preserve, Unicode, Until, Off, Explicit, Infer, From, Join, Equals, Distinct, Where, Take, Skip, Order, By, Ascending, Descending, Group, Into, Aggregate);
+
+ static string[] tokenList = new string[] {
+ // ----- terminal classes -----
+ "<EOF>",
+ "<EOL>",
+ "<Identifier>",
+ "<LiteralString>",
+ "<LiteralCharacter>",
+ "<LiteralInteger>",
+ "<LiteralDouble>",
+ "<LiteralSingle>",
+ "<LiteralDecimal>",
+ "<LiteralDate>",
+ // ----- special character -----
+ "=",
+ ":",
+ ",",
+ "&",
+ "/",
+ "\\",
+ ".",
+ "!",
+ "-",
+ "+",
+ "^",
+ "?",
+ "*",
+ "{",
+ "}",
+ "(",
+ ")",
+ ">",
+ "<",
+ "<>",
+ ">=",
+ "<=",
+ "<<",
+ ">>",
+ "+=",
+ "^=",
+ "-=",
+ "*=",
+ "/=",
+ "\\=",
+ "<<=",
+ ">>=",
+ "&=",
+ // ----- keywords -----
+ "AddHandler",
+ "AddressOf",
+ "Aggregate",
+ "Alias",
+ "And",
+ "AndAlso",
+ "Ansi",
+ "As",
+ "Ascending",
+ "Assembly",
+ "Auto",
+ "Binary",
+ "Boolean",
+ "ByRef",
+ "By",
+ "Byte",
+ "ByVal",
+ "Call",
+ "Case",
+ "Catch",
+ "CBool",
+ "CByte",
+ "CChar",
+ "CDate",
+ "CDbl",
+ "CDec",
+ "Char",
+ "CInt",
+ "Class",
+ "CLng",
+ "CObj",
+ "Compare",
+ "Const",
+ "Continue",
+ "CSByte",
+ "CShort",
+ "CSng",
+ "CStr",
+ "CType",
+ "CUInt",
+ "CULng",
+ "CUShort",
+ "Custom",
+ "Date",
+ "Decimal",
+ "Declare",
+ "Default",
+ "Delegate",
+ "Descending",
+ "Dim",
+ "DirectCast",
+ "Distinct",
+ "Do",
+ "Double",
+ "Each",
+ "Else",
+ "ElseIf",
+ "End",
+ "EndIf",
+ "Enum",
+ "Equals",
+ "Erase",
+ "Error",
+ "Event",
+ "Exit",
+ "Explicit",
+ "False",
+ "Finally",
+ "For",
+ "Friend",
+ "From",
+ "Function",
+ "Get",
+ "GetType",
+ "Global",
+ "GoSub",
+ "GoTo",
+ "Group",
+ "Handles",
+ "If",
+ "Implements",
+ "Imports",
+ "In",
+ "Infer",
+ "Inherits",
+ "Integer",
+ "Interface",
+ "Into",
+ "Is",
+ "IsNot",
+ "Join",
+ "Let",
+ "Lib",
+ "Like",
+ "Long",
+ "Loop",
+ "Me",
+ "Mod",
+ "Module",
+ "MustInherit",
+ "MustOverride",
+ "MyBase",
+ "MyClass",
+ "Namespace",
+ "Narrowing",
+ "New",
+ "Next",
+ "Not",
+ "Nothing",
+ "NotInheritable",
+ "NotOverridable",
+ "Object",
+ "Of",
+ "Off",
+ "On",
+ "Operator",
+ "Option",
+ "Optional",
+ "Or",
+ "Order",
+ "OrElse",
+ "Overloads",
+ "Overridable",
+ "Overrides",
+ "ParamArray",
+ "Partial",
+ "Preserve",
+ "Private",
+ "Property",
+ "Protected",
+ "Public",
+ "RaiseEvent",
+ "ReadOnly",
+ "ReDim",
+ "Rem",
+ "RemoveHandler",
+ "Resume",
+ "Return",
+ "SByte",
+ "Select",
+ "Set",
+ "Shadows",
+ "Shared",
+ "Short",
+ "Single",
+ "Skip",
+ "Static",
+ "Step",
+ "Stop",
+ "Strict",
+ "String",
+ "Structure",
+ "Sub",
+ "SyncLock",
+ "Take",
+ "Text",
+ "Then",
+ "Throw",
+ "To",
+ "True",
+ "Try",
+ "TryCast",
+ "TypeOf",
+ "UInteger",
+ "ULong",
+ "Unicode",
+ "Until",
+ "UShort",
+ "Using",
+ "Variant",
+ "Wend",
+ "When",
+ "Where",
+ "While",
+ "Widening",
+ "With",
+ "WithEvents",
+ "WriteOnly",
+ "Xor",
+ };
+ public static string GetTokenString(int token)
+ {
+ if (token >= 0 && token < tokenList.Length) {
+ return tokenList[token];
+ }
+ throw new System.NotSupportedException("Unknown token:" + token);
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Location.cs b/main/contrib/NRefactory/Project/Src/Location.cs
index bb9f008639..76b539273d 100644
--- a/main/contrib/NRefactory/Project/Src/Location.cs
+++ b/main/contrib/NRefactory/Project/Src/Location.cs
@@ -1,125 +1,125 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 3718 $</version>
-// </file>
-
-using System;
-
-namespace ICSharpCode.NRefactory
-{
- /// <summary>
- /// A line/column position.
- /// NRefactory lines/columns are counting from one.
- /// </summary>
- public struct Location : IComparable<Location>, IEquatable<Location>
- {
- public static readonly Location Empty = new Location(-1, -1);
-
- public Location(int column, int line)
- {
- x = column;
- y = line;
- }
-
- int x, y;
-
- public int X {
- get { return x; }
- set { x = value; }
- }
-
- public int Y {
- get { return y; }
- set { y = value; }
- }
-
- public int Line {
- get { return y; }
- set { y = value; }
- }
-
- public int Column {
- get { return x; }
- set { x = value; }
- }
-
- public bool IsEmpty {
- get {
- return x <= 0 && y <= 0;
- }
- }
-
- public override string ToString()
- {
- return string.Format("(Line {1}, Col {0})", this.x, this.y);
- }
-
- public override int GetHashCode()
- {
- return unchecked (87 * x.GetHashCode() ^ y.GetHashCode());
- }
-
- public override bool Equals(object obj)
- {
- if (!(obj is Location)) return false;
- return (Location)obj == this;
- }
-
- public bool Equals(Location other)
- {
- return this == other;
- }
-
- public static bool operator ==(Location a, Location b)
- {
- return a.x == b.x && a.y == b.y;
- }
-
- public static bool operator !=(Location a, Location b)
- {
- return a.x != b.x || a.y != b.y;
- }
-
- public static bool operator <(Location a, Location b)
- {
- if (a.y < b.y)
- return true;
- else if (a.y == b.y)
- return a.x < b.x;
- else
- return false;
- }
-
- public static bool operator >(Location a, Location b)
- {
- if (a.y > b.y)
- return true;
- else if (a.y == b.y)
- return a.x > b.x;
- else
- return false;
- }
-
- public static bool operator <=(Location a, Location b)
- {
- return !(a > b);
- }
-
- public static bool operator >=(Location a, Location b)
- {
- return !(a < b);
- }
-
- public int CompareTo(Location other)
- {
- if (this == other)
- return 0;
- if (this < other)
- return -1;
- else
- return 1;
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+
+namespace ICSharpCode.NRefactory
+{
+ /// <summary>
+ /// A line/column position.
+ /// NRefactory lines/columns are counting from one.
+ /// </summary>
+ public struct Location : IComparable<Location>, IEquatable<Location>
+ {
+ public static readonly Location Empty = new Location(-1, -1);
+
+ public Location(int column, int line)
+ {
+ x = column;
+ y = line;
+ }
+
+ int x, y;
+
+ public int X {
+ get { return x; }
+ set { x = value; }
+ }
+
+ public int Y {
+ get { return y; }
+ set { y = value; }
+ }
+
+ public int Line {
+ get { return y; }
+ set { y = value; }
+ }
+
+ public int Column {
+ get { return x; }
+ set { x = value; }
+ }
+
+ public bool IsEmpty {
+ get {
+ return x <= 0 && y <= 0;
+ }
+ }
+
+ public override string ToString()
+ {
+ return string.Format("(Line {1}, Col {0})", this.x, this.y);
+ }
+
+ public override int GetHashCode()
+ {
+ return unchecked (87 * x.GetHashCode() ^ y.GetHashCode());
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (!(obj is Location)) return false;
+ return (Location)obj == this;
+ }
+
+ public bool Equals(Location other)
+ {
+ return this == other;
+ }
+
+ public static bool operator ==(Location a, Location b)
+ {
+ return a.x == b.x && a.y == b.y;
+ }
+
+ public static bool operator !=(Location a, Location b)
+ {
+ return a.x != b.x || a.y != b.y;
+ }
+
+ public static bool operator <(Location a, Location b)
+ {
+ if (a.y < b.y)
+ return true;
+ else if (a.y == b.y)
+ return a.x < b.x;
+ else
+ return false;
+ }
+
+ public static bool operator >(Location a, Location b)
+ {
+ if (a.y > b.y)
+ return true;
+ else if (a.y == b.y)
+ return a.x > b.x;
+ else
+ return false;
+ }
+
+ public static bool operator <=(Location a, Location b)
+ {
+ return !(a > b);
+ }
+
+ public static bool operator >=(Location a, Location b)
+ {
+ return !(a < b);
+ }
+
+ public int CompareTo(Location other)
+ {
+ if (this == other)
+ return 0;
+ if (this < other)
+ return -1;
+ else
+ return 1;
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/OperatorPrecedence.cs b/main/contrib/NRefactory/Project/Src/OperatorPrecedence.cs
index 854949a7ba..7487e7ef57 100644
--- a/main/contrib/NRefactory/Project/Src/OperatorPrecedence.cs
+++ b/main/contrib/NRefactory/Project/Src/OperatorPrecedence.cs
@@ -1,88 +1,88 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 2644$</version>
-// </file>
-
-using System;
-using System.Collections.Generic;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory
-{
- /// <summary>
- /// Stores the operator precedences for the output visitor.
- /// </summary>
- static class OperatorPrecedence
- {
- static readonly Dictionary<BinaryOperatorType, int> vbDict = MakePrecedenceTable(
- new BinaryOperatorType[] { BinaryOperatorType.Power },
- new BinaryOperatorType[] { BinaryOperatorType.Multiply, BinaryOperatorType.Divide },
- new BinaryOperatorType[] { BinaryOperatorType.DivideInteger },
- new BinaryOperatorType[] { BinaryOperatorType.Modulus },
- new BinaryOperatorType[] { BinaryOperatorType.Add, BinaryOperatorType.Subtract },
- new BinaryOperatorType[] { BinaryOperatorType.Concat },
- new BinaryOperatorType[] { BinaryOperatorType.ShiftLeft, BinaryOperatorType.ShiftRight },
- new BinaryOperatorType[] {
- BinaryOperatorType.Equality, BinaryOperatorType.InEquality,
- BinaryOperatorType.LessThan, BinaryOperatorType.LessThanOrEqual,
- BinaryOperatorType.GreaterThan, BinaryOperatorType.GreaterThanOrEqual,
- BinaryOperatorType.ReferenceEquality, BinaryOperatorType.ReferenceInequality,
- BinaryOperatorType.Like
- },
- new BinaryOperatorType[] { BinaryOperatorType.LogicalAnd, BinaryOperatorType.BitwiseAnd },
- new BinaryOperatorType[] { BinaryOperatorType.LogicalOr, BinaryOperatorType.BitwiseOr },
- new BinaryOperatorType[] { BinaryOperatorType.ExclusiveOr }
- );
-
- static readonly Dictionary<BinaryOperatorType, int> csharpDict = MakePrecedenceTable(
- new BinaryOperatorType[] { BinaryOperatorType.Multiply, BinaryOperatorType.Divide, BinaryOperatorType.Modulus },
- new BinaryOperatorType[] { BinaryOperatorType.Add, BinaryOperatorType.Subtract },
- new BinaryOperatorType[] { BinaryOperatorType.ShiftLeft, BinaryOperatorType.ShiftRight },
- new BinaryOperatorType[] {
- BinaryOperatorType.LessThan, BinaryOperatorType.LessThanOrEqual,
- BinaryOperatorType.GreaterThan, BinaryOperatorType.GreaterThanOrEqual,
- },
- new BinaryOperatorType[] { BinaryOperatorType.Equality, BinaryOperatorType.InEquality },
- new BinaryOperatorType[] { BinaryOperatorType.BitwiseAnd },
- new BinaryOperatorType[] { BinaryOperatorType.ExclusiveOr },
- new BinaryOperatorType[] { BinaryOperatorType.BitwiseOr },
- new BinaryOperatorType[] { BinaryOperatorType.LogicalAnd, BinaryOperatorType.LogicalOr },
- new BinaryOperatorType[] { BinaryOperatorType.NullCoalescing }
- );
-
- // create a dictionary operator->precedence (higher value = higher precedence)
- static Dictionary<BinaryOperatorType, int> MakePrecedenceTable(params BinaryOperatorType[][] input)
- {
- Dictionary<BinaryOperatorType, int> dict = new Dictionary<BinaryOperatorType, int>();
- for (int i = 0; i < input.Length; i++) {
- foreach (BinaryOperatorType op in input[i]) {
- dict.Add(op, input.Length - i);
- }
- }
- return dict;
- }
-
- public static int ComparePrecedenceVB(BinaryOperatorType op1, BinaryOperatorType op2)
- {
- int p1 = GetOperatorPrecedence(vbDict, op1);
- int p2 = GetOperatorPrecedence(vbDict, op2);
- return p1.CompareTo(p2);
- }
-
- public static int ComparePrecedenceCSharp(BinaryOperatorType op1, BinaryOperatorType op2)
- {
- int p1 = GetOperatorPrecedence(csharpDict, op1);
- int p2 = GetOperatorPrecedence(csharpDict, op2);
- return p1.CompareTo(p2);
- }
-
- static int GetOperatorPrecedence(Dictionary<BinaryOperatorType, int> dict, BinaryOperatorType op)
- {
- int p;
- dict.TryGetValue(op, out p);
- return p;
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
+// <version>$Revision: 2644$</version>
+// </file>
+
+using System;
+using System.Collections.Generic;
+using ICSharpCode.NRefactory.Ast;
+
+namespace ICSharpCode.NRefactory
+{
+ /// <summary>
+ /// Stores the operator precedences for the output visitor.
+ /// </summary>
+ static class OperatorPrecedence
+ {
+ static readonly Dictionary<BinaryOperatorType, int> vbDict = MakePrecedenceTable(
+ new BinaryOperatorType[] { BinaryOperatorType.Power },
+ new BinaryOperatorType[] { BinaryOperatorType.Multiply, BinaryOperatorType.Divide },
+ new BinaryOperatorType[] { BinaryOperatorType.DivideInteger },
+ new BinaryOperatorType[] { BinaryOperatorType.Modulus },
+ new BinaryOperatorType[] { BinaryOperatorType.Add, BinaryOperatorType.Subtract },
+ new BinaryOperatorType[] { BinaryOperatorType.Concat },
+ new BinaryOperatorType[] { BinaryOperatorType.ShiftLeft, BinaryOperatorType.ShiftRight },
+ new BinaryOperatorType[] {
+ BinaryOperatorType.Equality, BinaryOperatorType.InEquality,
+ BinaryOperatorType.LessThan, BinaryOperatorType.LessThanOrEqual,
+ BinaryOperatorType.GreaterThan, BinaryOperatorType.GreaterThanOrEqual,
+ BinaryOperatorType.ReferenceEquality, BinaryOperatorType.ReferenceInequality,
+ BinaryOperatorType.Like
+ },
+ new BinaryOperatorType[] { BinaryOperatorType.LogicalAnd, BinaryOperatorType.BitwiseAnd },
+ new BinaryOperatorType[] { BinaryOperatorType.LogicalOr, BinaryOperatorType.BitwiseOr },
+ new BinaryOperatorType[] { BinaryOperatorType.ExclusiveOr }
+ );
+
+ static readonly Dictionary<BinaryOperatorType, int> csharpDict = MakePrecedenceTable(
+ new BinaryOperatorType[] { BinaryOperatorType.Multiply, BinaryOperatorType.Divide, BinaryOperatorType.Modulus },
+ new BinaryOperatorType[] { BinaryOperatorType.Add, BinaryOperatorType.Subtract },
+ new BinaryOperatorType[] { BinaryOperatorType.ShiftLeft, BinaryOperatorType.ShiftRight },
+ new BinaryOperatorType[] {
+ BinaryOperatorType.LessThan, BinaryOperatorType.LessThanOrEqual,
+ BinaryOperatorType.GreaterThan, BinaryOperatorType.GreaterThanOrEqual,
+ },
+ new BinaryOperatorType[] { BinaryOperatorType.Equality, BinaryOperatorType.InEquality },
+ new BinaryOperatorType[] { BinaryOperatorType.BitwiseAnd },
+ new BinaryOperatorType[] { BinaryOperatorType.ExclusiveOr },
+ new BinaryOperatorType[] { BinaryOperatorType.BitwiseOr },
+ new BinaryOperatorType[] { BinaryOperatorType.LogicalAnd, BinaryOperatorType.LogicalOr },
+ new BinaryOperatorType[] { BinaryOperatorType.NullCoalescing }
+ );
+
+ // create a dictionary operator->precedence (higher value = higher precedence)
+ static Dictionary<BinaryOperatorType, int> MakePrecedenceTable(params BinaryOperatorType[][] input)
+ {
+ Dictionary<BinaryOperatorType, int> dict = new Dictionary<BinaryOperatorType, int>();
+ for (int i = 0; i < input.Length; i++) {
+ foreach (BinaryOperatorType op in input[i]) {
+ dict.Add(op, input.Length - i);
+ }
+ }
+ return dict;
+ }
+
+ public static int ComparePrecedenceVB(BinaryOperatorType op1, BinaryOperatorType op2)
+ {
+ int p1 = GetOperatorPrecedence(vbDict, op1);
+ int p2 = GetOperatorPrecedence(vbDict, op2);
+ return p1.CompareTo(p2);
+ }
+
+ public static int ComparePrecedenceCSharp(BinaryOperatorType op1, BinaryOperatorType op2)
+ {
+ int p1 = GetOperatorPrecedence(csharpDict, op1);
+ int p2 = GetOperatorPrecedence(csharpDict, op2);
+ return p1.CompareTo(p2);
+ }
+
+ static int GetOperatorPrecedence(Dictionary<BinaryOperatorType, int> dict, BinaryOperatorType op)
+ {
+ int p;
+ dict.TryGetValue(op, out p);
+ return p;
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Parser/AbstractParser.cs b/main/contrib/NRefactory/Project/Src/Parser/AbstractParser.cs
index 3c0ce23c65..1d2b83c068 100644
--- a/main/contrib/NRefactory/Project/Src/Parser/AbstractParser.cs
+++ b/main/contrib/NRefactory/Project/Src/Parser/AbstractParser.cs
@@ -1,110 +1,110 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 2533M $</version>
-// </file>
-
-using System;
-using System.Collections.Generic;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Parser
-{
- public abstract class AbstractParser : IParser
- {
- protected const int MinErrDist = 2;
- protected const string ErrMsgFormat = "-- line {0} col {1}: {2}"; // 0=line, 1=column, 2=text
-
-
- private Errors errors;
- private ILexer lexer;
-
- protected int errDist = MinErrDist;
-
- [CLSCompliant(false)]
- protected CompilationUnit compilationUnit;
-
- bool parseMethodContents = true;
-
- public bool ParseMethodBodies {
- get {
- return parseMethodContents;
- }
- set {
- parseMethodContents = value;
- }
- }
-
- public ILexer Lexer {
- get {
- return lexer;
- }
- }
-
- public Errors Errors {
- get {
- return errors;
- }
- }
-
- public CompilationUnit CompilationUnit {
- get {
- return compilationUnit;
- }
- }
-
- internal AbstractParser(ILexer lexer)
- {
- this.errors = lexer.Errors;
- this.lexer = lexer;
- errors.SynErr = new ErrorCodeProc(SynErr);
- }
-
- public abstract void Parse();
-
- public abstract TypeReference ParseTypeReference ();
- public abstract Expression ParseExpression();
- public abstract BlockStatement ParseBlock();
- public abstract List<INode> ParseTypeMembers();
-
- protected abstract void SynErr(int line, int col, int errorNumber);
-
- protected void SynErr(int n)
- {
- if (errDist >= MinErrDist) {
- errors.SynErr(lexer.LookAhead.line, lexer.LookAhead.col, n);
- }
- errDist = 0;
- }
-
- protected void SemErr(string msg)
- {
- if (errDist >= MinErrDist) {
- errors.Error(lexer.Token.line, lexer.Token.col, msg);
- }
- errDist = 0;
- }
-
- protected void Expect(int n)
- {
- if (lexer.LookAhead.kind == n) {
- lexer.NextToken();
- } else {
- SynErr(n);
- }
- }
-
- #region System.IDisposable interface implementation
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly")]
- public void Dispose()
- {
- errors = null;
- if (lexer != null) {
- lexer.Dispose();
- }
- lexer = null;
- }
- #endregion
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+using System.Collections.Generic;
+using ICSharpCode.NRefactory.Ast;
+
+namespace ICSharpCode.NRefactory.Parser
+{
+ public abstract class AbstractParser : IParser
+ {
+ protected const int MinErrDist = 2;
+ protected const string ErrMsgFormat = "-- line {0} col {1}: {2}"; // 0=line, 1=column, 2=text
+
+
+ private Errors errors;
+ private ILexer lexer;
+
+ protected int errDist = MinErrDist;
+
+ [CLSCompliant(false)]
+ protected CompilationUnit compilationUnit;
+
+ bool parseMethodContents = true;
+
+ public bool ParseMethodBodies {
+ get {
+ return parseMethodContents;
+ }
+ set {
+ parseMethodContents = value;
+ }
+ }
+
+ public ILexer Lexer {
+ get {
+ return lexer;
+ }
+ }
+
+ public Errors Errors {
+ get {
+ return errors;
+ }
+ }
+
+ public CompilationUnit CompilationUnit {
+ get {
+ return compilationUnit;
+ }
+ }
+
+ internal AbstractParser(ILexer lexer)
+ {
+ this.errors = lexer.Errors;
+ this.lexer = lexer;
+ errors.SynErr = new ErrorCodeProc(SynErr);
+ }
+
+ public abstract void Parse();
+
+ public abstract TypeReference ParseTypeReference ();
+ public abstract Expression ParseExpression();
+ public abstract BlockStatement ParseBlock();
+ public abstract List<INode> ParseTypeMembers();
+
+ protected abstract void SynErr(int line, int col, int errorNumber);
+
+ protected void SynErr(int n)
+ {
+ if (errDist >= MinErrDist) {
+ errors.SynErr(lexer.LookAhead.line, lexer.LookAhead.col, n);
+ }
+ errDist = 0;
+ }
+
+ protected void SemErr(string msg)
+ {
+ if (errDist >= MinErrDist) {
+ errors.Error(lexer.Token.line, lexer.Token.col, msg);
+ }
+ errDist = 0;
+ }
+
+ protected void Expect(int n)
+ {
+ if (lexer.LookAhead.kind == n) {
+ lexer.NextToken();
+ } else {
+ SynErr(n);
+ }
+ }
+
+ #region System.IDisposable interface implementation
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1063:ImplementIDisposableCorrectly")]
+ public void Dispose()
+ {
+ errors = null;
+ if (lexer != null) {
+ lexer.Dispose();
+ }
+ lexer = null;
+ }
+ #endregion
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Parser/CSharp/CSharpParser.cs b/main/contrib/NRefactory/Project/Src/Parser/CSharp/CSharpParser.cs
index f5a49eeb38..05992dbc89 100644
--- a/main/contrib/NRefactory/Project/Src/Parser/CSharp/CSharpParser.cs
+++ b/main/contrib/NRefactory/Project/Src/Parser/CSharp/CSharpParser.cs
@@ -2,7 +2,7 @@
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 3943 $</version>
+// <version>$Revision: 4740 $</version>
// </file>
using ICSharpCode.NRefactory.Visitors;
@@ -610,5 +610,70 @@ namespace ICSharpCode.NRefactory.Parser.CSharp
item.Parent = parent;
}
}
+
+ internal static string GetReflectionNameForOperator(OverloadableOperatorType op)
+ {
+ switch (op) {
+ case OverloadableOperatorType.Add:
+ return "op_Addition";
+ case OverloadableOperatorType.BitNot:
+ return "op_OnesComplement";
+ case OverloadableOperatorType.BitwiseAnd:
+ return "op_BitwiseAnd";
+ case OverloadableOperatorType.BitwiseOr:
+ return "op_BitwiseOr";
+ case OverloadableOperatorType.Concat:
+ case OverloadableOperatorType.CType:
+ return "op_unknown";
+ case OverloadableOperatorType.Decrement:
+ return "op_Decrement";
+ case OverloadableOperatorType.Divide:
+ return "op_Division";
+ case OverloadableOperatorType.DivideInteger:
+ return "op_unknown";
+ case OverloadableOperatorType.Equality:
+ return "op_Equality";
+ case OverloadableOperatorType.ExclusiveOr:
+ return "op_ExclusiveOr";
+ case OverloadableOperatorType.GreaterThan:
+ return "op_GreaterThan";
+ case OverloadableOperatorType.GreaterThanOrEqual:
+ return "op_GreaterThanOrEqual";
+ case OverloadableOperatorType.Increment:
+ return "op_Increment";
+ case OverloadableOperatorType.InEquality:
+ return "op_Inequality";
+ case OverloadableOperatorType.IsFalse:
+ return "op_False";
+ case OverloadableOperatorType.IsTrue:
+ return "op_True";
+ case OverloadableOperatorType.LessThan:
+ return "op_LessThan";
+ case OverloadableOperatorType.LessThanOrEqual:
+ return "op_LessThanOrEqual";
+ case OverloadableOperatorType.Like:
+ return "op_unknown";
+ case OverloadableOperatorType.Modulus:
+ return "op_Modulus";
+ case OverloadableOperatorType.Multiply:
+ return "op_Multiply";
+ case OverloadableOperatorType.Not:
+ return "op_LogicalNot";
+ case OverloadableOperatorType.Power:
+ return "op_unknown";
+ case OverloadableOperatorType.ShiftLeft:
+ return "op_LeftShift";
+ case OverloadableOperatorType.ShiftRight:
+ return "op_RightShift";
+ case OverloadableOperatorType.Subtract:
+ return "op_Subtraction";
+ case OverloadableOperatorType.UnaryMinus:
+ return "op_UnaryNegation";
+ case OverloadableOperatorType.UnaryPlus:
+ return "op_UnaryPlus";
+ default:
+ throw new NotSupportedException();
+ }
+ }
}
}
diff --git a/main/contrib/NRefactory/Project/Src/Parser/CSharp/Parser.cs b/main/contrib/NRefactory/Project/Src/Parser/CSharp/Parser.cs
index c6f1e5e466..59627eabb5 100644
--- a/main/contrib/NRefactory/Project/Src/Parser/CSharp/Parser.cs
+++ b/main/contrib/NRefactory/Project/Src/Parser/CSharp/Parser.cs
@@ -1570,23 +1570,23 @@ ModifierList m) {
}
void ClassMemberDecl(
-#line 1054 "cs.ATG"
+#line 1060 "cs.ATG"
ModifierList m, List<AttributeSection> attributes) {
-#line 1055 "cs.ATG"
+#line 1061 "cs.ATG"
Statement stmt = null;
if (StartOf(21)) {
StructMemberDecl(
-#line 1057 "cs.ATG"
+#line 1063 "cs.ATG"
m, attributes);
} else if (la.kind == 27) {
-#line 1058 "cs.ATG"
+#line 1064 "cs.ATG"
m.Check(Modifiers.Destructors); Location startPos = la.Location;
lexer.NextToken();
Identifier();
-#line 1059 "cs.ATG"
+#line 1065 "cs.ATG"
DestructorDeclaration d = new DestructorDeclaration(t.val, m.Modifier, attributes);
d.Modifier = m.Modifier;
d.StartLocation = m.GetDeclarationLocation(startPos);
@@ -1594,17 +1594,17 @@ m, attributes);
Expect(20);
Expect(21);
-#line 1063 "cs.ATG"
+#line 1069 "cs.ATG"
d.EndLocation = t.EndLocation;
if (la.kind == 16) {
Block(
-#line 1063 "cs.ATG"
+#line 1069 "cs.ATG"
out stmt);
} else if (la.kind == 11) {
lexer.NextToken();
} else SynErr(160);
-#line 1064 "cs.ATG"
+#line 1070 "cs.ATG"
d.Body = (BlockStatement)stmt;
compilationUnit.AddChild(d);
@@ -1930,6 +1930,7 @@ out stmt);
List<ParameterDeclarationExpression> parameters = new List<ParameterDeclarationExpression>();
parameters.Add(new ParameterDeclarationExpression(type, varName));
OperatorDeclaration operatorDeclaration = new OperatorDeclaration {
+ Name = (isImplicit ? "op_Implicit" : "op_Explicit"),
Modifier = m.Modifier,
Attributes = attributes,
Parameters = parameters,
@@ -1943,69 +1944,74 @@ out stmt);
} else if (StartOf(22)) {
TypeDecl(
-#line 897 "cs.ATG"
+#line 898 "cs.ATG"
m, attributes);
} else if (StartOf(10)) {
Type(
-#line 899 "cs.ATG"
+#line 900 "cs.ATG"
out type);
-#line 899 "cs.ATG"
+#line 900 "cs.ATG"
Location startPos = t.Location;
if (la.kind == 92) {
-#line 901 "cs.ATG"
+#line 902 "cs.ATG"
OverloadableOperatorType op;
m.Check(Modifiers.Operators);
if (m.isNone) Error("at least one modifier must be set");
lexer.NextToken();
OverloadableOperator(
-#line 905 "cs.ATG"
+#line 906 "cs.ATG"
out op);
-#line 905 "cs.ATG"
+#line 906 "cs.ATG"
TypeReference firstType, secondType = null; string secondName = null;
Expect(20);
Type(
-#line 906 "cs.ATG"
+#line 907 "cs.ATG"
out firstType);
Identifier();
-#line 906 "cs.ATG"
+#line 907 "cs.ATG"
string firstName = t.val;
if (la.kind == 14) {
lexer.NextToken();
Type(
-#line 907 "cs.ATG"
+#line 908 "cs.ATG"
out secondType);
Identifier();
-#line 907 "cs.ATG"
+#line 908 "cs.ATG"
secondName = t.val;
} else if (la.kind == 21) {
} else SynErr(167);
-#line 915 "cs.ATG"
+#line 916 "cs.ATG"
Location endPos = t.Location;
Expect(21);
if (la.kind == 16) {
Block(
-#line 916 "cs.ATG"
+#line 917 "cs.ATG"
out stmt);
} else if (la.kind == 11) {
lexer.NextToken();
} else SynErr(168);
-#line 918 "cs.ATG"
+#line 919 "cs.ATG"
+ if (op == OverloadableOperatorType.Add && secondType == null)
+ op = OverloadableOperatorType.UnaryPlus;
+ if (op == OverloadableOperatorType.Subtract && secondType == null)
+ op = OverloadableOperatorType.UnaryMinus;
OperatorDeclaration operatorDeclaration = new OperatorDeclaration {
- Modifier = m.Modifier,
- Attributes = attributes,
- TypeReference = type,
- OverloadableOperator = op,
- Body = (BlockStatement)stmt,
- StartLocation = m.GetDeclarationLocation(startPos),
- EndLocation = endPos
+ Modifier = m.Modifier,
+ Attributes = attributes,
+ TypeReference = type,
+ OverloadableOperator = op,
+ Name = GetReflectionNameForOperator(op),
+ Body = (BlockStatement)stmt,
+ StartLocation = m.GetDeclarationLocation(startPos),
+ EndLocation = endPos
};
SafeAdd(operatorDeclaration, operatorDeclaration.Parameters, new ParameterDeclarationExpression(firstType, firstName));
if (secondType != null) {
@@ -2014,75 +2020,75 @@ out stmt);
compilationUnit.AddChild(operatorDeclaration);
} else if (
-#line 935 "cs.ATG"
+#line 941 "cs.ATG"
IsVarDecl()) {
-#line 936 "cs.ATG"
+#line 942 "cs.ATG"
m.Check(Modifiers.Fields);
FieldDeclaration fd = new FieldDeclaration(attributes, type, m.Modifier);
fd.StartLocation = m.GetDeclarationLocation(startPos);
if (
-#line 940 "cs.ATG"
+#line 946 "cs.ATG"
m.Contains(Modifiers.Fixed)) {
VariableDeclarator(
-#line 941 "cs.ATG"
+#line 947 "cs.ATG"
fd);
Expect(18);
Expr(
-#line 943 "cs.ATG"
+#line 949 "cs.ATG"
out expr);
-#line 943 "cs.ATG"
+#line 949 "cs.ATG"
if (fd.Fields.Count > 0)
fd.Fields[fd.Fields.Count-1].FixedArrayInitialization = expr;
Expect(19);
while (la.kind == 14) {
lexer.NextToken();
VariableDeclarator(
-#line 947 "cs.ATG"
+#line 953 "cs.ATG"
fd);
Expect(18);
Expr(
-#line 949 "cs.ATG"
+#line 955 "cs.ATG"
out expr);
-#line 949 "cs.ATG"
+#line 955 "cs.ATG"
if (fd.Fields.Count > 0)
fd.Fields[fd.Fields.Count-1].FixedArrayInitialization = expr;
Expect(19);
}
} else if (StartOf(19)) {
VariableDeclarator(
-#line 954 "cs.ATG"
+#line 960 "cs.ATG"
fd);
while (la.kind == 14) {
lexer.NextToken();
VariableDeclarator(
-#line 955 "cs.ATG"
+#line 961 "cs.ATG"
fd);
}
} else SynErr(169);
Expect(11);
-#line 957 "cs.ATG"
+#line 963 "cs.ATG"
fd.EndLocation = t.EndLocation; compilationUnit.AddChild(fd);
} else if (la.kind == 111) {
-#line 960 "cs.ATG"
+#line 966 "cs.ATG"
m.Check(Modifiers.Indexers);
lexer.NextToken();
Expect(18);
FormalParameterList(
-#line 961 "cs.ATG"
+#line 967 "cs.ATG"
p);
Expect(19);
-#line 961 "cs.ATG"
+#line 967 "cs.ATG"
Location endLocation = t.EndLocation;
Expect(16);
-#line 962 "cs.ATG"
+#line 968 "cs.ATG"
IndexerDeclaration indexer = new IndexerDeclaration(type, p, m.Modifier, attributes);
indexer.StartLocation = startPos;
indexer.EndLocation = endLocation;
@@ -2091,64 +2097,64 @@ p);
PropertySetRegion setRegion;
AccessorDecls(
-#line 969 "cs.ATG"
+#line 975 "cs.ATG"
out getRegion, out setRegion);
Expect(17);
-#line 970 "cs.ATG"
+#line 976 "cs.ATG"
indexer.BodyEnd = t.EndLocation;
indexer.GetRegion = getRegion;
indexer.SetRegion = setRegion;
compilationUnit.AddChild(indexer);
} else if (
-#line 975 "cs.ATG"
+#line 981 "cs.ATG"
IsIdentifierToken(la)) {
if (
-#line 976 "cs.ATG"
+#line 982 "cs.ATG"
IsExplicitInterfaceImplementation()) {
TypeName(
-#line 977 "cs.ATG"
+#line 983 "cs.ATG"
out explicitInterface, false);
-#line 978 "cs.ATG"
+#line 984 "cs.ATG"
if (la.kind != Tokens.Dot || Peek(1).kind != Tokens.This) {
qualident = TypeReference.StripLastIdentifierFromType(ref explicitInterface);
}
} else if (StartOf(19)) {
Identifier();
-#line 981 "cs.ATG"
+#line 987 "cs.ATG"
qualident = t.val;
} else SynErr(170);
-#line 983 "cs.ATG"
+#line 989 "cs.ATG"
Location qualIdentEndLocation = t.EndLocation;
if (la.kind == 16 || la.kind == 20 || la.kind == 23) {
if (la.kind == 20 || la.kind == 23) {
-#line 987 "cs.ATG"
+#line 993 "cs.ATG"
m.Check(Modifiers.PropertysEventsMethods);
if (la.kind == 23) {
TypeParameterList(
-#line 989 "cs.ATG"
+#line 995 "cs.ATG"
templates);
}
Expect(20);
if (la.kind == 111) {
lexer.NextToken();
-#line 991 "cs.ATG"
+#line 997 "cs.ATG"
isExtensionMethod = true;
}
if (StartOf(11)) {
FormalParameterList(
-#line 992 "cs.ATG"
+#line 998 "cs.ATG"
p);
}
Expect(21);
-#line 994 "cs.ATG"
+#line 1000 "cs.ATG"
MethodDeclaration methodDeclaration = new MethodDeclaration {
Name = qualident,
Modifier = m.Modifier,
@@ -2166,23 +2172,23 @@ p);
while (la.kind == 127) {
TypeParameterConstraintsClause(
-#line 1009 "cs.ATG"
+#line 1015 "cs.ATG"
templates);
}
if (la.kind == 16) {
Block(
-#line 1010 "cs.ATG"
+#line 1016 "cs.ATG"
out stmt);
} else if (la.kind == 11) {
lexer.NextToken();
} else SynErr(171);
-#line 1010 "cs.ATG"
+#line 1016 "cs.ATG"
methodDeclaration.Body = (BlockStatement)stmt;
} else {
lexer.NextToken();
-#line 1013 "cs.ATG"
+#line 1019 "cs.ATG"
PropertyDeclaration pDecl = new PropertyDeclaration(qualident, type, m.Modifier, attributes);
if (explicitInterface != null)
pDecl.InterfaceImplementations.Add(new InterfaceImplementation(explicitInterface, qualident));
@@ -2193,11 +2199,11 @@ out stmt);
PropertySetRegion setRegion;
AccessorDecls(
-#line 1022 "cs.ATG"
+#line 1028 "cs.ATG"
out getRegion, out setRegion);
Expect(17);
-#line 1024 "cs.ATG"
+#line 1030 "cs.ATG"
pDecl.GetRegion = getRegion;
pDecl.SetRegion = setRegion;
pDecl.BodyEnd = t.EndLocation;
@@ -2206,17 +2212,17 @@ out getRegion, out setRegion);
}
} else if (la.kind == 15) {
-#line 1032 "cs.ATG"
+#line 1038 "cs.ATG"
m.Check(Modifiers.Indexers);
lexer.NextToken();
Expect(111);
Expect(18);
FormalParameterList(
-#line 1033 "cs.ATG"
+#line 1039 "cs.ATG"
p);
Expect(19);
-#line 1034 "cs.ATG"
+#line 1040 "cs.ATG"
IndexerDeclaration indexer = new IndexerDeclaration(type, p, m.Modifier, attributes);
indexer.StartLocation = m.GetDeclarationLocation(startPos);
indexer.EndLocation = t.EndLocation;
@@ -2227,14 +2233,14 @@ p);
Expect(16);
-#line 1042 "cs.ATG"
+#line 1048 "cs.ATG"
Location bodyStart = t.Location;
AccessorDecls(
-#line 1043 "cs.ATG"
+#line 1049 "cs.ATG"
out getRegion, out setRegion);
Expect(17);
-#line 1044 "cs.ATG"
+#line 1050 "cs.ATG"
indexer.BodyStart = bodyStart;
indexer.BodyEnd = t.EndLocation;
indexer.GetRegion = getRegion;
@@ -2248,9 +2254,10 @@ out getRegion, out setRegion);
void InterfaceMemberDecl() {
-#line 1071 "cs.ATG"
+#line 1077 "cs.ATG"
TypeReference type;
- AttributeSection section;
+
+ AttributeSection section;
Modifiers mod = Modifiers.None;
List<AttributeSection> attributes = new List<AttributeSection>();
List<ParameterDeclarationExpression> parameters = new List<ParameterDeclarationExpression>();
@@ -2262,49 +2269,49 @@ out getRegion, out setRegion);
while (la.kind == 18) {
AttributeSection(
-#line 1084 "cs.ATG"
+#line 1090 "cs.ATG"
out section);
-#line 1084 "cs.ATG"
+#line 1090 "cs.ATG"
attributes.Add(section);
}
if (la.kind == 89) {
lexer.NextToken();
-#line 1085 "cs.ATG"
+#line 1091 "cs.ATG"
mod = Modifiers.New; startLocation = t.Location;
}
if (
-#line 1088 "cs.ATG"
+#line 1094 "cs.ATG"
NotVoidPointer()) {
Expect(123);
-#line 1088 "cs.ATG"
+#line 1094 "cs.ATG"
if (startLocation.IsEmpty) startLocation = t.Location;
Identifier();
-#line 1089 "cs.ATG"
+#line 1095 "cs.ATG"
name = t.val;
if (la.kind == 23) {
TypeParameterList(
-#line 1090 "cs.ATG"
+#line 1096 "cs.ATG"
templates);
}
Expect(20);
if (StartOf(11)) {
FormalParameterList(
-#line 1091 "cs.ATG"
+#line 1097 "cs.ATG"
parameters);
}
Expect(21);
while (la.kind == 127) {
TypeParameterConstraintsClause(
-#line 1092 "cs.ATG"
+#line 1098 "cs.ATG"
templates);
}
Expect(11);
-#line 1094 "cs.ATG"
+#line 1100 "cs.ATG"
MethodDeclaration md = new MethodDeclaration {
Name = name, Modifier = mod, TypeReference = new TypeReference("System.Void", true),
Parameters = parameters, Attributes = attributes, Templates = templates,
@@ -2315,37 +2322,37 @@ templates);
} else if (StartOf(23)) {
if (StartOf(10)) {
Type(
-#line 1102 "cs.ATG"
+#line 1108 "cs.ATG"
out type);
-#line 1102 "cs.ATG"
+#line 1108 "cs.ATG"
if (startLocation.IsEmpty) startLocation = t.Location;
if (StartOf(19)) {
Identifier();
-#line 1104 "cs.ATG"
+#line 1110 "cs.ATG"
name = t.val; Location qualIdentEndLocation = t.EndLocation;
if (la.kind == 20 || la.kind == 23) {
if (la.kind == 23) {
TypeParameterList(
-#line 1108 "cs.ATG"
+#line 1114 "cs.ATG"
templates);
}
Expect(20);
if (StartOf(11)) {
FormalParameterList(
-#line 1109 "cs.ATG"
+#line 1115 "cs.ATG"
parameters);
}
Expect(21);
while (la.kind == 127) {
TypeParameterConstraintsClause(
-#line 1111 "cs.ATG"
+#line 1117 "cs.ATG"
templates);
}
Expect(11);
-#line 1112 "cs.ATG"
+#line 1118 "cs.ATG"
MethodDeclaration md = new MethodDeclaration {
Name = name, Modifier = mod, TypeReference = type,
Parameters = parameters, Attributes = attributes, Templates = templates,
@@ -2355,58 +2362,58 @@ templates);
} else if (la.kind == 16) {
-#line 1121 "cs.ATG"
+#line 1127 "cs.ATG"
PropertyDeclaration pd = new PropertyDeclaration(name, type, mod, attributes);
compilationUnit.AddChild(pd);
lexer.NextToken();
-#line 1124 "cs.ATG"
+#line 1130 "cs.ATG"
Location bodyStart = t.Location;
InterfaceAccessors(
-#line 1125 "cs.ATG"
+#line 1131 "cs.ATG"
out getBlock, out setBlock);
Expect(17);
-#line 1126 "cs.ATG"
+#line 1132 "cs.ATG"
pd.GetRegion = getBlock; pd.SetRegion = setBlock; pd.StartLocation = startLocation; pd.EndLocation = qualIdentEndLocation; pd.BodyStart = bodyStart; pd.BodyEnd = t.EndLocation;
} else SynErr(175);
} else if (la.kind == 111) {
lexer.NextToken();
Expect(18);
FormalParameterList(
-#line 1129 "cs.ATG"
+#line 1135 "cs.ATG"
parameters);
Expect(19);
-#line 1130 "cs.ATG"
+#line 1136 "cs.ATG"
Location bracketEndLocation = t.EndLocation;
-#line 1131 "cs.ATG"
+#line 1137 "cs.ATG"
IndexerDeclaration id = new IndexerDeclaration(type, parameters, mod, attributes);
compilationUnit.AddChild(id);
Expect(16);
-#line 1133 "cs.ATG"
+#line 1139 "cs.ATG"
Location bodyStart = t.Location;
InterfaceAccessors(
-#line 1134 "cs.ATG"
+#line 1140 "cs.ATG"
out getBlock, out setBlock);
Expect(17);
-#line 1136 "cs.ATG"
+#line 1142 "cs.ATG"
id.GetRegion = getBlock; id.SetRegion = setBlock; id.StartLocation = startLocation; id.EndLocation = bracketEndLocation; id.BodyStart = bodyStart; id.BodyEnd = t.EndLocation;
} else SynErr(176);
} else {
lexer.NextToken();
-#line 1139 "cs.ATG"
+#line 1145 "cs.ATG"
if (startLocation.IsEmpty) startLocation = t.Location;
Type(
-#line 1140 "cs.ATG"
+#line 1146 "cs.ATG"
out type);
Identifier();
-#line 1141 "cs.ATG"
+#line 1147 "cs.ATG"
EventDeclaration ed = new EventDeclaration {
TypeReference = type, Name = t.val, Modifier = mod, Attributes = attributes
};
@@ -2414,17 +2421,17 @@ out type);
Expect(11);
-#line 1147 "cs.ATG"
+#line 1153 "cs.ATG"
ed.StartLocation = startLocation; ed.EndLocation = t.EndLocation;
}
} else SynErr(177);
}
void EnumMemberDecl(
-#line 1152 "cs.ATG"
+#line 1158 "cs.ATG"
out FieldDeclaration f) {
-#line 1154 "cs.ATG"
+#line 1160 "cs.ATG"
Expression expr = null;
List<AttributeSection> attributes = new List<AttributeSection>();
AttributeSection section = null;
@@ -2432,15 +2439,15 @@ out FieldDeclaration f) {
while (la.kind == 18) {
AttributeSection(
-#line 1160 "cs.ATG"
+#line 1166 "cs.ATG"
out section);
-#line 1160 "cs.ATG"
+#line 1166 "cs.ATG"
attributes.Add(section);
}
Identifier();
-#line 1161 "cs.ATG"
+#line 1167 "cs.ATG"
f = new FieldDeclaration(attributes);
varDecl = new VariableDeclaration(t.val);
f.Fields.Add(varDecl);
@@ -2450,10 +2457,10 @@ out section);
if (la.kind == 3) {
lexer.NextToken();
Expr(
-#line 1167 "cs.ATG"
+#line 1173 "cs.ATG"
out expr);
-#line 1167 "cs.ATG"
+#line 1173 "cs.ATG"
varDecl.Initializer = expr;
}
}
@@ -2663,11 +2670,11 @@ out ModifierList m) {
}
void Block(
-#line 1287 "cs.ATG"
+#line 1293 "cs.ATG"
out Statement stmt) {
Expect(16);
-#line 1289 "cs.ATG"
+#line 1295 "cs.ATG"
BlockStatement blockStmt = new BlockStatement();
blockStmt.StartLocation = t.Location;
compilationUnit.BlockStart(blockStmt);
@@ -2679,7 +2686,7 @@ out Statement stmt) {
while (!(la.kind == 0 || la.kind == 17)) {SynErr(182); lexer.NextToken(); }
Expect(17);
-#line 1297 "cs.ATG"
+#line 1303 "cs.ATG"
stmt = blockStmt;
blockStmt.EndLocation = t.EndLocation;
compilationUnit.BlockEnd();
@@ -2687,10 +2694,10 @@ out Statement stmt) {
}
void EventAccessorDecls(
-#line 1224 "cs.ATG"
+#line 1230 "cs.ATG"
out EventAddRegion addBlock, out EventRemoveRegion removeBlock) {
-#line 1225 "cs.ATG"
+#line 1231 "cs.ATG"
AttributeSection section;
List<AttributeSection> attributes = new List<AttributeSection>();
Statement stmt;
@@ -2699,93 +2706,93 @@ out EventAddRegion addBlock, out EventRemoveRegion removeBlock) {
while (la.kind == 18) {
AttributeSection(
-#line 1232 "cs.ATG"
+#line 1238 "cs.ATG"
out section);
-#line 1232 "cs.ATG"
+#line 1238 "cs.ATG"
attributes.Add(section);
}
if (la.kind == 130) {
-#line 1234 "cs.ATG"
+#line 1240 "cs.ATG"
addBlock = new EventAddRegion(attributes);
AddAccessorDecl(
-#line 1235 "cs.ATG"
+#line 1241 "cs.ATG"
out stmt);
-#line 1235 "cs.ATG"
+#line 1241 "cs.ATG"
attributes = new List<AttributeSection>(); addBlock.Block = (BlockStatement)stmt;
while (la.kind == 18) {
AttributeSection(
-#line 1236 "cs.ATG"
+#line 1242 "cs.ATG"
out section);
-#line 1236 "cs.ATG"
+#line 1242 "cs.ATG"
attributes.Add(section);
}
RemoveAccessorDecl(
-#line 1237 "cs.ATG"
+#line 1243 "cs.ATG"
out stmt);
-#line 1237 "cs.ATG"
+#line 1243 "cs.ATG"
removeBlock = new EventRemoveRegion(attributes); removeBlock.Block = (BlockStatement)stmt;
} else if (la.kind == 131) {
RemoveAccessorDecl(
-#line 1239 "cs.ATG"
+#line 1245 "cs.ATG"
out stmt);
-#line 1239 "cs.ATG"
+#line 1245 "cs.ATG"
removeBlock = new EventRemoveRegion(attributes); removeBlock.Block = (BlockStatement)stmt; attributes = new List<AttributeSection>();
while (la.kind == 18) {
AttributeSection(
-#line 1240 "cs.ATG"
+#line 1246 "cs.ATG"
out section);
-#line 1240 "cs.ATG"
+#line 1246 "cs.ATG"
attributes.Add(section);
}
AddAccessorDecl(
-#line 1241 "cs.ATG"
+#line 1247 "cs.ATG"
out stmt);
-#line 1241 "cs.ATG"
+#line 1247 "cs.ATG"
addBlock = new EventAddRegion(attributes); addBlock.Block = (BlockStatement)stmt;
} else SynErr(183);
}
void ConstructorInitializer(
-#line 1317 "cs.ATG"
+#line 1323 "cs.ATG"
out ConstructorInitializer ci) {
-#line 1318 "cs.ATG"
+#line 1324 "cs.ATG"
Expression expr; ci = new ConstructorInitializer();
Expect(9);
if (la.kind == 51) {
lexer.NextToken();
-#line 1322 "cs.ATG"
+#line 1328 "cs.ATG"
ci.ConstructorInitializerType = ConstructorInitializerType.Base;
} else if (la.kind == 111) {
lexer.NextToken();
-#line 1323 "cs.ATG"
+#line 1329 "cs.ATG"
ci.ConstructorInitializerType = ConstructorInitializerType.This;
} else SynErr(184);
Expect(20);
if (StartOf(26)) {
Argument(
-#line 1326 "cs.ATG"
+#line 1332 "cs.ATG"
out expr);
-#line 1326 "cs.ATG"
+#line 1332 "cs.ATG"
SafeAdd(ci, ci.Arguments, expr);
while (la.kind == 14) {
lexer.NextToken();
Argument(
-#line 1327 "cs.ATG"
+#line 1333 "cs.ATG"
out expr);
-#line 1327 "cs.ATG"
+#line 1333 "cs.ATG"
SafeAdd(ci, ci.Arguments, expr);
}
}
@@ -2793,161 +2800,161 @@ out expr);
}
void OverloadableOperator(
-#line 1340 "cs.ATG"
+#line 1346 "cs.ATG"
out OverloadableOperatorType op) {
-#line 1341 "cs.ATG"
+#line 1347 "cs.ATG"
op = OverloadableOperatorType.None;
switch (la.kind) {
case 4: {
lexer.NextToken();
-#line 1343 "cs.ATG"
+#line 1349 "cs.ATG"
op = OverloadableOperatorType.Add;
break;
}
case 5: {
lexer.NextToken();
-#line 1344 "cs.ATG"
+#line 1350 "cs.ATG"
op = OverloadableOperatorType.Subtract;
break;
}
case 24: {
lexer.NextToken();
-#line 1346 "cs.ATG"
+#line 1352 "cs.ATG"
op = OverloadableOperatorType.Not;
break;
}
case 27: {
lexer.NextToken();
-#line 1347 "cs.ATG"
+#line 1353 "cs.ATG"
op = OverloadableOperatorType.BitNot;
break;
}
case 31: {
lexer.NextToken();
-#line 1349 "cs.ATG"
+#line 1355 "cs.ATG"
op = OverloadableOperatorType.Increment;
break;
}
case 32: {
lexer.NextToken();
-#line 1350 "cs.ATG"
+#line 1356 "cs.ATG"
op = OverloadableOperatorType.Decrement;
break;
}
case 113: {
lexer.NextToken();
-#line 1352 "cs.ATG"
+#line 1358 "cs.ATG"
op = OverloadableOperatorType.IsTrue;
break;
}
case 72: {
lexer.NextToken();
-#line 1353 "cs.ATG"
+#line 1359 "cs.ATG"
op = OverloadableOperatorType.IsFalse;
break;
}
case 6: {
lexer.NextToken();
-#line 1355 "cs.ATG"
+#line 1361 "cs.ATG"
op = OverloadableOperatorType.Multiply;
break;
}
case 7: {
lexer.NextToken();
-#line 1356 "cs.ATG"
+#line 1362 "cs.ATG"
op = OverloadableOperatorType.Divide;
break;
}
case 8: {
lexer.NextToken();
-#line 1357 "cs.ATG"
+#line 1363 "cs.ATG"
op = OverloadableOperatorType.Modulus;
break;
}
case 28: {
lexer.NextToken();
-#line 1359 "cs.ATG"
+#line 1365 "cs.ATG"
op = OverloadableOperatorType.BitwiseAnd;
break;
}
case 29: {
lexer.NextToken();
-#line 1360 "cs.ATG"
+#line 1366 "cs.ATG"
op = OverloadableOperatorType.BitwiseOr;
break;
}
case 30: {
lexer.NextToken();
-#line 1361 "cs.ATG"
+#line 1367 "cs.ATG"
op = OverloadableOperatorType.ExclusiveOr;
break;
}
case 37: {
lexer.NextToken();
-#line 1363 "cs.ATG"
+#line 1369 "cs.ATG"
op = OverloadableOperatorType.ShiftLeft;
break;
}
case 33: {
lexer.NextToken();
-#line 1364 "cs.ATG"
+#line 1370 "cs.ATG"
op = OverloadableOperatorType.Equality;
break;
}
case 34: {
lexer.NextToken();
-#line 1365 "cs.ATG"
+#line 1371 "cs.ATG"
op = OverloadableOperatorType.InEquality;
break;
}
case 23: {
lexer.NextToken();
-#line 1366 "cs.ATG"
+#line 1372 "cs.ATG"
op = OverloadableOperatorType.LessThan;
break;
}
case 35: {
lexer.NextToken();
-#line 1367 "cs.ATG"
+#line 1373 "cs.ATG"
op = OverloadableOperatorType.GreaterThanOrEqual;
break;
}
case 36: {
lexer.NextToken();
-#line 1368 "cs.ATG"
+#line 1374 "cs.ATG"
op = OverloadableOperatorType.LessThanOrEqual;
break;
}
case 22: {
lexer.NextToken();
-#line 1369 "cs.ATG"
+#line 1375 "cs.ATG"
op = OverloadableOperatorType.GreaterThan;
if (la.kind == 22) {
lexer.NextToken();
-#line 1369 "cs.ATG"
+#line 1375 "cs.ATG"
op = OverloadableOperatorType.ShiftRight;
}
break;
@@ -2957,34 +2964,34 @@ out OverloadableOperatorType op) {
}
void VariableDeclarator(
-#line 1279 "cs.ATG"
+#line 1285 "cs.ATG"
FieldDeclaration parentFieldDeclaration) {
-#line 1280 "cs.ATG"
+#line 1286 "cs.ATG"
Expression expr = null;
Identifier();
-#line 1282 "cs.ATG"
+#line 1288 "cs.ATG"
VariableDeclaration f = new VariableDeclaration(t.val); f.StartLocation = t.Location;
if (la.kind == 3) {
lexer.NextToken();
VariableInitializer(
-#line 1283 "cs.ATG"
+#line 1289 "cs.ATG"
out expr);
-#line 1283 "cs.ATG"
+#line 1289 "cs.ATG"
f.Initializer = expr;
}
-#line 1284 "cs.ATG"
+#line 1290 "cs.ATG"
f.EndLocation = t.EndLocation; SafeAdd(parentFieldDeclaration, parentFieldDeclaration.Fields, f);
}
void AccessorDecls(
-#line 1171 "cs.ATG"
+#line 1177 "cs.ATG"
out PropertyGetRegion getBlock, out PropertySetRegion setBlock) {
-#line 1173 "cs.ATG"
+#line 1179 "cs.ATG"
List<AttributeSection> attributes = new List<AttributeSection>();
AttributeSection section;
getBlock = null;
@@ -2993,92 +3000,92 @@ out PropertyGetRegion getBlock, out PropertySetRegion setBlock) {
while (la.kind == 18) {
AttributeSection(
-#line 1180 "cs.ATG"
+#line 1186 "cs.ATG"
out section);
-#line 1180 "cs.ATG"
+#line 1186 "cs.ATG"
attributes.Add(section);
}
if (la.kind == 84 || la.kind == 96 || la.kind == 97) {
AccessorModifiers(
-#line 1181 "cs.ATG"
+#line 1187 "cs.ATG"
out modifiers);
}
if (la.kind == 128) {
GetAccessorDecl(
-#line 1183 "cs.ATG"
+#line 1189 "cs.ATG"
out getBlock, attributes);
-#line 1184 "cs.ATG"
+#line 1190 "cs.ATG"
if (modifiers != null) {getBlock.Modifier = modifiers.Modifier; }
if (StartOf(27)) {
-#line 1185 "cs.ATG"
+#line 1191 "cs.ATG"
attributes = new List<AttributeSection>(); modifiers = null;
while (la.kind == 18) {
AttributeSection(
-#line 1186 "cs.ATG"
+#line 1192 "cs.ATG"
out section);
-#line 1186 "cs.ATG"
+#line 1192 "cs.ATG"
attributes.Add(section);
}
if (la.kind == 84 || la.kind == 96 || la.kind == 97) {
AccessorModifiers(
-#line 1187 "cs.ATG"
+#line 1193 "cs.ATG"
out modifiers);
}
SetAccessorDecl(
-#line 1188 "cs.ATG"
+#line 1194 "cs.ATG"
out setBlock, attributes);
-#line 1189 "cs.ATG"
+#line 1195 "cs.ATG"
if (modifiers != null) {setBlock.Modifier = modifiers.Modifier; }
}
} else if (la.kind == 129) {
SetAccessorDecl(
-#line 1192 "cs.ATG"
+#line 1198 "cs.ATG"
out setBlock, attributes);
-#line 1193 "cs.ATG"
+#line 1199 "cs.ATG"
if (modifiers != null) {setBlock.Modifier = modifiers.Modifier; }
if (StartOf(28)) {
-#line 1194 "cs.ATG"
+#line 1200 "cs.ATG"
attributes = new List<AttributeSection>(); modifiers = null;
while (la.kind == 18) {
AttributeSection(
-#line 1195 "cs.ATG"
+#line 1201 "cs.ATG"
out section);
-#line 1195 "cs.ATG"
+#line 1201 "cs.ATG"
attributes.Add(section);
}
if (la.kind == 84 || la.kind == 96 || la.kind == 97) {
AccessorModifiers(
-#line 1196 "cs.ATG"
+#line 1202 "cs.ATG"
out modifiers);
}
GetAccessorDecl(
-#line 1197 "cs.ATG"
+#line 1203 "cs.ATG"
out getBlock, attributes);
-#line 1198 "cs.ATG"
+#line 1204 "cs.ATG"
if (modifiers != null) {getBlock.Modifier = modifiers.Modifier; }
}
} else if (StartOf(19)) {
Identifier();
-#line 1200 "cs.ATG"
+#line 1206 "cs.ATG"
Error("get or set accessor declaration expected");
} else SynErr(186);
}
void InterfaceAccessors(
-#line 1245 "cs.ATG"
+#line 1251 "cs.ATG"
out PropertyGetRegion getBlock, out PropertySetRegion setBlock) {
-#line 1247 "cs.ATG"
+#line 1253 "cs.ATG"
AttributeSection section;
List<AttributeSection> attributes = new List<AttributeSection>();
getBlock = null; setBlock = null;
@@ -3086,173 +3093,173 @@ out PropertyGetRegion getBlock, out PropertySetRegion setBlock) {
while (la.kind == 18) {
AttributeSection(
-#line 1253 "cs.ATG"
+#line 1259 "cs.ATG"
out section);
-#line 1253 "cs.ATG"
+#line 1259 "cs.ATG"
attributes.Add(section);
}
-#line 1254 "cs.ATG"
+#line 1260 "cs.ATG"
Location startLocation = la.Location;
if (la.kind == 128) {
lexer.NextToken();
-#line 1256 "cs.ATG"
+#line 1262 "cs.ATG"
getBlock = new PropertyGetRegion(null, attributes);
} else if (la.kind == 129) {
lexer.NextToken();
-#line 1257 "cs.ATG"
+#line 1263 "cs.ATG"
setBlock = new PropertySetRegion(null, attributes);
} else SynErr(187);
Expect(11);
-#line 1260 "cs.ATG"
+#line 1266 "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<AttributeSection>();
if (la.kind == 18 || la.kind == 128 || la.kind == 129) {
while (la.kind == 18) {
AttributeSection(
-#line 1264 "cs.ATG"
+#line 1270 "cs.ATG"
out section);
-#line 1264 "cs.ATG"
+#line 1270 "cs.ATG"
attributes.Add(section);
}
-#line 1265 "cs.ATG"
+#line 1271 "cs.ATG"
startLocation = la.Location;
if (la.kind == 128) {
lexer.NextToken();
-#line 1267 "cs.ATG"
+#line 1273 "cs.ATG"
if (getBlock != null) Error("get already declared");
else { getBlock = new PropertyGetRegion(null, attributes); lastBlock = getBlock; }
} else if (la.kind == 129) {
lexer.NextToken();
-#line 1270 "cs.ATG"
+#line 1276 "cs.ATG"
if (setBlock != null) Error("set already declared");
else { setBlock = new PropertySetRegion(null, attributes); lastBlock = setBlock; }
} else SynErr(188);
Expect(11);
-#line 1275 "cs.ATG"
+#line 1281 "cs.ATG"
if (lastBlock != null) { lastBlock.StartLocation = startLocation; lastBlock.EndLocation = t.EndLocation; }
}
}
void GetAccessorDecl(
-#line 1204 "cs.ATG"
+#line 1210 "cs.ATG"
out PropertyGetRegion getBlock, List<AttributeSection> attributes) {
-#line 1205 "cs.ATG"
+#line 1211 "cs.ATG"
Statement stmt = null;
Expect(128);
-#line 1208 "cs.ATG"
+#line 1214 "cs.ATG"
Location startLocation = t.Location;
if (la.kind == 16) {
Block(
-#line 1209 "cs.ATG"
+#line 1215 "cs.ATG"
out stmt);
} else if (la.kind == 11) {
lexer.NextToken();
} else SynErr(189);
-#line 1210 "cs.ATG"
+#line 1216 "cs.ATG"
getBlock = new PropertyGetRegion((BlockStatement)stmt, attributes);
-#line 1211 "cs.ATG"
+#line 1217 "cs.ATG"
getBlock.StartLocation = startLocation; getBlock.EndLocation = t.EndLocation;
}
void SetAccessorDecl(
-#line 1214 "cs.ATG"
+#line 1220 "cs.ATG"
out PropertySetRegion setBlock, List<AttributeSection> attributes) {
-#line 1215 "cs.ATG"
+#line 1221 "cs.ATG"
Statement stmt = null;
Expect(129);
-#line 1218 "cs.ATG"
+#line 1224 "cs.ATG"
Location startLocation = t.Location;
if (la.kind == 16) {
Block(
-#line 1219 "cs.ATG"
+#line 1225 "cs.ATG"
out stmt);
} else if (la.kind == 11) {
lexer.NextToken();
} else SynErr(190);
-#line 1220 "cs.ATG"
+#line 1226 "cs.ATG"
setBlock = new PropertySetRegion((BlockStatement)stmt, attributes);
-#line 1221 "cs.ATG"
+#line 1227 "cs.ATG"
setBlock.StartLocation = startLocation; setBlock.EndLocation = t.EndLocation;
}
void AddAccessorDecl(
-#line 1303 "cs.ATG"
+#line 1309 "cs.ATG"
out Statement stmt) {
-#line 1304 "cs.ATG"
+#line 1310 "cs.ATG"
stmt = null;
Expect(130);
Block(
-#line 1307 "cs.ATG"
+#line 1313 "cs.ATG"
out stmt);
}
void RemoveAccessorDecl(
-#line 1310 "cs.ATG"
+#line 1316 "cs.ATG"
out Statement stmt) {
-#line 1311 "cs.ATG"
+#line 1317 "cs.ATG"
stmt = null;
Expect(131);
Block(
-#line 1314 "cs.ATG"
+#line 1320 "cs.ATG"
out stmt);
}
void VariableInitializer(
-#line 1332 "cs.ATG"
+#line 1338 "cs.ATG"
out Expression initializerExpression) {
-#line 1333 "cs.ATG"
+#line 1339 "cs.ATG"
TypeReference type = null; Expression expr = null; initializerExpression = null;
if (StartOf(6)) {
Expr(
-#line 1335 "cs.ATG"
+#line 1341 "cs.ATG"
out initializerExpression);
} else if (la.kind == 16) {
CollectionInitializer(
-#line 1336 "cs.ATG"
+#line 1342 "cs.ATG"
out initializerExpression);
} else if (la.kind == 106) {
lexer.NextToken();
Type(
-#line 1337 "cs.ATG"
+#line 1343 "cs.ATG"
out type);
Expect(18);
Expr(
-#line 1337 "cs.ATG"
+#line 1343 "cs.ATG"
out expr);
Expect(19);
-#line 1337 "cs.ATG"
+#line 1343 "cs.ATG"
initializerExpression = new StackAllocExpression(type, expr);
} else SynErr(191);
}
void Statement() {
-#line 1480 "cs.ATG"
+#line 1486 "cs.ATG"
TypeReference type;
Expression expr;
Statement stmt = null;
@@ -3260,32 +3267,32 @@ out expr);
while (!(StartOf(29))) {SynErr(192); lexer.NextToken(); }
if (
-#line 1489 "cs.ATG"
+#line 1495 "cs.ATG"
IsLabel()) {
Identifier();
-#line 1489 "cs.ATG"
+#line 1495 "cs.ATG"
compilationUnit.AddChild(new LabelStatement(t.val));
Expect(9);
Statement();
} else if (la.kind == 60) {
lexer.NextToken();
Type(
-#line 1492 "cs.ATG"
+#line 1498 "cs.ATG"
out type);
-#line 1492 "cs.ATG"
+#line 1498 "cs.ATG"
LocalVariableDeclaration var = new LocalVariableDeclaration(type, Modifiers.Const); string ident = null; var.StartLocation = t.Location;
Identifier();
-#line 1493 "cs.ATG"
+#line 1499 "cs.ATG"
ident = t.val; Location varStart = t.Location;
Expect(3);
Expr(
-#line 1494 "cs.ATG"
+#line 1500 "cs.ATG"
out expr);
-#line 1496 "cs.ATG"
+#line 1502 "cs.ATG"
SafeAdd(var, var.Variables, new VariableDeclaration(ident, expr) {
StartLocation = varStart,
EndLocation = t.EndLocation,
@@ -3296,14 +3303,14 @@ out expr);
lexer.NextToken();
Identifier();
-#line 1502 "cs.ATG"
+#line 1508 "cs.ATG"
ident = t.val;
Expect(3);
Expr(
-#line 1502 "cs.ATG"
+#line 1508 "cs.ATG"
out expr);
-#line 1504 "cs.ATG"
+#line 1510 "cs.ATG"
SafeAdd(var, var.Variables, new VariableDeclaration(ident, expr) {
StartLocation = varStart,
EndLocation = t.EndLocation,
@@ -3313,28 +3320,28 @@ out expr);
}
Expect(11);
-#line 1510 "cs.ATG"
+#line 1516 "cs.ATG"
var.EndLocation = t.EndLocation; compilationUnit.AddChild(var);
} else if (
-#line 1513 "cs.ATG"
+#line 1519 "cs.ATG"
IsLocalVarDecl()) {
LocalVariableDecl(
-#line 1513 "cs.ATG"
+#line 1519 "cs.ATG"
out stmt);
Expect(11);
-#line 1513 "cs.ATG"
+#line 1519 "cs.ATG"
compilationUnit.AddChild(stmt);
} else if (StartOf(30)) {
EmbeddedStatement(
-#line 1515 "cs.ATG"
+#line 1521 "cs.ATG"
out stmt);
-#line 1515 "cs.ATG"
+#line 1521 "cs.ATG"
compilationUnit.AddChild(stmt);
} else SynErr(193);
-#line 1521 "cs.ATG"
+#line 1527 "cs.ATG"
if (stmt != null) {
stmt.StartLocation = startPos;
stmt.EndLocation = t.EndLocation;
@@ -3343,10 +3350,10 @@ out stmt);
}
void Argument(
-#line 1372 "cs.ATG"
+#line 1378 "cs.ATG"
out Expression argumentexpr) {
-#line 1374 "cs.ATG"
+#line 1380 "cs.ATG"
Expression expr;
FieldDirection fd = FieldDirection.None;
@@ -3354,51 +3361,51 @@ out Expression argumentexpr) {
if (la.kind == 100) {
lexer.NextToken();
-#line 1379 "cs.ATG"
+#line 1385 "cs.ATG"
fd = FieldDirection.Ref;
} else {
lexer.NextToken();
-#line 1380 "cs.ATG"
+#line 1386 "cs.ATG"
fd = FieldDirection.Out;
}
}
Expr(
-#line 1382 "cs.ATG"
+#line 1388 "cs.ATG"
out expr);
-#line 1383 "cs.ATG"
+#line 1389 "cs.ATG"
argumentexpr = fd != FieldDirection.None ? argumentexpr = new DirectionExpression(fd, expr) : expr;
}
void CollectionInitializer(
-#line 1403 "cs.ATG"
+#line 1409 "cs.ATG"
out Expression outExpr) {
-#line 1405 "cs.ATG"
+#line 1411 "cs.ATG"
Expression expr = null;
CollectionInitializerExpression initializer = new CollectionInitializerExpression();
Expect(16);
-#line 1409 "cs.ATG"
+#line 1415 "cs.ATG"
initializer.StartLocation = t.Location;
if (StartOf(31)) {
VariableInitializer(
-#line 1410 "cs.ATG"
+#line 1416 "cs.ATG"
out expr);
-#line 1411 "cs.ATG"
+#line 1417 "cs.ATG"
SafeAdd(initializer, initializer.CreateExpressions, expr);
while (
-#line 1412 "cs.ATG"
+#line 1418 "cs.ATG"
NotFinalComma()) {
Expect(14);
VariableInitializer(
-#line 1413 "cs.ATG"
+#line 1419 "cs.ATG"
out expr);
-#line 1414 "cs.ATG"
+#line 1420 "cs.ATG"
SafeAdd(initializer, initializer.CreateExpressions, expr);
}
if (la.kind == 14) {
@@ -3407,105 +3414,105 @@ out expr);
}
Expect(17);
-#line 1418 "cs.ATG"
+#line 1424 "cs.ATG"
initializer.EndLocation = t.Location; outExpr = initializer;
}
void AssignmentOperator(
-#line 1386 "cs.ATG"
+#line 1392 "cs.ATG"
out AssignmentOperatorType op) {
-#line 1387 "cs.ATG"
+#line 1393 "cs.ATG"
op = AssignmentOperatorType.None;
if (la.kind == 3) {
lexer.NextToken();
-#line 1389 "cs.ATG"
+#line 1395 "cs.ATG"
op = AssignmentOperatorType.Assign;
} else if (la.kind == 38) {
lexer.NextToken();
-#line 1390 "cs.ATG"
+#line 1396 "cs.ATG"
op = AssignmentOperatorType.Add;
} else if (la.kind == 39) {
lexer.NextToken();
-#line 1391 "cs.ATG"
+#line 1397 "cs.ATG"
op = AssignmentOperatorType.Subtract;
} else if (la.kind == 40) {
lexer.NextToken();
-#line 1392 "cs.ATG"
+#line 1398 "cs.ATG"
op = AssignmentOperatorType.Multiply;
} else if (la.kind == 41) {
lexer.NextToken();
-#line 1393 "cs.ATG"
+#line 1399 "cs.ATG"
op = AssignmentOperatorType.Divide;
} else if (la.kind == 42) {
lexer.NextToken();
-#line 1394 "cs.ATG"
+#line 1400 "cs.ATG"
op = AssignmentOperatorType.Modulus;
} else if (la.kind == 43) {
lexer.NextToken();
-#line 1395 "cs.ATG"
+#line 1401 "cs.ATG"
op = AssignmentOperatorType.BitwiseAnd;
} else if (la.kind == 44) {
lexer.NextToken();
-#line 1396 "cs.ATG"
+#line 1402 "cs.ATG"
op = AssignmentOperatorType.BitwiseOr;
} else if (la.kind == 45) {
lexer.NextToken();
-#line 1397 "cs.ATG"
+#line 1403 "cs.ATG"
op = AssignmentOperatorType.ExclusiveOr;
} else if (la.kind == 46) {
lexer.NextToken();
-#line 1398 "cs.ATG"
+#line 1404 "cs.ATG"
op = AssignmentOperatorType.ShiftLeft;
} else if (
-#line 1399 "cs.ATG"
+#line 1405 "cs.ATG"
la.kind == Tokens.GreaterThan && Peek(1).kind == Tokens.GreaterEqual) {
Expect(22);
Expect(35);
-#line 1400 "cs.ATG"
+#line 1406 "cs.ATG"
op = AssignmentOperatorType.ShiftRight;
} else SynErr(194);
}
void CollectionOrObjectInitializer(
-#line 1421 "cs.ATG"
+#line 1427 "cs.ATG"
out Expression outExpr) {
-#line 1423 "cs.ATG"
+#line 1429 "cs.ATG"
Expression expr = null;
CollectionInitializerExpression initializer = new CollectionInitializerExpression();
Expect(16);
-#line 1427 "cs.ATG"
+#line 1433 "cs.ATG"
initializer.StartLocation = t.Location;
if (StartOf(31)) {
ObjectPropertyInitializerOrVariableInitializer(
-#line 1428 "cs.ATG"
+#line 1434 "cs.ATG"
out expr);
-#line 1429 "cs.ATG"
+#line 1435 "cs.ATG"
SafeAdd(initializer, initializer.CreateExpressions, expr);
while (
-#line 1430 "cs.ATG"
+#line 1436 "cs.ATG"
NotFinalComma()) {
Expect(14);
ObjectPropertyInitializerOrVariableInitializer(
-#line 1431 "cs.ATG"
+#line 1437 "cs.ATG"
out expr);
-#line 1432 "cs.ATG"
+#line 1438 "cs.ATG"
SafeAdd(initializer, initializer.CreateExpressions, expr);
}
if (la.kind == 14) {
@@ -3514,280 +3521,280 @@ out expr);
}
Expect(17);
-#line 1436 "cs.ATG"
+#line 1442 "cs.ATG"
initializer.EndLocation = t.Location; outExpr = initializer;
}
void ObjectPropertyInitializerOrVariableInitializer(
-#line 1439 "cs.ATG"
+#line 1445 "cs.ATG"
out Expression expr) {
-#line 1440 "cs.ATG"
+#line 1446 "cs.ATG"
expr = null;
if (
-#line 1442 "cs.ATG"
+#line 1448 "cs.ATG"
IdentAndAsgn()) {
Identifier();
-#line 1444 "cs.ATG"
+#line 1450 "cs.ATG"
NamedArgumentExpression nae = new NamedArgumentExpression(t.val, null);
nae.StartLocation = t.Location;
Expression r = null;
Expect(3);
if (la.kind == 16) {
CollectionOrObjectInitializer(
-#line 1448 "cs.ATG"
+#line 1454 "cs.ATG"
out r);
} else if (StartOf(31)) {
VariableInitializer(
-#line 1449 "cs.ATG"
+#line 1455 "cs.ATG"
out r);
} else SynErr(195);
-#line 1450 "cs.ATG"
+#line 1456 "cs.ATG"
nae.Expression = r; nae.EndLocation = t.EndLocation; expr = nae;
} else if (StartOf(31)) {
VariableInitializer(
-#line 1452 "cs.ATG"
+#line 1458 "cs.ATG"
out expr);
} else SynErr(196);
}
void LocalVariableDecl(
-#line 1456 "cs.ATG"
+#line 1462 "cs.ATG"
out Statement stmt) {
-#line 1458 "cs.ATG"
+#line 1464 "cs.ATG"
TypeReference type;
VariableDeclaration var = null;
LocalVariableDeclaration localVariableDeclaration;
Location startPos = la.Location;
Type(
-#line 1464 "cs.ATG"
+#line 1470 "cs.ATG"
out type);
-#line 1464 "cs.ATG"
+#line 1470 "cs.ATG"
localVariableDeclaration = new LocalVariableDeclaration(type); localVariableDeclaration.StartLocation = startPos;
LocalVariableDeclarator(
-#line 1465 "cs.ATG"
+#line 1471 "cs.ATG"
out var);
-#line 1465 "cs.ATG"
+#line 1471 "cs.ATG"
SafeAdd(localVariableDeclaration, localVariableDeclaration.Variables, var);
while (la.kind == 14) {
lexer.NextToken();
LocalVariableDeclarator(
-#line 1466 "cs.ATG"
+#line 1472 "cs.ATG"
out var);
-#line 1466 "cs.ATG"
+#line 1472 "cs.ATG"
SafeAdd(localVariableDeclaration, localVariableDeclaration.Variables, var);
}
-#line 1467 "cs.ATG"
+#line 1473 "cs.ATG"
stmt = localVariableDeclaration; stmt.EndLocation = t.EndLocation;
}
void LocalVariableDeclarator(
-#line 1470 "cs.ATG"
+#line 1476 "cs.ATG"
out VariableDeclaration var) {
-#line 1471 "cs.ATG"
+#line 1477 "cs.ATG"
Expression expr = null;
Identifier();
-#line 1473 "cs.ATG"
+#line 1479 "cs.ATG"
var = new VariableDeclaration(t.val); var.StartLocation = t.Location;
if (la.kind == 3) {
lexer.NextToken();
VariableInitializer(
-#line 1474 "cs.ATG"
+#line 1480 "cs.ATG"
out expr);
-#line 1474 "cs.ATG"
+#line 1480 "cs.ATG"
var.Initializer = expr;
}
-#line 1475 "cs.ATG"
+#line 1481 "cs.ATG"
var.EndLocation = t.EndLocation;
}
void EmbeddedStatement(
-#line 1528 "cs.ATG"
+#line 1534 "cs.ATG"
out Statement statement) {
-#line 1530 "cs.ATG"
+#line 1536 "cs.ATG"
TypeReference type = null;
Expression expr = null;
Statement embeddedStatement = null;
statement = null;
-#line 1536 "cs.ATG"
+#line 1542 "cs.ATG"
Location startLocation = la.Location;
if (la.kind == 16) {
Block(
-#line 1538 "cs.ATG"
+#line 1544 "cs.ATG"
out statement);
} else if (la.kind == 11) {
lexer.NextToken();
-#line 1541 "cs.ATG"
+#line 1547 "cs.ATG"
statement = new EmptyStatement();
} else if (
-#line 1544 "cs.ATG"
+#line 1550 "cs.ATG"
UnCheckedAndLBrace()) {
-#line 1544 "cs.ATG"
+#line 1550 "cs.ATG"
Statement block; bool isChecked = true;
if (la.kind == 58) {
lexer.NextToken();
} else if (la.kind == 118) {
lexer.NextToken();
-#line 1545 "cs.ATG"
+#line 1551 "cs.ATG"
isChecked = false;
} else SynErr(197);
Block(
-#line 1546 "cs.ATG"
+#line 1552 "cs.ATG"
out block);
-#line 1546 "cs.ATG"
+#line 1552 "cs.ATG"
statement = isChecked ? (Statement)new CheckedStatement(block) : (Statement)new UncheckedStatement(block);
} else if (la.kind == 79) {
IfStatement(
-#line 1549 "cs.ATG"
+#line 1555 "cs.ATG"
out statement);
} else if (la.kind == 110) {
lexer.NextToken();
-#line 1551 "cs.ATG"
+#line 1557 "cs.ATG"
List<SwitchSection> switchSections = new List<SwitchSection>();
Expect(20);
Expr(
-#line 1552 "cs.ATG"
+#line 1558 "cs.ATG"
out expr);
Expect(21);
Expect(16);
SwitchSections(
-#line 1553 "cs.ATG"
+#line 1559 "cs.ATG"
switchSections);
Expect(17);
-#line 1555 "cs.ATG"
+#line 1561 "cs.ATG"
statement = new SwitchStatement(expr, switchSections);
} else if (la.kind == 125) {
lexer.NextToken();
Expect(20);
Expr(
-#line 1558 "cs.ATG"
+#line 1564 "cs.ATG"
out expr);
Expect(21);
EmbeddedStatement(
-#line 1559 "cs.ATG"
+#line 1565 "cs.ATG"
out embeddedStatement);
-#line 1560 "cs.ATG"
+#line 1566 "cs.ATG"
statement = new DoLoopStatement(expr, embeddedStatement, ConditionType.While, ConditionPosition.Start);
} else if (la.kind == 65) {
lexer.NextToken();
EmbeddedStatement(
-#line 1562 "cs.ATG"
+#line 1568 "cs.ATG"
out embeddedStatement);
Expect(125);
Expect(20);
Expr(
-#line 1563 "cs.ATG"
+#line 1569 "cs.ATG"
out expr);
Expect(21);
Expect(11);
-#line 1564 "cs.ATG"
+#line 1570 "cs.ATG"
statement = new DoLoopStatement(expr, embeddedStatement, ConditionType.While, ConditionPosition.End);
} else if (la.kind == 76) {
lexer.NextToken();
-#line 1566 "cs.ATG"
+#line 1572 "cs.ATG"
List<Statement> initializer = null; List<Statement> iterator = null;
Expect(20);
if (StartOf(6)) {
ForInitializer(
-#line 1567 "cs.ATG"
+#line 1573 "cs.ATG"
out initializer);
}
Expect(11);
if (StartOf(6)) {
Expr(
-#line 1568 "cs.ATG"
+#line 1574 "cs.ATG"
out expr);
}
Expect(11);
if (StartOf(6)) {
ForIterator(
-#line 1569 "cs.ATG"
+#line 1575 "cs.ATG"
out iterator);
}
Expect(21);
EmbeddedStatement(
-#line 1570 "cs.ATG"
+#line 1576 "cs.ATG"
out embeddedStatement);
-#line 1571 "cs.ATG"
+#line 1577 "cs.ATG"
statement = new ForStatement(initializer, expr, iterator, embeddedStatement);
} else if (la.kind == 77) {
lexer.NextToken();
Expect(20);
Type(
-#line 1573 "cs.ATG"
+#line 1579 "cs.ATG"
out type);
Identifier();
-#line 1573 "cs.ATG"
+#line 1579 "cs.ATG"
string varName = t.val;
Expect(81);
Expr(
-#line 1574 "cs.ATG"
+#line 1580 "cs.ATG"
out expr);
Expect(21);
EmbeddedStatement(
-#line 1575 "cs.ATG"
+#line 1581 "cs.ATG"
out embeddedStatement);
-#line 1576 "cs.ATG"
+#line 1582 "cs.ATG"
statement = new ForeachStatement(type, varName , expr, embeddedStatement);
} else if (la.kind == 53) {
lexer.NextToken();
Expect(11);
-#line 1579 "cs.ATG"
+#line 1585 "cs.ATG"
statement = new BreakStatement();
} else if (la.kind == 61) {
lexer.NextToken();
Expect(11);
-#line 1580 "cs.ATG"
+#line 1586 "cs.ATG"
statement = new ContinueStatement();
} else if (la.kind == 78) {
GotoStatement(
-#line 1581 "cs.ATG"
+#line 1587 "cs.ATG"
out statement);
} else if (
-#line 1583 "cs.ATG"
+#line 1589 "cs.ATG"
IsYieldStatement()) {
Expect(132);
if (la.kind == 101) {
lexer.NextToken();
Expr(
-#line 1584 "cs.ATG"
+#line 1590 "cs.ATG"
out expr);
-#line 1584 "cs.ATG"
+#line 1590 "cs.ATG"
statement = new YieldStatement(new ReturnStatement(expr));
} else if (la.kind == 53) {
lexer.NextToken();
-#line 1585 "cs.ATG"
+#line 1591 "cs.ATG"
statement = new YieldStatement(new BreakStatement());
} else SynErr(198);
Expect(11);
@@ -3795,90 +3802,90 @@ out expr);
lexer.NextToken();
if (StartOf(6)) {
Expr(
-#line 1588 "cs.ATG"
+#line 1594 "cs.ATG"
out expr);
}
Expect(11);
-#line 1588 "cs.ATG"
+#line 1594 "cs.ATG"
statement = new ReturnStatement(expr);
} else if (la.kind == 112) {
lexer.NextToken();
if (StartOf(6)) {
Expr(
-#line 1589 "cs.ATG"
+#line 1595 "cs.ATG"
out expr);
}
Expect(11);
-#line 1589 "cs.ATG"
+#line 1595 "cs.ATG"
statement = new ThrowStatement(expr);
} else if (StartOf(6)) {
StatementExpr(
-#line 1592 "cs.ATG"
+#line 1598 "cs.ATG"
out statement);
while (!(la.kind == 0 || la.kind == 11)) {SynErr(199); lexer.NextToken(); }
Expect(11);
} else if (la.kind == 114) {
TryStatement(
-#line 1595 "cs.ATG"
+#line 1601 "cs.ATG"
out statement);
} else if (la.kind == 86) {
lexer.NextToken();
Expect(20);
Expr(
-#line 1598 "cs.ATG"
+#line 1604 "cs.ATG"
out expr);
Expect(21);
EmbeddedStatement(
-#line 1599 "cs.ATG"
+#line 1605 "cs.ATG"
out embeddedStatement);
-#line 1599 "cs.ATG"
+#line 1605 "cs.ATG"
statement = new LockStatement(expr, embeddedStatement);
} else if (la.kind == 121) {
-#line 1602 "cs.ATG"
+#line 1608 "cs.ATG"
Statement resourceAcquisitionStmt = null;
lexer.NextToken();
Expect(20);
ResourceAcquisition(
-#line 1604 "cs.ATG"
+#line 1610 "cs.ATG"
out resourceAcquisitionStmt);
Expect(21);
EmbeddedStatement(
-#line 1605 "cs.ATG"
+#line 1611 "cs.ATG"
out embeddedStatement);
-#line 1605 "cs.ATG"
+#line 1611 "cs.ATG"
statement = new UsingStatement(resourceAcquisitionStmt, embeddedStatement);
} else if (la.kind == 119) {
lexer.NextToken();
Block(
-#line 1608 "cs.ATG"
+#line 1614 "cs.ATG"
out embeddedStatement);
-#line 1608 "cs.ATG"
+#line 1614 "cs.ATG"
statement = new UnsafeStatement(embeddedStatement);
} else if (la.kind == 74) {
-#line 1610 "cs.ATG"
+#line 1616 "cs.ATG"
Statement pointerDeclarationStmt = null;
lexer.NextToken();
Expect(20);
ResourceAcquisition(
-#line 1612 "cs.ATG"
+#line 1618 "cs.ATG"
out pointerDeclarationStmt);
Expect(21);
EmbeddedStatement(
-#line 1613 "cs.ATG"
+#line 1619 "cs.ATG"
out embeddedStatement);
-#line 1613 "cs.ATG"
+#line 1619 "cs.ATG"
statement = new FixedStatement(pointerDeclarationStmt, embeddedStatement);
} else SynErr(200);
-#line 1615 "cs.ATG"
+#line 1621 "cs.ATG"
if (statement != null) {
statement.StartLocation = startLocation;
statement.EndLocation = t.EndLocation;
@@ -3887,10 +3894,10 @@ out embeddedStatement);
}
void IfStatement(
-#line 1622 "cs.ATG"
+#line 1628 "cs.ATG"
out Statement statement) {
-#line 1624 "cs.ATG"
+#line 1630 "cs.ATG"
Expression expr = null;
Statement embeddedStatement = null;
statement = null;
@@ -3898,26 +3905,26 @@ out Statement statement) {
Expect(79);
Expect(20);
Expr(
-#line 1630 "cs.ATG"
+#line 1636 "cs.ATG"
out expr);
Expect(21);
EmbeddedStatement(
-#line 1631 "cs.ATG"
+#line 1637 "cs.ATG"
out embeddedStatement);
-#line 1632 "cs.ATG"
+#line 1638 "cs.ATG"
Statement elseStatement = null;
if (la.kind == 67) {
lexer.NextToken();
EmbeddedStatement(
-#line 1633 "cs.ATG"
+#line 1639 "cs.ATG"
out elseStatement);
}
-#line 1634 "cs.ATG"
+#line 1640 "cs.ATG"
statement = elseStatement != null ? new IfElseStatement(expr, embeddedStatement, elseStatement) : new IfElseStatement(expr, embeddedStatement);
-#line 1635 "cs.ATG"
+#line 1641 "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(
@@ -3930,29 +3937,29 @@ out elseStatement);
}
void SwitchSections(
-#line 1665 "cs.ATG"
+#line 1671 "cs.ATG"
List<SwitchSection> switchSections) {
-#line 1667 "cs.ATG"
+#line 1673 "cs.ATG"
SwitchSection switchSection = new SwitchSection();
CaseLabel label;
SwitchLabel(
-#line 1671 "cs.ATG"
+#line 1677 "cs.ATG"
out label);
-#line 1671 "cs.ATG"
+#line 1677 "cs.ATG"
SafeAdd(switchSection, switchSection.SwitchLabels, label);
-#line 1672 "cs.ATG"
+#line 1678 "cs.ATG"
compilationUnit.BlockStart(switchSection);
while (StartOf(32)) {
if (la.kind == 55 || la.kind == 63) {
SwitchLabel(
-#line 1674 "cs.ATG"
+#line 1680 "cs.ATG"
out label);
-#line 1675 "cs.ATG"
+#line 1681 "cs.ATG"
if (label != null) {
if (switchSection.Children.Count > 0) {
// open new section
@@ -3968,67 +3975,67 @@ out label);
}
}
-#line 1687 "cs.ATG"
+#line 1693 "cs.ATG"
compilationUnit.BlockEnd(); switchSections.Add(switchSection);
}
void ForInitializer(
-#line 1646 "cs.ATG"
+#line 1652 "cs.ATG"
out List<Statement> initializer) {
-#line 1648 "cs.ATG"
+#line 1654 "cs.ATG"
Statement stmt;
initializer = new List<Statement>();
if (
-#line 1652 "cs.ATG"
+#line 1658 "cs.ATG"
IsLocalVarDecl()) {
LocalVariableDecl(
-#line 1652 "cs.ATG"
+#line 1658 "cs.ATG"
out stmt);
-#line 1652 "cs.ATG"
+#line 1658 "cs.ATG"
initializer.Add(stmt);
} else if (StartOf(6)) {
StatementExpr(
-#line 1653 "cs.ATG"
+#line 1659 "cs.ATG"
out stmt);
-#line 1653 "cs.ATG"
+#line 1659 "cs.ATG"
initializer.Add(stmt);
while (la.kind == 14) {
lexer.NextToken();
StatementExpr(
-#line 1653 "cs.ATG"
+#line 1659 "cs.ATG"
out stmt);
-#line 1653 "cs.ATG"
+#line 1659 "cs.ATG"
initializer.Add(stmt);
}
} else SynErr(201);
}
void ForIterator(
-#line 1656 "cs.ATG"
+#line 1662 "cs.ATG"
out List<Statement> iterator) {
-#line 1658 "cs.ATG"
+#line 1664 "cs.ATG"
Statement stmt;
iterator = new List<Statement>();
StatementExpr(
-#line 1662 "cs.ATG"
+#line 1668 "cs.ATG"
out stmt);
-#line 1662 "cs.ATG"
+#line 1668 "cs.ATG"
iterator.Add(stmt);
while (la.kind == 14) {
lexer.NextToken();
StatementExpr(
-#line 1662 "cs.ATG"
+#line 1668 "cs.ATG"
out stmt);
-#line 1662 "cs.ATG"
+#line 1668 "cs.ATG"
iterator.Add(stmt);
}
}
@@ -4079,35 +4086,34 @@ out expr);
}
void TryStatement(
-#line 1697 "cs.ATG"
+#line 1703 "cs.ATG"
out Statement tryStatement) {
-#line 1699 "cs.ATG"
+#line 1705 "cs.ATG"
Statement blockStmt = null, finallyStmt = null;
- List<CatchClause> catchClauses = null;
+ CatchClause catchClause = null;
+ List<CatchClause> catchClauses = new List<CatchClause>();
Expect(114);
Block(
-#line 1703 "cs.ATG"
+#line 1710 "cs.ATG"
out blockStmt);
- if (la.kind == 56) {
- CatchClauses(
-#line 1705 "cs.ATG"
-out catchClauses);
- if (la.kind == 73) {
- lexer.NextToken();
- Block(
-#line 1705 "cs.ATG"
-out finallyStmt);
- }
- } else if (la.kind == 73) {
+ while (la.kind == 56) {
+ CatchClause(
+#line 1712 "cs.ATG"
+out catchClause);
+
+#line 1713 "cs.ATG"
+ if (catchClause != null) catchClauses.Add(catchClause);
+ }
+ if (la.kind == 73) {
lexer.NextToken();
Block(
-#line 1706 "cs.ATG"
+#line 1715 "cs.ATG"
out finallyStmt);
- } else SynErr(203);
+ }
-#line 1709 "cs.ATG"
+#line 1717 "cs.ATG"
tryStatement = new TryCatchStatement(blockStmt, catchClauses, finallyStmt);
if (catchClauses != null) {
foreach (CatchClause cc in catchClauses) cc.Parent = tryStatement;
@@ -4136,118 +4142,79 @@ out expr);
#line 1773 "cs.ATG"
stmt = new ExpressionStatement(expr);
- } else SynErr(204);
+ } else SynErr(203);
}
void SwitchLabel(
-#line 1690 "cs.ATG"
+#line 1696 "cs.ATG"
out CaseLabel label) {
-#line 1691 "cs.ATG"
+#line 1697 "cs.ATG"
Expression expr = null; label = null;
if (la.kind == 55) {
lexer.NextToken();
Expr(
-#line 1693 "cs.ATG"
+#line 1699 "cs.ATG"
out expr);
Expect(9);
-#line 1693 "cs.ATG"
+#line 1699 "cs.ATG"
label = new CaseLabel(expr);
} else if (la.kind == 63) {
lexer.NextToken();
Expect(9);
-#line 1694 "cs.ATG"
+#line 1700 "cs.ATG"
label = new CaseLabel();
- } else SynErr(205);
+ } else SynErr(204);
}
- void CatchClauses(
-#line 1716 "cs.ATG"
-out List<CatchClause> catchClauses) {
-
-#line 1718 "cs.ATG"
- catchClauses = new List<CatchClause>();
-
+ void CatchClause(
+#line 1724 "cs.ATG"
+out CatchClause catchClause) {
Expect(56);
-#line 1721 "cs.ATG"
+#line 1726 "cs.ATG"
string identifier;
Statement stmt;
TypeReference typeRef;
Location startPos = t.Location;
- CatchClause catchClause = null;
+ catchClause = null;
if (la.kind == 16) {
Block(
-#line 1729 "cs.ATG"
+#line 1734 "cs.ATG"
out stmt);
-#line 1729 "cs.ATG"
+#line 1734 "cs.ATG"
catchClause = new CatchClause(stmt);
} else if (la.kind == 20) {
lexer.NextToken();
ClassType(
-#line 1731 "cs.ATG"
+#line 1737 "cs.ATG"
out typeRef, false);
-#line 1731 "cs.ATG"
+#line 1737 "cs.ATG"
identifier = null;
if (StartOf(19)) {
Identifier();
-#line 1732 "cs.ATG"
+#line 1738 "cs.ATG"
identifier = t.val;
}
Expect(21);
Block(
-#line 1733 "cs.ATG"
-out stmt);
-
-#line 1734 "cs.ATG"
- catchClause = new CatchClause(typeRef, identifier, stmt);
- while (
-#line 1735 "cs.ATG"
-IsTypedCatch()) {
- Expect(56);
- Expect(20);
- ClassType(
-#line 1735 "cs.ATG"
-out typeRef, false);
-
-#line 1735 "cs.ATG"
- identifier = null;
- if (StartOf(19)) {
- Identifier();
-
-#line 1736 "cs.ATG"
- identifier = t.val;
- }
- Expect(21);
- Block(
-#line 1737 "cs.ATG"
-out stmt);
-
-#line 1738 "cs.ATG"
- catchClause = new CatchClause(typeRef, identifier, stmt);
- }
- if (la.kind == 56) {
- lexer.NextToken();
- Block(
-#line 1740 "cs.ATG"
+#line 1739 "cs.ATG"
out stmt);
#line 1740 "cs.ATG"
- catchClause = new CatchClause(stmt);
- }
- } else SynErr(206);
+ catchClause = new CatchClause(typeRef, identifier, stmt);
+ } else SynErr(205);
-#line 1742 "cs.ATG"
+#line 1743 "cs.ATG"
if (catchClause != null) {
catchClause.StartLocation = startPos;
catchClause.EndLocation = t.Location;
- catchClauses.Add(catchClause);
}
}
@@ -4335,7 +4302,7 @@ LastExpressionIsUnaryMinus(expressions) && IsMostNegativeIntegerWithoutTypeSuffi
PrimaryExpr(
#line 1851 "cs.ATG"
out expr);
- } else SynErr(207);
+ } else SynErr(206);
#line 1853 "cs.ATG"
for (int i = 0; i < expressions.Count; ++i) {
@@ -4618,7 +4585,7 @@ NotVoidPointer()) {
TypeWithRestriction(
#line 1938 "cs.ATG"
out type, true, true);
- } else SynErr(208);
+ } else SynErr(207);
Expect(21);
#line 1940 "cs.ATG"
@@ -4671,7 +4638,7 @@ out expr);
#line 1946 "cs.ATG"
pexpr = expr;
- } else SynErr(209);
+ } else SynErr(208);
#line 1948 "cs.ATG"
if (pexpr != null) {
@@ -4696,7 +4663,7 @@ out expr);
#line 1959 "cs.ATG"
pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostDecrement);
- } else SynErr(210);
+ } else SynErr(209);
} else if (la.kind == 47) {
PointerMemberAccess(
#line 1962 "cs.ATG"
@@ -4845,7 +4812,7 @@ out type);
#line 2358 "cs.ATG"
if (type != null) { types.Add(type); }
}
- } else SynErr(211);
+ } else SynErr(210);
Expect(22);
}
@@ -5042,8 +5009,8 @@ out expr);
#line 2069 "cs.ATG"
ace.ArrayInitializer = (CollectionInitializerExpression)expr;
}
- } else SynErr(212);
- } else SynErr(213);
+ } else SynErr(211);
+ } else SynErr(212);
}
void AnonymousMethodExpr(
@@ -5179,7 +5146,7 @@ out type);
p = new ParameterDeclarationExpression(type, t.val, mod);
p.StartLocation = start; p.EndLocation = t.EndLocation;
- } else SynErr(214);
+ } else SynErr(213);
}
void LambdaExpressionBody(
@@ -5202,7 +5169,7 @@ out expr);
#line 2136 "cs.ATG"
lambda.ExpressionBody = expr;
- } else SynErr(215);
+ } else SynErr(214);
#line 2138 "cs.ATG"
lambda.EndLocation = t.EndLocation;
@@ -5400,7 +5367,7 @@ ref outExpr);
#line 2233 "cs.ATG"
op = BinaryOperatorType.GreaterThanOrEqual;
- } else SynErr(216);
+ } else SynErr(215);
UnaryExpr(
#line 2235 "cs.ATG"
out expr);
@@ -5441,7 +5408,7 @@ ref type);
#line 2248 "cs.ATG"
outExpr = new CastExpression(type, outExpr, CastType.TryCast);
- } else SynErr(217);
+ } else SynErr(216);
}
}
}
@@ -5583,7 +5550,7 @@ out t);
#line 2410 "cs.ATG"
type = t;
- } else SynErr(218);
+ } else SynErr(217);
}
void QueryExpressionFromClause(
@@ -5664,7 +5631,7 @@ out groupClause);
#line 2475 "cs.ATG"
q.SelectOrGroupClause = groupClause;
- } else SynErr(219);
+ } else SynErr(218);
if (la.kind == 136) {
QueryExpressionIntoClause(
#line 2477 "cs.ATG"
@@ -6127,23 +6094,22 @@ out expr);
case 200: s = "invalid EmbeddedStatement"; break;
case 201: s = "invalid ForInitializer"; break;
case 202: s = "invalid GotoStatement"; break;
- case 203: s = "invalid TryStatement"; break;
- case 204: s = "invalid ResourceAcquisition"; break;
- case 205: s = "invalid SwitchLabel"; break;
- case 206: s = "invalid CatchClauses"; break;
- case 207: s = "invalid UnaryExpr"; break;
+ case 203: s = "invalid ResourceAcquisition"; break;
+ case 204: s = "invalid SwitchLabel"; break;
+ case 205: s = "invalid CatchClause"; break;
+ case 206: s = "invalid UnaryExpr"; break;
+ case 207: s = "invalid PrimaryExpr"; break;
case 208: s = "invalid PrimaryExpr"; break;
case 209: s = "invalid PrimaryExpr"; break;
- case 210: s = "invalid PrimaryExpr"; break;
- case 211: s = "invalid TypeArgumentList"; break;
+ case 210: s = "invalid TypeArgumentList"; break;
+ case 211: s = "invalid NewExpression"; break;
case 212: s = "invalid NewExpression"; break;
- case 213: s = "invalid NewExpression"; break;
- case 214: s = "invalid LambdaExpressionParameter"; break;
- case 215: s = "invalid LambdaExpressionBody"; break;
+ case 213: s = "invalid LambdaExpressionParameter"; break;
+ case 214: s = "invalid LambdaExpressionBody"; break;
+ case 215: s = "invalid RelationalExpr"; break;
case 216: s = "invalid RelationalExpr"; break;
- case 217: s = "invalid RelationalExpr"; break;
- case 218: s = "invalid TypeParameterConstraintsClauseBase"; break;
- case 219: s = "invalid QueryExpressionBody"; break;
+ case 217: s = "invalid TypeParameterConstraintsClauseBase"; break;
+ case 218: s = "invalid QueryExpressionBody"; break;
default: s = "error " + errorNumber; break;
}
diff --git a/main/contrib/NRefactory/Project/Src/Parser/CSharp/cs.ATG b/main/contrib/NRefactory/Project/Src/Parser/CSharp/cs.ATG
index b8172db5fe..1901e1978b 100644
--- a/main/contrib/NRefactory/Project/Src/Parser/CSharp/cs.ATG
+++ b/main/contrib/NRefactory/Project/Src/Parser/CSharp/cs.ATG
@@ -880,6 +880,7 @@ StructMemberDecl<ModifierList m, List<AttributeSection> attributes>
List<ParameterDeclarationExpression> parameters = new List<ParameterDeclarationExpression>();
parameters.Add(new ParameterDeclarationExpression(type, varName));
OperatorDeclaration operatorDeclaration = new OperatorDeclaration {
+ Name = (isImplicit ? "op_Implicit" : "op_Explicit"),
Modifier = m.Modifier,
Attributes = attributes,
Parameters = parameters,
@@ -915,11 +916,16 @@ StructMemberDecl<ModifierList m, List<AttributeSection> attributes>
(. Location endPos = t.Location; .)
")" ( Block<out stmt> | ";" )
(.
+ if (op == OverloadableOperatorType.Add && secondType == null)
+ op = OverloadableOperatorType.UnaryPlus;
+ if (op == OverloadableOperatorType.Subtract && secondType == null)
+ op = OverloadableOperatorType.UnaryMinus;
OperatorDeclaration operatorDeclaration = new OperatorDeclaration {
Modifier = m.Modifier,
Attributes = attributes,
TypeReference = type,
OverloadableOperator = op,
+ Name = GetReflectionNameForOperator(op),
Body = (BlockStatement)stmt,
StartLocation = m.GetDeclarationLocation(startPos),
EndLocation = endPos
@@ -1697,14 +1703,16 @@ SwitchLabel<out CaseLabel label>
TryStatement<out Statement tryStatement>
(.
Statement blockStmt = null, finallyStmt = null;
- List<CatchClause> catchClauses = null;
+ CatchClause catchClause = null;
+ List<CatchClause> catchClauses = new List<CatchClause>();
.)
=
"try" Block<out blockStmt>
- (
- CatchClauses<out catchClauses> [ "finally" Block<out finallyStmt> ]
- | "finally" Block<out finallyStmt>
- )
+ {
+ CatchClause<out catchClause>
+ (. if (catchClause != null) catchClauses.Add(catchClause); .)
+ }
+ [ "finally" Block<out finallyStmt> ]
(.
tryStatement = new TryCatchStatement(blockStmt, catchClauses, finallyStmt);
if (catchClauses != null) {
@@ -1713,36 +1721,28 @@ TryStatement<out Statement tryStatement>
.)
.
-CatchClauses<out List<CatchClause> catchClauses>
-(.
- catchClauses = new List<CatchClause>();
-.)
+CatchClause<out CatchClause catchClause>
=
"catch" (. string identifier;
Statement stmt;
TypeReference typeRef;
Location startPos = t.Location;
- CatchClause catchClause = null;
+ catchClause = null;
.)
- /*--- general catch clause (as only catch clause) */
(
+ /*--- general catch clause */
Block<out stmt> (. catchClause = new CatchClause(stmt); .)
+
/*--- specific catch clause */
| "(" ClassType<out typeRef, false> (. identifier = null; .)
[ Identifier (. identifier = t.val; .) ]
")" Block<out stmt>
(. catchClause = new CatchClause(typeRef, identifier, stmt); .)
- { IF (IsTypedCatch()) "catch" "(" ClassType<out typeRef, false> (. identifier = null; .)
- [ Identifier (. identifier = t.val; .) ]
- ")" Block<out stmt>
- (. catchClause = new CatchClause(typeRef, identifier, stmt); .) }
- /*--- general catch clause (after specific catch clauses, optional) */
- [ "catch" Block<out stmt> (. catchClause = new CatchClause(stmt); .) ]
- ) (.
+ )
+ (.
if (catchClause != null) {
catchClause.StartLocation = startPos;
catchClause.EndLocation = t.Location;
- catchClauses.Add(catchClause);
}
.)
.
diff --git a/main/contrib/NRefactory/Project/Src/Parser/Errors.cs b/main/contrib/NRefactory/Project/Src/Parser/Errors.cs
index 854961a33e..4819e51b96 100644
--- a/main/contrib/NRefactory/Project/Src/Parser/Errors.cs
+++ b/main/contrib/NRefactory/Project/Src/Parser/Errors.cs
@@ -1,54 +1,54 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="none" email=""/>
-// <version>$Revision: 3385 $</version>
-// </file>
-
-using System;
-using System.Text;
-
-namespace ICSharpCode.NRefactory.Parser
-{
- public delegate void ErrorCodeProc(int line, int col, int n);
- public delegate void ErrorMsgProc(int line, int col, string msg);
-
- public class Errors
- {
- int count = 0; // number of errors detected
- public ErrorCodeProc SynErr;
- public ErrorCodeProc SemErr;
- public ErrorMsgProc Error;
- StringBuilder errorText = new StringBuilder();
-
- public string ErrorOutput {
- get {
- return errorText.ToString();
- }
- }
-
- public Errors()
- {
- SynErr = new ErrorCodeProc(DefaultCodeError); // syntactic errors
- SemErr = new ErrorCodeProc(DefaultCodeError); // semantic errors
- Error = new ErrorMsgProc(DefaultMsgError); // user defined string based errors
- }
-
- public int Count {
- get {
- return count;
- }
- }
-
- void DefaultCodeError(int line, int col, int n)
- {
- errorText.AppendLine(String.Format("-- line {0} col {1}: error {2}", line, col, n));
- count++;
- }
-
- void DefaultMsgError(int line, int col, string s) {
- errorText.AppendLine(String.Format("-- line {0} col {1}: {2}", line, col, s));
- count++;
- }
- } // Errors
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="none" email=""/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+using System.Text;
+
+namespace ICSharpCode.NRefactory.Parser
+{
+ public delegate void ErrorCodeProc(int line, int col, int n);
+ public delegate void ErrorMsgProc(int line, int col, string msg);
+
+ public class Errors
+ {
+ int count = 0; // number of errors detected
+ public ErrorCodeProc SynErr;
+ public ErrorCodeProc SemErr;
+ public ErrorMsgProc Error;
+ StringBuilder errorText = new StringBuilder();
+
+ public string ErrorOutput {
+ get {
+ return errorText.ToString();
+ }
+ }
+
+ public Errors()
+ {
+ SynErr = new ErrorCodeProc(DefaultCodeError); // syntactic errors
+ SemErr = new ErrorCodeProc(DefaultCodeError); // semantic errors
+ Error = new ErrorMsgProc(DefaultMsgError); // user defined string based errors
+ }
+
+ public int Count {
+ get {
+ return count;
+ }
+ }
+
+ void DefaultCodeError(int line, int col, int n)
+ {
+ errorText.AppendLine(String.Format("-- line {0} col {1}: error {2}", line, col, n));
+ count++;
+ }
+
+ void DefaultMsgError(int line, int col, string s) {
+ errorText.AppendLine(String.Format("-- line {0} col {1}: {2}", line, col, s));
+ count++;
+ }
+ } // Errors
+}
diff --git a/main/contrib/NRefactory/Project/Src/Parser/IParser.cs b/main/contrib/NRefactory/Project/Src/Parser/IParser.cs
index eca5c36d81..70aabcdf94 100644
--- a/main/contrib/NRefactory/Project/Src/Parser/IParser.cs
+++ b/main/contrib/NRefactory/Project/Src/Parser/IParser.cs
@@ -1,42 +1,42 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 2533M $</version>
-// </file>
-
-using System;
-using System.Collections.Generic;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory
-{
- /// <summary>
- /// Parser interface.
- /// </summary>
- public interface IParser : IDisposable
- {
- Parser.Errors Errors {
- get;
- }
-
- Parser.ILexer Lexer {
- get;
- }
-
- CompilationUnit CompilationUnit {
- get;
- }
-
- bool ParseMethodBodies {
- get; set;
- }
-
- void Parse();
-
- Expression ParseExpression();
- TypeReference ParseTypeReference ();
- BlockStatement ParseBlock();
- List<INode> ParseTypeMembers();
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+using System.Collections.Generic;
+using ICSharpCode.NRefactory.Ast;
+
+namespace ICSharpCode.NRefactory
+{
+ /// <summary>
+ /// Parser interface.
+ /// </summary>
+ public interface IParser : IDisposable
+ {
+ Parser.Errors Errors {
+ get;
+ }
+
+ Parser.ILexer Lexer {
+ get;
+ }
+
+ CompilationUnit CompilationUnit {
+ get;
+ }
+
+ bool ParseMethodBodies {
+ get; set;
+ }
+
+ void Parse();
+
+ Expression ParseExpression();
+ TypeReference ParseTypeReference ();
+ BlockStatement ParseBlock();
+ List<INode> ParseTypeMembers();
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Parser/ModifierList.cs b/main/contrib/NRefactory/Project/Src/Parser/ModifierList.cs
index 77ddb22055..78e76b6b00 100644
--- a/main/contrib/NRefactory/Project/Src/Parser/ModifierList.cs
+++ b/main/contrib/NRefactory/Project/Src/Parser/ModifierList.cs
@@ -1,73 +1,73 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="none" email=""/>
-// <version>$Revision: 3717 $</version>
-// </file>
-
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Parser
-{
- internal class ModifierList
- {
- Modifiers cur;
- Location location = new Location(-1, -1);
-
- public Modifiers Modifier {
- get {
- return cur;
- }
- }
-
- public Location GetDeclarationLocation(Location keywordLocation)
- {
- if(location.IsEmpty) {
- return keywordLocation;
- }
- return location;
- }
-
-// public Location Location {
-// get {
-// return location;
-// }
-// set {
-// location = value;
-// }
-// }
-
- public bool isNone { get { return cur == Modifiers.None; } }
-
- public bool Contains(Modifiers m)
- {
- return ((cur & m) != 0);
- }
-
- public void Add(Modifiers m, Location tokenLocation)
- {
- if(location.IsEmpty) {
- location = tokenLocation;
- }
-
- if ((cur & m) == 0) {
- cur |= m;
- } else {
-// parser.Error("modifier " + m + " already defined");
- }
- }
-
-// public void Add(Modifiers m)
-// {
-// Add(m.cur, m.Location);
-// }
-
- public void Check(Modifiers allowed)
- {
- Modifiers wrong = cur & ~allowed;
- if (wrong != Modifiers.None) {
-// parser.Error("modifier(s) " + wrong + " not allowed here");
- }
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="none" email=""/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using ICSharpCode.NRefactory.Ast;
+
+namespace ICSharpCode.NRefactory.Parser
+{
+ internal class ModifierList
+ {
+ Modifiers cur;
+ Location location = new Location(-1, -1);
+
+ public Modifiers Modifier {
+ get {
+ return cur;
+ }
+ }
+
+ public Location GetDeclarationLocation(Location keywordLocation)
+ {
+ if(location.IsEmpty) {
+ return keywordLocation;
+ }
+ return location;
+ }
+
+// public Location Location {
+// get {
+// return location;
+// }
+// set {
+// location = value;
+// }
+// }
+
+ public bool isNone { get { return cur == Modifiers.None; } }
+
+ public bool Contains(Modifiers m)
+ {
+ return ((cur & m) != 0);
+ }
+
+ public void Add(Modifiers m, Location tokenLocation)
+ {
+ if(location.IsEmpty) {
+ location = tokenLocation;
+ }
+
+ if ((cur & m) == 0) {
+ cur |= m;
+ } else {
+// parser.Error("modifier " + m + " already defined");
+ }
+ }
+
+// public void Add(Modifiers m)
+// {
+// Add(m.cur, m.Location);
+// }
+
+ public void Check(Modifiers allowed)
+ {
+ Modifiers wrong = cur & ~allowed;
+ if (wrong != Modifiers.None) {
+// parser.Error("modifier(s) " + wrong + " not allowed here");
+ }
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Parser/VBNet/ParamModifierList.cs b/main/contrib/NRefactory/Project/Src/Parser/VBNet/ParamModifierList.cs
index 6a54b67773..eba37a29ce 100644
--- a/main/contrib/NRefactory/Project/Src/Parser/VBNet/ParamModifierList.cs
+++ b/main/contrib/NRefactory/Project/Src/Parser/VBNet/ParamModifierList.cs
@@ -1,53 +1,53 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="none" email=""/>
-// <version>$Revision: 1611 $</version>
-// </file>
-
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Parser.VB
-{
- internal class ParamModifierList
- {
- ParameterModifiers cur;
- Parser parser;
-
- public ParameterModifiers Modifier {
- get {
- return cur;
- }
- }
-
- public ParamModifierList(Parser parser)
- {
- this.parser = parser;
- cur = ParameterModifiers.None;
- }
-
- public bool isNone { get { return cur == ParameterModifiers.None; } }
-
- public void Add(ParameterModifiers m)
- {
- if ((cur & m) == 0) {
- cur |= m;
- } else {
- parser.Error("param modifier " + m + " already defined");
- }
- }
-
- public void Add(ParamModifierList m)
- {
- Add(m.cur);
- }
-
- public void Check()
- {
- if((cur & ParameterModifiers.In) != 0 &&
- (cur & ParameterModifiers.Ref) != 0) {
- parser.Error("ByRef and ByVal are not allowed at the same time.");
- }
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="none" email=""/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using ICSharpCode.NRefactory.Ast;
+
+namespace ICSharpCode.NRefactory.Parser.VB
+{
+ internal class ParamModifierList
+ {
+ ParameterModifiers cur;
+ Parser parser;
+
+ public ParameterModifiers Modifier {
+ get {
+ return cur;
+ }
+ }
+
+ public ParamModifierList(Parser parser)
+ {
+ this.parser = parser;
+ cur = ParameterModifiers.None;
+ }
+
+ public bool isNone { get { return cur == ParameterModifiers.None; } }
+
+ public void Add(ParameterModifiers m)
+ {
+ if ((cur & m) == 0) {
+ cur |= m;
+ } else {
+ parser.Error("param modifier " + m + " already defined");
+ }
+ }
+
+ public void Add(ParamModifierList m)
+ {
+ Add(m.cur);
+ }
+
+ public void Check()
+ {
+ if((cur & ParameterModifiers.In) != 0 &&
+ (cur & ParameterModifiers.Ref) != 0) {
+ parser.Error("ByRef and ByVal are not allowed at the same time.");
+ }
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Parser/VBNet/Parser.cs b/main/contrib/NRefactory/Project/Src/Parser/VBNet/Parser.cs
index 33f40d8748..4551eda142 100644
--- a/main/contrib/NRefactory/Project/Src/Parser/VBNet/Parser.cs
+++ b/main/contrib/NRefactory/Project/Src/Parser/VBNet/Parser.cs
@@ -1,7406 +1,7406 @@
-
-#line 1 "VBNET.ATG"
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.Specialized;
-using System.Text;
-using ICSharpCode.NRefactory.Ast;
-using ICSharpCode.NRefactory.Parser.VB;
-using ASTAttribute = ICSharpCode.NRefactory.Ast.Attribute;
-/*
- Parser.frame file for NRefactory.
- */
-using System;
-using System.Reflection;
-
-namespace ICSharpCode.NRefactory.Parser.VB {
-
-
-
-partial class Parser : AbstractParser
-{
- const int maxT = 222;
-
- const bool T = true;
- const bool x = false;
-
-
-#line 12 "VBNET.ATG"
-
-
-/*
-
-*/
-
- void VBNET() {
-
-#line 246 "VBNET.ATG"
- lexer.NextToken(); // get the first token
- compilationUnit = new CompilationUnit();
-
- while (la.kind == 1 || la.kind == 11) {
- EndOfStmt();
- }
- while (la.kind == 159) {
- OptionStmt();
- while (la.kind == 1 || la.kind == 11) {
- EndOfStmt();
- }
- }
- while (la.kind == 124) {
- ImportsStmt();
- while (la.kind == 1 || la.kind == 11) {
- EndOfStmt();
- }
- }
- while (
-#line 253 "VBNET.ATG"
-IsGlobalAttrTarget()) {
- GlobalAttributeSection();
- while (la.kind == 1 || la.kind == 11) {
- EndOfStmt();
- }
- }
- while (StartOf(1)) {
- NamespaceMemberDecl();
- while (la.kind == 1 || la.kind == 11) {
- EndOfStmt();
- }
- }
- Expect(0);
- }
-
- void EndOfStmt() {
- if (la.kind == 1) {
- lexer.NextToken();
- } else if (la.kind == 11) {
- lexer.NextToken();
- } else SynErr(223);
- }
-
- void OptionStmt() {
-
-#line 258 "VBNET.ATG"
- INode node = null; bool val = true;
- Expect(159);
-
-#line 259 "VBNET.ATG"
- Location startPos = t.Location;
- if (la.kind == 108) {
- lexer.NextToken();
- if (la.kind == 156 || la.kind == 157) {
- OptionValue(
-#line 261 "VBNET.ATG"
-ref val);
- }
-
-#line 262 "VBNET.ATG"
- node = new OptionDeclaration(OptionType.Explicit, val);
- } else if (la.kind == 192) {
- lexer.NextToken();
- if (la.kind == 156 || la.kind == 157) {
- OptionValue(
-#line 264 "VBNET.ATG"
-ref val);
- }
-
-#line 265 "VBNET.ATG"
- node = new OptionDeclaration(OptionType.Strict, val);
- } else if (la.kind == 74) {
- lexer.NextToken();
- if (la.kind == 54) {
- lexer.NextToken();
-
-#line 267 "VBNET.ATG"
- node = new OptionDeclaration(OptionType.CompareBinary, val);
- } else if (la.kind == 198) {
- lexer.NextToken();
-
-#line 268 "VBNET.ATG"
- node = new OptionDeclaration(OptionType.CompareText, val);
- } else SynErr(224);
- } else if (la.kind == 126) {
- lexer.NextToken();
- if (la.kind == 156 || la.kind == 157) {
- OptionValue(
-#line 271 "VBNET.ATG"
-ref val);
- }
-
-#line 272 "VBNET.ATG"
- node = new OptionDeclaration(OptionType.Infer, val);
- } else SynErr(225);
- EndOfStmt();
-
-#line 276 "VBNET.ATG"
- if (node != null) {
- node.StartLocation = startPos;
- node.EndLocation = t.Location;
- compilationUnit.AddChild(node);
- }
-
- }
-
- void ImportsStmt() {
-
-#line 299 "VBNET.ATG"
- List<Using> usings = new List<Using>();
-
- Expect(124);
-
-#line 303 "VBNET.ATG"
- Location startPos = t.Location;
- Using u;
-
- ImportClause(
-#line 306 "VBNET.ATG"
-out u);
-
-#line 306 "VBNET.ATG"
- if (u != null) { usings.Add(u); }
- while (la.kind == 12) {
- lexer.NextToken();
- ImportClause(
-#line 308 "VBNET.ATG"
-out u);
-
-#line 308 "VBNET.ATG"
- if (u != null) { usings.Add(u); }
- }
- EndOfStmt();
-
-#line 312 "VBNET.ATG"
- UsingDeclaration usingDeclaration = new UsingDeclaration(usings);
- usingDeclaration.StartLocation = startPos;
- usingDeclaration.EndLocation = t.Location;
- compilationUnit.AddChild(usingDeclaration);
-
- }
-
- void GlobalAttributeSection() {
- Expect(28);
-
-#line 2521 "VBNET.ATG"
- Location startPos = t.Location;
- if (la.kind == 52) {
- lexer.NextToken();
- } else if (la.kind == 141) {
- lexer.NextToken();
- } else SynErr(226);
-
-#line 2523 "VBNET.ATG"
- string attributeTarget = t.val != null ? t.val.ToLower(System.Globalization.CultureInfo.InvariantCulture) : null;
- List<ASTAttribute> attributes = new List<ASTAttribute>();
- ASTAttribute attribute;
-
- Expect(11);
- Attribute(
-#line 2527 "VBNET.ATG"
-out attribute);
-
-#line 2527 "VBNET.ATG"
- attributes.Add(attribute);
- while (
-#line 2528 "VBNET.ATG"
-NotFinalComma()) {
- if (la.kind == 12) {
- lexer.NextToken();
- if (la.kind == 52) {
- lexer.NextToken();
- } else if (la.kind == 141) {
- lexer.NextToken();
- } else SynErr(227);
- Expect(11);
- }
- Attribute(
-#line 2528 "VBNET.ATG"
-out attribute);
-
-#line 2528 "VBNET.ATG"
- attributes.Add(attribute);
- }
- if (la.kind == 12) {
- lexer.NextToken();
- }
- Expect(27);
- EndOfStmt();
-
-#line 2533 "VBNET.ATG"
- AttributeSection section = new AttributeSection {
- AttributeTarget = attributeTarget,
- Attributes = attributes,
- StartLocation = startPos,
- EndLocation = t.EndLocation
- };
- compilationUnit.AddChild(section);
-
- }
-
- void NamespaceMemberDecl() {
-
-#line 341 "VBNET.ATG"
- ModifierList m = new ModifierList();
- AttributeSection section;
- List<AttributeSection> attributes = new List<AttributeSection>();
- string qualident;
-
- if (la.kind == 146) {
- lexer.NextToken();
-
-#line 348 "VBNET.ATG"
- Location startPos = t.Location;
-
- Qualident(
-#line 350 "VBNET.ATG"
-out qualident);
-
-#line 352 "VBNET.ATG"
- INode node = new NamespaceDeclaration(qualident);
- node.StartLocation = startPos;
- compilationUnit.AddChild(node);
- compilationUnit.BlockStart(node);
-
- EndOfStmt();
- NamespaceBody();
-
-#line 360 "VBNET.ATG"
- node.EndLocation = t.Location;
- compilationUnit.BlockEnd();
-
- } else if (StartOf(2)) {
- while (la.kind == 28) {
- AttributeSection(
-#line 364 "VBNET.ATG"
-out section);
-
-#line 364 "VBNET.ATG"
- attributes.Add(section);
- }
- while (StartOf(3)) {
- TypeModifier(
-#line 365 "VBNET.ATG"
-m);
- }
- NonModuleDeclaration(
-#line 365 "VBNET.ATG"
-m, attributes);
- } else SynErr(228);
- }
-
- void OptionValue(
-#line 284 "VBNET.ATG"
-ref bool val) {
- if (la.kind == 157) {
- lexer.NextToken();
-
-#line 286 "VBNET.ATG"
- val = true;
- } else if (la.kind == 156) {
- lexer.NextToken();
-
-#line 288 "VBNET.ATG"
- val = false;
- } else SynErr(229);
- }
-
- void ImportClause(
-#line 319 "VBNET.ATG"
-out Using u) {
-
-#line 321 "VBNET.ATG"
- string qualident = null;
- TypeReference aliasedType = null;
- u = null;
-
- Qualident(
-#line 325 "VBNET.ATG"
-out qualident);
- if (la.kind == 10) {
- lexer.NextToken();
- TypeName(
-#line 326 "VBNET.ATG"
-out aliasedType);
- }
-
-#line 328 "VBNET.ATG"
- if (qualident != null && qualident.Length > 0) {
- if (aliasedType != null) {
- u = new Using(qualident, aliasedType);
- } else {
- u = new Using(qualident);
- }
- }
-
- }
-
- void Qualident(
-#line 3279 "VBNET.ATG"
-out string qualident) {
-
-#line 3281 "VBNET.ATG"
- string name;
- qualidentBuilder.Length = 0;
-
- Identifier();
-
-#line 3285 "VBNET.ATG"
- qualidentBuilder.Append(t.val);
- while (
-#line 3286 "VBNET.ATG"
-DotAndIdentOrKw()) {
- Expect(16);
- IdentifierOrKeyword(
-#line 3286 "VBNET.ATG"
-out name);
-
-#line 3286 "VBNET.ATG"
- qualidentBuilder.Append('.'); qualidentBuilder.Append(name);
- }
-
-#line 3288 "VBNET.ATG"
- qualident = qualidentBuilder.ToString();
- }
-
- void TypeName(
-#line 2394 "VBNET.ATG"
-out TypeReference typeref) {
-
-#line 2395 "VBNET.ATG"
- ArrayList rank = null;
- NonArrayTypeName(
-#line 2397 "VBNET.ATG"
-out typeref, false);
- ArrayTypeModifiers(
-#line 2401 "VBNET.ATG"
-out rank);
-
-#line 2402 "VBNET.ATG"
- if (rank != null && typeref != null) {
- typeref.RankSpecifier = (int[])rank.ToArray(typeof(int));
- }
-
- }
-
- void NamespaceBody() {
- while (la.kind == 1 || la.kind == 11) {
- EndOfStmt();
- }
- while (StartOf(1)) {
- NamespaceMemberDecl();
- while (la.kind == 1 || la.kind == 11) {
- EndOfStmt();
- }
- }
- Expect(100);
- Expect(146);
- EndOfStmt();
- }
-
- void AttributeSection(
-#line 2596 "VBNET.ATG"
-out AttributeSection section) {
-
-#line 2598 "VBNET.ATG"
- string attributeTarget = "";List<ASTAttribute> attributes = new List<ASTAttribute>();
- ASTAttribute attribute;
-
-
- Expect(28);
-
-#line 2602 "VBNET.ATG"
- Location startPos = t.Location;
- if (
-#line 2603 "VBNET.ATG"
-IsLocalAttrTarget()) {
- if (la.kind == 106) {
- lexer.NextToken();
-
-#line 2604 "VBNET.ATG"
- attributeTarget = "event";
- } else if (la.kind == 180) {
- lexer.NextToken();
-
-#line 2605 "VBNET.ATG"
- attributeTarget = "return";
- } else {
- Identifier();
-
-#line 2608 "VBNET.ATG"
- string val = t.val.ToLower(System.Globalization.CultureInfo.InvariantCulture);
- if (val != "field" || val != "method" ||
- val != "module" || val != "param" ||
- val != "property" || val != "type")
- Error("attribute target specifier (event, return, field," +
- "method, module, param, property, or type) expected");
- attributeTarget = t.val;
-
- }
- Expect(11);
- }
- Attribute(
-#line 2618 "VBNET.ATG"
-out attribute);
-
-#line 2618 "VBNET.ATG"
- attributes.Add(attribute);
- while (
-#line 2619 "VBNET.ATG"
-NotFinalComma()) {
- Expect(12);
- Attribute(
-#line 2619 "VBNET.ATG"
-out attribute);
-
-#line 2619 "VBNET.ATG"
- attributes.Add(attribute);
- }
- if (la.kind == 12) {
- lexer.NextToken();
- }
- Expect(27);
-
-#line 2623 "VBNET.ATG"
- section = new AttributeSection {
- AttributeTarget = attributeTarget,
- Attributes = attributes,
- StartLocation = startPos,
- EndLocation = t.EndLocation
- };
-
- }
-
- void TypeModifier(
-#line 3362 "VBNET.ATG"
-ModifierList m) {
- switch (la.kind) {
- case 173: {
- lexer.NextToken();
-
-#line 3363 "VBNET.ATG"
- m.Add(Modifiers.Public, t.Location);
- break;
- }
- case 172: {
- lexer.NextToken();
-
-#line 3364 "VBNET.ATG"
- m.Add(Modifiers.Protected, t.Location);
- break;
- }
- case 112: {
- lexer.NextToken();
-
-#line 3365 "VBNET.ATG"
- m.Add(Modifiers.Internal, t.Location);
- break;
- }
- case 170: {
- lexer.NextToken();
-
-#line 3366 "VBNET.ATG"
- m.Add(Modifiers.Private, t.Location);
- break;
- }
- case 185: {
- lexer.NextToken();
-
-#line 3367 "VBNET.ATG"
- m.Add(Modifiers.Static, t.Location);
- break;
- }
- case 184: {
- lexer.NextToken();
-
-#line 3368 "VBNET.ATG"
- m.Add(Modifiers.New, t.Location);
- break;
- }
- case 142: {
- lexer.NextToken();
-
-#line 3369 "VBNET.ATG"
- m.Add(Modifiers.Abstract, t.Location);
- break;
- }
- case 152: {
- lexer.NextToken();
-
-#line 3370 "VBNET.ATG"
- m.Add(Modifiers.Sealed, t.Location);
- break;
- }
- case 168: {
- lexer.NextToken();
-
-#line 3371 "VBNET.ATG"
- m.Add(Modifiers.Partial, t.Location);
- break;
- }
- default: SynErr(230); break;
- }
- }
-
- void NonModuleDeclaration(
-#line 424 "VBNET.ATG"
-ModifierList m, List<AttributeSection> attributes) {
-
-#line 426 "VBNET.ATG"
- TypeReference typeRef = null;
- List<TypeReference> baseInterfaces = null;
-
- switch (la.kind) {
- case 71: {
-
-#line 429 "VBNET.ATG"
- m.Check(Modifiers.Classes);
- lexer.NextToken();
-
-#line 432 "VBNET.ATG"
- TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
- newType.StartLocation = t.Location;
- compilationUnit.AddChild(newType);
- compilationUnit.BlockStart(newType);
-
- newType.Type = ClassType.Class;
-
- Identifier();
-
-#line 439 "VBNET.ATG"
- newType.Name = t.val;
- TypeParameterList(
-#line 440 "VBNET.ATG"
-newType.Templates);
- EndOfStmt();
-
-#line 442 "VBNET.ATG"
- newType.BodyStartLocation = t.Location;
- if (la.kind == 127) {
- ClassBaseType(
-#line 443 "VBNET.ATG"
-out typeRef);
-
-#line 443 "VBNET.ATG"
- SafeAdd(newType, newType.BaseTypes, typeRef);
- }
- while (la.kind == 123) {
- TypeImplementsClause(
-#line 444 "VBNET.ATG"
-out baseInterfaces);
-
-#line 444 "VBNET.ATG"
- newType.BaseTypes.AddRange(baseInterfaces);
- }
- ClassBody(
-#line 445 "VBNET.ATG"
-newType);
- Expect(100);
- Expect(71);
-
-#line 446 "VBNET.ATG"
- newType.EndLocation = t.EndLocation;
- EndOfStmt();
-
-#line 449 "VBNET.ATG"
- compilationUnit.BlockEnd();
-
- break;
- }
- case 141: {
- lexer.NextToken();
-
-#line 453 "VBNET.ATG"
- m.Check(Modifiers.VBModules);
- TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
- compilationUnit.AddChild(newType);
- compilationUnit.BlockStart(newType);
- newType.StartLocation = m.GetDeclarationLocation(t.Location);
- newType.Type = ClassType.Module;
-
- Identifier();
-
-#line 460 "VBNET.ATG"
- newType.Name = t.val;
- EndOfStmt();
-
-#line 462 "VBNET.ATG"
- newType.BodyStartLocation = t.Location;
- ModuleBody(
-#line 463 "VBNET.ATG"
-newType);
-
-#line 465 "VBNET.ATG"
- compilationUnit.BlockEnd();
-
- break;
- }
- case 194: {
- lexer.NextToken();
-
-#line 469 "VBNET.ATG"
- m.Check(Modifiers.VBStructures);
- TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
- compilationUnit.AddChild(newType);
- compilationUnit.BlockStart(newType);
- newType.StartLocation = m.GetDeclarationLocation(t.Location);
- newType.Type = ClassType.Struct;
-
- Identifier();
-
-#line 476 "VBNET.ATG"
- newType.Name = t.val;
- TypeParameterList(
-#line 477 "VBNET.ATG"
-newType.Templates);
- EndOfStmt();
-
-#line 479 "VBNET.ATG"
- newType.BodyStartLocation = t.Location;
- while (la.kind == 123) {
- TypeImplementsClause(
-#line 480 "VBNET.ATG"
-out baseInterfaces);
-
-#line 480 "VBNET.ATG"
- newType.BaseTypes.AddRange(baseInterfaces);
- }
- StructureBody(
-#line 481 "VBNET.ATG"
-newType);
-
-#line 483 "VBNET.ATG"
- compilationUnit.BlockEnd();
-
- break;
- }
- case 102: {
- lexer.NextToken();
-
-#line 488 "VBNET.ATG"
- m.Check(Modifiers.VBEnums);
- TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
- newType.StartLocation = m.GetDeclarationLocation(t.Location);
- compilationUnit.AddChild(newType);
- compilationUnit.BlockStart(newType);
-
- newType.Type = ClassType.Enum;
-
- Identifier();
-
-#line 496 "VBNET.ATG"
- newType.Name = t.val;
- if (la.kind == 50) {
- lexer.NextToken();
- NonArrayTypeName(
-#line 497 "VBNET.ATG"
-out typeRef, false);
-
-#line 497 "VBNET.ATG"
- SafeAdd(newType, newType.BaseTypes, typeRef);
- }
- EndOfStmt();
-
-#line 499 "VBNET.ATG"
- newType.BodyStartLocation = t.Location;
- EnumBody(
-#line 500 "VBNET.ATG"
-newType);
-
-#line 502 "VBNET.ATG"
- compilationUnit.BlockEnd();
-
- break;
- }
- case 129: {
- lexer.NextToken();
-
-#line 507 "VBNET.ATG"
- m.Check(Modifiers.VBInterfacs);
- TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
- newType.StartLocation = m.GetDeclarationLocation(t.Location);
- compilationUnit.AddChild(newType);
- compilationUnit.BlockStart(newType);
- newType.Type = ClassType.Interface;
-
- Identifier();
-
-#line 514 "VBNET.ATG"
- newType.Name = t.val;
- TypeParameterList(
-#line 515 "VBNET.ATG"
-newType.Templates);
- EndOfStmt();
-
-#line 517 "VBNET.ATG"
- newType.BodyStartLocation = t.Location;
- while (la.kind == 127) {
- InterfaceBase(
-#line 518 "VBNET.ATG"
-out baseInterfaces);
-
-#line 518 "VBNET.ATG"
- newType.BaseTypes.AddRange(baseInterfaces);
- }
- InterfaceBody(
-#line 519 "VBNET.ATG"
-newType);
-
-#line 521 "VBNET.ATG"
- compilationUnit.BlockEnd();
-
- break;
- }
- case 90: {
- lexer.NextToken();
-
-#line 526 "VBNET.ATG"
- m.Check(Modifiers.VBDelegates);
- DelegateDeclaration delegateDeclr = new DelegateDeclaration(m.Modifier, attributes);
- delegateDeclr.ReturnType = new TypeReference("System.Void", true);
- delegateDeclr.StartLocation = m.GetDeclarationLocation(t.Location);
- List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
-
- if (la.kind == 195) {
- lexer.NextToken();
- Identifier();
-
-#line 533 "VBNET.ATG"
- delegateDeclr.Name = t.val;
- TypeParameterList(
-#line 534 "VBNET.ATG"
-delegateDeclr.Templates);
- if (la.kind == 25) {
- lexer.NextToken();
- if (StartOf(4)) {
- FormalParameterList(
-#line 535 "VBNET.ATG"
-p);
- }
- Expect(26);
-
-#line 535 "VBNET.ATG"
- delegateDeclr.Parameters = p;
- }
- } else if (la.kind == 114) {
- lexer.NextToken();
- Identifier();
-
-#line 537 "VBNET.ATG"
- delegateDeclr.Name = t.val;
- TypeParameterList(
-#line 538 "VBNET.ATG"
-delegateDeclr.Templates);
- if (la.kind == 25) {
- lexer.NextToken();
- if (StartOf(4)) {
- FormalParameterList(
-#line 539 "VBNET.ATG"
-p);
- }
- Expect(26);
-
-#line 539 "VBNET.ATG"
- delegateDeclr.Parameters = p;
- }
- if (la.kind == 50) {
- lexer.NextToken();
-
-#line 540 "VBNET.ATG"
- TypeReference type;
- TypeName(
-#line 540 "VBNET.ATG"
-out type);
-
-#line 540 "VBNET.ATG"
- delegateDeclr.ReturnType = type;
- }
- } else SynErr(231);
-
-#line 542 "VBNET.ATG"
- delegateDeclr.EndLocation = t.EndLocation;
- EndOfStmt();
-
-#line 545 "VBNET.ATG"
- compilationUnit.AddChild(delegateDeclr);
-
- break;
- }
- default: SynErr(232); break;
- }
- }
-
- void TypeParameterList(
-#line 369 "VBNET.ATG"
-List<TemplateDefinition> templates) {
-
-#line 371 "VBNET.ATG"
- TemplateDefinition template;
-
- if (
-#line 374 "VBNET.ATG"
-la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of) {
- lexer.NextToken();
- Expect(155);
- TypeParameter(
-#line 375 "VBNET.ATG"
-out template);
-
-#line 377 "VBNET.ATG"
- if (template != null) templates.Add(template);
-
- while (la.kind == 12) {
- lexer.NextToken();
- TypeParameter(
-#line 380 "VBNET.ATG"
-out template);
-
-#line 382 "VBNET.ATG"
- if (template != null) templates.Add(template);
-
- }
- Expect(26);
- }
- }
-
- void TypeParameter(
-#line 390 "VBNET.ATG"
-out TemplateDefinition template) {
- Identifier();
-
-#line 392 "VBNET.ATG"
- template = new TemplateDefinition(t.val, null);
- if (la.kind == 50) {
- TypeParameterConstraints(
-#line 393 "VBNET.ATG"
-template);
- }
- }
-
- void Identifier() {
- if (StartOf(5)) {
- IdentifierForFieldDeclaration();
- } else if (la.kind == 85) {
- lexer.NextToken();
- } else SynErr(233);
- }
-
- void TypeParameterConstraints(
-#line 397 "VBNET.ATG"
-TemplateDefinition template) {
-
-#line 399 "VBNET.ATG"
- TypeReference constraint;
-
- Expect(50);
- if (la.kind == 23) {
- lexer.NextToken();
- TypeParameterConstraint(
-#line 405 "VBNET.ATG"
-out constraint);
-
-#line 405 "VBNET.ATG"
- if (constraint != null) { template.Bases.Add(constraint); }
- while (la.kind == 12) {
- lexer.NextToken();
- TypeParameterConstraint(
-#line 408 "VBNET.ATG"
-out constraint);
-
-#line 408 "VBNET.ATG"
- if (constraint != null) { template.Bases.Add(constraint); }
- }
- Expect(24);
- } else if (StartOf(6)) {
- TypeParameterConstraint(
-#line 411 "VBNET.ATG"
-out constraint);
-
-#line 411 "VBNET.ATG"
- if (constraint != null) { template.Bases.Add(constraint); }
- } else SynErr(234);
- }
-
- void TypeParameterConstraint(
-#line 415 "VBNET.ATG"
-out TypeReference constraint) {
-
-#line 416 "VBNET.ATG"
- constraint = null;
- if (la.kind == 71) {
- lexer.NextToken();
-
-#line 417 "VBNET.ATG"
- constraint = TypeReference.ClassConstraint;
- } else if (la.kind == 194) {
- lexer.NextToken();
-
-#line 418 "VBNET.ATG"
- constraint = TypeReference.StructConstraint;
- } else if (la.kind == 148) {
- lexer.NextToken();
-
-#line 419 "VBNET.ATG"
- constraint = TypeReference.NewConstraint;
- } else if (StartOf(7)) {
- TypeName(
-#line 420 "VBNET.ATG"
-out constraint);
- } else SynErr(235);
- }
-
- void ClassBaseType(
-#line 765 "VBNET.ATG"
-out TypeReference typeRef) {
-
-#line 767 "VBNET.ATG"
- typeRef = null;
-
- Expect(127);
- TypeName(
-#line 770 "VBNET.ATG"
-out typeRef);
- EndOfStmt();
- }
-
- void TypeImplementsClause(
-#line 1563 "VBNET.ATG"
-out List<TypeReference> baseInterfaces) {
-
-#line 1565 "VBNET.ATG"
- baseInterfaces = new List<TypeReference>();
- TypeReference type = null;
-
- Expect(123);
- TypeName(
-#line 1568 "VBNET.ATG"
-out type);
-
-#line 1570 "VBNET.ATG"
- if (type != null) baseInterfaces.Add(type);
-
- while (la.kind == 12) {
- lexer.NextToken();
- TypeName(
-#line 1573 "VBNET.ATG"
-out type);
-
-#line 1574 "VBNET.ATG"
- if (type != null) baseInterfaces.Add(type);
- }
- EndOfStmt();
- }
-
- void ClassBody(
-#line 559 "VBNET.ATG"
-TypeDeclaration newType) {
-
-#line 560 "VBNET.ATG"
- AttributeSection section;
- while (la.kind == 1 || la.kind == 11) {
- EndOfStmt();
- }
- while (StartOf(8)) {
-
-#line 563 "VBNET.ATG"
- List<AttributeSection> attributes = new List<AttributeSection>();
- ModifierList m = new ModifierList();
-
- while (la.kind == 28) {
- AttributeSection(
-#line 566 "VBNET.ATG"
-out section);
-
-#line 566 "VBNET.ATG"
- attributes.Add(section);
- }
- while (StartOf(9)) {
- MemberModifier(
-#line 567 "VBNET.ATG"
-m);
- }
- ClassMemberDecl(
-#line 568 "VBNET.ATG"
-m, attributes);
- while (la.kind == 1 || la.kind == 11) {
- EndOfStmt();
- }
- }
- }
-
- void ModuleBody(
-#line 590 "VBNET.ATG"
-TypeDeclaration newType) {
-
-#line 591 "VBNET.ATG"
- AttributeSection section;
- while (la.kind == 1 || la.kind == 11) {
- EndOfStmt();
- }
- while (StartOf(8)) {
-
-#line 594 "VBNET.ATG"
- List<AttributeSection> attributes = new List<AttributeSection>();
- ModifierList m = new ModifierList();
-
- while (la.kind == 28) {
- AttributeSection(
-#line 597 "VBNET.ATG"
-out section);
-
-#line 597 "VBNET.ATG"
- attributes.Add(section);
- }
- while (StartOf(9)) {
- MemberModifier(
-#line 598 "VBNET.ATG"
-m);
- }
- ClassMemberDecl(
-#line 599 "VBNET.ATG"
-m, attributes);
- while (la.kind == 1 || la.kind == 11) {
- EndOfStmt();
- }
- }
- Expect(100);
- Expect(141);
-
-#line 602 "VBNET.ATG"
- newType.EndLocation = t.EndLocation;
- EndOfStmt();
- }
-
- void StructureBody(
-#line 573 "VBNET.ATG"
-TypeDeclaration newType) {
-
-#line 574 "VBNET.ATG"
- AttributeSection section;
- while (la.kind == 1 || la.kind == 11) {
- EndOfStmt();
- }
- while (StartOf(8)) {
-
-#line 577 "VBNET.ATG"
- List<AttributeSection> attributes = new List<AttributeSection>();
- ModifierList m = new ModifierList();
-
- while (la.kind == 28) {
- AttributeSection(
-#line 580 "VBNET.ATG"
-out section);
-
-#line 580 "VBNET.ATG"
- attributes.Add(section);
- }
- while (StartOf(9)) {
- MemberModifier(
-#line 581 "VBNET.ATG"
-m);
- }
- StructureMemberDecl(
-#line 582 "VBNET.ATG"
-m, attributes);
- while (la.kind == 1 || la.kind == 11) {
- EndOfStmt();
- }
- }
- Expect(100);
- Expect(194);
-
-#line 585 "VBNET.ATG"
- newType.EndLocation = t.EndLocation;
- EndOfStmt();
- }
-
- void NonArrayTypeName(
-#line 2420 "VBNET.ATG"
-out TypeReference typeref, bool canBeUnbound) {
-
-#line 2422 "VBNET.ATG"
- string name;
- typeref = null;
- bool isGlobal = false;
-
- if (StartOf(10)) {
- if (la.kind == 117) {
- lexer.NextToken();
- Expect(16);
-
-#line 2427 "VBNET.ATG"
- isGlobal = true;
- }
- QualIdentAndTypeArguments(
-#line 2428 "VBNET.ATG"
-out typeref, canBeUnbound);
-
-#line 2429 "VBNET.ATG"
- typeref.IsGlobal = isGlobal;
- while (la.kind == 16) {
- lexer.NextToken();
-
-#line 2430 "VBNET.ATG"
- TypeReference nestedTypeRef;
- QualIdentAndTypeArguments(
-#line 2431 "VBNET.ATG"
-out nestedTypeRef, canBeUnbound);
-
-#line 2432 "VBNET.ATG"
- typeref = new InnerClassTypeReference(typeref, nestedTypeRef.Type, nestedTypeRef.GenericTypes);
- }
- } else if (la.kind == 154) {
- lexer.NextToken();
-
-#line 2435 "VBNET.ATG"
- typeref = new TypeReference("System.Object", true);
- if (la.kind == 21) {
- lexer.NextToken();
-
-#line 2439 "VBNET.ATG"
- List<TypeReference> typeArguments = new List<TypeReference>(1);
- if (typeref != null) typeArguments.Add(typeref);
- typeref = new TypeReference("System.Nullable", typeArguments) { IsKeyword = true };
-
- }
- } else if (StartOf(11)) {
- PrimitiveTypeName(
-#line 2445 "VBNET.ATG"
-out name);
-
-#line 2445 "VBNET.ATG"
- typeref = new TypeReference(name, true);
- if (la.kind == 21) {
- lexer.NextToken();
-
-#line 2449 "VBNET.ATG"
- List<TypeReference> typeArguments = new List<TypeReference>(1);
- if (typeref != null) typeArguments.Add(typeref);
- typeref = new TypeReference("System.Nullable", typeArguments) { IsKeyword = true };
-
- }
- } else SynErr(236);
- }
-
- void EnumBody(
-#line 606 "VBNET.ATG"
-TypeDeclaration newType) {
-
-#line 607 "VBNET.ATG"
- FieldDeclaration f;
- while (la.kind == 1 || la.kind == 11) {
- EndOfStmt();
- }
- while (StartOf(12)) {
- EnumMemberDecl(
-#line 610 "VBNET.ATG"
-out f);
-
-#line 612 "VBNET.ATG"
- compilationUnit.AddChild(f);
-
- while (la.kind == 1 || la.kind == 11) {
- EndOfStmt();
- }
- }
- Expect(100);
- Expect(102);
-
-#line 616 "VBNET.ATG"
- newType.EndLocation = t.EndLocation;
- EndOfStmt();
- }
-
- void InterfaceBase(
-#line 1548 "VBNET.ATG"
-out List<TypeReference> bases) {
-
-#line 1550 "VBNET.ATG"
- TypeReference type;
- bases = new List<TypeReference>();
-
- Expect(127);
- TypeName(
-#line 1554 "VBNET.ATG"
-out type);
-
-#line 1554 "VBNET.ATG"
- if (type != null) bases.Add(type);
- while (la.kind == 12) {
- lexer.NextToken();
- TypeName(
-#line 1557 "VBNET.ATG"
-out type);
-
-#line 1557 "VBNET.ATG"
- if (type != null) bases.Add(type);
- }
- EndOfStmt();
- }
-
- void InterfaceBody(
-#line 620 "VBNET.ATG"
-TypeDeclaration newType) {
- while (la.kind == 1 || la.kind == 11) {
- EndOfStmt();
- }
- while (StartOf(13)) {
- InterfaceMemberDecl();
- while (la.kind == 1 || la.kind == 11) {
- EndOfStmt();
- }
- }
- Expect(100);
- Expect(129);
-
-#line 626 "VBNET.ATG"
- newType.EndLocation = t.EndLocation;
- EndOfStmt();
- }
-
- void FormalParameterList(
-#line 2633 "VBNET.ATG"
-List<ParameterDeclarationExpression> parameter) {
-
-#line 2634 "VBNET.ATG"
- ParameterDeclarationExpression p;
- FormalParameter(
-#line 2636 "VBNET.ATG"
-out p);
-
-#line 2636 "VBNET.ATG"
- if (p != null) parameter.Add(p);
- while (la.kind == 12) {
- lexer.NextToken();
- FormalParameter(
-#line 2638 "VBNET.ATG"
-out p);
-
-#line 2638 "VBNET.ATG"
- if (p != null) parameter.Add(p);
- }
- }
-
- void MemberModifier(
-#line 3374 "VBNET.ATG"
-ModifierList m) {
- switch (la.kind) {
- case 142: {
- lexer.NextToken();
-
-#line 3375 "VBNET.ATG"
- m.Add(Modifiers.Abstract, t.Location);
- break;
- }
- case 89: {
- lexer.NextToken();
-
-#line 3376 "VBNET.ATG"
- m.Add(Modifiers.Default, t.Location);
- break;
- }
- case 112: {
- lexer.NextToken();
-
-#line 3377 "VBNET.ATG"
- m.Add(Modifiers.Internal, t.Location);
- break;
- }
- case 184: {
- lexer.NextToken();
-
-#line 3378 "VBNET.ATG"
- m.Add(Modifiers.New, t.Location);
- break;
- }
- case 166: {
- lexer.NextToken();
-
-#line 3379 "VBNET.ATG"
- m.Add(Modifiers.Override, t.Location);
- break;
- }
- case 143: {
- lexer.NextToken();
-
-#line 3380 "VBNET.ATG"
- m.Add(Modifiers.Abstract, t.Location);
- break;
- }
- case 170: {
- lexer.NextToken();
-
-#line 3381 "VBNET.ATG"
- m.Add(Modifiers.Private, t.Location);
- break;
- }
- case 172: {
- lexer.NextToken();
-
-#line 3382 "VBNET.ATG"
- m.Add(Modifiers.Protected, t.Location);
- break;
- }
- case 173: {
- lexer.NextToken();
-
-#line 3383 "VBNET.ATG"
- m.Add(Modifiers.Public, t.Location);
- break;
- }
- case 152: {
- lexer.NextToken();
-
-#line 3384 "VBNET.ATG"
- m.Add(Modifiers.Sealed, t.Location);
- break;
- }
- case 153: {
- lexer.NextToken();
-
-#line 3385 "VBNET.ATG"
- m.Add(Modifiers.Sealed, t.Location);
- break;
- }
- case 185: {
- lexer.NextToken();
-
-#line 3386 "VBNET.ATG"
- m.Add(Modifiers.Static, t.Location);
- break;
- }
- case 165: {
- lexer.NextToken();
-
-#line 3387 "VBNET.ATG"
- m.Add(Modifiers.Virtual, t.Location);
- break;
- }
- case 164: {
- lexer.NextToken();
-
-#line 3388 "VBNET.ATG"
- m.Add(Modifiers.Overloads, t.Location);
- break;
- }
- case 175: {
- lexer.NextToken();
-
-#line 3389 "VBNET.ATG"
- m.Add(Modifiers.ReadOnly, t.Location);
- break;
- }
- case 220: {
- lexer.NextToken();
-
-#line 3390 "VBNET.ATG"
- m.Add(Modifiers.WriteOnly, t.Location);
- break;
- }
- case 219: {
- lexer.NextToken();
-
-#line 3391 "VBNET.ATG"
- m.Add(Modifiers.WithEvents, t.Location);
- break;
- }
- case 92: {
- lexer.NextToken();
-
-#line 3392 "VBNET.ATG"
- m.Add(Modifiers.Dim, t.Location);
- break;
- }
- case 168: {
- lexer.NextToken();
-
-#line 3393 "VBNET.ATG"
- m.Add(Modifiers.Partial, t.Location);
- break;
- }
- default: SynErr(237); break;
- }
- }
-
- void ClassMemberDecl(
-#line 761 "VBNET.ATG"
-ModifierList m, List<AttributeSection> attributes) {
- StructureMemberDecl(
-#line 762 "VBNET.ATG"
-m, attributes);
- }
-
- void StructureMemberDecl(
-#line 775 "VBNET.ATG"
-ModifierList m, List<AttributeSection> attributes) {
-
-#line 777 "VBNET.ATG"
- TypeReference type = null;
- List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
- Statement stmt = null;
- List<VariableDeclaration> variableDeclarators = new List<VariableDeclaration>();
- List<TemplateDefinition> templates = new List<TemplateDefinition>();
-
- switch (la.kind) {
- case 71: case 90: case 102: case 129: case 141: case 194: {
- NonModuleDeclaration(
-#line 784 "VBNET.ATG"
-m, attributes);
- break;
- }
- case 195: {
- lexer.NextToken();
-
-#line 788 "VBNET.ATG"
- Location startPos = t.Location;
-
- if (StartOf(14)) {
-
-#line 792 "VBNET.ATG"
- string name = String.Empty;
- MethodDeclaration methodDeclaration; List<string> handlesClause = null;
- List<InterfaceImplementation> implementsClause = null;
-
- Identifier();
-
-#line 798 "VBNET.ATG"
- name = t.val;
- m.Check(Modifiers.VBMethods);
-
- TypeParameterList(
-#line 801 "VBNET.ATG"
-templates);
- if (la.kind == 25) {
- lexer.NextToken();
- if (StartOf(4)) {
- FormalParameterList(
-#line 802 "VBNET.ATG"
-p);
- }
- Expect(26);
- }
- if (la.kind == 121 || la.kind == 123) {
- if (la.kind == 123) {
- ImplementsClause(
-#line 805 "VBNET.ATG"
-out implementsClause);
- } else {
- HandlesClause(
-#line 807 "VBNET.ATG"
-out handlesClause);
- }
- }
-
-#line 810 "VBNET.ATG"
- Location endLocation = t.EndLocation;
- if (
-#line 813 "VBNET.ATG"
-IsMustOverride(m)) {
- EndOfStmt();
-
-#line 816 "VBNET.ATG"
- methodDeclaration = new MethodDeclaration {
- Name = name, Modifier = m.Modifier, Parameters = p, Attributes = attributes,
- StartLocation = m.GetDeclarationLocation(startPos), EndLocation = endLocation,
- TypeReference = new TypeReference("System.Void", true),
- Templates = templates,
- HandlesClause = handlesClause,
- InterfaceImplementations = implementsClause
- };
- compilationUnit.AddChild(methodDeclaration);
-
- } else if (la.kind == 1) {
- lexer.NextToken();
-
-#line 829 "VBNET.ATG"
- methodDeclaration = new MethodDeclaration {
- Name = name, Modifier = m.Modifier, Parameters = p, Attributes = attributes,
- StartLocation = m.GetDeclarationLocation(startPos), EndLocation = endLocation,
- TypeReference = new TypeReference("System.Void", true),
- Templates = templates,
- HandlesClause = handlesClause,
- InterfaceImplementations = implementsClause
- };
- compilationUnit.AddChild(methodDeclaration);
-
-
-#line 840 "VBNET.ATG"
- if (ParseMethodBodies) {
- Block(
-#line 841 "VBNET.ATG"
-out stmt);
- Expect(100);
- Expect(195);
-
-#line 843 "VBNET.ATG"
- } else {
- // don't parse method body
- lexer.SkipCurrentBlock(Tokens.Sub); stmt = new BlockStatement();
- }
-
-
-#line 849 "VBNET.ATG"
- methodDeclaration.Body = (BlockStatement)stmt;
-
-#line 850 "VBNET.ATG"
- methodDeclaration.Body.EndLocation = t.EndLocation;
- EndOfStmt();
- } else SynErr(238);
- } else if (la.kind == 148) {
- lexer.NextToken();
- if (la.kind == 25) {
- lexer.NextToken();
- if (StartOf(4)) {
- FormalParameterList(
-#line 854 "VBNET.ATG"
-p);
- }
- Expect(26);
- }
-
-#line 855 "VBNET.ATG"
- m.Check(Modifiers.Constructors);
-
-#line 856 "VBNET.ATG"
- Location constructorEndLocation = t.EndLocation;
- Expect(1);
-
-#line 859 "VBNET.ATG"
- if (ParseMethodBodies) {
- Block(
-#line 860 "VBNET.ATG"
-out stmt);
- Expect(100);
- Expect(195);
-
-#line 862 "VBNET.ATG"
- } else {
- // don't parse method body
- lexer.SkipCurrentBlock(Tokens.Sub); stmt = new BlockStatement();
- }
-
-
-#line 868 "VBNET.ATG"
- Location endLocation = t.EndLocation;
- EndOfStmt();
-
-#line 871 "VBNET.ATG"
- ConstructorDeclaration cd = new ConstructorDeclaration("New", m.Modifier, p, attributes);
- cd.StartLocation = m.GetDeclarationLocation(startPos);
- cd.EndLocation = constructorEndLocation;
- cd.Body = (BlockStatement)stmt;
- cd.Body.EndLocation = endLocation;
- compilationUnit.AddChild(cd);
-
- } else SynErr(239);
- break;
- }
- case 114: {
- lexer.NextToken();
-
-#line 883 "VBNET.ATG"
- m.Check(Modifiers.VBMethods);
- string name = String.Empty;
- Location startPos = t.Location;
- MethodDeclaration methodDeclaration;List<string> handlesClause = null;
- List<InterfaceImplementation> implementsClause = null;
- AttributeSection returnTypeAttributeSection = null;
-
- Identifier();
-
-#line 890 "VBNET.ATG"
- name = t.val;
- TypeParameterList(
-#line 891 "VBNET.ATG"
-templates);
- if (la.kind == 25) {
- lexer.NextToken();
- if (StartOf(4)) {
- FormalParameterList(
-#line 892 "VBNET.ATG"
-p);
- }
- Expect(26);
- }
- if (la.kind == 50) {
- lexer.NextToken();
- while (la.kind == 28) {
- AttributeSection(
-#line 893 "VBNET.ATG"
-out returnTypeAttributeSection);
- }
- TypeName(
-#line 893 "VBNET.ATG"
-out type);
- }
-
-#line 895 "VBNET.ATG"
- if(type == null) {
- type = new TypeReference("System.Object", true);
- }
-
- if (la.kind == 121 || la.kind == 123) {
- if (la.kind == 123) {
- ImplementsClause(
-#line 901 "VBNET.ATG"
-out implementsClause);
- } else {
- HandlesClause(
-#line 903 "VBNET.ATG"
-out handlesClause);
- }
- }
- if (
-#line 908 "VBNET.ATG"
-IsMustOverride(m)) {
- EndOfStmt();
-
-#line 911 "VBNET.ATG"
- methodDeclaration = new MethodDeclaration {
- Name = name, Modifier = m.Modifier, TypeReference = type,
- Parameters = p, Attributes = attributes,
- StartLocation = m.GetDeclarationLocation(startPos),
- EndLocation = t.EndLocation,
- HandlesClause = handlesClause,
- Templates = templates,
- InterfaceImplementations = implementsClause
- };
- if (returnTypeAttributeSection != null) {
- returnTypeAttributeSection.AttributeTarget = "return";
- methodDeclaration.Attributes.Add(returnTypeAttributeSection);
- }
- compilationUnit.AddChild(methodDeclaration);
-
- } else if (la.kind == 1) {
- lexer.NextToken();
-
-#line 929 "VBNET.ATG"
- methodDeclaration = new MethodDeclaration {
- Name = name, Modifier = m.Modifier, TypeReference = type,
- Parameters = p, Attributes = attributes,
- StartLocation = m.GetDeclarationLocation(startPos),
- EndLocation = t.EndLocation,
- Templates = templates,
- HandlesClause = handlesClause,
- InterfaceImplementations = implementsClause
- };
- if (returnTypeAttributeSection != null) {
- returnTypeAttributeSection.AttributeTarget = "return";
- methodDeclaration.Attributes.Add(returnTypeAttributeSection);
- }
-
- compilationUnit.AddChild(methodDeclaration);
-
- if (ParseMethodBodies) {
- Block(
-#line 946 "VBNET.ATG"
-out stmt);
- Expect(100);
- Expect(114);
-
-#line 948 "VBNET.ATG"
- } else {
- // don't parse method body
- lexer.SkipCurrentBlock(Tokens.Function); stmt = new BlockStatement();
- }
- methodDeclaration.Body = (BlockStatement)stmt;
- methodDeclaration.Body.StartLocation = methodDeclaration.EndLocation;
- methodDeclaration.Body.EndLocation = t.EndLocation;
-
- EndOfStmt();
- } else SynErr(240);
- break;
- }
- case 88: {
- lexer.NextToken();
-
-#line 962 "VBNET.ATG"
- m.Check(Modifiers.VBExternalMethods);
- Location startPos = t.Location;
- CharsetModifier charsetModifer = CharsetModifier.None;
- string library = String.Empty;
- string alias = null;
- string name = String.Empty;
-
- if (StartOf(15)) {
- Charset(
-#line 969 "VBNET.ATG"
-out charsetModifer);
- }
- if (la.kind == 195) {
- lexer.NextToken();
- Identifier();
-
-#line 972 "VBNET.ATG"
- name = t.val;
- Expect(135);
- Expect(3);
-
-#line 973 "VBNET.ATG"
- library = t.literalValue as string;
- if (la.kind == 46) {
- lexer.NextToken();
- Expect(3);
-
-#line 974 "VBNET.ATG"
- alias = t.literalValue as string;
- }
- if (la.kind == 25) {
- lexer.NextToken();
- if (StartOf(4)) {
- FormalParameterList(
-#line 975 "VBNET.ATG"
-p);
- }
- Expect(26);
- }
- EndOfStmt();
-
-#line 978 "VBNET.ATG"
- DeclareDeclaration declareDeclaration = new DeclareDeclaration(name, m.Modifier, null, p, attributes, library, alias, charsetModifer);
- declareDeclaration.StartLocation = m.GetDeclarationLocation(startPos);
- declareDeclaration.EndLocation = t.EndLocation;
- compilationUnit.AddChild(declareDeclaration);
-
- } else if (la.kind == 114) {
- lexer.NextToken();
- Identifier();
-
-#line 985 "VBNET.ATG"
- name = t.val;
- Expect(135);
- Expect(3);
-
-#line 986 "VBNET.ATG"
- library = t.literalValue as string;
- if (la.kind == 46) {
- lexer.NextToken();
- Expect(3);
-
-#line 987 "VBNET.ATG"
- alias = t.literalValue as string;
- }
- if (la.kind == 25) {
- lexer.NextToken();
- if (StartOf(4)) {
- FormalParameterList(
-#line 988 "VBNET.ATG"
-p);
- }
- Expect(26);
- }
- if (la.kind == 50) {
- lexer.NextToken();
- TypeName(
-#line 989 "VBNET.ATG"
-out type);
- }
- EndOfStmt();
-
-#line 992 "VBNET.ATG"
- DeclareDeclaration declareDeclaration = new DeclareDeclaration(name, m.Modifier, type, p, attributes, library, alias, charsetModifer);
- declareDeclaration.StartLocation = m.GetDeclarationLocation(startPos);
- declareDeclaration.EndLocation = t.EndLocation;
- compilationUnit.AddChild(declareDeclaration);
-
- } else SynErr(241);
- break;
- }
- case 106: {
- lexer.NextToken();
-
-#line 1002 "VBNET.ATG"
- m.Check(Modifiers.VBEvents);
- Location startPos = t.Location;
- EventDeclaration eventDeclaration;
- string name = String.Empty;
- List<InterfaceImplementation> implementsClause = null;
-
- Identifier();
-
-#line 1008 "VBNET.ATG"
- name= t.val;
- if (la.kind == 50) {
- lexer.NextToken();
- TypeName(
-#line 1010 "VBNET.ATG"
-out type);
- } else if (StartOf(16)) {
- if (la.kind == 25) {
- lexer.NextToken();
- if (StartOf(4)) {
- FormalParameterList(
-#line 1012 "VBNET.ATG"
-p);
- }
- Expect(26);
- }
- } else SynErr(242);
- if (la.kind == 123) {
- ImplementsClause(
-#line 1014 "VBNET.ATG"
-out implementsClause);
- }
-
-#line 1016 "VBNET.ATG"
- eventDeclaration = new EventDeclaration {
- Name = name, TypeReference = type, Modifier = m.Modifier,
- Parameters = p, Attributes = attributes, InterfaceImplementations = implementsClause,
- StartLocation = m.GetDeclarationLocation(startPos),
- EndLocation = t.EndLocation
- };
- compilationUnit.AddChild(eventDeclaration);
-
- EndOfStmt();
- break;
- }
- case 2: case 45: case 49: case 51: case 52: case 53: case 54: case 57: case 74: case 91: case 94: case 103: case 108: case 113: case 120: case 126: case 130: case 133: case 156: case 162: case 169: case 188: case 197: case 198: case 208: case 209: case 215: {
-
-#line 1026 "VBNET.ATG"
- Location startPos = t.Location;
-
-#line 1028 "VBNET.ATG"
- m.Check(Modifiers.Fields);
- FieldDeclaration fd = new FieldDeclaration(attributes, null, m.Modifier);
- fd.StartLocation = m.GetDeclarationLocation(startPos);
-
- IdentifierForFieldDeclaration();
-
-#line 1032 "VBNET.ATG"
- string name = t.val;
- VariableDeclaratorPartAfterIdentifier(
-#line 1033 "VBNET.ATG"
-variableDeclarators, name);
- while (la.kind == 12) {
- lexer.NextToken();
- VariableDeclarator(
-#line 1034 "VBNET.ATG"
-variableDeclarators);
- }
- EndOfStmt();
-
-#line 1037 "VBNET.ATG"
- fd.EndLocation = t.EndLocation;
- fd.Fields = variableDeclarators;
- compilationUnit.AddChild(fd);
-
- break;
- }
- case 75: {
-
-#line 1042 "VBNET.ATG"
- m.Check(Modifiers.Fields);
- lexer.NextToken();
-
-#line 1043 "VBNET.ATG"
- m.Add(Modifiers.Const, t.Location);
-
-#line 1045 "VBNET.ATG"
- FieldDeclaration fd = new FieldDeclaration(attributes, type, m.Modifier);
- fd.StartLocation = m.GetDeclarationLocation(t.Location);
- List<VariableDeclaration> constantDeclarators = new List<VariableDeclaration>();
-
- ConstantDeclarator(
-#line 1049 "VBNET.ATG"
-constantDeclarators);
- while (la.kind == 12) {
- lexer.NextToken();
- ConstantDeclarator(
-#line 1050 "VBNET.ATG"
-constantDeclarators);
- }
-
-#line 1052 "VBNET.ATG"
- fd.Fields = constantDeclarators;
- fd.EndLocation = t.Location;
-
- EndOfStmt();
-
-#line 1057 "VBNET.ATG"
- fd.EndLocation = t.EndLocation;
- compilationUnit.AddChild(fd);
-
- break;
- }
- case 171: {
- lexer.NextToken();
-
-#line 1063 "VBNET.ATG"
- m.Check(Modifiers.VBProperties);
- Location startPos = t.Location;
- List<InterfaceImplementation> implementsClause = null;
-
- Identifier();
-
-#line 1067 "VBNET.ATG"
- string propertyName = t.val;
- if (la.kind == 25) {
- lexer.NextToken();
- if (StartOf(4)) {
- FormalParameterList(
-#line 1068 "VBNET.ATG"
-p);
- }
- Expect(26);
- }
- if (la.kind == 50) {
- lexer.NextToken();
- TypeName(
-#line 1069 "VBNET.ATG"
-out type);
- }
-
-#line 1071 "VBNET.ATG"
- if(type == null) {
- type = new TypeReference("System.Object", true);
- }
-
- if (la.kind == 123) {
- ImplementsClause(
-#line 1075 "VBNET.ATG"
-out implementsClause);
- }
- EndOfStmt();
- if (
-#line 1079 "VBNET.ATG"
-IsMustOverride(m)) {
-
-#line 1081 "VBNET.ATG"
- PropertyDeclaration pDecl = new PropertyDeclaration(propertyName, type, m.Modifier, attributes);
- pDecl.StartLocation = m.GetDeclarationLocation(startPos);
- pDecl.EndLocation = t.Location;
- pDecl.TypeReference = type;
- pDecl.InterfaceImplementations = implementsClause;
- pDecl.Parameters = p;
- compilationUnit.AddChild(pDecl);
-
- } else if (StartOf(17)) {
-
-#line 1091 "VBNET.ATG"
- PropertyDeclaration pDecl = new PropertyDeclaration(propertyName, type, m.Modifier, attributes);
- pDecl.StartLocation = m.GetDeclarationLocation(startPos);
- pDecl.EndLocation = t.Location;
- pDecl.BodyStart = t.Location;
- pDecl.TypeReference = type;
- pDecl.InterfaceImplementations = implementsClause;
- pDecl.Parameters = p;
- PropertyGetRegion getRegion;
- PropertySetRegion setRegion;
-
- AccessorDecls(
-#line 1101 "VBNET.ATG"
-out getRegion, out setRegion);
- Expect(100);
- Expect(171);
- EndOfStmt();
-
-#line 1105 "VBNET.ATG"
- pDecl.GetRegion = getRegion;
- pDecl.SetRegion = setRegion;
- pDecl.BodyEnd = t.EndLocation;
- compilationUnit.AddChild(pDecl);
-
- } else SynErr(243);
- break;
- }
- case 85: {
- lexer.NextToken();
-
-#line 1112 "VBNET.ATG"
- Location startPos = t.Location;
- Expect(106);
-
-#line 1114 "VBNET.ATG"
- m.Check(Modifiers.VBCustomEvents);
- EventAddRemoveRegion eventAccessorDeclaration;
- EventAddRegion addHandlerAccessorDeclaration = null;
- EventRemoveRegion removeHandlerAccessorDeclaration = null;
- EventRaiseRegion raiseEventAccessorDeclaration = null;
- List<InterfaceImplementation> implementsClause = null;
-
- Identifier();
-
-#line 1121 "VBNET.ATG"
- string customEventName = t.val;
- Expect(50);
- TypeName(
-#line 1122 "VBNET.ATG"
-out type);
- if (la.kind == 123) {
- ImplementsClause(
-#line 1123 "VBNET.ATG"
-out implementsClause);
- }
- EndOfStmt();
- while (StartOf(18)) {
- EventAccessorDeclaration(
-#line 1126 "VBNET.ATG"
-out eventAccessorDeclaration);
-
-#line 1128 "VBNET.ATG"
- if(eventAccessorDeclaration is EventAddRegion)
- {
- addHandlerAccessorDeclaration = (EventAddRegion)eventAccessorDeclaration;
- }
- else if(eventAccessorDeclaration is EventRemoveRegion)
- {
- removeHandlerAccessorDeclaration = (EventRemoveRegion)eventAccessorDeclaration;
- }
- else if(eventAccessorDeclaration is EventRaiseRegion)
- {
- raiseEventAccessorDeclaration = (EventRaiseRegion)eventAccessorDeclaration;
- }
-
- }
- Expect(100);
- Expect(106);
- EndOfStmt();
-
-#line 1144 "VBNET.ATG"
- if(addHandlerAccessorDeclaration == null)
- {
- Error("Need to provide AddHandler accessor.");
- }
-
- if(removeHandlerAccessorDeclaration == null)
- {
- Error("Need to provide RemoveHandler accessor.");
- }
-
- if(raiseEventAccessorDeclaration == null)
- {
- Error("Need to provide RaiseEvent accessor.");
- }
-
- EventDeclaration decl = new EventDeclaration {
- TypeReference = type, Name = customEventName, Modifier = m.Modifier,
- Attributes = attributes,
- StartLocation = m.GetDeclarationLocation(startPos),
- EndLocation = t.EndLocation,
- AddRegion = addHandlerAccessorDeclaration,
- RemoveRegion = removeHandlerAccessorDeclaration,
- RaiseRegion = raiseEventAccessorDeclaration
- };
- compilationUnit.AddChild(decl);
-
- break;
- }
- case 147: case 158: case 217: {
-
-#line 1170 "VBNET.ATG"
- ConversionType opConversionType = ConversionType.None;
- if (la.kind == 147 || la.kind == 217) {
- if (la.kind == 217) {
- lexer.NextToken();
-
-#line 1171 "VBNET.ATG"
- opConversionType = ConversionType.Implicit;
- } else {
- lexer.NextToken();
-
-#line 1172 "VBNET.ATG"
- opConversionType = ConversionType.Explicit;
- }
- }
- Expect(158);
-
-#line 1175 "VBNET.ATG"
- m.Check(Modifiers.VBOperators);
- Location startPos = t.Location;
- TypeReference returnType = NullTypeReference.Instance;
- TypeReference operandType = NullTypeReference.Instance;
- string operandName;
- OverloadableOperatorType operatorType;
- AttributeSection section;
- List<ParameterDeclarationExpression> parameters = new List<ParameterDeclarationExpression>();
- List<AttributeSection> returnTypeAttributes = new List<AttributeSection>();
-
- OverloadableOperator(
-#line 1185 "VBNET.ATG"
-out operatorType);
- Expect(25);
- if (la.kind == 59) {
- lexer.NextToken();
- }
- Identifier();
-
-#line 1186 "VBNET.ATG"
- operandName = t.val;
- if (la.kind == 50) {
- lexer.NextToken();
- TypeName(
-#line 1187 "VBNET.ATG"
-out operandType);
- }
-
-#line 1188 "VBNET.ATG"
- parameters.Add(new ParameterDeclarationExpression(operandType, operandName, ParameterModifiers.In));
- while (la.kind == 12) {
- lexer.NextToken();
- if (la.kind == 59) {
- lexer.NextToken();
- }
- Identifier();
-
-#line 1192 "VBNET.ATG"
- operandName = t.val;
- if (la.kind == 50) {
- lexer.NextToken();
- TypeName(
-#line 1193 "VBNET.ATG"
-out operandType);
- }
-
-#line 1194 "VBNET.ATG"
- parameters.Add(new ParameterDeclarationExpression(operandType, operandName, ParameterModifiers.In));
- }
- Expect(26);
-
-#line 1197 "VBNET.ATG"
- Location endPos = t.EndLocation;
- if (la.kind == 50) {
- lexer.NextToken();
- while (la.kind == 28) {
- AttributeSection(
-#line 1198 "VBNET.ATG"
-out section);
-
-#line 1198 "VBNET.ATG"
- returnTypeAttributes.Add(section);
- }
- TypeName(
-#line 1198 "VBNET.ATG"
-out returnType);
-
-#line 1198 "VBNET.ATG"
- endPos = t.EndLocation;
- }
- Expect(1);
- Block(
-#line 1200 "VBNET.ATG"
-out stmt);
- Expect(100);
- Expect(158);
- EndOfStmt();
-
-#line 1202 "VBNET.ATG"
- OperatorDeclaration operatorDeclaration = new OperatorDeclaration {
- Modifier = m.Modifier,
- Attributes = attributes,
- Parameters = parameters,
- TypeReference = returnType,
- OverloadableOperator = operatorType,
- ConversionType = opConversionType,
- ReturnTypeAttributes = returnTypeAttributes,
- Body = (BlockStatement)stmt,
- StartLocation = m.GetDeclarationLocation(startPos),
- EndLocation = endPos
- };
- operatorDeclaration.Body.StartLocation = startPos;
- operatorDeclaration.Body.EndLocation = t.Location;
- compilationUnit.AddChild(operatorDeclaration);
-
- break;
- }
- default: SynErr(244); break;
- }
- }
-
- void EnumMemberDecl(
-#line 743 "VBNET.ATG"
-out FieldDeclaration f) {
-
-#line 745 "VBNET.ATG"
- Expression expr = null;List<AttributeSection> attributes = new List<AttributeSection>();
- AttributeSection section = null;
- VariableDeclaration varDecl = null;
-
- while (la.kind == 28) {
- AttributeSection(
-#line 749 "VBNET.ATG"
-out section);
-
-#line 749 "VBNET.ATG"
- attributes.Add(section);
- }
- Identifier();
-
-#line 752 "VBNET.ATG"
- f = new FieldDeclaration(attributes);
- varDecl = new VariableDeclaration(t.val);
- f.Fields.Add(varDecl);
- f.StartLocation = varDecl.StartLocation = t.Location;
-
- if (la.kind == 10) {
- lexer.NextToken();
- Expr(
-#line 757 "VBNET.ATG"
-out expr);
-
-#line 757 "VBNET.ATG"
- varDecl.Initializer = expr;
- }
- EndOfStmt();
- }
-
- void InterfaceMemberDecl() {
-
-#line 634 "VBNET.ATG"
- TypeReference type =null;
- List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
- List<TemplateDefinition> templates = new List<TemplateDefinition>();
- AttributeSection section, returnTypeAttributeSection = null;
- ModifierList mod = new ModifierList();
- List<AttributeSection> attributes = new List<AttributeSection>();
- string name;
-
- if (StartOf(19)) {
- while (la.kind == 28) {
- AttributeSection(
-#line 642 "VBNET.ATG"
-out section);
-
-#line 642 "VBNET.ATG"
- attributes.Add(section);
- }
- while (StartOf(9)) {
- MemberModifier(
-#line 645 "VBNET.ATG"
-mod);
- }
- if (la.kind == 106) {
- lexer.NextToken();
-
-#line 649 "VBNET.ATG"
- mod.Check(Modifiers.VBInterfaceEvents);
- Location startLocation = t.Location;
-
- Identifier();
-
-#line 652 "VBNET.ATG"
- name = t.val;
- if (la.kind == 25) {
- lexer.NextToken();
- if (StartOf(4)) {
- FormalParameterList(
-#line 653 "VBNET.ATG"
-p);
- }
- Expect(26);
- }
- if (la.kind == 50) {
- lexer.NextToken();
- TypeName(
-#line 654 "VBNET.ATG"
-out type);
- }
- EndOfStmt();
-
-#line 657 "VBNET.ATG"
- EventDeclaration ed = new EventDeclaration {
- Name = name, TypeReference = type, Modifier = mod.Modifier,
- Parameters = p, Attributes = attributes,
- StartLocation = startLocation, EndLocation = t.EndLocation
- };
- compilationUnit.AddChild(ed);
-
- } else if (la.kind == 195) {
- lexer.NextToken();
-
-#line 667 "VBNET.ATG"
- Location startLocation = t.Location;
- mod.Check(Modifiers.VBInterfaceMethods);
-
- Identifier();
-
-#line 670 "VBNET.ATG"
- name = t.val;
- TypeParameterList(
-#line 671 "VBNET.ATG"
-templates);
- if (la.kind == 25) {
- lexer.NextToken();
- if (StartOf(4)) {
- FormalParameterList(
-#line 672 "VBNET.ATG"
-p);
- }
- Expect(26);
- }
- EndOfStmt();
-
-#line 675 "VBNET.ATG"
- MethodDeclaration md = new MethodDeclaration {
- Name = name,
- Modifier = mod.Modifier,
- Parameters = p,
- Attributes = attributes,
- TypeReference = new TypeReference("System.Void", true),
- StartLocation = startLocation,
- EndLocation = t.EndLocation,
- Templates = templates
- };
- compilationUnit.AddChild(md);
-
- } else if (la.kind == 114) {
- lexer.NextToken();
-
-#line 690 "VBNET.ATG"
- mod.Check(Modifiers.VBInterfaceMethods);
- Location startLocation = t.Location;
-
- Identifier();
-
-#line 693 "VBNET.ATG"
- name = t.val;
- TypeParameterList(
-#line 694 "VBNET.ATG"
-templates);
- if (la.kind == 25) {
- lexer.NextToken();
- if (StartOf(4)) {
- FormalParameterList(
-#line 695 "VBNET.ATG"
-p);
- }
- Expect(26);
- }
- if (la.kind == 50) {
- lexer.NextToken();
- while (la.kind == 28) {
- AttributeSection(
-#line 696 "VBNET.ATG"
-out returnTypeAttributeSection);
- }
- TypeName(
-#line 696 "VBNET.ATG"
-out type);
- }
-
-#line 698 "VBNET.ATG"
- if(type == null) {
- type = new TypeReference("System.Object", true);
- }
- MethodDeclaration md = new MethodDeclaration {
- Name = name, Modifier = mod.Modifier,
- TypeReference = type, Parameters = p, Attributes = attributes
- };
- if (returnTypeAttributeSection != null) {
- returnTypeAttributeSection.AttributeTarget = "return";
- md.Attributes.Add(returnTypeAttributeSection);
- }
- md.StartLocation = startLocation;
- md.EndLocation = t.EndLocation;
- md.Templates = templates;
- compilationUnit.AddChild(md);
-
- EndOfStmt();
- } else if (la.kind == 171) {
- lexer.NextToken();
-
-#line 718 "VBNET.ATG"
- Location startLocation = t.Location;
- mod.Check(Modifiers.VBInterfaceProperties);
-
- Identifier();
-
-#line 721 "VBNET.ATG"
- name = t.val;
- if (la.kind == 25) {
- lexer.NextToken();
- if (StartOf(4)) {
- FormalParameterList(
-#line 722 "VBNET.ATG"
-p);
- }
- Expect(26);
- }
- if (la.kind == 50) {
- lexer.NextToken();
- TypeName(
-#line 723 "VBNET.ATG"
-out type);
- }
-
-#line 725 "VBNET.ATG"
- if(type == null) {
- type = new TypeReference("System.Object", true);
- }
-
- EndOfStmt();
-
-#line 731 "VBNET.ATG"
- PropertyDeclaration pd = new PropertyDeclaration(name, type, mod.Modifier, attributes);
- pd.Parameters = p;
- pd.EndLocation = t.EndLocation;
- pd.StartLocation = startLocation;
- compilationUnit.AddChild(pd);
-
- } else SynErr(245);
- } else if (StartOf(20)) {
- NonModuleDeclaration(
-#line 739 "VBNET.ATG"
-mod, attributes);
- } else SynErr(246);
- }
-
- void Expr(
-#line 1607 "VBNET.ATG"
-out Expression expr) {
-
-#line 1608 "VBNET.ATG"
- expr = null;
- if (
-#line 1609 "VBNET.ATG"
-IsQueryExpression() ) {
- QueryExpr(
-#line 1610 "VBNET.ATG"
-out expr);
- } else if (la.kind == 114) {
- LambdaExpr(
-#line 1611 "VBNET.ATG"
-out expr);
- } else if (StartOf(21)) {
- DisjunctionExpr(
-#line 1612 "VBNET.ATG"
-out expr);
- } else SynErr(247);
- }
-
- void ImplementsClause(
-#line 1580 "VBNET.ATG"
-out List<InterfaceImplementation> baseInterfaces) {
-
-#line 1582 "VBNET.ATG"
- baseInterfaces = new List<InterfaceImplementation>();
- TypeReference type = null;
- string memberName = null;
-
- Expect(123);
- NonArrayTypeName(
-#line 1587 "VBNET.ATG"
-out type, false);
-
-#line 1588 "VBNET.ATG"
- if (type != null) memberName = TypeReference.StripLastIdentifierFromType(ref type);
-
-#line 1589 "VBNET.ATG"
- baseInterfaces.Add(new InterfaceImplementation(type, memberName));
- while (la.kind == 12) {
- lexer.NextToken();
- NonArrayTypeName(
-#line 1591 "VBNET.ATG"
-out type, false);
-
-#line 1592 "VBNET.ATG"
- if (type != null) memberName = TypeReference.StripLastIdentifierFromType(ref type);
-
-#line 1593 "VBNET.ATG"
- baseInterfaces.Add(new InterfaceImplementation(type, memberName));
- }
- }
-
- void HandlesClause(
-#line 1538 "VBNET.ATG"
-out List<string> handlesClause) {
-
-#line 1540 "VBNET.ATG"
- handlesClause = new List<string>();
- string name;
-
- Expect(121);
- EventMemberSpecifier(
-#line 1543 "VBNET.ATG"
-out name);
-
-#line 1543 "VBNET.ATG"
- if (name != null) handlesClause.Add(name);
- while (la.kind == 12) {
- lexer.NextToken();
- EventMemberSpecifier(
-#line 1544 "VBNET.ATG"
-out name);
-
-#line 1544 "VBNET.ATG"
- if (name != null) handlesClause.Add(name);
- }
- }
-
- void Block(
-#line 2680 "VBNET.ATG"
-out Statement stmt) {
-
-#line 2683 "VBNET.ATG"
- BlockStatement blockStmt = new BlockStatement();
- /* in snippet parsing mode, t might be null */
- if (t != null) blockStmt.StartLocation = t.EndLocation;
- compilationUnit.BlockStart(blockStmt);
-
- while (StartOf(22) ||
-#line 2689 "VBNET.ATG"
-IsEndStmtAhead()) {
- if (
-#line 2689 "VBNET.ATG"
-IsEndStmtAhead()) {
- Expect(100);
- EndOfStmt();
-
-#line 2689 "VBNET.ATG"
- compilationUnit.AddChild(new EndStatement());
- } else {
- Statement();
- EndOfStmt();
- }
- }
-
-#line 2694 "VBNET.ATG"
- stmt = blockStmt;
- if (t != null) blockStmt.EndLocation = t.EndLocation;
- compilationUnit.BlockEnd();
-
- }
-
- void Charset(
-#line 1530 "VBNET.ATG"
-out CharsetModifier charsetModifier) {
-
-#line 1531 "VBNET.ATG"
- charsetModifier = CharsetModifier.None;
- if (la.kind == 114 || la.kind == 195) {
- } else if (la.kind == 49) {
- lexer.NextToken();
-
-#line 1532 "VBNET.ATG"
- charsetModifier = CharsetModifier.Ansi;
- } else if (la.kind == 53) {
- lexer.NextToken();
-
-#line 1533 "VBNET.ATG"
- charsetModifier = CharsetModifier.Auto;
- } else if (la.kind == 208) {
- lexer.NextToken();
-
-#line 1534 "VBNET.ATG"
- charsetModifier = CharsetModifier.Unicode;
- } else SynErr(248);
- }
-
- void IdentifierForFieldDeclaration() {
- switch (la.kind) {
- case 2: {
- lexer.NextToken();
- break;
- }
- case 45: {
- lexer.NextToken();
- break;
- }
- case 49: {
- lexer.NextToken();
- break;
- }
- case 51: {
- lexer.NextToken();
- break;
- }
- case 52: {
- lexer.NextToken();
- break;
- }
- case 53: {
- lexer.NextToken();
- break;
- }
- case 54: {
- lexer.NextToken();
- break;
- }
- case 57: {
- lexer.NextToken();
- break;
- }
- case 74: {
- lexer.NextToken();
- break;
- }
- case 91: {
- lexer.NextToken();
- break;
- }
- case 94: {
- lexer.NextToken();
- break;
- }
- case 103: {
- lexer.NextToken();
- break;
- }
- case 108: {
- lexer.NextToken();
- break;
- }
- case 113: {
- lexer.NextToken();
- break;
- }
- case 120: {
- lexer.NextToken();
- break;
- }
- case 126: {
- lexer.NextToken();
- break;
- }
- case 130: {
- lexer.NextToken();
- break;
- }
- case 133: {
- lexer.NextToken();
- break;
- }
- case 156: {
- lexer.NextToken();
- break;
- }
- case 162: {
- lexer.NextToken();
- break;
- }
- case 169: {
- lexer.NextToken();
- break;
- }
- case 188: {
- lexer.NextToken();
- break;
- }
- case 197: {
- lexer.NextToken();
- break;
- }
- case 198: {
- lexer.NextToken();
- break;
- }
- case 208: {
- lexer.NextToken();
- break;
- }
- case 209: {
- lexer.NextToken();
- break;
- }
- case 215: {
- lexer.NextToken();
- break;
- }
- default: SynErr(249); break;
- }
- }
-
- void VariableDeclaratorPartAfterIdentifier(
-#line 1406 "VBNET.ATG"
-List<VariableDeclaration> fieldDeclaration, string name) {
-
-#line 1408 "VBNET.ATG"
- Expression expr = null;
- TypeReference type = null;
- ArrayList rank = null;
- List<Expression> dimension = null;
- Location startLocation = t.Location;
-
- if (
-#line 1414 "VBNET.ATG"
-IsSize() && !IsDims()) {
- ArrayInitializationModifier(
-#line 1414 "VBNET.ATG"
-out dimension);
- }
- if (
-#line 1415 "VBNET.ATG"
-IsDims()) {
- ArrayNameModifier(
-#line 1415 "VBNET.ATG"
-out rank);
- }
- if (
-#line 1417 "VBNET.ATG"
-IsObjectCreation()) {
- Expect(50);
- ObjectCreateExpression(
-#line 1417 "VBNET.ATG"
-out expr);
-
-#line 1419 "VBNET.ATG"
- if (expr is ObjectCreateExpression) {
- type = ((ObjectCreateExpression)expr).CreateType.Clone();
- } else {
- type = ((ArrayCreateExpression)expr).CreateType.Clone();
- }
-
- } else if (StartOf(23)) {
- if (la.kind == 50) {
- lexer.NextToken();
- TypeName(
-#line 1426 "VBNET.ATG"
-out type);
-
-#line 1428 "VBNET.ATG"
- if (type != null) {
- for (int i = fieldDeclaration.Count - 1; i >= 0; i--) {
- VariableDeclaration vd = fieldDeclaration[i];
- if (vd.TypeReference.Type.Length > 0) break;
- TypeReference newType = type.Clone();
- newType.RankSpecifier = vd.TypeReference.RankSpecifier;
- vd.TypeReference = newType;
- }
- }
-
- }
-
-#line 1440 "VBNET.ATG"
- if (type == null && (dimension != null || rank != null)) {
- type = new TypeReference("");
- }
- if (dimension != null) {
- if(type.RankSpecifier != null) {
- Error("array rank only allowed one time");
- } else {
- if (rank == null) {
- type.RankSpecifier = new int[] { dimension.Count - 1 };
- } else {
- rank.Insert(0, dimension.Count - 1);
- type.RankSpecifier = (int[])rank.ToArray(typeof(int));
- }
- expr = new ArrayCreateExpression(type.Clone(), dimension);
- }
- } else if (rank != null) {
- if(type.RankSpecifier != null) {
- Error("array rank only allowed one time");
- } else {
- type.RankSpecifier = (int[])rank.ToArray(typeof(int));
- }
- }
-
- if (la.kind == 10) {
- lexer.NextToken();
- VariableInitializer(
-#line 1463 "VBNET.ATG"
-out expr);
- }
- } else SynErr(250);
-
-#line 1466 "VBNET.ATG"
- VariableDeclaration varDecl = new VariableDeclaration(name, expr, type);
- varDecl.StartLocation = startLocation;
- varDecl.EndLocation = t.Location;
- fieldDeclaration.Add(varDecl);
-
- }
-
- void VariableDeclarator(
-#line 1400 "VBNET.ATG"
-List<VariableDeclaration> fieldDeclaration) {
- Identifier();
-
-#line 1402 "VBNET.ATG"
- string name = t.val;
- VariableDeclaratorPartAfterIdentifier(
-#line 1403 "VBNET.ATG"
-fieldDeclaration, name);
- }
-
- void ConstantDeclarator(
-#line 1381 "VBNET.ATG"
-List<VariableDeclaration> constantDeclaration) {
-
-#line 1383 "VBNET.ATG"
- Expression expr = null;
- TypeReference type = null;
- string name = String.Empty;
- Location location;
-
- Identifier();
-
-#line 1388 "VBNET.ATG"
- name = t.val; location = t.Location;
- if (la.kind == 50) {
- lexer.NextToken();
- TypeName(
-#line 1389 "VBNET.ATG"
-out type);
- }
- Expect(10);
- Expr(
-#line 1390 "VBNET.ATG"
-out expr);
-
-#line 1392 "VBNET.ATG"
- VariableDeclaration f = new VariableDeclaration(name, expr);
- f.TypeReference = type;
- f.StartLocation = location;
- constantDeclaration.Add(f);
-
- }
-
- void AccessorDecls(
-#line 1315 "VBNET.ATG"
-out PropertyGetRegion getBlock, out PropertySetRegion setBlock) {
-
-#line 1317 "VBNET.ATG"
- List<AttributeSection> attributes = new List<AttributeSection>();
- AttributeSection section;
- getBlock = null;
- setBlock = null;
-
- while (la.kind == 28) {
- AttributeSection(
-#line 1322 "VBNET.ATG"
-out section);
-
-#line 1322 "VBNET.ATG"
- attributes.Add(section);
- }
- if (StartOf(24)) {
- GetAccessorDecl(
-#line 1324 "VBNET.ATG"
-out getBlock, attributes);
- if (StartOf(25)) {
-
-#line 1326 "VBNET.ATG"
- attributes = new List<AttributeSection>();
- while (la.kind == 28) {
- AttributeSection(
-#line 1327 "VBNET.ATG"
-out section);
-
-#line 1327 "VBNET.ATG"
- attributes.Add(section);
- }
- SetAccessorDecl(
-#line 1328 "VBNET.ATG"
-out setBlock, attributes);
- }
- } else if (StartOf(26)) {
- SetAccessorDecl(
-#line 1331 "VBNET.ATG"
-out setBlock, attributes);
- if (StartOf(27)) {
-
-#line 1333 "VBNET.ATG"
- attributes = new List<AttributeSection>();
- while (la.kind == 28) {
- AttributeSection(
-#line 1334 "VBNET.ATG"
-out section);
-
-#line 1334 "VBNET.ATG"
- attributes.Add(section);
- }
- GetAccessorDecl(
-#line 1335 "VBNET.ATG"
-out getBlock, attributes);
- }
- } else SynErr(251);
- }
-
- void EventAccessorDeclaration(
-#line 1278 "VBNET.ATG"
-out EventAddRemoveRegion eventAccessorDeclaration) {
-
-#line 1280 "VBNET.ATG"
- Statement stmt = null;
- List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
- AttributeSection section;
- List<AttributeSection> attributes = new List<AttributeSection>();
- eventAccessorDeclaration = null;
-
- while (la.kind == 28) {
- AttributeSection(
-#line 1286 "VBNET.ATG"
-out section);
-
-#line 1286 "VBNET.ATG"
- attributes.Add(section);
- }
- if (la.kind == 43) {
- lexer.NextToken();
- if (la.kind == 25) {
- lexer.NextToken();
- if (StartOf(4)) {
- FormalParameterList(
-#line 1288 "VBNET.ATG"
-p);
- }
- Expect(26);
- }
- Expect(1);
- Block(
-#line 1289 "VBNET.ATG"
-out stmt);
- Expect(100);
- Expect(43);
- EndOfStmt();
-
-#line 1291 "VBNET.ATG"
- eventAccessorDeclaration = new EventAddRegion(attributes);
- eventAccessorDeclaration.Block = (BlockStatement)stmt;
- eventAccessorDeclaration.Parameters = p;
-
- } else if (la.kind == 178) {
- lexer.NextToken();
- if (la.kind == 25) {
- lexer.NextToken();
- if (StartOf(4)) {
- FormalParameterList(
-#line 1296 "VBNET.ATG"
-p);
- }
- Expect(26);
- }
- Expect(1);
- Block(
-#line 1297 "VBNET.ATG"
-out stmt);
- Expect(100);
- Expect(178);
- EndOfStmt();
-
-#line 1299 "VBNET.ATG"
- eventAccessorDeclaration = new EventRemoveRegion(attributes);
- eventAccessorDeclaration.Block = (BlockStatement)stmt;
- eventAccessorDeclaration.Parameters = p;
-
- } else if (la.kind == 174) {
- lexer.NextToken();
- if (la.kind == 25) {
- lexer.NextToken();
- if (StartOf(4)) {
- FormalParameterList(
-#line 1304 "VBNET.ATG"
-p);
- }
- Expect(26);
- }
- Expect(1);
- Block(
-#line 1305 "VBNET.ATG"
-out stmt);
- Expect(100);
- Expect(174);
- EndOfStmt();
-
-#line 1307 "VBNET.ATG"
- eventAccessorDeclaration = new EventRaiseRegion(attributes);
- eventAccessorDeclaration.Block = (BlockStatement)stmt;
- eventAccessorDeclaration.Parameters = p;
-
- } else SynErr(252);
- }
-
- void OverloadableOperator(
-#line 1220 "VBNET.ATG"
-out OverloadableOperatorType operatorType) {
-
-#line 1221 "VBNET.ATG"
- operatorType = OverloadableOperatorType.None;
- switch (la.kind) {
- case 19: {
- lexer.NextToken();
-
-#line 1223 "VBNET.ATG"
- operatorType = OverloadableOperatorType.Add;
- break;
- }
- case 18: {
- lexer.NextToken();
-
-#line 1225 "VBNET.ATG"
- operatorType = OverloadableOperatorType.Subtract;
- break;
- }
- case 22: {
- lexer.NextToken();
-
-#line 1227 "VBNET.ATG"
- operatorType = OverloadableOperatorType.Multiply;
- break;
- }
- case 14: {
- lexer.NextToken();
-
-#line 1229 "VBNET.ATG"
- operatorType = OverloadableOperatorType.Divide;
- break;
- }
- case 15: {
- lexer.NextToken();
-
-#line 1231 "VBNET.ATG"
- operatorType = OverloadableOperatorType.DivideInteger;
- break;
- }
- case 13: {
- lexer.NextToken();
-
-#line 1233 "VBNET.ATG"
- operatorType = OverloadableOperatorType.Concat;
- break;
- }
- case 136: {
- lexer.NextToken();
-
-#line 1235 "VBNET.ATG"
- operatorType = OverloadableOperatorType.Like;
- break;
- }
- case 140: {
- lexer.NextToken();
-
-#line 1237 "VBNET.ATG"
- operatorType = OverloadableOperatorType.Modulus;
- break;
- }
- case 47: {
- lexer.NextToken();
-
-#line 1239 "VBNET.ATG"
- operatorType = OverloadableOperatorType.BitwiseAnd;
- break;
- }
- case 161: {
- lexer.NextToken();
-
-#line 1241 "VBNET.ATG"
- operatorType = OverloadableOperatorType.BitwiseOr;
- break;
- }
- case 221: {
- lexer.NextToken();
-
-#line 1243 "VBNET.ATG"
- operatorType = OverloadableOperatorType.ExclusiveOr;
- break;
- }
- case 20: {
- lexer.NextToken();
-
-#line 1245 "VBNET.ATG"
- operatorType = OverloadableOperatorType.Power;
- break;
- }
- case 32: {
- lexer.NextToken();
-
-#line 1247 "VBNET.ATG"
- operatorType = OverloadableOperatorType.ShiftLeft;
- break;
- }
- case 33: {
- lexer.NextToken();
-
-#line 1249 "VBNET.ATG"
- operatorType = OverloadableOperatorType.ShiftRight;
- break;
- }
- case 10: {
- lexer.NextToken();
-
-#line 1251 "VBNET.ATG"
- operatorType = OverloadableOperatorType.Equality;
- break;
- }
- case 29: {
- lexer.NextToken();
-
-#line 1253 "VBNET.ATG"
- operatorType = OverloadableOperatorType.InEquality;
- break;
- }
- case 28: {
- lexer.NextToken();
-
-#line 1255 "VBNET.ATG"
- operatorType = OverloadableOperatorType.LessThan;
- break;
- }
- case 31: {
- lexer.NextToken();
-
-#line 1257 "VBNET.ATG"
- operatorType = OverloadableOperatorType.LessThanOrEqual;
- break;
- }
- case 27: {
- lexer.NextToken();
-
-#line 1259 "VBNET.ATG"
- operatorType = OverloadableOperatorType.GreaterThan;
- break;
- }
- case 30: {
- lexer.NextToken();
-
-#line 1261 "VBNET.ATG"
- operatorType = OverloadableOperatorType.GreaterThanOrEqual;
- break;
- }
- case 81: {
- lexer.NextToken();
-
-#line 1263 "VBNET.ATG"
- operatorType = OverloadableOperatorType.CType;
- break;
- }
- case 2: case 45: case 49: case 51: case 52: case 53: case 54: case 57: case 74: case 85: case 91: case 94: case 103: case 108: case 113: case 120: case 126: case 130: case 133: case 156: case 162: case 169: case 188: case 197: case 198: case 208: case 209: case 215: {
- Identifier();
-
-#line 1267 "VBNET.ATG"
- string opName = t.val;
- if (string.Equals(opName, "istrue", StringComparison.InvariantCultureIgnoreCase)) {
- operatorType = OverloadableOperatorType.IsTrue;
- } else if (string.Equals(opName, "isfalse", StringComparison.InvariantCultureIgnoreCase)) {
- operatorType = OverloadableOperatorType.IsFalse;
- } else {
- Error("Invalid operator. Possible operators are '+', '-', 'Not', 'IsTrue', 'IsFalse'.");
- }
-
- break;
- }
- default: SynErr(253); break;
- }
- }
-
- void GetAccessorDecl(
-#line 1341 "VBNET.ATG"
-out PropertyGetRegion getBlock, List<AttributeSection> attributes) {
-
-#line 1342 "VBNET.ATG"
- Statement stmt = null; Modifiers m;
- PropertyAccessorAccessModifier(
-#line 1344 "VBNET.ATG"
-out m);
- Expect(115);
-
-#line 1346 "VBNET.ATG"
- Location startLocation = t.Location;
- Expect(1);
- Block(
-#line 1348 "VBNET.ATG"
-out stmt);
-
-#line 1349 "VBNET.ATG"
- getBlock = new PropertyGetRegion((BlockStatement)stmt, attributes);
- Expect(100);
- Expect(115);
-
-#line 1351 "VBNET.ATG"
- getBlock.Modifier = m;
-
-#line 1352 "VBNET.ATG"
- getBlock.StartLocation = startLocation; getBlock.EndLocation = t.EndLocation;
- EndOfStmt();
- }
-
- void SetAccessorDecl(
-#line 1357 "VBNET.ATG"
-out PropertySetRegion setBlock, List<AttributeSection> attributes) {
-
-#line 1359 "VBNET.ATG"
- Statement stmt = null;
- List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
- Modifiers m;
-
- PropertyAccessorAccessModifier(
-#line 1364 "VBNET.ATG"
-out m);
- Expect(183);
-
-#line 1366 "VBNET.ATG"
- Location startLocation = t.Location;
- if (la.kind == 25) {
- lexer.NextToken();
- if (StartOf(4)) {
- FormalParameterList(
-#line 1367 "VBNET.ATG"
-p);
- }
- Expect(26);
- }
- Expect(1);
- Block(
-#line 1369 "VBNET.ATG"
-out stmt);
-
-#line 1371 "VBNET.ATG"
- setBlock = new PropertySetRegion((BlockStatement)stmt, attributes);
- setBlock.Modifier = m;
- setBlock.Parameters = p;
-
- Expect(100);
- Expect(183);
-
-#line 1376 "VBNET.ATG"
- setBlock.StartLocation = startLocation; setBlock.EndLocation = t.EndLocation;
- EndOfStmt();
- }
-
- void PropertyAccessorAccessModifier(
-#line 3396 "VBNET.ATG"
-out Modifiers m) {
-
-#line 3397 "VBNET.ATG"
- m = Modifiers.None;
- while (StartOf(28)) {
- if (la.kind == 173) {
- lexer.NextToken();
-
-#line 3399 "VBNET.ATG"
- m |= Modifiers.Public;
- } else if (la.kind == 172) {
- lexer.NextToken();
-
-#line 3400 "VBNET.ATG"
- m |= Modifiers.Protected;
- } else if (la.kind == 112) {
- lexer.NextToken();
-
-#line 3401 "VBNET.ATG"
- m |= Modifiers.Internal;
- } else {
- lexer.NextToken();
-
-#line 3402 "VBNET.ATG"
- m |= Modifiers.Private;
- }
- }
- }
-
- void ArrayInitializationModifier(
-#line 1474 "VBNET.ATG"
-out List<Expression> arrayModifiers) {
-
-#line 1476 "VBNET.ATG"
- arrayModifiers = null;
-
- Expect(25);
- InitializationRankList(
-#line 1478 "VBNET.ATG"
-out arrayModifiers);
- Expect(26);
- }
-
- void ArrayNameModifier(
-#line 2473 "VBNET.ATG"
-out ArrayList arrayModifiers) {
-
-#line 2475 "VBNET.ATG"
- arrayModifiers = null;
-
- ArrayTypeModifiers(
-#line 2477 "VBNET.ATG"
-out arrayModifiers);
- }
-
- void ObjectCreateExpression(
-#line 1935 "VBNET.ATG"
-out Expression oce) {
-
-#line 1937 "VBNET.ATG"
- TypeReference type = null;
- Expression initializer = null;
- List<Expression> arguments = null;
- ArrayList dimensions = null;
- oce = null;
- bool canBeNormal; bool canBeReDim;
-
- Expect(148);
- if (StartOf(7)) {
- NonArrayTypeName(
-#line 1945 "VBNET.ATG"
-out type, false);
- if (la.kind == 25) {
- lexer.NextToken();
- NormalOrReDimArgumentList(
-#line 1946 "VBNET.ATG"
-out arguments, out canBeNormal, out canBeReDim);
- Expect(26);
- if (la.kind == 23 ||
-#line 1947 "VBNET.ATG"
-la.kind == Tokens.OpenParenthesis) {
- if (
-#line 1947 "VBNET.ATG"
-la.kind == Tokens.OpenParenthesis) {
- ArrayTypeModifiers(
-#line 1948 "VBNET.ATG"
-out dimensions);
- CollectionInitializer(
-#line 1949 "VBNET.ATG"
-out initializer);
- } else {
- CollectionInitializer(
-#line 1950 "VBNET.ATG"
-out initializer);
- }
- }
-
-#line 1952 "VBNET.ATG"
- if (canBeReDim && !canBeNormal && initializer == null) initializer = new CollectionInitializerExpression();
- }
- }
-
-#line 1956 "VBNET.ATG"
- if (initializer == null) {
- oce = new ObjectCreateExpression(type, arguments);
- } else {
- if (dimensions == null) dimensions = new ArrayList();
- dimensions.Insert(0, (arguments == null) ? 0 : Math.Max(arguments.Count - 1, 0));
- type.RankSpecifier = (int[])dimensions.ToArray(typeof(int));
- ArrayCreateExpression ace = new ArrayCreateExpression(type, initializer as CollectionInitializerExpression);
- ace.Arguments = arguments;
- oce = ace;
- }
-
- if (la.kind == 218) {
-
-#line 1970 "VBNET.ATG"
- NamedArgumentExpression memberInitializer = null;
-
- lexer.NextToken();
-
-#line 1974 "VBNET.ATG"
- CollectionInitializerExpression memberInitializers = new CollectionInitializerExpression();
- memberInitializers.StartLocation = la.Location;
-
- Expect(23);
- MemberInitializer(
-#line 1978 "VBNET.ATG"
-out memberInitializer);
-
-#line 1979 "VBNET.ATG"
- memberInitializers.CreateExpressions.Add(memberInitializer);
- while (la.kind == 12) {
- lexer.NextToken();
- MemberInitializer(
-#line 1981 "VBNET.ATG"
-out memberInitializer);
-
-#line 1982 "VBNET.ATG"
- memberInitializers.CreateExpressions.Add(memberInitializer);
- }
- Expect(24);
-
-#line 1986 "VBNET.ATG"
- memberInitializers.EndLocation = t.Location;
- if(oce is ObjectCreateExpression)
- {
- ((ObjectCreateExpression)oce).ObjectInitializer = memberInitializers;
- }
-
- }
- }
-
- void VariableInitializer(
-#line 1502 "VBNET.ATG"
-out Expression initializerExpression) {
-
-#line 1504 "VBNET.ATG"
- initializerExpression = null;
-
- if (StartOf(29)) {
- Expr(
-#line 1506 "VBNET.ATG"
-out initializerExpression);
- } else if (la.kind == 23) {
- CollectionInitializer(
-#line 1507 "VBNET.ATG"
-out initializerExpression);
- } else SynErr(254);
- }
-
- void InitializationRankList(
-#line 1482 "VBNET.ATG"
-out List<Expression> rank) {
-
-#line 1484 "VBNET.ATG"
- rank = new List<Expression>();
- Expression expr = null;
-
- Expr(
-#line 1487 "VBNET.ATG"
-out expr);
- if (la.kind == 201) {
- lexer.NextToken();
-
-#line 1488 "VBNET.ATG"
- EnsureIsZero(expr);
- Expr(
-#line 1489 "VBNET.ATG"
-out expr);
- }
-
-#line 1491 "VBNET.ATG"
- if (expr != null) { rank.Add(expr); }
- while (la.kind == 12) {
- lexer.NextToken();
- Expr(
-#line 1493 "VBNET.ATG"
-out expr);
- if (la.kind == 201) {
- lexer.NextToken();
-
-#line 1494 "VBNET.ATG"
- EnsureIsZero(expr);
- Expr(
-#line 1495 "VBNET.ATG"
-out expr);
- }
-
-#line 1497 "VBNET.ATG"
- if (expr != null) { rank.Add(expr); }
- }
- }
-
- void CollectionInitializer(
-#line 1511 "VBNET.ATG"
-out Expression outExpr) {
-
-#line 1513 "VBNET.ATG"
- Expression expr = null;
- CollectionInitializerExpression initializer = new CollectionInitializerExpression();
-
- Expect(23);
- if (StartOf(30)) {
- VariableInitializer(
-#line 1518 "VBNET.ATG"
-out expr);
-
-#line 1520 "VBNET.ATG"
- if (expr != null) { initializer.CreateExpressions.Add(expr); }
-
- while (
-#line 1523 "VBNET.ATG"
-NotFinalComma()) {
- Expect(12);
- VariableInitializer(
-#line 1523 "VBNET.ATG"
-out expr);
-
-#line 1524 "VBNET.ATG"
- if (expr != null) { initializer.CreateExpressions.Add(expr); }
- }
- }
- Expect(24);
-
-#line 1527 "VBNET.ATG"
- outExpr = initializer;
- }
-
- void EventMemberSpecifier(
-#line 1597 "VBNET.ATG"
-out string name) {
-
-#line 1598 "VBNET.ATG"
- string eventName;
- if (StartOf(14)) {
- Identifier();
- } else if (la.kind == 144) {
- lexer.NextToken();
- } else if (la.kind == 139) {
- lexer.NextToken();
- } else SynErr(255);
-
-#line 1601 "VBNET.ATG"
- name = t.val;
- Expect(16);
- IdentifierOrKeyword(
-#line 1603 "VBNET.ATG"
-out eventName);
-
-#line 1604 "VBNET.ATG"
- name = name + "." + eventName;
- }
-
- void IdentifierOrKeyword(
-#line 3329 "VBNET.ATG"
-out string name) {
-
-#line 3331 "VBNET.ATG"
- lexer.NextToken(); name = t.val;
- }
-
- void QueryExpr(
-#line 2013 "VBNET.ATG"
-out Expression expr) {
-
-#line 2015 "VBNET.ATG"
- QueryExpression qexpr = new QueryExpression();
- qexpr.StartLocation = la.Location;
- List<QueryExpressionClause> middleClauses = new List<QueryExpressionClause>();
- expr = qexpr;
-
- FromOrAggregateQueryOperator(
-#line 2020 "VBNET.ATG"
-middleClauses);
- while (StartOf(31)) {
- QueryOperator(
-#line 2021 "VBNET.ATG"
-middleClauses);
- }
-
-#line 2023 "VBNET.ATG"
- qexpr.EndLocation = t.EndLocation;
-
- }
-
- void LambdaExpr(
-#line 1995 "VBNET.ATG"
-out Expression expr) {
-
-#line 1997 "VBNET.ATG"
- Expression inner = null;
- LambdaExpression lambda = new LambdaExpression();
- lambda.StartLocation = la.Location;
-
- Expect(114);
- if (la.kind == 25) {
- lexer.NextToken();
- if (StartOf(4)) {
- FormalParameterList(
-#line 2003 "VBNET.ATG"
-lambda.Parameters);
- }
- Expect(26);
- }
- Expr(
-#line 2004 "VBNET.ATG"
-out inner);
-
-#line 2006 "VBNET.ATG"
- lambda.ExpressionBody = inner;
- lambda.EndLocation = t.EndLocation; // la.Location?
-
- expr = lambda;
-
- }
-
- void DisjunctionExpr(
-#line 1779 "VBNET.ATG"
-out Expression outExpr) {
-
-#line 1781 "VBNET.ATG"
- Expression expr;
- BinaryOperatorType op = BinaryOperatorType.None;
-
- ConjunctionExpr(
-#line 1784 "VBNET.ATG"
-out outExpr);
- while (la.kind == 161 || la.kind == 163 || la.kind == 221) {
- if (la.kind == 161) {
- lexer.NextToken();
-
-#line 1787 "VBNET.ATG"
- op = BinaryOperatorType.BitwiseOr;
- } else if (la.kind == 163) {
- lexer.NextToken();
-
-#line 1788 "VBNET.ATG"
- op = BinaryOperatorType.LogicalOr;
- } else {
- lexer.NextToken();
-
-#line 1789 "VBNET.ATG"
- op = BinaryOperatorType.ExclusiveOr;
- }
- ConjunctionExpr(
-#line 1791 "VBNET.ATG"
-out expr);
-
-#line 1791 "VBNET.ATG"
- outExpr = new BinaryOperatorExpression(outExpr, op, expr);
- }
- }
-
- void AssignmentOperator(
-#line 1615 "VBNET.ATG"
-out AssignmentOperatorType op) {
-
-#line 1616 "VBNET.ATG"
- op = AssignmentOperatorType.None;
- switch (la.kind) {
- case 10: {
- lexer.NextToken();
-
-#line 1617 "VBNET.ATG"
- op = AssignmentOperatorType.Assign;
- break;
- }
- case 42: {
- lexer.NextToken();
-
-#line 1618 "VBNET.ATG"
- op = AssignmentOperatorType.ConcatString;
- break;
- }
- case 34: {
- lexer.NextToken();
-
-#line 1619 "VBNET.ATG"
- op = AssignmentOperatorType.Add;
- break;
- }
- case 36: {
- lexer.NextToken();
-
-#line 1620 "VBNET.ATG"
- op = AssignmentOperatorType.Subtract;
- break;
- }
- case 37: {
- lexer.NextToken();
-
-#line 1621 "VBNET.ATG"
- op = AssignmentOperatorType.Multiply;
- break;
- }
- case 38: {
- lexer.NextToken();
-
-#line 1622 "VBNET.ATG"
- op = AssignmentOperatorType.Divide;
- break;
- }
- case 39: {
- lexer.NextToken();
-
-#line 1623 "VBNET.ATG"
- op = AssignmentOperatorType.DivideInteger;
- break;
- }
- case 35: {
- lexer.NextToken();
-
-#line 1624 "VBNET.ATG"
- op = AssignmentOperatorType.Power;
- break;
- }
- case 40: {
- lexer.NextToken();
-
-#line 1625 "VBNET.ATG"
- op = AssignmentOperatorType.ShiftLeft;
- break;
- }
- case 41: {
- lexer.NextToken();
-
-#line 1626 "VBNET.ATG"
- op = AssignmentOperatorType.ShiftRight;
- break;
- }
- default: SynErr(256); break;
- }
- }
-
- void SimpleExpr(
-#line 1630 "VBNET.ATG"
-out Expression pexpr) {
-
-#line 1631 "VBNET.ATG"
- string name;
- SimpleNonInvocationExpression(
-#line 1633 "VBNET.ATG"
-out pexpr);
- while (la.kind == 16 || la.kind == 17 || la.kind == 25) {
- if (la.kind == 16) {
- lexer.NextToken();
- IdentifierOrKeyword(
-#line 1635 "VBNET.ATG"
-out name);
-
-#line 1636 "VBNET.ATG"
- pexpr = new MemberReferenceExpression(pexpr, name);
- if (
-#line 1637 "VBNET.ATG"
-la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of) {
- lexer.NextToken();
- Expect(155);
- TypeArgumentList(
-#line 1638 "VBNET.ATG"
-((MemberReferenceExpression)pexpr).TypeArguments);
- Expect(26);
- }
- } else if (la.kind == 17) {
- lexer.NextToken();
- IdentifierOrKeyword(
-#line 1640 "VBNET.ATG"
-out name);
-
-#line 1640 "VBNET.ATG"
- pexpr = new BinaryOperatorExpression(pexpr, BinaryOperatorType.DictionaryAccess, new PrimitiveExpression(name, name));
- } else {
- InvocationExpression(
-#line 1641 "VBNET.ATG"
-ref pexpr);
- }
- }
- }
-
- void SimpleNonInvocationExpression(
-#line 1645 "VBNET.ATG"
-out Expression pexpr) {
-
-#line 1647 "VBNET.ATG"
- Expression expr;
- TypeReference type = null;
- string name = String.Empty;
- pexpr = null;
-
- if (StartOf(32)) {
- switch (la.kind) {
- case 3: {
- lexer.NextToken();
-
-#line 1655 "VBNET.ATG"
- pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };
- break;
- }
- case 4: {
- lexer.NextToken();
-
-#line 1656 "VBNET.ATG"
- pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };
- break;
- }
- case 7: {
- lexer.NextToken();
-
-#line 1657 "VBNET.ATG"
- pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };
- break;
- }
- case 6: {
- lexer.NextToken();
-
-#line 1658 "VBNET.ATG"
- pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };
- break;
- }
- case 5: {
- lexer.NextToken();
-
-#line 1659 "VBNET.ATG"
- pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };
- break;
- }
- case 9: {
- lexer.NextToken();
-
-#line 1660 "VBNET.ATG"
- pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };
- break;
- }
- case 8: {
- lexer.NextToken();
-
-#line 1661 "VBNET.ATG"
- pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };
- break;
- }
- case 202: {
- lexer.NextToken();
-
-#line 1663 "VBNET.ATG"
- pexpr = new PrimitiveExpression(true, "true");
- break;
- }
- case 109: {
- lexer.NextToken();
-
-#line 1664 "VBNET.ATG"
- pexpr = new PrimitiveExpression(false, "false");
- break;
- }
- case 151: {
- lexer.NextToken();
-
-#line 1665 "VBNET.ATG"
- pexpr = new PrimitiveExpression(null, "null");
- break;
- }
- case 25: {
- lexer.NextToken();
- Expr(
-#line 1666 "VBNET.ATG"
-out expr);
- Expect(26);
-
-#line 1666 "VBNET.ATG"
- pexpr = new ParenthesizedExpression(expr);
- break;
- }
- case 2: case 45: case 49: case 51: case 52: case 53: case 54: case 57: case 74: case 85: case 91: case 94: case 103: case 108: case 113: case 120: case 126: case 130: case 133: case 156: case 162: case 169: case 188: case 197: case 198: case 208: case 209: case 215: {
- Identifier();
-
-#line 1668 "VBNET.ATG"
- pexpr = new IdentifierExpression(t.val);
- pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation;
-
- if (
-#line 1671 "VBNET.ATG"
-la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of) {
- lexer.NextToken();
- Expect(155);
- TypeArgumentList(
-#line 1672 "VBNET.ATG"
-((IdentifierExpression)pexpr).TypeArguments);
- Expect(26);
- }
- break;
- }
- case 55: case 58: case 69: case 86: case 87: case 96: case 128: case 137: case 154: case 181: case 186: case 187: case 193: case 206: case 207: case 210: {
-
-#line 1674 "VBNET.ATG"
- string val = String.Empty;
- if (StartOf(11)) {
- PrimitiveTypeName(
-#line 1675 "VBNET.ATG"
-out val);
- } else if (la.kind == 154) {
- lexer.NextToken();
-
-#line 1675 "VBNET.ATG"
- val = "System.Object";
- } else SynErr(257);
-
-#line 1676 "VBNET.ATG"
- pexpr = new TypeReferenceExpression(new TypeReference(val, true));
- break;
- }
- case 139: {
- lexer.NextToken();
-
-#line 1677 "VBNET.ATG"
- pexpr = new ThisReferenceExpression();
- break;
- }
- case 144: case 145: {
-
-#line 1678 "VBNET.ATG"
- Expression retExpr = null;
- if (la.kind == 144) {
- lexer.NextToken();
-
-#line 1679 "VBNET.ATG"
- retExpr = new BaseReferenceExpression();
- } else if (la.kind == 145) {
- lexer.NextToken();
-
-#line 1680 "VBNET.ATG"
- retExpr = new ClassReferenceExpression();
- } else SynErr(258);
- Expect(16);
- IdentifierOrKeyword(
-#line 1682 "VBNET.ATG"
-out name);
-
-#line 1682 "VBNET.ATG"
- pexpr = new MemberReferenceExpression(retExpr, name);
- break;
- }
- case 117: {
- lexer.NextToken();
- Expect(16);
- Identifier();
-
-#line 1684 "VBNET.ATG"
- type = new TypeReference(t.val ?? "");
-
-#line 1686 "VBNET.ATG"
- type.IsGlobal = true;
-
-#line 1687 "VBNET.ATG"
- pexpr = new TypeReferenceExpression(type);
- break;
- }
- case 148: {
- ObjectCreateExpression(
-#line 1688 "VBNET.ATG"
-out expr);
-
-#line 1688 "VBNET.ATG"
- pexpr = expr;
- break;
- }
- case 81: case 93: case 204: {
-
-#line 1690 "VBNET.ATG"
- CastType castType = CastType.Cast;
- if (la.kind == 93) {
- lexer.NextToken();
- } else if (la.kind == 81) {
- lexer.NextToken();
-
-#line 1692 "VBNET.ATG"
- castType = CastType.Conversion;
- } else if (la.kind == 204) {
- lexer.NextToken();
-
-#line 1693 "VBNET.ATG"
- castType = CastType.TryCast;
- } else SynErr(259);
- Expect(25);
- Expr(
-#line 1695 "VBNET.ATG"
-out expr);
- Expect(12);
- TypeName(
-#line 1695 "VBNET.ATG"
-out type);
- Expect(26);
-
-#line 1696 "VBNET.ATG"
- pexpr = new CastExpression(type, expr, castType);
- break;
- }
- case 63: case 64: case 65: case 66: case 67: case 68: case 70: case 72: case 73: case 77: case 78: case 79: case 80: case 82: case 83: case 84: {
- CastTarget(
-#line 1697 "VBNET.ATG"
-out type);
- Expect(25);
- Expr(
-#line 1697 "VBNET.ATG"
-out expr);
- Expect(26);
-
-#line 1697 "VBNET.ATG"
- pexpr = new CastExpression(type, expr, CastType.PrimitiveConversion);
- break;
- }
- case 44: {
- lexer.NextToken();
- Expr(
-#line 1698 "VBNET.ATG"
-out expr);
-
-#line 1698 "VBNET.ATG"
- pexpr = new AddressOfExpression(expr);
- break;
- }
- case 116: {
- lexer.NextToken();
- Expect(25);
- GetTypeTypeName(
-#line 1699 "VBNET.ATG"
-out type);
- Expect(26);
-
-#line 1699 "VBNET.ATG"
- pexpr = new TypeOfExpression(type);
- break;
- }
- case 205: {
- lexer.NextToken();
- SimpleExpr(
-#line 1700 "VBNET.ATG"
-out expr);
- Expect(131);
- TypeName(
-#line 1700 "VBNET.ATG"
-out type);
-
-#line 1700 "VBNET.ATG"
- pexpr = new TypeOfIsExpression(expr, type);
- break;
- }
- case 122: {
- ConditionalExpression(
-#line 1701 "VBNET.ATG"
-out pexpr);
- break;
- }
- }
- } else if (la.kind == 16) {
- lexer.NextToken();
- IdentifierOrKeyword(
-#line 1705 "VBNET.ATG"
-out name);
-
-#line 1705 "VBNET.ATG"
- pexpr = new MemberReferenceExpression(null, name);
- } else SynErr(260);
- }
-
- void TypeArgumentList(
-#line 2509 "VBNET.ATG"
-List<TypeReference> typeArguments) {
-
-#line 2511 "VBNET.ATG"
- TypeReference typeref;
-
- TypeName(
-#line 2513 "VBNET.ATG"
-out typeref);
-
-#line 2513 "VBNET.ATG"
- if (typeref != null) typeArguments.Add(typeref);
- while (la.kind == 12) {
- lexer.NextToken();
- TypeName(
-#line 2516 "VBNET.ATG"
-out typeref);
-
-#line 2516 "VBNET.ATG"
- if (typeref != null) typeArguments.Add(typeref);
- }
- }
-
- void InvocationExpression(
-#line 1743 "VBNET.ATG"
-ref Expression pexpr) {
-
-#line 1744 "VBNET.ATG"
- List<Expression> parameters = null;
- Expect(25);
-
-#line 1746 "VBNET.ATG"
- Location start = t.Location;
- ArgumentList(
-#line 1747 "VBNET.ATG"
-out parameters);
- Expect(26);
-
-#line 1750 "VBNET.ATG"
- pexpr = new InvocationExpression(pexpr, parameters);
-
-
-#line 1752 "VBNET.ATG"
- pexpr.StartLocation = start; pexpr.EndLocation = t.Location;
- }
-
- void PrimitiveTypeName(
-#line 3336 "VBNET.ATG"
-out string type) {
-
-#line 3337 "VBNET.ATG"
- type = String.Empty;
- switch (la.kind) {
- case 55: {
- lexer.NextToken();
-
-#line 3338 "VBNET.ATG"
- type = "System.Boolean";
- break;
- }
- case 86: {
- lexer.NextToken();
-
-#line 3339 "VBNET.ATG"
- type = "System.DateTime";
- break;
- }
- case 69: {
- lexer.NextToken();
-
-#line 3340 "VBNET.ATG"
- type = "System.Char";
- break;
- }
- case 193: {
- lexer.NextToken();
-
-#line 3341 "VBNET.ATG"
- type = "System.String";
- break;
- }
- case 87: {
- lexer.NextToken();
-
-#line 3342 "VBNET.ATG"
- type = "System.Decimal";
- break;
- }
- case 58: {
- lexer.NextToken();
-
-#line 3343 "VBNET.ATG"
- type = "System.Byte";
- break;
- }
- case 186: {
- lexer.NextToken();
-
-#line 3344 "VBNET.ATG"
- type = "System.Int16";
- break;
- }
- case 128: {
- lexer.NextToken();
-
-#line 3345 "VBNET.ATG"
- type = "System.Int32";
- break;
- }
- case 137: {
- lexer.NextToken();
-
-#line 3346 "VBNET.ATG"
- type = "System.Int64";
- break;
- }
- case 187: {
- lexer.NextToken();
-
-#line 3347 "VBNET.ATG"
- type = "System.Single";
- break;
- }
- case 96: {
- lexer.NextToken();
-
-#line 3348 "VBNET.ATG"
- type = "System.Double";
- break;
- }
- case 206: {
- lexer.NextToken();
-
-#line 3349 "VBNET.ATG"
- type = "System.UInt32";
- break;
- }
- case 207: {
- lexer.NextToken();
-
-#line 3350 "VBNET.ATG"
- type = "System.UInt64";
- break;
- }
- case 210: {
- lexer.NextToken();
-
-#line 3351 "VBNET.ATG"
- type = "System.UInt16";
- break;
- }
- case 181: {
- lexer.NextToken();
-
-#line 3352 "VBNET.ATG"
- type = "System.SByte";
- break;
- }
- default: SynErr(261); break;
- }
- }
-
- void CastTarget(
-#line 1757 "VBNET.ATG"
-out TypeReference type) {
-
-#line 1759 "VBNET.ATG"
- type = null;
-
- switch (la.kind) {
- case 63: {
- lexer.NextToken();
-
-#line 1761 "VBNET.ATG"
- type = new TypeReference("System.Boolean", true);
- break;
- }
- case 64: {
- lexer.NextToken();
-
-#line 1762 "VBNET.ATG"
- type = new TypeReference("System.Byte", true);
- break;
- }
- case 77: {
- lexer.NextToken();
-
-#line 1763 "VBNET.ATG"
- type = new TypeReference("System.SByte", true);
- break;
- }
- case 65: {
- lexer.NextToken();
-
-#line 1764 "VBNET.ATG"
- type = new TypeReference("System.Char", true);
- break;
- }
- case 66: {
- lexer.NextToken();
-
-#line 1765 "VBNET.ATG"
- type = new TypeReference("System.DateTime", true);
- break;
- }
- case 68: {
- lexer.NextToken();
-
-#line 1766 "VBNET.ATG"
- type = new TypeReference("System.Decimal", true);
- break;
- }
- case 67: {
- lexer.NextToken();
-
-#line 1767 "VBNET.ATG"
- type = new TypeReference("System.Double", true);
- break;
- }
- case 78: {
- lexer.NextToken();
-
-#line 1768 "VBNET.ATG"
- type = new TypeReference("System.Int16", true);
- break;
- }
- case 70: {
- lexer.NextToken();
-
-#line 1769 "VBNET.ATG"
- type = new TypeReference("System.Int32", true);
- break;
- }
- case 72: {
- lexer.NextToken();
-
-#line 1770 "VBNET.ATG"
- type = new TypeReference("System.Int64", true);
- break;
- }
- case 84: {
- lexer.NextToken();
-
-#line 1771 "VBNET.ATG"
- type = new TypeReference("System.UInt16", true);
- break;
- }
- case 82: {
- lexer.NextToken();
-
-#line 1772 "VBNET.ATG"
- type = new TypeReference("System.UInt32", true);
- break;
- }
- case 83: {
- lexer.NextToken();
-
-#line 1773 "VBNET.ATG"
- type = new TypeReference("System.UInt64", true);
- break;
- }
- case 73: {
- lexer.NextToken();
-
-#line 1774 "VBNET.ATG"
- type = new TypeReference("System.Object", true);
- break;
- }
- case 79: {
- lexer.NextToken();
-
-#line 1775 "VBNET.ATG"
- type = new TypeReference("System.Single", true);
- break;
- }
- case 80: {
- lexer.NextToken();
-
-#line 1776 "VBNET.ATG"
- type = new TypeReference("System.String", true);
- break;
- }
- default: SynErr(262); break;
- }
- }
-
- void GetTypeTypeName(
-#line 2408 "VBNET.ATG"
-out TypeReference typeref) {
-
-#line 2409 "VBNET.ATG"
- ArrayList rank = null;
- NonArrayTypeName(
-#line 2411 "VBNET.ATG"
-out typeref, true);
- ArrayTypeModifiers(
-#line 2412 "VBNET.ATG"
-out rank);
-
-#line 2413 "VBNET.ATG"
- if (rank != null && typeref != null) {
- typeref.RankSpecifier = (int[])rank.ToArray(typeof(int));
- }
-
- }
-
- void ConditionalExpression(
-#line 1709 "VBNET.ATG"
-out Expression expr) {
-
-#line 1711 "VBNET.ATG"
- ConditionalExpression conditionalExpression = new ConditionalExpression();
- BinaryOperatorExpression binaryOperatorExpression = new BinaryOperatorExpression();
- conditionalExpression.StartLocation = binaryOperatorExpression.StartLocation = la.Location;
-
- Expression condition = null;
- Expression trueExpr = null;
- Expression falseExpr = null;
-
- Expect(122);
- Expect(25);
- Expr(
-#line 1720 "VBNET.ATG"
-out condition);
- Expect(12);
- Expr(
-#line 1720 "VBNET.ATG"
-out trueExpr);
- if (la.kind == 12) {
- lexer.NextToken();
- Expr(
-#line 1720 "VBNET.ATG"
-out falseExpr);
- }
- Expect(26);
-
-#line 1722 "VBNET.ATG"
- if(falseExpr != null)
- {
- conditionalExpression.Condition = condition;
- conditionalExpression.TrueExpression = trueExpr;
- conditionalExpression.FalseExpression = falseExpr;
- conditionalExpression.EndLocation = t.EndLocation;
-
- expr = conditionalExpression;
- }
- else
- {
- binaryOperatorExpression.Left = condition;
- binaryOperatorExpression.Right = trueExpr;
- binaryOperatorExpression.Op = BinaryOperatorType.NullCoalescing;
- binaryOperatorExpression.EndLocation = t.EndLocation;
-
- expr = binaryOperatorExpression;
- }
-
- }
-
- void ArgumentList(
-#line 2340 "VBNET.ATG"
-out List<Expression> arguments) {
-
-#line 2342 "VBNET.ATG"
- arguments = new List<Expression>();
- Expression expr = null;
-
- if (StartOf(29)) {
- Argument(
-#line 2345 "VBNET.ATG"
-out expr);
- }
- while (la.kind == 12) {
- lexer.NextToken();
-
-#line 2346 "VBNET.ATG"
- arguments.Add(expr ?? Expression.Null); expr = null;
- if (StartOf(29)) {
- Argument(
-#line 2347 "VBNET.ATG"
-out expr);
- }
-
-#line 2348 "VBNET.ATG"
- if (expr == null) expr = Expression.Null;
- }
-
-#line 2350 "VBNET.ATG"
- if (expr != null) arguments.Add(expr);
- }
-
- void ConjunctionExpr(
-#line 1795 "VBNET.ATG"
-out Expression outExpr) {
-
-#line 1797 "VBNET.ATG"
- Expression expr;
- BinaryOperatorType op = BinaryOperatorType.None;
-
- NotExpr(
-#line 1800 "VBNET.ATG"
-out outExpr);
- while (la.kind == 47 || la.kind == 48) {
- if (la.kind == 47) {
- lexer.NextToken();
-
-#line 1803 "VBNET.ATG"
- op = BinaryOperatorType.BitwiseAnd;
- } else {
- lexer.NextToken();
-
-#line 1804 "VBNET.ATG"
- op = BinaryOperatorType.LogicalAnd;
- }
- NotExpr(
-#line 1806 "VBNET.ATG"
-out expr);
-
-#line 1806 "VBNET.ATG"
- outExpr = new BinaryOperatorExpression(outExpr, op, expr);
- }
- }
-
- void NotExpr(
-#line 1810 "VBNET.ATG"
-out Expression outExpr) {
-
-#line 1811 "VBNET.ATG"
- UnaryOperatorType uop = UnaryOperatorType.None;
- while (la.kind == 150) {
- lexer.NextToken();
-
-#line 1812 "VBNET.ATG"
- uop = UnaryOperatorType.Not;
- }
- ComparisonExpr(
-#line 1813 "VBNET.ATG"
-out outExpr);
-
-#line 1814 "VBNET.ATG"
- if (uop != UnaryOperatorType.None)
- outExpr = new UnaryOperatorExpression(outExpr, uop);
-
- }
-
- void ComparisonExpr(
-#line 1819 "VBNET.ATG"
-out Expression outExpr) {
-
-#line 1821 "VBNET.ATG"
- Expression expr;
- BinaryOperatorType op = BinaryOperatorType.None;
-
- ShiftExpr(
-#line 1824 "VBNET.ATG"
-out outExpr);
- while (StartOf(33)) {
- switch (la.kind) {
- case 28: {
- lexer.NextToken();
-
-#line 1827 "VBNET.ATG"
- op = BinaryOperatorType.LessThan;
- break;
- }
- case 27: {
- lexer.NextToken();
-
-#line 1828 "VBNET.ATG"
- op = BinaryOperatorType.GreaterThan;
- break;
- }
- case 31: {
- lexer.NextToken();
-
-#line 1829 "VBNET.ATG"
- op = BinaryOperatorType.LessThanOrEqual;
- break;
- }
- case 30: {
- lexer.NextToken();
-
-#line 1830 "VBNET.ATG"
- op = BinaryOperatorType.GreaterThanOrEqual;
- break;
- }
- case 29: {
- lexer.NextToken();
-
-#line 1831 "VBNET.ATG"
- op = BinaryOperatorType.InEquality;
- break;
- }
- case 10: {
- lexer.NextToken();
-
-#line 1832 "VBNET.ATG"
- op = BinaryOperatorType.Equality;
- break;
- }
- case 136: {
- lexer.NextToken();
-
-#line 1833 "VBNET.ATG"
- op = BinaryOperatorType.Like;
- break;
- }
- case 131: {
- lexer.NextToken();
-
-#line 1834 "VBNET.ATG"
- op = BinaryOperatorType.ReferenceEquality;
- break;
- }
- case 132: {
- lexer.NextToken();
-
-#line 1835 "VBNET.ATG"
- op = BinaryOperatorType.ReferenceInequality;
- break;
- }
- }
- if (StartOf(34)) {
- ShiftExpr(
-#line 1838 "VBNET.ATG"
-out expr);
-
-#line 1838 "VBNET.ATG"
- outExpr = new BinaryOperatorExpression(outExpr, op, expr);
- } else if (la.kind == 150) {
- lexer.NextToken();
- ShiftExpr(
-#line 1841 "VBNET.ATG"
-out expr);
-
-#line 1841 "VBNET.ATG"
- outExpr = new BinaryOperatorExpression(outExpr, op, new UnaryOperatorExpression(expr, UnaryOperatorType.Not));
- } else SynErr(263);
- }
- }
-
- void ShiftExpr(
-#line 1846 "VBNET.ATG"
-out Expression outExpr) {
-
-#line 1848 "VBNET.ATG"
- Expression expr;
- BinaryOperatorType op = BinaryOperatorType.None;
-
- ConcatenationExpr(
-#line 1851 "VBNET.ATG"
-out outExpr);
- while (la.kind == 32 || la.kind == 33) {
- if (la.kind == 32) {
- lexer.NextToken();
-
-#line 1854 "VBNET.ATG"
- op = BinaryOperatorType.ShiftLeft;
- } else {
- lexer.NextToken();
-
-#line 1855 "VBNET.ATG"
- op = BinaryOperatorType.ShiftRight;
- }
- ConcatenationExpr(
-#line 1857 "VBNET.ATG"
-out expr);
-
-#line 1857 "VBNET.ATG"
- outExpr = new BinaryOperatorExpression(outExpr, op, expr);
- }
- }
-
- void ConcatenationExpr(
-#line 1861 "VBNET.ATG"
-out Expression outExpr) {
-
-#line 1862 "VBNET.ATG"
- Expression expr;
- AdditiveExpr(
-#line 1864 "VBNET.ATG"
-out outExpr);
- while (la.kind == 13) {
- lexer.NextToken();
- AdditiveExpr(
-#line 1864 "VBNET.ATG"
-out expr);
-
-#line 1864 "VBNET.ATG"
- outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.Concat, expr);
- }
- }
-
- void AdditiveExpr(
-#line 1867 "VBNET.ATG"
-out Expression outExpr) {
-
-#line 1869 "VBNET.ATG"
- Expression expr;
- BinaryOperatorType op = BinaryOperatorType.None;
-
- ModuloExpr(
-#line 1872 "VBNET.ATG"
-out outExpr);
- while (la.kind == 18 || la.kind == 19) {
- if (la.kind == 19) {
- lexer.NextToken();
-
-#line 1875 "VBNET.ATG"
- op = BinaryOperatorType.Add;
- } else {
- lexer.NextToken();
-
-#line 1876 "VBNET.ATG"
- op = BinaryOperatorType.Subtract;
- }
- ModuloExpr(
-#line 1878 "VBNET.ATG"
-out expr);
-
-#line 1878 "VBNET.ATG"
- outExpr = new BinaryOperatorExpression(outExpr, op, expr);
- }
- }
-
- void ModuloExpr(
-#line 1882 "VBNET.ATG"
-out Expression outExpr) {
-
-#line 1883 "VBNET.ATG"
- Expression expr;
- IntegerDivisionExpr(
-#line 1885 "VBNET.ATG"
-out outExpr);
- while (la.kind == 140) {
- lexer.NextToken();
- IntegerDivisionExpr(
-#line 1885 "VBNET.ATG"
-out expr);
-
-#line 1885 "VBNET.ATG"
- outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.Modulus, expr);
- }
- }
-
- void IntegerDivisionExpr(
-#line 1888 "VBNET.ATG"
-out Expression outExpr) {
-
-#line 1889 "VBNET.ATG"
- Expression expr;
- MultiplicativeExpr(
-#line 1891 "VBNET.ATG"
-out outExpr);
- while (la.kind == 15) {
- lexer.NextToken();
- MultiplicativeExpr(
-#line 1891 "VBNET.ATG"
-out expr);
-
-#line 1891 "VBNET.ATG"
- outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.DivideInteger, expr);
- }
- }
-
- void MultiplicativeExpr(
-#line 1894 "VBNET.ATG"
-out Expression outExpr) {
-
-#line 1896 "VBNET.ATG"
- Expression expr;
- BinaryOperatorType op = BinaryOperatorType.None;
-
- UnaryExpr(
-#line 1899 "VBNET.ATG"
-out outExpr);
- while (la.kind == 14 || la.kind == 22) {
- if (la.kind == 22) {
- lexer.NextToken();
-
-#line 1902 "VBNET.ATG"
- op = BinaryOperatorType.Multiply;
- } else {
- lexer.NextToken();
-
-#line 1903 "VBNET.ATG"
- op = BinaryOperatorType.Divide;
- }
- UnaryExpr(
-#line 1905 "VBNET.ATG"
-out expr);
-
-#line 1905 "VBNET.ATG"
- outExpr = new BinaryOperatorExpression(outExpr, op, expr);
- }
- }
-
- void UnaryExpr(
-#line 1909 "VBNET.ATG"
-out Expression uExpr) {
-
-#line 1911 "VBNET.ATG"
- Expression expr;
- UnaryOperatorType uop = UnaryOperatorType.None;
- bool isUOp = false;
-
- while (la.kind == 18 || la.kind == 19 || la.kind == 22) {
- if (la.kind == 19) {
- lexer.NextToken();
-
-#line 1915 "VBNET.ATG"
- uop = UnaryOperatorType.Plus; isUOp = true;
- } else if (la.kind == 18) {
- lexer.NextToken();
-
-#line 1916 "VBNET.ATG"
- uop = UnaryOperatorType.Minus; isUOp = true;
- } else {
- lexer.NextToken();
-
-#line 1917 "VBNET.ATG"
- uop = UnaryOperatorType.Dereference; isUOp = true;
- }
- }
- ExponentiationExpr(
-#line 1919 "VBNET.ATG"
-out expr);
-
-#line 1921 "VBNET.ATG"
- if (isUOp) {
- uExpr = new UnaryOperatorExpression(expr, uop);
- } else {
- uExpr = expr;
- }
-
- }
-
- void ExponentiationExpr(
-#line 1929 "VBNET.ATG"
-out Expression outExpr) {
-
-#line 1930 "VBNET.ATG"
- Expression expr;
- SimpleExpr(
-#line 1932 "VBNET.ATG"
-out outExpr);
- while (la.kind == 20) {
- lexer.NextToken();
- SimpleExpr(
-#line 1932 "VBNET.ATG"
-out expr);
-
-#line 1932 "VBNET.ATG"
- outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.Power, expr);
- }
- }
-
- void NormalOrReDimArgumentList(
-#line 2354 "VBNET.ATG"
-out List<Expression> arguments, out bool canBeNormal, out bool canBeRedim) {
-
-#line 2356 "VBNET.ATG"
- arguments = new List<Expression>();
- canBeNormal = true; canBeRedim = !IsNamedAssign();
- Expression expr = null;
-
- if (StartOf(29)) {
- Argument(
-#line 2361 "VBNET.ATG"
-out expr);
- if (la.kind == 201) {
- lexer.NextToken();
-
-#line 2362 "VBNET.ATG"
- EnsureIsZero(expr); canBeNormal = false;
- Expr(
-#line 2363 "VBNET.ATG"
-out expr);
- }
- }
- while (la.kind == 12) {
- lexer.NextToken();
-
-#line 2366 "VBNET.ATG"
- if (expr == null) canBeRedim = false;
-
-#line 2367 "VBNET.ATG"
- arguments.Add(expr ?? Expression.Null); expr = null;
-
-#line 2368 "VBNET.ATG"
- canBeRedim &= !IsNamedAssign();
- if (StartOf(29)) {
- Argument(
-#line 2369 "VBNET.ATG"
-out expr);
- if (la.kind == 201) {
- lexer.NextToken();
-
-#line 2370 "VBNET.ATG"
- EnsureIsZero(expr); canBeNormal = false;
- Expr(
-#line 2371 "VBNET.ATG"
-out expr);
- }
- }
-
-#line 2373 "VBNET.ATG"
- if (expr == null) { canBeRedim = false; expr = Expression.Null; }
- }
-
-#line 2375 "VBNET.ATG"
- if (expr != null) arguments.Add(expr); else canBeRedim = false;
- }
-
- void ArrayTypeModifiers(
-#line 2482 "VBNET.ATG"
-out ArrayList arrayModifiers) {
-
-#line 2484 "VBNET.ATG"
- arrayModifiers = new ArrayList();
- int i = 0;
-
- while (
-#line 2487 "VBNET.ATG"
-IsDims()) {
- Expect(25);
- if (la.kind == 12 || la.kind == 26) {
- RankList(
-#line 2489 "VBNET.ATG"
-out i);
- }
-
-#line 2491 "VBNET.ATG"
- arrayModifiers.Add(i);
-
- Expect(26);
- }
-
-#line 2496 "VBNET.ATG"
- if(arrayModifiers.Count == 0) {
- arrayModifiers = null;
- }
-
- }
-
- void MemberInitializer(
-#line 2324 "VBNET.ATG"
-out NamedArgumentExpression memberInitializer) {
-
-#line 2326 "VBNET.ATG"
- memberInitializer = new NamedArgumentExpression();
- memberInitializer.StartLocation = la.Location;
- Expression initExpr = null;
- string name = null;
-
- Expect(16);
- IdentifierOrKeyword(
-#line 2331 "VBNET.ATG"
-out name);
- Expect(10);
- Expr(
-#line 2331 "VBNET.ATG"
-out initExpr);
-
-#line 2333 "VBNET.ATG"
- memberInitializer.Name = name;
- memberInitializer.Expression = initExpr;
- memberInitializer.EndLocation = t.EndLocation;
-
- }
-
- void FromOrAggregateQueryOperator(
-#line 2027 "VBNET.ATG"
-List<QueryExpressionClause> middleClauses) {
-
-#line 2028 "VBNET.ATG"
-
- if (la.kind == 113) {
- FromQueryOperator(
-#line 2029 "VBNET.ATG"
-middleClauses);
- } else if (la.kind == 45) {
- AggregateQueryOperator(
-#line 2030 "VBNET.ATG"
-middleClauses);
- } else SynErr(264);
- }
-
- void QueryOperator(
-#line 2033 "VBNET.ATG"
-List<QueryExpressionClause> middleClauses) {
-
-#line 2035 "VBNET.ATG"
- QueryExpressionJoinVBClause joinClause = null;
- QueryExpressionGroupVBClause groupByClause = null;
- QueryExpressionPartitionVBClause partitionClause = null;
- QueryExpressionGroupJoinVBClause groupJoinClause = null;
-
- if (la.kind == 113) {
- FromQueryOperator(
-#line 2040 "VBNET.ATG"
-middleClauses);
- } else if (la.kind == 45) {
- AggregateQueryOperator(
-#line 2041 "VBNET.ATG"
-middleClauses);
- } else if (la.kind == 182) {
- SelectQueryOperator(
-#line 2042 "VBNET.ATG"
-middleClauses);
- } else if (la.kind == 94) {
- DistinctQueryOperator(
-#line 2043 "VBNET.ATG"
-middleClauses);
- } else if (la.kind == 215) {
- WhereQueryOperator(
-#line 2044 "VBNET.ATG"
-middleClauses);
- } else if (la.kind == 162) {
- OrderByQueryOperator(
-#line 2045 "VBNET.ATG"
-middleClauses);
- } else if (la.kind == 188 || la.kind == 197) {
- PartitionQueryOperator(
-#line 2046 "VBNET.ATG"
-out partitionClause);
- } else if (la.kind == 134) {
- LetQueryOperator(
-#line 2047 "VBNET.ATG"
-middleClauses);
- } else if (la.kind == 133) {
- JoinQueryOperator(
-#line 2048 "VBNET.ATG"
-out joinClause);
-
-#line 2049 "VBNET.ATG"
- middleClauses.Add(joinClause);
- } else if (
-#line 2050 "VBNET.ATG"
-la.kind == Tokens.Group && Peek(1).kind == Tokens.Join) {
- GroupJoinQueryOperator(
-#line 2050 "VBNET.ATG"
-out groupJoinClause);
-
-#line 2051 "VBNET.ATG"
- middleClauses.Add(groupJoinClause);
- } else if (la.kind == 120) {
- GroupByQueryOperator(
-#line 2052 "VBNET.ATG"
-out groupByClause);
-
-#line 2053 "VBNET.ATG"
- middleClauses.Add(groupByClause);
- } else SynErr(265);
- }
-
- void FromQueryOperator(
-#line 2128 "VBNET.ATG"
-List<QueryExpressionClause> middleClauses) {
-
-#line 2130 "VBNET.ATG"
-
- Expect(113);
- CollectionRangeVariableDeclarationList(
-#line 2131 "VBNET.ATG"
-middleClauses);
- }
-
- void AggregateQueryOperator(
-#line 2191 "VBNET.ATG"
-List<QueryExpressionClause> middleClauses) {
-
-#line 2193 "VBNET.ATG"
- QueryExpressionFromClause fromClause = null;
- QueryExpressionAggregateClause aggregateClause = new QueryExpressionAggregateClause();
- aggregateClause.IntoVariables = new List<ExpressionRangeVariable>();
- aggregateClause.StartLocation = la.Location;
-
- Expect(45);
- CollectionRangeVariableDeclaration(
-#line 2198 "VBNET.ATG"
-out fromClause);
-
-#line 2200 "VBNET.ATG"
- aggregateClause.FromClause = fromClause;
-
- while (StartOf(31)) {
- QueryOperator(
-#line 2203 "VBNET.ATG"
-aggregateClause.MiddleClauses);
- }
- Expect(130);
- ExpressionRangeVariableDeclarationList(
-#line 2205 "VBNET.ATG"
-aggregateClause.IntoVariables);
-
-#line 2207 "VBNET.ATG"
- aggregateClause.EndLocation = t.EndLocation;
- middleClauses.Add(aggregateClause);
-
- }
-
- void SelectQueryOperator(
-#line 2134 "VBNET.ATG"
-List<QueryExpressionClause> middleClauses) {
-
-#line 2136 "VBNET.ATG"
- QueryExpressionSelectVBClause selectClause = new QueryExpressionSelectVBClause();
- selectClause.StartLocation = la.Location;
-
- Expect(182);
- ExpressionRangeVariableDeclarationList(
-#line 2139 "VBNET.ATG"
-selectClause.Variables);
-
-#line 2141 "VBNET.ATG"
- selectClause.EndLocation = t.Location;
- middleClauses.Add(selectClause);
-
- }
-
- void DistinctQueryOperator(
-#line 2146 "VBNET.ATG"
-List<QueryExpressionClause> middleClauses) {
-
-#line 2148 "VBNET.ATG"
- QueryExpressionDistinctClause distinctClause = new QueryExpressionDistinctClause();
- distinctClause.StartLocation = la.Location;
-
- Expect(94);
-
-#line 2153 "VBNET.ATG"
- distinctClause.EndLocation = t.EndLocation;
- middleClauses.Add(distinctClause);
-
- }
-
- void WhereQueryOperator(
-#line 2158 "VBNET.ATG"
-List<QueryExpressionClause> middleClauses) {
-
-#line 2160 "VBNET.ATG"
- QueryExpressionWhereClause whereClause = new QueryExpressionWhereClause();
- whereClause.StartLocation = la.Location;
- Expression operand = null;
-
- Expect(215);
- Expr(
-#line 2164 "VBNET.ATG"
-out operand);
-
-#line 2166 "VBNET.ATG"
- whereClause.Condition = operand;
- whereClause.EndLocation = t.EndLocation;
-
- middleClauses.Add(whereClause);
-
- }
-
- void OrderByQueryOperator(
-#line 2056 "VBNET.ATG"
-List<QueryExpressionClause> middleClauses) {
-
-#line 2058 "VBNET.ATG"
- QueryExpressionOrderClause orderClause = new QueryExpressionOrderClause();
- orderClause.StartLocation = la.Location;
- List<QueryExpressionOrdering> orderings = null;
-
- Expect(162);
- Expect(57);
- OrderExpressionList(
-#line 2062 "VBNET.ATG"
-out orderings);
-
-#line 2064 "VBNET.ATG"
- orderClause.Orderings = orderings;
- orderClause.EndLocation = t.EndLocation;
- middleClauses.Add(orderClause);
-
- }
-
- void PartitionQueryOperator(
-#line 2173 "VBNET.ATG"
-out QueryExpressionPartitionVBClause partitionClause) {
-
-#line 2175 "VBNET.ATG"
- partitionClause = new QueryExpressionPartitionVBClause();
- partitionClause.StartLocation = la.Location;
- Expression expr = null;
-
- if (la.kind == 197) {
- lexer.NextToken();
-
-#line 2179 "VBNET.ATG"
- partitionClause.PartitionType = QueryExpressionPartitionType.Take;
- if (la.kind == 216) {
- lexer.NextToken();
-
-#line 2180 "VBNET.ATG"
- partitionClause.PartitionType = QueryExpressionPartitionType.TakeWhile;
- }
- Expr(
-#line 2181 "VBNET.ATG"
-out expr);
- } else if (la.kind == 188) {
- lexer.NextToken();
-
-#line 2182 "VBNET.ATG"
- partitionClause.PartitionType = QueryExpressionPartitionType.Skip;
- if (la.kind == 216) {
- lexer.NextToken();
- }
-
-#line 2183 "VBNET.ATG"
- partitionClause.PartitionType = QueryExpressionPartitionType.SkipWhile;
- Expr(
-#line 2184 "VBNET.ATG"
-out expr);
-
-#line 2186 "VBNET.ATG"
- partitionClause.Expression = expr;
- partitionClause.EndLocation = t.EndLocation;
-
- } else SynErr(266);
- }
-
- void LetQueryOperator(
-#line 2212 "VBNET.ATG"
-List<QueryExpressionClause> middleClauses) {
-
-#line 2214 "VBNET.ATG"
- QueryExpressionLetVBClause letClause = new QueryExpressionLetVBClause();
- letClause.StartLocation = la.Location;
-
- Expect(134);
- ExpressionRangeVariableDeclarationList(
-#line 2217 "VBNET.ATG"
-letClause.Variables);
-
-#line 2219 "VBNET.ATG"
- letClause.EndLocation = t.EndLocation;
- middleClauses.Add(letClause);
-
- }
-
- void JoinQueryOperator(
-#line 2256 "VBNET.ATG"
-out QueryExpressionJoinVBClause joinClause) {
-
-#line 2258 "VBNET.ATG"
- joinClause = new QueryExpressionJoinVBClause();
- joinClause.StartLocation = la.Location;
- QueryExpressionFromClause joinVariable = null;
- QueryExpressionJoinVBClause subJoin = null;
- QueryExpressionJoinConditionVB condition = null;
-
-
- Expect(133);
- CollectionRangeVariableDeclaration(
-#line 2265 "VBNET.ATG"
-out joinVariable);
-
-#line 2266 "VBNET.ATG"
- joinClause.JoinVariable = joinVariable;
- if (la.kind == 133) {
- JoinQueryOperator(
-#line 2268 "VBNET.ATG"
-out subJoin);
-
-#line 2269 "VBNET.ATG"
- joinClause.SubJoin = subJoin;
- }
- Expect(157);
- JoinCondition(
-#line 2272 "VBNET.ATG"
-out condition);
-
-#line 2273 "VBNET.ATG"
- SafeAdd(joinClause, joinClause.Conditions, condition);
- while (la.kind == 47) {
- lexer.NextToken();
- JoinCondition(
-#line 2275 "VBNET.ATG"
-out condition);
-
-#line 2276 "VBNET.ATG"
- SafeAdd(joinClause, joinClause.Conditions, condition);
- }
-
-#line 2279 "VBNET.ATG"
- joinClause.EndLocation = t.EndLocation;
-
- }
-
- void GroupJoinQueryOperator(
-#line 2114 "VBNET.ATG"
-out QueryExpressionGroupJoinVBClause groupJoinClause) {
-
-#line 2116 "VBNET.ATG"
- groupJoinClause = new QueryExpressionGroupJoinVBClause();
- groupJoinClause.StartLocation = la.Location;
- QueryExpressionJoinVBClause joinClause = null;
-
- Expect(120);
- JoinQueryOperator(
-#line 2120 "VBNET.ATG"
-out joinClause);
- Expect(130);
- ExpressionRangeVariableDeclarationList(
-#line 2121 "VBNET.ATG"
-groupJoinClause.IntoVariables);
-
-#line 2123 "VBNET.ATG"
- groupJoinClause.JoinClause = joinClause;
- groupJoinClause.EndLocation = t.EndLocation;
-
- }
-
- void GroupByQueryOperator(
-#line 2101 "VBNET.ATG"
-out QueryExpressionGroupVBClause groupByClause) {
-
-#line 2103 "VBNET.ATG"
- groupByClause = new QueryExpressionGroupVBClause();
- groupByClause.StartLocation = la.Location;
-
- Expect(120);
- ExpressionRangeVariableDeclarationList(
-#line 2106 "VBNET.ATG"
-groupByClause.GroupVariables);
- Expect(57);
- ExpressionRangeVariableDeclarationList(
-#line 2107 "VBNET.ATG"
-groupByClause.ByVariables);
- Expect(130);
- ExpressionRangeVariableDeclarationList(
-#line 2108 "VBNET.ATG"
-groupByClause.IntoVariables);
-
-#line 2110 "VBNET.ATG"
- groupByClause.EndLocation = t.EndLocation;
-
- }
-
- void OrderExpressionList(
-#line 2070 "VBNET.ATG"
-out List<QueryExpressionOrdering> orderings) {
-
-#line 2072 "VBNET.ATG"
- orderings = new List<QueryExpressionOrdering>();
- QueryExpressionOrdering ordering = null;
-
- OrderExpression(
-#line 2075 "VBNET.ATG"
-out ordering);
-
-#line 2076 "VBNET.ATG"
- orderings.Add(ordering);
- while (la.kind == 12) {
- lexer.NextToken();
- OrderExpression(
-#line 2078 "VBNET.ATG"
-out ordering);
-
-#line 2079 "VBNET.ATG"
- orderings.Add(ordering);
- }
- }
-
- void OrderExpression(
-#line 2083 "VBNET.ATG"
-out QueryExpressionOrdering ordering) {
-
-#line 2085 "VBNET.ATG"
- ordering = new QueryExpressionOrdering();
- ordering.StartLocation = la.Location;
- ordering.Direction = QueryExpressionOrderingDirection.None;
- Expression orderExpr = null;
-
- Expr(
-#line 2090 "VBNET.ATG"
-out orderExpr);
-
-#line 2092 "VBNET.ATG"
- ordering.Criteria = orderExpr;
-
- if (la.kind == 51 || la.kind == 91) {
- if (la.kind == 51) {
- lexer.NextToken();
-
-#line 2095 "VBNET.ATG"
- ordering.Direction = QueryExpressionOrderingDirection.Ascending;
- } else {
- lexer.NextToken();
-
-#line 2096 "VBNET.ATG"
- ordering.Direction = QueryExpressionOrderingDirection.Descending;
- }
- }
-
-#line 2098 "VBNET.ATG"
- ordering.EndLocation = t.EndLocation;
- }
-
- void ExpressionRangeVariableDeclarationList(
-#line 2224 "VBNET.ATG"
-List<ExpressionRangeVariable> variables) {
-
-#line 2226 "VBNET.ATG"
- ExpressionRangeVariable variable = null;
-
- ExpressionRangeVariableDeclaration(
-#line 2228 "VBNET.ATG"
-out variable);
-
-#line 2229 "VBNET.ATG"
- variables.Add(variable);
- while (la.kind == 12) {
- lexer.NextToken();
- ExpressionRangeVariableDeclaration(
-#line 2230 "VBNET.ATG"
-out variable);
-
-#line 2230 "VBNET.ATG"
- variables.Add(variable);
- }
- }
-
- void CollectionRangeVariableDeclarationList(
-#line 2283 "VBNET.ATG"
-List<QueryExpressionClause> middleClauses) {
-
-#line 2285 "VBNET.ATG"
- QueryExpressionFromClause fromClause = null;
-
- CollectionRangeVariableDeclaration(
-#line 2287 "VBNET.ATG"
-out fromClause);
-
-#line 2288 "VBNET.ATG"
- middleClauses.Add(fromClause);
- while (la.kind == 12) {
- lexer.NextToken();
- CollectionRangeVariableDeclaration(
-#line 2289 "VBNET.ATG"
-out fromClause);
-
-#line 2289 "VBNET.ATG"
- middleClauses.Add(fromClause);
- }
- }
-
- void CollectionRangeVariableDeclaration(
-#line 2292 "VBNET.ATG"
-out QueryExpressionFromClause fromClause) {
-
-#line 2294 "VBNET.ATG"
- fromClause = new QueryExpressionFromClause();
- fromClause.StartLocation = la.Location;
- TypeReference typeName = null;
- Expression inExpr = null;
-
- Identifier();
- if (la.kind == 50) {
- lexer.NextToken();
- TypeName(
-#line 2300 "VBNET.ATG"
-out typeName);
-
-#line 2300 "VBNET.ATG"
- fromClause.Type = typeName;
- }
- Expect(125);
- Expr(
-#line 2301 "VBNET.ATG"
-out inExpr);
-
-#line 2303 "VBNET.ATG"
- fromClause.InExpression = inExpr;
- fromClause.EndLocation = t.EndLocation;
-
- }
-
- void ExpressionRangeVariableDeclaration(
-#line 2233 "VBNET.ATG"
-out ExpressionRangeVariable variable) {
-
-#line 2235 "VBNET.ATG"
- variable = new ExpressionRangeVariable();
- variable.StartLocation = la.Location;
- Expression rhs = null;
- TypeReference typeName = null;
-
- if (
-#line 2241 "VBNET.ATG"
-IsIdentifiedExpressionRange()) {
- Identifier();
-
-#line 2242 "VBNET.ATG"
- variable.Identifier = t.val;
- if (la.kind == 50) {
- lexer.NextToken();
- TypeName(
-#line 2244 "VBNET.ATG"
-out typeName);
-
-#line 2245 "VBNET.ATG"
- variable.Type = typeName;
- }
- Expect(10);
- }
- Expr(
-#line 2249 "VBNET.ATG"
-out rhs);
-
-#line 2251 "VBNET.ATG"
- variable.Expression = rhs;
- variable.EndLocation = t.EndLocation;
-
- }
-
- void JoinCondition(
-#line 2308 "VBNET.ATG"
-out QueryExpressionJoinConditionVB condition) {
-
-#line 2310 "VBNET.ATG"
- condition = new QueryExpressionJoinConditionVB();
- condition.StartLocation = la.Location;
-
- Expression lhs = null;
- Expression rhs = null;
-
- Expr(
-#line 2316 "VBNET.ATG"
-out lhs);
- Expect(103);
- Expr(
-#line 2316 "VBNET.ATG"
-out rhs);
-
-#line 2318 "VBNET.ATG"
- condition.LeftSide = lhs;
- condition.RightSide = rhs;
- condition.EndLocation = t.EndLocation;
-
- }
-
- void Argument(
-#line 2379 "VBNET.ATG"
-out Expression argumentexpr) {
-
-#line 2381 "VBNET.ATG"
- Expression expr;
- argumentexpr = null;
- string name;
-
- if (
-#line 2385 "VBNET.ATG"
-IsNamedAssign()) {
- Identifier();
-
-#line 2385 "VBNET.ATG"
- name = t.val;
- Expect(11);
- Expect(10);
- Expr(
-#line 2385 "VBNET.ATG"
-out expr);
-
-#line 2387 "VBNET.ATG"
- argumentexpr = new NamedArgumentExpression(name, expr);
-
- } else if (StartOf(29)) {
- Expr(
-#line 2390 "VBNET.ATG"
-out argumentexpr);
- } else SynErr(267);
- }
-
- void QualIdentAndTypeArguments(
-#line 2456 "VBNET.ATG"
-out TypeReference typeref, bool canBeUnbound) {
-
-#line 2457 "VBNET.ATG"
- string name; typeref = null;
- Qualident(
-#line 2459 "VBNET.ATG"
-out name);
-
-#line 2460 "VBNET.ATG"
- typeref = new TypeReference(name);
- if (
-#line 2461 "VBNET.ATG"
-la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of) {
- lexer.NextToken();
- Expect(155);
- if (
-#line 2463 "VBNET.ATG"
-canBeUnbound && (la.kind == Tokens.CloseParenthesis || la.kind == Tokens.Comma)) {
-
-#line 2464 "VBNET.ATG"
- typeref.GenericTypes.Add(NullTypeReference.Instance);
- while (la.kind == 12) {
- lexer.NextToken();
-
-#line 2465 "VBNET.ATG"
- typeref.GenericTypes.Add(NullTypeReference.Instance);
- }
- } else if (StartOf(7)) {
- TypeArgumentList(
-#line 2466 "VBNET.ATG"
-typeref.GenericTypes);
- } else SynErr(268);
- Expect(26);
- }
- }
-
- void RankList(
-#line 2503 "VBNET.ATG"
-out int i) {
-
-#line 2504 "VBNET.ATG"
- i = 0;
- while (la.kind == 12) {
- lexer.NextToken();
-
-#line 2505 "VBNET.ATG"
- ++i;
- }
- }
-
- void Attribute(
-#line 2544 "VBNET.ATG"
-out ASTAttribute attribute) {
-
-#line 2545 "VBNET.ATG"
- string name;
- List<Expression> positional = new List<Expression>();
- List<NamedArgumentExpression> named = new List<NamedArgumentExpression>();
-
- if (la.kind == 117) {
- lexer.NextToken();
- Expect(16);
- }
- Qualident(
-#line 2550 "VBNET.ATG"
-out name);
- if (la.kind == 25) {
- AttributeArguments(
-#line 2551 "VBNET.ATG"
-positional, named);
- }
-
-#line 2553 "VBNET.ATG"
- attribute = new ASTAttribute(name, positional, named);
-
- }
-
- void AttributeArguments(
-#line 2558 "VBNET.ATG"
-List<Expression> positional, List<NamedArgumentExpression> named) {
-
-#line 2560 "VBNET.ATG"
- bool nameFound = false;
- string name = "";
- Expression expr;
-
- Expect(25);
- if (
-#line 2566 "VBNET.ATG"
-IsNotClosingParenthesis()) {
- if (
-#line 2568 "VBNET.ATG"
-IsNamedAssign()) {
-
-#line 2568 "VBNET.ATG"
- nameFound = true;
- IdentifierOrKeyword(
-#line 2569 "VBNET.ATG"
-out name);
- if (la.kind == 11) {
- lexer.NextToken();
- }
- Expect(10);
- }
- Expr(
-#line 2571 "VBNET.ATG"
-out expr);
-
-#line 2573 "VBNET.ATG"
- if (expr != null) {
- if (string.IsNullOrEmpty(name)) { positional.Add(expr); }
- else { named.Add(new NamedArgumentExpression(name, expr)); name = ""; }
- }
-
- while (la.kind == 12) {
- lexer.NextToken();
- if (
-#line 2581 "VBNET.ATG"
-IsNamedAssign()) {
-
-#line 2581 "VBNET.ATG"
- nameFound = true;
- IdentifierOrKeyword(
-#line 2582 "VBNET.ATG"
-out name);
- if (la.kind == 11) {
- lexer.NextToken();
- }
- Expect(10);
- } else if (StartOf(29)) {
-
-#line 2584 "VBNET.ATG"
- if (nameFound) Error("no positional argument after named argument");
- } else SynErr(269);
- Expr(
-#line 2585 "VBNET.ATG"
-out expr);
-
-#line 2585 "VBNET.ATG"
- if (expr != null) { if(name == "") positional.Add(expr);
- else { named.Add(new NamedArgumentExpression(name, expr)); name = ""; }
- }
-
- }
- }
- Expect(26);
- }
-
- void FormalParameter(
-#line 2642 "VBNET.ATG"
-out ParameterDeclarationExpression p) {
-
-#line 2644 "VBNET.ATG"
- AttributeSection section;
- List<AttributeSection> attributes = new List<AttributeSection>();
- TypeReference type = null;
- ParamModifierList mod = new ParamModifierList(this);
- Expression expr = null;
- p = null;
- ArrayList arrayModifiers = null;
-
- while (la.kind == 28) {
- AttributeSection(
-#line 2653 "VBNET.ATG"
-out section);
-
-#line 2653 "VBNET.ATG"
- attributes.Add(section);
- }
- while (StartOf(35)) {
- ParameterModifier(
-#line 2654 "VBNET.ATG"
-mod);
- }
- Identifier();
-
-#line 2655 "VBNET.ATG"
- string parameterName = t.val;
- if (
-#line 2656 "VBNET.ATG"
-IsDims()) {
- ArrayTypeModifiers(
-#line 2656 "VBNET.ATG"
-out arrayModifiers);
- }
- if (la.kind == 50) {
- lexer.NextToken();
- TypeName(
-#line 2657 "VBNET.ATG"
-out type);
- }
-
-#line 2659 "VBNET.ATG"
- if(type != null) {
- if (arrayModifiers != null) {
- if (type.RankSpecifier != null) {
- Error("array rank only allowed one time");
- } else {
- type.RankSpecifier = (int[])arrayModifiers.ToArray(typeof(int));
- }
- }
- } else {
- type = new TypeReference("System.Object", arrayModifiers == null ? null : (int[])arrayModifiers.ToArray(typeof(int)));
- }
-
- if (la.kind == 10) {
- lexer.NextToken();
- Expr(
-#line 2671 "VBNET.ATG"
-out expr);
- }
-
-#line 2673 "VBNET.ATG"
- mod.Check();
- p = new ParameterDeclarationExpression(type, parameterName, mod.Modifier, expr);
- p.Attributes = attributes;
-
- }
-
- void ParameterModifier(
-#line 3355 "VBNET.ATG"
-ParamModifierList m) {
- if (la.kind == 59) {
- lexer.NextToken();
-
-#line 3356 "VBNET.ATG"
- m.Add(ParameterModifiers.In);
- } else if (la.kind == 56) {
- lexer.NextToken();
-
-#line 3357 "VBNET.ATG"
- m.Add(ParameterModifiers.Ref);
- } else if (la.kind == 160) {
- lexer.NextToken();
-
-#line 3358 "VBNET.ATG"
- m.Add(ParameterModifiers.Optional);
- } else if (la.kind == 167) {
- lexer.NextToken();
-
-#line 3359 "VBNET.ATG"
- m.Add(ParameterModifiers.Params);
- } else SynErr(270);
- }
-
- void Statement() {
-
-#line 2702 "VBNET.ATG"
- Statement stmt = null;
- Location startPos = la.Location;
- string label = String.Empty;
-
-
- if (la.kind == 1 || la.kind == 11) {
- } else if (
-#line 2708 "VBNET.ATG"
-IsLabel()) {
- LabelName(
-#line 2708 "VBNET.ATG"
-out label);
-
-#line 2710 "VBNET.ATG"
- compilationUnit.AddChild(new LabelStatement(t.val));
-
- Expect(11);
- Statement();
- } else if (StartOf(36)) {
- EmbeddedStatement(
-#line 2713 "VBNET.ATG"
-out stmt);
-
-#line 2713 "VBNET.ATG"
- compilationUnit.AddChild(stmt);
- } else SynErr(271);
-
-#line 2716 "VBNET.ATG"
- if (stmt != null) {
- stmt.StartLocation = startPos;
- stmt.EndLocation = t.Location;
- }
-
- }
-
- void LabelName(
-#line 3131 "VBNET.ATG"
-out string name) {
-
-#line 3133 "VBNET.ATG"
- name = String.Empty;
-
- if (StartOf(14)) {
- Identifier();
-
-#line 3135 "VBNET.ATG"
- name = t.val;
- } else if (la.kind == 5) {
- lexer.NextToken();
-
-#line 3136 "VBNET.ATG"
- name = t.val;
- } else SynErr(272);
- }
-
- void EmbeddedStatement(
-#line 2755 "VBNET.ATG"
-out Statement statement) {
-
-#line 2757 "VBNET.ATG"
- Statement embeddedStatement = null;
- statement = null;
- Expression expr = null;
- string name = String.Empty;
- List<Expression> p = null;
-
- if (la.kind == 107) {
- lexer.NextToken();
-
-#line 2763 "VBNET.ATG"
- ExitType exitType = ExitType.None;
- switch (la.kind) {
- case 195: {
- lexer.NextToken();
-
-#line 2765 "VBNET.ATG"
- exitType = ExitType.Sub;
- break;
- }
- case 114: {
- lexer.NextToken();
-
-#line 2767 "VBNET.ATG"
- exitType = ExitType.Function;
- break;
- }
- case 171: {
- lexer.NextToken();
-
-#line 2769 "VBNET.ATG"
- exitType = ExitType.Property;
- break;
- }
- case 95: {
- lexer.NextToken();
-
-#line 2771 "VBNET.ATG"
- exitType = ExitType.Do;
- break;
- }
- case 111: {
- lexer.NextToken();
-
-#line 2773 "VBNET.ATG"
- exitType = ExitType.For;
- break;
- }
- case 203: {
- lexer.NextToken();
-
-#line 2775 "VBNET.ATG"
- exitType = ExitType.Try;
- break;
- }
- case 216: {
- lexer.NextToken();
-
-#line 2777 "VBNET.ATG"
- exitType = ExitType.While;
- break;
- }
- case 182: {
- lexer.NextToken();
-
-#line 2779 "VBNET.ATG"
- exitType = ExitType.Select;
- break;
- }
- default: SynErr(273); break;
- }
-
-#line 2781 "VBNET.ATG"
- statement = new ExitStatement(exitType);
- } else if (la.kind == 203) {
- TryStatement(
-#line 2782 "VBNET.ATG"
-out statement);
- } else if (la.kind == 76) {
- lexer.NextToken();
-
-#line 2783 "VBNET.ATG"
- ContinueType continueType = ContinueType.None;
- if (la.kind == 95 || la.kind == 111 || la.kind == 216) {
- if (la.kind == 95) {
- lexer.NextToken();
-
-#line 2783 "VBNET.ATG"
- continueType = ContinueType.Do;
- } else if (la.kind == 111) {
- lexer.NextToken();
-
-#line 2783 "VBNET.ATG"
- continueType = ContinueType.For;
- } else {
- lexer.NextToken();
-
-#line 2783 "VBNET.ATG"
- continueType = ContinueType.While;
- }
- }
-
-#line 2783 "VBNET.ATG"
- statement = new ContinueStatement(continueType);
- } else if (la.kind == 200) {
- lexer.NextToken();
- if (StartOf(29)) {
- Expr(
-#line 2785 "VBNET.ATG"
-out expr);
- }
-
-#line 2785 "VBNET.ATG"
- statement = new ThrowStatement(expr);
- } else if (la.kind == 180) {
- lexer.NextToken();
- if (StartOf(29)) {
- Expr(
-#line 2787 "VBNET.ATG"
-out expr);
- }
-
-#line 2787 "VBNET.ATG"
- statement = new ReturnStatement(expr);
- } else if (la.kind == 196) {
- lexer.NextToken();
- Expr(
-#line 2789 "VBNET.ATG"
-out expr);
- EndOfStmt();
- Block(
-#line 2789 "VBNET.ATG"
-out embeddedStatement);
- Expect(100);
- Expect(196);
-
-#line 2790 "VBNET.ATG"
- statement = new LockStatement(expr, embeddedStatement);
- } else if (la.kind == 174) {
- lexer.NextToken();
- Identifier();
-
-#line 2792 "VBNET.ATG"
- name = t.val;
- if (la.kind == 25) {
- lexer.NextToken();
- if (StartOf(37)) {
- ArgumentList(
-#line 2793 "VBNET.ATG"
-out p);
- }
- Expect(26);
- }
-
-#line 2795 "VBNET.ATG"
- statement = new RaiseEventStatement(name, p);
-
- } else if (la.kind == 218) {
- WithStatement(
-#line 2798 "VBNET.ATG"
-out statement);
- } else if (la.kind == 43) {
- lexer.NextToken();
-
-#line 2800 "VBNET.ATG"
- Expression handlerExpr = null;
- Expr(
-#line 2801 "VBNET.ATG"
-out expr);
- Expect(12);
- Expr(
-#line 2801 "VBNET.ATG"
-out handlerExpr);
-
-#line 2803 "VBNET.ATG"
- statement = new AddHandlerStatement(expr, handlerExpr);
-
- } else if (la.kind == 178) {
- lexer.NextToken();
-
-#line 2806 "VBNET.ATG"
- Expression handlerExpr = null;
- Expr(
-#line 2807 "VBNET.ATG"
-out expr);
- Expect(12);
- Expr(
-#line 2807 "VBNET.ATG"
-out handlerExpr);
-
-#line 2809 "VBNET.ATG"
- statement = new RemoveHandlerStatement(expr, handlerExpr);
-
- } else if (la.kind == 216) {
- lexer.NextToken();
- Expr(
-#line 2812 "VBNET.ATG"
-out expr);
- EndOfStmt();
- Block(
-#line 2813 "VBNET.ATG"
-out embeddedStatement);
- Expect(100);
- Expect(216);
-
-#line 2815 "VBNET.ATG"
- statement = new DoLoopStatement(expr, embeddedStatement, ConditionType.While, ConditionPosition.Start);
-
- } else if (la.kind == 95) {
- lexer.NextToken();
-
-#line 2820 "VBNET.ATG"
- ConditionType conditionType = ConditionType.None;
-
- if (la.kind == 209 || la.kind == 216) {
- WhileOrUntil(
-#line 2823 "VBNET.ATG"
-out conditionType);
- Expr(
-#line 2823 "VBNET.ATG"
-out expr);
- EndOfStmt();
- Block(
-#line 2824 "VBNET.ATG"
-out embeddedStatement);
- Expect(138);
-
-#line 2827 "VBNET.ATG"
- statement = new DoLoopStatement(expr,
- embeddedStatement,
- conditionType == ConditionType.While ? ConditionType.DoWhile : conditionType,
- ConditionPosition.Start);
-
- } else if (la.kind == 1 || la.kind == 11) {
- EndOfStmt();
- Block(
-#line 2834 "VBNET.ATG"
-out embeddedStatement);
- Expect(138);
- if (la.kind == 209 || la.kind == 216) {
- WhileOrUntil(
-#line 2835 "VBNET.ATG"
-out conditionType);
- Expr(
-#line 2835 "VBNET.ATG"
-out expr);
- }
-
-#line 2837 "VBNET.ATG"
- statement = new DoLoopStatement(expr, embeddedStatement, conditionType, ConditionPosition.End);
-
- } else SynErr(274);
- } else if (la.kind == 111) {
- lexer.NextToken();
-
-#line 2842 "VBNET.ATG"
- Expression group = null;
- TypeReference typeReference;
- string typeName;
- Location startLocation = t.Location;
-
- if (la.kind == 97) {
- lexer.NextToken();
- LoopControlVariable(
-#line 2849 "VBNET.ATG"
-out typeReference, out typeName);
- Expect(125);
- Expr(
-#line 2850 "VBNET.ATG"
-out group);
- EndOfStmt();
- Block(
-#line 2851 "VBNET.ATG"
-out embeddedStatement);
- Expect(149);
- if (StartOf(29)) {
- Expr(
-#line 2852 "VBNET.ATG"
-out expr);
- }
-
-#line 2854 "VBNET.ATG"
- statement = new ForeachStatement(typeReference,
- typeName,
- group,
- embeddedStatement,
- expr);
- statement.StartLocation = startLocation;
- statement.EndLocation = t.EndLocation;
-
-
- } else if (StartOf(38)) {
-
-#line 2865 "VBNET.ATG"
- Expression start = null;
- Expression end = null;
- Expression step = null;
- Expression variableExpr = null;
- Expression nextExpr = null;
- List<Expression> nextExpressions = null;
-
- if (
-#line 2872 "VBNET.ATG"
-IsLoopVariableDeclaration()) {
- LoopControlVariable(
-#line 2873 "VBNET.ATG"
-out typeReference, out typeName);
- } else {
-
-#line 2875 "VBNET.ATG"
- typeReference = null; typeName = null;
- SimpleExpr(
-#line 2876 "VBNET.ATG"
-out variableExpr);
- }
- Expect(10);
- Expr(
-#line 2878 "VBNET.ATG"
-out start);
- Expect(201);
- Expr(
-#line 2878 "VBNET.ATG"
-out end);
- if (la.kind == 190) {
- lexer.NextToken();
- Expr(
-#line 2878 "VBNET.ATG"
-out step);
- }
- EndOfStmt();
- Block(
-#line 2879 "VBNET.ATG"
-out embeddedStatement);
- Expect(149);
- if (StartOf(29)) {
- Expr(
-#line 2882 "VBNET.ATG"
-out nextExpr);
-
-#line 2884 "VBNET.ATG"
- nextExpressions = new List<Expression>();
- nextExpressions.Add(nextExpr);
-
- while (la.kind == 12) {
- lexer.NextToken();
- Expr(
-#line 2887 "VBNET.ATG"
-out nextExpr);
-
-#line 2887 "VBNET.ATG"
- nextExpressions.Add(nextExpr);
- }
- }
-
-#line 2890 "VBNET.ATG"
- statement = new ForNextStatement {
- TypeReference = typeReference,
- VariableName = typeName,
- LoopVariableExpression = variableExpr,
- Start = start,
- End = end,
- Step = step,
- EmbeddedStatement = embeddedStatement,
- NextExpressions = nextExpressions
- };
-
- } else SynErr(275);
- } else if (la.kind == 105) {
- lexer.NextToken();
- Expr(
-#line 2903 "VBNET.ATG"
-out expr);
-
-#line 2903 "VBNET.ATG"
- statement = new ErrorStatement(expr);
- } else if (la.kind == 176) {
- lexer.NextToken();
-
-#line 2905 "VBNET.ATG"
- bool isPreserve = false;
- if (la.kind == 169) {
- lexer.NextToken();
-
-#line 2905 "VBNET.ATG"
- isPreserve = true;
- }
- ReDimClause(
-#line 2906 "VBNET.ATG"
-out expr);
-
-#line 2908 "VBNET.ATG"
- ReDimStatement reDimStatement = new ReDimStatement(isPreserve);
- statement = reDimStatement;
- SafeAdd(reDimStatement, reDimStatement.ReDimClauses, expr as InvocationExpression);
-
- while (la.kind == 12) {
- lexer.NextToken();
- ReDimClause(
-#line 2912 "VBNET.ATG"
-out expr);
-
-#line 2913 "VBNET.ATG"
- SafeAdd(reDimStatement, reDimStatement.ReDimClauses, expr as InvocationExpression);
- }
- } else if (la.kind == 104) {
- lexer.NextToken();
- Expr(
-#line 2917 "VBNET.ATG"
-out expr);
-
-#line 2919 "VBNET.ATG"
- EraseStatement eraseStatement = new EraseStatement();
- if (expr != null) { SafeAdd(eraseStatement, eraseStatement.Expressions, expr);}
-
- while (la.kind == 12) {
- lexer.NextToken();
- Expr(
-#line 2922 "VBNET.ATG"
-out expr);
-
-#line 2922 "VBNET.ATG"
- if (expr != null) { SafeAdd(eraseStatement, eraseStatement.Expressions, expr); }
- }
-
-#line 2923 "VBNET.ATG"
- statement = eraseStatement;
- } else if (la.kind == 191) {
- lexer.NextToken();
-
-#line 2925 "VBNET.ATG"
- statement = new StopStatement();
- } else if (
-#line 2927 "VBNET.ATG"
-la.kind == Tokens.If) {
- Expect(122);
-
-#line 2928 "VBNET.ATG"
- Location ifStartLocation = t.Location;
- Expr(
-#line 2928 "VBNET.ATG"
-out expr);
- if (la.kind == 199) {
- lexer.NextToken();
- }
- if (la.kind == 1 || la.kind == 11) {
- EndOfStmt();
- Block(
-#line 2931 "VBNET.ATG"
-out embeddedStatement);
-
-#line 2933 "VBNET.ATG"
- IfElseStatement ifStatement = new IfElseStatement(expr, embeddedStatement);
- ifStatement.StartLocation = ifStartLocation;
- Location elseIfStart;
-
- while (la.kind == 99 ||
-#line 2939 "VBNET.ATG"
-IsElseIf()) {
- if (
-#line 2939 "VBNET.ATG"
-IsElseIf()) {
- Expect(98);
-
-#line 2939 "VBNET.ATG"
- elseIfStart = t.Location;
- Expect(122);
- } else {
- lexer.NextToken();
-
-#line 2940 "VBNET.ATG"
- elseIfStart = t.Location;
- }
-
-#line 2942 "VBNET.ATG"
- Expression condition = null; Statement block = null;
- Expr(
-#line 2943 "VBNET.ATG"
-out condition);
- if (la.kind == 199) {
- lexer.NextToken();
- }
- EndOfStmt();
- Block(
-#line 2944 "VBNET.ATG"
-out block);
-
-#line 2946 "VBNET.ATG"
- ElseIfSection elseIfSection = new ElseIfSection(condition, block);
- elseIfSection.StartLocation = elseIfStart;
- elseIfSection.EndLocation = t.Location;
- elseIfSection.Parent = ifStatement;
- ifStatement.ElseIfSections.Add(elseIfSection);
-
- }
- if (la.kind == 98) {
- lexer.NextToken();
- EndOfStmt();
- Block(
-#line 2955 "VBNET.ATG"
-out embeddedStatement);
-
-#line 2957 "VBNET.ATG"
- ifStatement.FalseStatement.Add(embeddedStatement);
-
- }
- Expect(100);
- Expect(122);
-
-#line 2961 "VBNET.ATG"
- ifStatement.EndLocation = t.Location;
- statement = ifStatement;
-
- } else if (StartOf(39)) {
-
-#line 2966 "VBNET.ATG"
- IfElseStatement ifStatement = new IfElseStatement(expr);
- ifStatement.StartLocation = ifStartLocation;
-
- SingleLineStatementList(
-#line 2969 "VBNET.ATG"
-ifStatement.TrueStatement);
- if (la.kind == 98) {
- lexer.NextToken();
- if (StartOf(39)) {
- SingleLineStatementList(
-#line 2972 "VBNET.ATG"
-ifStatement.FalseStatement);
- }
- }
-
-#line 2974 "VBNET.ATG"
- ifStatement.EndLocation = t.Location; statement = ifStatement;
- } else SynErr(276);
- } else if (la.kind == 182) {
- lexer.NextToken();
- if (la.kind == 61) {
- lexer.NextToken();
- }
- Expr(
-#line 2977 "VBNET.ATG"
-out expr);
- EndOfStmt();
-
-#line 2978 "VBNET.ATG"
- List<SwitchSection> selectSections = new List<SwitchSection>();
- Statement block = null;
-
- while (la.kind == 61) {
-
-#line 2982 "VBNET.ATG"
- List<CaseLabel> caseClauses = null; Location caseLocation = la.Location;
- lexer.NextToken();
- CaseClauses(
-#line 2983 "VBNET.ATG"
-out caseClauses);
- if (
-#line 2983 "VBNET.ATG"
-IsNotStatementSeparator()) {
- lexer.NextToken();
- }
- EndOfStmt();
-
-#line 2985 "VBNET.ATG"
- SwitchSection selectSection = new SwitchSection(caseClauses);
- selectSection.StartLocation = caseLocation;
-
- Block(
-#line 2988 "VBNET.ATG"
-out block);
-
-#line 2990 "VBNET.ATG"
- selectSection.Children = block.Children;
- selectSection.EndLocation = t.EndLocation;
- selectSections.Add(selectSection);
-
- }
-
-#line 2996 "VBNET.ATG"
- statement = new SwitchStatement(expr, selectSections);
-
- Expect(100);
- Expect(182);
- } else if (la.kind == 157) {
-
-#line 2999 "VBNET.ATG"
- OnErrorStatement onErrorStatement = null;
- OnErrorStatement(
-#line 3000 "VBNET.ATG"
-out onErrorStatement);
-
-#line 3000 "VBNET.ATG"
- statement = onErrorStatement;
- } else if (la.kind == 119) {
-
-#line 3001 "VBNET.ATG"
- GotoStatement goToStatement = null;
- GotoStatement(
-#line 3002 "VBNET.ATG"
-out goToStatement);
-
-#line 3002 "VBNET.ATG"
- statement = goToStatement;
- } else if (la.kind == 179) {
-
-#line 3003 "VBNET.ATG"
- ResumeStatement resumeStatement = null;
- ResumeStatement(
-#line 3004 "VBNET.ATG"
-out resumeStatement);
-
-#line 3004 "VBNET.ATG"
- statement = resumeStatement;
- } else if (StartOf(38)) {
-
-#line 3007 "VBNET.ATG"
- Expression val = null;
- AssignmentOperatorType op;
-
- bool mustBeAssignment = la.kind == Tokens.Plus || la.kind == Tokens.Minus ||
- la.kind == Tokens.Not || la.kind == Tokens.Times;
-
- SimpleExpr(
-#line 3013 "VBNET.ATG"
-out expr);
- if (StartOf(40)) {
- AssignmentOperator(
-#line 3015 "VBNET.ATG"
-out op);
- Expr(
-#line 3015 "VBNET.ATG"
-out val);
-
-#line 3015 "VBNET.ATG"
- expr = new AssignmentExpression(expr, op, val);
- } else if (la.kind == 1 || la.kind == 11 || la.kind == 98) {
-
-#line 3016 "VBNET.ATG"
- if (mustBeAssignment) Error("error in assignment.");
- } else SynErr(277);
-
-#line 3019 "VBNET.ATG"
- // a field reference expression that stands alone is a
- // invocation expression without parantheses and arguments
- if(expr is MemberReferenceExpression || expr is IdentifierExpression) {
- expr = new InvocationExpression(expr);
- }
- statement = new ExpressionStatement(expr);
-
- } else if (la.kind == 60) {
- lexer.NextToken();
- SimpleExpr(
-#line 3026 "VBNET.ATG"
-out expr);
-
-#line 3026 "VBNET.ATG"
- statement = new ExpressionStatement(expr);
- } else if (la.kind == 211) {
- lexer.NextToken();
-
-#line 3028 "VBNET.ATG"
- Statement block;
- if (
-#line 3029 "VBNET.ATG"
-Peek(1).kind == Tokens.As) {
-
-#line 3030 "VBNET.ATG"
- LocalVariableDeclaration resourceAquisition = new LocalVariableDeclaration(Modifiers.None);
- VariableDeclarator(
-#line 3031 "VBNET.ATG"
-resourceAquisition.Variables);
- while (la.kind == 12) {
- lexer.NextToken();
- VariableDeclarator(
-#line 3033 "VBNET.ATG"
-resourceAquisition.Variables);
- }
- Block(
-#line 3035 "VBNET.ATG"
-out block);
-
-#line 3037 "VBNET.ATG"
- statement = new UsingStatement(resourceAquisition, block);
-
- } else if (StartOf(29)) {
- Expr(
-#line 3039 "VBNET.ATG"
-out expr);
- Block(
-#line 3040 "VBNET.ATG"
-out block);
-
-#line 3041 "VBNET.ATG"
- statement = new UsingStatement(new ExpressionStatement(expr), block);
- } else SynErr(278);
- Expect(100);
- Expect(211);
- } else if (StartOf(41)) {
- LocalDeclarationStatement(
-#line 3044 "VBNET.ATG"
-out statement);
- } else SynErr(279);
- }
-
- void LocalDeclarationStatement(
-#line 2724 "VBNET.ATG"
-out Statement statement) {
-
-#line 2726 "VBNET.ATG"
- ModifierList m = new ModifierList();
- LocalVariableDeclaration localVariableDeclaration;
- bool dimfound = false;
-
- while (la.kind == 75 || la.kind == 92 || la.kind == 189) {
- if (la.kind == 75) {
- lexer.NextToken();
-
-#line 2732 "VBNET.ATG"
- m.Add(Modifiers.Const, t.Location);
- } else if (la.kind == 189) {
- lexer.NextToken();
-
-#line 2733 "VBNET.ATG"
- m.Add(Modifiers.Static, t.Location);
- } else {
- lexer.NextToken();
-
-#line 2734 "VBNET.ATG"
- dimfound = true;
- }
- }
-
-#line 2737 "VBNET.ATG"
- if(dimfound && (m.Modifier & Modifiers.Const) != 0) {
- Error("Dim is not allowed on constants.");
- }
-
- if(m.isNone && dimfound == false) {
- Error("Const, Dim or Static expected");
- }
-
- localVariableDeclaration = new LocalVariableDeclaration(m.Modifier);
- localVariableDeclaration.StartLocation = t.Location;
-
- VariableDeclarator(
-#line 2748 "VBNET.ATG"
-localVariableDeclaration.Variables);
- while (la.kind == 12) {
- lexer.NextToken();
- VariableDeclarator(
-#line 2749 "VBNET.ATG"
-localVariableDeclaration.Variables);
- }
-
-#line 2751 "VBNET.ATG"
- statement = localVariableDeclaration;
-
- }
-
- void TryStatement(
-#line 3245 "VBNET.ATG"
-out Statement tryStatement) {
-
-#line 3247 "VBNET.ATG"
- Statement blockStmt = null, finallyStmt = null;List<CatchClause> catchClauses = null;
-
- Expect(203);
- EndOfStmt();
- Block(
-#line 3250 "VBNET.ATG"
-out blockStmt);
- if (la.kind == 62 || la.kind == 100 || la.kind == 110) {
- CatchClauses(
-#line 3251 "VBNET.ATG"
-out catchClauses);
- }
- if (la.kind == 110) {
- lexer.NextToken();
- EndOfStmt();
- Block(
-#line 3252 "VBNET.ATG"
-out finallyStmt);
- }
- Expect(100);
- Expect(203);
-
-#line 3255 "VBNET.ATG"
- tryStatement = new TryCatchStatement(blockStmt, catchClauses, finallyStmt);
-
- }
-
- void WithStatement(
-#line 3225 "VBNET.ATG"
-out Statement withStatement) {
-
-#line 3227 "VBNET.ATG"
- Statement blockStmt = null;
- Expression expr = null;
-
- Expect(218);
-
-#line 3230 "VBNET.ATG"
- Location start = t.Location;
- Expr(
-#line 3231 "VBNET.ATG"
-out expr);
- EndOfStmt();
-
-#line 3233 "VBNET.ATG"
- withStatement = new WithStatement(expr);
- withStatement.StartLocation = start;
-
- Block(
-#line 3236 "VBNET.ATG"
-out blockStmt);
-
-#line 3238 "VBNET.ATG"
- ((WithStatement)withStatement).Body = (BlockStatement)blockStmt;
-
- Expect(100);
- Expect(218);
-
-#line 3241 "VBNET.ATG"
- withStatement.EndLocation = t.Location;
- }
-
- void WhileOrUntil(
-#line 3218 "VBNET.ATG"
-out ConditionType conditionType) {
-
-#line 3219 "VBNET.ATG"
- conditionType = ConditionType.None;
- if (la.kind == 216) {
- lexer.NextToken();
-
-#line 3220 "VBNET.ATG"
- conditionType = ConditionType.While;
- } else if (la.kind == 209) {
- lexer.NextToken();
-
-#line 3221 "VBNET.ATG"
- conditionType = ConditionType.Until;
- } else SynErr(280);
- }
-
- void LoopControlVariable(
-#line 3061 "VBNET.ATG"
-out TypeReference type, out string name) {
-
-#line 3062 "VBNET.ATG"
- ArrayList arrayModifiers = null;
- type = null;
-
- Qualident(
-#line 3066 "VBNET.ATG"
-out name);
- if (
-#line 3067 "VBNET.ATG"
-IsDims()) {
- ArrayTypeModifiers(
-#line 3067 "VBNET.ATG"
-out arrayModifiers);
- }
- if (la.kind == 50) {
- lexer.NextToken();
- TypeName(
-#line 3068 "VBNET.ATG"
-out type);
-
-#line 3068 "VBNET.ATG"
- if (name.IndexOf('.') > 0) { Error("No type def for 'for each' member indexer allowed."); }
- }
-
-#line 3070 "VBNET.ATG"
- if (type != null) {
- if(type.RankSpecifier != null && arrayModifiers != null) {
- Error("array rank only allowed one time");
- } else if (arrayModifiers != null) {
- type.RankSpecifier = (int[])arrayModifiers.ToArray(typeof(int));
- }
- }
-
- }
-
- void ReDimClause(
-#line 3140 "VBNET.ATG"
-out Expression expr) {
- SimpleNonInvocationExpression(
-#line 3142 "VBNET.ATG"
-out expr);
- ReDimClauseInternal(
-#line 3143 "VBNET.ATG"
-ref expr);
- }
-
- void SingleLineStatementList(
-#line 3047 "VBNET.ATG"
-List<Statement> list) {
-
-#line 3048 "VBNET.ATG"
- Statement embeddedStatement = null;
- if (la.kind == 100) {
- lexer.NextToken();
-
-#line 3050 "VBNET.ATG"
- embeddedStatement = new EndStatement();
- } else if (StartOf(36)) {
- EmbeddedStatement(
-#line 3051 "VBNET.ATG"
-out embeddedStatement);
- } else SynErr(281);
-
-#line 3052 "VBNET.ATG"
- if (embeddedStatement != null) list.Add(embeddedStatement);
- while (la.kind == 11) {
- lexer.NextToken();
- while (la.kind == 11) {
- lexer.NextToken();
- }
- if (la.kind == 100) {
- lexer.NextToken();
-
-#line 3054 "VBNET.ATG"
- embeddedStatement = new EndStatement();
- } else if (StartOf(36)) {
- EmbeddedStatement(
-#line 3055 "VBNET.ATG"
-out embeddedStatement);
- } else SynErr(282);
-
-#line 3056 "VBNET.ATG"
- if (embeddedStatement != null) list.Add(embeddedStatement);
- }
- }
-
- void CaseClauses(
-#line 3178 "VBNET.ATG"
-out List<CaseLabel> caseClauses) {
-
-#line 3180 "VBNET.ATG"
- caseClauses = new List<CaseLabel>();
- CaseLabel caseClause = null;
-
- CaseClause(
-#line 3183 "VBNET.ATG"
-out caseClause);
-
-#line 3183 "VBNET.ATG"
- if (caseClause != null) { caseClauses.Add(caseClause); }
- while (la.kind == 12) {
- lexer.NextToken();
- CaseClause(
-#line 3184 "VBNET.ATG"
-out caseClause);
-
-#line 3184 "VBNET.ATG"
- if (caseClause != null) { caseClauses.Add(caseClause); }
- }
- }
-
- void OnErrorStatement(
-#line 3081 "VBNET.ATG"
-out OnErrorStatement stmt) {
-
-#line 3083 "VBNET.ATG"
- stmt = null;
- GotoStatement goToStatement = null;
-
- Expect(157);
- Expect(105);
- if (
-#line 3089 "VBNET.ATG"
-IsNegativeLabelName()) {
- Expect(119);
- Expect(18);
- Expect(5);
-
-#line 3091 "VBNET.ATG"
- long intLabel = Int64.Parse(t.val);
- if(intLabel != 1) {
- Error("invalid label in on error statement.");
- }
- stmt = new OnErrorStatement(new GotoStatement((intLabel * -1).ToString()));
-
- } else if (la.kind == 119) {
- GotoStatement(
-#line 3097 "VBNET.ATG"
-out goToStatement);
-
-#line 3099 "VBNET.ATG"
- string val = goToStatement.Label;
-
- // if value is numeric, make sure that is 0
- try {
- long intLabel = Int64.Parse(val);
- if(intLabel != 0) {
- Error("invalid label in on error statement.");
- }
- } catch {
- }
- stmt = new OnErrorStatement(goToStatement);
-
- } else if (la.kind == 179) {
- lexer.NextToken();
- Expect(149);
-
-#line 3113 "VBNET.ATG"
- stmt = new OnErrorStatement(new ResumeStatement(true));
-
- } else SynErr(283);
- }
-
- void GotoStatement(
-#line 3119 "VBNET.ATG"
-out GotoStatement goToStatement) {
-
-#line 3121 "VBNET.ATG"
- string label = String.Empty;
-
- Expect(119);
- LabelName(
-#line 3124 "VBNET.ATG"
-out label);
-
-#line 3126 "VBNET.ATG"
- goToStatement = new GotoStatement(label);
-
- }
-
- void ResumeStatement(
-#line 3167 "VBNET.ATG"
-out ResumeStatement resumeStatement) {
-
-#line 3169 "VBNET.ATG"
- resumeStatement = null;
- string label = String.Empty;
-
- if (
-#line 3172 "VBNET.ATG"
-IsResumeNext()) {
- Expect(179);
- Expect(149);
-
-#line 3173 "VBNET.ATG"
- resumeStatement = new ResumeStatement(true);
- } else if (la.kind == 179) {
- lexer.NextToken();
- if (StartOf(42)) {
- LabelName(
-#line 3174 "VBNET.ATG"
-out label);
- }
-
-#line 3174 "VBNET.ATG"
- resumeStatement = new ResumeStatement(label);
- } else SynErr(284);
- }
-
- void ReDimClauseInternal(
-#line 3146 "VBNET.ATG"
-ref Expression expr) {
-
-#line 3147 "VBNET.ATG"
- List<Expression> arguments; bool canBeNormal; bool canBeRedim; string name;
- while (la.kind == 16 ||
-#line 3150 "VBNET.ATG"
-la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of) {
- if (la.kind == 16) {
- lexer.NextToken();
- IdentifierOrKeyword(
-#line 3149 "VBNET.ATG"
-out name);
-
-#line 3149 "VBNET.ATG"
- expr = new MemberReferenceExpression(expr, name);
- } else {
- InvocationExpression(
-#line 3151 "VBNET.ATG"
-ref expr);
- }
- }
- Expect(25);
- NormalOrReDimArgumentList(
-#line 3154 "VBNET.ATG"
-out arguments, out canBeNormal, out canBeRedim);
- Expect(26);
-
-#line 3156 "VBNET.ATG"
- expr = new InvocationExpression(expr, arguments);
- if (canBeRedim == false || canBeNormal && (la.kind == Tokens.Dot || la.kind == Tokens.OpenParenthesis)) {
- if (this.Errors.Count == 0) {
- // don't recurse on parse errors - could result in endless recursion
- ReDimClauseInternal(ref expr);
- }
- }
-
- }
-
- void CaseClause(
-#line 3188 "VBNET.ATG"
-out CaseLabel caseClause) {
-
-#line 3190 "VBNET.ATG"
- Expression expr = null;
- Expression sexpr = null;
- BinaryOperatorType op = BinaryOperatorType.None;
- caseClause = null;
-
- if (la.kind == 98) {
- lexer.NextToken();
-
-#line 3196 "VBNET.ATG"
- caseClause = new CaseLabel();
- } else if (StartOf(43)) {
- if (la.kind == 131) {
- lexer.NextToken();
- }
- switch (la.kind) {
- case 28: {
- lexer.NextToken();
-
-#line 3200 "VBNET.ATG"
- op = BinaryOperatorType.LessThan;
- break;
- }
- case 27: {
- lexer.NextToken();
-
-#line 3201 "VBNET.ATG"
- op = BinaryOperatorType.GreaterThan;
- break;
- }
- case 31: {
- lexer.NextToken();
-
-#line 3202 "VBNET.ATG"
- op = BinaryOperatorType.LessThanOrEqual;
- break;
- }
- case 30: {
- lexer.NextToken();
-
-#line 3203 "VBNET.ATG"
- op = BinaryOperatorType.GreaterThanOrEqual;
- break;
- }
- case 10: {
- lexer.NextToken();
-
-#line 3204 "VBNET.ATG"
- op = BinaryOperatorType.Equality;
- break;
- }
- case 29: {
- lexer.NextToken();
-
-#line 3205 "VBNET.ATG"
- op = BinaryOperatorType.InEquality;
- break;
- }
- default: SynErr(285); break;
- }
- Expr(
-#line 3207 "VBNET.ATG"
-out expr);
-
-#line 3209 "VBNET.ATG"
- caseClause = new CaseLabel(op, expr);
-
- } else if (StartOf(29)) {
- Expr(
-#line 3211 "VBNET.ATG"
-out expr);
- if (la.kind == 201) {
- lexer.NextToken();
- Expr(
-#line 3211 "VBNET.ATG"
-out sexpr);
- }
-
-#line 3213 "VBNET.ATG"
- caseClause = new CaseLabel(expr, sexpr);
-
- } else SynErr(286);
- }
-
- void CatchClauses(
-#line 3260 "VBNET.ATG"
-out List<CatchClause> catchClauses) {
-
-#line 3262 "VBNET.ATG"
- catchClauses = new List<CatchClause>();
- TypeReference type = null;
- Statement blockStmt = null;
- Expression expr = null;
- string name = String.Empty;
-
- while (la.kind == 62) {
- lexer.NextToken();
- if (StartOf(14)) {
- Identifier();
-
-#line 3270 "VBNET.ATG"
- name = t.val;
- if (la.kind == 50) {
- lexer.NextToken();
- TypeName(
-#line 3270 "VBNET.ATG"
-out type);
- }
- }
- if (la.kind == 214) {
- lexer.NextToken();
- Expr(
-#line 3271 "VBNET.ATG"
-out expr);
- }
- EndOfStmt();
- Block(
-#line 3273 "VBNET.ATG"
-out blockStmt);
-
-#line 3274 "VBNET.ATG"
- catchClauses.Add(new CatchClause(type, name, blockStmt, expr));
- }
- }
-
-
-
- void ParseRoot()
- {
- VBNET();
-
- }
-
- protected override void SynErr(int line, int col, int errorNumber)
- {
- string s;
- switch (errorNumber) {
- case 0: s = "EOF expected"; break;
- case 1: s = "EOL expected"; break;
- case 2: s = "ident expected"; break;
- case 3: s = "LiteralString expected"; break;
- case 4: s = "LiteralCharacter expected"; break;
- case 5: s = "LiteralInteger expected"; break;
- case 6: s = "LiteralDouble expected"; break;
- case 7: s = "LiteralSingle expected"; break;
- case 8: s = "LiteralDecimal expected"; break;
- case 9: s = "LiteralDate expected"; break;
- case 10: s = "\"=\" expected"; break;
- case 11: s = "\":\" expected"; break;
- case 12: s = "\",\" expected"; break;
- case 13: s = "\"&\" expected"; break;
- case 14: s = "\"/\" expected"; break;
- case 15: s = "\"\\\\\" expected"; break;
- case 16: s = "\".\" expected"; break;
- case 17: s = "\"!\" expected"; break;
- case 18: s = "\"-\" expected"; break;
- case 19: s = "\"+\" expected"; break;
- case 20: s = "\"^\" expected"; break;
- case 21: s = "\"?\" expected"; break;
- case 22: s = "\"*\" expected"; break;
- case 23: s = "\"{\" expected"; break;
- case 24: s = "\"}\" expected"; break;
- case 25: s = "\"(\" expected"; break;
- case 26: s = "\")\" expected"; break;
- case 27: s = "\">\" expected"; break;
- case 28: s = "\"<\" expected"; break;
- case 29: s = "\"<>\" expected"; break;
- case 30: s = "\">=\" expected"; break;
- case 31: s = "\"<=\" expected"; break;
- case 32: s = "\"<<\" expected"; break;
- case 33: s = "\">>\" expected"; break;
- case 34: s = "\"+=\" expected"; break;
- case 35: s = "\"^=\" expected"; break;
- case 36: s = "\"-=\" expected"; break;
- case 37: s = "\"*=\" expected"; break;
- case 38: s = "\"/=\" expected"; break;
- case 39: s = "\"\\\\=\" expected"; break;
- case 40: s = "\"<<=\" expected"; break;
- case 41: s = "\">>=\" expected"; break;
- case 42: s = "\"&=\" expected"; break;
- case 43: s = "\"AddHandler\" expected"; break;
- case 44: s = "\"AddressOf\" expected"; break;
- case 45: s = "\"Aggregate\" expected"; break;
- case 46: s = "\"Alias\" expected"; break;
- case 47: s = "\"And\" expected"; break;
- case 48: s = "\"AndAlso\" expected"; break;
- case 49: s = "\"Ansi\" expected"; break;
- case 50: s = "\"As\" expected"; break;
- case 51: s = "\"Ascending\" expected"; break;
- case 52: s = "\"Assembly\" expected"; break;
- case 53: s = "\"Auto\" expected"; break;
- case 54: s = "\"Binary\" expected"; break;
- case 55: s = "\"Boolean\" expected"; break;
- case 56: s = "\"ByRef\" expected"; break;
- case 57: s = "\"By\" expected"; break;
- case 58: s = "\"Byte\" expected"; break;
- case 59: s = "\"ByVal\" expected"; break;
- case 60: s = "\"Call\" expected"; break;
- case 61: s = "\"Case\" expected"; break;
- case 62: s = "\"Catch\" expected"; break;
- case 63: s = "\"CBool\" expected"; break;
- case 64: s = "\"CByte\" expected"; break;
- case 65: s = "\"CChar\" expected"; break;
- case 66: s = "\"CDate\" expected"; break;
- case 67: s = "\"CDbl\" expected"; break;
- case 68: s = "\"CDec\" expected"; break;
- case 69: s = "\"Char\" expected"; break;
- case 70: s = "\"CInt\" expected"; break;
- case 71: s = "\"Class\" expected"; break;
- case 72: s = "\"CLng\" expected"; break;
- case 73: s = "\"CObj\" expected"; break;
- case 74: s = "\"Compare\" expected"; break;
- case 75: s = "\"Const\" expected"; break;
- case 76: s = "\"Continue\" expected"; break;
- case 77: s = "\"CSByte\" expected"; break;
- case 78: s = "\"CShort\" expected"; break;
- case 79: s = "\"CSng\" expected"; break;
- case 80: s = "\"CStr\" expected"; break;
- case 81: s = "\"CType\" expected"; break;
- case 82: s = "\"CUInt\" expected"; break;
- case 83: s = "\"CULng\" expected"; break;
- case 84: s = "\"CUShort\" expected"; break;
- case 85: s = "\"Custom\" expected"; break;
- case 86: s = "\"Date\" expected"; break;
- case 87: s = "\"Decimal\" expected"; break;
- case 88: s = "\"Declare\" expected"; break;
- case 89: s = "\"Default\" expected"; break;
- case 90: s = "\"Delegate\" expected"; break;
- case 91: s = "\"Descending\" expected"; break;
- case 92: s = "\"Dim\" expected"; break;
- case 93: s = "\"DirectCast\" expected"; break;
- case 94: s = "\"Distinct\" expected"; break;
- case 95: s = "\"Do\" expected"; break;
- case 96: s = "\"Double\" expected"; break;
- case 97: s = "\"Each\" expected"; break;
- case 98: s = "\"Else\" expected"; break;
- case 99: s = "\"ElseIf\" expected"; break;
- case 100: s = "\"End\" expected"; break;
- case 101: s = "\"EndIf\" expected"; break;
- case 102: s = "\"Enum\" expected"; break;
- case 103: s = "\"Equals\" expected"; break;
- case 104: s = "\"Erase\" expected"; break;
- case 105: s = "\"Error\" expected"; break;
- case 106: s = "\"Event\" expected"; break;
- case 107: s = "\"Exit\" expected"; break;
- case 108: s = "\"Explicit\" expected"; break;
- case 109: s = "\"False\" expected"; break;
- case 110: s = "\"Finally\" expected"; break;
- case 111: s = "\"For\" expected"; break;
- case 112: s = "\"Friend\" expected"; break;
- case 113: s = "\"From\" expected"; break;
- case 114: s = "\"Function\" expected"; break;
- case 115: s = "\"Get\" expected"; break;
- case 116: s = "\"GetType\" expected"; break;
- case 117: s = "\"Global\" expected"; break;
- case 118: s = "\"GoSub\" expected"; break;
- case 119: s = "\"GoTo\" expected"; break;
- case 120: s = "\"Group\" expected"; break;
- case 121: s = "\"Handles\" expected"; break;
- case 122: s = "\"If\" expected"; break;
- case 123: s = "\"Implements\" expected"; break;
- case 124: s = "\"Imports\" expected"; break;
- case 125: s = "\"In\" expected"; break;
- case 126: s = "\"Infer\" expected"; break;
- case 127: s = "\"Inherits\" expected"; break;
- case 128: s = "\"Integer\" expected"; break;
- case 129: s = "\"Interface\" expected"; break;
- case 130: s = "\"Into\" expected"; break;
- case 131: s = "\"Is\" expected"; break;
- case 132: s = "\"IsNot\" expected"; break;
- case 133: s = "\"Join\" expected"; break;
- case 134: s = "\"Let\" expected"; break;
- case 135: s = "\"Lib\" expected"; break;
- case 136: s = "\"Like\" expected"; break;
- case 137: s = "\"Long\" expected"; break;
- case 138: s = "\"Loop\" expected"; break;
- case 139: s = "\"Me\" expected"; break;
- case 140: s = "\"Mod\" expected"; break;
- case 141: s = "\"Module\" expected"; break;
- case 142: s = "\"MustInherit\" expected"; break;
- case 143: s = "\"MustOverride\" expected"; break;
- case 144: s = "\"MyBase\" expected"; break;
- case 145: s = "\"MyClass\" expected"; break;
- case 146: s = "\"Namespace\" expected"; break;
- case 147: s = "\"Narrowing\" expected"; break;
- case 148: s = "\"New\" expected"; break;
- case 149: s = "\"Next\" expected"; break;
- case 150: s = "\"Not\" expected"; break;
- case 151: s = "\"Nothing\" expected"; break;
- case 152: s = "\"NotInheritable\" expected"; break;
- case 153: s = "\"NotOverridable\" expected"; break;
- case 154: s = "\"Object\" expected"; break;
- case 155: s = "\"Of\" expected"; break;
- case 156: s = "\"Off\" expected"; break;
- case 157: s = "\"On\" expected"; break;
- case 158: s = "\"Operator\" expected"; break;
- case 159: s = "\"Option\" expected"; break;
- case 160: s = "\"Optional\" expected"; break;
- case 161: s = "\"Or\" expected"; break;
- case 162: s = "\"Order\" expected"; break;
- case 163: s = "\"OrElse\" expected"; break;
- case 164: s = "\"Overloads\" expected"; break;
- case 165: s = "\"Overridable\" expected"; break;
- case 166: s = "\"Overrides\" expected"; break;
- case 167: s = "\"ParamArray\" expected"; break;
- case 168: s = "\"Partial\" expected"; break;
- case 169: s = "\"Preserve\" expected"; break;
- case 170: s = "\"Private\" expected"; break;
- case 171: s = "\"Property\" expected"; break;
- case 172: s = "\"Protected\" expected"; break;
- case 173: s = "\"Public\" expected"; break;
- case 174: s = "\"RaiseEvent\" expected"; break;
- case 175: s = "\"ReadOnly\" expected"; break;
- case 176: s = "\"ReDim\" expected"; break;
- case 177: s = "\"Rem\" expected"; break;
- case 178: s = "\"RemoveHandler\" expected"; break;
- case 179: s = "\"Resume\" expected"; break;
- case 180: s = "\"Return\" expected"; break;
- case 181: s = "\"SByte\" expected"; break;
- case 182: s = "\"Select\" expected"; break;
- case 183: s = "\"Set\" expected"; break;
- case 184: s = "\"Shadows\" expected"; break;
- case 185: s = "\"Shared\" expected"; break;
- case 186: s = "\"Short\" expected"; break;
- case 187: s = "\"Single\" expected"; break;
- case 188: s = "\"Skip\" expected"; break;
- case 189: s = "\"Static\" expected"; break;
- case 190: s = "\"Step\" expected"; break;
- case 191: s = "\"Stop\" expected"; break;
- case 192: s = "\"Strict\" expected"; break;
- case 193: s = "\"String\" expected"; break;
- case 194: s = "\"Structure\" expected"; break;
- case 195: s = "\"Sub\" expected"; break;
- case 196: s = "\"SyncLock\" expected"; break;
- case 197: s = "\"Take\" expected"; break;
- case 198: s = "\"Text\" expected"; break;
- case 199: s = "\"Then\" expected"; break;
- case 200: s = "\"Throw\" expected"; break;
- case 201: s = "\"To\" expected"; break;
- case 202: s = "\"True\" expected"; break;
- case 203: s = "\"Try\" expected"; break;
- case 204: s = "\"TryCast\" expected"; break;
- case 205: s = "\"TypeOf\" expected"; break;
- case 206: s = "\"UInteger\" expected"; break;
- case 207: s = "\"ULong\" expected"; break;
- case 208: s = "\"Unicode\" expected"; break;
- case 209: s = "\"Until\" expected"; break;
- case 210: s = "\"UShort\" expected"; break;
- case 211: s = "\"Using\" expected"; break;
- case 212: s = "\"Variant\" expected"; break;
- case 213: s = "\"Wend\" expected"; break;
- case 214: s = "\"When\" expected"; break;
- case 215: s = "\"Where\" expected"; break;
- case 216: s = "\"While\" expected"; break;
- case 217: s = "\"Widening\" expected"; break;
- case 218: s = "\"With\" expected"; break;
- case 219: s = "\"WithEvents\" expected"; break;
- case 220: s = "\"WriteOnly\" expected"; break;
- case 221: s = "\"Xor\" expected"; break;
- case 222: s = "??? expected"; break;
- case 223: s = "invalid EndOfStmt"; break;
- case 224: s = "invalid OptionStmt"; break;
- case 225: s = "invalid OptionStmt"; break;
- case 226: s = "invalid GlobalAttributeSection"; break;
- case 227: s = "invalid GlobalAttributeSection"; break;
- case 228: s = "invalid NamespaceMemberDecl"; break;
- case 229: s = "invalid OptionValue"; break;
- case 230: s = "invalid TypeModifier"; break;
- case 231: s = "invalid NonModuleDeclaration"; break;
- case 232: s = "invalid NonModuleDeclaration"; break;
- case 233: s = "invalid Identifier"; break;
- case 234: s = "invalid TypeParameterConstraints"; break;
- case 235: s = "invalid TypeParameterConstraint"; break;
- case 236: s = "invalid NonArrayTypeName"; break;
- case 237: s = "invalid MemberModifier"; break;
- case 238: s = "invalid StructureMemberDecl"; break;
- case 239: s = "invalid StructureMemberDecl"; break;
- case 240: s = "invalid StructureMemberDecl"; break;
- case 241: s = "invalid StructureMemberDecl"; break;
- case 242: s = "invalid StructureMemberDecl"; break;
- case 243: s = "invalid StructureMemberDecl"; break;
- case 244: s = "invalid StructureMemberDecl"; break;
- case 245: s = "invalid InterfaceMemberDecl"; break;
- case 246: s = "invalid InterfaceMemberDecl"; break;
- case 247: s = "invalid Expr"; break;
- case 248: s = "invalid Charset"; break;
- case 249: s = "invalid IdentifierForFieldDeclaration"; break;
- case 250: s = "invalid VariableDeclaratorPartAfterIdentifier"; break;
- case 251: s = "invalid AccessorDecls"; break;
- case 252: s = "invalid EventAccessorDeclaration"; break;
- case 253: s = "invalid OverloadableOperator"; break;
- case 254: s = "invalid VariableInitializer"; break;
- case 255: s = "invalid EventMemberSpecifier"; break;
- case 256: s = "invalid AssignmentOperator"; break;
- case 257: s = "invalid SimpleNonInvocationExpression"; break;
- case 258: s = "invalid SimpleNonInvocationExpression"; break;
- case 259: s = "invalid SimpleNonInvocationExpression"; break;
- case 260: s = "invalid SimpleNonInvocationExpression"; break;
- case 261: s = "invalid PrimitiveTypeName"; break;
- case 262: s = "invalid CastTarget"; break;
- case 263: s = "invalid ComparisonExpr"; break;
- case 264: s = "invalid FromOrAggregateQueryOperator"; break;
- case 265: s = "invalid QueryOperator"; break;
- case 266: s = "invalid PartitionQueryOperator"; break;
- case 267: s = "invalid Argument"; break;
- case 268: s = "invalid QualIdentAndTypeArguments"; break;
- case 269: s = "invalid AttributeArguments"; break;
- case 270: s = "invalid ParameterModifier"; break;
- case 271: s = "invalid Statement"; break;
- case 272: s = "invalid LabelName"; break;
- case 273: s = "invalid EmbeddedStatement"; break;
- case 274: s = "invalid EmbeddedStatement"; break;
- case 275: s = "invalid EmbeddedStatement"; break;
- case 276: s = "invalid EmbeddedStatement"; break;
- case 277: s = "invalid EmbeddedStatement"; break;
- case 278: s = "invalid EmbeddedStatement"; break;
- case 279: s = "invalid EmbeddedStatement"; break;
- case 280: s = "invalid WhileOrUntil"; break;
- case 281: s = "invalid SingleLineStatementList"; break;
- case 282: s = "invalid SingleLineStatementList"; break;
- case 283: s = "invalid OnErrorStatement"; break;
- case 284: s = "invalid ResumeStatement"; break;
- case 285: s = "invalid CaseClause"; break;
- case 286: s = "invalid CaseClause"; break;
-
- default: s = "error " + errorNumber; break;
- }
- this.Errors.Error(line, col, s);
- }
-
- private bool StartOf(int s)
- {
- return set[s, lexer.LookAhead.kind];
- }
-
- static bool[,] set = {
- {T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,T,T,x, x,x,T,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,T,x, T,T,x,x, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,T,T,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,T,x, T,T,x,x, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,T,x, T,T,x,x, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x},
- {x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,T,x,T, T,T,T,x, T,T,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,T, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, T,x,x,x, x,T,x,x, x,x,x,x, T,x,x,x, x,x,T,x, x,x,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, T,x,T,x, x,x,x,T, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,T,T,x, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,T, x,x,x,x, x,x,x,x},
- {x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,T,x,T, T,T,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, T,x,x,x, x,T,x,x, x,x,x,x, T,x,x,x, x,x,T,x, x,x,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,T,T,x, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,T, x,x,x,x, x,x,x,x},
- {x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,T,x,T, T,T,T,T, x,T,T,x, x,x,x,x, x,x,x,x, x,T,x,T, x,x,T,x, x,x,x,x, x,x,x,x, x,T,T,T, x,x,x,T, x,x,T,x, T,x,x,x, x,x,x,T, x,x,x,x, T,x,x,x, x,T,x,x, x,T,x,x, T,x,x,x, x,x,T,x, T,x,T,x, x,T,x,x, x,T,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,T,x, T,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,T,T, T,x,x,x, x,T,T,x, x,T,T,x, x,x,x,x, x,x,T,T, T,T,T,x, x,x,x,T, x,x,x,x, x,x,x,x},
- {x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,T,x,T, T,T,T,T, x,T,T,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,T,T,T, x,x,x,T, x,x,T,x, T,x,x,x, x,x,x,T, x,x,x,x, T,x,x,x, x,T,x,x, x,T,x,x, T,x,x,x, x,x,T,x, T,x,T,x, x,T,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, T,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,T,T, T,x,x,x, x,T,x,x, x,T,T,x, x,x,x,x, x,x,T,T, T,T,T,x, x,x,x,T, x,x,x,x, x,x,x,x},
- {x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,T,x,T, T,T,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,T,T, x,x,x,x, x,x,x,x, x,T,x,x, T,T,T,T, T,x,T,x, x,x,x,x, x,x,T,T, x,x,T,x, T,x,x,x, T,T,T,x, x,x,x,x, T,x,x,x, x,x,T,x, x,T,T,x, x,T,x,x, x,x,x,x, x,T,T,T, x,x,x,T, x,x,x,x, T,T,x,x, T,x,T,x, x,x,T,x, T,T,T,x, T,T,T,T, T,T,x,T, x,x,x,x, x,x,x,x, T,T,x,x, T,x,x,x, x,x,T,T, x,T,T,x, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,T, x,T,x,T, T,x,x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,T, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,x, x,x,x,x, T,T,T,x, T,x,T,x, T,T,x,T, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,x,x,x},
- {x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,T,x,T, T,T,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,T, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, T,x,x,x, x,T,x,x, x,T,x,x, T,x,x,x, x,x,T,x, x,x,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,T,T,x, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,T, x,x,x,x, x,x,x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,T,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,T, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,T,T, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,T,T, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x},
- {x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,T,x,T, T,T,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,T, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, T,x,x,x, x,T,x,x, x,x,x,x, T,x,x,x, x,x,T,x, x,x,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,T,T,x, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,T, x,x,x,x, x,x,x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,T,x, T,x,x,x, x,x,x,x, x,x,T,x, x,x,T,x, x,x,x,x, T,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,T,T,T, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,x, x,x,x,x, T,T,T,x, T,x,T,T, T,T,x,T, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,x, x,x,T,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,x,x,x},
- {x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,T,x,T, T,T,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,T, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, T,x,x,x, x,T,x,x, x,x,x,x, T,x,x,x, x,x,T,x, x,x,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,T,T,x, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,T, x,x,x,x, x,x,x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x},
- {x,T,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, T,T,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, T,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,T, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,x, x,x,x,x, T,T,T,x, T,x,T,T, T,T,x,T, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,x,x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x},
- {x,x,T,T, T,T,T,T, T,T,x,x, x,x,x,x, T,x,T,T, x,x,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,x,x, x,T,x,T, T,T,T,T, x,T,T,x, x,x,x,T, T,T,T,T, T,T,T,x, T,T,T,x, x,T,T,T, T,T,T,T, T,T,T,T, x,x,x,T, x,T,T,x, T,x,x,x, x,x,x,T, x,x,x,x, T,T,x,x, x,T,x,x, T,T,x,x, T,x,T,x, x,x,T,x, T,x,T,x, x,T,x,x, x,T,x,T, x,x,x,x, T,T,x,x, T,x,T,T, x,x,T,x, T,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,T,T, T,x,x,x, x,T,x,x, x,T,T,x, x,x,T,x, T,T,T,T, T,T,T,x, x,x,x,T, x,x,x,x, x,x,x,x},
- {x,T,T,T, T,T,T,T, T,T,x,T, x,x,x,x, T,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,T,x,x, x,T,x,T, T,T,T,T, x,T,T,x, T,x,x,T, T,T,T,T, T,T,T,x, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, x,x,x,T, T,T,T,T, T,x,x,x, x,x,x,T, T,T,x,T, T,T,x,T, x,T,x,x, T,T,x,T, T,x,T,x, x,x,T,x, T,x,T,x, x,T,x,x, x,T,x,T, x,x,x,x, T,T,x,x, T,x,x,T, x,x,T,x, T,T,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,T,x, T,x,T,T, T,T,T,x, x,x,T,T, T,T,x,T, x,T,x,x, T,T,T,x, T,x,T,T, T,T,T,T, T,T,T,T, x,x,x,T, T,x,T,x, x,x,x,x},
- {x,T,T,T, T,T,T,T, T,T,T,T, T,x,x,x, T,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,T,x,x, x,T,T,T, T,T,T,T, x,T,T,x, T,x,x,T, T,T,T,T, T,T,T,x, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, x,x,x,T, T,T,T,T, T,x,T,x, T,x,x,T, T,T,x,T, T,T,x,T, x,T,x,x, T,T,x,T, T,x,T,x, x,x,T,x, T,x,T,x, x,T,x,x, x,T,x,T, x,x,x,x, T,T,x,x, T,x,x,T, x,x,T,x, T,T,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,T,x, T,x,T,T, T,T,T,x, x,x,T,T, T,T,x,T, x,T,x,x, T,T,T,x, T,x,T,T, T,T,T,T, T,T,T,T, x,x,x,T, T,x,T,x, x,x,x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, T,T,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, T,T,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x},
- {x,x,T,T, T,T,T,T, T,T,x,x, x,x,x,x, T,x,T,T, x,x,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,x,x, x,T,x,T, T,T,T,T, x,T,T,x, x,x,x,T, T,T,T,T, T,T,T,x, T,T,T,x, x,T,T,T, T,T,T,T, T,T,T,T, x,x,x,T, x,T,T,x, T,x,x,x, x,x,x,T, x,x,x,x, T,T,x,x, x,T,T,x, T,T,x,x, T,x,T,x, x,x,T,x, T,x,T,x, x,T,x,x, x,T,x,T, x,x,x,x, T,T,x,x, T,x,T,T, x,x,T,x, T,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,T,T, T,x,x,x, x,T,x,x, x,T,T,x, x,x,T,x, T,T,T,T, T,T,T,x, x,x,x,T, x,x,x,x, x,x,x,x},
- {x,x,T,T, T,T,T,T, T,T,x,x, x,x,x,x, T,x,T,T, x,x,T,T, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,x,x, x,T,x,T, T,T,T,T, x,T,T,x, x,x,x,T, T,T,T,T, T,T,T,x, T,T,T,x, x,T,T,T, T,T,T,T, T,T,T,T, x,x,x,T, x,T,T,x, T,x,x,x, x,x,x,T, x,x,x,x, T,T,x,x, x,T,T,x, T,T,x,x, T,x,T,x, x,x,T,x, T,x,T,x, x,T,x,x, x,T,x,T, x,x,x,x, T,T,x,x, T,x,T,T, x,x,T,x, T,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,T,T, T,x,x,x, x,T,x,x, x,T,T,x, x,x,T,x, T,T,T,T, T,T,T,x, x,x,x,T, x,x,x,x, x,x,x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,T,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, T,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x},
- {x,x,T,T, T,T,T,T, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,x,x, x,T,x,T, T,T,T,T, x,T,T,x, x,x,x,T, T,T,T,T, T,T,T,x, T,T,T,x, x,T,T,T, T,T,T,T, T,T,T,T, x,x,x,T, x,T,T,x, T,x,x,x, x,x,x,T, x,x,x,x, T,T,x,x, x,T,x,x, T,T,x,x, T,x,T,x, x,x,T,x, T,x,T,x, x,T,x,x, x,T,x,T, x,x,x,x, T,T,x,x, T,x,x,T, x,x,T,x, T,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,T,T, T,x,x,x, x,T,x,x, x,T,T,x, x,x,T,x, T,T,T,T, T,T,T,x, x,x,x,T, x,x,x,x, x,x,x,x},
- {x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,T,T,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x},
- {x,x,T,T, T,T,T,T, T,T,x,x, x,x,x,x, T,x,T,T, x,x,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,x,x, x,T,x,T, T,T,T,T, x,T,T,x, x,x,x,T, T,T,T,T, T,T,T,x, T,T,T,x, x,T,T,T, T,T,T,T, T,T,T,T, x,x,x,T, x,T,T,x, T,x,x,x, x,x,x,T, x,x,x,x, T,T,x,x, x,T,x,x, T,T,x,x, T,x,T,x, x,x,T,x, T,x,T,x, x,T,x,x, x,T,x,T, x,x,x,x, T,T,x,x, T,x,x,T, x,x,T,x, T,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,T,T, T,x,x,x, x,T,x,x, x,T,T,x, x,x,T,x, T,T,T,T, T,T,T,x, x,x,x,T, x,x,x,x, x,x,x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x},
- {x,x,T,T, T,T,T,T, T,T,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,T,x,x, x,T,x,T, T,T,T,T, x,T,T,x, T,x,x,T, T,T,T,T, T,T,T,x, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, x,x,x,T, T,T,T,T, T,x,x,x, x,x,x,T, T,T,x,T, T,T,x,T, x,T,x,x, T,T,x,T, T,x,T,x, x,x,T,x, T,x,T,x, x,T,x,x, x,T,x,T, x,x,x,x, T,T,x,x, T,x,x,T, x,x,T,x, T,T,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,T,x, T,x,T,T, T,T,T,x, x,x,T,T, T,T,x,T, x,T,x,x, T,T,T,x, T,x,T,T, T,T,T,T, T,T,T,T, x,x,x,T, T,x,T,x, x,x,x,x},
- {x,x,T,T, T,T,T,T, T,T,x,x, T,x,x,x, T,x,T,T, x,x,T,x, x,T,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,x,x, x,T,x,T, T,T,T,T, x,T,T,x, x,x,x,T, T,T,T,T, T,T,T,x, T,T,T,x, x,T,T,T, T,T,T,T, T,T,T,T, x,x,x,T, x,T,T,x, T,x,x,x, x,x,x,T, x,x,x,x, T,T,x,x, x,T,T,x, T,T,x,x, T,x,T,x, x,x,T,x, T,x,T,x, x,T,x,x, x,T,x,T, x,x,x,x, T,T,x,x, T,x,T,T, x,x,T,x, T,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,T,T, T,x,x,x, x,T,x,x, x,T,T,x, x,x,T,x, T,T,T,T, T,T,T,x, x,x,x,T, x,x,x,x, x,x,x,x},
- {x,x,T,T, T,T,T,T, T,T,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,x,x, x,T,x,T, T,T,T,T, x,T,T,x, x,x,x,T, T,T,T,T, T,T,T,x, T,T,T,x, x,T,T,T, T,T,T,T, T,T,T,T, x,x,x,T, x,T,T,x, T,x,x,x, x,x,x,T, x,x,x,x, T,T,x,x, x,T,x,x, T,T,x,x, T,x,T,x, x,x,T,x, T,x,T,x, x,T,x,x, x,T,x,T, x,x,x,x, T,T,x,x, T,x,x,T, x,x,T,x, T,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,T,T, T,x,x,x, x,T,x,x, x,T,T,x, x,x,T,x, T,T,T,T, T,T,T,x, x,x,x,T, x,x,x,x, x,x,x,x},
- {x,x,T,T, T,T,T,T, T,T,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,T,x,x, x,T,x,T, T,T,T,T, x,T,T,x, T,x,x,T, T,T,T,T, T,T,T,x, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, x,x,x,T, T,T,T,T, T,x,x,x, T,x,x,T, T,T,x,T, T,T,x,T, x,T,x,x, T,T,x,T, T,x,T,x, x,x,T,x, T,x,T,x, x,T,x,x, x,T,x,T, x,x,x,x, T,T,x,x, T,x,x,T, x,x,T,x, T,T,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,T,x, T,x,T,T, T,T,T,x, x,x,T,T, T,T,x,T, x,T,x,x, T,T,T,x, T,x,T,T, T,T,T,T, T,T,T,T, x,x,x,T, T,x,T,x, x,x,x,x},
- {x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,T, T,T,T,T, T,T,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x},
- {x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,T,x,T, T,T,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,T, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,T, T,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, T,x,x,x, x,T,x,x, x,x,x,x, T,x,x,x, x,x,T,x, x,x,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,x, x,T,T,x, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,T, x,x,x,x, x,x,x,x},
- {x,x,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,T,x,T, T,T,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,T, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, T,x,x,x, x,T,x,x, x,x,x,x, T,x,x,x, x,x,T,x, x,x,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,T,T,x, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,T, x,x,x,x, x,x,x,x},
- {x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,T,T,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x}
-
- };
-} // end Parser
-
+
+#line 1 "VBNET.ATG"
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Text;
+using ICSharpCode.NRefactory.Ast;
+using ICSharpCode.NRefactory.Parser.VB;
+using ASTAttribute = ICSharpCode.NRefactory.Ast.Attribute;
+/*
+ Parser.frame file for NRefactory.
+ */
+using System;
+using System.Reflection;
+
+namespace ICSharpCode.NRefactory.Parser.VB {
+
+
+
+partial class Parser : AbstractParser
+{
+ const int maxT = 222;
+
+ const bool T = true;
+ const bool x = false;
+
+
+#line 12 "VBNET.ATG"
+
+
+/*
+
+*/
+
+ void VBNET() {
+
+#line 246 "VBNET.ATG"
+ lexer.NextToken(); // get the first token
+ compilationUnit = new CompilationUnit();
+
+ while (la.kind == 1 || la.kind == 11) {
+ EndOfStmt();
+ }
+ while (la.kind == 159) {
+ OptionStmt();
+ while (la.kind == 1 || la.kind == 11) {
+ EndOfStmt();
+ }
+ }
+ while (la.kind == 124) {
+ ImportsStmt();
+ while (la.kind == 1 || la.kind == 11) {
+ EndOfStmt();
+ }
+ }
+ while (
+#line 253 "VBNET.ATG"
+IsGlobalAttrTarget()) {
+ GlobalAttributeSection();
+ while (la.kind == 1 || la.kind == 11) {
+ EndOfStmt();
+ }
+ }
+ while (StartOf(1)) {
+ NamespaceMemberDecl();
+ while (la.kind == 1 || la.kind == 11) {
+ EndOfStmt();
+ }
+ }
+ Expect(0);
+ }
+
+ void EndOfStmt() {
+ if (la.kind == 1) {
+ lexer.NextToken();
+ } else if (la.kind == 11) {
+ lexer.NextToken();
+ } else SynErr(223);
+ }
+
+ void OptionStmt() {
+
+#line 258 "VBNET.ATG"
+ INode node = null; bool val = true;
+ Expect(159);
+
+#line 259 "VBNET.ATG"
+ Location startPos = t.Location;
+ if (la.kind == 108) {
+ lexer.NextToken();
+ if (la.kind == 156 || la.kind == 157) {
+ OptionValue(
+#line 261 "VBNET.ATG"
+ref val);
+ }
+
+#line 262 "VBNET.ATG"
+ node = new OptionDeclaration(OptionType.Explicit, val);
+ } else if (la.kind == 192) {
+ lexer.NextToken();
+ if (la.kind == 156 || la.kind == 157) {
+ OptionValue(
+#line 264 "VBNET.ATG"
+ref val);
+ }
+
+#line 265 "VBNET.ATG"
+ node = new OptionDeclaration(OptionType.Strict, val);
+ } else if (la.kind == 74) {
+ lexer.NextToken();
+ if (la.kind == 54) {
+ lexer.NextToken();
+
+#line 267 "VBNET.ATG"
+ node = new OptionDeclaration(OptionType.CompareBinary, val);
+ } else if (la.kind == 198) {
+ lexer.NextToken();
+
+#line 268 "VBNET.ATG"
+ node = new OptionDeclaration(OptionType.CompareText, val);
+ } else SynErr(224);
+ } else if (la.kind == 126) {
+ lexer.NextToken();
+ if (la.kind == 156 || la.kind == 157) {
+ OptionValue(
+#line 271 "VBNET.ATG"
+ref val);
+ }
+
+#line 272 "VBNET.ATG"
+ node = new OptionDeclaration(OptionType.Infer, val);
+ } else SynErr(225);
+ EndOfStmt();
+
+#line 276 "VBNET.ATG"
+ if (node != null) {
+ node.StartLocation = startPos;
+ node.EndLocation = t.Location;
+ compilationUnit.AddChild(node);
+ }
+
+ }
+
+ void ImportsStmt() {
+
+#line 299 "VBNET.ATG"
+ List<Using> usings = new List<Using>();
+
+ Expect(124);
+
+#line 303 "VBNET.ATG"
+ Location startPos = t.Location;
+ Using u;
+
+ ImportClause(
+#line 306 "VBNET.ATG"
+out u);
+
+#line 306 "VBNET.ATG"
+ if (u != null) { usings.Add(u); }
+ while (la.kind == 12) {
+ lexer.NextToken();
+ ImportClause(
+#line 308 "VBNET.ATG"
+out u);
+
+#line 308 "VBNET.ATG"
+ if (u != null) { usings.Add(u); }
+ }
+ EndOfStmt();
+
+#line 312 "VBNET.ATG"
+ UsingDeclaration usingDeclaration = new UsingDeclaration(usings);
+ usingDeclaration.StartLocation = startPos;
+ usingDeclaration.EndLocation = t.Location;
+ compilationUnit.AddChild(usingDeclaration);
+
+ }
+
+ void GlobalAttributeSection() {
+ Expect(28);
+
+#line 2521 "VBNET.ATG"
+ Location startPos = t.Location;
+ if (la.kind == 52) {
+ lexer.NextToken();
+ } else if (la.kind == 141) {
+ lexer.NextToken();
+ } else SynErr(226);
+
+#line 2523 "VBNET.ATG"
+ string attributeTarget = t.val != null ? t.val.ToLower(System.Globalization.CultureInfo.InvariantCulture) : null;
+ List<ASTAttribute> attributes = new List<ASTAttribute>();
+ ASTAttribute attribute;
+
+ Expect(11);
+ Attribute(
+#line 2527 "VBNET.ATG"
+out attribute);
+
+#line 2527 "VBNET.ATG"
+ attributes.Add(attribute);
+ while (
+#line 2528 "VBNET.ATG"
+NotFinalComma()) {
+ if (la.kind == 12) {
+ lexer.NextToken();
+ if (la.kind == 52) {
+ lexer.NextToken();
+ } else if (la.kind == 141) {
+ lexer.NextToken();
+ } else SynErr(227);
+ Expect(11);
+ }
+ Attribute(
+#line 2528 "VBNET.ATG"
+out attribute);
+
+#line 2528 "VBNET.ATG"
+ attributes.Add(attribute);
+ }
+ if (la.kind == 12) {
+ lexer.NextToken();
+ }
+ Expect(27);
+ EndOfStmt();
+
+#line 2533 "VBNET.ATG"
+ AttributeSection section = new AttributeSection {
+ AttributeTarget = attributeTarget,
+ Attributes = attributes,
+ StartLocation = startPos,
+ EndLocation = t.EndLocation
+ };
+ compilationUnit.AddChild(section);
+
+ }
+
+ void NamespaceMemberDecl() {
+
+#line 341 "VBNET.ATG"
+ ModifierList m = new ModifierList();
+ AttributeSection section;
+ List<AttributeSection> attributes = new List<AttributeSection>();
+ string qualident;
+
+ if (la.kind == 146) {
+ lexer.NextToken();
+
+#line 348 "VBNET.ATG"
+ Location startPos = t.Location;
+
+ Qualident(
+#line 350 "VBNET.ATG"
+out qualident);
+
+#line 352 "VBNET.ATG"
+ INode node = new NamespaceDeclaration(qualident);
+ node.StartLocation = startPos;
+ compilationUnit.AddChild(node);
+ compilationUnit.BlockStart(node);
+
+ EndOfStmt();
+ NamespaceBody();
+
+#line 360 "VBNET.ATG"
+ node.EndLocation = t.Location;
+ compilationUnit.BlockEnd();
+
+ } else if (StartOf(2)) {
+ while (la.kind == 28) {
+ AttributeSection(
+#line 364 "VBNET.ATG"
+out section);
+
+#line 364 "VBNET.ATG"
+ attributes.Add(section);
+ }
+ while (StartOf(3)) {
+ TypeModifier(
+#line 365 "VBNET.ATG"
+m);
+ }
+ NonModuleDeclaration(
+#line 365 "VBNET.ATG"
+m, attributes);
+ } else SynErr(228);
+ }
+
+ void OptionValue(
+#line 284 "VBNET.ATG"
+ref bool val) {
+ if (la.kind == 157) {
+ lexer.NextToken();
+
+#line 286 "VBNET.ATG"
+ val = true;
+ } else if (la.kind == 156) {
+ lexer.NextToken();
+
+#line 288 "VBNET.ATG"
+ val = false;
+ } else SynErr(229);
+ }
+
+ void ImportClause(
+#line 319 "VBNET.ATG"
+out Using u) {
+
+#line 321 "VBNET.ATG"
+ string qualident = null;
+ TypeReference aliasedType = null;
+ u = null;
+
+ Qualident(
+#line 325 "VBNET.ATG"
+out qualident);
+ if (la.kind == 10) {
+ lexer.NextToken();
+ TypeName(
+#line 326 "VBNET.ATG"
+out aliasedType);
+ }
+
+#line 328 "VBNET.ATG"
+ if (qualident != null && qualident.Length > 0) {
+ if (aliasedType != null) {
+ u = new Using(qualident, aliasedType);
+ } else {
+ u = new Using(qualident);
+ }
+ }
+
+ }
+
+ void Qualident(
+#line 3279 "VBNET.ATG"
+out string qualident) {
+
+#line 3281 "VBNET.ATG"
+ string name;
+ qualidentBuilder.Length = 0;
+
+ Identifier();
+
+#line 3285 "VBNET.ATG"
+ qualidentBuilder.Append(t.val);
+ while (
+#line 3286 "VBNET.ATG"
+DotAndIdentOrKw()) {
+ Expect(16);
+ IdentifierOrKeyword(
+#line 3286 "VBNET.ATG"
+out name);
+
+#line 3286 "VBNET.ATG"
+ qualidentBuilder.Append('.'); qualidentBuilder.Append(name);
+ }
+
+#line 3288 "VBNET.ATG"
+ qualident = qualidentBuilder.ToString();
+ }
+
+ void TypeName(
+#line 2394 "VBNET.ATG"
+out TypeReference typeref) {
+
+#line 2395 "VBNET.ATG"
+ ArrayList rank = null;
+ NonArrayTypeName(
+#line 2397 "VBNET.ATG"
+out typeref, false);
+ ArrayTypeModifiers(
+#line 2401 "VBNET.ATG"
+out rank);
+
+#line 2402 "VBNET.ATG"
+ if (rank != null && typeref != null) {
+ typeref.RankSpecifier = (int[])rank.ToArray(typeof(int));
+ }
+
+ }
+
+ void NamespaceBody() {
+ while (la.kind == 1 || la.kind == 11) {
+ EndOfStmt();
+ }
+ while (StartOf(1)) {
+ NamespaceMemberDecl();
+ while (la.kind == 1 || la.kind == 11) {
+ EndOfStmt();
+ }
+ }
+ Expect(100);
+ Expect(146);
+ EndOfStmt();
+ }
+
+ void AttributeSection(
+#line 2596 "VBNET.ATG"
+out AttributeSection section) {
+
+#line 2598 "VBNET.ATG"
+ string attributeTarget = "";List<ASTAttribute> attributes = new List<ASTAttribute>();
+ ASTAttribute attribute;
+
+
+ Expect(28);
+
+#line 2602 "VBNET.ATG"
+ Location startPos = t.Location;
+ if (
+#line 2603 "VBNET.ATG"
+IsLocalAttrTarget()) {
+ if (la.kind == 106) {
+ lexer.NextToken();
+
+#line 2604 "VBNET.ATG"
+ attributeTarget = "event";
+ } else if (la.kind == 180) {
+ lexer.NextToken();
+
+#line 2605 "VBNET.ATG"
+ attributeTarget = "return";
+ } else {
+ Identifier();
+
+#line 2608 "VBNET.ATG"
+ string val = t.val.ToLower(System.Globalization.CultureInfo.InvariantCulture);
+ if (val != "field" || val != "method" ||
+ val != "module" || val != "param" ||
+ val != "property" || val != "type")
+ Error("attribute target specifier (event, return, field," +
+ "method, module, param, property, or type) expected");
+ attributeTarget = t.val;
+
+ }
+ Expect(11);
+ }
+ Attribute(
+#line 2618 "VBNET.ATG"
+out attribute);
+
+#line 2618 "VBNET.ATG"
+ attributes.Add(attribute);
+ while (
+#line 2619 "VBNET.ATG"
+NotFinalComma()) {
+ Expect(12);
+ Attribute(
+#line 2619 "VBNET.ATG"
+out attribute);
+
+#line 2619 "VBNET.ATG"
+ attributes.Add(attribute);
+ }
+ if (la.kind == 12) {
+ lexer.NextToken();
+ }
+ Expect(27);
+
+#line 2623 "VBNET.ATG"
+ section = new AttributeSection {
+ AttributeTarget = attributeTarget,
+ Attributes = attributes,
+ StartLocation = startPos,
+ EndLocation = t.EndLocation
+ };
+
+ }
+
+ void TypeModifier(
+#line 3362 "VBNET.ATG"
+ModifierList m) {
+ switch (la.kind) {
+ case 173: {
+ lexer.NextToken();
+
+#line 3363 "VBNET.ATG"
+ m.Add(Modifiers.Public, t.Location);
+ break;
+ }
+ case 172: {
+ lexer.NextToken();
+
+#line 3364 "VBNET.ATG"
+ m.Add(Modifiers.Protected, t.Location);
+ break;
+ }
+ case 112: {
+ lexer.NextToken();
+
+#line 3365 "VBNET.ATG"
+ m.Add(Modifiers.Internal, t.Location);
+ break;
+ }
+ case 170: {
+ lexer.NextToken();
+
+#line 3366 "VBNET.ATG"
+ m.Add(Modifiers.Private, t.Location);
+ break;
+ }
+ case 185: {
+ lexer.NextToken();
+
+#line 3367 "VBNET.ATG"
+ m.Add(Modifiers.Static, t.Location);
+ break;
+ }
+ case 184: {
+ lexer.NextToken();
+
+#line 3368 "VBNET.ATG"
+ m.Add(Modifiers.New, t.Location);
+ break;
+ }
+ case 142: {
+ lexer.NextToken();
+
+#line 3369 "VBNET.ATG"
+ m.Add(Modifiers.Abstract, t.Location);
+ break;
+ }
+ case 152: {
+ lexer.NextToken();
+
+#line 3370 "VBNET.ATG"
+ m.Add(Modifiers.Sealed, t.Location);
+ break;
+ }
+ case 168: {
+ lexer.NextToken();
+
+#line 3371 "VBNET.ATG"
+ m.Add(Modifiers.Partial, t.Location);
+ break;
+ }
+ default: SynErr(230); break;
+ }
+ }
+
+ void NonModuleDeclaration(
+#line 424 "VBNET.ATG"
+ModifierList m, List<AttributeSection> attributes) {
+
+#line 426 "VBNET.ATG"
+ TypeReference typeRef = null;
+ List<TypeReference> baseInterfaces = null;
+
+ switch (la.kind) {
+ case 71: {
+
+#line 429 "VBNET.ATG"
+ m.Check(Modifiers.Classes);
+ lexer.NextToken();
+
+#line 432 "VBNET.ATG"
+ TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
+ newType.StartLocation = t.Location;
+ compilationUnit.AddChild(newType);
+ compilationUnit.BlockStart(newType);
+
+ newType.Type = ClassType.Class;
+
+ Identifier();
+
+#line 439 "VBNET.ATG"
+ newType.Name = t.val;
+ TypeParameterList(
+#line 440 "VBNET.ATG"
+newType.Templates);
+ EndOfStmt();
+
+#line 442 "VBNET.ATG"
+ newType.BodyStartLocation = t.Location;
+ if (la.kind == 127) {
+ ClassBaseType(
+#line 443 "VBNET.ATG"
+out typeRef);
+
+#line 443 "VBNET.ATG"
+ SafeAdd(newType, newType.BaseTypes, typeRef);
+ }
+ while (la.kind == 123) {
+ TypeImplementsClause(
+#line 444 "VBNET.ATG"
+out baseInterfaces);
+
+#line 444 "VBNET.ATG"
+ newType.BaseTypes.AddRange(baseInterfaces);
+ }
+ ClassBody(
+#line 445 "VBNET.ATG"
+newType);
+ Expect(100);
+ Expect(71);
+
+#line 446 "VBNET.ATG"
+ newType.EndLocation = t.EndLocation;
+ EndOfStmt();
+
+#line 449 "VBNET.ATG"
+ compilationUnit.BlockEnd();
+
+ break;
+ }
+ case 141: {
+ lexer.NextToken();
+
+#line 453 "VBNET.ATG"
+ m.Check(Modifiers.VBModules);
+ TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
+ compilationUnit.AddChild(newType);
+ compilationUnit.BlockStart(newType);
+ newType.StartLocation = m.GetDeclarationLocation(t.Location);
+ newType.Type = ClassType.Module;
+
+ Identifier();
+
+#line 460 "VBNET.ATG"
+ newType.Name = t.val;
+ EndOfStmt();
+
+#line 462 "VBNET.ATG"
+ newType.BodyStartLocation = t.Location;
+ ModuleBody(
+#line 463 "VBNET.ATG"
+newType);
+
+#line 465 "VBNET.ATG"
+ compilationUnit.BlockEnd();
+
+ break;
+ }
+ case 194: {
+ lexer.NextToken();
+
+#line 469 "VBNET.ATG"
+ m.Check(Modifiers.VBStructures);
+ TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
+ compilationUnit.AddChild(newType);
+ compilationUnit.BlockStart(newType);
+ newType.StartLocation = m.GetDeclarationLocation(t.Location);
+ newType.Type = ClassType.Struct;
+
+ Identifier();
+
+#line 476 "VBNET.ATG"
+ newType.Name = t.val;
+ TypeParameterList(
+#line 477 "VBNET.ATG"
+newType.Templates);
+ EndOfStmt();
+
+#line 479 "VBNET.ATG"
+ newType.BodyStartLocation = t.Location;
+ while (la.kind == 123) {
+ TypeImplementsClause(
+#line 480 "VBNET.ATG"
+out baseInterfaces);
+
+#line 480 "VBNET.ATG"
+ newType.BaseTypes.AddRange(baseInterfaces);
+ }
+ StructureBody(
+#line 481 "VBNET.ATG"
+newType);
+
+#line 483 "VBNET.ATG"
+ compilationUnit.BlockEnd();
+
+ break;
+ }
+ case 102: {
+ lexer.NextToken();
+
+#line 488 "VBNET.ATG"
+ m.Check(Modifiers.VBEnums);
+ TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
+ newType.StartLocation = m.GetDeclarationLocation(t.Location);
+ compilationUnit.AddChild(newType);
+ compilationUnit.BlockStart(newType);
+
+ newType.Type = ClassType.Enum;
+
+ Identifier();
+
+#line 496 "VBNET.ATG"
+ newType.Name = t.val;
+ if (la.kind == 50) {
+ lexer.NextToken();
+ NonArrayTypeName(
+#line 497 "VBNET.ATG"
+out typeRef, false);
+
+#line 497 "VBNET.ATG"
+ SafeAdd(newType, newType.BaseTypes, typeRef);
+ }
+ EndOfStmt();
+
+#line 499 "VBNET.ATG"
+ newType.BodyStartLocation = t.Location;
+ EnumBody(
+#line 500 "VBNET.ATG"
+newType);
+
+#line 502 "VBNET.ATG"
+ compilationUnit.BlockEnd();
+
+ break;
+ }
+ case 129: {
+ lexer.NextToken();
+
+#line 507 "VBNET.ATG"
+ m.Check(Modifiers.VBInterfacs);
+ TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
+ newType.StartLocation = m.GetDeclarationLocation(t.Location);
+ compilationUnit.AddChild(newType);
+ compilationUnit.BlockStart(newType);
+ newType.Type = ClassType.Interface;
+
+ Identifier();
+
+#line 514 "VBNET.ATG"
+ newType.Name = t.val;
+ TypeParameterList(
+#line 515 "VBNET.ATG"
+newType.Templates);
+ EndOfStmt();
+
+#line 517 "VBNET.ATG"
+ newType.BodyStartLocation = t.Location;
+ while (la.kind == 127) {
+ InterfaceBase(
+#line 518 "VBNET.ATG"
+out baseInterfaces);
+
+#line 518 "VBNET.ATG"
+ newType.BaseTypes.AddRange(baseInterfaces);
+ }
+ InterfaceBody(
+#line 519 "VBNET.ATG"
+newType);
+
+#line 521 "VBNET.ATG"
+ compilationUnit.BlockEnd();
+
+ break;
+ }
+ case 90: {
+ lexer.NextToken();
+
+#line 526 "VBNET.ATG"
+ m.Check(Modifiers.VBDelegates);
+ DelegateDeclaration delegateDeclr = new DelegateDeclaration(m.Modifier, attributes);
+ delegateDeclr.ReturnType = new TypeReference("System.Void", true);
+ delegateDeclr.StartLocation = m.GetDeclarationLocation(t.Location);
+ List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
+
+ if (la.kind == 195) {
+ lexer.NextToken();
+ Identifier();
+
+#line 533 "VBNET.ATG"
+ delegateDeclr.Name = t.val;
+ TypeParameterList(
+#line 534 "VBNET.ATG"
+delegateDeclr.Templates);
+ if (la.kind == 25) {
+ lexer.NextToken();
+ if (StartOf(4)) {
+ FormalParameterList(
+#line 535 "VBNET.ATG"
+p);
+ }
+ Expect(26);
+
+#line 535 "VBNET.ATG"
+ delegateDeclr.Parameters = p;
+ }
+ } else if (la.kind == 114) {
+ lexer.NextToken();
+ Identifier();
+
+#line 537 "VBNET.ATG"
+ delegateDeclr.Name = t.val;
+ TypeParameterList(
+#line 538 "VBNET.ATG"
+delegateDeclr.Templates);
+ if (la.kind == 25) {
+ lexer.NextToken();
+ if (StartOf(4)) {
+ FormalParameterList(
+#line 539 "VBNET.ATG"
+p);
+ }
+ Expect(26);
+
+#line 539 "VBNET.ATG"
+ delegateDeclr.Parameters = p;
+ }
+ if (la.kind == 50) {
+ lexer.NextToken();
+
+#line 540 "VBNET.ATG"
+ TypeReference type;
+ TypeName(
+#line 540 "VBNET.ATG"
+out type);
+
+#line 540 "VBNET.ATG"
+ delegateDeclr.ReturnType = type;
+ }
+ } else SynErr(231);
+
+#line 542 "VBNET.ATG"
+ delegateDeclr.EndLocation = t.EndLocation;
+ EndOfStmt();
+
+#line 545 "VBNET.ATG"
+ compilationUnit.AddChild(delegateDeclr);
+
+ break;
+ }
+ default: SynErr(232); break;
+ }
+ }
+
+ void TypeParameterList(
+#line 369 "VBNET.ATG"
+List<TemplateDefinition> templates) {
+
+#line 371 "VBNET.ATG"
+ TemplateDefinition template;
+
+ if (
+#line 374 "VBNET.ATG"
+la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of) {
+ lexer.NextToken();
+ Expect(155);
+ TypeParameter(
+#line 375 "VBNET.ATG"
+out template);
+
+#line 377 "VBNET.ATG"
+ if (template != null) templates.Add(template);
+
+ while (la.kind == 12) {
+ lexer.NextToken();
+ TypeParameter(
+#line 380 "VBNET.ATG"
+out template);
+
+#line 382 "VBNET.ATG"
+ if (template != null) templates.Add(template);
+
+ }
+ Expect(26);
+ }
+ }
+
+ void TypeParameter(
+#line 390 "VBNET.ATG"
+out TemplateDefinition template) {
+ Identifier();
+
+#line 392 "VBNET.ATG"
+ template = new TemplateDefinition(t.val, null);
+ if (la.kind == 50) {
+ TypeParameterConstraints(
+#line 393 "VBNET.ATG"
+template);
+ }
+ }
+
+ void Identifier() {
+ if (StartOf(5)) {
+ IdentifierForFieldDeclaration();
+ } else if (la.kind == 85) {
+ lexer.NextToken();
+ } else SynErr(233);
+ }
+
+ void TypeParameterConstraints(
+#line 397 "VBNET.ATG"
+TemplateDefinition template) {
+
+#line 399 "VBNET.ATG"
+ TypeReference constraint;
+
+ Expect(50);
+ if (la.kind == 23) {
+ lexer.NextToken();
+ TypeParameterConstraint(
+#line 405 "VBNET.ATG"
+out constraint);
+
+#line 405 "VBNET.ATG"
+ if (constraint != null) { template.Bases.Add(constraint); }
+ while (la.kind == 12) {
+ lexer.NextToken();
+ TypeParameterConstraint(
+#line 408 "VBNET.ATG"
+out constraint);
+
+#line 408 "VBNET.ATG"
+ if (constraint != null) { template.Bases.Add(constraint); }
+ }
+ Expect(24);
+ } else if (StartOf(6)) {
+ TypeParameterConstraint(
+#line 411 "VBNET.ATG"
+out constraint);
+
+#line 411 "VBNET.ATG"
+ if (constraint != null) { template.Bases.Add(constraint); }
+ } else SynErr(234);
+ }
+
+ void TypeParameterConstraint(
+#line 415 "VBNET.ATG"
+out TypeReference constraint) {
+
+#line 416 "VBNET.ATG"
+ constraint = null;
+ if (la.kind == 71) {
+ lexer.NextToken();
+
+#line 417 "VBNET.ATG"
+ constraint = TypeReference.ClassConstraint;
+ } else if (la.kind == 194) {
+ lexer.NextToken();
+
+#line 418 "VBNET.ATG"
+ constraint = TypeReference.StructConstraint;
+ } else if (la.kind == 148) {
+ lexer.NextToken();
+
+#line 419 "VBNET.ATG"
+ constraint = TypeReference.NewConstraint;
+ } else if (StartOf(7)) {
+ TypeName(
+#line 420 "VBNET.ATG"
+out constraint);
+ } else SynErr(235);
+ }
+
+ void ClassBaseType(
+#line 765 "VBNET.ATG"
+out TypeReference typeRef) {
+
+#line 767 "VBNET.ATG"
+ typeRef = null;
+
+ Expect(127);
+ TypeName(
+#line 770 "VBNET.ATG"
+out typeRef);
+ EndOfStmt();
+ }
+
+ void TypeImplementsClause(
+#line 1563 "VBNET.ATG"
+out List<TypeReference> baseInterfaces) {
+
+#line 1565 "VBNET.ATG"
+ baseInterfaces = new List<TypeReference>();
+ TypeReference type = null;
+
+ Expect(123);
+ TypeName(
+#line 1568 "VBNET.ATG"
+out type);
+
+#line 1570 "VBNET.ATG"
+ if (type != null) baseInterfaces.Add(type);
+
+ while (la.kind == 12) {
+ lexer.NextToken();
+ TypeName(
+#line 1573 "VBNET.ATG"
+out type);
+
+#line 1574 "VBNET.ATG"
+ if (type != null) baseInterfaces.Add(type);
+ }
+ EndOfStmt();
+ }
+
+ void ClassBody(
+#line 559 "VBNET.ATG"
+TypeDeclaration newType) {
+
+#line 560 "VBNET.ATG"
+ AttributeSection section;
+ while (la.kind == 1 || la.kind == 11) {
+ EndOfStmt();
+ }
+ while (StartOf(8)) {
+
+#line 563 "VBNET.ATG"
+ List<AttributeSection> attributes = new List<AttributeSection>();
+ ModifierList m = new ModifierList();
+
+ while (la.kind == 28) {
+ AttributeSection(
+#line 566 "VBNET.ATG"
+out section);
+
+#line 566 "VBNET.ATG"
+ attributes.Add(section);
+ }
+ while (StartOf(9)) {
+ MemberModifier(
+#line 567 "VBNET.ATG"
+m);
+ }
+ ClassMemberDecl(
+#line 568 "VBNET.ATG"
+m, attributes);
+ while (la.kind == 1 || la.kind == 11) {
+ EndOfStmt();
+ }
+ }
+ }
+
+ void ModuleBody(
+#line 590 "VBNET.ATG"
+TypeDeclaration newType) {
+
+#line 591 "VBNET.ATG"
+ AttributeSection section;
+ while (la.kind == 1 || la.kind == 11) {
+ EndOfStmt();
+ }
+ while (StartOf(8)) {
+
+#line 594 "VBNET.ATG"
+ List<AttributeSection> attributes = new List<AttributeSection>();
+ ModifierList m = new ModifierList();
+
+ while (la.kind == 28) {
+ AttributeSection(
+#line 597 "VBNET.ATG"
+out section);
+
+#line 597 "VBNET.ATG"
+ attributes.Add(section);
+ }
+ while (StartOf(9)) {
+ MemberModifier(
+#line 598 "VBNET.ATG"
+m);
+ }
+ ClassMemberDecl(
+#line 599 "VBNET.ATG"
+m, attributes);
+ while (la.kind == 1 || la.kind == 11) {
+ EndOfStmt();
+ }
+ }
+ Expect(100);
+ Expect(141);
+
+#line 602 "VBNET.ATG"
+ newType.EndLocation = t.EndLocation;
+ EndOfStmt();
+ }
+
+ void StructureBody(
+#line 573 "VBNET.ATG"
+TypeDeclaration newType) {
+
+#line 574 "VBNET.ATG"
+ AttributeSection section;
+ while (la.kind == 1 || la.kind == 11) {
+ EndOfStmt();
+ }
+ while (StartOf(8)) {
+
+#line 577 "VBNET.ATG"
+ List<AttributeSection> attributes = new List<AttributeSection>();
+ ModifierList m = new ModifierList();
+
+ while (la.kind == 28) {
+ AttributeSection(
+#line 580 "VBNET.ATG"
+out section);
+
+#line 580 "VBNET.ATG"
+ attributes.Add(section);
+ }
+ while (StartOf(9)) {
+ MemberModifier(
+#line 581 "VBNET.ATG"
+m);
+ }
+ StructureMemberDecl(
+#line 582 "VBNET.ATG"
+m, attributes);
+ while (la.kind == 1 || la.kind == 11) {
+ EndOfStmt();
+ }
+ }
+ Expect(100);
+ Expect(194);
+
+#line 585 "VBNET.ATG"
+ newType.EndLocation = t.EndLocation;
+ EndOfStmt();
+ }
+
+ void NonArrayTypeName(
+#line 2420 "VBNET.ATG"
+out TypeReference typeref, bool canBeUnbound) {
+
+#line 2422 "VBNET.ATG"
+ string name;
+ typeref = null;
+ bool isGlobal = false;
+
+ if (StartOf(10)) {
+ if (la.kind == 117) {
+ lexer.NextToken();
+ Expect(16);
+
+#line 2427 "VBNET.ATG"
+ isGlobal = true;
+ }
+ QualIdentAndTypeArguments(
+#line 2428 "VBNET.ATG"
+out typeref, canBeUnbound);
+
+#line 2429 "VBNET.ATG"
+ typeref.IsGlobal = isGlobal;
+ while (la.kind == 16) {
+ lexer.NextToken();
+
+#line 2430 "VBNET.ATG"
+ TypeReference nestedTypeRef;
+ QualIdentAndTypeArguments(
+#line 2431 "VBNET.ATG"
+out nestedTypeRef, canBeUnbound);
+
+#line 2432 "VBNET.ATG"
+ typeref = new InnerClassTypeReference(typeref, nestedTypeRef.Type, nestedTypeRef.GenericTypes);
+ }
+ } else if (la.kind == 154) {
+ lexer.NextToken();
+
+#line 2435 "VBNET.ATG"
+ typeref = new TypeReference("System.Object", true);
+ if (la.kind == 21) {
+ lexer.NextToken();
+
+#line 2439 "VBNET.ATG"
+ List<TypeReference> typeArguments = new List<TypeReference>(1);
+ if (typeref != null) typeArguments.Add(typeref);
+ typeref = new TypeReference("System.Nullable", typeArguments) { IsKeyword = true };
+
+ }
+ } else if (StartOf(11)) {
+ PrimitiveTypeName(
+#line 2445 "VBNET.ATG"
+out name);
+
+#line 2445 "VBNET.ATG"
+ typeref = new TypeReference(name, true);
+ if (la.kind == 21) {
+ lexer.NextToken();
+
+#line 2449 "VBNET.ATG"
+ List<TypeReference> typeArguments = new List<TypeReference>(1);
+ if (typeref != null) typeArguments.Add(typeref);
+ typeref = new TypeReference("System.Nullable", typeArguments) { IsKeyword = true };
+
+ }
+ } else SynErr(236);
+ }
+
+ void EnumBody(
+#line 606 "VBNET.ATG"
+TypeDeclaration newType) {
+
+#line 607 "VBNET.ATG"
+ FieldDeclaration f;
+ while (la.kind == 1 || la.kind == 11) {
+ EndOfStmt();
+ }
+ while (StartOf(12)) {
+ EnumMemberDecl(
+#line 610 "VBNET.ATG"
+out f);
+
+#line 612 "VBNET.ATG"
+ compilationUnit.AddChild(f);
+
+ while (la.kind == 1 || la.kind == 11) {
+ EndOfStmt();
+ }
+ }
+ Expect(100);
+ Expect(102);
+
+#line 616 "VBNET.ATG"
+ newType.EndLocation = t.EndLocation;
+ EndOfStmt();
+ }
+
+ void InterfaceBase(
+#line 1548 "VBNET.ATG"
+out List<TypeReference> bases) {
+
+#line 1550 "VBNET.ATG"
+ TypeReference type;
+ bases = new List<TypeReference>();
+
+ Expect(127);
+ TypeName(
+#line 1554 "VBNET.ATG"
+out type);
+
+#line 1554 "VBNET.ATG"
+ if (type != null) bases.Add(type);
+ while (la.kind == 12) {
+ lexer.NextToken();
+ TypeName(
+#line 1557 "VBNET.ATG"
+out type);
+
+#line 1557 "VBNET.ATG"
+ if (type != null) bases.Add(type);
+ }
+ EndOfStmt();
+ }
+
+ void InterfaceBody(
+#line 620 "VBNET.ATG"
+TypeDeclaration newType) {
+ while (la.kind == 1 || la.kind == 11) {
+ EndOfStmt();
+ }
+ while (StartOf(13)) {
+ InterfaceMemberDecl();
+ while (la.kind == 1 || la.kind == 11) {
+ EndOfStmt();
+ }
+ }
+ Expect(100);
+ Expect(129);
+
+#line 626 "VBNET.ATG"
+ newType.EndLocation = t.EndLocation;
+ EndOfStmt();
+ }
+
+ void FormalParameterList(
+#line 2633 "VBNET.ATG"
+List<ParameterDeclarationExpression> parameter) {
+
+#line 2634 "VBNET.ATG"
+ ParameterDeclarationExpression p;
+ FormalParameter(
+#line 2636 "VBNET.ATG"
+out p);
+
+#line 2636 "VBNET.ATG"
+ if (p != null) parameter.Add(p);
+ while (la.kind == 12) {
+ lexer.NextToken();
+ FormalParameter(
+#line 2638 "VBNET.ATG"
+out p);
+
+#line 2638 "VBNET.ATG"
+ if (p != null) parameter.Add(p);
+ }
+ }
+
+ void MemberModifier(
+#line 3374 "VBNET.ATG"
+ModifierList m) {
+ switch (la.kind) {
+ case 142: {
+ lexer.NextToken();
+
+#line 3375 "VBNET.ATG"
+ m.Add(Modifiers.Abstract, t.Location);
+ break;
+ }
+ case 89: {
+ lexer.NextToken();
+
+#line 3376 "VBNET.ATG"
+ m.Add(Modifiers.Default, t.Location);
+ break;
+ }
+ case 112: {
+ lexer.NextToken();
+
+#line 3377 "VBNET.ATG"
+ m.Add(Modifiers.Internal, t.Location);
+ break;
+ }
+ case 184: {
+ lexer.NextToken();
+
+#line 3378 "VBNET.ATG"
+ m.Add(Modifiers.New, t.Location);
+ break;
+ }
+ case 166: {
+ lexer.NextToken();
+
+#line 3379 "VBNET.ATG"
+ m.Add(Modifiers.Override, t.Location);
+ break;
+ }
+ case 143: {
+ lexer.NextToken();
+
+#line 3380 "VBNET.ATG"
+ m.Add(Modifiers.Abstract, t.Location);
+ break;
+ }
+ case 170: {
+ lexer.NextToken();
+
+#line 3381 "VBNET.ATG"
+ m.Add(Modifiers.Private, t.Location);
+ break;
+ }
+ case 172: {
+ lexer.NextToken();
+
+#line 3382 "VBNET.ATG"
+ m.Add(Modifiers.Protected, t.Location);
+ break;
+ }
+ case 173: {
+ lexer.NextToken();
+
+#line 3383 "VBNET.ATG"
+ m.Add(Modifiers.Public, t.Location);
+ break;
+ }
+ case 152: {
+ lexer.NextToken();
+
+#line 3384 "VBNET.ATG"
+ m.Add(Modifiers.Sealed, t.Location);
+ break;
+ }
+ case 153: {
+ lexer.NextToken();
+
+#line 3385 "VBNET.ATG"
+ m.Add(Modifiers.Sealed, t.Location);
+ break;
+ }
+ case 185: {
+ lexer.NextToken();
+
+#line 3386 "VBNET.ATG"
+ m.Add(Modifiers.Static, t.Location);
+ break;
+ }
+ case 165: {
+ lexer.NextToken();
+
+#line 3387 "VBNET.ATG"
+ m.Add(Modifiers.Virtual, t.Location);
+ break;
+ }
+ case 164: {
+ lexer.NextToken();
+
+#line 3388 "VBNET.ATG"
+ m.Add(Modifiers.Overloads, t.Location);
+ break;
+ }
+ case 175: {
+ lexer.NextToken();
+
+#line 3389 "VBNET.ATG"
+ m.Add(Modifiers.ReadOnly, t.Location);
+ break;
+ }
+ case 220: {
+ lexer.NextToken();
+
+#line 3390 "VBNET.ATG"
+ m.Add(Modifiers.WriteOnly, t.Location);
+ break;
+ }
+ case 219: {
+ lexer.NextToken();
+
+#line 3391 "VBNET.ATG"
+ m.Add(Modifiers.WithEvents, t.Location);
+ break;
+ }
+ case 92: {
+ lexer.NextToken();
+
+#line 3392 "VBNET.ATG"
+ m.Add(Modifiers.Dim, t.Location);
+ break;
+ }
+ case 168: {
+ lexer.NextToken();
+
+#line 3393 "VBNET.ATG"
+ m.Add(Modifiers.Partial, t.Location);
+ break;
+ }
+ default: SynErr(237); break;
+ }
+ }
+
+ void ClassMemberDecl(
+#line 761 "VBNET.ATG"
+ModifierList m, List<AttributeSection> attributes) {
+ StructureMemberDecl(
+#line 762 "VBNET.ATG"
+m, attributes);
+ }
+
+ void StructureMemberDecl(
+#line 775 "VBNET.ATG"
+ModifierList m, List<AttributeSection> attributes) {
+
+#line 777 "VBNET.ATG"
+ TypeReference type = null;
+ List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
+ Statement stmt = null;
+ List<VariableDeclaration> variableDeclarators = new List<VariableDeclaration>();
+ List<TemplateDefinition> templates = new List<TemplateDefinition>();
+
+ switch (la.kind) {
+ case 71: case 90: case 102: case 129: case 141: case 194: {
+ NonModuleDeclaration(
+#line 784 "VBNET.ATG"
+m, attributes);
+ break;
+ }
+ case 195: {
+ lexer.NextToken();
+
+#line 788 "VBNET.ATG"
+ Location startPos = t.Location;
+
+ if (StartOf(14)) {
+
+#line 792 "VBNET.ATG"
+ string name = String.Empty;
+ MethodDeclaration methodDeclaration; List<string> handlesClause = null;
+ List<InterfaceImplementation> implementsClause = null;
+
+ Identifier();
+
+#line 798 "VBNET.ATG"
+ name = t.val;
+ m.Check(Modifiers.VBMethods);
+
+ TypeParameterList(
+#line 801 "VBNET.ATG"
+templates);
+ if (la.kind == 25) {
+ lexer.NextToken();
+ if (StartOf(4)) {
+ FormalParameterList(
+#line 802 "VBNET.ATG"
+p);
+ }
+ Expect(26);
+ }
+ if (la.kind == 121 || la.kind == 123) {
+ if (la.kind == 123) {
+ ImplementsClause(
+#line 805 "VBNET.ATG"
+out implementsClause);
+ } else {
+ HandlesClause(
+#line 807 "VBNET.ATG"
+out handlesClause);
+ }
+ }
+
+#line 810 "VBNET.ATG"
+ Location endLocation = t.EndLocation;
+ if (
+#line 813 "VBNET.ATG"
+IsMustOverride(m)) {
+ EndOfStmt();
+
+#line 816 "VBNET.ATG"
+ methodDeclaration = new MethodDeclaration {
+ Name = name, Modifier = m.Modifier, Parameters = p, Attributes = attributes,
+ StartLocation = m.GetDeclarationLocation(startPos), EndLocation = endLocation,
+ TypeReference = new TypeReference("System.Void", true),
+ Templates = templates,
+ HandlesClause = handlesClause,
+ InterfaceImplementations = implementsClause
+ };
+ compilationUnit.AddChild(methodDeclaration);
+
+ } else if (la.kind == 1) {
+ lexer.NextToken();
+
+#line 829 "VBNET.ATG"
+ methodDeclaration = new MethodDeclaration {
+ Name = name, Modifier = m.Modifier, Parameters = p, Attributes = attributes,
+ StartLocation = m.GetDeclarationLocation(startPos), EndLocation = endLocation,
+ TypeReference = new TypeReference("System.Void", true),
+ Templates = templates,
+ HandlesClause = handlesClause,
+ InterfaceImplementations = implementsClause
+ };
+ compilationUnit.AddChild(methodDeclaration);
+
+
+#line 840 "VBNET.ATG"
+ if (ParseMethodBodies) {
+ Block(
+#line 841 "VBNET.ATG"
+out stmt);
+ Expect(100);
+ Expect(195);
+
+#line 843 "VBNET.ATG"
+ } else {
+ // don't parse method body
+ lexer.SkipCurrentBlock(Tokens.Sub); stmt = new BlockStatement();
+ }
+
+
+#line 849 "VBNET.ATG"
+ methodDeclaration.Body = (BlockStatement)stmt;
+
+#line 850 "VBNET.ATG"
+ methodDeclaration.Body.EndLocation = t.EndLocation;
+ EndOfStmt();
+ } else SynErr(238);
+ } else if (la.kind == 148) {
+ lexer.NextToken();
+ if (la.kind == 25) {
+ lexer.NextToken();
+ if (StartOf(4)) {
+ FormalParameterList(
+#line 854 "VBNET.ATG"
+p);
+ }
+ Expect(26);
+ }
+
+#line 855 "VBNET.ATG"
+ m.Check(Modifiers.Constructors);
+
+#line 856 "VBNET.ATG"
+ Location constructorEndLocation = t.EndLocation;
+ Expect(1);
+
+#line 859 "VBNET.ATG"
+ if (ParseMethodBodies) {
+ Block(
+#line 860 "VBNET.ATG"
+out stmt);
+ Expect(100);
+ Expect(195);
+
+#line 862 "VBNET.ATG"
+ } else {
+ // don't parse method body
+ lexer.SkipCurrentBlock(Tokens.Sub); stmt = new BlockStatement();
+ }
+
+
+#line 868 "VBNET.ATG"
+ Location endLocation = t.EndLocation;
+ EndOfStmt();
+
+#line 871 "VBNET.ATG"
+ ConstructorDeclaration cd = new ConstructorDeclaration("New", m.Modifier, p, attributes);
+ cd.StartLocation = m.GetDeclarationLocation(startPos);
+ cd.EndLocation = constructorEndLocation;
+ cd.Body = (BlockStatement)stmt;
+ cd.Body.EndLocation = endLocation;
+ compilationUnit.AddChild(cd);
+
+ } else SynErr(239);
+ break;
+ }
+ case 114: {
+ lexer.NextToken();
+
+#line 883 "VBNET.ATG"
+ m.Check(Modifiers.VBMethods);
+ string name = String.Empty;
+ Location startPos = t.Location;
+ MethodDeclaration methodDeclaration;List<string> handlesClause = null;
+ List<InterfaceImplementation> implementsClause = null;
+ AttributeSection returnTypeAttributeSection = null;
+
+ Identifier();
+
+#line 890 "VBNET.ATG"
+ name = t.val;
+ TypeParameterList(
+#line 891 "VBNET.ATG"
+templates);
+ if (la.kind == 25) {
+ lexer.NextToken();
+ if (StartOf(4)) {
+ FormalParameterList(
+#line 892 "VBNET.ATG"
+p);
+ }
+ Expect(26);
+ }
+ if (la.kind == 50) {
+ lexer.NextToken();
+ while (la.kind == 28) {
+ AttributeSection(
+#line 893 "VBNET.ATG"
+out returnTypeAttributeSection);
+ }
+ TypeName(
+#line 893 "VBNET.ATG"
+out type);
+ }
+
+#line 895 "VBNET.ATG"
+ if(type == null) {
+ type = new TypeReference("System.Object", true);
+ }
+
+ if (la.kind == 121 || la.kind == 123) {
+ if (la.kind == 123) {
+ ImplementsClause(
+#line 901 "VBNET.ATG"
+out implementsClause);
+ } else {
+ HandlesClause(
+#line 903 "VBNET.ATG"
+out handlesClause);
+ }
+ }
+ if (
+#line 908 "VBNET.ATG"
+IsMustOverride(m)) {
+ EndOfStmt();
+
+#line 911 "VBNET.ATG"
+ methodDeclaration = new MethodDeclaration {
+ Name = name, Modifier = m.Modifier, TypeReference = type,
+ Parameters = p, Attributes = attributes,
+ StartLocation = m.GetDeclarationLocation(startPos),
+ EndLocation = t.EndLocation,
+ HandlesClause = handlesClause,
+ Templates = templates,
+ InterfaceImplementations = implementsClause
+ };
+ if (returnTypeAttributeSection != null) {
+ returnTypeAttributeSection.AttributeTarget = "return";
+ methodDeclaration.Attributes.Add(returnTypeAttributeSection);
+ }
+ compilationUnit.AddChild(methodDeclaration);
+
+ } else if (la.kind == 1) {
+ lexer.NextToken();
+
+#line 929 "VBNET.ATG"
+ methodDeclaration = new MethodDeclaration {
+ Name = name, Modifier = m.Modifier, TypeReference = type,
+ Parameters = p, Attributes = attributes,
+ StartLocation = m.GetDeclarationLocation(startPos),
+ EndLocation = t.EndLocation,
+ Templates = templates,
+ HandlesClause = handlesClause,
+ InterfaceImplementations = implementsClause
+ };
+ if (returnTypeAttributeSection != null) {
+ returnTypeAttributeSection.AttributeTarget = "return";
+ methodDeclaration.Attributes.Add(returnTypeAttributeSection);
+ }
+
+ compilationUnit.AddChild(methodDeclaration);
+
+ if (ParseMethodBodies) {
+ Block(
+#line 946 "VBNET.ATG"
+out stmt);
+ Expect(100);
+ Expect(114);
+
+#line 948 "VBNET.ATG"
+ } else {
+ // don't parse method body
+ lexer.SkipCurrentBlock(Tokens.Function); stmt = new BlockStatement();
+ }
+ methodDeclaration.Body = (BlockStatement)stmt;
+ methodDeclaration.Body.StartLocation = methodDeclaration.EndLocation;
+ methodDeclaration.Body.EndLocation = t.EndLocation;
+
+ EndOfStmt();
+ } else SynErr(240);
+ break;
+ }
+ case 88: {
+ lexer.NextToken();
+
+#line 962 "VBNET.ATG"
+ m.Check(Modifiers.VBExternalMethods);
+ Location startPos = t.Location;
+ CharsetModifier charsetModifer = CharsetModifier.None;
+ string library = String.Empty;
+ string alias = null;
+ string name = String.Empty;
+
+ if (StartOf(15)) {
+ Charset(
+#line 969 "VBNET.ATG"
+out charsetModifer);
+ }
+ if (la.kind == 195) {
+ lexer.NextToken();
+ Identifier();
+
+#line 972 "VBNET.ATG"
+ name = t.val;
+ Expect(135);
+ Expect(3);
+
+#line 973 "VBNET.ATG"
+ library = t.literalValue as string;
+ if (la.kind == 46) {
+ lexer.NextToken();
+ Expect(3);
+
+#line 974 "VBNET.ATG"
+ alias = t.literalValue as string;
+ }
+ if (la.kind == 25) {
+ lexer.NextToken();
+ if (StartOf(4)) {
+ FormalParameterList(
+#line 975 "VBNET.ATG"
+p);
+ }
+ Expect(26);
+ }
+ EndOfStmt();
+
+#line 978 "VBNET.ATG"
+ DeclareDeclaration declareDeclaration = new DeclareDeclaration(name, m.Modifier, null, p, attributes, library, alias, charsetModifer);
+ declareDeclaration.StartLocation = m.GetDeclarationLocation(startPos);
+ declareDeclaration.EndLocation = t.EndLocation;
+ compilationUnit.AddChild(declareDeclaration);
+
+ } else if (la.kind == 114) {
+ lexer.NextToken();
+ Identifier();
+
+#line 985 "VBNET.ATG"
+ name = t.val;
+ Expect(135);
+ Expect(3);
+
+#line 986 "VBNET.ATG"
+ library = t.literalValue as string;
+ if (la.kind == 46) {
+ lexer.NextToken();
+ Expect(3);
+
+#line 987 "VBNET.ATG"
+ alias = t.literalValue as string;
+ }
+ if (la.kind == 25) {
+ lexer.NextToken();
+ if (StartOf(4)) {
+ FormalParameterList(
+#line 988 "VBNET.ATG"
+p);
+ }
+ Expect(26);
+ }
+ if (la.kind == 50) {
+ lexer.NextToken();
+ TypeName(
+#line 989 "VBNET.ATG"
+out type);
+ }
+ EndOfStmt();
+
+#line 992 "VBNET.ATG"
+ DeclareDeclaration declareDeclaration = new DeclareDeclaration(name, m.Modifier, type, p, attributes, library, alias, charsetModifer);
+ declareDeclaration.StartLocation = m.GetDeclarationLocation(startPos);
+ declareDeclaration.EndLocation = t.EndLocation;
+ compilationUnit.AddChild(declareDeclaration);
+
+ } else SynErr(241);
+ break;
+ }
+ case 106: {
+ lexer.NextToken();
+
+#line 1002 "VBNET.ATG"
+ m.Check(Modifiers.VBEvents);
+ Location startPos = t.Location;
+ EventDeclaration eventDeclaration;
+ string name = String.Empty;
+ List<InterfaceImplementation> implementsClause = null;
+
+ Identifier();
+
+#line 1008 "VBNET.ATG"
+ name= t.val;
+ if (la.kind == 50) {
+ lexer.NextToken();
+ TypeName(
+#line 1010 "VBNET.ATG"
+out type);
+ } else if (StartOf(16)) {
+ if (la.kind == 25) {
+ lexer.NextToken();
+ if (StartOf(4)) {
+ FormalParameterList(
+#line 1012 "VBNET.ATG"
+p);
+ }
+ Expect(26);
+ }
+ } else SynErr(242);
+ if (la.kind == 123) {
+ ImplementsClause(
+#line 1014 "VBNET.ATG"
+out implementsClause);
+ }
+
+#line 1016 "VBNET.ATG"
+ eventDeclaration = new EventDeclaration {
+ Name = name, TypeReference = type, Modifier = m.Modifier,
+ Parameters = p, Attributes = attributes, InterfaceImplementations = implementsClause,
+ StartLocation = m.GetDeclarationLocation(startPos),
+ EndLocation = t.EndLocation
+ };
+ compilationUnit.AddChild(eventDeclaration);
+
+ EndOfStmt();
+ break;
+ }
+ case 2: case 45: case 49: case 51: case 52: case 53: case 54: case 57: case 74: case 91: case 94: case 103: case 108: case 113: case 120: case 126: case 130: case 133: case 156: case 162: case 169: case 188: case 197: case 198: case 208: case 209: case 215: {
+
+#line 1026 "VBNET.ATG"
+ Location startPos = t.Location;
+
+#line 1028 "VBNET.ATG"
+ m.Check(Modifiers.Fields);
+ FieldDeclaration fd = new FieldDeclaration(attributes, null, m.Modifier);
+ fd.StartLocation = m.GetDeclarationLocation(startPos);
+
+ IdentifierForFieldDeclaration();
+
+#line 1032 "VBNET.ATG"
+ string name = t.val;
+ VariableDeclaratorPartAfterIdentifier(
+#line 1033 "VBNET.ATG"
+variableDeclarators, name);
+ while (la.kind == 12) {
+ lexer.NextToken();
+ VariableDeclarator(
+#line 1034 "VBNET.ATG"
+variableDeclarators);
+ }
+ EndOfStmt();
+
+#line 1037 "VBNET.ATG"
+ fd.EndLocation = t.EndLocation;
+ fd.Fields = variableDeclarators;
+ compilationUnit.AddChild(fd);
+
+ break;
+ }
+ case 75: {
+
+#line 1042 "VBNET.ATG"
+ m.Check(Modifiers.Fields);
+ lexer.NextToken();
+
+#line 1043 "VBNET.ATG"
+ m.Add(Modifiers.Const, t.Location);
+
+#line 1045 "VBNET.ATG"
+ FieldDeclaration fd = new FieldDeclaration(attributes, type, m.Modifier);
+ fd.StartLocation = m.GetDeclarationLocation(t.Location);
+ List<VariableDeclaration> constantDeclarators = new List<VariableDeclaration>();
+
+ ConstantDeclarator(
+#line 1049 "VBNET.ATG"
+constantDeclarators);
+ while (la.kind == 12) {
+ lexer.NextToken();
+ ConstantDeclarator(
+#line 1050 "VBNET.ATG"
+constantDeclarators);
+ }
+
+#line 1052 "VBNET.ATG"
+ fd.Fields = constantDeclarators;
+ fd.EndLocation = t.Location;
+
+ EndOfStmt();
+
+#line 1057 "VBNET.ATG"
+ fd.EndLocation = t.EndLocation;
+ compilationUnit.AddChild(fd);
+
+ break;
+ }
+ case 171: {
+ lexer.NextToken();
+
+#line 1063 "VBNET.ATG"
+ m.Check(Modifiers.VBProperties);
+ Location startPos = t.Location;
+ List<InterfaceImplementation> implementsClause = null;
+
+ Identifier();
+
+#line 1067 "VBNET.ATG"
+ string propertyName = t.val;
+ if (la.kind == 25) {
+ lexer.NextToken();
+ if (StartOf(4)) {
+ FormalParameterList(
+#line 1068 "VBNET.ATG"
+p);
+ }
+ Expect(26);
+ }
+ if (la.kind == 50) {
+ lexer.NextToken();
+ TypeName(
+#line 1069 "VBNET.ATG"
+out type);
+ }
+
+#line 1071 "VBNET.ATG"
+ if(type == null) {
+ type = new TypeReference("System.Object", true);
+ }
+
+ if (la.kind == 123) {
+ ImplementsClause(
+#line 1075 "VBNET.ATG"
+out implementsClause);
+ }
+ EndOfStmt();
+ if (
+#line 1079 "VBNET.ATG"
+IsMustOverride(m)) {
+
+#line 1081 "VBNET.ATG"
+ PropertyDeclaration pDecl = new PropertyDeclaration(propertyName, type, m.Modifier, attributes);
+ pDecl.StartLocation = m.GetDeclarationLocation(startPos);
+ pDecl.EndLocation = t.Location;
+ pDecl.TypeReference = type;
+ pDecl.InterfaceImplementations = implementsClause;
+ pDecl.Parameters = p;
+ compilationUnit.AddChild(pDecl);
+
+ } else if (StartOf(17)) {
+
+#line 1091 "VBNET.ATG"
+ PropertyDeclaration pDecl = new PropertyDeclaration(propertyName, type, m.Modifier, attributes);
+ pDecl.StartLocation = m.GetDeclarationLocation(startPos);
+ pDecl.EndLocation = t.Location;
+ pDecl.BodyStart = t.Location;
+ pDecl.TypeReference = type;
+ pDecl.InterfaceImplementations = implementsClause;
+ pDecl.Parameters = p;
+ PropertyGetRegion getRegion;
+ PropertySetRegion setRegion;
+
+ AccessorDecls(
+#line 1101 "VBNET.ATG"
+out getRegion, out setRegion);
+ Expect(100);
+ Expect(171);
+ EndOfStmt();
+
+#line 1105 "VBNET.ATG"
+ pDecl.GetRegion = getRegion;
+ pDecl.SetRegion = setRegion;
+ pDecl.BodyEnd = t.EndLocation;
+ compilationUnit.AddChild(pDecl);
+
+ } else SynErr(243);
+ break;
+ }
+ case 85: {
+ lexer.NextToken();
+
+#line 1112 "VBNET.ATG"
+ Location startPos = t.Location;
+ Expect(106);
+
+#line 1114 "VBNET.ATG"
+ m.Check(Modifiers.VBCustomEvents);
+ EventAddRemoveRegion eventAccessorDeclaration;
+ EventAddRegion addHandlerAccessorDeclaration = null;
+ EventRemoveRegion removeHandlerAccessorDeclaration = null;
+ EventRaiseRegion raiseEventAccessorDeclaration = null;
+ List<InterfaceImplementation> implementsClause = null;
+
+ Identifier();
+
+#line 1121 "VBNET.ATG"
+ string customEventName = t.val;
+ Expect(50);
+ TypeName(
+#line 1122 "VBNET.ATG"
+out type);
+ if (la.kind == 123) {
+ ImplementsClause(
+#line 1123 "VBNET.ATG"
+out implementsClause);
+ }
+ EndOfStmt();
+ while (StartOf(18)) {
+ EventAccessorDeclaration(
+#line 1126 "VBNET.ATG"
+out eventAccessorDeclaration);
+
+#line 1128 "VBNET.ATG"
+ if(eventAccessorDeclaration is EventAddRegion)
+ {
+ addHandlerAccessorDeclaration = (EventAddRegion)eventAccessorDeclaration;
+ }
+ else if(eventAccessorDeclaration is EventRemoveRegion)
+ {
+ removeHandlerAccessorDeclaration = (EventRemoveRegion)eventAccessorDeclaration;
+ }
+ else if(eventAccessorDeclaration is EventRaiseRegion)
+ {
+ raiseEventAccessorDeclaration = (EventRaiseRegion)eventAccessorDeclaration;
+ }
+
+ }
+ Expect(100);
+ Expect(106);
+ EndOfStmt();
+
+#line 1144 "VBNET.ATG"
+ if(addHandlerAccessorDeclaration == null)
+ {
+ Error("Need to provide AddHandler accessor.");
+ }
+
+ if(removeHandlerAccessorDeclaration == null)
+ {
+ Error("Need to provide RemoveHandler accessor.");
+ }
+
+ if(raiseEventAccessorDeclaration == null)
+ {
+ Error("Need to provide RaiseEvent accessor.");
+ }
+
+ EventDeclaration decl = new EventDeclaration {
+ TypeReference = type, Name = customEventName, Modifier = m.Modifier,
+ Attributes = attributes,
+ StartLocation = m.GetDeclarationLocation(startPos),
+ EndLocation = t.EndLocation,
+ AddRegion = addHandlerAccessorDeclaration,
+ RemoveRegion = removeHandlerAccessorDeclaration,
+ RaiseRegion = raiseEventAccessorDeclaration
+ };
+ compilationUnit.AddChild(decl);
+
+ break;
+ }
+ case 147: case 158: case 217: {
+
+#line 1170 "VBNET.ATG"
+ ConversionType opConversionType = ConversionType.None;
+ if (la.kind == 147 || la.kind == 217) {
+ if (la.kind == 217) {
+ lexer.NextToken();
+
+#line 1171 "VBNET.ATG"
+ opConversionType = ConversionType.Implicit;
+ } else {
+ lexer.NextToken();
+
+#line 1172 "VBNET.ATG"
+ opConversionType = ConversionType.Explicit;
+ }
+ }
+ Expect(158);
+
+#line 1175 "VBNET.ATG"
+ m.Check(Modifiers.VBOperators);
+ Location startPos = t.Location;
+ TypeReference returnType = NullTypeReference.Instance;
+ TypeReference operandType = NullTypeReference.Instance;
+ string operandName;
+ OverloadableOperatorType operatorType;
+ AttributeSection section;
+ List<ParameterDeclarationExpression> parameters = new List<ParameterDeclarationExpression>();
+ List<AttributeSection> returnTypeAttributes = new List<AttributeSection>();
+
+ OverloadableOperator(
+#line 1185 "VBNET.ATG"
+out operatorType);
+ Expect(25);
+ if (la.kind == 59) {
+ lexer.NextToken();
+ }
+ Identifier();
+
+#line 1186 "VBNET.ATG"
+ operandName = t.val;
+ if (la.kind == 50) {
+ lexer.NextToken();
+ TypeName(
+#line 1187 "VBNET.ATG"
+out operandType);
+ }
+
+#line 1188 "VBNET.ATG"
+ parameters.Add(new ParameterDeclarationExpression(operandType, operandName, ParameterModifiers.In));
+ while (la.kind == 12) {
+ lexer.NextToken();
+ if (la.kind == 59) {
+ lexer.NextToken();
+ }
+ Identifier();
+
+#line 1192 "VBNET.ATG"
+ operandName = t.val;
+ if (la.kind == 50) {
+ lexer.NextToken();
+ TypeName(
+#line 1193 "VBNET.ATG"
+out operandType);
+ }
+
+#line 1194 "VBNET.ATG"
+ parameters.Add(new ParameterDeclarationExpression(operandType, operandName, ParameterModifiers.In));
+ }
+ Expect(26);
+
+#line 1197 "VBNET.ATG"
+ Location endPos = t.EndLocation;
+ if (la.kind == 50) {
+ lexer.NextToken();
+ while (la.kind == 28) {
+ AttributeSection(
+#line 1198 "VBNET.ATG"
+out section);
+
+#line 1198 "VBNET.ATG"
+ returnTypeAttributes.Add(section);
+ }
+ TypeName(
+#line 1198 "VBNET.ATG"
+out returnType);
+
+#line 1198 "VBNET.ATG"
+ endPos = t.EndLocation;
+ }
+ Expect(1);
+ Block(
+#line 1200 "VBNET.ATG"
+out stmt);
+ Expect(100);
+ Expect(158);
+ EndOfStmt();
+
+#line 1202 "VBNET.ATG"
+ OperatorDeclaration operatorDeclaration = new OperatorDeclaration {
+ Modifier = m.Modifier,
+ Attributes = attributes,
+ Parameters = parameters,
+ TypeReference = returnType,
+ OverloadableOperator = operatorType,
+ ConversionType = opConversionType,
+ ReturnTypeAttributes = returnTypeAttributes,
+ Body = (BlockStatement)stmt,
+ StartLocation = m.GetDeclarationLocation(startPos),
+ EndLocation = endPos
+ };
+ operatorDeclaration.Body.StartLocation = startPos;
+ operatorDeclaration.Body.EndLocation = t.Location;
+ compilationUnit.AddChild(operatorDeclaration);
+
+ break;
+ }
+ default: SynErr(244); break;
+ }
+ }
+
+ void EnumMemberDecl(
+#line 743 "VBNET.ATG"
+out FieldDeclaration f) {
+
+#line 745 "VBNET.ATG"
+ Expression expr = null;List<AttributeSection> attributes = new List<AttributeSection>();
+ AttributeSection section = null;
+ VariableDeclaration varDecl = null;
+
+ while (la.kind == 28) {
+ AttributeSection(
+#line 749 "VBNET.ATG"
+out section);
+
+#line 749 "VBNET.ATG"
+ attributes.Add(section);
+ }
+ Identifier();
+
+#line 752 "VBNET.ATG"
+ f = new FieldDeclaration(attributes);
+ varDecl = new VariableDeclaration(t.val);
+ f.Fields.Add(varDecl);
+ f.StartLocation = varDecl.StartLocation = t.Location;
+
+ if (la.kind == 10) {
+ lexer.NextToken();
+ Expr(
+#line 757 "VBNET.ATG"
+out expr);
+
+#line 757 "VBNET.ATG"
+ varDecl.Initializer = expr;
+ }
+ EndOfStmt();
+ }
+
+ void InterfaceMemberDecl() {
+
+#line 634 "VBNET.ATG"
+ TypeReference type =null;
+ List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
+ List<TemplateDefinition> templates = new List<TemplateDefinition>();
+ AttributeSection section, returnTypeAttributeSection = null;
+ ModifierList mod = new ModifierList();
+ List<AttributeSection> attributes = new List<AttributeSection>();
+ string name;
+
+ if (StartOf(19)) {
+ while (la.kind == 28) {
+ AttributeSection(
+#line 642 "VBNET.ATG"
+out section);
+
+#line 642 "VBNET.ATG"
+ attributes.Add(section);
+ }
+ while (StartOf(9)) {
+ MemberModifier(
+#line 645 "VBNET.ATG"
+mod);
+ }
+ if (la.kind == 106) {
+ lexer.NextToken();
+
+#line 649 "VBNET.ATG"
+ mod.Check(Modifiers.VBInterfaceEvents);
+ Location startLocation = t.Location;
+
+ Identifier();
+
+#line 652 "VBNET.ATG"
+ name = t.val;
+ if (la.kind == 25) {
+ lexer.NextToken();
+ if (StartOf(4)) {
+ FormalParameterList(
+#line 653 "VBNET.ATG"
+p);
+ }
+ Expect(26);
+ }
+ if (la.kind == 50) {
+ lexer.NextToken();
+ TypeName(
+#line 654 "VBNET.ATG"
+out type);
+ }
+ EndOfStmt();
+
+#line 657 "VBNET.ATG"
+ EventDeclaration ed = new EventDeclaration {
+ Name = name, TypeReference = type, Modifier = mod.Modifier,
+ Parameters = p, Attributes = attributes,
+ StartLocation = startLocation, EndLocation = t.EndLocation
+ };
+ compilationUnit.AddChild(ed);
+
+ } else if (la.kind == 195) {
+ lexer.NextToken();
+
+#line 667 "VBNET.ATG"
+ Location startLocation = t.Location;
+ mod.Check(Modifiers.VBInterfaceMethods);
+
+ Identifier();
+
+#line 670 "VBNET.ATG"
+ name = t.val;
+ TypeParameterList(
+#line 671 "VBNET.ATG"
+templates);
+ if (la.kind == 25) {
+ lexer.NextToken();
+ if (StartOf(4)) {
+ FormalParameterList(
+#line 672 "VBNET.ATG"
+p);
+ }
+ Expect(26);
+ }
+ EndOfStmt();
+
+#line 675 "VBNET.ATG"
+ MethodDeclaration md = new MethodDeclaration {
+ Name = name,
+ Modifier = mod.Modifier,
+ Parameters = p,
+ Attributes = attributes,
+ TypeReference = new TypeReference("System.Void", true),
+ StartLocation = startLocation,
+ EndLocation = t.EndLocation,
+ Templates = templates
+ };
+ compilationUnit.AddChild(md);
+
+ } else if (la.kind == 114) {
+ lexer.NextToken();
+
+#line 690 "VBNET.ATG"
+ mod.Check(Modifiers.VBInterfaceMethods);
+ Location startLocation = t.Location;
+
+ Identifier();
+
+#line 693 "VBNET.ATG"
+ name = t.val;
+ TypeParameterList(
+#line 694 "VBNET.ATG"
+templates);
+ if (la.kind == 25) {
+ lexer.NextToken();
+ if (StartOf(4)) {
+ FormalParameterList(
+#line 695 "VBNET.ATG"
+p);
+ }
+ Expect(26);
+ }
+ if (la.kind == 50) {
+ lexer.NextToken();
+ while (la.kind == 28) {
+ AttributeSection(
+#line 696 "VBNET.ATG"
+out returnTypeAttributeSection);
+ }
+ TypeName(
+#line 696 "VBNET.ATG"
+out type);
+ }
+
+#line 698 "VBNET.ATG"
+ if(type == null) {
+ type = new TypeReference("System.Object", true);
+ }
+ MethodDeclaration md = new MethodDeclaration {
+ Name = name, Modifier = mod.Modifier,
+ TypeReference = type, Parameters = p, Attributes = attributes
+ };
+ if (returnTypeAttributeSection != null) {
+ returnTypeAttributeSection.AttributeTarget = "return";
+ md.Attributes.Add(returnTypeAttributeSection);
+ }
+ md.StartLocation = startLocation;
+ md.EndLocation = t.EndLocation;
+ md.Templates = templates;
+ compilationUnit.AddChild(md);
+
+ EndOfStmt();
+ } else if (la.kind == 171) {
+ lexer.NextToken();
+
+#line 718 "VBNET.ATG"
+ Location startLocation = t.Location;
+ mod.Check(Modifiers.VBInterfaceProperties);
+
+ Identifier();
+
+#line 721 "VBNET.ATG"
+ name = t.val;
+ if (la.kind == 25) {
+ lexer.NextToken();
+ if (StartOf(4)) {
+ FormalParameterList(
+#line 722 "VBNET.ATG"
+p);
+ }
+ Expect(26);
+ }
+ if (la.kind == 50) {
+ lexer.NextToken();
+ TypeName(
+#line 723 "VBNET.ATG"
+out type);
+ }
+
+#line 725 "VBNET.ATG"
+ if(type == null) {
+ type = new TypeReference("System.Object", true);
+ }
+
+ EndOfStmt();
+
+#line 731 "VBNET.ATG"
+ PropertyDeclaration pd = new PropertyDeclaration(name, type, mod.Modifier, attributes);
+ pd.Parameters = p;
+ pd.EndLocation = t.EndLocation;
+ pd.StartLocation = startLocation;
+ compilationUnit.AddChild(pd);
+
+ } else SynErr(245);
+ } else if (StartOf(20)) {
+ NonModuleDeclaration(
+#line 739 "VBNET.ATG"
+mod, attributes);
+ } else SynErr(246);
+ }
+
+ void Expr(
+#line 1607 "VBNET.ATG"
+out Expression expr) {
+
+#line 1608 "VBNET.ATG"
+ expr = null;
+ if (
+#line 1609 "VBNET.ATG"
+IsQueryExpression() ) {
+ QueryExpr(
+#line 1610 "VBNET.ATG"
+out expr);
+ } else if (la.kind == 114) {
+ LambdaExpr(
+#line 1611 "VBNET.ATG"
+out expr);
+ } else if (StartOf(21)) {
+ DisjunctionExpr(
+#line 1612 "VBNET.ATG"
+out expr);
+ } else SynErr(247);
+ }
+
+ void ImplementsClause(
+#line 1580 "VBNET.ATG"
+out List<InterfaceImplementation> baseInterfaces) {
+
+#line 1582 "VBNET.ATG"
+ baseInterfaces = new List<InterfaceImplementation>();
+ TypeReference type = null;
+ string memberName = null;
+
+ Expect(123);
+ NonArrayTypeName(
+#line 1587 "VBNET.ATG"
+out type, false);
+
+#line 1588 "VBNET.ATG"
+ if (type != null) memberName = TypeReference.StripLastIdentifierFromType(ref type);
+
+#line 1589 "VBNET.ATG"
+ baseInterfaces.Add(new InterfaceImplementation(type, memberName));
+ while (la.kind == 12) {
+ lexer.NextToken();
+ NonArrayTypeName(
+#line 1591 "VBNET.ATG"
+out type, false);
+
+#line 1592 "VBNET.ATG"
+ if (type != null) memberName = TypeReference.StripLastIdentifierFromType(ref type);
+
+#line 1593 "VBNET.ATG"
+ baseInterfaces.Add(new InterfaceImplementation(type, memberName));
+ }
+ }
+
+ void HandlesClause(
+#line 1538 "VBNET.ATG"
+out List<string> handlesClause) {
+
+#line 1540 "VBNET.ATG"
+ handlesClause = new List<string>();
+ string name;
+
+ Expect(121);
+ EventMemberSpecifier(
+#line 1543 "VBNET.ATG"
+out name);
+
+#line 1543 "VBNET.ATG"
+ if (name != null) handlesClause.Add(name);
+ while (la.kind == 12) {
+ lexer.NextToken();
+ EventMemberSpecifier(
+#line 1544 "VBNET.ATG"
+out name);
+
+#line 1544 "VBNET.ATG"
+ if (name != null) handlesClause.Add(name);
+ }
+ }
+
+ void Block(
+#line 2680 "VBNET.ATG"
+out Statement stmt) {
+
+#line 2683 "VBNET.ATG"
+ BlockStatement blockStmt = new BlockStatement();
+ /* in snippet parsing mode, t might be null */
+ if (t != null) blockStmt.StartLocation = t.EndLocation;
+ compilationUnit.BlockStart(blockStmt);
+
+ while (StartOf(22) ||
+#line 2689 "VBNET.ATG"
+IsEndStmtAhead()) {
+ if (
+#line 2689 "VBNET.ATG"
+IsEndStmtAhead()) {
+ Expect(100);
+ EndOfStmt();
+
+#line 2689 "VBNET.ATG"
+ compilationUnit.AddChild(new EndStatement());
+ } else {
+ Statement();
+ EndOfStmt();
+ }
+ }
+
+#line 2694 "VBNET.ATG"
+ stmt = blockStmt;
+ if (t != null) blockStmt.EndLocation = t.EndLocation;
+ compilationUnit.BlockEnd();
+
+ }
+
+ void Charset(
+#line 1530 "VBNET.ATG"
+out CharsetModifier charsetModifier) {
+
+#line 1531 "VBNET.ATG"
+ charsetModifier = CharsetModifier.None;
+ if (la.kind == 114 || la.kind == 195) {
+ } else if (la.kind == 49) {
+ lexer.NextToken();
+
+#line 1532 "VBNET.ATG"
+ charsetModifier = CharsetModifier.Ansi;
+ } else if (la.kind == 53) {
+ lexer.NextToken();
+
+#line 1533 "VBNET.ATG"
+ charsetModifier = CharsetModifier.Auto;
+ } else if (la.kind == 208) {
+ lexer.NextToken();
+
+#line 1534 "VBNET.ATG"
+ charsetModifier = CharsetModifier.Unicode;
+ } else SynErr(248);
+ }
+
+ void IdentifierForFieldDeclaration() {
+ switch (la.kind) {
+ case 2: {
+ lexer.NextToken();
+ break;
+ }
+ case 45: {
+ lexer.NextToken();
+ break;
+ }
+ case 49: {
+ lexer.NextToken();
+ break;
+ }
+ case 51: {
+ lexer.NextToken();
+ break;
+ }
+ case 52: {
+ lexer.NextToken();
+ break;
+ }
+ case 53: {
+ lexer.NextToken();
+ break;
+ }
+ case 54: {
+ lexer.NextToken();
+ break;
+ }
+ case 57: {
+ lexer.NextToken();
+ break;
+ }
+ case 74: {
+ lexer.NextToken();
+ break;
+ }
+ case 91: {
+ lexer.NextToken();
+ break;
+ }
+ case 94: {
+ lexer.NextToken();
+ break;
+ }
+ case 103: {
+ lexer.NextToken();
+ break;
+ }
+ case 108: {
+ lexer.NextToken();
+ break;
+ }
+ case 113: {
+ lexer.NextToken();
+ break;
+ }
+ case 120: {
+ lexer.NextToken();
+ break;
+ }
+ case 126: {
+ lexer.NextToken();
+ break;
+ }
+ case 130: {
+ lexer.NextToken();
+ break;
+ }
+ case 133: {
+ lexer.NextToken();
+ break;
+ }
+ case 156: {
+ lexer.NextToken();
+ break;
+ }
+ case 162: {
+ lexer.NextToken();
+ break;
+ }
+ case 169: {
+ lexer.NextToken();
+ break;
+ }
+ case 188: {
+ lexer.NextToken();
+ break;
+ }
+ case 197: {
+ lexer.NextToken();
+ break;
+ }
+ case 198: {
+ lexer.NextToken();
+ break;
+ }
+ case 208: {
+ lexer.NextToken();
+ break;
+ }
+ case 209: {
+ lexer.NextToken();
+ break;
+ }
+ case 215: {
+ lexer.NextToken();
+ break;
+ }
+ default: SynErr(249); break;
+ }
+ }
+
+ void VariableDeclaratorPartAfterIdentifier(
+#line 1406 "VBNET.ATG"
+List<VariableDeclaration> fieldDeclaration, string name) {
+
+#line 1408 "VBNET.ATG"
+ Expression expr = null;
+ TypeReference type = null;
+ ArrayList rank = null;
+ List<Expression> dimension = null;
+ Location startLocation = t.Location;
+
+ if (
+#line 1414 "VBNET.ATG"
+IsSize() && !IsDims()) {
+ ArrayInitializationModifier(
+#line 1414 "VBNET.ATG"
+out dimension);
+ }
+ if (
+#line 1415 "VBNET.ATG"
+IsDims()) {
+ ArrayNameModifier(
+#line 1415 "VBNET.ATG"
+out rank);
+ }
+ if (
+#line 1417 "VBNET.ATG"
+IsObjectCreation()) {
+ Expect(50);
+ ObjectCreateExpression(
+#line 1417 "VBNET.ATG"
+out expr);
+
+#line 1419 "VBNET.ATG"
+ if (expr is ObjectCreateExpression) {
+ type = ((ObjectCreateExpression)expr).CreateType.Clone();
+ } else {
+ type = ((ArrayCreateExpression)expr).CreateType.Clone();
+ }
+
+ } else if (StartOf(23)) {
+ if (la.kind == 50) {
+ lexer.NextToken();
+ TypeName(
+#line 1426 "VBNET.ATG"
+out type);
+
+#line 1428 "VBNET.ATG"
+ if (type != null) {
+ for (int i = fieldDeclaration.Count - 1; i >= 0; i--) {
+ VariableDeclaration vd = fieldDeclaration[i];
+ if (vd.TypeReference.Type.Length > 0) break;
+ TypeReference newType = type.Clone();
+ newType.RankSpecifier = vd.TypeReference.RankSpecifier;
+ vd.TypeReference = newType;
+ }
+ }
+
+ }
+
+#line 1440 "VBNET.ATG"
+ if (type == null && (dimension != null || rank != null)) {
+ type = new TypeReference("");
+ }
+ if (dimension != null) {
+ if(type.RankSpecifier != null) {
+ Error("array rank only allowed one time");
+ } else {
+ if (rank == null) {
+ type.RankSpecifier = new int[] { dimension.Count - 1 };
+ } else {
+ rank.Insert(0, dimension.Count - 1);
+ type.RankSpecifier = (int[])rank.ToArray(typeof(int));
+ }
+ expr = new ArrayCreateExpression(type.Clone(), dimension);
+ }
+ } else if (rank != null) {
+ if(type.RankSpecifier != null) {
+ Error("array rank only allowed one time");
+ } else {
+ type.RankSpecifier = (int[])rank.ToArray(typeof(int));
+ }
+ }
+
+ if (la.kind == 10) {
+ lexer.NextToken();
+ VariableInitializer(
+#line 1463 "VBNET.ATG"
+out expr);
+ }
+ } else SynErr(250);
+
+#line 1466 "VBNET.ATG"
+ VariableDeclaration varDecl = new VariableDeclaration(name, expr, type);
+ varDecl.StartLocation = startLocation;
+ varDecl.EndLocation = t.Location;
+ fieldDeclaration.Add(varDecl);
+
+ }
+
+ void VariableDeclarator(
+#line 1400 "VBNET.ATG"
+List<VariableDeclaration> fieldDeclaration) {
+ Identifier();
+
+#line 1402 "VBNET.ATG"
+ string name = t.val;
+ VariableDeclaratorPartAfterIdentifier(
+#line 1403 "VBNET.ATG"
+fieldDeclaration, name);
+ }
+
+ void ConstantDeclarator(
+#line 1381 "VBNET.ATG"
+List<VariableDeclaration> constantDeclaration) {
+
+#line 1383 "VBNET.ATG"
+ Expression expr = null;
+ TypeReference type = null;
+ string name = String.Empty;
+ Location location;
+
+ Identifier();
+
+#line 1388 "VBNET.ATG"
+ name = t.val; location = t.Location;
+ if (la.kind == 50) {
+ lexer.NextToken();
+ TypeName(
+#line 1389 "VBNET.ATG"
+out type);
+ }
+ Expect(10);
+ Expr(
+#line 1390 "VBNET.ATG"
+out expr);
+
+#line 1392 "VBNET.ATG"
+ VariableDeclaration f = new VariableDeclaration(name, expr);
+ f.TypeReference = type;
+ f.StartLocation = location;
+ constantDeclaration.Add(f);
+
+ }
+
+ void AccessorDecls(
+#line 1315 "VBNET.ATG"
+out PropertyGetRegion getBlock, out PropertySetRegion setBlock) {
+
+#line 1317 "VBNET.ATG"
+ List<AttributeSection> attributes = new List<AttributeSection>();
+ AttributeSection section;
+ getBlock = null;
+ setBlock = null;
+
+ while (la.kind == 28) {
+ AttributeSection(
+#line 1322 "VBNET.ATG"
+out section);
+
+#line 1322 "VBNET.ATG"
+ attributes.Add(section);
+ }
+ if (StartOf(24)) {
+ GetAccessorDecl(
+#line 1324 "VBNET.ATG"
+out getBlock, attributes);
+ if (StartOf(25)) {
+
+#line 1326 "VBNET.ATG"
+ attributes = new List<AttributeSection>();
+ while (la.kind == 28) {
+ AttributeSection(
+#line 1327 "VBNET.ATG"
+out section);
+
+#line 1327 "VBNET.ATG"
+ attributes.Add(section);
+ }
+ SetAccessorDecl(
+#line 1328 "VBNET.ATG"
+out setBlock, attributes);
+ }
+ } else if (StartOf(26)) {
+ SetAccessorDecl(
+#line 1331 "VBNET.ATG"
+out setBlock, attributes);
+ if (StartOf(27)) {
+
+#line 1333 "VBNET.ATG"
+ attributes = new List<AttributeSection>();
+ while (la.kind == 28) {
+ AttributeSection(
+#line 1334 "VBNET.ATG"
+out section);
+
+#line 1334 "VBNET.ATG"
+ attributes.Add(section);
+ }
+ GetAccessorDecl(
+#line 1335 "VBNET.ATG"
+out getBlock, attributes);
+ }
+ } else SynErr(251);
+ }
+
+ void EventAccessorDeclaration(
+#line 1278 "VBNET.ATG"
+out EventAddRemoveRegion eventAccessorDeclaration) {
+
+#line 1280 "VBNET.ATG"
+ Statement stmt = null;
+ List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
+ AttributeSection section;
+ List<AttributeSection> attributes = new List<AttributeSection>();
+ eventAccessorDeclaration = null;
+
+ while (la.kind == 28) {
+ AttributeSection(
+#line 1286 "VBNET.ATG"
+out section);
+
+#line 1286 "VBNET.ATG"
+ attributes.Add(section);
+ }
+ if (la.kind == 43) {
+ lexer.NextToken();
+ if (la.kind == 25) {
+ lexer.NextToken();
+ if (StartOf(4)) {
+ FormalParameterList(
+#line 1288 "VBNET.ATG"
+p);
+ }
+ Expect(26);
+ }
+ Expect(1);
+ Block(
+#line 1289 "VBNET.ATG"
+out stmt);
+ Expect(100);
+ Expect(43);
+ EndOfStmt();
+
+#line 1291 "VBNET.ATG"
+ eventAccessorDeclaration = new EventAddRegion(attributes);
+ eventAccessorDeclaration.Block = (BlockStatement)stmt;
+ eventAccessorDeclaration.Parameters = p;
+
+ } else if (la.kind == 178) {
+ lexer.NextToken();
+ if (la.kind == 25) {
+ lexer.NextToken();
+ if (StartOf(4)) {
+ FormalParameterList(
+#line 1296 "VBNET.ATG"
+p);
+ }
+ Expect(26);
+ }
+ Expect(1);
+ Block(
+#line 1297 "VBNET.ATG"
+out stmt);
+ Expect(100);
+ Expect(178);
+ EndOfStmt();
+
+#line 1299 "VBNET.ATG"
+ eventAccessorDeclaration = new EventRemoveRegion(attributes);
+ eventAccessorDeclaration.Block = (BlockStatement)stmt;
+ eventAccessorDeclaration.Parameters = p;
+
+ } else if (la.kind == 174) {
+ lexer.NextToken();
+ if (la.kind == 25) {
+ lexer.NextToken();
+ if (StartOf(4)) {
+ FormalParameterList(
+#line 1304 "VBNET.ATG"
+p);
+ }
+ Expect(26);
+ }
+ Expect(1);
+ Block(
+#line 1305 "VBNET.ATG"
+out stmt);
+ Expect(100);
+ Expect(174);
+ EndOfStmt();
+
+#line 1307 "VBNET.ATG"
+ eventAccessorDeclaration = new EventRaiseRegion(attributes);
+ eventAccessorDeclaration.Block = (BlockStatement)stmt;
+ eventAccessorDeclaration.Parameters = p;
+
+ } else SynErr(252);
+ }
+
+ void OverloadableOperator(
+#line 1220 "VBNET.ATG"
+out OverloadableOperatorType operatorType) {
+
+#line 1221 "VBNET.ATG"
+ operatorType = OverloadableOperatorType.None;
+ switch (la.kind) {
+ case 19: {
+ lexer.NextToken();
+
+#line 1223 "VBNET.ATG"
+ operatorType = OverloadableOperatorType.Add;
+ break;
+ }
+ case 18: {
+ lexer.NextToken();
+
+#line 1225 "VBNET.ATG"
+ operatorType = OverloadableOperatorType.Subtract;
+ break;
+ }
+ case 22: {
+ lexer.NextToken();
+
+#line 1227 "VBNET.ATG"
+ operatorType = OverloadableOperatorType.Multiply;
+ break;
+ }
+ case 14: {
+ lexer.NextToken();
+
+#line 1229 "VBNET.ATG"
+ operatorType = OverloadableOperatorType.Divide;
+ break;
+ }
+ case 15: {
+ lexer.NextToken();
+
+#line 1231 "VBNET.ATG"
+ operatorType = OverloadableOperatorType.DivideInteger;
+ break;
+ }
+ case 13: {
+ lexer.NextToken();
+
+#line 1233 "VBNET.ATG"
+ operatorType = OverloadableOperatorType.Concat;
+ break;
+ }
+ case 136: {
+ lexer.NextToken();
+
+#line 1235 "VBNET.ATG"
+ operatorType = OverloadableOperatorType.Like;
+ break;
+ }
+ case 140: {
+ lexer.NextToken();
+
+#line 1237 "VBNET.ATG"
+ operatorType = OverloadableOperatorType.Modulus;
+ break;
+ }
+ case 47: {
+ lexer.NextToken();
+
+#line 1239 "VBNET.ATG"
+ operatorType = OverloadableOperatorType.BitwiseAnd;
+ break;
+ }
+ case 161: {
+ lexer.NextToken();
+
+#line 1241 "VBNET.ATG"
+ operatorType = OverloadableOperatorType.BitwiseOr;
+ break;
+ }
+ case 221: {
+ lexer.NextToken();
+
+#line 1243 "VBNET.ATG"
+ operatorType = OverloadableOperatorType.ExclusiveOr;
+ break;
+ }
+ case 20: {
+ lexer.NextToken();
+
+#line 1245 "VBNET.ATG"
+ operatorType = OverloadableOperatorType.Power;
+ break;
+ }
+ case 32: {
+ lexer.NextToken();
+
+#line 1247 "VBNET.ATG"
+ operatorType = OverloadableOperatorType.ShiftLeft;
+ break;
+ }
+ case 33: {
+ lexer.NextToken();
+
+#line 1249 "VBNET.ATG"
+ operatorType = OverloadableOperatorType.ShiftRight;
+ break;
+ }
+ case 10: {
+ lexer.NextToken();
+
+#line 1251 "VBNET.ATG"
+ operatorType = OverloadableOperatorType.Equality;
+ break;
+ }
+ case 29: {
+ lexer.NextToken();
+
+#line 1253 "VBNET.ATG"
+ operatorType = OverloadableOperatorType.InEquality;
+ break;
+ }
+ case 28: {
+ lexer.NextToken();
+
+#line 1255 "VBNET.ATG"
+ operatorType = OverloadableOperatorType.LessThan;
+ break;
+ }
+ case 31: {
+ lexer.NextToken();
+
+#line 1257 "VBNET.ATG"
+ operatorType = OverloadableOperatorType.LessThanOrEqual;
+ break;
+ }
+ case 27: {
+ lexer.NextToken();
+
+#line 1259 "VBNET.ATG"
+ operatorType = OverloadableOperatorType.GreaterThan;
+ break;
+ }
+ case 30: {
+ lexer.NextToken();
+
+#line 1261 "VBNET.ATG"
+ operatorType = OverloadableOperatorType.GreaterThanOrEqual;
+ break;
+ }
+ case 81: {
+ lexer.NextToken();
+
+#line 1263 "VBNET.ATG"
+ operatorType = OverloadableOperatorType.CType;
+ break;
+ }
+ case 2: case 45: case 49: case 51: case 52: case 53: case 54: case 57: case 74: case 85: case 91: case 94: case 103: case 108: case 113: case 120: case 126: case 130: case 133: case 156: case 162: case 169: case 188: case 197: case 198: case 208: case 209: case 215: {
+ Identifier();
+
+#line 1267 "VBNET.ATG"
+ string opName = t.val;
+ if (string.Equals(opName, "istrue", StringComparison.InvariantCultureIgnoreCase)) {
+ operatorType = OverloadableOperatorType.IsTrue;
+ } else if (string.Equals(opName, "isfalse", StringComparison.InvariantCultureIgnoreCase)) {
+ operatorType = OverloadableOperatorType.IsFalse;
+ } else {
+ Error("Invalid operator. Possible operators are '+', '-', 'Not', 'IsTrue', 'IsFalse'.");
+ }
+
+ break;
+ }
+ default: SynErr(253); break;
+ }
+ }
+
+ void GetAccessorDecl(
+#line 1341 "VBNET.ATG"
+out PropertyGetRegion getBlock, List<AttributeSection> attributes) {
+
+#line 1342 "VBNET.ATG"
+ Statement stmt = null; Modifiers m;
+ PropertyAccessorAccessModifier(
+#line 1344 "VBNET.ATG"
+out m);
+ Expect(115);
+
+#line 1346 "VBNET.ATG"
+ Location startLocation = t.Location;
+ Expect(1);
+ Block(
+#line 1348 "VBNET.ATG"
+out stmt);
+
+#line 1349 "VBNET.ATG"
+ getBlock = new PropertyGetRegion((BlockStatement)stmt, attributes);
+ Expect(100);
+ Expect(115);
+
+#line 1351 "VBNET.ATG"
+ getBlock.Modifier = m;
+
+#line 1352 "VBNET.ATG"
+ getBlock.StartLocation = startLocation; getBlock.EndLocation = t.EndLocation;
+ EndOfStmt();
+ }
+
+ void SetAccessorDecl(
+#line 1357 "VBNET.ATG"
+out PropertySetRegion setBlock, List<AttributeSection> attributes) {
+
+#line 1359 "VBNET.ATG"
+ Statement stmt = null;
+ List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
+ Modifiers m;
+
+ PropertyAccessorAccessModifier(
+#line 1364 "VBNET.ATG"
+out m);
+ Expect(183);
+
+#line 1366 "VBNET.ATG"
+ Location startLocation = t.Location;
+ if (la.kind == 25) {
+ lexer.NextToken();
+ if (StartOf(4)) {
+ FormalParameterList(
+#line 1367 "VBNET.ATG"
+p);
+ }
+ Expect(26);
+ }
+ Expect(1);
+ Block(
+#line 1369 "VBNET.ATG"
+out stmt);
+
+#line 1371 "VBNET.ATG"
+ setBlock = new PropertySetRegion((BlockStatement)stmt, attributes);
+ setBlock.Modifier = m;
+ setBlock.Parameters = p;
+
+ Expect(100);
+ Expect(183);
+
+#line 1376 "VBNET.ATG"
+ setBlock.StartLocation = startLocation; setBlock.EndLocation = t.EndLocation;
+ EndOfStmt();
+ }
+
+ void PropertyAccessorAccessModifier(
+#line 3396 "VBNET.ATG"
+out Modifiers m) {
+
+#line 3397 "VBNET.ATG"
+ m = Modifiers.None;
+ while (StartOf(28)) {
+ if (la.kind == 173) {
+ lexer.NextToken();
+
+#line 3399 "VBNET.ATG"
+ m |= Modifiers.Public;
+ } else if (la.kind == 172) {
+ lexer.NextToken();
+
+#line 3400 "VBNET.ATG"
+ m |= Modifiers.Protected;
+ } else if (la.kind == 112) {
+ lexer.NextToken();
+
+#line 3401 "VBNET.ATG"
+ m |= Modifiers.Internal;
+ } else {
+ lexer.NextToken();
+
+#line 3402 "VBNET.ATG"
+ m |= Modifiers.Private;
+ }
+ }
+ }
+
+ void ArrayInitializationModifier(
+#line 1474 "VBNET.ATG"
+out List<Expression> arrayModifiers) {
+
+#line 1476 "VBNET.ATG"
+ arrayModifiers = null;
+
+ Expect(25);
+ InitializationRankList(
+#line 1478 "VBNET.ATG"
+out arrayModifiers);
+ Expect(26);
+ }
+
+ void ArrayNameModifier(
+#line 2473 "VBNET.ATG"
+out ArrayList arrayModifiers) {
+
+#line 2475 "VBNET.ATG"
+ arrayModifiers = null;
+
+ ArrayTypeModifiers(
+#line 2477 "VBNET.ATG"
+out arrayModifiers);
+ }
+
+ void ObjectCreateExpression(
+#line 1935 "VBNET.ATG"
+out Expression oce) {
+
+#line 1937 "VBNET.ATG"
+ TypeReference type = null;
+ Expression initializer = null;
+ List<Expression> arguments = null;
+ ArrayList dimensions = null;
+ oce = null;
+ bool canBeNormal; bool canBeReDim;
+
+ Expect(148);
+ if (StartOf(7)) {
+ NonArrayTypeName(
+#line 1945 "VBNET.ATG"
+out type, false);
+ if (la.kind == 25) {
+ lexer.NextToken();
+ NormalOrReDimArgumentList(
+#line 1946 "VBNET.ATG"
+out arguments, out canBeNormal, out canBeReDim);
+ Expect(26);
+ if (la.kind == 23 ||
+#line 1947 "VBNET.ATG"
+la.kind == Tokens.OpenParenthesis) {
+ if (
+#line 1947 "VBNET.ATG"
+la.kind == Tokens.OpenParenthesis) {
+ ArrayTypeModifiers(
+#line 1948 "VBNET.ATG"
+out dimensions);
+ CollectionInitializer(
+#line 1949 "VBNET.ATG"
+out initializer);
+ } else {
+ CollectionInitializer(
+#line 1950 "VBNET.ATG"
+out initializer);
+ }
+ }
+
+#line 1952 "VBNET.ATG"
+ if (canBeReDim && !canBeNormal && initializer == null) initializer = new CollectionInitializerExpression();
+ }
+ }
+
+#line 1956 "VBNET.ATG"
+ if (initializer == null) {
+ oce = new ObjectCreateExpression(type, arguments);
+ } else {
+ if (dimensions == null) dimensions = new ArrayList();
+ dimensions.Insert(0, (arguments == null) ? 0 : Math.Max(arguments.Count - 1, 0));
+ type.RankSpecifier = (int[])dimensions.ToArray(typeof(int));
+ ArrayCreateExpression ace = new ArrayCreateExpression(type, initializer as CollectionInitializerExpression);
+ ace.Arguments = arguments;
+ oce = ace;
+ }
+
+ if (la.kind == 218) {
+
+#line 1970 "VBNET.ATG"
+ NamedArgumentExpression memberInitializer = null;
+
+ lexer.NextToken();
+
+#line 1974 "VBNET.ATG"
+ CollectionInitializerExpression memberInitializers = new CollectionInitializerExpression();
+ memberInitializers.StartLocation = la.Location;
+
+ Expect(23);
+ MemberInitializer(
+#line 1978 "VBNET.ATG"
+out memberInitializer);
+
+#line 1979 "VBNET.ATG"
+ memberInitializers.CreateExpressions.Add(memberInitializer);
+ while (la.kind == 12) {
+ lexer.NextToken();
+ MemberInitializer(
+#line 1981 "VBNET.ATG"
+out memberInitializer);
+
+#line 1982 "VBNET.ATG"
+ memberInitializers.CreateExpressions.Add(memberInitializer);
+ }
+ Expect(24);
+
+#line 1986 "VBNET.ATG"
+ memberInitializers.EndLocation = t.Location;
+ if(oce is ObjectCreateExpression)
+ {
+ ((ObjectCreateExpression)oce).ObjectInitializer = memberInitializers;
+ }
+
+ }
+ }
+
+ void VariableInitializer(
+#line 1502 "VBNET.ATG"
+out Expression initializerExpression) {
+
+#line 1504 "VBNET.ATG"
+ initializerExpression = null;
+
+ if (StartOf(29)) {
+ Expr(
+#line 1506 "VBNET.ATG"
+out initializerExpression);
+ } else if (la.kind == 23) {
+ CollectionInitializer(
+#line 1507 "VBNET.ATG"
+out initializerExpression);
+ } else SynErr(254);
+ }
+
+ void InitializationRankList(
+#line 1482 "VBNET.ATG"
+out List<Expression> rank) {
+
+#line 1484 "VBNET.ATG"
+ rank = new List<Expression>();
+ Expression expr = null;
+
+ Expr(
+#line 1487 "VBNET.ATG"
+out expr);
+ if (la.kind == 201) {
+ lexer.NextToken();
+
+#line 1488 "VBNET.ATG"
+ EnsureIsZero(expr);
+ Expr(
+#line 1489 "VBNET.ATG"
+out expr);
+ }
+
+#line 1491 "VBNET.ATG"
+ if (expr != null) { rank.Add(expr); }
+ while (la.kind == 12) {
+ lexer.NextToken();
+ Expr(
+#line 1493 "VBNET.ATG"
+out expr);
+ if (la.kind == 201) {
+ lexer.NextToken();
+
+#line 1494 "VBNET.ATG"
+ EnsureIsZero(expr);
+ Expr(
+#line 1495 "VBNET.ATG"
+out expr);
+ }
+
+#line 1497 "VBNET.ATG"
+ if (expr != null) { rank.Add(expr); }
+ }
+ }
+
+ void CollectionInitializer(
+#line 1511 "VBNET.ATG"
+out Expression outExpr) {
+
+#line 1513 "VBNET.ATG"
+ Expression expr = null;
+ CollectionInitializerExpression initializer = new CollectionInitializerExpression();
+
+ Expect(23);
+ if (StartOf(30)) {
+ VariableInitializer(
+#line 1518 "VBNET.ATG"
+out expr);
+
+#line 1520 "VBNET.ATG"
+ if (expr != null) { initializer.CreateExpressions.Add(expr); }
+
+ while (
+#line 1523 "VBNET.ATG"
+NotFinalComma()) {
+ Expect(12);
+ VariableInitializer(
+#line 1523 "VBNET.ATG"
+out expr);
+
+#line 1524 "VBNET.ATG"
+ if (expr != null) { initializer.CreateExpressions.Add(expr); }
+ }
+ }
+ Expect(24);
+
+#line 1527 "VBNET.ATG"
+ outExpr = initializer;
+ }
+
+ void EventMemberSpecifier(
+#line 1597 "VBNET.ATG"
+out string name) {
+
+#line 1598 "VBNET.ATG"
+ string eventName;
+ if (StartOf(14)) {
+ Identifier();
+ } else if (la.kind == 144) {
+ lexer.NextToken();
+ } else if (la.kind == 139) {
+ lexer.NextToken();
+ } else SynErr(255);
+
+#line 1601 "VBNET.ATG"
+ name = t.val;
+ Expect(16);
+ IdentifierOrKeyword(
+#line 1603 "VBNET.ATG"
+out eventName);
+
+#line 1604 "VBNET.ATG"
+ name = name + "." + eventName;
+ }
+
+ void IdentifierOrKeyword(
+#line 3329 "VBNET.ATG"
+out string name) {
+
+#line 3331 "VBNET.ATG"
+ lexer.NextToken(); name = t.val;
+ }
+
+ void QueryExpr(
+#line 2013 "VBNET.ATG"
+out Expression expr) {
+
+#line 2015 "VBNET.ATG"
+ QueryExpression qexpr = new QueryExpression();
+ qexpr.StartLocation = la.Location;
+ List<QueryExpressionClause> middleClauses = new List<QueryExpressionClause>();
+ expr = qexpr;
+
+ FromOrAggregateQueryOperator(
+#line 2020 "VBNET.ATG"
+middleClauses);
+ while (StartOf(31)) {
+ QueryOperator(
+#line 2021 "VBNET.ATG"
+middleClauses);
+ }
+
+#line 2023 "VBNET.ATG"
+ qexpr.EndLocation = t.EndLocation;
+
+ }
+
+ void LambdaExpr(
+#line 1995 "VBNET.ATG"
+out Expression expr) {
+
+#line 1997 "VBNET.ATG"
+ Expression inner = null;
+ LambdaExpression lambda = new LambdaExpression();
+ lambda.StartLocation = la.Location;
+
+ Expect(114);
+ if (la.kind == 25) {
+ lexer.NextToken();
+ if (StartOf(4)) {
+ FormalParameterList(
+#line 2003 "VBNET.ATG"
+lambda.Parameters);
+ }
+ Expect(26);
+ }
+ Expr(
+#line 2004 "VBNET.ATG"
+out inner);
+
+#line 2006 "VBNET.ATG"
+ lambda.ExpressionBody = inner;
+ lambda.EndLocation = t.EndLocation; // la.Location?
+
+ expr = lambda;
+
+ }
+
+ void DisjunctionExpr(
+#line 1779 "VBNET.ATG"
+out Expression outExpr) {
+
+#line 1781 "VBNET.ATG"
+ Expression expr;
+ BinaryOperatorType op = BinaryOperatorType.None;
+
+ ConjunctionExpr(
+#line 1784 "VBNET.ATG"
+out outExpr);
+ while (la.kind == 161 || la.kind == 163 || la.kind == 221) {
+ if (la.kind == 161) {
+ lexer.NextToken();
+
+#line 1787 "VBNET.ATG"
+ op = BinaryOperatorType.BitwiseOr;
+ } else if (la.kind == 163) {
+ lexer.NextToken();
+
+#line 1788 "VBNET.ATG"
+ op = BinaryOperatorType.LogicalOr;
+ } else {
+ lexer.NextToken();
+
+#line 1789 "VBNET.ATG"
+ op = BinaryOperatorType.ExclusiveOr;
+ }
+ ConjunctionExpr(
+#line 1791 "VBNET.ATG"
+out expr);
+
+#line 1791 "VBNET.ATG"
+ outExpr = new BinaryOperatorExpression(outExpr, op, expr);
+ }
+ }
+
+ void AssignmentOperator(
+#line 1615 "VBNET.ATG"
+out AssignmentOperatorType op) {
+
+#line 1616 "VBNET.ATG"
+ op = AssignmentOperatorType.None;
+ switch (la.kind) {
+ case 10: {
+ lexer.NextToken();
+
+#line 1617 "VBNET.ATG"
+ op = AssignmentOperatorType.Assign;
+ break;
+ }
+ case 42: {
+ lexer.NextToken();
+
+#line 1618 "VBNET.ATG"
+ op = AssignmentOperatorType.ConcatString;
+ break;
+ }
+ case 34: {
+ lexer.NextToken();
+
+#line 1619 "VBNET.ATG"
+ op = AssignmentOperatorType.Add;
+ break;
+ }
+ case 36: {
+ lexer.NextToken();
+
+#line 1620 "VBNET.ATG"
+ op = AssignmentOperatorType.Subtract;
+ break;
+ }
+ case 37: {
+ lexer.NextToken();
+
+#line 1621 "VBNET.ATG"
+ op = AssignmentOperatorType.Multiply;
+ break;
+ }
+ case 38: {
+ lexer.NextToken();
+
+#line 1622 "VBNET.ATG"
+ op = AssignmentOperatorType.Divide;
+ break;
+ }
+ case 39: {
+ lexer.NextToken();
+
+#line 1623 "VBNET.ATG"
+ op = AssignmentOperatorType.DivideInteger;
+ break;
+ }
+ case 35: {
+ lexer.NextToken();
+
+#line 1624 "VBNET.ATG"
+ op = AssignmentOperatorType.Power;
+ break;
+ }
+ case 40: {
+ lexer.NextToken();
+
+#line 1625 "VBNET.ATG"
+ op = AssignmentOperatorType.ShiftLeft;
+ break;
+ }
+ case 41: {
+ lexer.NextToken();
+
+#line 1626 "VBNET.ATG"
+ op = AssignmentOperatorType.ShiftRight;
+ break;
+ }
+ default: SynErr(256); break;
+ }
+ }
+
+ void SimpleExpr(
+#line 1630 "VBNET.ATG"
+out Expression pexpr) {
+
+#line 1631 "VBNET.ATG"
+ string name;
+ SimpleNonInvocationExpression(
+#line 1633 "VBNET.ATG"
+out pexpr);
+ while (la.kind == 16 || la.kind == 17 || la.kind == 25) {
+ if (la.kind == 16) {
+ lexer.NextToken();
+ IdentifierOrKeyword(
+#line 1635 "VBNET.ATG"
+out name);
+
+#line 1636 "VBNET.ATG"
+ pexpr = new MemberReferenceExpression(pexpr, name);
+ if (
+#line 1637 "VBNET.ATG"
+la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of) {
+ lexer.NextToken();
+ Expect(155);
+ TypeArgumentList(
+#line 1638 "VBNET.ATG"
+((MemberReferenceExpression)pexpr).TypeArguments);
+ Expect(26);
+ }
+ } else if (la.kind == 17) {
+ lexer.NextToken();
+ IdentifierOrKeyword(
+#line 1640 "VBNET.ATG"
+out name);
+
+#line 1640 "VBNET.ATG"
+ pexpr = new BinaryOperatorExpression(pexpr, BinaryOperatorType.DictionaryAccess, new PrimitiveExpression(name, name));
+ } else {
+ InvocationExpression(
+#line 1641 "VBNET.ATG"
+ref pexpr);
+ }
+ }
+ }
+
+ void SimpleNonInvocationExpression(
+#line 1645 "VBNET.ATG"
+out Expression pexpr) {
+
+#line 1647 "VBNET.ATG"
+ Expression expr;
+ TypeReference type = null;
+ string name = String.Empty;
+ pexpr = null;
+
+ if (StartOf(32)) {
+ switch (la.kind) {
+ case 3: {
+ lexer.NextToken();
+
+#line 1655 "VBNET.ATG"
+ pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };
+ break;
+ }
+ case 4: {
+ lexer.NextToken();
+
+#line 1656 "VBNET.ATG"
+ pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };
+ break;
+ }
+ case 7: {
+ lexer.NextToken();
+
+#line 1657 "VBNET.ATG"
+ pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };
+ break;
+ }
+ case 6: {
+ lexer.NextToken();
+
+#line 1658 "VBNET.ATG"
+ pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };
+ break;
+ }
+ case 5: {
+ lexer.NextToken();
+
+#line 1659 "VBNET.ATG"
+ pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };
+ break;
+ }
+ case 9: {
+ lexer.NextToken();
+
+#line 1660 "VBNET.ATG"
+ pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };
+ break;
+ }
+ case 8: {
+ lexer.NextToken();
+
+#line 1661 "VBNET.ATG"
+ pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };
+ break;
+ }
+ case 202: {
+ lexer.NextToken();
+
+#line 1663 "VBNET.ATG"
+ pexpr = new PrimitiveExpression(true, "true");
+ break;
+ }
+ case 109: {
+ lexer.NextToken();
+
+#line 1664 "VBNET.ATG"
+ pexpr = new PrimitiveExpression(false, "false");
+ break;
+ }
+ case 151: {
+ lexer.NextToken();
+
+#line 1665 "VBNET.ATG"
+ pexpr = new PrimitiveExpression(null, "null");
+ break;
+ }
+ case 25: {
+ lexer.NextToken();
+ Expr(
+#line 1666 "VBNET.ATG"
+out expr);
+ Expect(26);
+
+#line 1666 "VBNET.ATG"
+ pexpr = new ParenthesizedExpression(expr);
+ break;
+ }
+ case 2: case 45: case 49: case 51: case 52: case 53: case 54: case 57: case 74: case 85: case 91: case 94: case 103: case 108: case 113: case 120: case 126: case 130: case 133: case 156: case 162: case 169: case 188: case 197: case 198: case 208: case 209: case 215: {
+ Identifier();
+
+#line 1668 "VBNET.ATG"
+ pexpr = new IdentifierExpression(t.val);
+ pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation;
+
+ if (
+#line 1671 "VBNET.ATG"
+la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of) {
+ lexer.NextToken();
+ Expect(155);
+ TypeArgumentList(
+#line 1672 "VBNET.ATG"
+((IdentifierExpression)pexpr).TypeArguments);
+ Expect(26);
+ }
+ break;
+ }
+ case 55: case 58: case 69: case 86: case 87: case 96: case 128: case 137: case 154: case 181: case 186: case 187: case 193: case 206: case 207: case 210: {
+
+#line 1674 "VBNET.ATG"
+ string val = String.Empty;
+ if (StartOf(11)) {
+ PrimitiveTypeName(
+#line 1675 "VBNET.ATG"
+out val);
+ } else if (la.kind == 154) {
+ lexer.NextToken();
+
+#line 1675 "VBNET.ATG"
+ val = "System.Object";
+ } else SynErr(257);
+
+#line 1676 "VBNET.ATG"
+ pexpr = new TypeReferenceExpression(new TypeReference(val, true));
+ break;
+ }
+ case 139: {
+ lexer.NextToken();
+
+#line 1677 "VBNET.ATG"
+ pexpr = new ThisReferenceExpression();
+ break;
+ }
+ case 144: case 145: {
+
+#line 1678 "VBNET.ATG"
+ Expression retExpr = null;
+ if (la.kind == 144) {
+ lexer.NextToken();
+
+#line 1679 "VBNET.ATG"
+ retExpr = new BaseReferenceExpression();
+ } else if (la.kind == 145) {
+ lexer.NextToken();
+
+#line 1680 "VBNET.ATG"
+ retExpr = new ClassReferenceExpression();
+ } else SynErr(258);
+ Expect(16);
+ IdentifierOrKeyword(
+#line 1682 "VBNET.ATG"
+out name);
+
+#line 1682 "VBNET.ATG"
+ pexpr = new MemberReferenceExpression(retExpr, name);
+ break;
+ }
+ case 117: {
+ lexer.NextToken();
+ Expect(16);
+ Identifier();
+
+#line 1684 "VBNET.ATG"
+ type = new TypeReference(t.val ?? "");
+
+#line 1686 "VBNET.ATG"
+ type.IsGlobal = true;
+
+#line 1687 "VBNET.ATG"
+ pexpr = new TypeReferenceExpression(type);
+ break;
+ }
+ case 148: {
+ ObjectCreateExpression(
+#line 1688 "VBNET.ATG"
+out expr);
+
+#line 1688 "VBNET.ATG"
+ pexpr = expr;
+ break;
+ }
+ case 81: case 93: case 204: {
+
+#line 1690 "VBNET.ATG"
+ CastType castType = CastType.Cast;
+ if (la.kind == 93) {
+ lexer.NextToken();
+ } else if (la.kind == 81) {
+ lexer.NextToken();
+
+#line 1692 "VBNET.ATG"
+ castType = CastType.Conversion;
+ } else if (la.kind == 204) {
+ lexer.NextToken();
+
+#line 1693 "VBNET.ATG"
+ castType = CastType.TryCast;
+ } else SynErr(259);
+ Expect(25);
+ Expr(
+#line 1695 "VBNET.ATG"
+out expr);
+ Expect(12);
+ TypeName(
+#line 1695 "VBNET.ATG"
+out type);
+ Expect(26);
+
+#line 1696 "VBNET.ATG"
+ pexpr = new CastExpression(type, expr, castType);
+ break;
+ }
+ case 63: case 64: case 65: case 66: case 67: case 68: case 70: case 72: case 73: case 77: case 78: case 79: case 80: case 82: case 83: case 84: {
+ CastTarget(
+#line 1697 "VBNET.ATG"
+out type);
+ Expect(25);
+ Expr(
+#line 1697 "VBNET.ATG"
+out expr);
+ Expect(26);
+
+#line 1697 "VBNET.ATG"
+ pexpr = new CastExpression(type, expr, CastType.PrimitiveConversion);
+ break;
+ }
+ case 44: {
+ lexer.NextToken();
+ Expr(
+#line 1698 "VBNET.ATG"
+out expr);
+
+#line 1698 "VBNET.ATG"
+ pexpr = new AddressOfExpression(expr);
+ break;
+ }
+ case 116: {
+ lexer.NextToken();
+ Expect(25);
+ GetTypeTypeName(
+#line 1699 "VBNET.ATG"
+out type);
+ Expect(26);
+
+#line 1699 "VBNET.ATG"
+ pexpr = new TypeOfExpression(type);
+ break;
+ }
+ case 205: {
+ lexer.NextToken();
+ SimpleExpr(
+#line 1700 "VBNET.ATG"
+out expr);
+ Expect(131);
+ TypeName(
+#line 1700 "VBNET.ATG"
+out type);
+
+#line 1700 "VBNET.ATG"
+ pexpr = new TypeOfIsExpression(expr, type);
+ break;
+ }
+ case 122: {
+ ConditionalExpression(
+#line 1701 "VBNET.ATG"
+out pexpr);
+ break;
+ }
+ }
+ } else if (la.kind == 16) {
+ lexer.NextToken();
+ IdentifierOrKeyword(
+#line 1705 "VBNET.ATG"
+out name);
+
+#line 1705 "VBNET.ATG"
+ pexpr = new MemberReferenceExpression(null, name);
+ } else SynErr(260);
+ }
+
+ void TypeArgumentList(
+#line 2509 "VBNET.ATG"
+List<TypeReference> typeArguments) {
+
+#line 2511 "VBNET.ATG"
+ TypeReference typeref;
+
+ TypeName(
+#line 2513 "VBNET.ATG"
+out typeref);
+
+#line 2513 "VBNET.ATG"
+ if (typeref != null) typeArguments.Add(typeref);
+ while (la.kind == 12) {
+ lexer.NextToken();
+ TypeName(
+#line 2516 "VBNET.ATG"
+out typeref);
+
+#line 2516 "VBNET.ATG"
+ if (typeref != null) typeArguments.Add(typeref);
+ }
+ }
+
+ void InvocationExpression(
+#line 1743 "VBNET.ATG"
+ref Expression pexpr) {
+
+#line 1744 "VBNET.ATG"
+ List<Expression> parameters = null;
+ Expect(25);
+
+#line 1746 "VBNET.ATG"
+ Location start = t.Location;
+ ArgumentList(
+#line 1747 "VBNET.ATG"
+out parameters);
+ Expect(26);
+
+#line 1750 "VBNET.ATG"
+ pexpr = new InvocationExpression(pexpr, parameters);
+
+
+#line 1752 "VBNET.ATG"
+ pexpr.StartLocation = start; pexpr.EndLocation = t.Location;
+ }
+
+ void PrimitiveTypeName(
+#line 3336 "VBNET.ATG"
+out string type) {
+
+#line 3337 "VBNET.ATG"
+ type = String.Empty;
+ switch (la.kind) {
+ case 55: {
+ lexer.NextToken();
+
+#line 3338 "VBNET.ATG"
+ type = "System.Boolean";
+ break;
+ }
+ case 86: {
+ lexer.NextToken();
+
+#line 3339 "VBNET.ATG"
+ type = "System.DateTime";
+ break;
+ }
+ case 69: {
+ lexer.NextToken();
+
+#line 3340 "VBNET.ATG"
+ type = "System.Char";
+ break;
+ }
+ case 193: {
+ lexer.NextToken();
+
+#line 3341 "VBNET.ATG"
+ type = "System.String";
+ break;
+ }
+ case 87: {
+ lexer.NextToken();
+
+#line 3342 "VBNET.ATG"
+ type = "System.Decimal";
+ break;
+ }
+ case 58: {
+ lexer.NextToken();
+
+#line 3343 "VBNET.ATG"
+ type = "System.Byte";
+ break;
+ }
+ case 186: {
+ lexer.NextToken();
+
+#line 3344 "VBNET.ATG"
+ type = "System.Int16";
+ break;
+ }
+ case 128: {
+ lexer.NextToken();
+
+#line 3345 "VBNET.ATG"
+ type = "System.Int32";
+ break;
+ }
+ case 137: {
+ lexer.NextToken();
+
+#line 3346 "VBNET.ATG"
+ type = "System.Int64";
+ break;
+ }
+ case 187: {
+ lexer.NextToken();
+
+#line 3347 "VBNET.ATG"
+ type = "System.Single";
+ break;
+ }
+ case 96: {
+ lexer.NextToken();
+
+#line 3348 "VBNET.ATG"
+ type = "System.Double";
+ break;
+ }
+ case 206: {
+ lexer.NextToken();
+
+#line 3349 "VBNET.ATG"
+ type = "System.UInt32";
+ break;
+ }
+ case 207: {
+ lexer.NextToken();
+
+#line 3350 "VBNET.ATG"
+ type = "System.UInt64";
+ break;
+ }
+ case 210: {
+ lexer.NextToken();
+
+#line 3351 "VBNET.ATG"
+ type = "System.UInt16";
+ break;
+ }
+ case 181: {
+ lexer.NextToken();
+
+#line 3352 "VBNET.ATG"
+ type = "System.SByte";
+ break;
+ }
+ default: SynErr(261); break;
+ }
+ }
+
+ void CastTarget(
+#line 1757 "VBNET.ATG"
+out TypeReference type) {
+
+#line 1759 "VBNET.ATG"
+ type = null;
+
+ switch (la.kind) {
+ case 63: {
+ lexer.NextToken();
+
+#line 1761 "VBNET.ATG"
+ type = new TypeReference("System.Boolean", true);
+ break;
+ }
+ case 64: {
+ lexer.NextToken();
+
+#line 1762 "VBNET.ATG"
+ type = new TypeReference("System.Byte", true);
+ break;
+ }
+ case 77: {
+ lexer.NextToken();
+
+#line 1763 "VBNET.ATG"
+ type = new TypeReference("System.SByte", true);
+ break;
+ }
+ case 65: {
+ lexer.NextToken();
+
+#line 1764 "VBNET.ATG"
+ type = new TypeReference("System.Char", true);
+ break;
+ }
+ case 66: {
+ lexer.NextToken();
+
+#line 1765 "VBNET.ATG"
+ type = new TypeReference("System.DateTime", true);
+ break;
+ }
+ case 68: {
+ lexer.NextToken();
+
+#line 1766 "VBNET.ATG"
+ type = new TypeReference("System.Decimal", true);
+ break;
+ }
+ case 67: {
+ lexer.NextToken();
+
+#line 1767 "VBNET.ATG"
+ type = new TypeReference("System.Double", true);
+ break;
+ }
+ case 78: {
+ lexer.NextToken();
+
+#line 1768 "VBNET.ATG"
+ type = new TypeReference("System.Int16", true);
+ break;
+ }
+ case 70: {
+ lexer.NextToken();
+
+#line 1769 "VBNET.ATG"
+ type = new TypeReference("System.Int32", true);
+ break;
+ }
+ case 72: {
+ lexer.NextToken();
+
+#line 1770 "VBNET.ATG"
+ type = new TypeReference("System.Int64", true);
+ break;
+ }
+ case 84: {
+ lexer.NextToken();
+
+#line 1771 "VBNET.ATG"
+ type = new TypeReference("System.UInt16", true);
+ break;
+ }
+ case 82: {
+ lexer.NextToken();
+
+#line 1772 "VBNET.ATG"
+ type = new TypeReference("System.UInt32", true);
+ break;
+ }
+ case 83: {
+ lexer.NextToken();
+
+#line 1773 "VBNET.ATG"
+ type = new TypeReference("System.UInt64", true);
+ break;
+ }
+ case 73: {
+ lexer.NextToken();
+
+#line 1774 "VBNET.ATG"
+ type = new TypeReference("System.Object", true);
+ break;
+ }
+ case 79: {
+ lexer.NextToken();
+
+#line 1775 "VBNET.ATG"
+ type = new TypeReference("System.Single", true);
+ break;
+ }
+ case 80: {
+ lexer.NextToken();
+
+#line 1776 "VBNET.ATG"
+ type = new TypeReference("System.String", true);
+ break;
+ }
+ default: SynErr(262); break;
+ }
+ }
+
+ void GetTypeTypeName(
+#line 2408 "VBNET.ATG"
+out TypeReference typeref) {
+
+#line 2409 "VBNET.ATG"
+ ArrayList rank = null;
+ NonArrayTypeName(
+#line 2411 "VBNET.ATG"
+out typeref, true);
+ ArrayTypeModifiers(
+#line 2412 "VBNET.ATG"
+out rank);
+
+#line 2413 "VBNET.ATG"
+ if (rank != null && typeref != null) {
+ typeref.RankSpecifier = (int[])rank.ToArray(typeof(int));
+ }
+
+ }
+
+ void ConditionalExpression(
+#line 1709 "VBNET.ATG"
+out Expression expr) {
+
+#line 1711 "VBNET.ATG"
+ ConditionalExpression conditionalExpression = new ConditionalExpression();
+ BinaryOperatorExpression binaryOperatorExpression = new BinaryOperatorExpression();
+ conditionalExpression.StartLocation = binaryOperatorExpression.StartLocation = la.Location;
+
+ Expression condition = null;
+ Expression trueExpr = null;
+ Expression falseExpr = null;
+
+ Expect(122);
+ Expect(25);
+ Expr(
+#line 1720 "VBNET.ATG"
+out condition);
+ Expect(12);
+ Expr(
+#line 1720 "VBNET.ATG"
+out trueExpr);
+ if (la.kind == 12) {
+ lexer.NextToken();
+ Expr(
+#line 1720 "VBNET.ATG"
+out falseExpr);
+ }
+ Expect(26);
+
+#line 1722 "VBNET.ATG"
+ if(falseExpr != null)
+ {
+ conditionalExpression.Condition = condition;
+ conditionalExpression.TrueExpression = trueExpr;
+ conditionalExpression.FalseExpression = falseExpr;
+ conditionalExpression.EndLocation = t.EndLocation;
+
+ expr = conditionalExpression;
+ }
+ else
+ {
+ binaryOperatorExpression.Left = condition;
+ binaryOperatorExpression.Right = trueExpr;
+ binaryOperatorExpression.Op = BinaryOperatorType.NullCoalescing;
+ binaryOperatorExpression.EndLocation = t.EndLocation;
+
+ expr = binaryOperatorExpression;
+ }
+
+ }
+
+ void ArgumentList(
+#line 2340 "VBNET.ATG"
+out List<Expression> arguments) {
+
+#line 2342 "VBNET.ATG"
+ arguments = new List<Expression>();
+ Expression expr = null;
+
+ if (StartOf(29)) {
+ Argument(
+#line 2345 "VBNET.ATG"
+out expr);
+ }
+ while (la.kind == 12) {
+ lexer.NextToken();
+
+#line 2346 "VBNET.ATG"
+ arguments.Add(expr ?? Expression.Null); expr = null;
+ if (StartOf(29)) {
+ Argument(
+#line 2347 "VBNET.ATG"
+out expr);
+ }
+
+#line 2348 "VBNET.ATG"
+ if (expr == null) expr = Expression.Null;
+ }
+
+#line 2350 "VBNET.ATG"
+ if (expr != null) arguments.Add(expr);
+ }
+
+ void ConjunctionExpr(
+#line 1795 "VBNET.ATG"
+out Expression outExpr) {
+
+#line 1797 "VBNET.ATG"
+ Expression expr;
+ BinaryOperatorType op = BinaryOperatorType.None;
+
+ NotExpr(
+#line 1800 "VBNET.ATG"
+out outExpr);
+ while (la.kind == 47 || la.kind == 48) {
+ if (la.kind == 47) {
+ lexer.NextToken();
+
+#line 1803 "VBNET.ATG"
+ op = BinaryOperatorType.BitwiseAnd;
+ } else {
+ lexer.NextToken();
+
+#line 1804 "VBNET.ATG"
+ op = BinaryOperatorType.LogicalAnd;
+ }
+ NotExpr(
+#line 1806 "VBNET.ATG"
+out expr);
+
+#line 1806 "VBNET.ATG"
+ outExpr = new BinaryOperatorExpression(outExpr, op, expr);
+ }
+ }
+
+ void NotExpr(
+#line 1810 "VBNET.ATG"
+out Expression outExpr) {
+
+#line 1811 "VBNET.ATG"
+ UnaryOperatorType uop = UnaryOperatorType.None;
+ while (la.kind == 150) {
+ lexer.NextToken();
+
+#line 1812 "VBNET.ATG"
+ uop = UnaryOperatorType.Not;
+ }
+ ComparisonExpr(
+#line 1813 "VBNET.ATG"
+out outExpr);
+
+#line 1814 "VBNET.ATG"
+ if (uop != UnaryOperatorType.None)
+ outExpr = new UnaryOperatorExpression(outExpr, uop);
+
+ }
+
+ void ComparisonExpr(
+#line 1819 "VBNET.ATG"
+out Expression outExpr) {
+
+#line 1821 "VBNET.ATG"
+ Expression expr;
+ BinaryOperatorType op = BinaryOperatorType.None;
+
+ ShiftExpr(
+#line 1824 "VBNET.ATG"
+out outExpr);
+ while (StartOf(33)) {
+ switch (la.kind) {
+ case 28: {
+ lexer.NextToken();
+
+#line 1827 "VBNET.ATG"
+ op = BinaryOperatorType.LessThan;
+ break;
+ }
+ case 27: {
+ lexer.NextToken();
+
+#line 1828 "VBNET.ATG"
+ op = BinaryOperatorType.GreaterThan;
+ break;
+ }
+ case 31: {
+ lexer.NextToken();
+
+#line 1829 "VBNET.ATG"
+ op = BinaryOperatorType.LessThanOrEqual;
+ break;
+ }
+ case 30: {
+ lexer.NextToken();
+
+#line 1830 "VBNET.ATG"
+ op = BinaryOperatorType.GreaterThanOrEqual;
+ break;
+ }
+ case 29: {
+ lexer.NextToken();
+
+#line 1831 "VBNET.ATG"
+ op = BinaryOperatorType.InEquality;
+ break;
+ }
+ case 10: {
+ lexer.NextToken();
+
+#line 1832 "VBNET.ATG"
+ op = BinaryOperatorType.Equality;
+ break;
+ }
+ case 136: {
+ lexer.NextToken();
+
+#line 1833 "VBNET.ATG"
+ op = BinaryOperatorType.Like;
+ break;
+ }
+ case 131: {
+ lexer.NextToken();
+
+#line 1834 "VBNET.ATG"
+ op = BinaryOperatorType.ReferenceEquality;
+ break;
+ }
+ case 132: {
+ lexer.NextToken();
+
+#line 1835 "VBNET.ATG"
+ op = BinaryOperatorType.ReferenceInequality;
+ break;
+ }
+ }
+ if (StartOf(34)) {
+ ShiftExpr(
+#line 1838 "VBNET.ATG"
+out expr);
+
+#line 1838 "VBNET.ATG"
+ outExpr = new BinaryOperatorExpression(outExpr, op, expr);
+ } else if (la.kind == 150) {
+ lexer.NextToken();
+ ShiftExpr(
+#line 1841 "VBNET.ATG"
+out expr);
+
+#line 1841 "VBNET.ATG"
+ outExpr = new BinaryOperatorExpression(outExpr, op, new UnaryOperatorExpression(expr, UnaryOperatorType.Not));
+ } else SynErr(263);
+ }
+ }
+
+ void ShiftExpr(
+#line 1846 "VBNET.ATG"
+out Expression outExpr) {
+
+#line 1848 "VBNET.ATG"
+ Expression expr;
+ BinaryOperatorType op = BinaryOperatorType.None;
+
+ ConcatenationExpr(
+#line 1851 "VBNET.ATG"
+out outExpr);
+ while (la.kind == 32 || la.kind == 33) {
+ if (la.kind == 32) {
+ lexer.NextToken();
+
+#line 1854 "VBNET.ATG"
+ op = BinaryOperatorType.ShiftLeft;
+ } else {
+ lexer.NextToken();
+
+#line 1855 "VBNET.ATG"
+ op = BinaryOperatorType.ShiftRight;
+ }
+ ConcatenationExpr(
+#line 1857 "VBNET.ATG"
+out expr);
+
+#line 1857 "VBNET.ATG"
+ outExpr = new BinaryOperatorExpression(outExpr, op, expr);
+ }
+ }
+
+ void ConcatenationExpr(
+#line 1861 "VBNET.ATG"
+out Expression outExpr) {
+
+#line 1862 "VBNET.ATG"
+ Expression expr;
+ AdditiveExpr(
+#line 1864 "VBNET.ATG"
+out outExpr);
+ while (la.kind == 13) {
+ lexer.NextToken();
+ AdditiveExpr(
+#line 1864 "VBNET.ATG"
+out expr);
+
+#line 1864 "VBNET.ATG"
+ outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.Concat, expr);
+ }
+ }
+
+ void AdditiveExpr(
+#line 1867 "VBNET.ATG"
+out Expression outExpr) {
+
+#line 1869 "VBNET.ATG"
+ Expression expr;
+ BinaryOperatorType op = BinaryOperatorType.None;
+
+ ModuloExpr(
+#line 1872 "VBNET.ATG"
+out outExpr);
+ while (la.kind == 18 || la.kind == 19) {
+ if (la.kind == 19) {
+ lexer.NextToken();
+
+#line 1875 "VBNET.ATG"
+ op = BinaryOperatorType.Add;
+ } else {
+ lexer.NextToken();
+
+#line 1876 "VBNET.ATG"
+ op = BinaryOperatorType.Subtract;
+ }
+ ModuloExpr(
+#line 1878 "VBNET.ATG"
+out expr);
+
+#line 1878 "VBNET.ATG"
+ outExpr = new BinaryOperatorExpression(outExpr, op, expr);
+ }
+ }
+
+ void ModuloExpr(
+#line 1882 "VBNET.ATG"
+out Expression outExpr) {
+
+#line 1883 "VBNET.ATG"
+ Expression expr;
+ IntegerDivisionExpr(
+#line 1885 "VBNET.ATG"
+out outExpr);
+ while (la.kind == 140) {
+ lexer.NextToken();
+ IntegerDivisionExpr(
+#line 1885 "VBNET.ATG"
+out expr);
+
+#line 1885 "VBNET.ATG"
+ outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.Modulus, expr);
+ }
+ }
+
+ void IntegerDivisionExpr(
+#line 1888 "VBNET.ATG"
+out Expression outExpr) {
+
+#line 1889 "VBNET.ATG"
+ Expression expr;
+ MultiplicativeExpr(
+#line 1891 "VBNET.ATG"
+out outExpr);
+ while (la.kind == 15) {
+ lexer.NextToken();
+ MultiplicativeExpr(
+#line 1891 "VBNET.ATG"
+out expr);
+
+#line 1891 "VBNET.ATG"
+ outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.DivideInteger, expr);
+ }
+ }
+
+ void MultiplicativeExpr(
+#line 1894 "VBNET.ATG"
+out Expression outExpr) {
+
+#line 1896 "VBNET.ATG"
+ Expression expr;
+ BinaryOperatorType op = BinaryOperatorType.None;
+
+ UnaryExpr(
+#line 1899 "VBNET.ATG"
+out outExpr);
+ while (la.kind == 14 || la.kind == 22) {
+ if (la.kind == 22) {
+ lexer.NextToken();
+
+#line 1902 "VBNET.ATG"
+ op = BinaryOperatorType.Multiply;
+ } else {
+ lexer.NextToken();
+
+#line 1903 "VBNET.ATG"
+ op = BinaryOperatorType.Divide;
+ }
+ UnaryExpr(
+#line 1905 "VBNET.ATG"
+out expr);
+
+#line 1905 "VBNET.ATG"
+ outExpr = new BinaryOperatorExpression(outExpr, op, expr);
+ }
+ }
+
+ void UnaryExpr(
+#line 1909 "VBNET.ATG"
+out Expression uExpr) {
+
+#line 1911 "VBNET.ATG"
+ Expression expr;
+ UnaryOperatorType uop = UnaryOperatorType.None;
+ bool isUOp = false;
+
+ while (la.kind == 18 || la.kind == 19 || la.kind == 22) {
+ if (la.kind == 19) {
+ lexer.NextToken();
+
+#line 1915 "VBNET.ATG"
+ uop = UnaryOperatorType.Plus; isUOp = true;
+ } else if (la.kind == 18) {
+ lexer.NextToken();
+
+#line 1916 "VBNET.ATG"
+ uop = UnaryOperatorType.Minus; isUOp = true;
+ } else {
+ lexer.NextToken();
+
+#line 1917 "VBNET.ATG"
+ uop = UnaryOperatorType.Dereference; isUOp = true;
+ }
+ }
+ ExponentiationExpr(
+#line 1919 "VBNET.ATG"
+out expr);
+
+#line 1921 "VBNET.ATG"
+ if (isUOp) {
+ uExpr = new UnaryOperatorExpression(expr, uop);
+ } else {
+ uExpr = expr;
+ }
+
+ }
+
+ void ExponentiationExpr(
+#line 1929 "VBNET.ATG"
+out Expression outExpr) {
+
+#line 1930 "VBNET.ATG"
+ Expression expr;
+ SimpleExpr(
+#line 1932 "VBNET.ATG"
+out outExpr);
+ while (la.kind == 20) {
+ lexer.NextToken();
+ SimpleExpr(
+#line 1932 "VBNET.ATG"
+out expr);
+
+#line 1932 "VBNET.ATG"
+ outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.Power, expr);
+ }
+ }
+
+ void NormalOrReDimArgumentList(
+#line 2354 "VBNET.ATG"
+out List<Expression> arguments, out bool canBeNormal, out bool canBeRedim) {
+
+#line 2356 "VBNET.ATG"
+ arguments = new List<Expression>();
+ canBeNormal = true; canBeRedim = !IsNamedAssign();
+ Expression expr = null;
+
+ if (StartOf(29)) {
+ Argument(
+#line 2361 "VBNET.ATG"
+out expr);
+ if (la.kind == 201) {
+ lexer.NextToken();
+
+#line 2362 "VBNET.ATG"
+ EnsureIsZero(expr); canBeNormal = false;
+ Expr(
+#line 2363 "VBNET.ATG"
+out expr);
+ }
+ }
+ while (la.kind == 12) {
+ lexer.NextToken();
+
+#line 2366 "VBNET.ATG"
+ if (expr == null) canBeRedim = false;
+
+#line 2367 "VBNET.ATG"
+ arguments.Add(expr ?? Expression.Null); expr = null;
+
+#line 2368 "VBNET.ATG"
+ canBeRedim &= !IsNamedAssign();
+ if (StartOf(29)) {
+ Argument(
+#line 2369 "VBNET.ATG"
+out expr);
+ if (la.kind == 201) {
+ lexer.NextToken();
+
+#line 2370 "VBNET.ATG"
+ EnsureIsZero(expr); canBeNormal = false;
+ Expr(
+#line 2371 "VBNET.ATG"
+out expr);
+ }
+ }
+
+#line 2373 "VBNET.ATG"
+ if (expr == null) { canBeRedim = false; expr = Expression.Null; }
+ }
+
+#line 2375 "VBNET.ATG"
+ if (expr != null) arguments.Add(expr); else canBeRedim = false;
+ }
+
+ void ArrayTypeModifiers(
+#line 2482 "VBNET.ATG"
+out ArrayList arrayModifiers) {
+
+#line 2484 "VBNET.ATG"
+ arrayModifiers = new ArrayList();
+ int i = 0;
+
+ while (
+#line 2487 "VBNET.ATG"
+IsDims()) {
+ Expect(25);
+ if (la.kind == 12 || la.kind == 26) {
+ RankList(
+#line 2489 "VBNET.ATG"
+out i);
+ }
+
+#line 2491 "VBNET.ATG"
+ arrayModifiers.Add(i);
+
+ Expect(26);
+ }
+
+#line 2496 "VBNET.ATG"
+ if(arrayModifiers.Count == 0) {
+ arrayModifiers = null;
+ }
+
+ }
+
+ void MemberInitializer(
+#line 2324 "VBNET.ATG"
+out NamedArgumentExpression memberInitializer) {
+
+#line 2326 "VBNET.ATG"
+ memberInitializer = new NamedArgumentExpression();
+ memberInitializer.StartLocation = la.Location;
+ Expression initExpr = null;
+ string name = null;
+
+ Expect(16);
+ IdentifierOrKeyword(
+#line 2331 "VBNET.ATG"
+out name);
+ Expect(10);
+ Expr(
+#line 2331 "VBNET.ATG"
+out initExpr);
+
+#line 2333 "VBNET.ATG"
+ memberInitializer.Name = name;
+ memberInitializer.Expression = initExpr;
+ memberInitializer.EndLocation = t.EndLocation;
+
+ }
+
+ void FromOrAggregateQueryOperator(
+#line 2027 "VBNET.ATG"
+List<QueryExpressionClause> middleClauses) {
+
+#line 2028 "VBNET.ATG"
+
+ if (la.kind == 113) {
+ FromQueryOperator(
+#line 2029 "VBNET.ATG"
+middleClauses);
+ } else if (la.kind == 45) {
+ AggregateQueryOperator(
+#line 2030 "VBNET.ATG"
+middleClauses);
+ } else SynErr(264);
+ }
+
+ void QueryOperator(
+#line 2033 "VBNET.ATG"
+List<QueryExpressionClause> middleClauses) {
+
+#line 2035 "VBNET.ATG"
+ QueryExpressionJoinVBClause joinClause = null;
+ QueryExpressionGroupVBClause groupByClause = null;
+ QueryExpressionPartitionVBClause partitionClause = null;
+ QueryExpressionGroupJoinVBClause groupJoinClause = null;
+
+ if (la.kind == 113) {
+ FromQueryOperator(
+#line 2040 "VBNET.ATG"
+middleClauses);
+ } else if (la.kind == 45) {
+ AggregateQueryOperator(
+#line 2041 "VBNET.ATG"
+middleClauses);
+ } else if (la.kind == 182) {
+ SelectQueryOperator(
+#line 2042 "VBNET.ATG"
+middleClauses);
+ } else if (la.kind == 94) {
+ DistinctQueryOperator(
+#line 2043 "VBNET.ATG"
+middleClauses);
+ } else if (la.kind == 215) {
+ WhereQueryOperator(
+#line 2044 "VBNET.ATG"
+middleClauses);
+ } else if (la.kind == 162) {
+ OrderByQueryOperator(
+#line 2045 "VBNET.ATG"
+middleClauses);
+ } else if (la.kind == 188 || la.kind == 197) {
+ PartitionQueryOperator(
+#line 2046 "VBNET.ATG"
+out partitionClause);
+ } else if (la.kind == 134) {
+ LetQueryOperator(
+#line 2047 "VBNET.ATG"
+middleClauses);
+ } else if (la.kind == 133) {
+ JoinQueryOperator(
+#line 2048 "VBNET.ATG"
+out joinClause);
+
+#line 2049 "VBNET.ATG"
+ middleClauses.Add(joinClause);
+ } else if (
+#line 2050 "VBNET.ATG"
+la.kind == Tokens.Group && Peek(1).kind == Tokens.Join) {
+ GroupJoinQueryOperator(
+#line 2050 "VBNET.ATG"
+out groupJoinClause);
+
+#line 2051 "VBNET.ATG"
+ middleClauses.Add(groupJoinClause);
+ } else if (la.kind == 120) {
+ GroupByQueryOperator(
+#line 2052 "VBNET.ATG"
+out groupByClause);
+
+#line 2053 "VBNET.ATG"
+ middleClauses.Add(groupByClause);
+ } else SynErr(265);
+ }
+
+ void FromQueryOperator(
+#line 2128 "VBNET.ATG"
+List<QueryExpressionClause> middleClauses) {
+
+#line 2130 "VBNET.ATG"
+
+ Expect(113);
+ CollectionRangeVariableDeclarationList(
+#line 2131 "VBNET.ATG"
+middleClauses);
+ }
+
+ void AggregateQueryOperator(
+#line 2191 "VBNET.ATG"
+List<QueryExpressionClause> middleClauses) {
+
+#line 2193 "VBNET.ATG"
+ QueryExpressionFromClause fromClause = null;
+ QueryExpressionAggregateClause aggregateClause = new QueryExpressionAggregateClause();
+ aggregateClause.IntoVariables = new List<ExpressionRangeVariable>();
+ aggregateClause.StartLocation = la.Location;
+
+ Expect(45);
+ CollectionRangeVariableDeclaration(
+#line 2198 "VBNET.ATG"
+out fromClause);
+
+#line 2200 "VBNET.ATG"
+ aggregateClause.FromClause = fromClause;
+
+ while (StartOf(31)) {
+ QueryOperator(
+#line 2203 "VBNET.ATG"
+aggregateClause.MiddleClauses);
+ }
+ Expect(130);
+ ExpressionRangeVariableDeclarationList(
+#line 2205 "VBNET.ATG"
+aggregateClause.IntoVariables);
+
+#line 2207 "VBNET.ATG"
+ aggregateClause.EndLocation = t.EndLocation;
+ middleClauses.Add(aggregateClause);
+
+ }
+
+ void SelectQueryOperator(
+#line 2134 "VBNET.ATG"
+List<QueryExpressionClause> middleClauses) {
+
+#line 2136 "VBNET.ATG"
+ QueryExpressionSelectVBClause selectClause = new QueryExpressionSelectVBClause();
+ selectClause.StartLocation = la.Location;
+
+ Expect(182);
+ ExpressionRangeVariableDeclarationList(
+#line 2139 "VBNET.ATG"
+selectClause.Variables);
+
+#line 2141 "VBNET.ATG"
+ selectClause.EndLocation = t.Location;
+ middleClauses.Add(selectClause);
+
+ }
+
+ void DistinctQueryOperator(
+#line 2146 "VBNET.ATG"
+List<QueryExpressionClause> middleClauses) {
+
+#line 2148 "VBNET.ATG"
+ QueryExpressionDistinctClause distinctClause = new QueryExpressionDistinctClause();
+ distinctClause.StartLocation = la.Location;
+
+ Expect(94);
+
+#line 2153 "VBNET.ATG"
+ distinctClause.EndLocation = t.EndLocation;
+ middleClauses.Add(distinctClause);
+
+ }
+
+ void WhereQueryOperator(
+#line 2158 "VBNET.ATG"
+List<QueryExpressionClause> middleClauses) {
+
+#line 2160 "VBNET.ATG"
+ QueryExpressionWhereClause whereClause = new QueryExpressionWhereClause();
+ whereClause.StartLocation = la.Location;
+ Expression operand = null;
+
+ Expect(215);
+ Expr(
+#line 2164 "VBNET.ATG"
+out operand);
+
+#line 2166 "VBNET.ATG"
+ whereClause.Condition = operand;
+ whereClause.EndLocation = t.EndLocation;
+
+ middleClauses.Add(whereClause);
+
+ }
+
+ void OrderByQueryOperator(
+#line 2056 "VBNET.ATG"
+List<QueryExpressionClause> middleClauses) {
+
+#line 2058 "VBNET.ATG"
+ QueryExpressionOrderClause orderClause = new QueryExpressionOrderClause();
+ orderClause.StartLocation = la.Location;
+ List<QueryExpressionOrdering> orderings = null;
+
+ Expect(162);
+ Expect(57);
+ OrderExpressionList(
+#line 2062 "VBNET.ATG"
+out orderings);
+
+#line 2064 "VBNET.ATG"
+ orderClause.Orderings = orderings;
+ orderClause.EndLocation = t.EndLocation;
+ middleClauses.Add(orderClause);
+
+ }
+
+ void PartitionQueryOperator(
+#line 2173 "VBNET.ATG"
+out QueryExpressionPartitionVBClause partitionClause) {
+
+#line 2175 "VBNET.ATG"
+ partitionClause = new QueryExpressionPartitionVBClause();
+ partitionClause.StartLocation = la.Location;
+ Expression expr = null;
+
+ if (la.kind == 197) {
+ lexer.NextToken();
+
+#line 2179 "VBNET.ATG"
+ partitionClause.PartitionType = QueryExpressionPartitionType.Take;
+ if (la.kind == 216) {
+ lexer.NextToken();
+
+#line 2180 "VBNET.ATG"
+ partitionClause.PartitionType = QueryExpressionPartitionType.TakeWhile;
+ }
+ Expr(
+#line 2181 "VBNET.ATG"
+out expr);
+ } else if (la.kind == 188) {
+ lexer.NextToken();
+
+#line 2182 "VBNET.ATG"
+ partitionClause.PartitionType = QueryExpressionPartitionType.Skip;
+ if (la.kind == 216) {
+ lexer.NextToken();
+ }
+
+#line 2183 "VBNET.ATG"
+ partitionClause.PartitionType = QueryExpressionPartitionType.SkipWhile;
+ Expr(
+#line 2184 "VBNET.ATG"
+out expr);
+
+#line 2186 "VBNET.ATG"
+ partitionClause.Expression = expr;
+ partitionClause.EndLocation = t.EndLocation;
+
+ } else SynErr(266);
+ }
+
+ void LetQueryOperator(
+#line 2212 "VBNET.ATG"
+List<QueryExpressionClause> middleClauses) {
+
+#line 2214 "VBNET.ATG"
+ QueryExpressionLetVBClause letClause = new QueryExpressionLetVBClause();
+ letClause.StartLocation = la.Location;
+
+ Expect(134);
+ ExpressionRangeVariableDeclarationList(
+#line 2217 "VBNET.ATG"
+letClause.Variables);
+
+#line 2219 "VBNET.ATG"
+ letClause.EndLocation = t.EndLocation;
+ middleClauses.Add(letClause);
+
+ }
+
+ void JoinQueryOperator(
+#line 2256 "VBNET.ATG"
+out QueryExpressionJoinVBClause joinClause) {
+
+#line 2258 "VBNET.ATG"
+ joinClause = new QueryExpressionJoinVBClause();
+ joinClause.StartLocation = la.Location;
+ QueryExpressionFromClause joinVariable = null;
+ QueryExpressionJoinVBClause subJoin = null;
+ QueryExpressionJoinConditionVB condition = null;
+
+
+ Expect(133);
+ CollectionRangeVariableDeclaration(
+#line 2265 "VBNET.ATG"
+out joinVariable);
+
+#line 2266 "VBNET.ATG"
+ joinClause.JoinVariable = joinVariable;
+ if (la.kind == 133) {
+ JoinQueryOperator(
+#line 2268 "VBNET.ATG"
+out subJoin);
+
+#line 2269 "VBNET.ATG"
+ joinClause.SubJoin = subJoin;
+ }
+ Expect(157);
+ JoinCondition(
+#line 2272 "VBNET.ATG"
+out condition);
+
+#line 2273 "VBNET.ATG"
+ SafeAdd(joinClause, joinClause.Conditions, condition);
+ while (la.kind == 47) {
+ lexer.NextToken();
+ JoinCondition(
+#line 2275 "VBNET.ATG"
+out condition);
+
+#line 2276 "VBNET.ATG"
+ SafeAdd(joinClause, joinClause.Conditions, condition);
+ }
+
+#line 2279 "VBNET.ATG"
+ joinClause.EndLocation = t.EndLocation;
+
+ }
+
+ void GroupJoinQueryOperator(
+#line 2114 "VBNET.ATG"
+out QueryExpressionGroupJoinVBClause groupJoinClause) {
+
+#line 2116 "VBNET.ATG"
+ groupJoinClause = new QueryExpressionGroupJoinVBClause();
+ groupJoinClause.StartLocation = la.Location;
+ QueryExpressionJoinVBClause joinClause = null;
+
+ Expect(120);
+ JoinQueryOperator(
+#line 2120 "VBNET.ATG"
+out joinClause);
+ Expect(130);
+ ExpressionRangeVariableDeclarationList(
+#line 2121 "VBNET.ATG"
+groupJoinClause.IntoVariables);
+
+#line 2123 "VBNET.ATG"
+ groupJoinClause.JoinClause = joinClause;
+ groupJoinClause.EndLocation = t.EndLocation;
+
+ }
+
+ void GroupByQueryOperator(
+#line 2101 "VBNET.ATG"
+out QueryExpressionGroupVBClause groupByClause) {
+
+#line 2103 "VBNET.ATG"
+ groupByClause = new QueryExpressionGroupVBClause();
+ groupByClause.StartLocation = la.Location;
+
+ Expect(120);
+ ExpressionRangeVariableDeclarationList(
+#line 2106 "VBNET.ATG"
+groupByClause.GroupVariables);
+ Expect(57);
+ ExpressionRangeVariableDeclarationList(
+#line 2107 "VBNET.ATG"
+groupByClause.ByVariables);
+ Expect(130);
+ ExpressionRangeVariableDeclarationList(
+#line 2108 "VBNET.ATG"
+groupByClause.IntoVariables);
+
+#line 2110 "VBNET.ATG"
+ groupByClause.EndLocation = t.EndLocation;
+
+ }
+
+ void OrderExpressionList(
+#line 2070 "VBNET.ATG"
+out List<QueryExpressionOrdering> orderings) {
+
+#line 2072 "VBNET.ATG"
+ orderings = new List<QueryExpressionOrdering>();
+ QueryExpressionOrdering ordering = null;
+
+ OrderExpression(
+#line 2075 "VBNET.ATG"
+out ordering);
+
+#line 2076 "VBNET.ATG"
+ orderings.Add(ordering);
+ while (la.kind == 12) {
+ lexer.NextToken();
+ OrderExpression(
+#line 2078 "VBNET.ATG"
+out ordering);
+
+#line 2079 "VBNET.ATG"
+ orderings.Add(ordering);
+ }
+ }
+
+ void OrderExpression(
+#line 2083 "VBNET.ATG"
+out QueryExpressionOrdering ordering) {
+
+#line 2085 "VBNET.ATG"
+ ordering = new QueryExpressionOrdering();
+ ordering.StartLocation = la.Location;
+ ordering.Direction = QueryExpressionOrderingDirection.None;
+ Expression orderExpr = null;
+
+ Expr(
+#line 2090 "VBNET.ATG"
+out orderExpr);
+
+#line 2092 "VBNET.ATG"
+ ordering.Criteria = orderExpr;
+
+ if (la.kind == 51 || la.kind == 91) {
+ if (la.kind == 51) {
+ lexer.NextToken();
+
+#line 2095 "VBNET.ATG"
+ ordering.Direction = QueryExpressionOrderingDirection.Ascending;
+ } else {
+ lexer.NextToken();
+
+#line 2096 "VBNET.ATG"
+ ordering.Direction = QueryExpressionOrderingDirection.Descending;
+ }
+ }
+
+#line 2098 "VBNET.ATG"
+ ordering.EndLocation = t.EndLocation;
+ }
+
+ void ExpressionRangeVariableDeclarationList(
+#line 2224 "VBNET.ATG"
+List<ExpressionRangeVariable> variables) {
+
+#line 2226 "VBNET.ATG"
+ ExpressionRangeVariable variable = null;
+
+ ExpressionRangeVariableDeclaration(
+#line 2228 "VBNET.ATG"
+out variable);
+
+#line 2229 "VBNET.ATG"
+ variables.Add(variable);
+ while (la.kind == 12) {
+ lexer.NextToken();
+ ExpressionRangeVariableDeclaration(
+#line 2230 "VBNET.ATG"
+out variable);
+
+#line 2230 "VBNET.ATG"
+ variables.Add(variable);
+ }
+ }
+
+ void CollectionRangeVariableDeclarationList(
+#line 2283 "VBNET.ATG"
+List<QueryExpressionClause> middleClauses) {
+
+#line 2285 "VBNET.ATG"
+ QueryExpressionFromClause fromClause = null;
+
+ CollectionRangeVariableDeclaration(
+#line 2287 "VBNET.ATG"
+out fromClause);
+
+#line 2288 "VBNET.ATG"
+ middleClauses.Add(fromClause);
+ while (la.kind == 12) {
+ lexer.NextToken();
+ CollectionRangeVariableDeclaration(
+#line 2289 "VBNET.ATG"
+out fromClause);
+
+#line 2289 "VBNET.ATG"
+ middleClauses.Add(fromClause);
+ }
+ }
+
+ void CollectionRangeVariableDeclaration(
+#line 2292 "VBNET.ATG"
+out QueryExpressionFromClause fromClause) {
+
+#line 2294 "VBNET.ATG"
+ fromClause = new QueryExpressionFromClause();
+ fromClause.StartLocation = la.Location;
+ TypeReference typeName = null;
+ Expression inExpr = null;
+
+ Identifier();
+ if (la.kind == 50) {
+ lexer.NextToken();
+ TypeName(
+#line 2300 "VBNET.ATG"
+out typeName);
+
+#line 2300 "VBNET.ATG"
+ fromClause.Type = typeName;
+ }
+ Expect(125);
+ Expr(
+#line 2301 "VBNET.ATG"
+out inExpr);
+
+#line 2303 "VBNET.ATG"
+ fromClause.InExpression = inExpr;
+ fromClause.EndLocation = t.EndLocation;
+
+ }
+
+ void ExpressionRangeVariableDeclaration(
+#line 2233 "VBNET.ATG"
+out ExpressionRangeVariable variable) {
+
+#line 2235 "VBNET.ATG"
+ variable = new ExpressionRangeVariable();
+ variable.StartLocation = la.Location;
+ Expression rhs = null;
+ TypeReference typeName = null;
+
+ if (
+#line 2241 "VBNET.ATG"
+IsIdentifiedExpressionRange()) {
+ Identifier();
+
+#line 2242 "VBNET.ATG"
+ variable.Identifier = t.val;
+ if (la.kind == 50) {
+ lexer.NextToken();
+ TypeName(
+#line 2244 "VBNET.ATG"
+out typeName);
+
+#line 2245 "VBNET.ATG"
+ variable.Type = typeName;
+ }
+ Expect(10);
+ }
+ Expr(
+#line 2249 "VBNET.ATG"
+out rhs);
+
+#line 2251 "VBNET.ATG"
+ variable.Expression = rhs;
+ variable.EndLocation = t.EndLocation;
+
+ }
+
+ void JoinCondition(
+#line 2308 "VBNET.ATG"
+out QueryExpressionJoinConditionVB condition) {
+
+#line 2310 "VBNET.ATG"
+ condition = new QueryExpressionJoinConditionVB();
+ condition.StartLocation = la.Location;
+
+ Expression lhs = null;
+ Expression rhs = null;
+
+ Expr(
+#line 2316 "VBNET.ATG"
+out lhs);
+ Expect(103);
+ Expr(
+#line 2316 "VBNET.ATG"
+out rhs);
+
+#line 2318 "VBNET.ATG"
+ condition.LeftSide = lhs;
+ condition.RightSide = rhs;
+ condition.EndLocation = t.EndLocation;
+
+ }
+
+ void Argument(
+#line 2379 "VBNET.ATG"
+out Expression argumentexpr) {
+
+#line 2381 "VBNET.ATG"
+ Expression expr;
+ argumentexpr = null;
+ string name;
+
+ if (
+#line 2385 "VBNET.ATG"
+IsNamedAssign()) {
+ Identifier();
+
+#line 2385 "VBNET.ATG"
+ name = t.val;
+ Expect(11);
+ Expect(10);
+ Expr(
+#line 2385 "VBNET.ATG"
+out expr);
+
+#line 2387 "VBNET.ATG"
+ argumentexpr = new NamedArgumentExpression(name, expr);
+
+ } else if (StartOf(29)) {
+ Expr(
+#line 2390 "VBNET.ATG"
+out argumentexpr);
+ } else SynErr(267);
+ }
+
+ void QualIdentAndTypeArguments(
+#line 2456 "VBNET.ATG"
+out TypeReference typeref, bool canBeUnbound) {
+
+#line 2457 "VBNET.ATG"
+ string name; typeref = null;
+ Qualident(
+#line 2459 "VBNET.ATG"
+out name);
+
+#line 2460 "VBNET.ATG"
+ typeref = new TypeReference(name);
+ if (
+#line 2461 "VBNET.ATG"
+la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of) {
+ lexer.NextToken();
+ Expect(155);
+ if (
+#line 2463 "VBNET.ATG"
+canBeUnbound && (la.kind == Tokens.CloseParenthesis || la.kind == Tokens.Comma)) {
+
+#line 2464 "VBNET.ATG"
+ typeref.GenericTypes.Add(NullTypeReference.Instance);
+ while (la.kind == 12) {
+ lexer.NextToken();
+
+#line 2465 "VBNET.ATG"
+ typeref.GenericTypes.Add(NullTypeReference.Instance);
+ }
+ } else if (StartOf(7)) {
+ TypeArgumentList(
+#line 2466 "VBNET.ATG"
+typeref.GenericTypes);
+ } else SynErr(268);
+ Expect(26);
+ }
+ }
+
+ void RankList(
+#line 2503 "VBNET.ATG"
+out int i) {
+
+#line 2504 "VBNET.ATG"
+ i = 0;
+ while (la.kind == 12) {
+ lexer.NextToken();
+
+#line 2505 "VBNET.ATG"
+ ++i;
+ }
+ }
+
+ void Attribute(
+#line 2544 "VBNET.ATG"
+out ASTAttribute attribute) {
+
+#line 2545 "VBNET.ATG"
+ string name;
+ List<Expression> positional = new List<Expression>();
+ List<NamedArgumentExpression> named = new List<NamedArgumentExpression>();
+
+ if (la.kind == 117) {
+ lexer.NextToken();
+ Expect(16);
+ }
+ Qualident(
+#line 2550 "VBNET.ATG"
+out name);
+ if (la.kind == 25) {
+ AttributeArguments(
+#line 2551 "VBNET.ATG"
+positional, named);
+ }
+
+#line 2553 "VBNET.ATG"
+ attribute = new ASTAttribute(name, positional, named);
+
+ }
+
+ void AttributeArguments(
+#line 2558 "VBNET.ATG"
+List<Expression> positional, List<NamedArgumentExpression> named) {
+
+#line 2560 "VBNET.ATG"
+ bool nameFound = false;
+ string name = "";
+ Expression expr;
+
+ Expect(25);
+ if (
+#line 2566 "VBNET.ATG"
+IsNotClosingParenthesis()) {
+ if (
+#line 2568 "VBNET.ATG"
+IsNamedAssign()) {
+
+#line 2568 "VBNET.ATG"
+ nameFound = true;
+ IdentifierOrKeyword(
+#line 2569 "VBNET.ATG"
+out name);
+ if (la.kind == 11) {
+ lexer.NextToken();
+ }
+ Expect(10);
+ }
+ Expr(
+#line 2571 "VBNET.ATG"
+out expr);
+
+#line 2573 "VBNET.ATG"
+ if (expr != null) {
+ if (string.IsNullOrEmpty(name)) { positional.Add(expr); }
+ else { named.Add(new NamedArgumentExpression(name, expr)); name = ""; }
+ }
+
+ while (la.kind == 12) {
+ lexer.NextToken();
+ if (
+#line 2581 "VBNET.ATG"
+IsNamedAssign()) {
+
+#line 2581 "VBNET.ATG"
+ nameFound = true;
+ IdentifierOrKeyword(
+#line 2582 "VBNET.ATG"
+out name);
+ if (la.kind == 11) {
+ lexer.NextToken();
+ }
+ Expect(10);
+ } else if (StartOf(29)) {
+
+#line 2584 "VBNET.ATG"
+ if (nameFound) Error("no positional argument after named argument");
+ } else SynErr(269);
+ Expr(
+#line 2585 "VBNET.ATG"
+out expr);
+
+#line 2585 "VBNET.ATG"
+ if (expr != null) { if(name == "") positional.Add(expr);
+ else { named.Add(new NamedArgumentExpression(name, expr)); name = ""; }
+ }
+
+ }
+ }
+ Expect(26);
+ }
+
+ void FormalParameter(
+#line 2642 "VBNET.ATG"
+out ParameterDeclarationExpression p) {
+
+#line 2644 "VBNET.ATG"
+ AttributeSection section;
+ List<AttributeSection> attributes = new List<AttributeSection>();
+ TypeReference type = null;
+ ParamModifierList mod = new ParamModifierList(this);
+ Expression expr = null;
+ p = null;
+ ArrayList arrayModifiers = null;
+
+ while (la.kind == 28) {
+ AttributeSection(
+#line 2653 "VBNET.ATG"
+out section);
+
+#line 2653 "VBNET.ATG"
+ attributes.Add(section);
+ }
+ while (StartOf(35)) {
+ ParameterModifier(
+#line 2654 "VBNET.ATG"
+mod);
+ }
+ Identifier();
+
+#line 2655 "VBNET.ATG"
+ string parameterName = t.val;
+ if (
+#line 2656 "VBNET.ATG"
+IsDims()) {
+ ArrayTypeModifiers(
+#line 2656 "VBNET.ATG"
+out arrayModifiers);
+ }
+ if (la.kind == 50) {
+ lexer.NextToken();
+ TypeName(
+#line 2657 "VBNET.ATG"
+out type);
+ }
+
+#line 2659 "VBNET.ATG"
+ if(type != null) {
+ if (arrayModifiers != null) {
+ if (type.RankSpecifier != null) {
+ Error("array rank only allowed one time");
+ } else {
+ type.RankSpecifier = (int[])arrayModifiers.ToArray(typeof(int));
+ }
+ }
+ } else {
+ type = new TypeReference("System.Object", arrayModifiers == null ? null : (int[])arrayModifiers.ToArray(typeof(int)));
+ }
+
+ if (la.kind == 10) {
+ lexer.NextToken();
+ Expr(
+#line 2671 "VBNET.ATG"
+out expr);
+ }
+
+#line 2673 "VBNET.ATG"
+ mod.Check();
+ p = new ParameterDeclarationExpression(type, parameterName, mod.Modifier, expr);
+ p.Attributes = attributes;
+
+ }
+
+ void ParameterModifier(
+#line 3355 "VBNET.ATG"
+ParamModifierList m) {
+ if (la.kind == 59) {
+ lexer.NextToken();
+
+#line 3356 "VBNET.ATG"
+ m.Add(ParameterModifiers.In);
+ } else if (la.kind == 56) {
+ lexer.NextToken();
+
+#line 3357 "VBNET.ATG"
+ m.Add(ParameterModifiers.Ref);
+ } else if (la.kind == 160) {
+ lexer.NextToken();
+
+#line 3358 "VBNET.ATG"
+ m.Add(ParameterModifiers.Optional);
+ } else if (la.kind == 167) {
+ lexer.NextToken();
+
+#line 3359 "VBNET.ATG"
+ m.Add(ParameterModifiers.Params);
+ } else SynErr(270);
+ }
+
+ void Statement() {
+
+#line 2702 "VBNET.ATG"
+ Statement stmt = null;
+ Location startPos = la.Location;
+ string label = String.Empty;
+
+
+ if (la.kind == 1 || la.kind == 11) {
+ } else if (
+#line 2708 "VBNET.ATG"
+IsLabel()) {
+ LabelName(
+#line 2708 "VBNET.ATG"
+out label);
+
+#line 2710 "VBNET.ATG"
+ compilationUnit.AddChild(new LabelStatement(t.val));
+
+ Expect(11);
+ Statement();
+ } else if (StartOf(36)) {
+ EmbeddedStatement(
+#line 2713 "VBNET.ATG"
+out stmt);
+
+#line 2713 "VBNET.ATG"
+ compilationUnit.AddChild(stmt);
+ } else SynErr(271);
+
+#line 2716 "VBNET.ATG"
+ if (stmt != null) {
+ stmt.StartLocation = startPos;
+ stmt.EndLocation = t.Location;
+ }
+
+ }
+
+ void LabelName(
+#line 3131 "VBNET.ATG"
+out string name) {
+
+#line 3133 "VBNET.ATG"
+ name = String.Empty;
+
+ if (StartOf(14)) {
+ Identifier();
+
+#line 3135 "VBNET.ATG"
+ name = t.val;
+ } else if (la.kind == 5) {
+ lexer.NextToken();
+
+#line 3136 "VBNET.ATG"
+ name = t.val;
+ } else SynErr(272);
+ }
+
+ void EmbeddedStatement(
+#line 2755 "VBNET.ATG"
+out Statement statement) {
+
+#line 2757 "VBNET.ATG"
+ Statement embeddedStatement = null;
+ statement = null;
+ Expression expr = null;
+ string name = String.Empty;
+ List<Expression> p = null;
+
+ if (la.kind == 107) {
+ lexer.NextToken();
+
+#line 2763 "VBNET.ATG"
+ ExitType exitType = ExitType.None;
+ switch (la.kind) {
+ case 195: {
+ lexer.NextToken();
+
+#line 2765 "VBNET.ATG"
+ exitType = ExitType.Sub;
+ break;
+ }
+ case 114: {
+ lexer.NextToken();
+
+#line 2767 "VBNET.ATG"
+ exitType = ExitType.Function;
+ break;
+ }
+ case 171: {
+ lexer.NextToken();
+
+#line 2769 "VBNET.ATG"
+ exitType = ExitType.Property;
+ break;
+ }
+ case 95: {
+ lexer.NextToken();
+
+#line 2771 "VBNET.ATG"
+ exitType = ExitType.Do;
+ break;
+ }
+ case 111: {
+ lexer.NextToken();
+
+#line 2773 "VBNET.ATG"
+ exitType = ExitType.For;
+ break;
+ }
+ case 203: {
+ lexer.NextToken();
+
+#line 2775 "VBNET.ATG"
+ exitType = ExitType.Try;
+ break;
+ }
+ case 216: {
+ lexer.NextToken();
+
+#line 2777 "VBNET.ATG"
+ exitType = ExitType.While;
+ break;
+ }
+ case 182: {
+ lexer.NextToken();
+
+#line 2779 "VBNET.ATG"
+ exitType = ExitType.Select;
+ break;
+ }
+ default: SynErr(273); break;
+ }
+
+#line 2781 "VBNET.ATG"
+ statement = new ExitStatement(exitType);
+ } else if (la.kind == 203) {
+ TryStatement(
+#line 2782 "VBNET.ATG"
+out statement);
+ } else if (la.kind == 76) {
+ lexer.NextToken();
+
+#line 2783 "VBNET.ATG"
+ ContinueType continueType = ContinueType.None;
+ if (la.kind == 95 || la.kind == 111 || la.kind == 216) {
+ if (la.kind == 95) {
+ lexer.NextToken();
+
+#line 2783 "VBNET.ATG"
+ continueType = ContinueType.Do;
+ } else if (la.kind == 111) {
+ lexer.NextToken();
+
+#line 2783 "VBNET.ATG"
+ continueType = ContinueType.For;
+ } else {
+ lexer.NextToken();
+
+#line 2783 "VBNET.ATG"
+ continueType = ContinueType.While;
+ }
+ }
+
+#line 2783 "VBNET.ATG"
+ statement = new ContinueStatement(continueType);
+ } else if (la.kind == 200) {
+ lexer.NextToken();
+ if (StartOf(29)) {
+ Expr(
+#line 2785 "VBNET.ATG"
+out expr);
+ }
+
+#line 2785 "VBNET.ATG"
+ statement = new ThrowStatement(expr);
+ } else if (la.kind == 180) {
+ lexer.NextToken();
+ if (StartOf(29)) {
+ Expr(
+#line 2787 "VBNET.ATG"
+out expr);
+ }
+
+#line 2787 "VBNET.ATG"
+ statement = new ReturnStatement(expr);
+ } else if (la.kind == 196) {
+ lexer.NextToken();
+ Expr(
+#line 2789 "VBNET.ATG"
+out expr);
+ EndOfStmt();
+ Block(
+#line 2789 "VBNET.ATG"
+out embeddedStatement);
+ Expect(100);
+ Expect(196);
+
+#line 2790 "VBNET.ATG"
+ statement = new LockStatement(expr, embeddedStatement);
+ } else if (la.kind == 174) {
+ lexer.NextToken();
+ Identifier();
+
+#line 2792 "VBNET.ATG"
+ name = t.val;
+ if (la.kind == 25) {
+ lexer.NextToken();
+ if (StartOf(37)) {
+ ArgumentList(
+#line 2793 "VBNET.ATG"
+out p);
+ }
+ Expect(26);
+ }
+
+#line 2795 "VBNET.ATG"
+ statement = new RaiseEventStatement(name, p);
+
+ } else if (la.kind == 218) {
+ WithStatement(
+#line 2798 "VBNET.ATG"
+out statement);
+ } else if (la.kind == 43) {
+ lexer.NextToken();
+
+#line 2800 "VBNET.ATG"
+ Expression handlerExpr = null;
+ Expr(
+#line 2801 "VBNET.ATG"
+out expr);
+ Expect(12);
+ Expr(
+#line 2801 "VBNET.ATG"
+out handlerExpr);
+
+#line 2803 "VBNET.ATG"
+ statement = new AddHandlerStatement(expr, handlerExpr);
+
+ } else if (la.kind == 178) {
+ lexer.NextToken();
+
+#line 2806 "VBNET.ATG"
+ Expression handlerExpr = null;
+ Expr(
+#line 2807 "VBNET.ATG"
+out expr);
+ Expect(12);
+ Expr(
+#line 2807 "VBNET.ATG"
+out handlerExpr);
+
+#line 2809 "VBNET.ATG"
+ statement = new RemoveHandlerStatement(expr, handlerExpr);
+
+ } else if (la.kind == 216) {
+ lexer.NextToken();
+ Expr(
+#line 2812 "VBNET.ATG"
+out expr);
+ EndOfStmt();
+ Block(
+#line 2813 "VBNET.ATG"
+out embeddedStatement);
+ Expect(100);
+ Expect(216);
+
+#line 2815 "VBNET.ATG"
+ statement = new DoLoopStatement(expr, embeddedStatement, ConditionType.While, ConditionPosition.Start);
+
+ } else if (la.kind == 95) {
+ lexer.NextToken();
+
+#line 2820 "VBNET.ATG"
+ ConditionType conditionType = ConditionType.None;
+
+ if (la.kind == 209 || la.kind == 216) {
+ WhileOrUntil(
+#line 2823 "VBNET.ATG"
+out conditionType);
+ Expr(
+#line 2823 "VBNET.ATG"
+out expr);
+ EndOfStmt();
+ Block(
+#line 2824 "VBNET.ATG"
+out embeddedStatement);
+ Expect(138);
+
+#line 2827 "VBNET.ATG"
+ statement = new DoLoopStatement(expr,
+ embeddedStatement,
+ conditionType == ConditionType.While ? ConditionType.DoWhile : conditionType,
+ ConditionPosition.Start);
+
+ } else if (la.kind == 1 || la.kind == 11) {
+ EndOfStmt();
+ Block(
+#line 2834 "VBNET.ATG"
+out embeddedStatement);
+ Expect(138);
+ if (la.kind == 209 || la.kind == 216) {
+ WhileOrUntil(
+#line 2835 "VBNET.ATG"
+out conditionType);
+ Expr(
+#line 2835 "VBNET.ATG"
+out expr);
+ }
+
+#line 2837 "VBNET.ATG"
+ statement = new DoLoopStatement(expr, embeddedStatement, conditionType, ConditionPosition.End);
+
+ } else SynErr(274);
+ } else if (la.kind == 111) {
+ lexer.NextToken();
+
+#line 2842 "VBNET.ATG"
+ Expression group = null;
+ TypeReference typeReference;
+ string typeName;
+ Location startLocation = t.Location;
+
+ if (la.kind == 97) {
+ lexer.NextToken();
+ LoopControlVariable(
+#line 2849 "VBNET.ATG"
+out typeReference, out typeName);
+ Expect(125);
+ Expr(
+#line 2850 "VBNET.ATG"
+out group);
+ EndOfStmt();
+ Block(
+#line 2851 "VBNET.ATG"
+out embeddedStatement);
+ Expect(149);
+ if (StartOf(29)) {
+ Expr(
+#line 2852 "VBNET.ATG"
+out expr);
+ }
+
+#line 2854 "VBNET.ATG"
+ statement = new ForeachStatement(typeReference,
+ typeName,
+ group,
+ embeddedStatement,
+ expr);
+ statement.StartLocation = startLocation;
+ statement.EndLocation = t.EndLocation;
+
+
+ } else if (StartOf(38)) {
+
+#line 2865 "VBNET.ATG"
+ Expression start = null;
+ Expression end = null;
+ Expression step = null;
+ Expression variableExpr = null;
+ Expression nextExpr = null;
+ List<Expression> nextExpressions = null;
+
+ if (
+#line 2872 "VBNET.ATG"
+IsLoopVariableDeclaration()) {
+ LoopControlVariable(
+#line 2873 "VBNET.ATG"
+out typeReference, out typeName);
+ } else {
+
+#line 2875 "VBNET.ATG"
+ typeReference = null; typeName = null;
+ SimpleExpr(
+#line 2876 "VBNET.ATG"
+out variableExpr);
+ }
+ Expect(10);
+ Expr(
+#line 2878 "VBNET.ATG"
+out start);
+ Expect(201);
+ Expr(
+#line 2878 "VBNET.ATG"
+out end);
+ if (la.kind == 190) {
+ lexer.NextToken();
+ Expr(
+#line 2878 "VBNET.ATG"
+out step);
+ }
+ EndOfStmt();
+ Block(
+#line 2879 "VBNET.ATG"
+out embeddedStatement);
+ Expect(149);
+ if (StartOf(29)) {
+ Expr(
+#line 2882 "VBNET.ATG"
+out nextExpr);
+
+#line 2884 "VBNET.ATG"
+ nextExpressions = new List<Expression>();
+ nextExpressions.Add(nextExpr);
+
+ while (la.kind == 12) {
+ lexer.NextToken();
+ Expr(
+#line 2887 "VBNET.ATG"
+out nextExpr);
+
+#line 2887 "VBNET.ATG"
+ nextExpressions.Add(nextExpr);
+ }
+ }
+
+#line 2890 "VBNET.ATG"
+ statement = new ForNextStatement {
+ TypeReference = typeReference,
+ VariableName = typeName,
+ LoopVariableExpression = variableExpr,
+ Start = start,
+ End = end,
+ Step = step,
+ EmbeddedStatement = embeddedStatement,
+ NextExpressions = nextExpressions
+ };
+
+ } else SynErr(275);
+ } else if (la.kind == 105) {
+ lexer.NextToken();
+ Expr(
+#line 2903 "VBNET.ATG"
+out expr);
+
+#line 2903 "VBNET.ATG"
+ statement = new ErrorStatement(expr);
+ } else if (la.kind == 176) {
+ lexer.NextToken();
+
+#line 2905 "VBNET.ATG"
+ bool isPreserve = false;
+ if (la.kind == 169) {
+ lexer.NextToken();
+
+#line 2905 "VBNET.ATG"
+ isPreserve = true;
+ }
+ ReDimClause(
+#line 2906 "VBNET.ATG"
+out expr);
+
+#line 2908 "VBNET.ATG"
+ ReDimStatement reDimStatement = new ReDimStatement(isPreserve);
+ statement = reDimStatement;
+ SafeAdd(reDimStatement, reDimStatement.ReDimClauses, expr as InvocationExpression);
+
+ while (la.kind == 12) {
+ lexer.NextToken();
+ ReDimClause(
+#line 2912 "VBNET.ATG"
+out expr);
+
+#line 2913 "VBNET.ATG"
+ SafeAdd(reDimStatement, reDimStatement.ReDimClauses, expr as InvocationExpression);
+ }
+ } else if (la.kind == 104) {
+ lexer.NextToken();
+ Expr(
+#line 2917 "VBNET.ATG"
+out expr);
+
+#line 2919 "VBNET.ATG"
+ EraseStatement eraseStatement = new EraseStatement();
+ if (expr != null) { SafeAdd(eraseStatement, eraseStatement.Expressions, expr);}
+
+ while (la.kind == 12) {
+ lexer.NextToken();
+ Expr(
+#line 2922 "VBNET.ATG"
+out expr);
+
+#line 2922 "VBNET.ATG"
+ if (expr != null) { SafeAdd(eraseStatement, eraseStatement.Expressions, expr); }
+ }
+
+#line 2923 "VBNET.ATG"
+ statement = eraseStatement;
+ } else if (la.kind == 191) {
+ lexer.NextToken();
+
+#line 2925 "VBNET.ATG"
+ statement = new StopStatement();
+ } else if (
+#line 2927 "VBNET.ATG"
+la.kind == Tokens.If) {
+ Expect(122);
+
+#line 2928 "VBNET.ATG"
+ Location ifStartLocation = t.Location;
+ Expr(
+#line 2928 "VBNET.ATG"
+out expr);
+ if (la.kind == 199) {
+ lexer.NextToken();
+ }
+ if (la.kind == 1 || la.kind == 11) {
+ EndOfStmt();
+ Block(
+#line 2931 "VBNET.ATG"
+out embeddedStatement);
+
+#line 2933 "VBNET.ATG"
+ IfElseStatement ifStatement = new IfElseStatement(expr, embeddedStatement);
+ ifStatement.StartLocation = ifStartLocation;
+ Location elseIfStart;
+
+ while (la.kind == 99 ||
+#line 2939 "VBNET.ATG"
+IsElseIf()) {
+ if (
+#line 2939 "VBNET.ATG"
+IsElseIf()) {
+ Expect(98);
+
+#line 2939 "VBNET.ATG"
+ elseIfStart = t.Location;
+ Expect(122);
+ } else {
+ lexer.NextToken();
+
+#line 2940 "VBNET.ATG"
+ elseIfStart = t.Location;
+ }
+
+#line 2942 "VBNET.ATG"
+ Expression condition = null; Statement block = null;
+ Expr(
+#line 2943 "VBNET.ATG"
+out condition);
+ if (la.kind == 199) {
+ lexer.NextToken();
+ }
+ EndOfStmt();
+ Block(
+#line 2944 "VBNET.ATG"
+out block);
+
+#line 2946 "VBNET.ATG"
+ ElseIfSection elseIfSection = new ElseIfSection(condition, block);
+ elseIfSection.StartLocation = elseIfStart;
+ elseIfSection.EndLocation = t.Location;
+ elseIfSection.Parent = ifStatement;
+ ifStatement.ElseIfSections.Add(elseIfSection);
+
+ }
+ if (la.kind == 98) {
+ lexer.NextToken();
+ EndOfStmt();
+ Block(
+#line 2955 "VBNET.ATG"
+out embeddedStatement);
+
+#line 2957 "VBNET.ATG"
+ ifStatement.FalseStatement.Add(embeddedStatement);
+
+ }
+ Expect(100);
+ Expect(122);
+
+#line 2961 "VBNET.ATG"
+ ifStatement.EndLocation = t.Location;
+ statement = ifStatement;
+
+ } else if (StartOf(39)) {
+
+#line 2966 "VBNET.ATG"
+ IfElseStatement ifStatement = new IfElseStatement(expr);
+ ifStatement.StartLocation = ifStartLocation;
+
+ SingleLineStatementList(
+#line 2969 "VBNET.ATG"
+ifStatement.TrueStatement);
+ if (la.kind == 98) {
+ lexer.NextToken();
+ if (StartOf(39)) {
+ SingleLineStatementList(
+#line 2972 "VBNET.ATG"
+ifStatement.FalseStatement);
+ }
+ }
+
+#line 2974 "VBNET.ATG"
+ ifStatement.EndLocation = t.Location; statement = ifStatement;
+ } else SynErr(276);
+ } else if (la.kind == 182) {
+ lexer.NextToken();
+ if (la.kind == 61) {
+ lexer.NextToken();
+ }
+ Expr(
+#line 2977 "VBNET.ATG"
+out expr);
+ EndOfStmt();
+
+#line 2978 "VBNET.ATG"
+ List<SwitchSection> selectSections = new List<SwitchSection>();
+ Statement block = null;
+
+ while (la.kind == 61) {
+
+#line 2982 "VBNET.ATG"
+ List<CaseLabel> caseClauses = null; Location caseLocation = la.Location;
+ lexer.NextToken();
+ CaseClauses(
+#line 2983 "VBNET.ATG"
+out caseClauses);
+ if (
+#line 2983 "VBNET.ATG"
+IsNotStatementSeparator()) {
+ lexer.NextToken();
+ }
+ EndOfStmt();
+
+#line 2985 "VBNET.ATG"
+ SwitchSection selectSection = new SwitchSection(caseClauses);
+ selectSection.StartLocation = caseLocation;
+
+ Block(
+#line 2988 "VBNET.ATG"
+out block);
+
+#line 2990 "VBNET.ATG"
+ selectSection.Children = block.Children;
+ selectSection.EndLocation = t.EndLocation;
+ selectSections.Add(selectSection);
+
+ }
+
+#line 2996 "VBNET.ATG"
+ statement = new SwitchStatement(expr, selectSections);
+
+ Expect(100);
+ Expect(182);
+ } else if (la.kind == 157) {
+
+#line 2999 "VBNET.ATG"
+ OnErrorStatement onErrorStatement = null;
+ OnErrorStatement(
+#line 3000 "VBNET.ATG"
+out onErrorStatement);
+
+#line 3000 "VBNET.ATG"
+ statement = onErrorStatement;
+ } else if (la.kind == 119) {
+
+#line 3001 "VBNET.ATG"
+ GotoStatement goToStatement = null;
+ GotoStatement(
+#line 3002 "VBNET.ATG"
+out goToStatement);
+
+#line 3002 "VBNET.ATG"
+ statement = goToStatement;
+ } else if (la.kind == 179) {
+
+#line 3003 "VBNET.ATG"
+ ResumeStatement resumeStatement = null;
+ ResumeStatement(
+#line 3004 "VBNET.ATG"
+out resumeStatement);
+
+#line 3004 "VBNET.ATG"
+ statement = resumeStatement;
+ } else if (StartOf(38)) {
+
+#line 3007 "VBNET.ATG"
+ Expression val = null;
+ AssignmentOperatorType op;
+
+ bool mustBeAssignment = la.kind == Tokens.Plus || la.kind == Tokens.Minus ||
+ la.kind == Tokens.Not || la.kind == Tokens.Times;
+
+ SimpleExpr(
+#line 3013 "VBNET.ATG"
+out expr);
+ if (StartOf(40)) {
+ AssignmentOperator(
+#line 3015 "VBNET.ATG"
+out op);
+ Expr(
+#line 3015 "VBNET.ATG"
+out val);
+
+#line 3015 "VBNET.ATG"
+ expr = new AssignmentExpression(expr, op, val);
+ } else if (la.kind == 1 || la.kind == 11 || la.kind == 98) {
+
+#line 3016 "VBNET.ATG"
+ if (mustBeAssignment) Error("error in assignment.");
+ } else SynErr(277);
+
+#line 3019 "VBNET.ATG"
+ // a field reference expression that stands alone is a
+ // invocation expression without parantheses and arguments
+ if(expr is MemberReferenceExpression || expr is IdentifierExpression) {
+ expr = new InvocationExpression(expr);
+ }
+ statement = new ExpressionStatement(expr);
+
+ } else if (la.kind == 60) {
+ lexer.NextToken();
+ SimpleExpr(
+#line 3026 "VBNET.ATG"
+out expr);
+
+#line 3026 "VBNET.ATG"
+ statement = new ExpressionStatement(expr);
+ } else if (la.kind == 211) {
+ lexer.NextToken();
+
+#line 3028 "VBNET.ATG"
+ Statement block;
+ if (
+#line 3029 "VBNET.ATG"
+Peek(1).kind == Tokens.As) {
+
+#line 3030 "VBNET.ATG"
+ LocalVariableDeclaration resourceAquisition = new LocalVariableDeclaration(Modifiers.None);
+ VariableDeclarator(
+#line 3031 "VBNET.ATG"
+resourceAquisition.Variables);
+ while (la.kind == 12) {
+ lexer.NextToken();
+ VariableDeclarator(
+#line 3033 "VBNET.ATG"
+resourceAquisition.Variables);
+ }
+ Block(
+#line 3035 "VBNET.ATG"
+out block);
+
+#line 3037 "VBNET.ATG"
+ statement = new UsingStatement(resourceAquisition, block);
+
+ } else if (StartOf(29)) {
+ Expr(
+#line 3039 "VBNET.ATG"
+out expr);
+ Block(
+#line 3040 "VBNET.ATG"
+out block);
+
+#line 3041 "VBNET.ATG"
+ statement = new UsingStatement(new ExpressionStatement(expr), block);
+ } else SynErr(278);
+ Expect(100);
+ Expect(211);
+ } else if (StartOf(41)) {
+ LocalDeclarationStatement(
+#line 3044 "VBNET.ATG"
+out statement);
+ } else SynErr(279);
+ }
+
+ void LocalDeclarationStatement(
+#line 2724 "VBNET.ATG"
+out Statement statement) {
+
+#line 2726 "VBNET.ATG"
+ ModifierList m = new ModifierList();
+ LocalVariableDeclaration localVariableDeclaration;
+ bool dimfound = false;
+
+ while (la.kind == 75 || la.kind == 92 || la.kind == 189) {
+ if (la.kind == 75) {
+ lexer.NextToken();
+
+#line 2732 "VBNET.ATG"
+ m.Add(Modifiers.Const, t.Location);
+ } else if (la.kind == 189) {
+ lexer.NextToken();
+
+#line 2733 "VBNET.ATG"
+ m.Add(Modifiers.Static, t.Location);
+ } else {
+ lexer.NextToken();
+
+#line 2734 "VBNET.ATG"
+ dimfound = true;
+ }
+ }
+
+#line 2737 "VBNET.ATG"
+ if(dimfound && (m.Modifier & Modifiers.Const) != 0) {
+ Error("Dim is not allowed on constants.");
+ }
+
+ if(m.isNone && dimfound == false) {
+ Error("Const, Dim or Static expected");
+ }
+
+ localVariableDeclaration = new LocalVariableDeclaration(m.Modifier);
+ localVariableDeclaration.StartLocation = t.Location;
+
+ VariableDeclarator(
+#line 2748 "VBNET.ATG"
+localVariableDeclaration.Variables);
+ while (la.kind == 12) {
+ lexer.NextToken();
+ VariableDeclarator(
+#line 2749 "VBNET.ATG"
+localVariableDeclaration.Variables);
+ }
+
+#line 2751 "VBNET.ATG"
+ statement = localVariableDeclaration;
+
+ }
+
+ void TryStatement(
+#line 3245 "VBNET.ATG"
+out Statement tryStatement) {
+
+#line 3247 "VBNET.ATG"
+ Statement blockStmt = null, finallyStmt = null;List<CatchClause> catchClauses = null;
+
+ Expect(203);
+ EndOfStmt();
+ Block(
+#line 3250 "VBNET.ATG"
+out blockStmt);
+ if (la.kind == 62 || la.kind == 100 || la.kind == 110) {
+ CatchClauses(
+#line 3251 "VBNET.ATG"
+out catchClauses);
+ }
+ if (la.kind == 110) {
+ lexer.NextToken();
+ EndOfStmt();
+ Block(
+#line 3252 "VBNET.ATG"
+out finallyStmt);
+ }
+ Expect(100);
+ Expect(203);
+
+#line 3255 "VBNET.ATG"
+ tryStatement = new TryCatchStatement(blockStmt, catchClauses, finallyStmt);
+
+ }
+
+ void WithStatement(
+#line 3225 "VBNET.ATG"
+out Statement withStatement) {
+
+#line 3227 "VBNET.ATG"
+ Statement blockStmt = null;
+ Expression expr = null;
+
+ Expect(218);
+
+#line 3230 "VBNET.ATG"
+ Location start = t.Location;
+ Expr(
+#line 3231 "VBNET.ATG"
+out expr);
+ EndOfStmt();
+
+#line 3233 "VBNET.ATG"
+ withStatement = new WithStatement(expr);
+ withStatement.StartLocation = start;
+
+ Block(
+#line 3236 "VBNET.ATG"
+out blockStmt);
+
+#line 3238 "VBNET.ATG"
+ ((WithStatement)withStatement).Body = (BlockStatement)blockStmt;
+
+ Expect(100);
+ Expect(218);
+
+#line 3241 "VBNET.ATG"
+ withStatement.EndLocation = t.Location;
+ }
+
+ void WhileOrUntil(
+#line 3218 "VBNET.ATG"
+out ConditionType conditionType) {
+
+#line 3219 "VBNET.ATG"
+ conditionType = ConditionType.None;
+ if (la.kind == 216) {
+ lexer.NextToken();
+
+#line 3220 "VBNET.ATG"
+ conditionType = ConditionType.While;
+ } else if (la.kind == 209) {
+ lexer.NextToken();
+
+#line 3221 "VBNET.ATG"
+ conditionType = ConditionType.Until;
+ } else SynErr(280);
+ }
+
+ void LoopControlVariable(
+#line 3061 "VBNET.ATG"
+out TypeReference type, out string name) {
+
+#line 3062 "VBNET.ATG"
+ ArrayList arrayModifiers = null;
+ type = null;
+
+ Qualident(
+#line 3066 "VBNET.ATG"
+out name);
+ if (
+#line 3067 "VBNET.ATG"
+IsDims()) {
+ ArrayTypeModifiers(
+#line 3067 "VBNET.ATG"
+out arrayModifiers);
+ }
+ if (la.kind == 50) {
+ lexer.NextToken();
+ TypeName(
+#line 3068 "VBNET.ATG"
+out type);
+
+#line 3068 "VBNET.ATG"
+ if (name.IndexOf('.') > 0) { Error("No type def for 'for each' member indexer allowed."); }
+ }
+
+#line 3070 "VBNET.ATG"
+ if (type != null) {
+ if(type.RankSpecifier != null && arrayModifiers != null) {
+ Error("array rank only allowed one time");
+ } else if (arrayModifiers != null) {
+ type.RankSpecifier = (int[])arrayModifiers.ToArray(typeof(int));
+ }
+ }
+
+ }
+
+ void ReDimClause(
+#line 3140 "VBNET.ATG"
+out Expression expr) {
+ SimpleNonInvocationExpression(
+#line 3142 "VBNET.ATG"
+out expr);
+ ReDimClauseInternal(
+#line 3143 "VBNET.ATG"
+ref expr);
+ }
+
+ void SingleLineStatementList(
+#line 3047 "VBNET.ATG"
+List<Statement> list) {
+
+#line 3048 "VBNET.ATG"
+ Statement embeddedStatement = null;
+ if (la.kind == 100) {
+ lexer.NextToken();
+
+#line 3050 "VBNET.ATG"
+ embeddedStatement = new EndStatement();
+ } else if (StartOf(36)) {
+ EmbeddedStatement(
+#line 3051 "VBNET.ATG"
+out embeddedStatement);
+ } else SynErr(281);
+
+#line 3052 "VBNET.ATG"
+ if (embeddedStatement != null) list.Add(embeddedStatement);
+ while (la.kind == 11) {
+ lexer.NextToken();
+ while (la.kind == 11) {
+ lexer.NextToken();
+ }
+ if (la.kind == 100) {
+ lexer.NextToken();
+
+#line 3054 "VBNET.ATG"
+ embeddedStatement = new EndStatement();
+ } else if (StartOf(36)) {
+ EmbeddedStatement(
+#line 3055 "VBNET.ATG"
+out embeddedStatement);
+ } else SynErr(282);
+
+#line 3056 "VBNET.ATG"
+ if (embeddedStatement != null) list.Add(embeddedStatement);
+ }
+ }
+
+ void CaseClauses(
+#line 3178 "VBNET.ATG"
+out List<CaseLabel> caseClauses) {
+
+#line 3180 "VBNET.ATG"
+ caseClauses = new List<CaseLabel>();
+ CaseLabel caseClause = null;
+
+ CaseClause(
+#line 3183 "VBNET.ATG"
+out caseClause);
+
+#line 3183 "VBNET.ATG"
+ if (caseClause != null) { caseClauses.Add(caseClause); }
+ while (la.kind == 12) {
+ lexer.NextToken();
+ CaseClause(
+#line 3184 "VBNET.ATG"
+out caseClause);
+
+#line 3184 "VBNET.ATG"
+ if (caseClause != null) { caseClauses.Add(caseClause); }
+ }
+ }
+
+ void OnErrorStatement(
+#line 3081 "VBNET.ATG"
+out OnErrorStatement stmt) {
+
+#line 3083 "VBNET.ATG"
+ stmt = null;
+ GotoStatement goToStatement = null;
+
+ Expect(157);
+ Expect(105);
+ if (
+#line 3089 "VBNET.ATG"
+IsNegativeLabelName()) {
+ Expect(119);
+ Expect(18);
+ Expect(5);
+
+#line 3091 "VBNET.ATG"
+ long intLabel = Int64.Parse(t.val);
+ if(intLabel != 1) {
+ Error("invalid label in on error statement.");
+ }
+ stmt = new OnErrorStatement(new GotoStatement((intLabel * -1).ToString()));
+
+ } else if (la.kind == 119) {
+ GotoStatement(
+#line 3097 "VBNET.ATG"
+out goToStatement);
+
+#line 3099 "VBNET.ATG"
+ string val = goToStatement.Label;
+
+ // if value is numeric, make sure that is 0
+ try {
+ long intLabel = Int64.Parse(val);
+ if(intLabel != 0) {
+ Error("invalid label in on error statement.");
+ }
+ } catch {
+ }
+ stmt = new OnErrorStatement(goToStatement);
+
+ } else if (la.kind == 179) {
+ lexer.NextToken();
+ Expect(149);
+
+#line 3113 "VBNET.ATG"
+ stmt = new OnErrorStatement(new ResumeStatement(true));
+
+ } else SynErr(283);
+ }
+
+ void GotoStatement(
+#line 3119 "VBNET.ATG"
+out GotoStatement goToStatement) {
+
+#line 3121 "VBNET.ATG"
+ string label = String.Empty;
+
+ Expect(119);
+ LabelName(
+#line 3124 "VBNET.ATG"
+out label);
+
+#line 3126 "VBNET.ATG"
+ goToStatement = new GotoStatement(label);
+
+ }
+
+ void ResumeStatement(
+#line 3167 "VBNET.ATG"
+out ResumeStatement resumeStatement) {
+
+#line 3169 "VBNET.ATG"
+ resumeStatement = null;
+ string label = String.Empty;
+
+ if (
+#line 3172 "VBNET.ATG"
+IsResumeNext()) {
+ Expect(179);
+ Expect(149);
+
+#line 3173 "VBNET.ATG"
+ resumeStatement = new ResumeStatement(true);
+ } else if (la.kind == 179) {
+ lexer.NextToken();
+ if (StartOf(42)) {
+ LabelName(
+#line 3174 "VBNET.ATG"
+out label);
+ }
+
+#line 3174 "VBNET.ATG"
+ resumeStatement = new ResumeStatement(label);
+ } else SynErr(284);
+ }
+
+ void ReDimClauseInternal(
+#line 3146 "VBNET.ATG"
+ref Expression expr) {
+
+#line 3147 "VBNET.ATG"
+ List<Expression> arguments; bool canBeNormal; bool canBeRedim; string name;
+ while (la.kind == 16 ||
+#line 3150 "VBNET.ATG"
+la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of) {
+ if (la.kind == 16) {
+ lexer.NextToken();
+ IdentifierOrKeyword(
+#line 3149 "VBNET.ATG"
+out name);
+
+#line 3149 "VBNET.ATG"
+ expr = new MemberReferenceExpression(expr, name);
+ } else {
+ InvocationExpression(
+#line 3151 "VBNET.ATG"
+ref expr);
+ }
+ }
+ Expect(25);
+ NormalOrReDimArgumentList(
+#line 3154 "VBNET.ATG"
+out arguments, out canBeNormal, out canBeRedim);
+ Expect(26);
+
+#line 3156 "VBNET.ATG"
+ expr = new InvocationExpression(expr, arguments);
+ if (canBeRedim == false || canBeNormal && (la.kind == Tokens.Dot || la.kind == Tokens.OpenParenthesis)) {
+ if (this.Errors.Count == 0) {
+ // don't recurse on parse errors - could result in endless recursion
+ ReDimClauseInternal(ref expr);
+ }
+ }
+
+ }
+
+ void CaseClause(
+#line 3188 "VBNET.ATG"
+out CaseLabel caseClause) {
+
+#line 3190 "VBNET.ATG"
+ Expression expr = null;
+ Expression sexpr = null;
+ BinaryOperatorType op = BinaryOperatorType.None;
+ caseClause = null;
+
+ if (la.kind == 98) {
+ lexer.NextToken();
+
+#line 3196 "VBNET.ATG"
+ caseClause = new CaseLabel();
+ } else if (StartOf(43)) {
+ if (la.kind == 131) {
+ lexer.NextToken();
+ }
+ switch (la.kind) {
+ case 28: {
+ lexer.NextToken();
+
+#line 3200 "VBNET.ATG"
+ op = BinaryOperatorType.LessThan;
+ break;
+ }
+ case 27: {
+ lexer.NextToken();
+
+#line 3201 "VBNET.ATG"
+ op = BinaryOperatorType.GreaterThan;
+ break;
+ }
+ case 31: {
+ lexer.NextToken();
+
+#line 3202 "VBNET.ATG"
+ op = BinaryOperatorType.LessThanOrEqual;
+ break;
+ }
+ case 30: {
+ lexer.NextToken();
+
+#line 3203 "VBNET.ATG"
+ op = BinaryOperatorType.GreaterThanOrEqual;
+ break;
+ }
+ case 10: {
+ lexer.NextToken();
+
+#line 3204 "VBNET.ATG"
+ op = BinaryOperatorType.Equality;
+ break;
+ }
+ case 29: {
+ lexer.NextToken();
+
+#line 3205 "VBNET.ATG"
+ op = BinaryOperatorType.InEquality;
+ break;
+ }
+ default: SynErr(285); break;
+ }
+ Expr(
+#line 3207 "VBNET.ATG"
+out expr);
+
+#line 3209 "VBNET.ATG"
+ caseClause = new CaseLabel(op, expr);
+
+ } else if (StartOf(29)) {
+ Expr(
+#line 3211 "VBNET.ATG"
+out expr);
+ if (la.kind == 201) {
+ lexer.NextToken();
+ Expr(
+#line 3211 "VBNET.ATG"
+out sexpr);
+ }
+
+#line 3213 "VBNET.ATG"
+ caseClause = new CaseLabel(expr, sexpr);
+
+ } else SynErr(286);
+ }
+
+ void CatchClauses(
+#line 3260 "VBNET.ATG"
+out List<CatchClause> catchClauses) {
+
+#line 3262 "VBNET.ATG"
+ catchClauses = new List<CatchClause>();
+ TypeReference type = null;
+ Statement blockStmt = null;
+ Expression expr = null;
+ string name = String.Empty;
+
+ while (la.kind == 62) {
+ lexer.NextToken();
+ if (StartOf(14)) {
+ Identifier();
+
+#line 3270 "VBNET.ATG"
+ name = t.val;
+ if (la.kind == 50) {
+ lexer.NextToken();
+ TypeName(
+#line 3270 "VBNET.ATG"
+out type);
+ }
+ }
+ if (la.kind == 214) {
+ lexer.NextToken();
+ Expr(
+#line 3271 "VBNET.ATG"
+out expr);
+ }
+ EndOfStmt();
+ Block(
+#line 3273 "VBNET.ATG"
+out blockStmt);
+
+#line 3274 "VBNET.ATG"
+ catchClauses.Add(new CatchClause(type, name, blockStmt, expr));
+ }
+ }
+
+
+
+ void ParseRoot()
+ {
+ VBNET();
+
+ }
+
+ protected override void SynErr(int line, int col, int errorNumber)
+ {
+ string s;
+ switch (errorNumber) {
+ case 0: s = "EOF expected"; break;
+ case 1: s = "EOL expected"; break;
+ case 2: s = "ident expected"; break;
+ case 3: s = "LiteralString expected"; break;
+ case 4: s = "LiteralCharacter expected"; break;
+ case 5: s = "LiteralInteger expected"; break;
+ case 6: s = "LiteralDouble expected"; break;
+ case 7: s = "LiteralSingle expected"; break;
+ case 8: s = "LiteralDecimal expected"; break;
+ case 9: s = "LiteralDate expected"; break;
+ case 10: s = "\"=\" expected"; break;
+ case 11: s = "\":\" expected"; break;
+ case 12: s = "\",\" expected"; break;
+ case 13: s = "\"&\" expected"; break;
+ case 14: s = "\"/\" expected"; break;
+ case 15: s = "\"\\\\\" expected"; break;
+ case 16: s = "\".\" expected"; break;
+ case 17: s = "\"!\" expected"; break;
+ case 18: s = "\"-\" expected"; break;
+ case 19: s = "\"+\" expected"; break;
+ case 20: s = "\"^\" expected"; break;
+ case 21: s = "\"?\" expected"; break;
+ case 22: s = "\"*\" expected"; break;
+ case 23: s = "\"{\" expected"; break;
+ case 24: s = "\"}\" expected"; break;
+ case 25: s = "\"(\" expected"; break;
+ case 26: s = "\")\" expected"; break;
+ case 27: s = "\">\" expected"; break;
+ case 28: s = "\"<\" expected"; break;
+ case 29: s = "\"<>\" expected"; break;
+ case 30: s = "\">=\" expected"; break;
+ case 31: s = "\"<=\" expected"; break;
+ case 32: s = "\"<<\" expected"; break;
+ case 33: s = "\">>\" expected"; break;
+ case 34: s = "\"+=\" expected"; break;
+ case 35: s = "\"^=\" expected"; break;
+ case 36: s = "\"-=\" expected"; break;
+ case 37: s = "\"*=\" expected"; break;
+ case 38: s = "\"/=\" expected"; break;
+ case 39: s = "\"\\\\=\" expected"; break;
+ case 40: s = "\"<<=\" expected"; break;
+ case 41: s = "\">>=\" expected"; break;
+ case 42: s = "\"&=\" expected"; break;
+ case 43: s = "\"AddHandler\" expected"; break;
+ case 44: s = "\"AddressOf\" expected"; break;
+ case 45: s = "\"Aggregate\" expected"; break;
+ case 46: s = "\"Alias\" expected"; break;
+ case 47: s = "\"And\" expected"; break;
+ case 48: s = "\"AndAlso\" expected"; break;
+ case 49: s = "\"Ansi\" expected"; break;
+ case 50: s = "\"As\" expected"; break;
+ case 51: s = "\"Ascending\" expected"; break;
+ case 52: s = "\"Assembly\" expected"; break;
+ case 53: s = "\"Auto\" expected"; break;
+ case 54: s = "\"Binary\" expected"; break;
+ case 55: s = "\"Boolean\" expected"; break;
+ case 56: s = "\"ByRef\" expected"; break;
+ case 57: s = "\"By\" expected"; break;
+ case 58: s = "\"Byte\" expected"; break;
+ case 59: s = "\"ByVal\" expected"; break;
+ case 60: s = "\"Call\" expected"; break;
+ case 61: s = "\"Case\" expected"; break;
+ case 62: s = "\"Catch\" expected"; break;
+ case 63: s = "\"CBool\" expected"; break;
+ case 64: s = "\"CByte\" expected"; break;
+ case 65: s = "\"CChar\" expected"; break;
+ case 66: s = "\"CDate\" expected"; break;
+ case 67: s = "\"CDbl\" expected"; break;
+ case 68: s = "\"CDec\" expected"; break;
+ case 69: s = "\"Char\" expected"; break;
+ case 70: s = "\"CInt\" expected"; break;
+ case 71: s = "\"Class\" expected"; break;
+ case 72: s = "\"CLng\" expected"; break;
+ case 73: s = "\"CObj\" expected"; break;
+ case 74: s = "\"Compare\" expected"; break;
+ case 75: s = "\"Const\" expected"; break;
+ case 76: s = "\"Continue\" expected"; break;
+ case 77: s = "\"CSByte\" expected"; break;
+ case 78: s = "\"CShort\" expected"; break;
+ case 79: s = "\"CSng\" expected"; break;
+ case 80: s = "\"CStr\" expected"; break;
+ case 81: s = "\"CType\" expected"; break;
+ case 82: s = "\"CUInt\" expected"; break;
+ case 83: s = "\"CULng\" expected"; break;
+ case 84: s = "\"CUShort\" expected"; break;
+ case 85: s = "\"Custom\" expected"; break;
+ case 86: s = "\"Date\" expected"; break;
+ case 87: s = "\"Decimal\" expected"; break;
+ case 88: s = "\"Declare\" expected"; break;
+ case 89: s = "\"Default\" expected"; break;
+ case 90: s = "\"Delegate\" expected"; break;
+ case 91: s = "\"Descending\" expected"; break;
+ case 92: s = "\"Dim\" expected"; break;
+ case 93: s = "\"DirectCast\" expected"; break;
+ case 94: s = "\"Distinct\" expected"; break;
+ case 95: s = "\"Do\" expected"; break;
+ case 96: s = "\"Double\" expected"; break;
+ case 97: s = "\"Each\" expected"; break;
+ case 98: s = "\"Else\" expected"; break;
+ case 99: s = "\"ElseIf\" expected"; break;
+ case 100: s = "\"End\" expected"; break;
+ case 101: s = "\"EndIf\" expected"; break;
+ case 102: s = "\"Enum\" expected"; break;
+ case 103: s = "\"Equals\" expected"; break;
+ case 104: s = "\"Erase\" expected"; break;
+ case 105: s = "\"Error\" expected"; break;
+ case 106: s = "\"Event\" expected"; break;
+ case 107: s = "\"Exit\" expected"; break;
+ case 108: s = "\"Explicit\" expected"; break;
+ case 109: s = "\"False\" expected"; break;
+ case 110: s = "\"Finally\" expected"; break;
+ case 111: s = "\"For\" expected"; break;
+ case 112: s = "\"Friend\" expected"; break;
+ case 113: s = "\"From\" expected"; break;
+ case 114: s = "\"Function\" expected"; break;
+ case 115: s = "\"Get\" expected"; break;
+ case 116: s = "\"GetType\" expected"; break;
+ case 117: s = "\"Global\" expected"; break;
+ case 118: s = "\"GoSub\" expected"; break;
+ case 119: s = "\"GoTo\" expected"; break;
+ case 120: s = "\"Group\" expected"; break;
+ case 121: s = "\"Handles\" expected"; break;
+ case 122: s = "\"If\" expected"; break;
+ case 123: s = "\"Implements\" expected"; break;
+ case 124: s = "\"Imports\" expected"; break;
+ case 125: s = "\"In\" expected"; break;
+ case 126: s = "\"Infer\" expected"; break;
+ case 127: s = "\"Inherits\" expected"; break;
+ case 128: s = "\"Integer\" expected"; break;
+ case 129: s = "\"Interface\" expected"; break;
+ case 130: s = "\"Into\" expected"; break;
+ case 131: s = "\"Is\" expected"; break;
+ case 132: s = "\"IsNot\" expected"; break;
+ case 133: s = "\"Join\" expected"; break;
+ case 134: s = "\"Let\" expected"; break;
+ case 135: s = "\"Lib\" expected"; break;
+ case 136: s = "\"Like\" expected"; break;
+ case 137: s = "\"Long\" expected"; break;
+ case 138: s = "\"Loop\" expected"; break;
+ case 139: s = "\"Me\" expected"; break;
+ case 140: s = "\"Mod\" expected"; break;
+ case 141: s = "\"Module\" expected"; break;
+ case 142: s = "\"MustInherit\" expected"; break;
+ case 143: s = "\"MustOverride\" expected"; break;
+ case 144: s = "\"MyBase\" expected"; break;
+ case 145: s = "\"MyClass\" expected"; break;
+ case 146: s = "\"Namespace\" expected"; break;
+ case 147: s = "\"Narrowing\" expected"; break;
+ case 148: s = "\"New\" expected"; break;
+ case 149: s = "\"Next\" expected"; break;
+ case 150: s = "\"Not\" expected"; break;
+ case 151: s = "\"Nothing\" expected"; break;
+ case 152: s = "\"NotInheritable\" expected"; break;
+ case 153: s = "\"NotOverridable\" expected"; break;
+ case 154: s = "\"Object\" expected"; break;
+ case 155: s = "\"Of\" expected"; break;
+ case 156: s = "\"Off\" expected"; break;
+ case 157: s = "\"On\" expected"; break;
+ case 158: s = "\"Operator\" expected"; break;
+ case 159: s = "\"Option\" expected"; break;
+ case 160: s = "\"Optional\" expected"; break;
+ case 161: s = "\"Or\" expected"; break;
+ case 162: s = "\"Order\" expected"; break;
+ case 163: s = "\"OrElse\" expected"; break;
+ case 164: s = "\"Overloads\" expected"; break;
+ case 165: s = "\"Overridable\" expected"; break;
+ case 166: s = "\"Overrides\" expected"; break;
+ case 167: s = "\"ParamArray\" expected"; break;
+ case 168: s = "\"Partial\" expected"; break;
+ case 169: s = "\"Preserve\" expected"; break;
+ case 170: s = "\"Private\" expected"; break;
+ case 171: s = "\"Property\" expected"; break;
+ case 172: s = "\"Protected\" expected"; break;
+ case 173: s = "\"Public\" expected"; break;
+ case 174: s = "\"RaiseEvent\" expected"; break;
+ case 175: s = "\"ReadOnly\" expected"; break;
+ case 176: s = "\"ReDim\" expected"; break;
+ case 177: s = "\"Rem\" expected"; break;
+ case 178: s = "\"RemoveHandler\" expected"; break;
+ case 179: s = "\"Resume\" expected"; break;
+ case 180: s = "\"Return\" expected"; break;
+ case 181: s = "\"SByte\" expected"; break;
+ case 182: s = "\"Select\" expected"; break;
+ case 183: s = "\"Set\" expected"; break;
+ case 184: s = "\"Shadows\" expected"; break;
+ case 185: s = "\"Shared\" expected"; break;
+ case 186: s = "\"Short\" expected"; break;
+ case 187: s = "\"Single\" expected"; break;
+ case 188: s = "\"Skip\" expected"; break;
+ case 189: s = "\"Static\" expected"; break;
+ case 190: s = "\"Step\" expected"; break;
+ case 191: s = "\"Stop\" expected"; break;
+ case 192: s = "\"Strict\" expected"; break;
+ case 193: s = "\"String\" expected"; break;
+ case 194: s = "\"Structure\" expected"; break;
+ case 195: s = "\"Sub\" expected"; break;
+ case 196: s = "\"SyncLock\" expected"; break;
+ case 197: s = "\"Take\" expected"; break;
+ case 198: s = "\"Text\" expected"; break;
+ case 199: s = "\"Then\" expected"; break;
+ case 200: s = "\"Throw\" expected"; break;
+ case 201: s = "\"To\" expected"; break;
+ case 202: s = "\"True\" expected"; break;
+ case 203: s = "\"Try\" expected"; break;
+ case 204: s = "\"TryCast\" expected"; break;
+ case 205: s = "\"TypeOf\" expected"; break;
+ case 206: s = "\"UInteger\" expected"; break;
+ case 207: s = "\"ULong\" expected"; break;
+ case 208: s = "\"Unicode\" expected"; break;
+ case 209: s = "\"Until\" expected"; break;
+ case 210: s = "\"UShort\" expected"; break;
+ case 211: s = "\"Using\" expected"; break;
+ case 212: s = "\"Variant\" expected"; break;
+ case 213: s = "\"Wend\" expected"; break;
+ case 214: s = "\"When\" expected"; break;
+ case 215: s = "\"Where\" expected"; break;
+ case 216: s = "\"While\" expected"; break;
+ case 217: s = "\"Widening\" expected"; break;
+ case 218: s = "\"With\" expected"; break;
+ case 219: s = "\"WithEvents\" expected"; break;
+ case 220: s = "\"WriteOnly\" expected"; break;
+ case 221: s = "\"Xor\" expected"; break;
+ case 222: s = "??? expected"; break;
+ case 223: s = "invalid EndOfStmt"; break;
+ case 224: s = "invalid OptionStmt"; break;
+ case 225: s = "invalid OptionStmt"; break;
+ case 226: s = "invalid GlobalAttributeSection"; break;
+ case 227: s = "invalid GlobalAttributeSection"; break;
+ case 228: s = "invalid NamespaceMemberDecl"; break;
+ case 229: s = "invalid OptionValue"; break;
+ case 230: s = "invalid TypeModifier"; break;
+ case 231: s = "invalid NonModuleDeclaration"; break;
+ case 232: s = "invalid NonModuleDeclaration"; break;
+ case 233: s = "invalid Identifier"; break;
+ case 234: s = "invalid TypeParameterConstraints"; break;
+ case 235: s = "invalid TypeParameterConstraint"; break;
+ case 236: s = "invalid NonArrayTypeName"; break;
+ case 237: s = "invalid MemberModifier"; break;
+ case 238: s = "invalid StructureMemberDecl"; break;
+ case 239: s = "invalid StructureMemberDecl"; break;
+ case 240: s = "invalid StructureMemberDecl"; break;
+ case 241: s = "invalid StructureMemberDecl"; break;
+ case 242: s = "invalid StructureMemberDecl"; break;
+ case 243: s = "invalid StructureMemberDecl"; break;
+ case 244: s = "invalid StructureMemberDecl"; break;
+ case 245: s = "invalid InterfaceMemberDecl"; break;
+ case 246: s = "invalid InterfaceMemberDecl"; break;
+ case 247: s = "invalid Expr"; break;
+ case 248: s = "invalid Charset"; break;
+ case 249: s = "invalid IdentifierForFieldDeclaration"; break;
+ case 250: s = "invalid VariableDeclaratorPartAfterIdentifier"; break;
+ case 251: s = "invalid AccessorDecls"; break;
+ case 252: s = "invalid EventAccessorDeclaration"; break;
+ case 253: s = "invalid OverloadableOperator"; break;
+ case 254: s = "invalid VariableInitializer"; break;
+ case 255: s = "invalid EventMemberSpecifier"; break;
+ case 256: s = "invalid AssignmentOperator"; break;
+ case 257: s = "invalid SimpleNonInvocationExpression"; break;
+ case 258: s = "invalid SimpleNonInvocationExpression"; break;
+ case 259: s = "invalid SimpleNonInvocationExpression"; break;
+ case 260: s = "invalid SimpleNonInvocationExpression"; break;
+ case 261: s = "invalid PrimitiveTypeName"; break;
+ case 262: s = "invalid CastTarget"; break;
+ case 263: s = "invalid ComparisonExpr"; break;
+ case 264: s = "invalid FromOrAggregateQueryOperator"; break;
+ case 265: s = "invalid QueryOperator"; break;
+ case 266: s = "invalid PartitionQueryOperator"; break;
+ case 267: s = "invalid Argument"; break;
+ case 268: s = "invalid QualIdentAndTypeArguments"; break;
+ case 269: s = "invalid AttributeArguments"; break;
+ case 270: s = "invalid ParameterModifier"; break;
+ case 271: s = "invalid Statement"; break;
+ case 272: s = "invalid LabelName"; break;
+ case 273: s = "invalid EmbeddedStatement"; break;
+ case 274: s = "invalid EmbeddedStatement"; break;
+ case 275: s = "invalid EmbeddedStatement"; break;
+ case 276: s = "invalid EmbeddedStatement"; break;
+ case 277: s = "invalid EmbeddedStatement"; break;
+ case 278: s = "invalid EmbeddedStatement"; break;
+ case 279: s = "invalid EmbeddedStatement"; break;
+ case 280: s = "invalid WhileOrUntil"; break;
+ case 281: s = "invalid SingleLineStatementList"; break;
+ case 282: s = "invalid SingleLineStatementList"; break;
+ case 283: s = "invalid OnErrorStatement"; break;
+ case 284: s = "invalid ResumeStatement"; break;
+ case 285: s = "invalid CaseClause"; break;
+ case 286: s = "invalid CaseClause"; break;
+
+ default: s = "error " + errorNumber; break;
+ }
+ this.Errors.Error(line, col, s);
+ }
+
+ private bool StartOf(int s)
+ {
+ return set[s, lexer.LookAhead.kind];
+ }
+
+ static bool[,] set = {
+ {T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x},
+ {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,T,T,x, x,x,T,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,T,x, T,T,x,x, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x},
+ {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,T,T,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,T,x, T,T,x,x, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x},
+ {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,T,x, T,T,x,x, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x},
+ {x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,T,x,T, T,T,T,x, T,T,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,T, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, T,x,x,x, x,T,x,x, x,x,x,x, T,x,x,x, x,x,T,x, x,x,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, T,x,T,x, x,x,x,T, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,T,T,x, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,T, x,x,x,x, x,x,x,x},
+ {x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,T,x,T, T,T,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, T,x,x,x, x,T,x,x, x,x,x,x, T,x,x,x, x,x,T,x, x,x,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,T,T,x, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,T, x,x,x,x, x,x,x,x},
+ {x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,T,x,T, T,T,T,T, x,T,T,x, x,x,x,x, x,x,x,x, x,T,x,T, x,x,T,x, x,x,x,x, x,x,x,x, x,T,T,T, x,x,x,T, x,x,T,x, T,x,x,x, x,x,x,T, x,x,x,x, T,x,x,x, x,T,x,x, x,T,x,x, T,x,x,x, x,x,T,x, T,x,T,x, x,T,x,x, x,T,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,T,x, T,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,T,T, T,x,x,x, x,T,T,x, x,T,T,x, x,x,x,x, x,x,T,T, T,T,T,x, x,x,x,T, x,x,x,x, x,x,x,x},
+ {x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,T,x,T, T,T,T,T, x,T,T,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,T,T,T, x,x,x,T, x,x,T,x, T,x,x,x, x,x,x,T, x,x,x,x, T,x,x,x, x,T,x,x, x,T,x,x, T,x,x,x, x,x,T,x, T,x,T,x, x,T,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, T,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,T,T, T,x,x,x, x,T,x,x, x,T,T,x, x,x,x,x, x,x,T,T, T,T,T,x, x,x,x,T, x,x,x,x, x,x,x,x},
+ {x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,T,x,T, T,T,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,T,T, x,x,x,x, x,x,x,x, x,T,x,x, T,T,T,T, T,x,T,x, x,x,x,x, x,x,T,T, x,x,T,x, T,x,x,x, T,T,T,x, x,x,x,x, T,x,x,x, x,x,T,x, x,T,T,x, x,T,x,x, x,x,x,x, x,T,T,T, x,x,x,T, x,x,x,x, T,T,x,x, T,x,T,x, x,x,T,x, T,T,T,x, T,T,T,T, T,T,x,T, x,x,x,x, x,x,x,x, T,T,x,x, T,x,x,x, x,x,T,T, x,T,T,x, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,T, x,T,x,T, T,x,x,x},
+ {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,T, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,x, x,x,x,x, T,T,T,x, T,x,T,x, T,T,x,T, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,x,x,x},
+ {x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,T,x,T, T,T,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,T, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, T,x,x,x, x,T,x,x, x,T,x,x, T,x,x,x, x,x,T,x, x,x,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,T,T,x, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,T, x,x,x,x, x,x,x,x},
+ {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,T,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,T, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,T,T, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,T,T, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x},
+ {x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,T,x,T, T,T,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,T, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, T,x,x,x, x,T,x,x, x,x,x,x, T,x,x,x, x,x,T,x, x,x,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,T,T,x, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,T, x,x,x,x, x,x,x,x},
+ {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,T,x, T,x,x,x, x,x,x,x, x,x,T,x, x,x,T,x, x,x,x,x, T,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,T,T,T, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,x, x,x,x,x, T,T,T,x, T,x,T,T, T,T,x,T, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,x, x,x,T,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,x,x,x},
+ {x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,T,x,T, T,T,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,T, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, T,x,x,x, x,T,x,x, x,x,x,x, T,x,x,x, x,x,T,x, x,x,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,T,T,x, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,T, x,x,x,x, x,x,x,x},
+ {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x},
+ {x,T,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x},
+ {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, T,T,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x},
+ {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x},
+ {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, T,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,T, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,x, x,x,x,x, T,T,T,x, T,x,T,T, T,T,x,T, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,x,x,x},
+ {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x},
+ {x,x,T,T, T,T,T,T, T,T,x,x, x,x,x,x, T,x,T,T, x,x,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,x,x, x,T,x,T, T,T,T,T, x,T,T,x, x,x,x,T, T,T,T,T, T,T,T,x, T,T,T,x, x,T,T,T, T,T,T,T, T,T,T,T, x,x,x,T, x,T,T,x, T,x,x,x, x,x,x,T, x,x,x,x, T,T,x,x, x,T,x,x, T,T,x,x, T,x,T,x, x,x,T,x, T,x,T,x, x,T,x,x, x,T,x,T, x,x,x,x, T,T,x,x, T,x,T,T, x,x,T,x, T,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,T,T, T,x,x,x, x,T,x,x, x,T,T,x, x,x,T,x, T,T,T,T, T,T,T,x, x,x,x,T, x,x,x,x, x,x,x,x},
+ {x,T,T,T, T,T,T,T, T,T,x,T, x,x,x,x, T,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,T,x,x, x,T,x,T, T,T,T,T, x,T,T,x, T,x,x,T, T,T,T,T, T,T,T,x, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, x,x,x,T, T,T,T,T, T,x,x,x, x,x,x,T, T,T,x,T, T,T,x,T, x,T,x,x, T,T,x,T, T,x,T,x, x,x,T,x, T,x,T,x, x,T,x,x, x,T,x,T, x,x,x,x, T,T,x,x, T,x,x,T, x,x,T,x, T,T,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,T,x, T,x,T,T, T,T,T,x, x,x,T,T, T,T,x,T, x,T,x,x, T,T,T,x, T,x,T,T, T,T,T,T, T,T,T,T, x,x,x,T, T,x,T,x, x,x,x,x},
+ {x,T,T,T, T,T,T,T, T,T,T,T, T,x,x,x, T,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,T,x,x, x,T,T,T, T,T,T,T, x,T,T,x, T,x,x,T, T,T,T,T, T,T,T,x, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, x,x,x,T, T,T,T,T, T,x,T,x, T,x,x,T, T,T,x,T, T,T,x,T, x,T,x,x, T,T,x,T, T,x,T,x, x,x,T,x, T,x,T,x, x,T,x,x, x,T,x,T, x,x,x,x, T,T,x,x, T,x,x,T, x,x,T,x, T,T,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,T,x, T,x,T,T, T,T,T,x, x,x,T,T, T,T,x,T, x,T,x,x, T,T,T,x, T,x,T,T, T,T,T,T, T,T,T,T, x,x,x,T, T,x,T,x, x,x,x,x},
+ {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x},
+ {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, T,T,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x},
+ {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, T,T,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x},
+ {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x},
+ {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x},
+ {x,x,T,T, T,T,T,T, T,T,x,x, x,x,x,x, T,x,T,T, x,x,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,x,x, x,T,x,T, T,T,T,T, x,T,T,x, x,x,x,T, T,T,T,T, T,T,T,x, T,T,T,x, x,T,T,T, T,T,T,T, T,T,T,T, x,x,x,T, x,T,T,x, T,x,x,x, x,x,x,T, x,x,x,x, T,T,x,x, x,T,T,x, T,T,x,x, T,x,T,x, x,x,T,x, T,x,T,x, x,T,x,x, x,T,x,T, x,x,x,x, T,T,x,x, T,x,T,T, x,x,T,x, T,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,T,T, T,x,x,x, x,T,x,x, x,T,T,x, x,x,T,x, T,T,T,T, T,T,T,x, x,x,x,T, x,x,x,x, x,x,x,x},
+ {x,x,T,T, T,T,T,T, T,T,x,x, x,x,x,x, T,x,T,T, x,x,T,T, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,x,x, x,T,x,T, T,T,T,T, x,T,T,x, x,x,x,T, T,T,T,T, T,T,T,x, T,T,T,x, x,T,T,T, T,T,T,T, T,T,T,T, x,x,x,T, x,T,T,x, T,x,x,x, x,x,x,T, x,x,x,x, T,T,x,x, x,T,T,x, T,T,x,x, T,x,T,x, x,x,T,x, T,x,T,x, x,T,x,x, x,T,x,T, x,x,x,x, T,T,x,x, T,x,T,T, x,x,T,x, T,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,T,T, T,x,x,x, x,T,x,x, x,T,T,x, x,x,T,x, T,T,T,T, T,T,T,x, x,x,x,T, x,x,x,x, x,x,x,x},
+ {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,T,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, T,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x},
+ {x,x,T,T, T,T,T,T, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,x,x, x,T,x,T, T,T,T,T, x,T,T,x, x,x,x,T, T,T,T,T, T,T,T,x, T,T,T,x, x,T,T,T, T,T,T,T, T,T,T,T, x,x,x,T, x,T,T,x, T,x,x,x, x,x,x,T, x,x,x,x, T,T,x,x, x,T,x,x, T,T,x,x, T,x,T,x, x,x,T,x, T,x,T,x, x,T,x,x, x,T,x,T, x,x,x,x, T,T,x,x, T,x,x,T, x,x,T,x, T,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,T,T, T,x,x,x, x,T,x,x, x,T,T,x, x,x,T,x, T,T,T,T, T,T,T,x, x,x,x,T, x,x,x,x, x,x,x,x},
+ {x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,T,T,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x},
+ {x,x,T,T, T,T,T,T, T,T,x,x, x,x,x,x, T,x,T,T, x,x,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,x,x, x,T,x,T, T,T,T,T, x,T,T,x, x,x,x,T, T,T,T,T, T,T,T,x, T,T,T,x, x,T,T,T, T,T,T,T, T,T,T,T, x,x,x,T, x,T,T,x, T,x,x,x, x,x,x,T, x,x,x,x, T,T,x,x, x,T,x,x, T,T,x,x, T,x,T,x, x,x,T,x, T,x,T,x, x,T,x,x, x,T,x,T, x,x,x,x, T,T,x,x, T,x,x,T, x,x,T,x, T,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,T,T, T,x,x,x, x,T,x,x, x,T,T,x, x,x,T,x, T,T,T,T, T,T,T,x, x,x,x,T, x,x,x,x, x,x,x,x},
+ {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x},
+ {x,x,T,T, T,T,T,T, T,T,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,T,x,x, x,T,x,T, T,T,T,T, x,T,T,x, T,x,x,T, T,T,T,T, T,T,T,x, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, x,x,x,T, T,T,T,T, T,x,x,x, x,x,x,T, T,T,x,T, T,T,x,T, x,T,x,x, T,T,x,T, T,x,T,x, x,x,T,x, T,x,T,x, x,T,x,x, x,T,x,T, x,x,x,x, T,T,x,x, T,x,x,T, x,x,T,x, T,T,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,T,x, T,x,T,T, T,T,T,x, x,x,T,T, T,T,x,T, x,T,x,x, T,T,T,x, T,x,T,T, T,T,T,T, T,T,T,T, x,x,x,T, T,x,T,x, x,x,x,x},
+ {x,x,T,T, T,T,T,T, T,T,x,x, T,x,x,x, T,x,T,T, x,x,T,x, x,T,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,x,x, x,T,x,T, T,T,T,T, x,T,T,x, x,x,x,T, T,T,T,T, T,T,T,x, T,T,T,x, x,T,T,T, T,T,T,T, T,T,T,T, x,x,x,T, x,T,T,x, T,x,x,x, x,x,x,T, x,x,x,x, T,T,x,x, x,T,T,x, T,T,x,x, T,x,T,x, x,x,T,x, T,x,T,x, x,T,x,x, x,T,x,T, x,x,x,x, T,T,x,x, T,x,T,T, x,x,T,x, T,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,T,T, T,x,x,x, x,T,x,x, x,T,T,x, x,x,T,x, T,T,T,T, T,T,T,x, x,x,x,T, x,x,x,x, x,x,x,x},
+ {x,x,T,T, T,T,T,T, T,T,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,x,x, x,T,x,T, T,T,T,T, x,T,T,x, x,x,x,T, T,T,T,T, T,T,T,x, T,T,T,x, x,T,T,T, T,T,T,T, T,T,T,T, x,x,x,T, x,T,T,x, T,x,x,x, x,x,x,T, x,x,x,x, T,T,x,x, x,T,x,x, T,T,x,x, T,x,T,x, x,x,T,x, T,x,T,x, x,T,x,x, x,T,x,T, x,x,x,x, T,T,x,x, T,x,x,T, x,x,T,x, T,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,T,T, T,x,x,x, x,T,x,x, x,T,T,x, x,x,T,x, T,T,T,T, T,T,T,x, x,x,x,T, x,x,x,x, x,x,x,x},
+ {x,x,T,T, T,T,T,T, T,T,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,T,x,x, x,T,x,T, T,T,T,T, x,T,T,x, T,x,x,T, T,T,T,T, T,T,T,x, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, x,x,x,T, T,T,T,T, T,x,x,x, T,x,x,T, T,T,x,T, T,T,x,T, x,T,x,x, T,T,x,T, T,x,T,x, x,x,T,x, T,x,T,x, x,T,x,x, x,T,x,T, x,x,x,x, T,T,x,x, T,x,x,T, x,x,T,x, T,T,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,T,x, T,x,T,T, T,T,T,x, x,x,T,T, T,T,x,T, x,T,x,x, T,T,T,x, T,x,T,T, T,T,T,T, T,T,T,T, x,x,x,T, T,x,T,x, x,x,x,x},
+ {x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,T, T,T,T,T, T,T,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x},
+ {x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,T,x,T, T,T,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,T, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,T, T,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, T,x,x,x, x,T,x,x, x,x,x,x, T,x,x,x, x,x,T,x, x,x,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,x, x,T,T,x, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,T, x,x,x,x, x,x,x,x},
+ {x,x,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,T,x,T, T,T,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,T, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, T,x,x,x, x,T,x,x, x,x,x,x, T,x,x,x, x,x,T,x, x,x,T,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,T,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,T,T,x, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,T, x,x,x,x, x,x,x,x},
+ {x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,T,T,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x}
+
+ };
+} // end Parser
+
} \ No newline at end of file
diff --git a/main/contrib/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG b/main/contrib/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG
index 591c7cd3e1..1392e53695 100644
--- a/main/contrib/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG
+++ b/main/contrib/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG
@@ -1,3406 +1,3406 @@
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.Specialized;
-using System.Text;
-using ICSharpCode.NRefactory.Ast;
-using ICSharpCode.NRefactory.Parser.VB;
-using ASTAttribute = ICSharpCode.NRefactory.Ast.Attribute;
-
-COMPILER VBNET
-
-/* START AUTOGENERATED TOKENS SECTION */
-TOKENS
- /* ----- terminal classes ----- */
- /* EOF is 0 */
- EOL
- ident
- LiteralString
- LiteralCharacter
- LiteralInteger
- LiteralDouble
- LiteralSingle
- LiteralDecimal
- LiteralDate
-
- /* ----- special character ----- */
- "="
- ":"
- ","
- "&"
- "/"
- "\\"
- "."
- "!"
- "-"
- "+"
- "^"
- "?"
- "*"
- "{"
- "}"
- "("
- ")"
- ">"
- "<"
- "<>"
- ">="
- "<="
- "<<"
- ">>"
- "+="
- "^="
- "-="
- "*="
- "/="
- "\\="
- "<<="
- ">>="
- "&="
-
- /* ----- keywords ----- */
- "AddHandler"
- "AddressOf"
- "Aggregate"
- "Alias"
- "And"
- "AndAlso"
- "Ansi"
- "As"
- "Ascending"
- "Assembly"
- "Auto"
- "Binary"
- "Boolean"
- "ByRef"
- "By"
- "Byte"
- "ByVal"
- "Call"
- "Case"
- "Catch"
- "CBool"
- "CByte"
- "CChar"
- "CDate"
- "CDbl"
- "CDec"
- "Char"
- "CInt"
- "Class"
- "CLng"
- "CObj"
- "Compare"
- "Const"
- "Continue"
- "CSByte"
- "CShort"
- "CSng"
- "CStr"
- "CType"
- "CUInt"
- "CULng"
- "CUShort"
- "Custom"
- "Date"
- "Decimal"
- "Declare"
- "Default"
- "Delegate"
- "Descending"
- "Dim"
- "DirectCast"
- "Distinct"
- "Do"
- "Double"
- "Each"
- "Else"
- "ElseIf"
- "End"
- "EndIf"
- "Enum"
- "Equals"
- "Erase"
- "Error"
- "Event"
- "Exit"
- "Explicit"
- "False"
- "Finally"
- "For"
- "Friend"
- "From"
- "Function"
- "Get"
- "GetType"
- "Global"
- "GoSub"
- "GoTo"
- "Group"
- "Handles"
- "If"
- "Implements"
- "Imports"
- "In"
- "Infer"
- "Inherits"
- "Integer"
- "Interface"
- "Into"
- "Is"
- "IsNot"
- "Join"
- "Let"
- "Lib"
- "Like"
- "Long"
- "Loop"
- "Me"
- "Mod"
- "Module"
- "MustInherit"
- "MustOverride"
- "MyBase"
- "MyClass"
- "Namespace"
- "Narrowing"
- "New"
- "Next"
- "Not"
- "Nothing"
- "NotInheritable"
- "NotOverridable"
- "Object"
- "Of"
- "Off"
- "On"
- "Operator"
- "Option"
- "Optional"
- "Or"
- "Order"
- "OrElse"
- "Overloads"
- "Overridable"
- "Overrides"
- "ParamArray"
- "Partial"
- "Preserve"
- "Private"
- "Property"
- "Protected"
- "Public"
- "RaiseEvent"
- "ReadOnly"
- "ReDim"
- "Rem"
- "RemoveHandler"
- "Resume"
- "Return"
- "SByte"
- "Select"
- "Set"
- "Shadows"
- "Shared"
- "Short"
- "Single"
- "Skip"
- "Static"
- "Step"
- "Stop"
- "Strict"
- "String"
- "Structure"
- "Sub"
- "SyncLock"
- "Take"
- "Text"
- "Then"
- "Throw"
- "To"
- "True"
- "Try"
- "TryCast"
- "TypeOf"
- "UInteger"
- "ULong"
- "Unicode"
- "Until"
- "UShort"
- "Using"
- "Variant"
- "Wend"
- "When"
- "Where"
- "While"
- "Widening"
- "With"
- "WithEvents"
- "WriteOnly"
- "Xor"
-/* END AUTOGENERATED TOKENS SECTION */
-
-PRODUCTIONS
-
-VBNET
- (.
- lexer.NextToken(); // get the first token
- compilationUnit = new CompilationUnit();
- .)
-=
- { EndOfStmt }
- { OptionStmt { EndOfStmt } }
- { ImportsStmt { EndOfStmt } }
- { IF (IsGlobalAttrTarget()) GlobalAttributeSection { EndOfStmt } }
- { NamespaceMemberDecl { EndOfStmt } }
- EOF
-.
-
-OptionStmt (. INode node = null; bool val = true; .) =
- "Option" (. Location startPos = t.Location; .)
- (
- "Explicit" [ OptionValue<ref val> ]
- (. node = new OptionDeclaration(OptionType.Explicit, val); .)
- |
- "Strict" [ OptionValue<ref val> ]
- (. node = new OptionDeclaration(OptionType.Strict, val); .)
- |
- "Compare" ( "Binary" (. node = new OptionDeclaration(OptionType.CompareBinary, val); .)
- | "Text" (. node = new OptionDeclaration(OptionType.CompareText, val); .)
- )
- |
- "Infer" [ OptionValue<ref val> ]
- (. node = new OptionDeclaration(OptionType.Infer, val); .)
- )
- EndOfStmt
- (.
- if (node != null) {
- node.StartLocation = startPos;
- node.EndLocation = t.Location;
- compilationUnit.AddChild(node);
- }
- .)
- .
-
-OptionValue<ref bool val> =
- (
- "On" (. val = true; .)
- |
- "Off" (. val = false; .)
- )
- .
-
-EndOfStmt =
- EOL
-|
- ":"
-.
-
-ImportsStmt
- (.List<Using> usings = new List<Using>();
- .) =
- "Imports"
- (.
- Location startPos = t.Location;
- Using u;
- .)
- ImportClause<out u> (. if (u != null) { usings.Add(u); } .)
- {
- "," ImportClause<out u> (. if (u != null) { usings.Add(u); } .)
- }
- EndOfStmt
- (.
- UsingDeclaration usingDeclaration = new UsingDeclaration(usings);
- usingDeclaration.StartLocation = startPos;
- usingDeclaration.EndLocation = t.Location;
- compilationUnit.AddChild(usingDeclaration);
- .)
- .
-
-ImportClause<out Using u>
- (.
- string qualident = null;
- TypeReference aliasedType = null;
- u = null;
- .) =
- Qualident<out qualident>
- [ "=" TypeName<out aliasedType> ]
- (.
- if (qualident != null && qualident.Length > 0) {
- if (aliasedType != null) {
- u = new Using(qualident, aliasedType);
- } else {
- u = new Using(qualident);
- }
- }
- .)
- .
-
-/* 6.4.2 */
-NamespaceMemberDecl
- (.
- ModifierList m = new ModifierList();
- AttributeSection section;
- List<AttributeSection> attributes = new List<AttributeSection>();
- string qualident;
- .) =
- "Namespace"
- (.
- Location startPos = t.Location;
- .)
- Qualident<out qualident>
- (.
- INode node = new NamespaceDeclaration(qualident);
- node.StartLocation = startPos;
- compilationUnit.AddChild(node);
- compilationUnit.BlockStart(node);
- .)
- EndOfStmt
- NamespaceBody
- (.
- node.EndLocation = t.Location;
- compilationUnit.BlockEnd();
- .)
- |
- { AttributeSection<out section> (. attributes.Add(section); .) }
- { TypeModifier<m> } NonModuleDeclaration<m, attributes>
- .
-
-/* 4.9.1 */
-TypeParameterList<List<TemplateDefinition> templates>
-(.
- TemplateDefinition template;
-.) =
- [
- IF (la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of)
- "(" "Of" TypeParameter<out template>
- (.
- if (template != null) templates.Add(template);
- .)
- {
- "," TypeParameter<out template>
- (.
- if (template != null) templates.Add(template);
- .)
- }
- ")"
- ]
-.
-
-/* 4.9.1 */
-TypeParameter<out TemplateDefinition template>
-=
- Identifier (. template = new TemplateDefinition(t.val, null); .)
- [TypeParameterConstraints<template>]
-.
-
-/* 4.9.2 */
-TypeParameterConstraints<TemplateDefinition template>
-(.
- TypeReference constraint;
-.)
-=
- "As"
- (
- "{"
- TypeParameterConstraint<out constraint> (. if (constraint != null) { template.Bases.Add(constraint); } .)
- {
- ","
- TypeParameterConstraint<out constraint> (. if (constraint != null) { template.Bases.Add(constraint); } .)
- }
- "}"
- | TypeParameterConstraint<out constraint> (. if (constraint != null) { template.Bases.Add(constraint); } .)
- )
-.
-
-TypeParameterConstraint<out TypeReference constraint>
-(. constraint = null; .)
-= "Class" (. constraint = TypeReference.ClassConstraint; .)
-| "Structure" (. constraint = TypeReference.StructConstraint; .)
-| "New" (. constraint = TypeReference.NewConstraint; .)
-| TypeName<out constraint>
-.
-
-/* 6.4.2 */
-NonModuleDeclaration<ModifierList m, List<AttributeSection> attributes>
- (.
- TypeReference typeRef = null;
- List<TypeReference> baseInterfaces = null;
- .) =
- (. m.Check(Modifiers.Classes); .)
- /* Spec, 7.5 */
- "Class"
- (. TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
- newType.StartLocation = t.Location;
- compilationUnit.AddChild(newType);
- compilationUnit.BlockStart(newType);
-
- newType.Type = ClassType.Class;
- .)
- Identifier (. newType.Name = t.val; .)
- TypeParameterList<newType.Templates>
- EndOfStmt
- (. newType.BodyStartLocation = t.Location; .)
- [ ClassBaseType<out typeRef> (. SafeAdd(newType, newType.BaseTypes, typeRef); .) ]
- { TypeImplementsClause<out baseInterfaces> (. newType.BaseTypes.AddRange(baseInterfaces); .) }
- ClassBody<newType>
- "End" "Class" (. newType.EndLocation = t.EndLocation; .)
- EndOfStmt
- (.
- compilationUnit.BlockEnd();
- .)
- | "Module"
- (.
- m.Check(Modifiers.VBModules);
- TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
- compilationUnit.AddChild(newType);
- compilationUnit.BlockStart(newType);
- newType.StartLocation = m.GetDeclarationLocation(t.Location);
- newType.Type = ClassType.Module;
- .)
- Identifier (. newType.Name = t.val; .)
- EndOfStmt
- (. newType.BodyStartLocation = t.Location; .)
- ModuleBody<newType>
- (.
- compilationUnit.BlockEnd();
- .)
- | "Structure"
- (.
- m.Check(Modifiers.VBStructures);
- TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
- compilationUnit.AddChild(newType);
- compilationUnit.BlockStart(newType);
- newType.StartLocation = m.GetDeclarationLocation(t.Location);
- newType.Type = ClassType.Struct;
- .)
- Identifier (. newType.Name = t.val; .)
- TypeParameterList<newType.Templates>
- EndOfStmt
- (. newType.BodyStartLocation = t.Location; .)
- { TypeImplementsClause<out baseInterfaces> (. newType.BaseTypes.AddRange(baseInterfaces);.) }
- StructureBody<newType>
- (.
- compilationUnit.BlockEnd();
- .)
- | /* 7.4 */
- "Enum"
- (.
- m.Check(Modifiers.VBEnums);
- TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
- newType.StartLocation = m.GetDeclarationLocation(t.Location);
- compilationUnit.AddChild(newType);
- compilationUnit.BlockStart(newType);
-
- newType.Type = ClassType.Enum;
- .)
- Identifier (. newType.Name = t.val; .)
- [ "As" NonArrayTypeName<out typeRef, false> (. SafeAdd(newType, newType.BaseTypes, typeRef); .) ]
- EndOfStmt
- (. newType.BodyStartLocation = t.Location; .)
- EnumBody<newType>
- (.
- compilationUnit.BlockEnd();
- .)
- | /* 7.8 */
- "Interface"
- (.
- m.Check(Modifiers.VBInterfacs);
- TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
- newType.StartLocation = m.GetDeclarationLocation(t.Location);
- compilationUnit.AddChild(newType);
- compilationUnit.BlockStart(newType);
- newType.Type = ClassType.Interface;
- .)
- Identifier (. newType.Name = t.val; .)
- TypeParameterList<newType.Templates>
- EndOfStmt
- (. newType.BodyStartLocation = t.Location; .)
- { InterfaceBase<out baseInterfaces> (. newType.BaseTypes.AddRange(baseInterfaces); .) }
- InterfaceBody<newType>
- (.
- compilationUnit.BlockEnd();
- .)
- | /* 7.10 */
- "Delegate"
- (.
- m.Check(Modifiers.VBDelegates);
- DelegateDeclaration delegateDeclr = new DelegateDeclaration(m.Modifier, attributes);
- delegateDeclr.ReturnType = new TypeReference("System.Void", true);
- delegateDeclr.StartLocation = m.GetDeclarationLocation(t.Location);
- List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
- .)
- (
- "Sub" Identifier (. delegateDeclr.Name = t.val; .)
- TypeParameterList<delegateDeclr.Templates>
- [ "(" [ FormalParameterList<p> ] ")" (. delegateDeclr.Parameters = p; .) ]
- |
- "Function" Identifier (. delegateDeclr.Name = t.val; .)
- TypeParameterList<delegateDeclr.Templates>
- [ "(" [ FormalParameterList<p> ] ")" (. delegateDeclr.Parameters = p; .) ]
- [ "As" (. TypeReference type; .) TypeName<out type> (. delegateDeclr.ReturnType = type; .)]
- )
- (. delegateDeclr.EndLocation = t.EndLocation; .)
- EndOfStmt
- (.
- compilationUnit.AddChild(delegateDeclr);
- .)
- .
-
-NamespaceBody =
- { EndOfStmt } /* allow empty lines at begin of body */
- {
- NamespaceMemberDecl
- { EndOfStmt } /* allow empty lines in body */
- }
- "End" "Namespace"
- EndOfStmt
- .
-
-ClassBody<TypeDeclaration newType>
- (. AttributeSection section; .) =
- { EndOfStmt } /* allow empty lines at begin of body */
- {
- (.List<AttributeSection> attributes = new List<AttributeSection>();
- ModifierList m = new ModifierList();
- .)
- { AttributeSection<out section> (. attributes.Add(section); .) }
- { MemberModifier<m> }
- ClassMemberDecl<m, attributes>
- { EndOfStmt } /* allow empty lines in body */
- }
- .
-
-StructureBody<TypeDeclaration newType>
- (. AttributeSection section; .) =
- { EndOfStmt } /* allow empty lines at begin of body */
- {
- (.List<AttributeSection> attributes = new List<AttributeSection>();
- ModifierList m = new ModifierList();
- .)
- { AttributeSection<out section> (. attributes.Add(section); .) }
- { MemberModifier<m> }
- StructureMemberDecl<m, attributes>
- { EndOfStmt } /* allow empty lines in body */
- }
- "End" "Structure" (. newType.EndLocation = t.EndLocation; .)
- EndOfStmt
- .
-
-/* 7.7.1 */
-ModuleBody<TypeDeclaration newType>
- (. AttributeSection section; .) =
- { EndOfStmt } /* allow empty lines at begin of body */
- {
- (.List<AttributeSection> attributes = new List<AttributeSection>();
- ModifierList m = new ModifierList();
- .)
- { AttributeSection<out section> (. attributes.Add(section); .) }
- { MemberModifier<m> }
- ClassMemberDecl<m, attributes>
- { EndOfStmt } /* allow empty lines in body */
- }
- "End" "Module" (. newType.EndLocation = t.EndLocation; .)
- EndOfStmt
- .
-
-EnumBody<TypeDeclaration newType>
- (. FieldDeclaration f; .) =
- { EndOfStmt } /* allow empty lines at begin of body */
- {
- EnumMemberDecl<out f>
- (.
- compilationUnit.AddChild(f);
- .)
- { EndOfStmt } /* allow empty lines in body */
- }
- "End" "Enum" (. newType.EndLocation = t.EndLocation; .)
- EndOfStmt
- .
-
-InterfaceBody<TypeDeclaration newType> =
- { EndOfStmt } /* allow empty lines at begin of body */
- {
- InterfaceMemberDecl
- { EndOfStmt } /* allow empty lines in body */
- }
- "End" "Interface" (. newType.EndLocation = t.EndLocation; .)
- EndOfStmt
- .
-
-/* The information provided in the spec about */
-/* interface declarations is wrong */
-InterfaceMemberDecl
- (.
- TypeReference type =null;
- List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
- List<TemplateDefinition> templates = new List<TemplateDefinition>();
- AttributeSection section, returnTypeAttributeSection = null;
- ModifierList mod = new ModifierList();
- List<AttributeSection> attributes = new List<AttributeSection>();
- string name;
- .) =
- { AttributeSection<out section> (. attributes.Add(section); .) }
- /* this is different to c#: not only the Shadows modifier is allowed, */
- /* also member modifiers like overloads etc. */
- { MemberModifier<mod> }
- (
- "Event"
- (.
- mod.Check(Modifiers.VBInterfaceEvents);
- Location startLocation = t.Location;
- .)
- Identifier (. name = t.val; .)
- [ "(" [ FormalParameterList<p> ] ")" ]
- [ "As" TypeName<out type> ]
- EndOfStmt
- (.
- EventDeclaration ed = new EventDeclaration {
- Name = name, TypeReference = type, Modifier = mod.Modifier,
- Parameters = p, Attributes = attributes,
- StartLocation = startLocation, EndLocation = t.EndLocation
- };
- compilationUnit.AddChild(ed);
- .)
- |
- "Sub"
- (.
- Location startLocation = t.Location;
- mod.Check(Modifiers.VBInterfaceMethods);
- .)
- Identifier (. name = t.val; .)
- TypeParameterList<templates>
- [ "(" [ FormalParameterList<p> ] ")" ]
- EndOfStmt
- (.
- MethodDeclaration md = new MethodDeclaration {
- Name = name,
- Modifier = mod.Modifier,
- Parameters = p,
- Attributes = attributes,
- TypeReference = new TypeReference("System.Void", true),
- StartLocation = startLocation,
- EndLocation = t.EndLocation,
- Templates = templates
- };
- compilationUnit.AddChild(md);
- .)
- |
- "Function"
- (.
- mod.Check(Modifiers.VBInterfaceMethods);
- Location startLocation = t.Location;
- .)
- Identifier (. name = t.val; .)
- TypeParameterList<templates>
- [ "(" [ FormalParameterList<p> ] ")" ]
- [ "As" { AttributeSection<out returnTypeAttributeSection> } TypeName<out type> ]
- (.
- if(type == null) {
- type = new TypeReference("System.Object", true);
- }
- MethodDeclaration md = new MethodDeclaration {
- Name = name, Modifier = mod.Modifier,
- TypeReference = type, Parameters = p, Attributes = attributes
- };
- if (returnTypeAttributeSection != null) {
- returnTypeAttributeSection.AttributeTarget = "return";
- md.Attributes.Add(returnTypeAttributeSection);
- }
- md.StartLocation = startLocation;
- md.EndLocation = t.EndLocation;
- md.Templates = templates;
- compilationUnit.AddChild(md);
- .)
- EndOfStmt
- |
- "Property"
- (.
- Location startLocation = t.Location;
- mod.Check(Modifiers.VBInterfaceProperties);
- .)
- Identifier (. name = t.val; .)
- [ "(" [ FormalParameterList<p> ] ")" ]
- [ "As" TypeName<out type> ]
- (.
- if(type == null) {
- type = new TypeReference("System.Object", true);
- }
- .)
- EndOfStmt
- (.
- PropertyDeclaration pd = new PropertyDeclaration(name, type, mod.Modifier, attributes);
- pd.Parameters = p;
- pd.EndLocation = t.EndLocation;
- pd.StartLocation = startLocation;
- compilationUnit.AddChild(pd);
- .)
- )
- | /* inner type declarations */
- NonModuleDeclaration<mod, attributes>
- .
-
-/* 7.4.1 */
-EnumMemberDecl<out FieldDeclaration f>
- (.
- Expression expr = null;List<AttributeSection> attributes = new List<AttributeSection>();
- AttributeSection section = null;
- VariableDeclaration varDecl = null;
- .) =
- { AttributeSection<out section> (. attributes.Add(section); .) }
- Identifier
- (.
- f = new FieldDeclaration(attributes);
- varDecl = new VariableDeclaration(t.val);
- f.Fields.Add(varDecl);
- f.StartLocation = varDecl.StartLocation = t.Location;
- .)
- [ "=" Expr<out expr> (. varDecl.Initializer = expr; .) ]
- EndOfStmt
- .
-
-ClassMemberDecl<ModifierList m, List<AttributeSection> attributes> =
- StructureMemberDecl<m, attributes>
- .
-
-ClassBaseType<out TypeReference typeRef>
-(.
- typeRef = null;
-.) =
- "Inherits"
- TypeName<out typeRef>
- EndOfStmt
-.
-
-/* 7.6.1 */
-StructureMemberDecl<ModifierList m, List<AttributeSection> attributes>
- (.
- TypeReference type = null;
- List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
- Statement stmt = null;
- List<VariableDeclaration> variableDeclarators = new List<VariableDeclaration>();
- List<TemplateDefinition> templates = new List<TemplateDefinition>();
- .)
-=
- NonModuleDeclaration<m, attributes>
-| /* 9.2.1 */
- "Sub"
- (.
- Location startPos = t.Location;
- .)
- (
- (.
- string name = String.Empty;
- MethodDeclaration methodDeclaration; List<string> handlesClause = null;
- List<InterfaceImplementation> implementsClause = null;
- .)
- Identifier
- (.
- name = t.val;
- m.Check(Modifiers.VBMethods);
- .)
- TypeParameterList<templates>
- [ "(" [ FormalParameterList<p> ] ")" ]
- [
- (
- ImplementsClause<out implementsClause>
- |
- HandlesClause<out handlesClause>
- )
- ]
- (. Location endLocation = t.EndLocation; .)
- (
- /* abstract methods without a body */
- IF(IsMustOverride(m))
- EndOfStmt
- (.
- methodDeclaration = new MethodDeclaration {
- Name = name, Modifier = m.Modifier, Parameters = p, Attributes = attributes,
- StartLocation = m.GetDeclarationLocation(startPos), EndLocation = endLocation,
- TypeReference = new TypeReference("System.Void", true),
- Templates = templates,
- HandlesClause = handlesClause,
- InterfaceImplementations = implementsClause
- };
- compilationUnit.AddChild(methodDeclaration);
- .)
- |
- EOL
- (.
- methodDeclaration = new MethodDeclaration {
- Name = name, Modifier = m.Modifier, Parameters = p, Attributes = attributes,
- StartLocation = m.GetDeclarationLocation(startPos), EndLocation = endLocation,
- TypeReference = new TypeReference("System.Void", true),
- Templates = templates,
- HandlesClause = handlesClause,
- InterfaceImplementations = implementsClause
- };
- compilationUnit.AddChild(methodDeclaration);
- .)
-
- (. if (ParseMethodBodies) { .)
- Block<out stmt>
- "End" "Sub"
- (. } else {
- // don't parse method body
- lexer.SkipCurrentBlock(Tokens.Sub); stmt = new BlockStatement();
- }
- .)
-
- (. methodDeclaration.Body = (BlockStatement)stmt; .)
- (. methodDeclaration.Body.EndLocation = t.EndLocation; .)
- EndOfStmt
- )
- /* 9.3 */
- | "New" [ "(" [ FormalParameterList<p> ] ")" ]
- (. m.Check(Modifiers.Constructors); .)
- (. Location constructorEndLocation = t.EndLocation; .)
- EOL
-
- (. if (ParseMethodBodies) { .)
- Block<out stmt>
- "End" "Sub"
- (. } else {
- // don't parse method body
- lexer.SkipCurrentBlock(Tokens.Sub); stmt = new BlockStatement();
- }
- .)
-
- (. Location endLocation = t.EndLocation; .)
- EndOfStmt
- (.
- ConstructorDeclaration cd = new ConstructorDeclaration("New", m.Modifier, p, attributes);
- cd.StartLocation = m.GetDeclarationLocation(startPos);
- cd.EndLocation = constructorEndLocation;
- cd.Body = (BlockStatement)stmt;
- cd.Body.EndLocation = endLocation;
- compilationUnit.AddChild(cd);
- .)
- )
-|
- /* 9.2.1 */
- "Function"
- (.
- m.Check(Modifiers.VBMethods);
- string name = String.Empty;
- Location startPos = t.Location;
- MethodDeclaration methodDeclaration;List<string> handlesClause = null;
- List<InterfaceImplementation> implementsClause = null;
- AttributeSection returnTypeAttributeSection = null;
- .)
- Identifier (. name = t.val; .)
- TypeParameterList<templates>
- [ "(" [ FormalParameterList<p> ] ")" ]
- ["As" { AttributeSection<out returnTypeAttributeSection> } TypeName<out type> ]
- (.
- if(type == null) {
- type = new TypeReference("System.Object", true);
- }
- .)
- [
- (
- ImplementsClause<out implementsClause>
- |
- HandlesClause<out handlesClause>
- )
- ]
- (
- /* abstract methods without a body */
- IF(IsMustOverride(m))
- EndOfStmt
- (.
- methodDeclaration = new MethodDeclaration {
- Name = name, Modifier = m.Modifier, TypeReference = type,
- Parameters = p, Attributes = attributes,
- StartLocation = m.GetDeclarationLocation(startPos),
- EndLocation = t.EndLocation,
- HandlesClause = handlesClause,
- Templates = templates,
- InterfaceImplementations = implementsClause
- };
- if (returnTypeAttributeSection != null) {
- returnTypeAttributeSection.AttributeTarget = "return";
- methodDeclaration.Attributes.Add(returnTypeAttributeSection);
- }
- compilationUnit.AddChild(methodDeclaration);
- .)
- |
- EOL
- (.
- methodDeclaration = new MethodDeclaration {
- Name = name, Modifier = m.Modifier, TypeReference = type,
- Parameters = p, Attributes = attributes,
- StartLocation = m.GetDeclarationLocation(startPos),
- EndLocation = t.EndLocation,
- Templates = templates,
- HandlesClause = handlesClause,
- InterfaceImplementations = implementsClause
- };
- if (returnTypeAttributeSection != null) {
- returnTypeAttributeSection.AttributeTarget = "return";
- methodDeclaration.Attributes.Add(returnTypeAttributeSection);
- }
-
- compilationUnit.AddChild(methodDeclaration);
-
- if (ParseMethodBodies) { .)
- Block<out stmt>
- "End" "Function"
- (. } else {
- // don't parse method body
- lexer.SkipCurrentBlock(Tokens.Function); stmt = new BlockStatement();
- }
- methodDeclaration.Body = (BlockStatement)stmt;
- methodDeclaration.Body.StartLocation = methodDeclaration.EndLocation;
- methodDeclaration.Body.EndLocation = t.EndLocation;
- .)
- EndOfStmt
- )
-|
- /* 9.2.2. */
- "Declare"
- (.
- m.Check(Modifiers.VBExternalMethods);
- Location startPos = t.Location;
- CharsetModifier charsetModifer = CharsetModifier.None;
- string library = String.Empty;
- string alias = null;
- string name = String.Empty;
- .)
- [Charset<out charsetModifer> ]
- (
- "Sub"
- Identifier (. name = t.val; .)
- "Lib" LiteralString (. library = t.literalValue as string; .)
- ["Alias" LiteralString (. alias = t.literalValue as string; .)]
- [ "(" [ FormalParameterList<p> ] ")" ]
- EndOfStmt
- (.
- DeclareDeclaration declareDeclaration = new DeclareDeclaration(name, m.Modifier, null, p, attributes, library, alias, charsetModifer);
- declareDeclaration.StartLocation = m.GetDeclarationLocation(startPos);
- declareDeclaration.EndLocation = t.EndLocation;
- compilationUnit.AddChild(declareDeclaration);
- .)
- |
- "Function"
- Identifier (. name = t.val; .)
- "Lib" LiteralString (. library = t.literalValue as string; .)
- ["Alias" LiteralString (. alias = t.literalValue as string; .)]
- [ "(" [ FormalParameterList<p> ] ")" ]
- ["As" TypeName<out type> ]
- EndOfStmt
- (.
- DeclareDeclaration declareDeclaration = new DeclareDeclaration(name, m.Modifier, type, p, attributes, library, alias, charsetModifer);
- declareDeclaration.StartLocation = m.GetDeclarationLocation(startPos);
- declareDeclaration.EndLocation = t.EndLocation;
- compilationUnit.AddChild(declareDeclaration);
- .)
- )
-|
- /* 9. 4 */
- "Event"
- (.
- m.Check(Modifiers.VBEvents);
- Location startPos = t.Location;
- EventDeclaration eventDeclaration;
- string name = String.Empty;
- List<InterfaceImplementation> implementsClause = null;
- .)
- Identifier (. name= t.val; .)
- (
- "As" TypeName<out type>
- |
- [ "(" [ FormalParameterList<p> ] ")" ]
- )
- [ ImplementsClause<out implementsClause> ]
- (.
- eventDeclaration = new EventDeclaration {
- Name = name, TypeReference = type, Modifier = m.Modifier,
- Parameters = p, Attributes = attributes, InterfaceImplementations = implementsClause,
- StartLocation = m.GetDeclarationLocation(startPos),
- EndLocation = t.EndLocation
- };
- compilationUnit.AddChild(eventDeclaration);
- .)
- EndOfStmt
-| /* 9.6 */
- (. Location startPos = t.Location; .)
- (.
- m.Check(Modifiers.Fields);
- FieldDeclaration fd = new FieldDeclaration(attributes, null, m.Modifier);
- fd.StartLocation = m.GetDeclarationLocation(startPos);
- .)
- IdentifierForFieldDeclaration (. string name = t.val; .)
- VariableDeclaratorPartAfterIdentifier<variableDeclarators, name>
- { "," VariableDeclarator<variableDeclarators> }
- EndOfStmt
- (.
- fd.EndLocation = t.EndLocation;
- fd.Fields = variableDeclarators;
- compilationUnit.AddChild(fd);
- .)
- | /* 9.4 */
- (. m.Check(Modifiers.Fields); .)
- "Const" (. m.Add(Modifiers.Const, t.Location); .)
- (.
- FieldDeclaration fd = new FieldDeclaration(attributes, type, m.Modifier);
- fd.StartLocation = m.GetDeclarationLocation(t.Location);
- List<VariableDeclaration> constantDeclarators = new List<VariableDeclaration>();
- .)
- ConstantDeclarator<constantDeclarators>
- { "," ConstantDeclarator<constantDeclarators> }
- (.
- fd.Fields = constantDeclarators;
- fd.EndLocation = t.Location;
- .)
- EndOfStmt
- (.
- fd.EndLocation = t.EndLocation;
- compilationUnit.AddChild(fd);
- .)
-| /* 9.7 */
- "Property"
- (.
- m.Check(Modifiers.VBProperties);
- Location startPos = t.Location;
- List<InterfaceImplementation> implementsClause = null;
- .)
- Identifier (. string propertyName = t.val; .)
- [ "(" [ FormalParameterList<p> ] ")" ]
- [ "As" TypeName<out type> ]
- (.
- if(type == null) {
- type = new TypeReference("System.Object", true);
- }
- .)
- [ ImplementsClause<out implementsClause> ]
- EndOfStmt
- (
- /* abstract properties without a body */
- IF(IsMustOverride(m))
- (.
- PropertyDeclaration pDecl = new PropertyDeclaration(propertyName, type, m.Modifier, attributes);
- pDecl.StartLocation = m.GetDeclarationLocation(startPos);
- pDecl.EndLocation = t.Location;
- pDecl.TypeReference = type;
- pDecl.InterfaceImplementations = implementsClause;
- pDecl.Parameters = p;
- compilationUnit.AddChild(pDecl);
- .)
- |
- (.
- PropertyDeclaration pDecl = new PropertyDeclaration(propertyName, type, m.Modifier, attributes);
- pDecl.StartLocation = m.GetDeclarationLocation(startPos);
- pDecl.EndLocation = t.Location;
- pDecl.BodyStart = t.Location;
- pDecl.TypeReference = type;
- pDecl.InterfaceImplementations = implementsClause;
- pDecl.Parameters = p;
- PropertyGetRegion getRegion;
- PropertySetRegion setRegion;
- .)
- AccessorDecls<out getRegion, out setRegion>
- "End" "Property"
- EndOfStmt
- (.
- pDecl.GetRegion = getRegion;
- pDecl.SetRegion = setRegion;
- pDecl.BodyEnd = t.EndLocation;
- compilationUnit.AddChild(pDecl);
- .)
- )
-|
- "Custom" (. Location startPos = t.Location; .) "Event"
- (.
- m.Check(Modifiers.VBCustomEvents);
- EventAddRemoveRegion eventAccessorDeclaration;
- EventAddRegion addHandlerAccessorDeclaration = null;
- EventRemoveRegion removeHandlerAccessorDeclaration = null;
- EventRaiseRegion raiseEventAccessorDeclaration = null;
- List<InterfaceImplementation> implementsClause = null;
- .)
- Identifier (. string customEventName = t.val; .)
- "As" TypeName<out type>
- [ ImplementsClause<out implementsClause> ]
- EndOfStmt
- {
- EventAccessorDeclaration<out eventAccessorDeclaration>
- (.
- if(eventAccessorDeclaration is EventAddRegion)
- {
- addHandlerAccessorDeclaration = (EventAddRegion)eventAccessorDeclaration;
- }
- else if(eventAccessorDeclaration is EventRemoveRegion)
- {
- removeHandlerAccessorDeclaration = (EventRemoveRegion)eventAccessorDeclaration;
- }
- else if(eventAccessorDeclaration is EventRaiseRegion)
- {
- raiseEventAccessorDeclaration = (EventRaiseRegion)eventAccessorDeclaration;
- }
- .)
- }
- "End" "Event" EndOfStmt
- (.
- if(addHandlerAccessorDeclaration == null)
- {
- Error("Need to provide AddHandler accessor.");
- }
-
- if(removeHandlerAccessorDeclaration == null)
- {
- Error("Need to provide RemoveHandler accessor.");
- }
-
- if(raiseEventAccessorDeclaration == null)
- {
- Error("Need to provide RaiseEvent accessor.");
- }
-
- EventDeclaration decl = new EventDeclaration {
- TypeReference = type, Name = customEventName, Modifier = m.Modifier,
- Attributes = attributes,
- StartLocation = m.GetDeclarationLocation(startPos),
- EndLocation = t.EndLocation,
- AddRegion = addHandlerAccessorDeclaration,
- RemoveRegion = removeHandlerAccessorDeclaration,
- RaiseRegion = raiseEventAccessorDeclaration
- };
- compilationUnit.AddChild(decl);
- .)
-| (. ConversionType opConversionType = ConversionType.None; .)
- [ "Widening" (. opConversionType = ConversionType.Implicit; .)
- | "Narrowing" (. opConversionType = ConversionType.Explicit;.) ]
- "Operator"
- (.
- m.Check(Modifiers.VBOperators);
- Location startPos = t.Location;
- TypeReference returnType = NullTypeReference.Instance;
- TypeReference operandType = NullTypeReference.Instance;
- string operandName;
- OverloadableOperatorType operatorType;
- AttributeSection section;
- List<ParameterDeclarationExpression> parameters = new List<ParameterDeclarationExpression>();
- List<AttributeSection> returnTypeAttributes = new List<AttributeSection>();
- .)
- OverloadableOperator<out operatorType>
- "(" [ "ByVal" ] Identifier (. operandName = t.val; .)
- [ "As" TypeName<out operandType> ]
- (. parameters.Add(new ParameterDeclarationExpression(operandType, operandName, ParameterModifiers.In)); .)
-
- {
- ","
- [ "ByVal" ] Identifier (. operandName = t.val; .)
- [ "As" TypeName<out operandType> ]
- (. parameters.Add(new ParameterDeclarationExpression(operandType, operandName, ParameterModifiers.In)); .)
- }
- ")"
- (. Location endPos = t.EndLocation; .)
- [ "As" { AttributeSection<out section> (. returnTypeAttributes.Add(section); .) } TypeName<out returnType> (. endPos = t.EndLocation; .) ]
- EOL
- Block<out stmt> "End" "Operator" EndOfStmt
- (.
- OperatorDeclaration operatorDeclaration = new OperatorDeclaration {
- Modifier = m.Modifier,
- Attributes = attributes,
- Parameters = parameters,
- TypeReference = returnType,
- OverloadableOperator = operatorType,
- ConversionType = opConversionType,
- ReturnTypeAttributes = returnTypeAttributes,
- Body = (BlockStatement)stmt,
- StartLocation = m.GetDeclarationLocation(startPos),
- EndLocation = endPos
- };
- operatorDeclaration.Body.StartLocation = startPos;
- operatorDeclaration.Body.EndLocation = t.Location;
- compilationUnit.AddChild(operatorDeclaration);
- .)
-.
-
-OverloadableOperator<out OverloadableOperatorType operatorType>
- (. operatorType = OverloadableOperatorType.None; .)
- =
- "+" (. operatorType = OverloadableOperatorType.Add; .)
- |
- "-" (. operatorType = OverloadableOperatorType.Subtract; .)
- |
- "*" (. operatorType = OverloadableOperatorType.Multiply; .)
- |
- "/" (. operatorType = OverloadableOperatorType.Divide; .)
- |
- "\\" (. operatorType = OverloadableOperatorType.DivideInteger; .)
- |
- "&" (. operatorType = OverloadableOperatorType.Concat; .)
- |
- "Like" (. operatorType = OverloadableOperatorType.Like; .)
- |
- "Mod" (. operatorType = OverloadableOperatorType.Modulus; .)
- |
- "And" (. operatorType = OverloadableOperatorType.BitwiseAnd; .)
- |
- "Or" (. operatorType = OverloadableOperatorType.BitwiseOr; .)
- |
- "Xor" (. operatorType = OverloadableOperatorType.ExclusiveOr; .)
- |
- "^" (. operatorType = OverloadableOperatorType.Power; .)
- |
- "<<" (. operatorType = OverloadableOperatorType.ShiftLeft; .)
- |
- ">>" (. operatorType = OverloadableOperatorType.ShiftRight; .)
- |
- "=" (. operatorType = OverloadableOperatorType.Equality; .)
- |
- "<>" (. operatorType = OverloadableOperatorType.InEquality; .)
- |
- "<" (. operatorType = OverloadableOperatorType.LessThan; .)
- |
- "<=" (. operatorType = OverloadableOperatorType.LessThanOrEqual; .)
- |
- ">" (. operatorType = OverloadableOperatorType.GreaterThan; .)
- |
- ">=" (. operatorType = OverloadableOperatorType.GreaterThanOrEqual; .)
- |
- "CType" (. operatorType = OverloadableOperatorType.CType; .)
- |
- Identifier
- (.
- string opName = t.val;
- if (string.Equals(opName, "istrue", StringComparison.InvariantCultureIgnoreCase)) {
- operatorType = OverloadableOperatorType.IsTrue;
- } else if (string.Equals(opName, "isfalse", StringComparison.InvariantCultureIgnoreCase)) {
- operatorType = OverloadableOperatorType.IsFalse;
- } else {
- Error("Invalid operator. Possible operators are '+', '-', 'Not', 'IsTrue', 'IsFalse'.");
- }
- .)
- .
-
-EventAccessorDeclaration<out EventAddRemoveRegion eventAccessorDeclaration>
- (.
- Statement stmt = null;
- List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
- AttributeSection section;
- List<AttributeSection> attributes = new List<AttributeSection>();
- eventAccessorDeclaration = null;
- .) =
- { AttributeSection<out section> (. attributes.Add(section); .) }
- (
- "AddHandler" [ "(" [ FormalParameterList<p> ] ")" ] EOL
- Block<out stmt> "End" "AddHandler" EndOfStmt
- (.
- eventAccessorDeclaration = new EventAddRegion(attributes);
- eventAccessorDeclaration.Block = (BlockStatement)stmt;
- eventAccessorDeclaration.Parameters = p;
- .)
- |
- "RemoveHandler" [ "(" [ FormalParameterList<p> ] ")" ] EOL
- Block<out stmt> "End" "RemoveHandler" EndOfStmt
- (.
- eventAccessorDeclaration = new EventRemoveRegion(attributes);
- eventAccessorDeclaration.Block = (BlockStatement)stmt;
- eventAccessorDeclaration.Parameters = p;
- .)
- |
- "RaiseEvent" [ "(" [ FormalParameterList<p> ] ")" ] EOL
- Block<out stmt> "End" "RaiseEvent" EndOfStmt
- (.
- eventAccessorDeclaration = new EventRaiseRegion(attributes);
- eventAccessorDeclaration.Block = (BlockStatement)stmt;
- eventAccessorDeclaration.Parameters = p;
- .)
- )
- .
-
-/* 9.7 */
-AccessorDecls<out PropertyGetRegion getBlock, out PropertySetRegion setBlock>
- (.
- List<AttributeSection> attributes = new List<AttributeSection>();
- AttributeSection section;
- getBlock = null;
- setBlock = null;
- .) =
- { AttributeSection<out section> (. attributes.Add(section); .) }
- (
- GetAccessorDecl<out getBlock, attributes>
- [
- (. attributes = new List<AttributeSection>(); .)
- { AttributeSection<out section> (. attributes.Add(section); .) }
- SetAccessorDecl<out setBlock, attributes>
- ]
- |
- SetAccessorDecl<out setBlock, attributes>
- [
- (. attributes = new List<AttributeSection>(); .)
- { AttributeSection<out section> (. attributes.Add(section); .) }
- GetAccessorDecl<out getBlock, attributes>
- ]
- )
- .
-
-/* 9.7.1 */
-GetAccessorDecl<out PropertyGetRegion getBlock, List<AttributeSection> attributes>
- (. Statement stmt = null; Modifiers m; .)
-=
- PropertyAccessorAccessModifier<out m>
- "Get"
- (. Location startLocation = t.Location; .)
- EOL
- Block<out stmt>
- (. getBlock = new PropertyGetRegion((BlockStatement)stmt, attributes); .)
- "End" "Get"
- (. getBlock.Modifier = m; .)
- (. getBlock.StartLocation = startLocation; getBlock.EndLocation = t.EndLocation; .)
- EndOfStmt
- .
-
-/* 9.7.2 */
-SetAccessorDecl<out PropertySetRegion setBlock, List<AttributeSection> attributes>
- (.
- Statement stmt = null;
- List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
- Modifiers m;
- .)
-=
- PropertyAccessorAccessModifier<out m>
- "Set"
- (. Location startLocation = t.Location; .)
- [ "(" [ FormalParameterList<p> ] ")" ]
- EOL
- Block<out stmt>
- (.
- setBlock = new PropertySetRegion((BlockStatement)stmt, attributes);
- setBlock.Modifier = m;
- setBlock.Parameters = p;
- .)
- "End" "Set"
- (. setBlock.StartLocation = startLocation; setBlock.EndLocation = t.EndLocation; .)
- EndOfStmt
- .
-
-/* 9.5 */
-ConstantDeclarator<List<VariableDeclaration> constantDeclaration>
- (.
- Expression expr = null;
- TypeReference type = null;
- string name = String.Empty;
- Location location;
- .) =
- Identifier (. name = t.val; location = t.Location; .)
- ["As" TypeName<out type> ]
- "=" Expr<out expr>
- (.
- VariableDeclaration f = new VariableDeclaration(name, expr);
- f.TypeReference = type;
- f.StartLocation = location;
- constantDeclaration.Add(f);
- .)
-.
-
-/* 9.6 */
-VariableDeclarator<List<VariableDeclaration> fieldDeclaration>
-=
- Identifier (. string name = t.val; .)
- VariableDeclaratorPartAfterIdentifier<fieldDeclaration, name>
-.
-
-VariableDeclaratorPartAfterIdentifier<List<VariableDeclaration> fieldDeclaration, string name>
- (.
- Expression expr = null;
- TypeReference type = null;
- ArrayList rank = null;
- List<Expression> dimension = null;
- Location startLocation = t.Location;
- .) =
- [ IF(IsSize() && !IsDims()) ArrayInitializationModifier<out dimension> ]
- [ IF(IsDims()) ArrayNameModifier<out rank> ]
- (
- IF (IsObjectCreation()) "As" ObjectCreateExpression<out expr>
- (.
- if (expr is ObjectCreateExpression) {
- type = ((ObjectCreateExpression)expr).CreateType.Clone();
- } else {
- type = ((ArrayCreateExpression)expr).CreateType.Clone();
- }
- .)
- |
- [ "As" TypeName<out type>
- (.
- if (type != null) {
- for (int i = fieldDeclaration.Count - 1; i >= 0; i--) {
- VariableDeclaration vd = fieldDeclaration[i];
- if (vd.TypeReference.Type.Length > 0) break;
- TypeReference newType = type.Clone();
- newType.RankSpecifier = vd.TypeReference.RankSpecifier;
- vd.TypeReference = newType;
- }
- }
- .)
- ]
- (.
- if (type == null && (dimension != null || rank != null)) {
- type = new TypeReference("");
- }
- if (dimension != null) {
- if(type.RankSpecifier != null) {
- Error("array rank only allowed one time");
- } else {
- if (rank == null) {
- type.RankSpecifier = new int[] { dimension.Count - 1 };
- } else {
- rank.Insert(0, dimension.Count - 1);
- type.RankSpecifier = (int[])rank.ToArray(typeof(int));
- }
- expr = new ArrayCreateExpression(type.Clone(), dimension);
- }
- } else if (rank != null) {
- if(type.RankSpecifier != null) {
- Error("array rank only allowed one time");
- } else {
- type.RankSpecifier = (int[])rank.ToArray(typeof(int));
- }
- }
- .)
- [ "=" VariableInitializer<out expr> ]
- )
- (.
- VariableDeclaration varDecl = new VariableDeclaration(name, expr, type);
- varDecl.StartLocation = startLocation;
- varDecl.EndLocation = t.Location;
- fieldDeclaration.Add(varDecl);
- .)
-.
-
-/* 6.8 */
-ArrayInitializationModifier<out List<Expression> arrayModifiers>
-(.
- arrayModifiers = null;
-.) =
- "(" InitializationRankList<out arrayModifiers> ")"
-.
-
-/* 7.5.4.3 */
-InitializationRankList<out List<Expression> rank>
-(.
- rank = new List<Expression>();
- Expression expr = null;
-.) =
- Expr<out expr>
- [ "To" (. EnsureIsZero(expr); .)
- Expr<out expr>
- ]
- (. if (expr != null) { rank.Add(expr); } .)
- { ","
- Expr<out expr>
- [ "To" (. EnsureIsZero(expr); .)
- Expr<out expr>
- ]
- (. if (expr != null) { rank.Add(expr); } .)
- }
-.
-
-/* 9.6.3 */
-VariableInitializer<out Expression initializerExpression>
- (.
- initializerExpression = null;
- .) =
- Expr<out initializerExpression>
- | CollectionInitializer<out initializerExpression>
- .
-
-/* 9.6.3.4 */
-CollectionInitializer<out Expression outExpr>
- (.
- Expression expr = null;
- CollectionInitializerExpression initializer = new CollectionInitializerExpression();
- .) =
- "{"
- [
- VariableInitializer<out expr>
- (.
- if (expr != null) { initializer.CreateExpressions.Add(expr); }
- .)
- {
- IF (NotFinalComma()) "," VariableInitializer<out expr>
- (. if (expr != null) { initializer.CreateExpressions.Add(expr); } .)
- }
- ]
- "}" (. outExpr = initializer; .)
- .
-
-Charset<out CharsetModifier charsetModifier>
- (. charsetModifier = CharsetModifier.None; .) =
- | "Ansi" (. charsetModifier = CharsetModifier.Ansi; .)
- | "Auto" (. charsetModifier = CharsetModifier.Auto; .)
- | "Unicode" (. charsetModifier = CharsetModifier.Unicode; .)
- .
-
-/* 9.2.6 */
-HandlesClause<out List<string> handlesClause>
- (.
- handlesClause = new List<string>();
- string name;
- .) =
- "Handles" EventMemberSpecifier<out name> (. if (name != null) handlesClause.Add(name); .)
- { "," EventMemberSpecifier<out name> (. if (name != null) handlesClause.Add(name); .) }
- .
-
-/* 7.8. */
-InterfaceBase <out List<TypeReference> bases>
- (.
- TypeReference type;
- bases = new List<TypeReference>();
- .) =
- "Inherits"
- TypeName<out type> (. if (type != null) bases.Add(type); .)
- {
- ","
- TypeName<out type> (. if (type != null) bases.Add(type); .)
- }
- EndOfStmt
- .
-
-/* 7.2 */
-TypeImplementsClause<out List<TypeReference> baseInterfaces>
- (.
- baseInterfaces = new List<TypeReference>();
- TypeReference type = null;
- .) =
- "Implements" TypeName<out type>
- (.
- if (type != null) baseInterfaces.Add(type);
- .)
- {
- "," TypeName<out type>
- (. if (type != null) baseInterfaces.Add(type); .)
- }
- EndOfStmt
- .
-
-/* 9.1 */
-ImplementsClause<out List<InterfaceImplementation> baseInterfaces>
- (.
- baseInterfaces = new List<InterfaceImplementation>();
- TypeReference type = null;
- string memberName = null;
- .) =
- "Implements"
- NonArrayTypeName<out type, false>
- (. if (type != null) memberName = TypeReference.StripLastIdentifierFromType(ref type); .)
- (. baseInterfaces.Add(new InterfaceImplementation(type, memberName)); .)
- { ","
- NonArrayTypeName<out type, false>
- (. if (type != null) memberName = TypeReference.StripLastIdentifierFromType(ref type); .)
- (. baseInterfaces.Add(new InterfaceImplementation(type, memberName)); .)
- }
-.
-
-EventMemberSpecifier<out string name>
-(. string eventName; .)
-=
- ( Identifier | "MyBase" | "Me" )
- (. name = t.val; .)
- "."
- IdentifierOrKeyword<out eventName>
- (. name = name + "." + eventName; .)
-.
-
-Expr<out Expression expr>
- (. expr = null; .) =
- IF ( IsQueryExpression() )
- QueryExpr<out expr>
- | LambdaExpr<out expr>
- | DisjunctionExpr<out expr>
-.
-
-AssignmentOperator<out AssignmentOperatorType op>
- (. op = AssignmentOperatorType.None; .) =
- "=" (. op = AssignmentOperatorType.Assign; .)
- | "&=" (. op = AssignmentOperatorType.ConcatString; .)
- | "+=" (. op = AssignmentOperatorType.Add; .)
- | "-=" (. op = AssignmentOperatorType.Subtract; .)
- | "*=" (. op = AssignmentOperatorType.Multiply; .)
- | "/=" (. op = AssignmentOperatorType.Divide; .)
- | "\\=" (. op = AssignmentOperatorType.DivideInteger; .)
- | "^=" (. op = AssignmentOperatorType.Power; .)
- | "<<=" (. op = AssignmentOperatorType.ShiftLeft; .)
- | ">>=" (. op = AssignmentOperatorType.ShiftRight; .)
- .
-
-/* 11.4 */
-SimpleExpr<out Expression pexpr>
-(. string name; .)
-=
- SimpleNonInvocationExpression<out pexpr>
- {
- "." IdentifierOrKeyword<out name>
- (. pexpr = new MemberReferenceExpression(pexpr, name); .)
- [ IF (la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of)
- "(" "Of" TypeArgumentList<((MemberReferenceExpression)pexpr).TypeArguments> ")"
- ]
- | "!" IdentifierOrKeyword<out name> (. pexpr = new BinaryOperatorExpression(pexpr, BinaryOperatorType.DictionaryAccess, new PrimitiveExpression(name, name)); .)
- | InvocationExpression<ref pexpr>
- }
-.
-
-SimpleNonInvocationExpression<out Expression pexpr>
-(.
- Expression expr;
- TypeReference type = null;
- string name = String.Empty;
- pexpr = null;
-.) =
- (
- (
- /* 11.4.1 */
- LiteralString (.pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; .)
- | LiteralCharacter (.pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; .)
- | LiteralSingle (.pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; .)
- | LiteralDouble (.pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; .)
- | LiteralInteger (.pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; .)
- | LiteralDate (.pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; .)
- | LiteralDecimal (.pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; .)
- /* True, False and Nothing are handled as literals in the spec */
- | "True" (.pexpr = new PrimitiveExpression(true, "true"); .)
- | "False" (.pexpr = new PrimitiveExpression(false, "false"); .)
- | "Nothing" (.pexpr = new PrimitiveExpression(null, "null"); .)
- | /* 11.4.2 */ "(" Expr<out expr> ")" (. pexpr = new ParenthesizedExpression(expr); .)
- | /* 11.4.4 */ Identifier
- (. pexpr = new IdentifierExpression(t.val);
- pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation;
- .)
- [ IF (la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of)
- "(" "Of" TypeArgumentList<((IdentifierExpression)pexpr).TypeArguments> ")"
- ]
- | (. string val = String.Empty; .)
- ( PrimitiveTypeName<out val> | "Object" (. val = "System.Object"; .) )
- (. pexpr = new TypeReferenceExpression(new TypeReference(val, true)); .)
- | "Me" (. pexpr = new ThisReferenceExpression(); .)
- | (. Expression retExpr = null; .)
- ( "MyBase" (. retExpr = new BaseReferenceExpression(); .)
- | "MyClass" (. retExpr = new ClassReferenceExpression(); .)
- )
- "." IdentifierOrKeyword<out name> (. pexpr = new MemberReferenceExpression(retExpr, name); .)
- | "Global" "."
- Identifier (. type = new TypeReference(t.val ?? ""); .)
- /* fallback to "" is required if the token wasn't an identifier (->parser error but no exception) */
- (. type.IsGlobal = true; .)
- (. pexpr = new TypeReferenceExpression(type); .)
- | ObjectCreateExpression<out expr> (. pexpr = expr; .)
- | /* 11.11 : Casts */
- (. CastType castType = CastType.Cast; .)
- ( "DirectCast"
- | "CType" (. castType = CastType.Conversion; .)
- | "TryCast" (. castType = CastType.TryCast; .)
- )
- "(" Expr<out expr> "," TypeName<out type> ")"
- (. pexpr = new CastExpression(type, expr, castType); .)
- | /* 11.11 */ CastTarget<out type> "(" Expr<out expr> ")" (. pexpr = new CastExpression(type, expr, CastType.PrimitiveConversion); .)
- | /* 11.4.5 */ "AddressOf" Expr<out expr> (. pexpr = new AddressOfExpression(expr); .)
- | /* 11.5.1 */ "GetType" "(" GetTypeTypeName<out type> ")" (. pexpr = new TypeOfExpression(type); .)
- | /* 11.5.2 */ "TypeOf" SimpleExpr<out expr> "Is" TypeName<out type> (. pexpr = new TypeOfIsExpression(expr, type); .)
- | /* 11.22 */ ConditionalExpression<out pexpr>
- )
- |
- /* this form only occurs in WithStatements*/
- "." IdentifierOrKeyword<out name> (. pexpr = new MemberReferenceExpression(null, name);.)
- )
-.
-
-ConditionalExpression<out Expression expr>
- (.
- ConditionalExpression conditionalExpression = new ConditionalExpression();
- BinaryOperatorExpression binaryOperatorExpression = new BinaryOperatorExpression();
- conditionalExpression.StartLocation = binaryOperatorExpression.StartLocation = la.Location;
-
- Expression condition = null;
- Expression trueExpr = null;
- Expression falseExpr = null;
- .)
-=
- "If" "(" Expr<out condition> "," Expr<out trueExpr> [ "," Expr<out falseExpr> ] ")"
- (.
- if(falseExpr != null)
- {
- conditionalExpression.Condition = condition;
- conditionalExpression.TrueExpression = trueExpr;
- conditionalExpression.FalseExpression = falseExpr;
- conditionalExpression.EndLocation = t.EndLocation;
-
- expr = conditionalExpression;
- }
- else
- {
- binaryOperatorExpression.Left = condition;
- binaryOperatorExpression.Right = trueExpr;
- binaryOperatorExpression.Op = BinaryOperatorType.NullCoalescing;
- binaryOperatorExpression.EndLocation = t.EndLocation;
-
- expr = binaryOperatorExpression;
- }
- .)
-.
-
-InvocationExpression<ref Expression pexpr>
-(. List<Expression> parameters = null; .)
-=
- "(" (. Location start = t.Location; .)
- ArgumentList<out parameters>
- ")"
- (.
- pexpr = new InvocationExpression(pexpr, parameters);
- .)
- (. pexpr.StartLocation = start; pexpr.EndLocation = t.Location; .)
-.
-
-/* 11.11 */
-
-CastTarget<out TypeReference type>
- (.
- type = null;
- .) =
- "CBool" (. type = new TypeReference("System.Boolean", true); .)
- | "CByte" (. type = new TypeReference("System.Byte", true); .)
- | "CSByte" (. type = new TypeReference("System.SByte", true); .)
- | "CChar" (. type = new TypeReference("System.Char", true); .)
- | "CDate" (. type = new TypeReference("System.DateTime", true); .)
- | "CDec" (. type = new TypeReference("System.Decimal", true); .)
- | "CDbl" (. type = new TypeReference("System.Double", true); .)
- | "CShort" (. type = new TypeReference("System.Int16", true); .)
- | "CInt" (. type = new TypeReference("System.Int32", true); .)
- | "CLng" (. type = new TypeReference("System.Int64", true); .)
- | "CUShort" (. type = new TypeReference("System.UInt16", true); .)
- | "CUInt" (. type = new TypeReference("System.UInt32", true); .)
- | "CULng" (. type = new TypeReference("System.UInt64", true); .)
- | "CObj" (. type = new TypeReference("System.Object", true); .)
- | "CSng" (. type = new TypeReference("System.Single", true); .)
- | "CStr" (. type = new TypeReference("System.String", true); .)
- .
-
-DisjunctionExpr<out Expression outExpr>
-(.
- Expression expr;
- BinaryOperatorType op = BinaryOperatorType.None;
-.) =
- ConjunctionExpr<out outExpr>
- {
- (
- "Or" (. op = BinaryOperatorType.BitwiseOr; .)
- | "OrElse" (. op = BinaryOperatorType.LogicalOr; .)
- | "Xor" (. op = BinaryOperatorType.ExclusiveOr; .)
- )
- ConjunctionExpr<out expr> (. outExpr = new BinaryOperatorExpression(outExpr, op, expr); .)
- }
-.
-
-ConjunctionExpr<out Expression outExpr>
-(.
- Expression expr;
- BinaryOperatorType op = BinaryOperatorType.None;
-.) =
- NotExpr<out outExpr>
- {
- (
- "And" (. op = BinaryOperatorType.BitwiseAnd; .)
- | "AndAlso" (. op = BinaryOperatorType.LogicalAnd; .)
- )
- NotExpr<out expr> (. outExpr = new BinaryOperatorExpression(outExpr, op, expr); .)
- }
-.
-
-NotExpr<out Expression outExpr>
- (. UnaryOperatorType uop = UnaryOperatorType.None; .) =
- { "Not" (. uop = UnaryOperatorType.Not; .) }
- ComparisonExpr<out outExpr>
- (. if (uop != UnaryOperatorType.None)
- outExpr = new UnaryOperatorExpression(outExpr, uop);
- .)
- .
-
-ComparisonExpr<out Expression outExpr>
-(.
- Expression expr;
- BinaryOperatorType op = BinaryOperatorType.None;
-.) =
- ShiftExpr<out outExpr>
- {
- (
- "<" (. op = BinaryOperatorType.LessThan; .)
- | ">" (. op = BinaryOperatorType.GreaterThan; .)
- | "<=" (. op = BinaryOperatorType.LessThanOrEqual; .)
- | ">=" (. op = BinaryOperatorType.GreaterThanOrEqual; .)
- | "<>" (. op = BinaryOperatorType.InEquality; .)
- | "=" (. op = BinaryOperatorType.Equality; .)
- | "Like" (. op = BinaryOperatorType.Like; .)
- | "Is" (. op = BinaryOperatorType.ReferenceEquality; .)
- | "IsNot" (. op = BinaryOperatorType.ReferenceInequality; .)
- )
- (
- ShiftExpr<out expr> (. outExpr = new BinaryOperatorExpression(outExpr, op, expr); .)
- |
- "Not"
- ShiftExpr<out expr> (. outExpr = new BinaryOperatorExpression(outExpr, op, new UnaryOperatorExpression(expr, UnaryOperatorType.Not)); .)
- )
- }
-.
-
-ShiftExpr<out Expression outExpr>
- (.
- Expression expr;
- BinaryOperatorType op = BinaryOperatorType.None;
- .) =
- ConcatenationExpr<out outExpr>
- {
- (
- "<<" (. op = BinaryOperatorType.ShiftLeft; .)
- | ">>" (. op = BinaryOperatorType.ShiftRight; .)
- )
- ConcatenationExpr<out expr> (. outExpr = new BinaryOperatorExpression(outExpr, op, expr); .)
- }
- .
-
-ConcatenationExpr<out Expression outExpr>
-(. Expression expr; .)
-=
- AdditiveExpr<out outExpr> { "&" AdditiveExpr<out expr> (. outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.Concat, expr); .) }
-.
-
-AdditiveExpr<out Expression outExpr>
-(.
- Expression expr;
- BinaryOperatorType op = BinaryOperatorType.None;
-.) =
- ModuloExpr<out outExpr>
- {
- (
- "+" (. op = BinaryOperatorType.Add; .)
- | "-" (. op = BinaryOperatorType.Subtract; .)
- )
- ModuloExpr<out expr> (. outExpr = new BinaryOperatorExpression(outExpr, op, expr); .)
- }
-.
-
-ModuloExpr<out Expression outExpr>
-(. Expression expr; .)
-=
- IntegerDivisionExpr<out outExpr> { "Mod" IntegerDivisionExpr<out expr> (. outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.Modulus, expr); .) }
-.
-
-IntegerDivisionExpr<out Expression outExpr>
-(. Expression expr; .)
-=
- MultiplicativeExpr<out outExpr> { "\\" MultiplicativeExpr<out expr> (. outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.DivideInteger, expr); .) }
-.
-
-MultiplicativeExpr<out Expression outExpr>
-(.
- Expression expr;
- BinaryOperatorType op = BinaryOperatorType.None;
-.) =
- UnaryExpr<out outExpr>
- {
- (
- "*" (. op = BinaryOperatorType.Multiply; .)
- | "/" (. op = BinaryOperatorType.Divide; .)
- )
- UnaryExpr<out expr> (. outExpr = new BinaryOperatorExpression(outExpr, op, expr); .)
- }
-.
-
-UnaryExpr<out Expression uExpr>
-(.
- Expression expr;
- UnaryOperatorType uop = UnaryOperatorType.None;
- bool isUOp = false;
-.) =
- { "+" (. uop = UnaryOperatorType.Plus; isUOp = true; .)
- | "-" (. uop = UnaryOperatorType.Minus; isUOp = true; .)
- | "*" (. uop = UnaryOperatorType.Dereference; isUOp = true;.)
- }
- ExponentiationExpr<out expr>
- (.
- if (isUOp) {
- uExpr = new UnaryOperatorExpression(expr, uop);
- } else {
- uExpr = expr;
- }
- .)
-.
-
-ExponentiationExpr<out Expression outExpr>
-(. Expression expr; .)
-=
- SimpleExpr<out outExpr> { "^" SimpleExpr<out expr> (. outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.Power, expr); .) }
-.
-
-ObjectCreateExpression<out Expression oce>
-(.
- TypeReference type = null;
- Expression initializer = null;
- List<Expression> arguments = null;
- ArrayList dimensions = null;
- oce = null;
- bool canBeNormal; bool canBeReDim;
-.) =
- "New"
- [ NonArrayTypeName<out type, false>
- ["(" NormalOrReDimArgumentList<out arguments, out canBeNormal, out canBeReDim> ")"
- [ IF (la.kind == Tokens.OpenParenthesis)
- ArrayTypeModifiers<out dimensions>
- CollectionInitializer<out initializer>
- | CollectionInitializer<out initializer>
- ]
- (. if (canBeReDim && !canBeNormal && initializer == null) initializer = new CollectionInitializerExpression(); .)
- ]
- ]
- (.
- if (initializer == null) {
- oce = new ObjectCreateExpression(type, arguments);
- } else {
- if (dimensions == null) dimensions = new ArrayList();
- dimensions.Insert(0, (arguments == null) ? 0 : Math.Max(arguments.Count - 1, 0));
- type.RankSpecifier = (int[])dimensions.ToArray(typeof(int));
- ArrayCreateExpression ace = new ArrayCreateExpression(type, initializer as CollectionInitializerExpression);
- ace.Arguments = arguments;
- oce = ace;
- }
- .)
-
- [
- (.
- NamedArgumentExpression memberInitializer = null;
- .)
- "With"
- (.
- CollectionInitializerExpression memberInitializers = new CollectionInitializerExpression();
- memberInitializers.StartLocation = la.Location;
- .)
- "{"
- MemberInitializer<out memberInitializer>
- (. memberInitializers.CreateExpressions.Add(memberInitializer); .)
- { ","
- MemberInitializer<out memberInitializer>
- (. memberInitializers.CreateExpressions.Add(memberInitializer); .)
- }
- "}"
- (.
- memberInitializers.EndLocation = t.Location;
- if(oce is ObjectCreateExpression)
- {
- ((ObjectCreateExpression)oce).ObjectInitializer = memberInitializers;
- }
- .)
- ]
-.
-
-LambdaExpr<out Expression expr>
- (.
- Expression inner = null;
- LambdaExpression lambda = new LambdaExpression();
- lambda.StartLocation = la.Location;
- .) =
-
- "Function"
- [ "(" [ FormalParameterList<lambda.Parameters> ] ")" ]
- Expr<out inner>
- (.
- lambda.ExpressionBody = inner;
- lambda.EndLocation = t.EndLocation; // la.Location?
-
- expr = lambda;
- .)
-.
-
-QueryExpr<out Expression expr>
- (.
- QueryExpression qexpr = new QueryExpression();
- qexpr.StartLocation = la.Location;
- List<QueryExpressionClause> middleClauses = new List<QueryExpressionClause>();
- expr = qexpr;
- .) =
- FromOrAggregateQueryOperator<middleClauses>
- { QueryOperator<middleClauses> }
- (.
- qexpr.EndLocation = t.EndLocation;
- .)
-.
-
-FromOrAggregateQueryOperator<List<QueryExpressionClause> middleClauses>
- (. .) =
- FromQueryOperator<middleClauses>
- | AggregateQueryOperator<middleClauses>
-.
-
-QueryOperator<List<QueryExpressionClause> middleClauses>
- (.
- QueryExpressionJoinVBClause joinClause = null;
- QueryExpressionGroupVBClause groupByClause = null;
- QueryExpressionPartitionVBClause partitionClause = null;
- QueryExpressionGroupJoinVBClause groupJoinClause = null;
- .) =
- FromQueryOperator<middleClauses>
- | AggregateQueryOperator<middleClauses>
- | SelectQueryOperator<middleClauses>
- | DistinctQueryOperator<middleClauses>
- | WhereQueryOperator<middleClauses>
- | OrderByQueryOperator<middleClauses>
- | PartitionQueryOperator<out partitionClause>
- | LetQueryOperator<middleClauses>
- | JoinQueryOperator<out joinClause>
- (. middleClauses.Add(joinClause); .)
- | IF(la.kind == Tokens.Group && Peek(1).kind == Tokens.Join) GroupJoinQueryOperator<out groupJoinClause>
- (. middleClauses.Add(groupJoinClause); .)
- | GroupByQueryOperator<out groupByClause>
- (. middleClauses.Add(groupByClause); .)
-.
-
-OrderByQueryOperator<List<QueryExpressionClause> middleClauses>
- (.
- QueryExpressionOrderClause orderClause = new QueryExpressionOrderClause();
- orderClause.StartLocation = la.Location;
- List<QueryExpressionOrdering> orderings = null;
- .) =
- "Order" "By" OrderExpressionList<out orderings>
- (.
- orderClause.Orderings = orderings;
- orderClause.EndLocation = t.EndLocation;
- middleClauses.Add(orderClause);
- .)
-.
-
-OrderExpressionList<out List<QueryExpressionOrdering> orderings>
- (.
- orderings = new List<QueryExpressionOrdering>();
- QueryExpressionOrdering ordering = null;
- .) =
- OrderExpression<out ordering>
- (. orderings.Add(ordering); .)
- {
- "," OrderExpression<out ordering>
- (. orderings.Add(ordering); .)
- }
-.
-
-OrderExpression<out QueryExpressionOrdering ordering>
- (.
- ordering = new QueryExpressionOrdering();
- ordering.StartLocation = la.Location;
- ordering.Direction = QueryExpressionOrderingDirection.None;
- Expression orderExpr = null;
- .) =
- Expr<out orderExpr>
- (.
- ordering.Criteria = orderExpr;
- .)
- [
- "Ascending" (. ordering.Direction = QueryExpressionOrderingDirection.Ascending; .)
- | "Descending" (. ordering.Direction = QueryExpressionOrderingDirection.Descending; .)
- ]
- (. ordering.EndLocation = t.EndLocation; .)
-.
-
-GroupByQueryOperator<out QueryExpressionGroupVBClause groupByClause>
- (.
- groupByClause = new QueryExpressionGroupVBClause();
- groupByClause.StartLocation = la.Location;
- .) =
- "Group" ExpressionRangeVariableDeclarationList<groupByClause.GroupVariables>
- "By" ExpressionRangeVariableDeclarationList<groupByClause.ByVariables>
- "Into" ExpressionRangeVariableDeclarationList<groupByClause.IntoVariables>
- (.
- groupByClause.EndLocation = t.EndLocation;
- .)
-.
-
-GroupJoinQueryOperator<out QueryExpressionGroupJoinVBClause groupJoinClause>
- (.
- groupJoinClause = new QueryExpressionGroupJoinVBClause();
- groupJoinClause.StartLocation = la.Location;
- QueryExpressionJoinVBClause joinClause = null;
- .) =
- "Group" JoinQueryOperator<out joinClause>
- "Into" ExpressionRangeVariableDeclarationList<groupJoinClause.IntoVariables>
- (.
- groupJoinClause.JoinClause = joinClause;
- groupJoinClause.EndLocation = t.EndLocation;
- .)
-.
-
-FromQueryOperator<List<QueryExpressionClause> middleClauses>
- (.
- .) =
- "From" CollectionRangeVariableDeclarationList<middleClauses>
-.
-
-SelectQueryOperator<List<QueryExpressionClause> middleClauses>
- (.
- QueryExpressionSelectVBClause selectClause = new QueryExpressionSelectVBClause();
- selectClause.StartLocation = la.Location;
- .) =
- "Select" ExpressionRangeVariableDeclarationList<selectClause.Variables>
- (.
- selectClause.EndLocation = t.Location;
- middleClauses.Add(selectClause);
- .)
-.
-
-DistinctQueryOperator<List<QueryExpressionClause> middleClauses>
- (.
- QueryExpressionDistinctClause distinctClause = new QueryExpressionDistinctClause();
- distinctClause.StartLocation = la.Location;
- .) =
- "Distinct"
- (.
- distinctClause.EndLocation = t.EndLocation;
- middleClauses.Add(distinctClause);
- .)
-.
-
-WhereQueryOperator<List<QueryExpressionClause> middleClauses>
- (.
- QueryExpressionWhereClause whereClause = new QueryExpressionWhereClause();
- whereClause.StartLocation = la.Location;
- Expression operand = null;
- .) =
- "Where" Expr<out operand>
- (.
- whereClause.Condition = operand;
- whereClause.EndLocation = t.EndLocation;
-
- middleClauses.Add(whereClause);
- .)
-.
-
-PartitionQueryOperator<out QueryExpressionPartitionVBClause partitionClause>
- (.
- partitionClause = new QueryExpressionPartitionVBClause();
- partitionClause.StartLocation = la.Location;
- Expression expr = null;
- .) =
- "Take" (. partitionClause.PartitionType = QueryExpressionPartitionType.Take; .)
- [ "While" (. partitionClause.PartitionType = QueryExpressionPartitionType.TakeWhile; .) ]
- Expr<out expr>
- | "Skip" (. partitionClause.PartitionType = QueryExpressionPartitionType.Skip; .)
- [ "While" ] (. partitionClause.PartitionType = QueryExpressionPartitionType.SkipWhile; .)
- Expr<out expr>
- (.
- partitionClause.Expression = expr;
- partitionClause.EndLocation = t.EndLocation;
- .)
-.
-
-AggregateQueryOperator<List<QueryExpressionClause> middleClauses>
- (.
- QueryExpressionFromClause fromClause = null;
- QueryExpressionAggregateClause aggregateClause = new QueryExpressionAggregateClause();
- aggregateClause.IntoVariables = new List<ExpressionRangeVariable>();
- aggregateClause.StartLocation = la.Location;
- .) =
- "Aggregate" CollectionRangeVariableDeclaration<out fromClause>
- (.
- aggregateClause.FromClause = fromClause;
- .)
- {
- QueryOperator<aggregateClause.MiddleClauses>
- }
- "Into" ExpressionRangeVariableDeclarationList<aggregateClause.IntoVariables>
- (.
- aggregateClause.EndLocation = t.EndLocation;
- middleClauses.Add(aggregateClause);
- .)
-.
-
-LetQueryOperator<List<QueryExpressionClause> middleClauses>
- (.
- QueryExpressionLetVBClause letClause = new QueryExpressionLetVBClause();
- letClause.StartLocation = la.Location;
- .) =
- "Let" ExpressionRangeVariableDeclarationList<letClause.Variables>
- (.
- letClause.EndLocation = t.EndLocation;
- middleClauses.Add(letClause);
- .)
-.
-
-ExpressionRangeVariableDeclarationList<List<ExpressionRangeVariable> variables>
- (.
- ExpressionRangeVariable variable = null;
- .) =
- ExpressionRangeVariableDeclaration<out variable>
- (. variables.Add(variable); .)
- { "," ExpressionRangeVariableDeclaration<out variable> (. variables.Add(variable); .) }
-.
-
-ExpressionRangeVariableDeclaration<out ExpressionRangeVariable variable>
- (.
- variable = new ExpressionRangeVariable();
- variable.StartLocation = la.Location;
- Expression rhs = null;
- TypeReference typeName = null;
- .) =
- [
- IF(IsIdentifiedExpressionRange()) Identifier
- (. variable.Identifier = t.val; .)
- [
- "As" TypeName<out typeName>
- (. variable.Type = typeName; .)
- ]
- "="
- ]
- Expr<out rhs>
- (.
- variable.Expression = rhs;
- variable.EndLocation = t.EndLocation;
- .)
-.
-
-JoinQueryOperator<out QueryExpressionJoinVBClause joinClause>
- (.
- joinClause = new QueryExpressionJoinVBClause();
- joinClause.StartLocation = la.Location;
- QueryExpressionFromClause joinVariable = null;
- QueryExpressionJoinVBClause subJoin = null;
- QueryExpressionJoinConditionVB condition = null;
-
- .) =
- "Join" CollectionRangeVariableDeclaration<out joinVariable>
- (. joinClause.JoinVariable = joinVariable; .)
- [
- JoinQueryOperator<out subJoin>
- (. joinClause.SubJoin = subJoin; .)
- ]
- "On"
- JoinCondition<out condition>
- (. SafeAdd(joinClause, joinClause.Conditions, condition); .)
- {
- "And" JoinCondition<out condition>
- (. SafeAdd(joinClause, joinClause.Conditions, condition); .)
- }
- (.
- joinClause.EndLocation = t.EndLocation;
- .)
-.
-
-CollectionRangeVariableDeclarationList<List<QueryExpressionClause> middleClauses>
- (.
- QueryExpressionFromClause fromClause = null;
- .) =
- CollectionRangeVariableDeclaration<out fromClause>
- (. middleClauses.Add(fromClause); .)
- { "," CollectionRangeVariableDeclaration<out fromClause> (. middleClauses.Add(fromClause); .) }
-.
-
-CollectionRangeVariableDeclaration<out QueryExpressionFromClause fromClause>
- (.
- fromClause = new QueryExpressionFromClause();
- fromClause.StartLocation = la.Location;
- TypeReference typeName = null;
- Expression inExpr = null;
- .) =
- Identifier
- [ "As" TypeName<out typeName> (. fromClause.Type = typeName; .) ]
- "In" Expr<out inExpr>
- (.
- fromClause.InExpression = inExpr;
- fromClause.EndLocation = t.EndLocation;
- .)
-.
-
-JoinCondition<out QueryExpressionJoinConditionVB condition>
- (.
- condition = new QueryExpressionJoinConditionVB();
- condition.StartLocation = la.Location;
-
- Expression lhs = null;
- Expression rhs = null;
- .) =
- Expr<out lhs> "Equals" Expr<out rhs>
- (.
- condition.LeftSide = lhs;
- condition.RightSide = rhs;
- condition.EndLocation = t.EndLocation;
- .)
-.
-
-MemberInitializer<out NamedArgumentExpression memberInitializer>
- (.
- memberInitializer = new NamedArgumentExpression();
- memberInitializer.StartLocation = la.Location;
- Expression initExpr = null;
- string name = null;
- .) =
- "." IdentifierOrKeyword<out name> "=" Expr<out initExpr>
- (.
- memberInitializer.Name = name;
- memberInitializer.Expression = initExpr;
- memberInitializer.EndLocation = t.EndLocation;
- .)
-.
-
-/* 9.3.2 */
-ArgumentList<out List<Expression> arguments>
- (.
- arguments = new List<Expression>();
- Expression expr = null;
- .) =
- [ Argument<out expr> ]
- { "," (. arguments.Add(expr ?? Expression.Null); expr = null; .)
- [ Argument<out expr> ]
- (. if (expr == null) expr = Expression.Null; .)
- }
- (. if (expr != null) arguments.Add(expr); .)
-.
-
-/* argument list that hasn't decided if it is method call or array initialisation */
-NormalOrReDimArgumentList<out List<Expression> arguments, out bool canBeNormal, out bool canBeRedim>
- (.
- arguments = new List<Expression>();
- canBeNormal = true; canBeRedim = !IsNamedAssign();
- Expression expr = null;
- .)
-=
- [ Argument<out expr>
- [ "To" (. EnsureIsZero(expr); canBeNormal = false; .)
- Expr<out expr>
- ] ]
- { ","
- (. if (expr == null) canBeRedim = false; .)
- (. arguments.Add(expr ?? Expression.Null); expr = null; .)
- (. canBeRedim &= !IsNamedAssign(); .)
- [ Argument<out expr>
- [ "To" (. EnsureIsZero(expr); canBeNormal = false; .)
- Expr<out expr>
- ] ]
- (. if (expr == null) { canBeRedim = false; expr = Expression.Null; } .)
- }
- (. if (expr != null) arguments.Add(expr); else canBeRedim = false; .)
-.
-
-/* Spec, 11.8 */
-Argument<out Expression argumentexpr>
- (.
- Expression expr;
- argumentexpr = null;
- string name;
- .) =
- IF(IsNamedAssign()) Identifier (. name = t.val; .) ":" "=" Expr<out expr>
- (.
- argumentexpr = new NamedArgumentExpression(name, expr);
- .)
- |
- Expr<out argumentexpr>
-.
-
-/* 7.1. */
-TypeName<out TypeReference typeref>
-(. ArrayList rank = null; .)
-=
- NonArrayTypeName<out typeref, false>
-
-
-
- ArrayTypeModifiers<out rank>
- (. if (rank != null && typeref != null) {
- typeref.RankSpecifier = (int[])rank.ToArray(typeof(int));
- }
- .)
-.
-
-GetTypeTypeName<out TypeReference typeref>
-(. ArrayList rank = null; .)
-=
- NonArrayTypeName<out typeref, true>
- ArrayTypeModifiers<out rank>
- (. if (rank != null && typeref != null) {
- typeref.RankSpecifier = (int[])rank.ToArray(typeof(int));
- }
- .)
-.
-
-/* 7.1 */
-NonArrayTypeName<out TypeReference typeref, bool canBeUnbound>
-(.
- string name;
- typeref = null;
- bool isGlobal = false;
-.) =
- (
- [ "Global" "." (. isGlobal = true; .) ]
- QualIdentAndTypeArguments<out typeref, canBeUnbound>
- (. typeref.IsGlobal = isGlobal; .)
- { "." (. TypeReference nestedTypeRef; .)
- QualIdentAndTypeArguments<out nestedTypeRef, canBeUnbound>
- (. typeref = new InnerClassTypeReference(typeref, nestedTypeRef.Type, nestedTypeRef.GenericTypes); .)
- }
- )
- | "Object" (. typeref = new TypeReference("System.Object", true); .)
- [
- "?"
- (.
- List<TypeReference> typeArguments = new List<TypeReference>(1);
- if (typeref != null) typeArguments.Add(typeref);
- typeref = new TypeReference("System.Nullable", typeArguments) { IsKeyword = true };
- .)
- ]
-
- | PrimitiveTypeName<out name> (. typeref = new TypeReference(name, true); .)
- [
- "?"
- (.
- List<TypeReference> typeArguments = new List<TypeReference>(1);
- if (typeref != null) typeArguments.Add(typeref);
- typeref = new TypeReference("System.Nullable", typeArguments) { IsKeyword = true };
- .)
- ]
-.
-
-QualIdentAndTypeArguments<out TypeReference typeref, bool canBeUnbound>
-(. string name; typeref = null; .)
-=
- Qualident<out name>
- (. typeref = new TypeReference(name); .)
- [IF (la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of)
- "(" "Of"
- ( IF (canBeUnbound && (la.kind == Tokens.CloseParenthesis || la.kind == Tokens.Comma))
- (. typeref.GenericTypes.Add(NullTypeReference.Instance); .)
- { "," (. typeref.GenericTypes.Add(NullTypeReference.Instance); .) }
- | TypeArgumentList<typeref.GenericTypes>
- )
- ")"
- ]
-.
-
-/* 7.9 */
-ArrayNameModifier<out ArrayList arrayModifiers>
-(.
- arrayModifiers = null;
-.) =
- ArrayTypeModifiers<out arrayModifiers>
-.
-
-
-/* 7.9 */
-ArrayTypeModifiers<out ArrayList arrayModifiers>
-(.
- arrayModifiers = new ArrayList();
- int i = 0;
-.) =
- { IF (IsDims())
- "("
- [ RankList<out i>]
- (.
- arrayModifiers.Add(i);
- .)
- ")"
- }
- (.
- if(arrayModifiers.Count == 0) {
- arrayModifiers = null;
- }
- .)
-.
-
-/* 7.9 */
-RankList<out int i>
-(. i = 0; .) =
- { "," (. ++i; .) }
-.
-
-/* 7.12 */
-TypeArgumentList<List<TypeReference> typeArguments>
-(.
- TypeReference typeref;
-.) =
- TypeName<out typeref> (. if (typeref != null) typeArguments.Add(typeref); .)
- {
- ","
- TypeName<out typeref> (. if (typeref != null) typeArguments.Add(typeref); .)
- }
-.
-
-GlobalAttributeSection =
- "<" (. Location startPos = t.Location; .)
- ("Assembly" | "Module")
- (. string attributeTarget = t.val != null ? t.val.ToLower(System.Globalization.CultureInfo.InvariantCulture) : null;
- List<ASTAttribute> attributes = new List<ASTAttribute>();
- ASTAttribute attribute;
- .)
- ":" Attribute<out attribute> (. attributes.Add(attribute); .)
- { IF (NotFinalComma()) ["," ("Assembly" | "Module") ":"] Attribute<out attribute> (. attributes.Add(attribute); .)}
- [ "," ]
- ">"
- EndOfStmt
- (.
- AttributeSection section = new AttributeSection {
- AttributeTarget = attributeTarget,
- Attributes = attributes,
- StartLocation = startPos,
- EndLocation = t.EndLocation
- };
- compilationUnit.AddChild(section);
- .)
- .
-
-/* Spec, 5. */
-Attribute<out ASTAttribute attribute>
-(. string name;
- List<Expression> positional = new List<Expression>();
- List<NamedArgumentExpression> named = new List<NamedArgumentExpression>();
-.) =
- [ "Global" "." ]
- Qualident<out name>
- [ AttributeArguments<positional, named> ]
- (.
- attribute = new ASTAttribute(name, positional, named);
- .)
-.
-
-/* Spec, 5.2.2 */
-AttributeArguments<List<Expression> positional, List<NamedArgumentExpression> named>
- (.
- bool nameFound = false;
- string name = "";
- Expression expr;
- .) =
- "("
- [
- IF (IsNotClosingParenthesis()) (
- [
- IF (IsNamedAssign()) (. nameFound = true; .)
- IdentifierOrKeyword<out name>
- [":"] "="
- ] Expr<out expr>
- (.
- if (expr != null) {
- if (string.IsNullOrEmpty(name)) { positional.Add(expr); }
- else { named.Add(new NamedArgumentExpression(name, expr)); name = ""; }
- }
- .)
- {
- ","
- (
- IF (IsNamedAssign()) (. nameFound = true; .)
- IdentifierOrKeyword<out name>
- [ ":" ] "="
- | (. if (nameFound) Error("no positional argument after named argument"); .)
- ) Expr<out expr> (. if (expr != null) { if(name == "") positional.Add(expr);
- else { named.Add(new NamedArgumentExpression(name, expr)); name = ""; }
- }
- .)
- }
- )
- ]
- ")"
- .
-
-/* Spec, 5. */
-AttributeSection<out AttributeSection section>
- (.
- string attributeTarget = "";List<ASTAttribute> attributes = new List<ASTAttribute>();
- ASTAttribute attribute;
-
- .) =
- "<" (. Location startPos = t.Location; .)
- [ IF (IsLocalAttrTarget())
- ( "Event" (. attributeTarget = "event";.)
- | "Return" (. attributeTarget = "return";.)
- | Identifier
- (.
- string val = t.val.ToLower(System.Globalization.CultureInfo.InvariantCulture);
- if (val != "field" || val != "method" ||
- val != "module" || val != "param" ||
- val != "property" || val != "type")
- Error("attribute target specifier (event, return, field," +
- "method, module, param, property, or type) expected");
- attributeTarget = t.val;
- .)
- ) ":"
- ]
- Attribute<out attribute> (. attributes.Add(attribute); .)
- { IF (NotFinalComma()) "," Attribute<out attribute> (. attributes.Add(attribute); .) }
- [ "," ]
- ">"
- (.
- section = new AttributeSection {
- AttributeTarget = attributeTarget,
- Attributes = attributes,
- StartLocation = startPos,
- EndLocation = t.EndLocation
- };
- .)
- .
-
-/* 9.2.5 */
-FormalParameterList<List<ParameterDeclarationExpression> parameter>
-(. ParameterDeclarationExpression p; .)
-=
- FormalParameter <out p> (. if (p != null) parameter.Add(p); .)
- { ","
- FormalParameter <out p> (. if (p != null) parameter.Add(p); .)
- }
-.
-/* 9.2.5 */
-FormalParameter<out ParameterDeclarationExpression p>
-(.
- AttributeSection section;
- List<AttributeSection> attributes = new List<AttributeSection>();
- TypeReference type = null;
- ParamModifierList mod = new ParamModifierList(this);
- Expression expr = null;
- p = null;
- ArrayList arrayModifiers = null;
-.)
-=
- { AttributeSection<out section> (. attributes.Add(section); .) }
- { ParameterModifier<mod> }
- Identifier (. string parameterName = t.val; .)
- [ IF(IsDims()) ArrayTypeModifiers<out arrayModifiers> ]
- [ "As" TypeName<out type> ]
- (.
- if(type != null) {
- if (arrayModifiers != null) {
- if (type.RankSpecifier != null) {
- Error("array rank only allowed one time");
- } else {
- type.RankSpecifier = (int[])arrayModifiers.ToArray(typeof(int));
- }
- }
- } else {
- type = new TypeReference("System.Object", arrayModifiers == null ? null : (int[])arrayModifiers.ToArray(typeof(int)));
- }
- .)
- [ "=" Expr<out expr> ]
- (.
- mod.Check();
- p = new ParameterDeclarationExpression(type, parameterName, mod.Modifier, expr);
- p.Attributes = attributes;
- .)
-.
-
-/* 10.1 */
-Block<out Statement stmt>
- =
- (.
- BlockStatement blockStmt = new BlockStatement();
- /* in snippet parsing mode, t might be null */
- if (t != null) blockStmt.StartLocation = t.EndLocation;
- compilationUnit.BlockStart(blockStmt);
- .)
- {
- IF (IsEndStmtAhead()) "End" EndOfStmt (. compilationUnit.AddChild(new EndStatement()); .)
- | Statement EndOfStmt
-/* IF (!LeaveBlock()) { }*/
- }
- (.
- stmt = blockStmt;
- if (t != null) blockStmt.EndLocation = t.EndLocation;
- compilationUnit.BlockEnd();
- .)
- .
-
-Statement
- (.
- Statement stmt = null;
- Location startPos = la.Location;
- string label = String.Empty;
-
- .) =
- (
- | IF (IsLabel()) LabelName<out label>
- (.
- compilationUnit.AddChild(new LabelStatement(t.val));
- .)
- ":" Statement
- | EmbeddedStatement<out stmt> (. compilationUnit.AddChild(stmt); .)
- )
- (.
- if (stmt != null) {
- stmt.StartLocation = startPos;
- stmt.EndLocation = t.Location;
- }
- .)
-.
-
-/* 10.2 */
-LocalDeclarationStatement<out Statement statement>
- (.
- ModifierList m = new ModifierList();
- LocalVariableDeclaration localVariableDeclaration;
- bool dimfound = false;
- .) =
- /* this differs from the spec: dim static x compiles with vbc. */
- {
- "Const" (. m.Add(Modifiers.Const, t.Location); .)
- | "Static" (. m.Add(Modifiers.Static, t.Location); .)
- | "Dim" (. dimfound = true; .)
- }
- (.
- if(dimfound && (m.Modifier & Modifiers.Const) != 0) {
- Error("Dim is not allowed on constants.");
- }
-
- if(m.isNone && dimfound == false) {
- Error("Const, Dim or Static expected");
- }
-
- localVariableDeclaration = new LocalVariableDeclaration(m.Modifier);
- localVariableDeclaration.StartLocation = t.Location;
- .)
- VariableDeclarator<localVariableDeclaration.Variables>
- { "," VariableDeclarator<localVariableDeclaration.Variables> }
- (.
- statement = localVariableDeclaration;
- .)
-.
-
-EmbeddedStatement<out Statement statement>
- (.
- Statement embeddedStatement = null;
- statement = null;
- Expression expr = null;
- string name = String.Empty;
- List<Expression> p = null;
- .) =
- "Exit" (. ExitType exitType = ExitType.None; .)
- (
- "Sub" (. exitType = ExitType.Sub; .)
- |
- "Function" (. exitType = ExitType.Function; .)
- |
- "Property" (. exitType = ExitType.Property; .)
- |
- "Do" (. exitType = ExitType.Do; .)
- |
- "For" (. exitType = ExitType.For; .)
- |
- "Try" (. exitType = ExitType.Try; .)
- |
- "While" (. exitType = ExitType.While; .)
- |
- "Select" (. exitType = ExitType.Select; .)
- )
- (. statement = new ExitStatement(exitType); .)
- | TryStatement<out statement>
- | "Continue" (. ContinueType continueType = ContinueType.None; .) [ "Do" (. continueType = ContinueType.Do; .) | "For" (. continueType = ContinueType.For; .) | "While" (. continueType = ContinueType.While; .)] (. statement = new ContinueStatement(continueType); .)
- | /* 10.10.1.3 */
- "Throw" [ Expr<out expr> ] (. statement = new ThrowStatement(expr); .)
- | /* 10.11 */
- "Return" [ Expr<out expr> ] (. statement = new ReturnStatement(expr); .)
- | /* 10.4 */
- "SyncLock" Expr<out expr> EndOfStmt Block<out embeddedStatement>
- "End" "SyncLock" (. statement = new LockStatement(expr, embeddedStatement); .)
- | /* 10.5.1 */
- "RaiseEvent" Identifier (. name = t.val; .)
- [ "(" [ ArgumentList<out p> ] ")" ]
- (.
- statement = new RaiseEventStatement(name, p);
- .)
- | /* 10.3 */
- WithStatement<out statement>
- | /* 10.5.2 */
- "AddHandler" (. Expression handlerExpr = null; .)
- Expr<out expr> "," Expr<out handlerExpr>
- (.
- statement = new AddHandlerStatement(expr, handlerExpr);
- .)
- | /* 10.5.2 */
- "RemoveHandler" (. Expression handlerExpr = null; .)
- Expr<out expr> "," Expr<out handlerExpr>
- (.
- statement = new RemoveHandlerStatement(expr, handlerExpr);
- .)
- | /* 10.9.1 */
- "While" Expr<out expr> EndOfStmt
- Block<out embeddedStatement> "End" "While"
- (.
- statement = new DoLoopStatement(expr, embeddedStatement, ConditionType.While, ConditionPosition.Start);
- .)
- | /* 10.9.1 */
- "Do"
- (.
- ConditionType conditionType = ConditionType.None;
- .)
- (
- WhileOrUntil<out conditionType> Expr<out expr> EndOfStmt
- Block<out embeddedStatement>
- "Loop"
- (.
- statement = new DoLoopStatement(expr,
- embeddedStatement,
- conditionType == ConditionType.While ? ConditionType.DoWhile : conditionType,
- ConditionPosition.Start);
- .)
- |
- EndOfStmt
- Block<out embeddedStatement>
- "Loop" [WhileOrUntil<out conditionType> Expr<out expr>]
- (.
- statement = new DoLoopStatement(expr, embeddedStatement, conditionType, ConditionPosition.End);
- .)
- )
- | "For"
- (.
- Expression group = null;
- TypeReference typeReference;
- string typeName;
- Location startLocation = t.Location;
- .)
- (
- /* 10.9.3 */
- "Each" LoopControlVariable<out typeReference, out typeName>
- "In" Expr<out group> EndOfStmt
- Block<out embeddedStatement>
- "Next" [ Expr<out expr> ]
- (.
- statement = new ForeachStatement(typeReference,
- typeName,
- group,
- embeddedStatement,
- expr);
- statement.StartLocation = startLocation;
- statement.EndLocation = t.EndLocation;
-
- .)
- | /* 10.9.2 */
- (.
- Expression start = null;
- Expression end = null;
- Expression step = null;
- Expression variableExpr = null;
- Expression nextExpr = null;
- List<Expression> nextExpressions = null;
- .)
- ( IF (IsLoopVariableDeclaration())
- LoopControlVariable<out typeReference, out typeName>
- |
- (. typeReference = null; typeName = null; .)
- SimpleExpr<out variableExpr>
- )
- "=" Expr<out start> "To" Expr<out end> [ "Step" Expr<out step> ]
- EndOfStmt Block<out embeddedStatement>
- "Next"
- [
- Expr<out nextExpr>
- (.
- nextExpressions = new List<Expression>();
- nextExpressions.Add(nextExpr);
- .)
- { "," Expr<out nextExpr> (. nextExpressions.Add(nextExpr); .) }
- ]
- (.
- statement = new ForNextStatement {
- TypeReference = typeReference,
- VariableName = typeName,
- LoopVariableExpression = variableExpr,
- Start = start,
- End = end,
- Step = step,
- EmbeddedStatement = embeddedStatement,
- NextExpressions = nextExpressions
- };
- .)
- )
- | /* 10.10.2.1 */
- "Error" Expr<out expr> (. statement = new ErrorStatement(expr); .)
- | /* 10.12.1 */
- "ReDim" (. bool isPreserve = false; .) [ "Preserve" (. isPreserve = true; .) ]
- ReDimClause<out expr>
- (.
- ReDimStatement reDimStatement = new ReDimStatement(isPreserve);
- statement = reDimStatement;
- SafeAdd(reDimStatement, reDimStatement.ReDimClauses, expr as InvocationExpression);
- .)
- { "," ReDimClause<out expr>
- (. SafeAdd(reDimStatement, reDimStatement.ReDimClauses, expr as InvocationExpression); .)
- }
- | /* 10.12.2 */
- "Erase"
- Expr<out expr>
- (.
- EraseStatement eraseStatement = new EraseStatement();
- if (expr != null) { SafeAdd(eraseStatement, eraseStatement.Expressions, expr);}
- .)
- { "," Expr<out expr> (. if (expr != null) { SafeAdd(eraseStatement, eraseStatement.Expressions, expr); }.) }
- (. statement = eraseStatement; .)
- | /* 10.11 */
- "Stop" (. statement = new StopStatement(); .)
- | /* 10.8.1 */
- IF (la.kind == Tokens.If)
- "If" (. Location ifStartLocation = t.Location; .) Expr<out expr> [ "Then" ]
- (
- /* multiline if statement */
- EndOfStmt Block<out embeddedStatement>
- (.
- IfElseStatement ifStatement = new IfElseStatement(expr, embeddedStatement);
- ifStatement.StartLocation = ifStartLocation;
- Location elseIfStart;
- .)
- {
- (
- IF(IsElseIf()) "Else" (. elseIfStart = t.Location; .) "If"
- | "ElseIf" (. elseIfStart = t.Location; .)
- )
- (. Expression condition = null; Statement block = null; .)
- Expr<out condition> [ "Then"] EndOfStmt
- Block<out block>
- (.
- ElseIfSection elseIfSection = new ElseIfSection(condition, block);
- elseIfSection.StartLocation = elseIfStart;
- elseIfSection.EndLocation = t.Location;
- elseIfSection.Parent = ifStatement;
- ifStatement.ElseIfSections.Add(elseIfSection);
- .)
- }
- [
- "Else" EndOfStmt
- Block<out embeddedStatement>
- (.
- ifStatement.FalseStatement.Add(embeddedStatement);
- .)
- ] "End" "If"
- (.
- ifStatement.EndLocation = t.Location;
- statement = ifStatement;
- .)
- | /* singleline if statement */
- (.
- IfElseStatement ifStatement = new IfElseStatement(expr);
- ifStatement.StartLocation = ifStartLocation;
- .)
- SingleLineStatementList<ifStatement.TrueStatement>
- [
- "Else"
- [ SingleLineStatementList<ifStatement.FalseStatement> ]
- ]
- (. ifStatement.EndLocation = t.Location; statement = ifStatement; .)
- )
- | /* 10.8.2 */
- "Select" [ "Case" ] Expr<out expr> EndOfStmt
- (.List<SwitchSection> selectSections = new List<SwitchSection>();
- Statement block = null;
- .)
- {
- (.List<CaseLabel> caseClauses = null; Location caseLocation = la.Location; .)
- "Case" CaseClauses<out caseClauses> [ IF(IsNotStatementSeparator()) ":" ] EndOfStmt
- (.
- SwitchSection selectSection = new SwitchSection(caseClauses);
- selectSection.StartLocation = caseLocation;
- .)
- Block<out block>
- (.
- selectSection.Children = block.Children;
- selectSection.EndLocation = t.EndLocation;
- selectSections.Add(selectSection);
- .)
- }
- (.
- statement = new SwitchStatement(expr, selectSections);
- .)
- "End" "Select"
- | (. OnErrorStatement onErrorStatement = null; .)
- OnErrorStatement<out onErrorStatement> (. statement = onErrorStatement; .)
- | (. GotoStatement goToStatement = null; .)
- GotoStatement<out goToStatement> (. statement = goToStatement; .)
- | (. ResumeStatement resumeStatement = null; .)
- ResumeStatement<out resumeStatement> (. statement = resumeStatement; .)
- |/* Statement expression (invocation and assignment) 10.6.1, 10.6.2, 10.6.3 */
- (.
- Expression val = null;
- AssignmentOperatorType op;
-
- bool mustBeAssignment = la.kind == Tokens.Plus || la.kind == Tokens.Minus ||
- la.kind == Tokens.Not || la.kind == Tokens.Times;
- .)
- SimpleExpr<out expr>
- (
- AssignmentOperator<out op> Expr<out val> (. expr = new AssignmentExpression(expr, op, val); .)
- | (. if (mustBeAssignment) Error("error in assignment."); .)
- )
- (.
- // a field reference expression that stands alone is a
- // invocation expression without parantheses and arguments
- if(expr is MemberReferenceExpression || expr is IdentifierExpression) {
- expr = new InvocationExpression(expr);
- }
- statement = new ExpressionStatement(expr);
- .)
- | "Call" SimpleExpr<out expr> (. statement = new ExpressionStatement(expr); .)
- | "Using"
- (. Statement block; .)
- ( IF (Peek(1).kind == Tokens.As)
- (. LocalVariableDeclaration resourceAquisition = new LocalVariableDeclaration(Modifiers.None); .)
- VariableDeclarator<resourceAquisition.Variables>
- { ","
- VariableDeclarator<resourceAquisition.Variables>
- }
- Block<out block>
- (.
- statement = new UsingStatement(resourceAquisition, block);
- .)
- | Expr<out expr>
- Block<out block>
- (. statement = new UsingStatement(new ExpressionStatement(expr), block); .)
- )
- "End" "Using"
- | LocalDeclarationStatement<out statement>
-.
-
-SingleLineStatementList<List<Statement> list>
-(. Statement embeddedStatement = null; .)
-=
- ( "End" (. embeddedStatement = new EndStatement(); .)
- | EmbeddedStatement<out embeddedStatement> )
- (. if (embeddedStatement != null) list.Add(embeddedStatement); .)
- { ":" { ":" }
- ( "End" (. embeddedStatement = new EndStatement(); .)
- | EmbeddedStatement<out embeddedStatement> )
- (. if (embeddedStatement != null) list.Add(embeddedStatement); .)
- }
-.
-
-/* 10.9.2 */
-LoopControlVariable<out TypeReference type, out string name>
-(.ArrayList arrayModifiers = null;
- type = null;
-.)
-=
- Qualident<out name>
- [ IF(IsDims()) ArrayTypeModifiers<out arrayModifiers> ]
- [ "As" TypeName<out type> (. if (name.IndexOf('.') > 0) { Error("No type def for 'for each' member indexer allowed."); } .) ]
- (.
- if (type != null) {
- if(type.RankSpecifier != null && arrayModifiers != null) {
- Error("array rank only allowed one time");
- } else if (arrayModifiers != null) {
- type.RankSpecifier = (int[])arrayModifiers.ToArray(typeof(int));
- }
- }
- .)
-.
-
-/* 10.2.2 */
-OnErrorStatement<out OnErrorStatement stmt>
- (.
- stmt = null;
- GotoStatement goToStatement = null;
- .)
- =
- "On" "Error"
- (
- IF(IsNegativeLabelName())"GoTo" "-" LiteralInteger
- (.
- long intLabel = Int64.Parse(t.val);
- if(intLabel != 1) {
- Error("invalid label in on error statement.");
- }
- stmt = new OnErrorStatement(new GotoStatement((intLabel * -1).ToString()));
- .)
- | GotoStatement<out goToStatement>
- (.
- string val = goToStatement.Label;
-
- // if value is numeric, make sure that is 0
- try {
- long intLabel = Int64.Parse(val);
- if(intLabel != 0) {
- Error("invalid label in on error statement.");
- }
- } catch {
- }
- stmt = new OnErrorStatement(goToStatement);
- .)
- | "Resume" "Next"
- (.
- stmt = new OnErrorStatement(new ResumeStatement(true));
- .)
- )
- .
-
-/* 10.11 */
-GotoStatement<out GotoStatement goToStatement>
- (.
- string label = String.Empty;
- .)
- =
- "GoTo" LabelName<out label>
- (.
- goToStatement = new GotoStatement(label);
- .)
- .
-
-/* 10.1 */
-LabelName<out string name>
- (.
- name = String.Empty;
- .) =
- Identifier (. name = t.val; .)
- | LiteralInteger (. name = t.val; .)
- .
-
-/* 12.12.1 */
-ReDimClause<out Expression expr>
-=
- SimpleNonInvocationExpression<out expr>
- ReDimClauseInternal<ref expr>
-.
-
-ReDimClauseInternal<ref Expression expr>
-(. List<Expression> arguments; bool canBeNormal; bool canBeRedim; string name; .)
-=
- { "." IdentifierOrKeyword<out name> (. expr = new MemberReferenceExpression(expr, name); .)
- | IF (la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of)
- InvocationExpression<ref expr>
- }
- "("
- NormalOrReDimArgumentList<out arguments, out canBeNormal, out canBeRedim>
- ")"
- (. expr = new InvocationExpression(expr, arguments);
- if (canBeRedim == false || canBeNormal && (la.kind == Tokens.Dot || la.kind == Tokens.OpenParenthesis)) {
- if (this.Errors.Count == 0) {
- // don't recurse on parse errors - could result in endless recursion
- ReDimClauseInternal(ref expr);
- }
- }
- .)
-.
-
-/* 10.10.2.3 */
-ResumeStatement<out ResumeStatement resumeStatement>
- (.
- resumeStatement = null;
- string label = String.Empty;
- .) =
- IF(IsResumeNext())
- "Resume" "Next" (. resumeStatement = new ResumeStatement(true); .)
- | "Resume" [ LabelName<out label> ] (. resumeStatement = new ResumeStatement(label); .)
- .
-
-/* 18.8.2 */
-CaseClauses<out List<CaseLabel> caseClauses>
- (.
- caseClauses = new List<CaseLabel>();
- CaseLabel caseClause = null;
- .) =
- CaseClause<out caseClause> (. if (caseClause != null) { caseClauses.Add(caseClause); } .)
- { "," CaseClause<out caseClause> (. if (caseClause != null) { caseClauses.Add(caseClause); } .) }
- .
-
-/* 19.8.2 */
-CaseClause<out CaseLabel caseClause>
- (.
- Expression expr = null;
- Expression sexpr = null;
- BinaryOperatorType op = BinaryOperatorType.None;
- caseClause = null;
- .) =
- "Else"
- (. caseClause = new CaseLabel(); .)
- |
- [ "Is" ]
- (
- "<" (. op = BinaryOperatorType.LessThan; .)
- | ">" (. op = BinaryOperatorType.GreaterThan; .)
- | "<=" (. op = BinaryOperatorType.LessThanOrEqual; .)
- | ">=" (. op = BinaryOperatorType.GreaterThanOrEqual; .)
- | "=" (. op = BinaryOperatorType.Equality; .)
- | "<>" (. op = BinaryOperatorType.InEquality; .)
- )
- Expr<out expr>
- (.
- caseClause = new CaseLabel(op, expr);
- .)
- | Expr<out expr> [ "To" Expr<out sexpr> ]
- (.
- caseClause = new CaseLabel(expr, sexpr);
- .)
- .
-
-/* 10.9.1 */
-WhileOrUntil<out ConditionType conditionType>
- (. conditionType = ConditionType.None; .) =
- "While" (. conditionType = ConditionType.While; .)
- | "Until" (. conditionType = ConditionType.Until; .)
- .
-
-/* 10.3 */
-WithStatement<out Statement withStatement>
- (.
- Statement blockStmt = null;
- Expression expr = null;
- .) =
- "With" (. Location start = t.Location; .)
- Expr<out expr> EndOfStmt
- (.
- withStatement = new WithStatement(expr);
- withStatement.StartLocation = start;
- .)
- Block<out blockStmt>
- (.
- ((WithStatement)withStatement).Body = (BlockStatement)blockStmt;
- .)
- "End" "With"
- (. withStatement.EndLocation = t.Location; .)
- .
-
-/* 10.10.1 */
-TryStatement<out Statement tryStatement>
- (.
- Statement blockStmt = null, finallyStmt = null;List<CatchClause> catchClauses = null;
- .) =
- "Try" EndOfStmt
- Block<out blockStmt>
- [CatchClauses<out catchClauses>]
- ["Finally" EndOfStmt Block<out finallyStmt> ]
- "End" "Try"
- (.
- tryStatement = new TryCatchStatement(blockStmt, catchClauses, finallyStmt);
- .)
- .
-
-/* 10.10.1.2 */
-CatchClauses<out List<CatchClause> catchClauses>
- (.
- catchClauses = new List<CatchClause>();
- TypeReference type = null;
- Statement blockStmt = null;
- Expression expr = null;
- string name = String.Empty;
- .) =
- {
- "Catch"
- [ Identifier (. name = t.val; .) ["As" TypeName<out type>] ]
- [ "When" Expr<out expr> ]
- EndOfStmt
- Block<out blockStmt>
- (. catchClauses.Add(new CatchClause(type, name, blockStmt, expr)); .)
- }
- .
-
-/* 4.7 */
-Qualident<out string qualident>
-(.
- string name;
- qualidentBuilder.Length = 0;
-.)
-=
- Identifier (. qualidentBuilder.Append(t.val); .)
- { IF (DotAndIdentOrKw()) "." IdentifierOrKeyword<out name> (. qualidentBuilder.Append('.'); qualidentBuilder.Append(name); .) }
-
- (. qualident = qualidentBuilder.ToString(); .)
-.
-
-/* This production handles pseudo keywords that are needed in the grammar */
-Identifier =
- IdentifierForFieldDeclaration
- | "Custom"
-.
-
-IdentifierForFieldDeclaration =
- ident
- | "Aggregate"
- | "Ansi"
- | "Ascending"
- | "Assembly"
- | "Auto"
- | "Binary"
- | "By"
- | "Compare"
- | "Descending"
- | "Distinct"
- | "Equals"
- | "Explicit"
- | "From"
- | "Group"
- | "Infer"
- | "Into"
- | "Join"
- | "Off"
- | "Order"
- | "Preserve"
- | "Skip"
- | "Take"
- | "Text"
- | "Unicode"
- | "Until"
- | "Where"
-.
-
-/* 2.2 */
-
-IdentifierOrKeyword<out string name>
-=
- (. lexer.NextToken(); name = t.val; .)
-.
-
-
-/* 7.3 */
-PrimitiveTypeName<out string type>
- (. type = String.Empty; .) =
- "Boolean" (. type = "System.Boolean"; .)
- | "Date" (. type = "System.DateTime"; .)
- | "Char" (. type = "System.Char"; .)
- | "String" (. type = "System.String"; .)
- | "Decimal" (. type = "System.Decimal"; .)
- | "Byte" (. type = "System.Byte"; .)
- | "Short" (. type = "System.Int16"; .)
- | "Integer" (. type = "System.Int32"; .)
- | "Long" (. type = "System.Int64"; .)
- | "Single" (. type = "System.Single"; .)
- | "Double" (. type = "System.Double"; .)
- | "UInteger" (. type = "System.UInt32"; .)
- | "ULong" (. type = "System.UInt64"; .)
- | "UShort" (. type = "System.UInt16"; .)
- | "SByte" (. type = "System.SByte"; .)
- .
-
-ParameterModifier<ParamModifierList m>
- = "ByVal" (. m.Add(ParameterModifiers.In); .)
- | "ByRef" (. m.Add(ParameterModifiers.Ref); .)
- | "Optional" (. m.Add(ParameterModifiers.Optional); .)
- | "ParamArray" (. m.Add(ParameterModifiers.Params); .)
- .
-
-TypeModifier<ModifierList m>
-= "Public" (. m.Add(Modifiers.Public, t.Location); .)
- | "Protected" (. m.Add(Modifiers.Protected, t.Location); .)
- | "Friend" (. m.Add(Modifiers.Internal, t.Location); .)
- | "Private" (. m.Add(Modifiers.Private, t.Location); .)
- | "Shared" (. m.Add(Modifiers.Static, t.Location); .)
- | "Shadows" (. m.Add(Modifiers.New, t.Location); .)
- | "MustInherit" (. m.Add(Modifiers.Abstract, t.Location); .)
- | "NotInheritable" (. m.Add(Modifiers.Sealed, t.Location); .)
- | "Partial" (. m.Add(Modifiers.Partial, t.Location); .)
-.
-
-MemberModifier<ModifierList m> =
- "MustInherit" (.m.Add(Modifiers.Abstract, t.Location);.)
- | "Default" (.m.Add(Modifiers.Default, t.Location);.)
- | "Friend" (.m.Add(Modifiers.Internal, t.Location);.)
- | "Shadows" (.m.Add(Modifiers.New, t.Location);.)
- | "Overrides" (.m.Add(Modifiers.Override, t.Location);.)
- | "MustOverride" (.m.Add(Modifiers.Abstract, t.Location);.)
- | "Private" (.m.Add(Modifiers.Private, t.Location);.)
- | "Protected" (.m.Add(Modifiers.Protected, t.Location);.)
- | "Public" (.m.Add(Modifiers.Public, t.Location);.)
- | "NotInheritable" (.m.Add(Modifiers.Sealed, t.Location);.)
- | "NotOverridable" (.m.Add(Modifiers.Sealed, t.Location);.)
- | "Shared" (.m.Add(Modifiers.Static, t.Location);.)
- | "Overridable" (.m.Add(Modifiers.Virtual, t.Location);.)
- | "Overloads" (.m.Add(Modifiers.Overloads, t.Location);.)
- | "ReadOnly" (.m.Add(Modifiers.ReadOnly, t.Location);.)
- | "WriteOnly" (.m.Add(Modifiers.WriteOnly, t.Location);.)
- | "WithEvents" (.m.Add(Modifiers.WithEvents, t.Location);.)
- | "Dim" (.m.Add(Modifiers.Dim, t.Location);.)
- | "Partial" (.m.Add(Modifiers.Partial, t.Location);.)
-.
-
-PropertyAccessorAccessModifier<out Modifiers m> =
- (. m = Modifiers.None; .)
- {(
- "Public" (. m |= Modifiers.Public; .)
- | "Protected" (. m |= Modifiers.Protected; .)
- | "Friend" (. m |= Modifiers.Internal; .)
- | "Private" (. m |= Modifiers.Private; .)
- )}
-.
-
-END VBNET.
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Text;
+using ICSharpCode.NRefactory.Ast;
+using ICSharpCode.NRefactory.Parser.VB;
+using ASTAttribute = ICSharpCode.NRefactory.Ast.Attribute;
+
+COMPILER VBNET
+
+/* START AUTOGENERATED TOKENS SECTION */
+TOKENS
+ /* ----- terminal classes ----- */
+ /* EOF is 0 */
+ EOL
+ ident
+ LiteralString
+ LiteralCharacter
+ LiteralInteger
+ LiteralDouble
+ LiteralSingle
+ LiteralDecimal
+ LiteralDate
+
+ /* ----- special character ----- */
+ "="
+ ":"
+ ","
+ "&"
+ "/"
+ "\\"
+ "."
+ "!"
+ "-"
+ "+"
+ "^"
+ "?"
+ "*"
+ "{"
+ "}"
+ "("
+ ")"
+ ">"
+ "<"
+ "<>"
+ ">="
+ "<="
+ "<<"
+ ">>"
+ "+="
+ "^="
+ "-="
+ "*="
+ "/="
+ "\\="
+ "<<="
+ ">>="
+ "&="
+
+ /* ----- keywords ----- */
+ "AddHandler"
+ "AddressOf"
+ "Aggregate"
+ "Alias"
+ "And"
+ "AndAlso"
+ "Ansi"
+ "As"
+ "Ascending"
+ "Assembly"
+ "Auto"
+ "Binary"
+ "Boolean"
+ "ByRef"
+ "By"
+ "Byte"
+ "ByVal"
+ "Call"
+ "Case"
+ "Catch"
+ "CBool"
+ "CByte"
+ "CChar"
+ "CDate"
+ "CDbl"
+ "CDec"
+ "Char"
+ "CInt"
+ "Class"
+ "CLng"
+ "CObj"
+ "Compare"
+ "Const"
+ "Continue"
+ "CSByte"
+ "CShort"
+ "CSng"
+ "CStr"
+ "CType"
+ "CUInt"
+ "CULng"
+ "CUShort"
+ "Custom"
+ "Date"
+ "Decimal"
+ "Declare"
+ "Default"
+ "Delegate"
+ "Descending"
+ "Dim"
+ "DirectCast"
+ "Distinct"
+ "Do"
+ "Double"
+ "Each"
+ "Else"
+ "ElseIf"
+ "End"
+ "EndIf"
+ "Enum"
+ "Equals"
+ "Erase"
+ "Error"
+ "Event"
+ "Exit"
+ "Explicit"
+ "False"
+ "Finally"
+ "For"
+ "Friend"
+ "From"
+ "Function"
+ "Get"
+ "GetType"
+ "Global"
+ "GoSub"
+ "GoTo"
+ "Group"
+ "Handles"
+ "If"
+ "Implements"
+ "Imports"
+ "In"
+ "Infer"
+ "Inherits"
+ "Integer"
+ "Interface"
+ "Into"
+ "Is"
+ "IsNot"
+ "Join"
+ "Let"
+ "Lib"
+ "Like"
+ "Long"
+ "Loop"
+ "Me"
+ "Mod"
+ "Module"
+ "MustInherit"
+ "MustOverride"
+ "MyBase"
+ "MyClass"
+ "Namespace"
+ "Narrowing"
+ "New"
+ "Next"
+ "Not"
+ "Nothing"
+ "NotInheritable"
+ "NotOverridable"
+ "Object"
+ "Of"
+ "Off"
+ "On"
+ "Operator"
+ "Option"
+ "Optional"
+ "Or"
+ "Order"
+ "OrElse"
+ "Overloads"
+ "Overridable"
+ "Overrides"
+ "ParamArray"
+ "Partial"
+ "Preserve"
+ "Private"
+ "Property"
+ "Protected"
+ "Public"
+ "RaiseEvent"
+ "ReadOnly"
+ "ReDim"
+ "Rem"
+ "RemoveHandler"
+ "Resume"
+ "Return"
+ "SByte"
+ "Select"
+ "Set"
+ "Shadows"
+ "Shared"
+ "Short"
+ "Single"
+ "Skip"
+ "Static"
+ "Step"
+ "Stop"
+ "Strict"
+ "String"
+ "Structure"
+ "Sub"
+ "SyncLock"
+ "Take"
+ "Text"
+ "Then"
+ "Throw"
+ "To"
+ "True"
+ "Try"
+ "TryCast"
+ "TypeOf"
+ "UInteger"
+ "ULong"
+ "Unicode"
+ "Until"
+ "UShort"
+ "Using"
+ "Variant"
+ "Wend"
+ "When"
+ "Where"
+ "While"
+ "Widening"
+ "With"
+ "WithEvents"
+ "WriteOnly"
+ "Xor"
+/* END AUTOGENERATED TOKENS SECTION */
+
+PRODUCTIONS
+
+VBNET
+ (.
+ lexer.NextToken(); // get the first token
+ compilationUnit = new CompilationUnit();
+ .)
+=
+ { EndOfStmt }
+ { OptionStmt { EndOfStmt } }
+ { ImportsStmt { EndOfStmt } }
+ { IF (IsGlobalAttrTarget()) GlobalAttributeSection { EndOfStmt } }
+ { NamespaceMemberDecl { EndOfStmt } }
+ EOF
+.
+
+OptionStmt (. INode node = null; bool val = true; .) =
+ "Option" (. Location startPos = t.Location; .)
+ (
+ "Explicit" [ OptionValue<ref val> ]
+ (. node = new OptionDeclaration(OptionType.Explicit, val); .)
+ |
+ "Strict" [ OptionValue<ref val> ]
+ (. node = new OptionDeclaration(OptionType.Strict, val); .)
+ |
+ "Compare" ( "Binary" (. node = new OptionDeclaration(OptionType.CompareBinary, val); .)
+ | "Text" (. node = new OptionDeclaration(OptionType.CompareText, val); .)
+ )
+ |
+ "Infer" [ OptionValue<ref val> ]
+ (. node = new OptionDeclaration(OptionType.Infer, val); .)
+ )
+ EndOfStmt
+ (.
+ if (node != null) {
+ node.StartLocation = startPos;
+ node.EndLocation = t.Location;
+ compilationUnit.AddChild(node);
+ }
+ .)
+ .
+
+OptionValue<ref bool val> =
+ (
+ "On" (. val = true; .)
+ |
+ "Off" (. val = false; .)
+ )
+ .
+
+EndOfStmt =
+ EOL
+|
+ ":"
+.
+
+ImportsStmt
+ (.List<Using> usings = new List<Using>();
+ .) =
+ "Imports"
+ (.
+ Location startPos = t.Location;
+ Using u;
+ .)
+ ImportClause<out u> (. if (u != null) { usings.Add(u); } .)
+ {
+ "," ImportClause<out u> (. if (u != null) { usings.Add(u); } .)
+ }
+ EndOfStmt
+ (.
+ UsingDeclaration usingDeclaration = new UsingDeclaration(usings);
+ usingDeclaration.StartLocation = startPos;
+ usingDeclaration.EndLocation = t.Location;
+ compilationUnit.AddChild(usingDeclaration);
+ .)
+ .
+
+ImportClause<out Using u>
+ (.
+ string qualident = null;
+ TypeReference aliasedType = null;
+ u = null;
+ .) =
+ Qualident<out qualident>
+ [ "=" TypeName<out aliasedType> ]
+ (.
+ if (qualident != null && qualident.Length > 0) {
+ if (aliasedType != null) {
+ u = new Using(qualident, aliasedType);
+ } else {
+ u = new Using(qualident);
+ }
+ }
+ .)
+ .
+
+/* 6.4.2 */
+NamespaceMemberDecl
+ (.
+ ModifierList m = new ModifierList();
+ AttributeSection section;
+ List<AttributeSection> attributes = new List<AttributeSection>();
+ string qualident;
+ .) =
+ "Namespace"
+ (.
+ Location startPos = t.Location;
+ .)
+ Qualident<out qualident>
+ (.
+ INode node = new NamespaceDeclaration(qualident);
+ node.StartLocation = startPos;
+ compilationUnit.AddChild(node);
+ compilationUnit.BlockStart(node);
+ .)
+ EndOfStmt
+ NamespaceBody
+ (.
+ node.EndLocation = t.Location;
+ compilationUnit.BlockEnd();
+ .)
+ |
+ { AttributeSection<out section> (. attributes.Add(section); .) }
+ { TypeModifier<m> } NonModuleDeclaration<m, attributes>
+ .
+
+/* 4.9.1 */
+TypeParameterList<List<TemplateDefinition> templates>
+(.
+ TemplateDefinition template;
+.) =
+ [
+ IF (la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of)
+ "(" "Of" TypeParameter<out template>
+ (.
+ if (template != null) templates.Add(template);
+ .)
+ {
+ "," TypeParameter<out template>
+ (.
+ if (template != null) templates.Add(template);
+ .)
+ }
+ ")"
+ ]
+.
+
+/* 4.9.1 */
+TypeParameter<out TemplateDefinition template>
+=
+ Identifier (. template = new TemplateDefinition(t.val, null); .)
+ [TypeParameterConstraints<template>]
+.
+
+/* 4.9.2 */
+TypeParameterConstraints<TemplateDefinition template>
+(.
+ TypeReference constraint;
+.)
+=
+ "As"
+ (
+ "{"
+ TypeParameterConstraint<out constraint> (. if (constraint != null) { template.Bases.Add(constraint); } .)
+ {
+ ","
+ TypeParameterConstraint<out constraint> (. if (constraint != null) { template.Bases.Add(constraint); } .)
+ }
+ "}"
+ | TypeParameterConstraint<out constraint> (. if (constraint != null) { template.Bases.Add(constraint); } .)
+ )
+.
+
+TypeParameterConstraint<out TypeReference constraint>
+(. constraint = null; .)
+= "Class" (. constraint = TypeReference.ClassConstraint; .)
+| "Structure" (. constraint = TypeReference.StructConstraint; .)
+| "New" (. constraint = TypeReference.NewConstraint; .)
+| TypeName<out constraint>
+.
+
+/* 6.4.2 */
+NonModuleDeclaration<ModifierList m, List<AttributeSection> attributes>
+ (.
+ TypeReference typeRef = null;
+ List<TypeReference> baseInterfaces = null;
+ .) =
+ (. m.Check(Modifiers.Classes); .)
+ /* Spec, 7.5 */
+ "Class"
+ (. TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
+ newType.StartLocation = t.Location;
+ compilationUnit.AddChild(newType);
+ compilationUnit.BlockStart(newType);
+
+ newType.Type = ClassType.Class;
+ .)
+ Identifier (. newType.Name = t.val; .)
+ TypeParameterList<newType.Templates>
+ EndOfStmt
+ (. newType.BodyStartLocation = t.Location; .)
+ [ ClassBaseType<out typeRef> (. SafeAdd(newType, newType.BaseTypes, typeRef); .) ]
+ { TypeImplementsClause<out baseInterfaces> (. newType.BaseTypes.AddRange(baseInterfaces); .) }
+ ClassBody<newType>
+ "End" "Class" (. newType.EndLocation = t.EndLocation; .)
+ EndOfStmt
+ (.
+ compilationUnit.BlockEnd();
+ .)
+ | "Module"
+ (.
+ m.Check(Modifiers.VBModules);
+ TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
+ compilationUnit.AddChild(newType);
+ compilationUnit.BlockStart(newType);
+ newType.StartLocation = m.GetDeclarationLocation(t.Location);
+ newType.Type = ClassType.Module;
+ .)
+ Identifier (. newType.Name = t.val; .)
+ EndOfStmt
+ (. newType.BodyStartLocation = t.Location; .)
+ ModuleBody<newType>
+ (.
+ compilationUnit.BlockEnd();
+ .)
+ | "Structure"
+ (.
+ m.Check(Modifiers.VBStructures);
+ TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
+ compilationUnit.AddChild(newType);
+ compilationUnit.BlockStart(newType);
+ newType.StartLocation = m.GetDeclarationLocation(t.Location);
+ newType.Type = ClassType.Struct;
+ .)
+ Identifier (. newType.Name = t.val; .)
+ TypeParameterList<newType.Templates>
+ EndOfStmt
+ (. newType.BodyStartLocation = t.Location; .)
+ { TypeImplementsClause<out baseInterfaces> (. newType.BaseTypes.AddRange(baseInterfaces);.) }
+ StructureBody<newType>
+ (.
+ compilationUnit.BlockEnd();
+ .)
+ | /* 7.4 */
+ "Enum"
+ (.
+ m.Check(Modifiers.VBEnums);
+ TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
+ newType.StartLocation = m.GetDeclarationLocation(t.Location);
+ compilationUnit.AddChild(newType);
+ compilationUnit.BlockStart(newType);
+
+ newType.Type = ClassType.Enum;
+ .)
+ Identifier (. newType.Name = t.val; .)
+ [ "As" NonArrayTypeName<out typeRef, false> (. SafeAdd(newType, newType.BaseTypes, typeRef); .) ]
+ EndOfStmt
+ (. newType.BodyStartLocation = t.Location; .)
+ EnumBody<newType>
+ (.
+ compilationUnit.BlockEnd();
+ .)
+ | /* 7.8 */
+ "Interface"
+ (.
+ m.Check(Modifiers.VBInterfacs);
+ TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
+ newType.StartLocation = m.GetDeclarationLocation(t.Location);
+ compilationUnit.AddChild(newType);
+ compilationUnit.BlockStart(newType);
+ newType.Type = ClassType.Interface;
+ .)
+ Identifier (. newType.Name = t.val; .)
+ TypeParameterList<newType.Templates>
+ EndOfStmt
+ (. newType.BodyStartLocation = t.Location; .)
+ { InterfaceBase<out baseInterfaces> (. newType.BaseTypes.AddRange(baseInterfaces); .) }
+ InterfaceBody<newType>
+ (.
+ compilationUnit.BlockEnd();
+ .)
+ | /* 7.10 */
+ "Delegate"
+ (.
+ m.Check(Modifiers.VBDelegates);
+ DelegateDeclaration delegateDeclr = new DelegateDeclaration(m.Modifier, attributes);
+ delegateDeclr.ReturnType = new TypeReference("System.Void", true);
+ delegateDeclr.StartLocation = m.GetDeclarationLocation(t.Location);
+ List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
+ .)
+ (
+ "Sub" Identifier (. delegateDeclr.Name = t.val; .)
+ TypeParameterList<delegateDeclr.Templates>
+ [ "(" [ FormalParameterList<p> ] ")" (. delegateDeclr.Parameters = p; .) ]
+ |
+ "Function" Identifier (. delegateDeclr.Name = t.val; .)
+ TypeParameterList<delegateDeclr.Templates>
+ [ "(" [ FormalParameterList<p> ] ")" (. delegateDeclr.Parameters = p; .) ]
+ [ "As" (. TypeReference type; .) TypeName<out type> (. delegateDeclr.ReturnType = type; .)]
+ )
+ (. delegateDeclr.EndLocation = t.EndLocation; .)
+ EndOfStmt
+ (.
+ compilationUnit.AddChild(delegateDeclr);
+ .)
+ .
+
+NamespaceBody =
+ { EndOfStmt } /* allow empty lines at begin of body */
+ {
+ NamespaceMemberDecl
+ { EndOfStmt } /* allow empty lines in body */
+ }
+ "End" "Namespace"
+ EndOfStmt
+ .
+
+ClassBody<TypeDeclaration newType>
+ (. AttributeSection section; .) =
+ { EndOfStmt } /* allow empty lines at begin of body */
+ {
+ (.List<AttributeSection> attributes = new List<AttributeSection>();
+ ModifierList m = new ModifierList();
+ .)
+ { AttributeSection<out section> (. attributes.Add(section); .) }
+ { MemberModifier<m> }
+ ClassMemberDecl<m, attributes>
+ { EndOfStmt } /* allow empty lines in body */
+ }
+ .
+
+StructureBody<TypeDeclaration newType>
+ (. AttributeSection section; .) =
+ { EndOfStmt } /* allow empty lines at begin of body */
+ {
+ (.List<AttributeSection> attributes = new List<AttributeSection>();
+ ModifierList m = new ModifierList();
+ .)
+ { AttributeSection<out section> (. attributes.Add(section); .) }
+ { MemberModifier<m> }
+ StructureMemberDecl<m, attributes>
+ { EndOfStmt } /* allow empty lines in body */
+ }
+ "End" "Structure" (. newType.EndLocation = t.EndLocation; .)
+ EndOfStmt
+ .
+
+/* 7.7.1 */
+ModuleBody<TypeDeclaration newType>
+ (. AttributeSection section; .) =
+ { EndOfStmt } /* allow empty lines at begin of body */
+ {
+ (.List<AttributeSection> attributes = new List<AttributeSection>();
+ ModifierList m = new ModifierList();
+ .)
+ { AttributeSection<out section> (. attributes.Add(section); .) }
+ { MemberModifier<m> }
+ ClassMemberDecl<m, attributes>
+ { EndOfStmt } /* allow empty lines in body */
+ }
+ "End" "Module" (. newType.EndLocation = t.EndLocation; .)
+ EndOfStmt
+ .
+
+EnumBody<TypeDeclaration newType>
+ (. FieldDeclaration f; .) =
+ { EndOfStmt } /* allow empty lines at begin of body */
+ {
+ EnumMemberDecl<out f>
+ (.
+ compilationUnit.AddChild(f);
+ .)
+ { EndOfStmt } /* allow empty lines in body */
+ }
+ "End" "Enum" (. newType.EndLocation = t.EndLocation; .)
+ EndOfStmt
+ .
+
+InterfaceBody<TypeDeclaration newType> =
+ { EndOfStmt } /* allow empty lines at begin of body */
+ {
+ InterfaceMemberDecl
+ { EndOfStmt } /* allow empty lines in body */
+ }
+ "End" "Interface" (. newType.EndLocation = t.EndLocation; .)
+ EndOfStmt
+ .
+
+/* The information provided in the spec about */
+/* interface declarations is wrong */
+InterfaceMemberDecl
+ (.
+ TypeReference type =null;
+ List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
+ List<TemplateDefinition> templates = new List<TemplateDefinition>();
+ AttributeSection section, returnTypeAttributeSection = null;
+ ModifierList mod = new ModifierList();
+ List<AttributeSection> attributes = new List<AttributeSection>();
+ string name;
+ .) =
+ { AttributeSection<out section> (. attributes.Add(section); .) }
+ /* this is different to c#: not only the Shadows modifier is allowed, */
+ /* also member modifiers like overloads etc. */
+ { MemberModifier<mod> }
+ (
+ "Event"
+ (.
+ mod.Check(Modifiers.VBInterfaceEvents);
+ Location startLocation = t.Location;
+ .)
+ Identifier (. name = t.val; .)
+ [ "(" [ FormalParameterList<p> ] ")" ]
+ [ "As" TypeName<out type> ]
+ EndOfStmt
+ (.
+ EventDeclaration ed = new EventDeclaration {
+ Name = name, TypeReference = type, Modifier = mod.Modifier,
+ Parameters = p, Attributes = attributes,
+ StartLocation = startLocation, EndLocation = t.EndLocation
+ };
+ compilationUnit.AddChild(ed);
+ .)
+ |
+ "Sub"
+ (.
+ Location startLocation = t.Location;
+ mod.Check(Modifiers.VBInterfaceMethods);
+ .)
+ Identifier (. name = t.val; .)
+ TypeParameterList<templates>
+ [ "(" [ FormalParameterList<p> ] ")" ]
+ EndOfStmt
+ (.
+ MethodDeclaration md = new MethodDeclaration {
+ Name = name,
+ Modifier = mod.Modifier,
+ Parameters = p,
+ Attributes = attributes,
+ TypeReference = new TypeReference("System.Void", true),
+ StartLocation = startLocation,
+ EndLocation = t.EndLocation,
+ Templates = templates
+ };
+ compilationUnit.AddChild(md);
+ .)
+ |
+ "Function"
+ (.
+ mod.Check(Modifiers.VBInterfaceMethods);
+ Location startLocation = t.Location;
+ .)
+ Identifier (. name = t.val; .)
+ TypeParameterList<templates>
+ [ "(" [ FormalParameterList<p> ] ")" ]
+ [ "As" { AttributeSection<out returnTypeAttributeSection> } TypeName<out type> ]
+ (.
+ if(type == null) {
+ type = new TypeReference("System.Object", true);
+ }
+ MethodDeclaration md = new MethodDeclaration {
+ Name = name, Modifier = mod.Modifier,
+ TypeReference = type, Parameters = p, Attributes = attributes
+ };
+ if (returnTypeAttributeSection != null) {
+ returnTypeAttributeSection.AttributeTarget = "return";
+ md.Attributes.Add(returnTypeAttributeSection);
+ }
+ md.StartLocation = startLocation;
+ md.EndLocation = t.EndLocation;
+ md.Templates = templates;
+ compilationUnit.AddChild(md);
+ .)
+ EndOfStmt
+ |
+ "Property"
+ (.
+ Location startLocation = t.Location;
+ mod.Check(Modifiers.VBInterfaceProperties);
+ .)
+ Identifier (. name = t.val; .)
+ [ "(" [ FormalParameterList<p> ] ")" ]
+ [ "As" TypeName<out type> ]
+ (.
+ if(type == null) {
+ type = new TypeReference("System.Object", true);
+ }
+ .)
+ EndOfStmt
+ (.
+ PropertyDeclaration pd = new PropertyDeclaration(name, type, mod.Modifier, attributes);
+ pd.Parameters = p;
+ pd.EndLocation = t.EndLocation;
+ pd.StartLocation = startLocation;
+ compilationUnit.AddChild(pd);
+ .)
+ )
+ | /* inner type declarations */
+ NonModuleDeclaration<mod, attributes>
+ .
+
+/* 7.4.1 */
+EnumMemberDecl<out FieldDeclaration f>
+ (.
+ Expression expr = null;List<AttributeSection> attributes = new List<AttributeSection>();
+ AttributeSection section = null;
+ VariableDeclaration varDecl = null;
+ .) =
+ { AttributeSection<out section> (. attributes.Add(section); .) }
+ Identifier
+ (.
+ f = new FieldDeclaration(attributes);
+ varDecl = new VariableDeclaration(t.val);
+ f.Fields.Add(varDecl);
+ f.StartLocation = varDecl.StartLocation = t.Location;
+ .)
+ [ "=" Expr<out expr> (. varDecl.Initializer = expr; .) ]
+ EndOfStmt
+ .
+
+ClassMemberDecl<ModifierList m, List<AttributeSection> attributes> =
+ StructureMemberDecl<m, attributes>
+ .
+
+ClassBaseType<out TypeReference typeRef>
+(.
+ typeRef = null;
+.) =
+ "Inherits"
+ TypeName<out typeRef>
+ EndOfStmt
+.
+
+/* 7.6.1 */
+StructureMemberDecl<ModifierList m, List<AttributeSection> attributes>
+ (.
+ TypeReference type = null;
+ List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
+ Statement stmt = null;
+ List<VariableDeclaration> variableDeclarators = new List<VariableDeclaration>();
+ List<TemplateDefinition> templates = new List<TemplateDefinition>();
+ .)
+=
+ NonModuleDeclaration<m, attributes>
+| /* 9.2.1 */
+ "Sub"
+ (.
+ Location startPos = t.Location;
+ .)
+ (
+ (.
+ string name = String.Empty;
+ MethodDeclaration methodDeclaration; List<string> handlesClause = null;
+ List<InterfaceImplementation> implementsClause = null;
+ .)
+ Identifier
+ (.
+ name = t.val;
+ m.Check(Modifiers.VBMethods);
+ .)
+ TypeParameterList<templates>
+ [ "(" [ FormalParameterList<p> ] ")" ]
+ [
+ (
+ ImplementsClause<out implementsClause>
+ |
+ HandlesClause<out handlesClause>
+ )
+ ]
+ (. Location endLocation = t.EndLocation; .)
+ (
+ /* abstract methods without a body */
+ IF(IsMustOverride(m))
+ EndOfStmt
+ (.
+ methodDeclaration = new MethodDeclaration {
+ Name = name, Modifier = m.Modifier, Parameters = p, Attributes = attributes,
+ StartLocation = m.GetDeclarationLocation(startPos), EndLocation = endLocation,
+ TypeReference = new TypeReference("System.Void", true),
+ Templates = templates,
+ HandlesClause = handlesClause,
+ InterfaceImplementations = implementsClause
+ };
+ compilationUnit.AddChild(methodDeclaration);
+ .)
+ |
+ EOL
+ (.
+ methodDeclaration = new MethodDeclaration {
+ Name = name, Modifier = m.Modifier, Parameters = p, Attributes = attributes,
+ StartLocation = m.GetDeclarationLocation(startPos), EndLocation = endLocation,
+ TypeReference = new TypeReference("System.Void", true),
+ Templates = templates,
+ HandlesClause = handlesClause,
+ InterfaceImplementations = implementsClause
+ };
+ compilationUnit.AddChild(methodDeclaration);
+ .)
+
+ (. if (ParseMethodBodies) { .)
+ Block<out stmt>
+ "End" "Sub"
+ (. } else {
+ // don't parse method body
+ lexer.SkipCurrentBlock(Tokens.Sub); stmt = new BlockStatement();
+ }
+ .)
+
+ (. methodDeclaration.Body = (BlockStatement)stmt; .)
+ (. methodDeclaration.Body.EndLocation = t.EndLocation; .)
+ EndOfStmt
+ )
+ /* 9.3 */
+ | "New" [ "(" [ FormalParameterList<p> ] ")" ]
+ (. m.Check(Modifiers.Constructors); .)
+ (. Location constructorEndLocation = t.EndLocation; .)
+ EOL
+
+ (. if (ParseMethodBodies) { .)
+ Block<out stmt>
+ "End" "Sub"
+ (. } else {
+ // don't parse method body
+ lexer.SkipCurrentBlock(Tokens.Sub); stmt = new BlockStatement();
+ }
+ .)
+
+ (. Location endLocation = t.EndLocation; .)
+ EndOfStmt
+ (.
+ ConstructorDeclaration cd = new ConstructorDeclaration("New", m.Modifier, p, attributes);
+ cd.StartLocation = m.GetDeclarationLocation(startPos);
+ cd.EndLocation = constructorEndLocation;
+ cd.Body = (BlockStatement)stmt;
+ cd.Body.EndLocation = endLocation;
+ compilationUnit.AddChild(cd);
+ .)
+ )
+|
+ /* 9.2.1 */
+ "Function"
+ (.
+ m.Check(Modifiers.VBMethods);
+ string name = String.Empty;
+ Location startPos = t.Location;
+ MethodDeclaration methodDeclaration;List<string> handlesClause = null;
+ List<InterfaceImplementation> implementsClause = null;
+ AttributeSection returnTypeAttributeSection = null;
+ .)
+ Identifier (. name = t.val; .)
+ TypeParameterList<templates>
+ [ "(" [ FormalParameterList<p> ] ")" ]
+ ["As" { AttributeSection<out returnTypeAttributeSection> } TypeName<out type> ]
+ (.
+ if(type == null) {
+ type = new TypeReference("System.Object", true);
+ }
+ .)
+ [
+ (
+ ImplementsClause<out implementsClause>
+ |
+ HandlesClause<out handlesClause>
+ )
+ ]
+ (
+ /* abstract methods without a body */
+ IF(IsMustOverride(m))
+ EndOfStmt
+ (.
+ methodDeclaration = new MethodDeclaration {
+ Name = name, Modifier = m.Modifier, TypeReference = type,
+ Parameters = p, Attributes = attributes,
+ StartLocation = m.GetDeclarationLocation(startPos),
+ EndLocation = t.EndLocation,
+ HandlesClause = handlesClause,
+ Templates = templates,
+ InterfaceImplementations = implementsClause
+ };
+ if (returnTypeAttributeSection != null) {
+ returnTypeAttributeSection.AttributeTarget = "return";
+ methodDeclaration.Attributes.Add(returnTypeAttributeSection);
+ }
+ compilationUnit.AddChild(methodDeclaration);
+ .)
+ |
+ EOL
+ (.
+ methodDeclaration = new MethodDeclaration {
+ Name = name, Modifier = m.Modifier, TypeReference = type,
+ Parameters = p, Attributes = attributes,
+ StartLocation = m.GetDeclarationLocation(startPos),
+ EndLocation = t.EndLocation,
+ Templates = templates,
+ HandlesClause = handlesClause,
+ InterfaceImplementations = implementsClause
+ };
+ if (returnTypeAttributeSection != null) {
+ returnTypeAttributeSection.AttributeTarget = "return";
+ methodDeclaration.Attributes.Add(returnTypeAttributeSection);
+ }
+
+ compilationUnit.AddChild(methodDeclaration);
+
+ if (ParseMethodBodies) { .)
+ Block<out stmt>
+ "End" "Function"
+ (. } else {
+ // don't parse method body
+ lexer.SkipCurrentBlock(Tokens.Function); stmt = new BlockStatement();
+ }
+ methodDeclaration.Body = (BlockStatement)stmt;
+ methodDeclaration.Body.StartLocation = methodDeclaration.EndLocation;
+ methodDeclaration.Body.EndLocation = t.EndLocation;
+ .)
+ EndOfStmt
+ )
+|
+ /* 9.2.2. */
+ "Declare"
+ (.
+ m.Check(Modifiers.VBExternalMethods);
+ Location startPos = t.Location;
+ CharsetModifier charsetModifer = CharsetModifier.None;
+ string library = String.Empty;
+ string alias = null;
+ string name = String.Empty;
+ .)
+ [Charset<out charsetModifer> ]
+ (
+ "Sub"
+ Identifier (. name = t.val; .)
+ "Lib" LiteralString (. library = t.literalValue as string; .)
+ ["Alias" LiteralString (. alias = t.literalValue as string; .)]
+ [ "(" [ FormalParameterList<p> ] ")" ]
+ EndOfStmt
+ (.
+ DeclareDeclaration declareDeclaration = new DeclareDeclaration(name, m.Modifier, null, p, attributes, library, alias, charsetModifer);
+ declareDeclaration.StartLocation = m.GetDeclarationLocation(startPos);
+ declareDeclaration.EndLocation = t.EndLocation;
+ compilationUnit.AddChild(declareDeclaration);
+ .)
+ |
+ "Function"
+ Identifier (. name = t.val; .)
+ "Lib" LiteralString (. library = t.literalValue as string; .)
+ ["Alias" LiteralString (. alias = t.literalValue as string; .)]
+ [ "(" [ FormalParameterList<p> ] ")" ]
+ ["As" TypeName<out type> ]
+ EndOfStmt
+ (.
+ DeclareDeclaration declareDeclaration = new DeclareDeclaration(name, m.Modifier, type, p, attributes, library, alias, charsetModifer);
+ declareDeclaration.StartLocation = m.GetDeclarationLocation(startPos);
+ declareDeclaration.EndLocation = t.EndLocation;
+ compilationUnit.AddChild(declareDeclaration);
+ .)
+ )
+|
+ /* 9. 4 */
+ "Event"
+ (.
+ m.Check(Modifiers.VBEvents);
+ Location startPos = t.Location;
+ EventDeclaration eventDeclaration;
+ string name = String.Empty;
+ List<InterfaceImplementation> implementsClause = null;
+ .)
+ Identifier (. name= t.val; .)
+ (
+ "As" TypeName<out type>
+ |
+ [ "(" [ FormalParameterList<p> ] ")" ]
+ )
+ [ ImplementsClause<out implementsClause> ]
+ (.
+ eventDeclaration = new EventDeclaration {
+ Name = name, TypeReference = type, Modifier = m.Modifier,
+ Parameters = p, Attributes = attributes, InterfaceImplementations = implementsClause,
+ StartLocation = m.GetDeclarationLocation(startPos),
+ EndLocation = t.EndLocation
+ };
+ compilationUnit.AddChild(eventDeclaration);
+ .)
+ EndOfStmt
+| /* 9.6 */
+ (. Location startPos = t.Location; .)
+ (.
+ m.Check(Modifiers.Fields);
+ FieldDeclaration fd = new FieldDeclaration(attributes, null, m.Modifier);
+ fd.StartLocation = m.GetDeclarationLocation(startPos);
+ .)
+ IdentifierForFieldDeclaration (. string name = t.val; .)
+ VariableDeclaratorPartAfterIdentifier<variableDeclarators, name>
+ { "," VariableDeclarator<variableDeclarators> }
+ EndOfStmt
+ (.
+ fd.EndLocation = t.EndLocation;
+ fd.Fields = variableDeclarators;
+ compilationUnit.AddChild(fd);
+ .)
+ | /* 9.4 */
+ (. m.Check(Modifiers.Fields); .)
+ "Const" (. m.Add(Modifiers.Const, t.Location); .)
+ (.
+ FieldDeclaration fd = new FieldDeclaration(attributes, type, m.Modifier);
+ fd.StartLocation = m.GetDeclarationLocation(t.Location);
+ List<VariableDeclaration> constantDeclarators = new List<VariableDeclaration>();
+ .)
+ ConstantDeclarator<constantDeclarators>
+ { "," ConstantDeclarator<constantDeclarators> }
+ (.
+ fd.Fields = constantDeclarators;
+ fd.EndLocation = t.Location;
+ .)
+ EndOfStmt
+ (.
+ fd.EndLocation = t.EndLocation;
+ compilationUnit.AddChild(fd);
+ .)
+| /* 9.7 */
+ "Property"
+ (.
+ m.Check(Modifiers.VBProperties);
+ Location startPos = t.Location;
+ List<InterfaceImplementation> implementsClause = null;
+ .)
+ Identifier (. string propertyName = t.val; .)
+ [ "(" [ FormalParameterList<p> ] ")" ]
+ [ "As" TypeName<out type> ]
+ (.
+ if(type == null) {
+ type = new TypeReference("System.Object", true);
+ }
+ .)
+ [ ImplementsClause<out implementsClause> ]
+ EndOfStmt
+ (
+ /* abstract properties without a body */
+ IF(IsMustOverride(m))
+ (.
+ PropertyDeclaration pDecl = new PropertyDeclaration(propertyName, type, m.Modifier, attributes);
+ pDecl.StartLocation = m.GetDeclarationLocation(startPos);
+ pDecl.EndLocation = t.Location;
+ pDecl.TypeReference = type;
+ pDecl.InterfaceImplementations = implementsClause;
+ pDecl.Parameters = p;
+ compilationUnit.AddChild(pDecl);
+ .)
+ |
+ (.
+ PropertyDeclaration pDecl = new PropertyDeclaration(propertyName, type, m.Modifier, attributes);
+ pDecl.StartLocation = m.GetDeclarationLocation(startPos);
+ pDecl.EndLocation = t.Location;
+ pDecl.BodyStart = t.Location;
+ pDecl.TypeReference = type;
+ pDecl.InterfaceImplementations = implementsClause;
+ pDecl.Parameters = p;
+ PropertyGetRegion getRegion;
+ PropertySetRegion setRegion;
+ .)
+ AccessorDecls<out getRegion, out setRegion>
+ "End" "Property"
+ EndOfStmt
+ (.
+ pDecl.GetRegion = getRegion;
+ pDecl.SetRegion = setRegion;
+ pDecl.BodyEnd = t.EndLocation;
+ compilationUnit.AddChild(pDecl);
+ .)
+ )
+|
+ "Custom" (. Location startPos = t.Location; .) "Event"
+ (.
+ m.Check(Modifiers.VBCustomEvents);
+ EventAddRemoveRegion eventAccessorDeclaration;
+ EventAddRegion addHandlerAccessorDeclaration = null;
+ EventRemoveRegion removeHandlerAccessorDeclaration = null;
+ EventRaiseRegion raiseEventAccessorDeclaration = null;
+ List<InterfaceImplementation> implementsClause = null;
+ .)
+ Identifier (. string customEventName = t.val; .)
+ "As" TypeName<out type>
+ [ ImplementsClause<out implementsClause> ]
+ EndOfStmt
+ {
+ EventAccessorDeclaration<out eventAccessorDeclaration>
+ (.
+ if(eventAccessorDeclaration is EventAddRegion)
+ {
+ addHandlerAccessorDeclaration = (EventAddRegion)eventAccessorDeclaration;
+ }
+ else if(eventAccessorDeclaration is EventRemoveRegion)
+ {
+ removeHandlerAccessorDeclaration = (EventRemoveRegion)eventAccessorDeclaration;
+ }
+ else if(eventAccessorDeclaration is EventRaiseRegion)
+ {
+ raiseEventAccessorDeclaration = (EventRaiseRegion)eventAccessorDeclaration;
+ }
+ .)
+ }
+ "End" "Event" EndOfStmt
+ (.
+ if(addHandlerAccessorDeclaration == null)
+ {
+ Error("Need to provide AddHandler accessor.");
+ }
+
+ if(removeHandlerAccessorDeclaration == null)
+ {
+ Error("Need to provide RemoveHandler accessor.");
+ }
+
+ if(raiseEventAccessorDeclaration == null)
+ {
+ Error("Need to provide RaiseEvent accessor.");
+ }
+
+ EventDeclaration decl = new EventDeclaration {
+ TypeReference = type, Name = customEventName, Modifier = m.Modifier,
+ Attributes = attributes,
+ StartLocation = m.GetDeclarationLocation(startPos),
+ EndLocation = t.EndLocation,
+ AddRegion = addHandlerAccessorDeclaration,
+ RemoveRegion = removeHandlerAccessorDeclaration,
+ RaiseRegion = raiseEventAccessorDeclaration
+ };
+ compilationUnit.AddChild(decl);
+ .)
+| (. ConversionType opConversionType = ConversionType.None; .)
+ [ "Widening" (. opConversionType = ConversionType.Implicit; .)
+ | "Narrowing" (. opConversionType = ConversionType.Explicit;.) ]
+ "Operator"
+ (.
+ m.Check(Modifiers.VBOperators);
+ Location startPos = t.Location;
+ TypeReference returnType = NullTypeReference.Instance;
+ TypeReference operandType = NullTypeReference.Instance;
+ string operandName;
+ OverloadableOperatorType operatorType;
+ AttributeSection section;
+ List<ParameterDeclarationExpression> parameters = new List<ParameterDeclarationExpression>();
+ List<AttributeSection> returnTypeAttributes = new List<AttributeSection>();
+ .)
+ OverloadableOperator<out operatorType>
+ "(" [ "ByVal" ] Identifier (. operandName = t.val; .)
+ [ "As" TypeName<out operandType> ]
+ (. parameters.Add(new ParameterDeclarationExpression(operandType, operandName, ParameterModifiers.In)); .)
+
+ {
+ ","
+ [ "ByVal" ] Identifier (. operandName = t.val; .)
+ [ "As" TypeName<out operandType> ]
+ (. parameters.Add(new ParameterDeclarationExpression(operandType, operandName, ParameterModifiers.In)); .)
+ }
+ ")"
+ (. Location endPos = t.EndLocation; .)
+ [ "As" { AttributeSection<out section> (. returnTypeAttributes.Add(section); .) } TypeName<out returnType> (. endPos = t.EndLocation; .) ]
+ EOL
+ Block<out stmt> "End" "Operator" EndOfStmt
+ (.
+ OperatorDeclaration operatorDeclaration = new OperatorDeclaration {
+ Modifier = m.Modifier,
+ Attributes = attributes,
+ Parameters = parameters,
+ TypeReference = returnType,
+ OverloadableOperator = operatorType,
+ ConversionType = opConversionType,
+ ReturnTypeAttributes = returnTypeAttributes,
+ Body = (BlockStatement)stmt,
+ StartLocation = m.GetDeclarationLocation(startPos),
+ EndLocation = endPos
+ };
+ operatorDeclaration.Body.StartLocation = startPos;
+ operatorDeclaration.Body.EndLocation = t.Location;
+ compilationUnit.AddChild(operatorDeclaration);
+ .)
+.
+
+OverloadableOperator<out OverloadableOperatorType operatorType>
+ (. operatorType = OverloadableOperatorType.None; .)
+ =
+ "+" (. operatorType = OverloadableOperatorType.Add; .)
+ |
+ "-" (. operatorType = OverloadableOperatorType.Subtract; .)
+ |
+ "*" (. operatorType = OverloadableOperatorType.Multiply; .)
+ |
+ "/" (. operatorType = OverloadableOperatorType.Divide; .)
+ |
+ "\\" (. operatorType = OverloadableOperatorType.DivideInteger; .)
+ |
+ "&" (. operatorType = OverloadableOperatorType.Concat; .)
+ |
+ "Like" (. operatorType = OverloadableOperatorType.Like; .)
+ |
+ "Mod" (. operatorType = OverloadableOperatorType.Modulus; .)
+ |
+ "And" (. operatorType = OverloadableOperatorType.BitwiseAnd; .)
+ |
+ "Or" (. operatorType = OverloadableOperatorType.BitwiseOr; .)
+ |
+ "Xor" (. operatorType = OverloadableOperatorType.ExclusiveOr; .)
+ |
+ "^" (. operatorType = OverloadableOperatorType.Power; .)
+ |
+ "<<" (. operatorType = OverloadableOperatorType.ShiftLeft; .)
+ |
+ ">>" (. operatorType = OverloadableOperatorType.ShiftRight; .)
+ |
+ "=" (. operatorType = OverloadableOperatorType.Equality; .)
+ |
+ "<>" (. operatorType = OverloadableOperatorType.InEquality; .)
+ |
+ "<" (. operatorType = OverloadableOperatorType.LessThan; .)
+ |
+ "<=" (. operatorType = OverloadableOperatorType.LessThanOrEqual; .)
+ |
+ ">" (. operatorType = OverloadableOperatorType.GreaterThan; .)
+ |
+ ">=" (. operatorType = OverloadableOperatorType.GreaterThanOrEqual; .)
+ |
+ "CType" (. operatorType = OverloadableOperatorType.CType; .)
+ |
+ Identifier
+ (.
+ string opName = t.val;
+ if (string.Equals(opName, "istrue", StringComparison.InvariantCultureIgnoreCase)) {
+ operatorType = OverloadableOperatorType.IsTrue;
+ } else if (string.Equals(opName, "isfalse", StringComparison.InvariantCultureIgnoreCase)) {
+ operatorType = OverloadableOperatorType.IsFalse;
+ } else {
+ Error("Invalid operator. Possible operators are '+', '-', 'Not', 'IsTrue', 'IsFalse'.");
+ }
+ .)
+ .
+
+EventAccessorDeclaration<out EventAddRemoveRegion eventAccessorDeclaration>
+ (.
+ Statement stmt = null;
+ List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
+ AttributeSection section;
+ List<AttributeSection> attributes = new List<AttributeSection>();
+ eventAccessorDeclaration = null;
+ .) =
+ { AttributeSection<out section> (. attributes.Add(section); .) }
+ (
+ "AddHandler" [ "(" [ FormalParameterList<p> ] ")" ] EOL
+ Block<out stmt> "End" "AddHandler" EndOfStmt
+ (.
+ eventAccessorDeclaration = new EventAddRegion(attributes);
+ eventAccessorDeclaration.Block = (BlockStatement)stmt;
+ eventAccessorDeclaration.Parameters = p;
+ .)
+ |
+ "RemoveHandler" [ "(" [ FormalParameterList<p> ] ")" ] EOL
+ Block<out stmt> "End" "RemoveHandler" EndOfStmt
+ (.
+ eventAccessorDeclaration = new EventRemoveRegion(attributes);
+ eventAccessorDeclaration.Block = (BlockStatement)stmt;
+ eventAccessorDeclaration.Parameters = p;
+ .)
+ |
+ "RaiseEvent" [ "(" [ FormalParameterList<p> ] ")" ] EOL
+ Block<out stmt> "End" "RaiseEvent" EndOfStmt
+ (.
+ eventAccessorDeclaration = new EventRaiseRegion(attributes);
+ eventAccessorDeclaration.Block = (BlockStatement)stmt;
+ eventAccessorDeclaration.Parameters = p;
+ .)
+ )
+ .
+
+/* 9.7 */
+AccessorDecls<out PropertyGetRegion getBlock, out PropertySetRegion setBlock>
+ (.
+ List<AttributeSection> attributes = new List<AttributeSection>();
+ AttributeSection section;
+ getBlock = null;
+ setBlock = null;
+ .) =
+ { AttributeSection<out section> (. attributes.Add(section); .) }
+ (
+ GetAccessorDecl<out getBlock, attributes>
+ [
+ (. attributes = new List<AttributeSection>(); .)
+ { AttributeSection<out section> (. attributes.Add(section); .) }
+ SetAccessorDecl<out setBlock, attributes>
+ ]
+ |
+ SetAccessorDecl<out setBlock, attributes>
+ [
+ (. attributes = new List<AttributeSection>(); .)
+ { AttributeSection<out section> (. attributes.Add(section); .) }
+ GetAccessorDecl<out getBlock, attributes>
+ ]
+ )
+ .
+
+/* 9.7.1 */
+GetAccessorDecl<out PropertyGetRegion getBlock, List<AttributeSection> attributes>
+ (. Statement stmt = null; Modifiers m; .)
+=
+ PropertyAccessorAccessModifier<out m>
+ "Get"
+ (. Location startLocation = t.Location; .)
+ EOL
+ Block<out stmt>
+ (. getBlock = new PropertyGetRegion((BlockStatement)stmt, attributes); .)
+ "End" "Get"
+ (. getBlock.Modifier = m; .)
+ (. getBlock.StartLocation = startLocation; getBlock.EndLocation = t.EndLocation; .)
+ EndOfStmt
+ .
+
+/* 9.7.2 */
+SetAccessorDecl<out PropertySetRegion setBlock, List<AttributeSection> attributes>
+ (.
+ Statement stmt = null;
+ List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
+ Modifiers m;
+ .)
+=
+ PropertyAccessorAccessModifier<out m>
+ "Set"
+ (. Location startLocation = t.Location; .)
+ [ "(" [ FormalParameterList<p> ] ")" ]
+ EOL
+ Block<out stmt>
+ (.
+ setBlock = new PropertySetRegion((BlockStatement)stmt, attributes);
+ setBlock.Modifier = m;
+ setBlock.Parameters = p;
+ .)
+ "End" "Set"
+ (. setBlock.StartLocation = startLocation; setBlock.EndLocation = t.EndLocation; .)
+ EndOfStmt
+ .
+
+/* 9.5 */
+ConstantDeclarator<List<VariableDeclaration> constantDeclaration>
+ (.
+ Expression expr = null;
+ TypeReference type = null;
+ string name = String.Empty;
+ Location location;
+ .) =
+ Identifier (. name = t.val; location = t.Location; .)
+ ["As" TypeName<out type> ]
+ "=" Expr<out expr>
+ (.
+ VariableDeclaration f = new VariableDeclaration(name, expr);
+ f.TypeReference = type;
+ f.StartLocation = location;
+ constantDeclaration.Add(f);
+ .)
+.
+
+/* 9.6 */
+VariableDeclarator<List<VariableDeclaration> fieldDeclaration>
+=
+ Identifier (. string name = t.val; .)
+ VariableDeclaratorPartAfterIdentifier<fieldDeclaration, name>
+.
+
+VariableDeclaratorPartAfterIdentifier<List<VariableDeclaration> fieldDeclaration, string name>
+ (.
+ Expression expr = null;
+ TypeReference type = null;
+ ArrayList rank = null;
+ List<Expression> dimension = null;
+ Location startLocation = t.Location;
+ .) =
+ [ IF(IsSize() && !IsDims()) ArrayInitializationModifier<out dimension> ]
+ [ IF(IsDims()) ArrayNameModifier<out rank> ]
+ (
+ IF (IsObjectCreation()) "As" ObjectCreateExpression<out expr>
+ (.
+ if (expr is ObjectCreateExpression) {
+ type = ((ObjectCreateExpression)expr).CreateType.Clone();
+ } else {
+ type = ((ArrayCreateExpression)expr).CreateType.Clone();
+ }
+ .)
+ |
+ [ "As" TypeName<out type>
+ (.
+ if (type != null) {
+ for (int i = fieldDeclaration.Count - 1; i >= 0; i--) {
+ VariableDeclaration vd = fieldDeclaration[i];
+ if (vd.TypeReference.Type.Length > 0) break;
+ TypeReference newType = type.Clone();
+ newType.RankSpecifier = vd.TypeReference.RankSpecifier;
+ vd.TypeReference = newType;
+ }
+ }
+ .)
+ ]
+ (.
+ if (type == null && (dimension != null || rank != null)) {
+ type = new TypeReference("");
+ }
+ if (dimension != null) {
+ if(type.RankSpecifier != null) {
+ Error("array rank only allowed one time");
+ } else {
+ if (rank == null) {
+ type.RankSpecifier = new int[] { dimension.Count - 1 };
+ } else {
+ rank.Insert(0, dimension.Count - 1);
+ type.RankSpecifier = (int[])rank.ToArray(typeof(int));
+ }
+ expr = new ArrayCreateExpression(type.Clone(), dimension);
+ }
+ } else if (rank != null) {
+ if(type.RankSpecifier != null) {
+ Error("array rank only allowed one time");
+ } else {
+ type.RankSpecifier = (int[])rank.ToArray(typeof(int));
+ }
+ }
+ .)
+ [ "=" VariableInitializer<out expr> ]
+ )
+ (.
+ VariableDeclaration varDecl = new VariableDeclaration(name, expr, type);
+ varDecl.StartLocation = startLocation;
+ varDecl.EndLocation = t.Location;
+ fieldDeclaration.Add(varDecl);
+ .)
+.
+
+/* 6.8 */
+ArrayInitializationModifier<out List<Expression> arrayModifiers>
+(.
+ arrayModifiers = null;
+.) =
+ "(" InitializationRankList<out arrayModifiers> ")"
+.
+
+/* 7.5.4.3 */
+InitializationRankList<out List<Expression> rank>
+(.
+ rank = new List<Expression>();
+ Expression expr = null;
+.) =
+ Expr<out expr>
+ [ "To" (. EnsureIsZero(expr); .)
+ Expr<out expr>
+ ]
+ (. if (expr != null) { rank.Add(expr); } .)
+ { ","
+ Expr<out expr>
+ [ "To" (. EnsureIsZero(expr); .)
+ Expr<out expr>
+ ]
+ (. if (expr != null) { rank.Add(expr); } .)
+ }
+.
+
+/* 9.6.3 */
+VariableInitializer<out Expression initializerExpression>
+ (.
+ initializerExpression = null;
+ .) =
+ Expr<out initializerExpression>
+ | CollectionInitializer<out initializerExpression>
+ .
+
+/* 9.6.3.4 */
+CollectionInitializer<out Expression outExpr>
+ (.
+ Expression expr = null;
+ CollectionInitializerExpression initializer = new CollectionInitializerExpression();
+ .) =
+ "{"
+ [
+ VariableInitializer<out expr>
+ (.
+ if (expr != null) { initializer.CreateExpressions.Add(expr); }
+ .)
+ {
+ IF (NotFinalComma()) "," VariableInitializer<out expr>
+ (. if (expr != null) { initializer.CreateExpressions.Add(expr); } .)
+ }
+ ]
+ "}" (. outExpr = initializer; .)
+ .
+
+Charset<out CharsetModifier charsetModifier>
+ (. charsetModifier = CharsetModifier.None; .) =
+ | "Ansi" (. charsetModifier = CharsetModifier.Ansi; .)
+ | "Auto" (. charsetModifier = CharsetModifier.Auto; .)
+ | "Unicode" (. charsetModifier = CharsetModifier.Unicode; .)
+ .
+
+/* 9.2.6 */
+HandlesClause<out List<string> handlesClause>
+ (.
+ handlesClause = new List<string>();
+ string name;
+ .) =
+ "Handles" EventMemberSpecifier<out name> (. if (name != null) handlesClause.Add(name); .)
+ { "," EventMemberSpecifier<out name> (. if (name != null) handlesClause.Add(name); .) }
+ .
+
+/* 7.8. */
+InterfaceBase <out List<TypeReference> bases>
+ (.
+ TypeReference type;
+ bases = new List<TypeReference>();
+ .) =
+ "Inherits"
+ TypeName<out type> (. if (type != null) bases.Add(type); .)
+ {
+ ","
+ TypeName<out type> (. if (type != null) bases.Add(type); .)
+ }
+ EndOfStmt
+ .
+
+/* 7.2 */
+TypeImplementsClause<out List<TypeReference> baseInterfaces>
+ (.
+ baseInterfaces = new List<TypeReference>();
+ TypeReference type = null;
+ .) =
+ "Implements" TypeName<out type>
+ (.
+ if (type != null) baseInterfaces.Add(type);
+ .)
+ {
+ "," TypeName<out type>
+ (. if (type != null) baseInterfaces.Add(type); .)
+ }
+ EndOfStmt
+ .
+
+/* 9.1 */
+ImplementsClause<out List<InterfaceImplementation> baseInterfaces>
+ (.
+ baseInterfaces = new List<InterfaceImplementation>();
+ TypeReference type = null;
+ string memberName = null;
+ .) =
+ "Implements"
+ NonArrayTypeName<out type, false>
+ (. if (type != null) memberName = TypeReference.StripLastIdentifierFromType(ref type); .)
+ (. baseInterfaces.Add(new InterfaceImplementation(type, memberName)); .)
+ { ","
+ NonArrayTypeName<out type, false>
+ (. if (type != null) memberName = TypeReference.StripLastIdentifierFromType(ref type); .)
+ (. baseInterfaces.Add(new InterfaceImplementation(type, memberName)); .)
+ }
+.
+
+EventMemberSpecifier<out string name>
+(. string eventName; .)
+=
+ ( Identifier | "MyBase" | "Me" )
+ (. name = t.val; .)
+ "."
+ IdentifierOrKeyword<out eventName>
+ (. name = name + "." + eventName; .)
+.
+
+Expr<out Expression expr>
+ (. expr = null; .) =
+ IF ( IsQueryExpression() )
+ QueryExpr<out expr>
+ | LambdaExpr<out expr>
+ | DisjunctionExpr<out expr>
+.
+
+AssignmentOperator<out AssignmentOperatorType op>
+ (. op = AssignmentOperatorType.None; .) =
+ "=" (. op = AssignmentOperatorType.Assign; .)
+ | "&=" (. op = AssignmentOperatorType.ConcatString; .)
+ | "+=" (. op = AssignmentOperatorType.Add; .)
+ | "-=" (. op = AssignmentOperatorType.Subtract; .)
+ | "*=" (. op = AssignmentOperatorType.Multiply; .)
+ | "/=" (. op = AssignmentOperatorType.Divide; .)
+ | "\\=" (. op = AssignmentOperatorType.DivideInteger; .)
+ | "^=" (. op = AssignmentOperatorType.Power; .)
+ | "<<=" (. op = AssignmentOperatorType.ShiftLeft; .)
+ | ">>=" (. op = AssignmentOperatorType.ShiftRight; .)
+ .
+
+/* 11.4 */
+SimpleExpr<out Expression pexpr>
+(. string name; .)
+=
+ SimpleNonInvocationExpression<out pexpr>
+ {
+ "." IdentifierOrKeyword<out name>
+ (. pexpr = new MemberReferenceExpression(pexpr, name); .)
+ [ IF (la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of)
+ "(" "Of" TypeArgumentList<((MemberReferenceExpression)pexpr).TypeArguments> ")"
+ ]
+ | "!" IdentifierOrKeyword<out name> (. pexpr = new BinaryOperatorExpression(pexpr, BinaryOperatorType.DictionaryAccess, new PrimitiveExpression(name, name)); .)
+ | InvocationExpression<ref pexpr>
+ }
+.
+
+SimpleNonInvocationExpression<out Expression pexpr>
+(.
+ Expression expr;
+ TypeReference type = null;
+ string name = String.Empty;
+ pexpr = null;
+.) =
+ (
+ (
+ /* 11.4.1 */
+ LiteralString (.pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; .)
+ | LiteralCharacter (.pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; .)
+ | LiteralSingle (.pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; .)
+ | LiteralDouble (.pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; .)
+ | LiteralInteger (.pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; .)
+ | LiteralDate (.pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; .)
+ | LiteralDecimal (.pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; .)
+ /* True, False and Nothing are handled as literals in the spec */
+ | "True" (.pexpr = new PrimitiveExpression(true, "true"); .)
+ | "False" (.pexpr = new PrimitiveExpression(false, "false"); .)
+ | "Nothing" (.pexpr = new PrimitiveExpression(null, "null"); .)
+ | /* 11.4.2 */ "(" Expr<out expr> ")" (. pexpr = new ParenthesizedExpression(expr); .)
+ | /* 11.4.4 */ Identifier
+ (. pexpr = new IdentifierExpression(t.val);
+ pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation;
+ .)
+ [ IF (la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of)
+ "(" "Of" TypeArgumentList<((IdentifierExpression)pexpr).TypeArguments> ")"
+ ]
+ | (. string val = String.Empty; .)
+ ( PrimitiveTypeName<out val> | "Object" (. val = "System.Object"; .) )
+ (. pexpr = new TypeReferenceExpression(new TypeReference(val, true)); .)
+ | "Me" (. pexpr = new ThisReferenceExpression(); .)
+ | (. Expression retExpr = null; .)
+ ( "MyBase" (. retExpr = new BaseReferenceExpression(); .)
+ | "MyClass" (. retExpr = new ClassReferenceExpression(); .)
+ )
+ "." IdentifierOrKeyword<out name> (. pexpr = new MemberReferenceExpression(retExpr, name); .)
+ | "Global" "."
+ Identifier (. type = new TypeReference(t.val ?? ""); .)
+ /* fallback to "" is required if the token wasn't an identifier (->parser error but no exception) */
+ (. type.IsGlobal = true; .)
+ (. pexpr = new TypeReferenceExpression(type); .)
+ | ObjectCreateExpression<out expr> (. pexpr = expr; .)
+ | /* 11.11 : Casts */
+ (. CastType castType = CastType.Cast; .)
+ ( "DirectCast"
+ | "CType" (. castType = CastType.Conversion; .)
+ | "TryCast" (. castType = CastType.TryCast; .)
+ )
+ "(" Expr<out expr> "," TypeName<out type> ")"
+ (. pexpr = new CastExpression(type, expr, castType); .)
+ | /* 11.11 */ CastTarget<out type> "(" Expr<out expr> ")" (. pexpr = new CastExpression(type, expr, CastType.PrimitiveConversion); .)
+ | /* 11.4.5 */ "AddressOf" Expr<out expr> (. pexpr = new AddressOfExpression(expr); .)
+ | /* 11.5.1 */ "GetType" "(" GetTypeTypeName<out type> ")" (. pexpr = new TypeOfExpression(type); .)
+ | /* 11.5.2 */ "TypeOf" SimpleExpr<out expr> "Is" TypeName<out type> (. pexpr = new TypeOfIsExpression(expr, type); .)
+ | /* 11.22 */ ConditionalExpression<out pexpr>
+ )
+ |
+ /* this form only occurs in WithStatements*/
+ "." IdentifierOrKeyword<out name> (. pexpr = new MemberReferenceExpression(null, name);.)
+ )
+.
+
+ConditionalExpression<out Expression expr>
+ (.
+ ConditionalExpression conditionalExpression = new ConditionalExpression();
+ BinaryOperatorExpression binaryOperatorExpression = new BinaryOperatorExpression();
+ conditionalExpression.StartLocation = binaryOperatorExpression.StartLocation = la.Location;
+
+ Expression condition = null;
+ Expression trueExpr = null;
+ Expression falseExpr = null;
+ .)
+=
+ "If" "(" Expr<out condition> "," Expr<out trueExpr> [ "," Expr<out falseExpr> ] ")"
+ (.
+ if(falseExpr != null)
+ {
+ conditionalExpression.Condition = condition;
+ conditionalExpression.TrueExpression = trueExpr;
+ conditionalExpression.FalseExpression = falseExpr;
+ conditionalExpression.EndLocation = t.EndLocation;
+
+ expr = conditionalExpression;
+ }
+ else
+ {
+ binaryOperatorExpression.Left = condition;
+ binaryOperatorExpression.Right = trueExpr;
+ binaryOperatorExpression.Op = BinaryOperatorType.NullCoalescing;
+ binaryOperatorExpression.EndLocation = t.EndLocation;
+
+ expr = binaryOperatorExpression;
+ }
+ .)
+.
+
+InvocationExpression<ref Expression pexpr>
+(. List<Expression> parameters = null; .)
+=
+ "(" (. Location start = t.Location; .)
+ ArgumentList<out parameters>
+ ")"
+ (.
+ pexpr = new InvocationExpression(pexpr, parameters);
+ .)
+ (. pexpr.StartLocation = start; pexpr.EndLocation = t.Location; .)
+.
+
+/* 11.11 */
+
+CastTarget<out TypeReference type>
+ (.
+ type = null;
+ .) =
+ "CBool" (. type = new TypeReference("System.Boolean", true); .)
+ | "CByte" (. type = new TypeReference("System.Byte", true); .)
+ | "CSByte" (. type = new TypeReference("System.SByte", true); .)
+ | "CChar" (. type = new TypeReference("System.Char", true); .)
+ | "CDate" (. type = new TypeReference("System.DateTime", true); .)
+ | "CDec" (. type = new TypeReference("System.Decimal", true); .)
+ | "CDbl" (. type = new TypeReference("System.Double", true); .)
+ | "CShort" (. type = new TypeReference("System.Int16", true); .)
+ | "CInt" (. type = new TypeReference("System.Int32", true); .)
+ | "CLng" (. type = new TypeReference("System.Int64", true); .)
+ | "CUShort" (. type = new TypeReference("System.UInt16", true); .)
+ | "CUInt" (. type = new TypeReference("System.UInt32", true); .)
+ | "CULng" (. type = new TypeReference("System.UInt64", true); .)
+ | "CObj" (. type = new TypeReference("System.Object", true); .)
+ | "CSng" (. type = new TypeReference("System.Single", true); .)
+ | "CStr" (. type = new TypeReference("System.String", true); .)
+ .
+
+DisjunctionExpr<out Expression outExpr>
+(.
+ Expression expr;
+ BinaryOperatorType op = BinaryOperatorType.None;
+.) =
+ ConjunctionExpr<out outExpr>
+ {
+ (
+ "Or" (. op = BinaryOperatorType.BitwiseOr; .)
+ | "OrElse" (. op = BinaryOperatorType.LogicalOr; .)
+ | "Xor" (. op = BinaryOperatorType.ExclusiveOr; .)
+ )
+ ConjunctionExpr<out expr> (. outExpr = new BinaryOperatorExpression(outExpr, op, expr); .)
+ }
+.
+
+ConjunctionExpr<out Expression outExpr>
+(.
+ Expression expr;
+ BinaryOperatorType op = BinaryOperatorType.None;
+.) =
+ NotExpr<out outExpr>
+ {
+ (
+ "And" (. op = BinaryOperatorType.BitwiseAnd; .)
+ | "AndAlso" (. op = BinaryOperatorType.LogicalAnd; .)
+ )
+ NotExpr<out expr> (. outExpr = new BinaryOperatorExpression(outExpr, op, expr); .)
+ }
+.
+
+NotExpr<out Expression outExpr>
+ (. UnaryOperatorType uop = UnaryOperatorType.None; .) =
+ { "Not" (. uop = UnaryOperatorType.Not; .) }
+ ComparisonExpr<out outExpr>
+ (. if (uop != UnaryOperatorType.None)
+ outExpr = new UnaryOperatorExpression(outExpr, uop);
+ .)
+ .
+
+ComparisonExpr<out Expression outExpr>
+(.
+ Expression expr;
+ BinaryOperatorType op = BinaryOperatorType.None;
+.) =
+ ShiftExpr<out outExpr>
+ {
+ (
+ "<" (. op = BinaryOperatorType.LessThan; .)
+ | ">" (. op = BinaryOperatorType.GreaterThan; .)
+ | "<=" (. op = BinaryOperatorType.LessThanOrEqual; .)
+ | ">=" (. op = BinaryOperatorType.GreaterThanOrEqual; .)
+ | "<>" (. op = BinaryOperatorType.InEquality; .)
+ | "=" (. op = BinaryOperatorType.Equality; .)
+ | "Like" (. op = BinaryOperatorType.Like; .)
+ | "Is" (. op = BinaryOperatorType.ReferenceEquality; .)
+ | "IsNot" (. op = BinaryOperatorType.ReferenceInequality; .)
+ )
+ (
+ ShiftExpr<out expr> (. outExpr = new BinaryOperatorExpression(outExpr, op, expr); .)
+ |
+ "Not"
+ ShiftExpr<out expr> (. outExpr = new BinaryOperatorExpression(outExpr, op, new UnaryOperatorExpression(expr, UnaryOperatorType.Not)); .)
+ )
+ }
+.
+
+ShiftExpr<out Expression outExpr>
+ (.
+ Expression expr;
+ BinaryOperatorType op = BinaryOperatorType.None;
+ .) =
+ ConcatenationExpr<out outExpr>
+ {
+ (
+ "<<" (. op = BinaryOperatorType.ShiftLeft; .)
+ | ">>" (. op = BinaryOperatorType.ShiftRight; .)
+ )
+ ConcatenationExpr<out expr> (. outExpr = new BinaryOperatorExpression(outExpr, op, expr); .)
+ }
+ .
+
+ConcatenationExpr<out Expression outExpr>
+(. Expression expr; .)
+=
+ AdditiveExpr<out outExpr> { "&" AdditiveExpr<out expr> (. outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.Concat, expr); .) }
+.
+
+AdditiveExpr<out Expression outExpr>
+(.
+ Expression expr;
+ BinaryOperatorType op = BinaryOperatorType.None;
+.) =
+ ModuloExpr<out outExpr>
+ {
+ (
+ "+" (. op = BinaryOperatorType.Add; .)
+ | "-" (. op = BinaryOperatorType.Subtract; .)
+ )
+ ModuloExpr<out expr> (. outExpr = new BinaryOperatorExpression(outExpr, op, expr); .)
+ }
+.
+
+ModuloExpr<out Expression outExpr>
+(. Expression expr; .)
+=
+ IntegerDivisionExpr<out outExpr> { "Mod" IntegerDivisionExpr<out expr> (. outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.Modulus, expr); .) }
+.
+
+IntegerDivisionExpr<out Expression outExpr>
+(. Expression expr; .)
+=
+ MultiplicativeExpr<out outExpr> { "\\" MultiplicativeExpr<out expr> (. outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.DivideInteger, expr); .) }
+.
+
+MultiplicativeExpr<out Expression outExpr>
+(.
+ Expression expr;
+ BinaryOperatorType op = BinaryOperatorType.None;
+.) =
+ UnaryExpr<out outExpr>
+ {
+ (
+ "*" (. op = BinaryOperatorType.Multiply; .)
+ | "/" (. op = BinaryOperatorType.Divide; .)
+ )
+ UnaryExpr<out expr> (. outExpr = new BinaryOperatorExpression(outExpr, op, expr); .)
+ }
+.
+
+UnaryExpr<out Expression uExpr>
+(.
+ Expression expr;
+ UnaryOperatorType uop = UnaryOperatorType.None;
+ bool isUOp = false;
+.) =
+ { "+" (. uop = UnaryOperatorType.Plus; isUOp = true; .)
+ | "-" (. uop = UnaryOperatorType.Minus; isUOp = true; .)
+ | "*" (. uop = UnaryOperatorType.Dereference; isUOp = true;.)
+ }
+ ExponentiationExpr<out expr>
+ (.
+ if (isUOp) {
+ uExpr = new UnaryOperatorExpression(expr, uop);
+ } else {
+ uExpr = expr;
+ }
+ .)
+.
+
+ExponentiationExpr<out Expression outExpr>
+(. Expression expr; .)
+=
+ SimpleExpr<out outExpr> { "^" SimpleExpr<out expr> (. outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.Power, expr); .) }
+.
+
+ObjectCreateExpression<out Expression oce>
+(.
+ TypeReference type = null;
+ Expression initializer = null;
+ List<Expression> arguments = null;
+ ArrayList dimensions = null;
+ oce = null;
+ bool canBeNormal; bool canBeReDim;
+.) =
+ "New"
+ [ NonArrayTypeName<out type, false>
+ ["(" NormalOrReDimArgumentList<out arguments, out canBeNormal, out canBeReDim> ")"
+ [ IF (la.kind == Tokens.OpenParenthesis)
+ ArrayTypeModifiers<out dimensions>
+ CollectionInitializer<out initializer>
+ | CollectionInitializer<out initializer>
+ ]
+ (. if (canBeReDim && !canBeNormal && initializer == null) initializer = new CollectionInitializerExpression(); .)
+ ]
+ ]
+ (.
+ if (initializer == null) {
+ oce = new ObjectCreateExpression(type, arguments);
+ } else {
+ if (dimensions == null) dimensions = new ArrayList();
+ dimensions.Insert(0, (arguments == null) ? 0 : Math.Max(arguments.Count - 1, 0));
+ type.RankSpecifier = (int[])dimensions.ToArray(typeof(int));
+ ArrayCreateExpression ace = new ArrayCreateExpression(type, initializer as CollectionInitializerExpression);
+ ace.Arguments = arguments;
+ oce = ace;
+ }
+ .)
+
+ [
+ (.
+ NamedArgumentExpression memberInitializer = null;
+ .)
+ "With"
+ (.
+ CollectionInitializerExpression memberInitializers = new CollectionInitializerExpression();
+ memberInitializers.StartLocation = la.Location;
+ .)
+ "{"
+ MemberInitializer<out memberInitializer>
+ (. memberInitializers.CreateExpressions.Add(memberInitializer); .)
+ { ","
+ MemberInitializer<out memberInitializer>
+ (. memberInitializers.CreateExpressions.Add(memberInitializer); .)
+ }
+ "}"
+ (.
+ memberInitializers.EndLocation = t.Location;
+ if(oce is ObjectCreateExpression)
+ {
+ ((ObjectCreateExpression)oce).ObjectInitializer = memberInitializers;
+ }
+ .)
+ ]
+.
+
+LambdaExpr<out Expression expr>
+ (.
+ Expression inner = null;
+ LambdaExpression lambda = new LambdaExpression();
+ lambda.StartLocation = la.Location;
+ .) =
+
+ "Function"
+ [ "(" [ FormalParameterList<lambda.Parameters> ] ")" ]
+ Expr<out inner>
+ (.
+ lambda.ExpressionBody = inner;
+ lambda.EndLocation = t.EndLocation; // la.Location?
+
+ expr = lambda;
+ .)
+.
+
+QueryExpr<out Expression expr>
+ (.
+ QueryExpression qexpr = new QueryExpression();
+ qexpr.StartLocation = la.Location;
+ List<QueryExpressionClause> middleClauses = new List<QueryExpressionClause>();
+ expr = qexpr;
+ .) =
+ FromOrAggregateQueryOperator<middleClauses>
+ { QueryOperator<middleClauses> }
+ (.
+ qexpr.EndLocation = t.EndLocation;
+ .)
+.
+
+FromOrAggregateQueryOperator<List<QueryExpressionClause> middleClauses>
+ (. .) =
+ FromQueryOperator<middleClauses>
+ | AggregateQueryOperator<middleClauses>
+.
+
+QueryOperator<List<QueryExpressionClause> middleClauses>
+ (.
+ QueryExpressionJoinVBClause joinClause = null;
+ QueryExpressionGroupVBClause groupByClause = null;
+ QueryExpressionPartitionVBClause partitionClause = null;
+ QueryExpressionGroupJoinVBClause groupJoinClause = null;
+ .) =
+ FromQueryOperator<middleClauses>
+ | AggregateQueryOperator<middleClauses>
+ | SelectQueryOperator<middleClauses>
+ | DistinctQueryOperator<middleClauses>
+ | WhereQueryOperator<middleClauses>
+ | OrderByQueryOperator<middleClauses>
+ | PartitionQueryOperator<out partitionClause>
+ | LetQueryOperator<middleClauses>
+ | JoinQueryOperator<out joinClause>
+ (. middleClauses.Add(joinClause); .)
+ | IF(la.kind == Tokens.Group && Peek(1).kind == Tokens.Join) GroupJoinQueryOperator<out groupJoinClause>
+ (. middleClauses.Add(groupJoinClause); .)
+ | GroupByQueryOperator<out groupByClause>
+ (. middleClauses.Add(groupByClause); .)
+.
+
+OrderByQueryOperator<List<QueryExpressionClause> middleClauses>
+ (.
+ QueryExpressionOrderClause orderClause = new QueryExpressionOrderClause();
+ orderClause.StartLocation = la.Location;
+ List<QueryExpressionOrdering> orderings = null;
+ .) =
+ "Order" "By" OrderExpressionList<out orderings>
+ (.
+ orderClause.Orderings = orderings;
+ orderClause.EndLocation = t.EndLocation;
+ middleClauses.Add(orderClause);
+ .)
+.
+
+OrderExpressionList<out List<QueryExpressionOrdering> orderings>
+ (.
+ orderings = new List<QueryExpressionOrdering>();
+ QueryExpressionOrdering ordering = null;
+ .) =
+ OrderExpression<out ordering>
+ (. orderings.Add(ordering); .)
+ {
+ "," OrderExpression<out ordering>
+ (. orderings.Add(ordering); .)
+ }
+.
+
+OrderExpression<out QueryExpressionOrdering ordering>
+ (.
+ ordering = new QueryExpressionOrdering();
+ ordering.StartLocation = la.Location;
+ ordering.Direction = QueryExpressionOrderingDirection.None;
+ Expression orderExpr = null;
+ .) =
+ Expr<out orderExpr>
+ (.
+ ordering.Criteria = orderExpr;
+ .)
+ [
+ "Ascending" (. ordering.Direction = QueryExpressionOrderingDirection.Ascending; .)
+ | "Descending" (. ordering.Direction = QueryExpressionOrderingDirection.Descending; .)
+ ]
+ (. ordering.EndLocation = t.EndLocation; .)
+.
+
+GroupByQueryOperator<out QueryExpressionGroupVBClause groupByClause>
+ (.
+ groupByClause = new QueryExpressionGroupVBClause();
+ groupByClause.StartLocation = la.Location;
+ .) =
+ "Group" ExpressionRangeVariableDeclarationList<groupByClause.GroupVariables>
+ "By" ExpressionRangeVariableDeclarationList<groupByClause.ByVariables>
+ "Into" ExpressionRangeVariableDeclarationList<groupByClause.IntoVariables>
+ (.
+ groupByClause.EndLocation = t.EndLocation;
+ .)
+.
+
+GroupJoinQueryOperator<out QueryExpressionGroupJoinVBClause groupJoinClause>
+ (.
+ groupJoinClause = new QueryExpressionGroupJoinVBClause();
+ groupJoinClause.StartLocation = la.Location;
+ QueryExpressionJoinVBClause joinClause = null;
+ .) =
+ "Group" JoinQueryOperator<out joinClause>
+ "Into" ExpressionRangeVariableDeclarationList<groupJoinClause.IntoVariables>
+ (.
+ groupJoinClause.JoinClause = joinClause;
+ groupJoinClause.EndLocation = t.EndLocation;
+ .)
+.
+
+FromQueryOperator<List<QueryExpressionClause> middleClauses>
+ (.
+ .) =
+ "From" CollectionRangeVariableDeclarationList<middleClauses>
+.
+
+SelectQueryOperator<List<QueryExpressionClause> middleClauses>
+ (.
+ QueryExpressionSelectVBClause selectClause = new QueryExpressionSelectVBClause();
+ selectClause.StartLocation = la.Location;
+ .) =
+ "Select" ExpressionRangeVariableDeclarationList<selectClause.Variables>
+ (.
+ selectClause.EndLocation = t.Location;
+ middleClauses.Add(selectClause);
+ .)
+.
+
+DistinctQueryOperator<List<QueryExpressionClause> middleClauses>
+ (.
+ QueryExpressionDistinctClause distinctClause = new QueryExpressionDistinctClause();
+ distinctClause.StartLocation = la.Location;
+ .) =
+ "Distinct"
+ (.
+ distinctClause.EndLocation = t.EndLocation;
+ middleClauses.Add(distinctClause);
+ .)
+.
+
+WhereQueryOperator<List<QueryExpressionClause> middleClauses>
+ (.
+ QueryExpressionWhereClause whereClause = new QueryExpressionWhereClause();
+ whereClause.StartLocation = la.Location;
+ Expression operand = null;
+ .) =
+ "Where" Expr<out operand>
+ (.
+ whereClause.Condition = operand;
+ whereClause.EndLocation = t.EndLocation;
+
+ middleClauses.Add(whereClause);
+ .)
+.
+
+PartitionQueryOperator<out QueryExpressionPartitionVBClause partitionClause>
+ (.
+ partitionClause = new QueryExpressionPartitionVBClause();
+ partitionClause.StartLocation = la.Location;
+ Expression expr = null;
+ .) =
+ "Take" (. partitionClause.PartitionType = QueryExpressionPartitionType.Take; .)
+ [ "While" (. partitionClause.PartitionType = QueryExpressionPartitionType.TakeWhile; .) ]
+ Expr<out expr>
+ | "Skip" (. partitionClause.PartitionType = QueryExpressionPartitionType.Skip; .)
+ [ "While" ] (. partitionClause.PartitionType = QueryExpressionPartitionType.SkipWhile; .)
+ Expr<out expr>
+ (.
+ partitionClause.Expression = expr;
+ partitionClause.EndLocation = t.EndLocation;
+ .)
+.
+
+AggregateQueryOperator<List<QueryExpressionClause> middleClauses>
+ (.
+ QueryExpressionFromClause fromClause = null;
+ QueryExpressionAggregateClause aggregateClause = new QueryExpressionAggregateClause();
+ aggregateClause.IntoVariables = new List<ExpressionRangeVariable>();
+ aggregateClause.StartLocation = la.Location;
+ .) =
+ "Aggregate" CollectionRangeVariableDeclaration<out fromClause>
+ (.
+ aggregateClause.FromClause = fromClause;
+ .)
+ {
+ QueryOperator<aggregateClause.MiddleClauses>
+ }
+ "Into" ExpressionRangeVariableDeclarationList<aggregateClause.IntoVariables>
+ (.
+ aggregateClause.EndLocation = t.EndLocation;
+ middleClauses.Add(aggregateClause);
+ .)
+.
+
+LetQueryOperator<List<QueryExpressionClause> middleClauses>
+ (.
+ QueryExpressionLetVBClause letClause = new QueryExpressionLetVBClause();
+ letClause.StartLocation = la.Location;
+ .) =
+ "Let" ExpressionRangeVariableDeclarationList<letClause.Variables>
+ (.
+ letClause.EndLocation = t.EndLocation;
+ middleClauses.Add(letClause);
+ .)
+.
+
+ExpressionRangeVariableDeclarationList<List<ExpressionRangeVariable> variables>
+ (.
+ ExpressionRangeVariable variable = null;
+ .) =
+ ExpressionRangeVariableDeclaration<out variable>
+ (. variables.Add(variable); .)
+ { "," ExpressionRangeVariableDeclaration<out variable> (. variables.Add(variable); .) }
+.
+
+ExpressionRangeVariableDeclaration<out ExpressionRangeVariable variable>
+ (.
+ variable = new ExpressionRangeVariable();
+ variable.StartLocation = la.Location;
+ Expression rhs = null;
+ TypeReference typeName = null;
+ .) =
+ [
+ IF(IsIdentifiedExpressionRange()) Identifier
+ (. variable.Identifier = t.val; .)
+ [
+ "As" TypeName<out typeName>
+ (. variable.Type = typeName; .)
+ ]
+ "="
+ ]
+ Expr<out rhs>
+ (.
+ variable.Expression = rhs;
+ variable.EndLocation = t.EndLocation;
+ .)
+.
+
+JoinQueryOperator<out QueryExpressionJoinVBClause joinClause>
+ (.
+ joinClause = new QueryExpressionJoinVBClause();
+ joinClause.StartLocation = la.Location;
+ QueryExpressionFromClause joinVariable = null;
+ QueryExpressionJoinVBClause subJoin = null;
+ QueryExpressionJoinConditionVB condition = null;
+
+ .) =
+ "Join" CollectionRangeVariableDeclaration<out joinVariable>
+ (. joinClause.JoinVariable = joinVariable; .)
+ [
+ JoinQueryOperator<out subJoin>
+ (. joinClause.SubJoin = subJoin; .)
+ ]
+ "On"
+ JoinCondition<out condition>
+ (. SafeAdd(joinClause, joinClause.Conditions, condition); .)
+ {
+ "And" JoinCondition<out condition>
+ (. SafeAdd(joinClause, joinClause.Conditions, condition); .)
+ }
+ (.
+ joinClause.EndLocation = t.EndLocation;
+ .)
+.
+
+CollectionRangeVariableDeclarationList<List<QueryExpressionClause> middleClauses>
+ (.
+ QueryExpressionFromClause fromClause = null;
+ .) =
+ CollectionRangeVariableDeclaration<out fromClause>
+ (. middleClauses.Add(fromClause); .)
+ { "," CollectionRangeVariableDeclaration<out fromClause> (. middleClauses.Add(fromClause); .) }
+.
+
+CollectionRangeVariableDeclaration<out QueryExpressionFromClause fromClause>
+ (.
+ fromClause = new QueryExpressionFromClause();
+ fromClause.StartLocation = la.Location;
+ TypeReference typeName = null;
+ Expression inExpr = null;
+ .) =
+ Identifier
+ [ "As" TypeName<out typeName> (. fromClause.Type = typeName; .) ]
+ "In" Expr<out inExpr>
+ (.
+ fromClause.InExpression = inExpr;
+ fromClause.EndLocation = t.EndLocation;
+ .)
+.
+
+JoinCondition<out QueryExpressionJoinConditionVB condition>
+ (.
+ condition = new QueryExpressionJoinConditionVB();
+ condition.StartLocation = la.Location;
+
+ Expression lhs = null;
+ Expression rhs = null;
+ .) =
+ Expr<out lhs> "Equals" Expr<out rhs>
+ (.
+ condition.LeftSide = lhs;
+ condition.RightSide = rhs;
+ condition.EndLocation = t.EndLocation;
+ .)
+.
+
+MemberInitializer<out NamedArgumentExpression memberInitializer>
+ (.
+ memberInitializer = new NamedArgumentExpression();
+ memberInitializer.StartLocation = la.Location;
+ Expression initExpr = null;
+ string name = null;
+ .) =
+ "." IdentifierOrKeyword<out name> "=" Expr<out initExpr>
+ (.
+ memberInitializer.Name = name;
+ memberInitializer.Expression = initExpr;
+ memberInitializer.EndLocation = t.EndLocation;
+ .)
+.
+
+/* 9.3.2 */
+ArgumentList<out List<Expression> arguments>
+ (.
+ arguments = new List<Expression>();
+ Expression expr = null;
+ .) =
+ [ Argument<out expr> ]
+ { "," (. arguments.Add(expr ?? Expression.Null); expr = null; .)
+ [ Argument<out expr> ]
+ (. if (expr == null) expr = Expression.Null; .)
+ }
+ (. if (expr != null) arguments.Add(expr); .)
+.
+
+/* argument list that hasn't decided if it is method call or array initialisation */
+NormalOrReDimArgumentList<out List<Expression> arguments, out bool canBeNormal, out bool canBeRedim>
+ (.
+ arguments = new List<Expression>();
+ canBeNormal = true; canBeRedim = !IsNamedAssign();
+ Expression expr = null;
+ .)
+=
+ [ Argument<out expr>
+ [ "To" (. EnsureIsZero(expr); canBeNormal = false; .)
+ Expr<out expr>
+ ] ]
+ { ","
+ (. if (expr == null) canBeRedim = false; .)
+ (. arguments.Add(expr ?? Expression.Null); expr = null; .)
+ (. canBeRedim &= !IsNamedAssign(); .)
+ [ Argument<out expr>
+ [ "To" (. EnsureIsZero(expr); canBeNormal = false; .)
+ Expr<out expr>
+ ] ]
+ (. if (expr == null) { canBeRedim = false; expr = Expression.Null; } .)
+ }
+ (. if (expr != null) arguments.Add(expr); else canBeRedim = false; .)
+.
+
+/* Spec, 11.8 */
+Argument<out Expression argumentexpr>
+ (.
+ Expression expr;
+ argumentexpr = null;
+ string name;
+ .) =
+ IF(IsNamedAssign()) Identifier (. name = t.val; .) ":" "=" Expr<out expr>
+ (.
+ argumentexpr = new NamedArgumentExpression(name, expr);
+ .)
+ |
+ Expr<out argumentexpr>
+.
+
+/* 7.1. */
+TypeName<out TypeReference typeref>
+(. ArrayList rank = null; .)
+=
+ NonArrayTypeName<out typeref, false>
+
+
+
+ ArrayTypeModifiers<out rank>
+ (. if (rank != null && typeref != null) {
+ typeref.RankSpecifier = (int[])rank.ToArray(typeof(int));
+ }
+ .)
+.
+
+GetTypeTypeName<out TypeReference typeref>
+(. ArrayList rank = null; .)
+=
+ NonArrayTypeName<out typeref, true>
+ ArrayTypeModifiers<out rank>
+ (. if (rank != null && typeref != null) {
+ typeref.RankSpecifier = (int[])rank.ToArray(typeof(int));
+ }
+ .)
+.
+
+/* 7.1 */
+NonArrayTypeName<out TypeReference typeref, bool canBeUnbound>
+(.
+ string name;
+ typeref = null;
+ bool isGlobal = false;
+.) =
+ (
+ [ "Global" "." (. isGlobal = true; .) ]
+ QualIdentAndTypeArguments<out typeref, canBeUnbound>
+ (. typeref.IsGlobal = isGlobal; .)
+ { "." (. TypeReference nestedTypeRef; .)
+ QualIdentAndTypeArguments<out nestedTypeRef, canBeUnbound>
+ (. typeref = new InnerClassTypeReference(typeref, nestedTypeRef.Type, nestedTypeRef.GenericTypes); .)
+ }
+ )
+ | "Object" (. typeref = new TypeReference("System.Object", true); .)
+ [
+ "?"
+ (.
+ List<TypeReference> typeArguments = new List<TypeReference>(1);
+ if (typeref != null) typeArguments.Add(typeref);
+ typeref = new TypeReference("System.Nullable", typeArguments) { IsKeyword = true };
+ .)
+ ]
+
+ | PrimitiveTypeName<out name> (. typeref = new TypeReference(name, true); .)
+ [
+ "?"
+ (.
+ List<TypeReference> typeArguments = new List<TypeReference>(1);
+ if (typeref != null) typeArguments.Add(typeref);
+ typeref = new TypeReference("System.Nullable", typeArguments) { IsKeyword = true };
+ .)
+ ]
+.
+
+QualIdentAndTypeArguments<out TypeReference typeref, bool canBeUnbound>
+(. string name; typeref = null; .)
+=
+ Qualident<out name>
+ (. typeref = new TypeReference(name); .)
+ [IF (la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of)
+ "(" "Of"
+ ( IF (canBeUnbound && (la.kind == Tokens.CloseParenthesis || la.kind == Tokens.Comma))
+ (. typeref.GenericTypes.Add(NullTypeReference.Instance); .)
+ { "," (. typeref.GenericTypes.Add(NullTypeReference.Instance); .) }
+ | TypeArgumentList<typeref.GenericTypes>
+ )
+ ")"
+ ]
+.
+
+/* 7.9 */
+ArrayNameModifier<out ArrayList arrayModifiers>
+(.
+ arrayModifiers = null;
+.) =
+ ArrayTypeModifiers<out arrayModifiers>
+.
+
+
+/* 7.9 */
+ArrayTypeModifiers<out ArrayList arrayModifiers>
+(.
+ arrayModifiers = new ArrayList();
+ int i = 0;
+.) =
+ { IF (IsDims())
+ "("
+ [ RankList<out i>]
+ (.
+ arrayModifiers.Add(i);
+ .)
+ ")"
+ }
+ (.
+ if(arrayModifiers.Count == 0) {
+ arrayModifiers = null;
+ }
+ .)
+.
+
+/* 7.9 */
+RankList<out int i>
+(. i = 0; .) =
+ { "," (. ++i; .) }
+.
+
+/* 7.12 */
+TypeArgumentList<List<TypeReference> typeArguments>
+(.
+ TypeReference typeref;
+.) =
+ TypeName<out typeref> (. if (typeref != null) typeArguments.Add(typeref); .)
+ {
+ ","
+ TypeName<out typeref> (. if (typeref != null) typeArguments.Add(typeref); .)
+ }
+.
+
+GlobalAttributeSection =
+ "<" (. Location startPos = t.Location; .)
+ ("Assembly" | "Module")
+ (. string attributeTarget = t.val != null ? t.val.ToLower(System.Globalization.CultureInfo.InvariantCulture) : null;
+ List<ASTAttribute> attributes = new List<ASTAttribute>();
+ ASTAttribute attribute;
+ .)
+ ":" Attribute<out attribute> (. attributes.Add(attribute); .)
+ { IF (NotFinalComma()) ["," ("Assembly" | "Module") ":"] Attribute<out attribute> (. attributes.Add(attribute); .)}
+ [ "," ]
+ ">"
+ EndOfStmt
+ (.
+ AttributeSection section = new AttributeSection {
+ AttributeTarget = attributeTarget,
+ Attributes = attributes,
+ StartLocation = startPos,
+ EndLocation = t.EndLocation
+ };
+ compilationUnit.AddChild(section);
+ .)
+ .
+
+/* Spec, 5. */
+Attribute<out ASTAttribute attribute>
+(. string name;
+ List<Expression> positional = new List<Expression>();
+ List<NamedArgumentExpression> named = new List<NamedArgumentExpression>();
+.) =
+ [ "Global" "." ]
+ Qualident<out name>
+ [ AttributeArguments<positional, named> ]
+ (.
+ attribute = new ASTAttribute(name, positional, named);
+ .)
+.
+
+/* Spec, 5.2.2 */
+AttributeArguments<List<Expression> positional, List<NamedArgumentExpression> named>
+ (.
+ bool nameFound = false;
+ string name = "";
+ Expression expr;
+ .) =
+ "("
+ [
+ IF (IsNotClosingParenthesis()) (
+ [
+ IF (IsNamedAssign()) (. nameFound = true; .)
+ IdentifierOrKeyword<out name>
+ [":"] "="
+ ] Expr<out expr>
+ (.
+ if (expr != null) {
+ if (string.IsNullOrEmpty(name)) { positional.Add(expr); }
+ else { named.Add(new NamedArgumentExpression(name, expr)); name = ""; }
+ }
+ .)
+ {
+ ","
+ (
+ IF (IsNamedAssign()) (. nameFound = true; .)
+ IdentifierOrKeyword<out name>
+ [ ":" ] "="
+ | (. if (nameFound) Error("no positional argument after named argument"); .)
+ ) Expr<out expr> (. if (expr != null) { if(name == "") positional.Add(expr);
+ else { named.Add(new NamedArgumentExpression(name, expr)); name = ""; }
+ }
+ .)
+ }
+ )
+ ]
+ ")"
+ .
+
+/* Spec, 5. */
+AttributeSection<out AttributeSection section>
+ (.
+ string attributeTarget = "";List<ASTAttribute> attributes = new List<ASTAttribute>();
+ ASTAttribute attribute;
+
+ .) =
+ "<" (. Location startPos = t.Location; .)
+ [ IF (IsLocalAttrTarget())
+ ( "Event" (. attributeTarget = "event";.)
+ | "Return" (. attributeTarget = "return";.)
+ | Identifier
+ (.
+ string val = t.val.ToLower(System.Globalization.CultureInfo.InvariantCulture);
+ if (val != "field" || val != "method" ||
+ val != "module" || val != "param" ||
+ val != "property" || val != "type")
+ Error("attribute target specifier (event, return, field," +
+ "method, module, param, property, or type) expected");
+ attributeTarget = t.val;
+ .)
+ ) ":"
+ ]
+ Attribute<out attribute> (. attributes.Add(attribute); .)
+ { IF (NotFinalComma()) "," Attribute<out attribute> (. attributes.Add(attribute); .) }
+ [ "," ]
+ ">"
+ (.
+ section = new AttributeSection {
+ AttributeTarget = attributeTarget,
+ Attributes = attributes,
+ StartLocation = startPos,
+ EndLocation = t.EndLocation
+ };
+ .)
+ .
+
+/* 9.2.5 */
+FormalParameterList<List<ParameterDeclarationExpression> parameter>
+(. ParameterDeclarationExpression p; .)
+=
+ FormalParameter <out p> (. if (p != null) parameter.Add(p); .)
+ { ","
+ FormalParameter <out p> (. if (p != null) parameter.Add(p); .)
+ }
+.
+/* 9.2.5 */
+FormalParameter<out ParameterDeclarationExpression p>
+(.
+ AttributeSection section;
+ List<AttributeSection> attributes = new List<AttributeSection>();
+ TypeReference type = null;
+ ParamModifierList mod = new ParamModifierList(this);
+ Expression expr = null;
+ p = null;
+ ArrayList arrayModifiers = null;
+.)
+=
+ { AttributeSection<out section> (. attributes.Add(section); .) }
+ { ParameterModifier<mod> }
+ Identifier (. string parameterName = t.val; .)
+ [ IF(IsDims()) ArrayTypeModifiers<out arrayModifiers> ]
+ [ "As" TypeName<out type> ]
+ (.
+ if(type != null) {
+ if (arrayModifiers != null) {
+ if (type.RankSpecifier != null) {
+ Error("array rank only allowed one time");
+ } else {
+ type.RankSpecifier = (int[])arrayModifiers.ToArray(typeof(int));
+ }
+ }
+ } else {
+ type = new TypeReference("System.Object", arrayModifiers == null ? null : (int[])arrayModifiers.ToArray(typeof(int)));
+ }
+ .)
+ [ "=" Expr<out expr> ]
+ (.
+ mod.Check();
+ p = new ParameterDeclarationExpression(type, parameterName, mod.Modifier, expr);
+ p.Attributes = attributes;
+ .)
+.
+
+/* 10.1 */
+Block<out Statement stmt>
+ =
+ (.
+ BlockStatement blockStmt = new BlockStatement();
+ /* in snippet parsing mode, t might be null */
+ if (t != null) blockStmt.StartLocation = t.EndLocation;
+ compilationUnit.BlockStart(blockStmt);
+ .)
+ {
+ IF (IsEndStmtAhead()) "End" EndOfStmt (. compilationUnit.AddChild(new EndStatement()); .)
+ | Statement EndOfStmt
+/* IF (!LeaveBlock()) { }*/
+ }
+ (.
+ stmt = blockStmt;
+ if (t != null) blockStmt.EndLocation = t.EndLocation;
+ compilationUnit.BlockEnd();
+ .)
+ .
+
+Statement
+ (.
+ Statement stmt = null;
+ Location startPos = la.Location;
+ string label = String.Empty;
+
+ .) =
+ (
+ | IF (IsLabel()) LabelName<out label>
+ (.
+ compilationUnit.AddChild(new LabelStatement(t.val));
+ .)
+ ":" Statement
+ | EmbeddedStatement<out stmt> (. compilationUnit.AddChild(stmt); .)
+ )
+ (.
+ if (stmt != null) {
+ stmt.StartLocation = startPos;
+ stmt.EndLocation = t.Location;
+ }
+ .)
+.
+
+/* 10.2 */
+LocalDeclarationStatement<out Statement statement>
+ (.
+ ModifierList m = new ModifierList();
+ LocalVariableDeclaration localVariableDeclaration;
+ bool dimfound = false;
+ .) =
+ /* this differs from the spec: dim static x compiles with vbc. */
+ {
+ "Const" (. m.Add(Modifiers.Const, t.Location); .)
+ | "Static" (. m.Add(Modifiers.Static, t.Location); .)
+ | "Dim" (. dimfound = true; .)
+ }
+ (.
+ if(dimfound && (m.Modifier & Modifiers.Const) != 0) {
+ Error("Dim is not allowed on constants.");
+ }
+
+ if(m.isNone && dimfound == false) {
+ Error("Const, Dim or Static expected");
+ }
+
+ localVariableDeclaration = new LocalVariableDeclaration(m.Modifier);
+ localVariableDeclaration.StartLocation = t.Location;
+ .)
+ VariableDeclarator<localVariableDeclaration.Variables>
+ { "," VariableDeclarator<localVariableDeclaration.Variables> }
+ (.
+ statement = localVariableDeclaration;
+ .)
+.
+
+EmbeddedStatement<out Statement statement>
+ (.
+ Statement embeddedStatement = null;
+ statement = null;
+ Expression expr = null;
+ string name = String.Empty;
+ List<Expression> p = null;
+ .) =
+ "Exit" (. ExitType exitType = ExitType.None; .)
+ (
+ "Sub" (. exitType = ExitType.Sub; .)
+ |
+ "Function" (. exitType = ExitType.Function; .)
+ |
+ "Property" (. exitType = ExitType.Property; .)
+ |
+ "Do" (. exitType = ExitType.Do; .)
+ |
+ "For" (. exitType = ExitType.For; .)
+ |
+ "Try" (. exitType = ExitType.Try; .)
+ |
+ "While" (. exitType = ExitType.While; .)
+ |
+ "Select" (. exitType = ExitType.Select; .)
+ )
+ (. statement = new ExitStatement(exitType); .)
+ | TryStatement<out statement>
+ | "Continue" (. ContinueType continueType = ContinueType.None; .) [ "Do" (. continueType = ContinueType.Do; .) | "For" (. continueType = ContinueType.For; .) | "While" (. continueType = ContinueType.While; .)] (. statement = new ContinueStatement(continueType); .)
+ | /* 10.10.1.3 */
+ "Throw" [ Expr<out expr> ] (. statement = new ThrowStatement(expr); .)
+ | /* 10.11 */
+ "Return" [ Expr<out expr> ] (. statement = new ReturnStatement(expr); .)
+ | /* 10.4 */
+ "SyncLock" Expr<out expr> EndOfStmt Block<out embeddedStatement>
+ "End" "SyncLock" (. statement = new LockStatement(expr, embeddedStatement); .)
+ | /* 10.5.1 */
+ "RaiseEvent" Identifier (. name = t.val; .)
+ [ "(" [ ArgumentList<out p> ] ")" ]
+ (.
+ statement = new RaiseEventStatement(name, p);
+ .)
+ | /* 10.3 */
+ WithStatement<out statement>
+ | /* 10.5.2 */
+ "AddHandler" (. Expression handlerExpr = null; .)
+ Expr<out expr> "," Expr<out handlerExpr>
+ (.
+ statement = new AddHandlerStatement(expr, handlerExpr);
+ .)
+ | /* 10.5.2 */
+ "RemoveHandler" (. Expression handlerExpr = null; .)
+ Expr<out expr> "," Expr<out handlerExpr>
+ (.
+ statement = new RemoveHandlerStatement(expr, handlerExpr);
+ .)
+ | /* 10.9.1 */
+ "While" Expr<out expr> EndOfStmt
+ Block<out embeddedStatement> "End" "While"
+ (.
+ statement = new DoLoopStatement(expr, embeddedStatement, ConditionType.While, ConditionPosition.Start);
+ .)
+ | /* 10.9.1 */
+ "Do"
+ (.
+ ConditionType conditionType = ConditionType.None;
+ .)
+ (
+ WhileOrUntil<out conditionType> Expr<out expr> EndOfStmt
+ Block<out embeddedStatement>
+ "Loop"
+ (.
+ statement = new DoLoopStatement(expr,
+ embeddedStatement,
+ conditionType == ConditionType.While ? ConditionType.DoWhile : conditionType,
+ ConditionPosition.Start);
+ .)
+ |
+ EndOfStmt
+ Block<out embeddedStatement>
+ "Loop" [WhileOrUntil<out conditionType> Expr<out expr>]
+ (.
+ statement = new DoLoopStatement(expr, embeddedStatement, conditionType, ConditionPosition.End);
+ .)
+ )
+ | "For"
+ (.
+ Expression group = null;
+ TypeReference typeReference;
+ string typeName;
+ Location startLocation = t.Location;
+ .)
+ (
+ /* 10.9.3 */
+ "Each" LoopControlVariable<out typeReference, out typeName>
+ "In" Expr<out group> EndOfStmt
+ Block<out embeddedStatement>
+ "Next" [ Expr<out expr> ]
+ (.
+ statement = new ForeachStatement(typeReference,
+ typeName,
+ group,
+ embeddedStatement,
+ expr);
+ statement.StartLocation = startLocation;
+ statement.EndLocation = t.EndLocation;
+
+ .)
+ | /* 10.9.2 */
+ (.
+ Expression start = null;
+ Expression end = null;
+ Expression step = null;
+ Expression variableExpr = null;
+ Expression nextExpr = null;
+ List<Expression> nextExpressions = null;
+ .)
+ ( IF (IsLoopVariableDeclaration())
+ LoopControlVariable<out typeReference, out typeName>
+ |
+ (. typeReference = null; typeName = null; .)
+ SimpleExpr<out variableExpr>
+ )
+ "=" Expr<out start> "To" Expr<out end> [ "Step" Expr<out step> ]
+ EndOfStmt Block<out embeddedStatement>
+ "Next"
+ [
+ Expr<out nextExpr>
+ (.
+ nextExpressions = new List<Expression>();
+ nextExpressions.Add(nextExpr);
+ .)
+ { "," Expr<out nextExpr> (. nextExpressions.Add(nextExpr); .) }
+ ]
+ (.
+ statement = new ForNextStatement {
+ TypeReference = typeReference,
+ VariableName = typeName,
+ LoopVariableExpression = variableExpr,
+ Start = start,
+ End = end,
+ Step = step,
+ EmbeddedStatement = embeddedStatement,
+ NextExpressions = nextExpressions
+ };
+ .)
+ )
+ | /* 10.10.2.1 */
+ "Error" Expr<out expr> (. statement = new ErrorStatement(expr); .)
+ | /* 10.12.1 */
+ "ReDim" (. bool isPreserve = false; .) [ "Preserve" (. isPreserve = true; .) ]
+ ReDimClause<out expr>
+ (.
+ ReDimStatement reDimStatement = new ReDimStatement(isPreserve);
+ statement = reDimStatement;
+ SafeAdd(reDimStatement, reDimStatement.ReDimClauses, expr as InvocationExpression);
+ .)
+ { "," ReDimClause<out expr>
+ (. SafeAdd(reDimStatement, reDimStatement.ReDimClauses, expr as InvocationExpression); .)
+ }
+ | /* 10.12.2 */
+ "Erase"
+ Expr<out expr>
+ (.
+ EraseStatement eraseStatement = new EraseStatement();
+ if (expr != null) { SafeAdd(eraseStatement, eraseStatement.Expressions, expr);}
+ .)
+ { "," Expr<out expr> (. if (expr != null) { SafeAdd(eraseStatement, eraseStatement.Expressions, expr); }.) }
+ (. statement = eraseStatement; .)
+ | /* 10.11 */
+ "Stop" (. statement = new StopStatement(); .)
+ | /* 10.8.1 */
+ IF (la.kind == Tokens.If)
+ "If" (. Location ifStartLocation = t.Location; .) Expr<out expr> [ "Then" ]
+ (
+ /* multiline if statement */
+ EndOfStmt Block<out embeddedStatement>
+ (.
+ IfElseStatement ifStatement = new IfElseStatement(expr, embeddedStatement);
+ ifStatement.StartLocation = ifStartLocation;
+ Location elseIfStart;
+ .)
+ {
+ (
+ IF(IsElseIf()) "Else" (. elseIfStart = t.Location; .) "If"
+ | "ElseIf" (. elseIfStart = t.Location; .)
+ )
+ (. Expression condition = null; Statement block = null; .)
+ Expr<out condition> [ "Then"] EndOfStmt
+ Block<out block>
+ (.
+ ElseIfSection elseIfSection = new ElseIfSection(condition, block);
+ elseIfSection.StartLocation = elseIfStart;
+ elseIfSection.EndLocation = t.Location;
+ elseIfSection.Parent = ifStatement;
+ ifStatement.ElseIfSections.Add(elseIfSection);
+ .)
+ }
+ [
+ "Else" EndOfStmt
+ Block<out embeddedStatement>
+ (.
+ ifStatement.FalseStatement.Add(embeddedStatement);
+ .)
+ ] "End" "If"
+ (.
+ ifStatement.EndLocation = t.Location;
+ statement = ifStatement;
+ .)
+ | /* singleline if statement */
+ (.
+ IfElseStatement ifStatement = new IfElseStatement(expr);
+ ifStatement.StartLocation = ifStartLocation;
+ .)
+ SingleLineStatementList<ifStatement.TrueStatement>
+ [
+ "Else"
+ [ SingleLineStatementList<ifStatement.FalseStatement> ]
+ ]
+ (. ifStatement.EndLocation = t.Location; statement = ifStatement; .)
+ )
+ | /* 10.8.2 */
+ "Select" [ "Case" ] Expr<out expr> EndOfStmt
+ (.List<SwitchSection> selectSections = new List<SwitchSection>();
+ Statement block = null;
+ .)
+ {
+ (.List<CaseLabel> caseClauses = null; Location caseLocation = la.Location; .)
+ "Case" CaseClauses<out caseClauses> [ IF(IsNotStatementSeparator()) ":" ] EndOfStmt
+ (.
+ SwitchSection selectSection = new SwitchSection(caseClauses);
+ selectSection.StartLocation = caseLocation;
+ .)
+ Block<out block>
+ (.
+ selectSection.Children = block.Children;
+ selectSection.EndLocation = t.EndLocation;
+ selectSections.Add(selectSection);
+ .)
+ }
+ (.
+ statement = new SwitchStatement(expr, selectSections);
+ .)
+ "End" "Select"
+ | (. OnErrorStatement onErrorStatement = null; .)
+ OnErrorStatement<out onErrorStatement> (. statement = onErrorStatement; .)
+ | (. GotoStatement goToStatement = null; .)
+ GotoStatement<out goToStatement> (. statement = goToStatement; .)
+ | (. ResumeStatement resumeStatement = null; .)
+ ResumeStatement<out resumeStatement> (. statement = resumeStatement; .)
+ |/* Statement expression (invocation and assignment) 10.6.1, 10.6.2, 10.6.3 */
+ (.
+ Expression val = null;
+ AssignmentOperatorType op;
+
+ bool mustBeAssignment = la.kind == Tokens.Plus || la.kind == Tokens.Minus ||
+ la.kind == Tokens.Not || la.kind == Tokens.Times;
+ .)
+ SimpleExpr<out expr>
+ (
+ AssignmentOperator<out op> Expr<out val> (. expr = new AssignmentExpression(expr, op, val); .)
+ | (. if (mustBeAssignment) Error("error in assignment."); .)
+ )
+ (.
+ // a field reference expression that stands alone is a
+ // invocation expression without parantheses and arguments
+ if(expr is MemberReferenceExpression || expr is IdentifierExpression) {
+ expr = new InvocationExpression(expr);
+ }
+ statement = new ExpressionStatement(expr);
+ .)
+ | "Call" SimpleExpr<out expr> (. statement = new ExpressionStatement(expr); .)
+ | "Using"
+ (. Statement block; .)
+ ( IF (Peek(1).kind == Tokens.As)
+ (. LocalVariableDeclaration resourceAquisition = new LocalVariableDeclaration(Modifiers.None); .)
+ VariableDeclarator<resourceAquisition.Variables>
+ { ","
+ VariableDeclarator<resourceAquisition.Variables>
+ }
+ Block<out block>
+ (.
+ statement = new UsingStatement(resourceAquisition, block);
+ .)
+ | Expr<out expr>
+ Block<out block>
+ (. statement = new UsingStatement(new ExpressionStatement(expr), block); .)
+ )
+ "End" "Using"
+ | LocalDeclarationStatement<out statement>
+.
+
+SingleLineStatementList<List<Statement> list>
+(. Statement embeddedStatement = null; .)
+=
+ ( "End" (. embeddedStatement = new EndStatement(); .)
+ | EmbeddedStatement<out embeddedStatement> )
+ (. if (embeddedStatement != null) list.Add(embeddedStatement); .)
+ { ":" { ":" }
+ ( "End" (. embeddedStatement = new EndStatement(); .)
+ | EmbeddedStatement<out embeddedStatement> )
+ (. if (embeddedStatement != null) list.Add(embeddedStatement); .)
+ }
+.
+
+/* 10.9.2 */
+LoopControlVariable<out TypeReference type, out string name>
+(.ArrayList arrayModifiers = null;
+ type = null;
+.)
+=
+ Qualident<out name>
+ [ IF(IsDims()) ArrayTypeModifiers<out arrayModifiers> ]
+ [ "As" TypeName<out type> (. if (name.IndexOf('.') > 0) { Error("No type def for 'for each' member indexer allowed."); } .) ]
+ (.
+ if (type != null) {
+ if(type.RankSpecifier != null && arrayModifiers != null) {
+ Error("array rank only allowed one time");
+ } else if (arrayModifiers != null) {
+ type.RankSpecifier = (int[])arrayModifiers.ToArray(typeof(int));
+ }
+ }
+ .)
+.
+
+/* 10.2.2 */
+OnErrorStatement<out OnErrorStatement stmt>
+ (.
+ stmt = null;
+ GotoStatement goToStatement = null;
+ .)
+ =
+ "On" "Error"
+ (
+ IF(IsNegativeLabelName())"GoTo" "-" LiteralInteger
+ (.
+ long intLabel = Int64.Parse(t.val);
+ if(intLabel != 1) {
+ Error("invalid label in on error statement.");
+ }
+ stmt = new OnErrorStatement(new GotoStatement((intLabel * -1).ToString()));
+ .)
+ | GotoStatement<out goToStatement>
+ (.
+ string val = goToStatement.Label;
+
+ // if value is numeric, make sure that is 0
+ try {
+ long intLabel = Int64.Parse(val);
+ if(intLabel != 0) {
+ Error("invalid label in on error statement.");
+ }
+ } catch {
+ }
+ stmt = new OnErrorStatement(goToStatement);
+ .)
+ | "Resume" "Next"
+ (.
+ stmt = new OnErrorStatement(new ResumeStatement(true));
+ .)
+ )
+ .
+
+/* 10.11 */
+GotoStatement<out GotoStatement goToStatement>
+ (.
+ string label = String.Empty;
+ .)
+ =
+ "GoTo" LabelName<out label>
+ (.
+ goToStatement = new GotoStatement(label);
+ .)
+ .
+
+/* 10.1 */
+LabelName<out string name>
+ (.
+ name = String.Empty;
+ .) =
+ Identifier (. name = t.val; .)
+ | LiteralInteger (. name = t.val; .)
+ .
+
+/* 12.12.1 */
+ReDimClause<out Expression expr>
+=
+ SimpleNonInvocationExpression<out expr>
+ ReDimClauseInternal<ref expr>
+.
+
+ReDimClauseInternal<ref Expression expr>
+(. List<Expression> arguments; bool canBeNormal; bool canBeRedim; string name; .)
+=
+ { "." IdentifierOrKeyword<out name> (. expr = new MemberReferenceExpression(expr, name); .)
+ | IF (la.kind == Tokens.OpenParenthesis && Peek(1).kind == Tokens.Of)
+ InvocationExpression<ref expr>
+ }
+ "("
+ NormalOrReDimArgumentList<out arguments, out canBeNormal, out canBeRedim>
+ ")"
+ (. expr = new InvocationExpression(expr, arguments);
+ if (canBeRedim == false || canBeNormal && (la.kind == Tokens.Dot || la.kind == Tokens.OpenParenthesis)) {
+ if (this.Errors.Count == 0) {
+ // don't recurse on parse errors - could result in endless recursion
+ ReDimClauseInternal(ref expr);
+ }
+ }
+ .)
+.
+
+/* 10.10.2.3 */
+ResumeStatement<out ResumeStatement resumeStatement>
+ (.
+ resumeStatement = null;
+ string label = String.Empty;
+ .) =
+ IF(IsResumeNext())
+ "Resume" "Next" (. resumeStatement = new ResumeStatement(true); .)
+ | "Resume" [ LabelName<out label> ] (. resumeStatement = new ResumeStatement(label); .)
+ .
+
+/* 18.8.2 */
+CaseClauses<out List<CaseLabel> caseClauses>
+ (.
+ caseClauses = new List<CaseLabel>();
+ CaseLabel caseClause = null;
+ .) =
+ CaseClause<out caseClause> (. if (caseClause != null) { caseClauses.Add(caseClause); } .)
+ { "," CaseClause<out caseClause> (. if (caseClause != null) { caseClauses.Add(caseClause); } .) }
+ .
+
+/* 19.8.2 */
+CaseClause<out CaseLabel caseClause>
+ (.
+ Expression expr = null;
+ Expression sexpr = null;
+ BinaryOperatorType op = BinaryOperatorType.None;
+ caseClause = null;
+ .) =
+ "Else"
+ (. caseClause = new CaseLabel(); .)
+ |
+ [ "Is" ]
+ (
+ "<" (. op = BinaryOperatorType.LessThan; .)
+ | ">" (. op = BinaryOperatorType.GreaterThan; .)
+ | "<=" (. op = BinaryOperatorType.LessThanOrEqual; .)
+ | ">=" (. op = BinaryOperatorType.GreaterThanOrEqual; .)
+ | "=" (. op = BinaryOperatorType.Equality; .)
+ | "<>" (. op = BinaryOperatorType.InEquality; .)
+ )
+ Expr<out expr>
+ (.
+ caseClause = new CaseLabel(op, expr);
+ .)
+ | Expr<out expr> [ "To" Expr<out sexpr> ]
+ (.
+ caseClause = new CaseLabel(expr, sexpr);
+ .)
+ .
+
+/* 10.9.1 */
+WhileOrUntil<out ConditionType conditionType>
+ (. conditionType = ConditionType.None; .) =
+ "While" (. conditionType = ConditionType.While; .)
+ | "Until" (. conditionType = ConditionType.Until; .)
+ .
+
+/* 10.3 */
+WithStatement<out Statement withStatement>
+ (.
+ Statement blockStmt = null;
+ Expression expr = null;
+ .) =
+ "With" (. Location start = t.Location; .)
+ Expr<out expr> EndOfStmt
+ (.
+ withStatement = new WithStatement(expr);
+ withStatement.StartLocation = start;
+ .)
+ Block<out blockStmt>
+ (.
+ ((WithStatement)withStatement).Body = (BlockStatement)blockStmt;
+ .)
+ "End" "With"
+ (. withStatement.EndLocation = t.Location; .)
+ .
+
+/* 10.10.1 */
+TryStatement<out Statement tryStatement>
+ (.
+ Statement blockStmt = null, finallyStmt = null;List<CatchClause> catchClauses = null;
+ .) =
+ "Try" EndOfStmt
+ Block<out blockStmt>
+ [CatchClauses<out catchClauses>]
+ ["Finally" EndOfStmt Block<out finallyStmt> ]
+ "End" "Try"
+ (.
+ tryStatement = new TryCatchStatement(blockStmt, catchClauses, finallyStmt);
+ .)
+ .
+
+/* 10.10.1.2 */
+CatchClauses<out List<CatchClause> catchClauses>
+ (.
+ catchClauses = new List<CatchClause>();
+ TypeReference type = null;
+ Statement blockStmt = null;
+ Expression expr = null;
+ string name = String.Empty;
+ .) =
+ {
+ "Catch"
+ [ Identifier (. name = t.val; .) ["As" TypeName<out type>] ]
+ [ "When" Expr<out expr> ]
+ EndOfStmt
+ Block<out blockStmt>
+ (. catchClauses.Add(new CatchClause(type, name, blockStmt, expr)); .)
+ }
+ .
+
+/* 4.7 */
+Qualident<out string qualident>
+(.
+ string name;
+ qualidentBuilder.Length = 0;
+.)
+=
+ Identifier (. qualidentBuilder.Append(t.val); .)
+ { IF (DotAndIdentOrKw()) "." IdentifierOrKeyword<out name> (. qualidentBuilder.Append('.'); qualidentBuilder.Append(name); .) }
+
+ (. qualident = qualidentBuilder.ToString(); .)
+.
+
+/* This production handles pseudo keywords that are needed in the grammar */
+Identifier =
+ IdentifierForFieldDeclaration
+ | "Custom"
+.
+
+IdentifierForFieldDeclaration =
+ ident
+ | "Aggregate"
+ | "Ansi"
+ | "Ascending"
+ | "Assembly"
+ | "Auto"
+ | "Binary"
+ | "By"
+ | "Compare"
+ | "Descending"
+ | "Distinct"
+ | "Equals"
+ | "Explicit"
+ | "From"
+ | "Group"
+ | "Infer"
+ | "Into"
+ | "Join"
+ | "Off"
+ | "Order"
+ | "Preserve"
+ | "Skip"
+ | "Take"
+ | "Text"
+ | "Unicode"
+ | "Until"
+ | "Where"
+.
+
+/* 2.2 */
+
+IdentifierOrKeyword<out string name>
+=
+ (. lexer.NextToken(); name = t.val; .)
+.
+
+
+/* 7.3 */
+PrimitiveTypeName<out string type>
+ (. type = String.Empty; .) =
+ "Boolean" (. type = "System.Boolean"; .)
+ | "Date" (. type = "System.DateTime"; .)
+ | "Char" (. type = "System.Char"; .)
+ | "String" (. type = "System.String"; .)
+ | "Decimal" (. type = "System.Decimal"; .)
+ | "Byte" (. type = "System.Byte"; .)
+ | "Short" (. type = "System.Int16"; .)
+ | "Integer" (. type = "System.Int32"; .)
+ | "Long" (. type = "System.Int64"; .)
+ | "Single" (. type = "System.Single"; .)
+ | "Double" (. type = "System.Double"; .)
+ | "UInteger" (. type = "System.UInt32"; .)
+ | "ULong" (. type = "System.UInt64"; .)
+ | "UShort" (. type = "System.UInt16"; .)
+ | "SByte" (. type = "System.SByte"; .)
+ .
+
+ParameterModifier<ParamModifierList m>
+ = "ByVal" (. m.Add(ParameterModifiers.In); .)
+ | "ByRef" (. m.Add(ParameterModifiers.Ref); .)
+ | "Optional" (. m.Add(ParameterModifiers.Optional); .)
+ | "ParamArray" (. m.Add(ParameterModifiers.Params); .)
+ .
+
+TypeModifier<ModifierList m>
+= "Public" (. m.Add(Modifiers.Public, t.Location); .)
+ | "Protected" (. m.Add(Modifiers.Protected, t.Location); .)
+ | "Friend" (. m.Add(Modifiers.Internal, t.Location); .)
+ | "Private" (. m.Add(Modifiers.Private, t.Location); .)
+ | "Shared" (. m.Add(Modifiers.Static, t.Location); .)
+ | "Shadows" (. m.Add(Modifiers.New, t.Location); .)
+ | "MustInherit" (. m.Add(Modifiers.Abstract, t.Location); .)
+ | "NotInheritable" (. m.Add(Modifiers.Sealed, t.Location); .)
+ | "Partial" (. m.Add(Modifiers.Partial, t.Location); .)
+.
+
+MemberModifier<ModifierList m> =
+ "MustInherit" (.m.Add(Modifiers.Abstract, t.Location);.)
+ | "Default" (.m.Add(Modifiers.Default, t.Location);.)
+ | "Friend" (.m.Add(Modifiers.Internal, t.Location);.)
+ | "Shadows" (.m.Add(Modifiers.New, t.Location);.)
+ | "Overrides" (.m.Add(Modifiers.Override, t.Location);.)
+ | "MustOverride" (.m.Add(Modifiers.Abstract, t.Location);.)
+ | "Private" (.m.Add(Modifiers.Private, t.Location);.)
+ | "Protected" (.m.Add(Modifiers.Protected, t.Location);.)
+ | "Public" (.m.Add(Modifiers.Public, t.Location);.)
+ | "NotInheritable" (.m.Add(Modifiers.Sealed, t.Location);.)
+ | "NotOverridable" (.m.Add(Modifiers.Sealed, t.Location);.)
+ | "Shared" (.m.Add(Modifiers.Static, t.Location);.)
+ | "Overridable" (.m.Add(Modifiers.Virtual, t.Location);.)
+ | "Overloads" (.m.Add(Modifiers.Overloads, t.Location);.)
+ | "ReadOnly" (.m.Add(Modifiers.ReadOnly, t.Location);.)
+ | "WriteOnly" (.m.Add(Modifiers.WriteOnly, t.Location);.)
+ | "WithEvents" (.m.Add(Modifiers.WithEvents, t.Location);.)
+ | "Dim" (.m.Add(Modifiers.Dim, t.Location);.)
+ | "Partial" (.m.Add(Modifiers.Partial, t.Location);.)
+.
+
+PropertyAccessorAccessModifier<out Modifiers m> =
+ (. m = Modifiers.None; .)
+ {(
+ "Public" (. m |= Modifiers.Public; .)
+ | "Protected" (. m |= Modifiers.Protected; .)
+ | "Friend" (. m |= Modifiers.Internal; .)
+ | "Private" (. m |= Modifiers.Private; .)
+ )}
+.
+
+END VBNET.
diff --git a/main/contrib/NRefactory/Project/Src/Parser/VBNet/VBNetParser.cs b/main/contrib/NRefactory/Project/Src/Parser/VBNet/VBNetParser.cs
index 63120f30b3..2004e04c28 100644
--- a/main/contrib/NRefactory/Project/Src/Parser/VBNet/VBNetParser.cs
+++ b/main/contrib/NRefactory/Project/Src/Parser/VBNet/VBNetParser.cs
@@ -1,325 +1,325 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 3717M $</version>
-// </file>
-
-using ICSharpCode.NRefactory.Visitors;
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Text;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Parser.VB
-{
- internal sealed partial class Parser : AbstractParser
- {
- Lexer lexer;
-
- public Parser(ILexer lexer) : base(lexer)
- {
- this.lexer = (Lexer)lexer;
- }
-
- private StringBuilder qualidentBuilder = new StringBuilder();
-
- Token t
- {
- [System.Diagnostics.DebuggerStepThrough]
- get {
- return lexer.Token;
- }
- }
- Token la
- {
- [System.Diagnostics.DebuggerStepThrough]
- get {
- return lexer.LookAhead;
- }
- }
-
- Token Peek (int n)
- {
- lexer.StartPeek();
- Token x = la;
- while (n > 0) {
- x = lexer.Peek();
- n--;
- }
- return x;
- }
-
- public void Error(string s)
- {
- if (errDist >= MinErrDist) {
- this.Errors.Error(la.line, la.col, s);
- }
- errDist = 0;
- }
-
- public override void Parse()
- {
- ParseRoot();
- compilationUnit.AcceptVisitor(new SetParentVisitor(), null);
- }
-
- public override TypeReference ParseTypeReference ()
- {
- // TODO
- return null;
- }
-
- public override Expression ParseExpression()
- {
- lexer.NextToken();
- Location startLocation = la.Location;
- Expression expr;
- Expr(out expr);
- while (la.kind == Tokens.EOL) lexer.NextToken();
- if (expr != null) {
- expr.StartLocation = startLocation;
- expr.EndLocation = t.EndLocation;
- expr.AcceptVisitor(new SetParentVisitor(), null);
- }
- Expect(Tokens.EOF);
- return expr;
- }
-
- public override BlockStatement ParseBlock()
- {
- lexer.NextToken();
- compilationUnit = new CompilationUnit();
-
- Location startLocation = la.Location;
- Statement st;
- Block(out st);
- if (st != null) {
- st.StartLocation = startLocation;
- if (t != null)
- st.EndLocation = t.EndLocation;
- else
- st.EndLocation = la.Location;
- st.AcceptVisitor(new SetParentVisitor(), null);
- }
- Expect(Tokens.EOF);
- return st as BlockStatement;
- }
-
- public override List<INode> ParseTypeMembers()
- {
- lexer.NextToken();
- compilationUnit = new CompilationUnit();
-
- TypeDeclaration newType = new TypeDeclaration(Modifiers.None, null);
- compilationUnit.BlockStart(newType);
- ClassBody(newType);
- compilationUnit.BlockEnd();
- Expect(Tokens.EOF);
- newType.AcceptVisitor(new SetParentVisitor(), null);
- return newType.Children;
- }
-
- bool LeaveBlock()
- {
- int peek = Peek(1).kind;
- return Tokens.BlockSucc[la.kind] && (la.kind != Tokens.End || peek == Tokens.EOL || peek == Tokens.Colon);
- }
-
- /* True, if "." is followed by an ident */
- bool DotAndIdentOrKw () {
- int peek = Peek(1).kind;
- return la.kind == Tokens.Dot && (peek == Tokens.Identifier || peek >= Tokens.AddHandler);
- }
-
- static bool IsIdentifierToken(Token tk)
- {
- return Tokens.IdentifierTokens[tk.kind] || tk.kind == Tokens.Identifier;
- }
-
- bool IsIdentifiedExpressionRange()
- {
- return la.kind == Tokens.As || la.kind == Tokens.Assign;
- }
-
- bool IsQueryExpression()
- {
- return (la.kind == Tokens.From || la.kind == Tokens.Aggregate) && IsIdentifierToken(Peek(1));
- }
-
- bool IsEndStmtAhead()
- {
- int peek = Peek(1).kind;
- return la.kind == Tokens.End && (peek == Tokens.EOL || peek == Tokens.Colon);
- }
-
- bool IsNotClosingParenthesis() {
- return la.kind != Tokens.CloseParenthesis;
- }
-
- /*
- True, if ident is followed by "=" or by ":" and "="
- */
- bool IsNamedAssign() {
- if(Peek(1).kind == Tokens.Colon && Peek(2).kind == Tokens.Assign) return true;
- return false;
- }
-
- bool IsObjectCreation() {
- return la.kind == Tokens.As && Peek(1).kind == Tokens.New;
- }
-
- /*
- True, if "<" is followed by the ident "assembly" or "module"
- */
- bool IsGlobalAttrTarget () {
- Token pt = Peek(1);
- return la.kind == Tokens.LessThan && ( string.Equals(pt.val, "assembly", StringComparison.InvariantCultureIgnoreCase) || string.Equals(pt.val, "module", StringComparison.InvariantCultureIgnoreCase));
- }
-
- /*
- True if the next token is a "(" and is followed by "," or ")"
- */
- bool IsDims()
- {
- int peek = Peek(1).kind;
- return la.kind == Tokens.OpenParenthesis
- && (peek == Tokens.Comma || peek == Tokens.CloseParenthesis);
- }
-
- /*
- True if the next token is an identifier
- */
- bool IsLoopVariableDeclaration()
- {
- if (!IsIdentifierToken(la))
- return false;
- lexer.StartPeek();
- Token x = lexer.Peek();
- if (x.kind == Tokens.OpenParenthesis) {
- do {
- x = lexer.Peek();
- } while (x.kind == Tokens.Comma);
- if (x.kind != Tokens.CloseParenthesis)
- return false;
- x = lexer.Peek();
- }
- return x.kind == Tokens.As || x.kind == Tokens.Assign;
- }
-
- bool IsSize()
- {
- return la.kind == Tokens.OpenParenthesis;
- }
-
- /*
- True, if the comma is not a trailing one,
- like the last one in: a, b, c,
- */
- bool NotFinalComma() {
- int peek = Peek(1).kind;
- return la.kind == Tokens.Comma &&
- peek != Tokens.CloseCurlyBrace;
- }
-
- /*
- True, if the next token is "Else" and this one
- if followed by "If"
- */
- bool IsElseIf()
- {
- int peek = Peek(1).kind;
- return la.kind == Tokens.Else && peek == Tokens.If;
- }
-
- /*
- True if the next token is goto and this one is
- followed by minus ("-") (this is allowd in in
- error clauses)
- */
- bool IsNegativeLabelName()
- {
- int peek = Peek(1).kind;
- return la.kind == Tokens.GoTo && peek == Tokens.Minus;
- }
-
- /*
- True if the next statement is a "Resume next" statement
- */
- bool IsResumeNext()
- {
- int peek = Peek(1).kind;
- return la.kind == Tokens.Resume && peek == Tokens.Next;
- }
-
- /*
- True, if ident/literal integer is followed by ":"
- */
- bool IsLabel()
- {
- return (la.kind == Tokens.Identifier || la.kind == Tokens.LiteralInteger)
- && Peek(1).kind == Tokens.Colon;
- }
-
- bool IsNotStatementSeparator()
- {
- return la.kind == Tokens.Colon && Peek(1).kind == Tokens.EOL;
- }
-
- static bool IsMustOverride(ModifierList m)
- {
- return m.Contains(Modifiers.Abstract);
- }
-
- /* Writes the type name represented through the expression into the string builder. */
- /* Returns true when the expression was converted successfully, returns false when */
- /* There was an unknown expression (e.g. TypeReferenceExpression) in it */
- bool WriteFullTypeName(StringBuilder b, Expression expr)
- {
- MemberReferenceExpression fre = expr as MemberReferenceExpression;
- if (fre != null) {
- bool result = WriteFullTypeName(b, fre.TargetObject);
- if (b.Length > 0) b.Append('.');
- b.Append(fre.MemberName);
- return result;
- } else if (expr is IdentifierExpression) {
- b.Append(((IdentifierExpression)expr).Identifier);
- return true;
- } else {
- return false;
- }
- }
-
- /*
- True, if lookahead is a local attribute target specifier,
- i.e. one of "event", "return", "field", "method",
- "module", "param", "property", or "type"
- */
- bool IsLocalAttrTarget() {
- // TODO
- return false;
- }
-
- void EnsureIsZero(Expression expr)
- {
- if (!(expr is PrimitiveExpression) || (expr as PrimitiveExpression).StringValue != "0")
- Error("lower bound of array must be zero");
- }
-
- /// <summary>
- /// Adds a child item to a collection stored in the parent node.
- /// Also set's the item's parent to <paramref name="parent"/>.
- /// Does nothing if item is null.
- /// </summary>
- static void SafeAdd<T>(INode parent, List<T> list, T item) where T : class, INode
- {
- Debug.Assert(parent != null);
- Debug.Assert((parent is INullable) ? !(parent as INullable).IsNull : true);
- if (item != null) {
- list.Add(item);
- item.Parent = parent;
- }
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using ICSharpCode.NRefactory.Visitors;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Text;
+using ICSharpCode.NRefactory.Ast;
+
+namespace ICSharpCode.NRefactory.Parser.VB
+{
+ internal sealed partial class Parser : AbstractParser
+ {
+ Lexer lexer;
+
+ public Parser(ILexer lexer) : base(lexer)
+ {
+ this.lexer = (Lexer)lexer;
+ }
+
+ private StringBuilder qualidentBuilder = new StringBuilder();
+
+ Token t
+ {
+ [System.Diagnostics.DebuggerStepThrough]
+ get {
+ return lexer.Token;
+ }
+ }
+ Token la
+ {
+ [System.Diagnostics.DebuggerStepThrough]
+ get {
+ return lexer.LookAhead;
+ }
+ }
+
+ Token Peek (int n)
+ {
+ lexer.StartPeek();
+ Token x = la;
+ while (n > 0) {
+ x = lexer.Peek();
+ n--;
+ }
+ return x;
+ }
+
+ public void Error(string s)
+ {
+ if (errDist >= MinErrDist) {
+ this.Errors.Error(la.line, la.col, s);
+ }
+ errDist = 0;
+ }
+
+ public override void Parse()
+ {
+ ParseRoot();
+ compilationUnit.AcceptVisitor(new SetParentVisitor(), null);
+ }
+
+ public override TypeReference ParseTypeReference ()
+ {
+ // TODO
+ return null;
+ }
+
+ public override Expression ParseExpression()
+ {
+ lexer.NextToken();
+ Location startLocation = la.Location;
+ Expression expr;
+ Expr(out expr);
+ while (la.kind == Tokens.EOL) lexer.NextToken();
+ if (expr != null) {
+ expr.StartLocation = startLocation;
+ expr.EndLocation = t.EndLocation;
+ expr.AcceptVisitor(new SetParentVisitor(), null);
+ }
+ Expect(Tokens.EOF);
+ return expr;
+ }
+
+ public override BlockStatement ParseBlock()
+ {
+ lexer.NextToken();
+ compilationUnit = new CompilationUnit();
+
+ Location startLocation = la.Location;
+ Statement st;
+ Block(out st);
+ if (st != null) {
+ st.StartLocation = startLocation;
+ if (t != null)
+ st.EndLocation = t.EndLocation;
+ else
+ st.EndLocation = la.Location;
+ st.AcceptVisitor(new SetParentVisitor(), null);
+ }
+ Expect(Tokens.EOF);
+ return st as BlockStatement;
+ }
+
+ public override List<INode> ParseTypeMembers()
+ {
+ lexer.NextToken();
+ compilationUnit = new CompilationUnit();
+
+ TypeDeclaration newType = new TypeDeclaration(Modifiers.None, null);
+ compilationUnit.BlockStart(newType);
+ ClassBody(newType);
+ compilationUnit.BlockEnd();
+ Expect(Tokens.EOF);
+ newType.AcceptVisitor(new SetParentVisitor(), null);
+ return newType.Children;
+ }
+
+ bool LeaveBlock()
+ {
+ int peek = Peek(1).kind;
+ return Tokens.BlockSucc[la.kind] && (la.kind != Tokens.End || peek == Tokens.EOL || peek == Tokens.Colon);
+ }
+
+ /* True, if "." is followed by an ident */
+ bool DotAndIdentOrKw () {
+ int peek = Peek(1).kind;
+ return la.kind == Tokens.Dot && (peek == Tokens.Identifier || peek >= Tokens.AddHandler);
+ }
+
+ static bool IsIdentifierToken(Token tk)
+ {
+ return Tokens.IdentifierTokens[tk.kind] || tk.kind == Tokens.Identifier;
+ }
+
+ bool IsIdentifiedExpressionRange()
+ {
+ return la.kind == Tokens.As || la.kind == Tokens.Assign;
+ }
+
+ bool IsQueryExpression()
+ {
+ return (la.kind == Tokens.From || la.kind == Tokens.Aggregate) && IsIdentifierToken(Peek(1));
+ }
+
+ bool IsEndStmtAhead()
+ {
+ int peek = Peek(1).kind;
+ return la.kind == Tokens.End && (peek == Tokens.EOL || peek == Tokens.Colon);
+ }
+
+ bool IsNotClosingParenthesis() {
+ return la.kind != Tokens.CloseParenthesis;
+ }
+
+ /*
+ True, if ident is followed by "=" or by ":" and "="
+ */
+ bool IsNamedAssign() {
+ if(Peek(1).kind == Tokens.Colon && Peek(2).kind == Tokens.Assign) return true;
+ return false;
+ }
+
+ bool IsObjectCreation() {
+ return la.kind == Tokens.As && Peek(1).kind == Tokens.New;
+ }
+
+ /*
+ True, if "<" is followed by the ident "assembly" or "module"
+ */
+ bool IsGlobalAttrTarget () {
+ Token pt = Peek(1);
+ return la.kind == Tokens.LessThan && ( string.Equals(pt.val, "assembly", StringComparison.InvariantCultureIgnoreCase) || string.Equals(pt.val, "module", StringComparison.InvariantCultureIgnoreCase));
+ }
+
+ /*
+ True if the next token is a "(" and is followed by "," or ")"
+ */
+ bool IsDims()
+ {
+ int peek = Peek(1).kind;
+ return la.kind == Tokens.OpenParenthesis
+ && (peek == Tokens.Comma || peek == Tokens.CloseParenthesis);
+ }
+
+ /*
+ True if the next token is an identifier
+ */
+ bool IsLoopVariableDeclaration()
+ {
+ if (!IsIdentifierToken(la))
+ return false;
+ lexer.StartPeek();
+ Token x = lexer.Peek();
+ if (x.kind == Tokens.OpenParenthesis) {
+ do {
+ x = lexer.Peek();
+ } while (x.kind == Tokens.Comma);
+ if (x.kind != Tokens.CloseParenthesis)
+ return false;
+ x = lexer.Peek();
+ }
+ return x.kind == Tokens.As || x.kind == Tokens.Assign;
+ }
+
+ bool IsSize()
+ {
+ return la.kind == Tokens.OpenParenthesis;
+ }
+
+ /*
+ True, if the comma is not a trailing one,
+ like the last one in: a, b, c,
+ */
+ bool NotFinalComma() {
+ int peek = Peek(1).kind;
+ return la.kind == Tokens.Comma &&
+ peek != Tokens.CloseCurlyBrace;
+ }
+
+ /*
+ True, if the next token is "Else" and this one
+ if followed by "If"
+ */
+ bool IsElseIf()
+ {
+ int peek = Peek(1).kind;
+ return la.kind == Tokens.Else && peek == Tokens.If;
+ }
+
+ /*
+ True if the next token is goto and this one is
+ followed by minus ("-") (this is allowd in in
+ error clauses)
+ */
+ bool IsNegativeLabelName()
+ {
+ int peek = Peek(1).kind;
+ return la.kind == Tokens.GoTo && peek == Tokens.Minus;
+ }
+
+ /*
+ True if the next statement is a "Resume next" statement
+ */
+ bool IsResumeNext()
+ {
+ int peek = Peek(1).kind;
+ return la.kind == Tokens.Resume && peek == Tokens.Next;
+ }
+
+ /*
+ True, if ident/literal integer is followed by ":"
+ */
+ bool IsLabel()
+ {
+ return (la.kind == Tokens.Identifier || la.kind == Tokens.LiteralInteger)
+ && Peek(1).kind == Tokens.Colon;
+ }
+
+ bool IsNotStatementSeparator()
+ {
+ return la.kind == Tokens.Colon && Peek(1).kind == Tokens.EOL;
+ }
+
+ static bool IsMustOverride(ModifierList m)
+ {
+ return m.Contains(Modifiers.Abstract);
+ }
+
+ /* Writes the type name represented through the expression into the string builder. */
+ /* Returns true when the expression was converted successfully, returns false when */
+ /* There was an unknown expression (e.g. TypeReferenceExpression) in it */
+ bool WriteFullTypeName(StringBuilder b, Expression expr)
+ {
+ MemberReferenceExpression fre = expr as MemberReferenceExpression;
+ if (fre != null) {
+ bool result = WriteFullTypeName(b, fre.TargetObject);
+ if (b.Length > 0) b.Append('.');
+ b.Append(fre.MemberName);
+ return result;
+ } else if (expr is IdentifierExpression) {
+ b.Append(((IdentifierExpression)expr).Identifier);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /*
+ True, if lookahead is a local attribute target specifier,
+ i.e. one of "event", "return", "field", "method",
+ "module", "param", "property", or "type"
+ */
+ bool IsLocalAttrTarget() {
+ // TODO
+ return false;
+ }
+
+ void EnsureIsZero(Expression expr)
+ {
+ if (!(expr is PrimitiveExpression) || (expr as PrimitiveExpression).StringValue != "0")
+ Error("lower bound of array must be zero");
+ }
+
+ /// <summary>
+ /// Adds a child item to a collection stored in the parent node.
+ /// Also set's the item's parent to <paramref name="parent"/>.
+ /// Does nothing if item is null.
+ /// </summary>
+ static void SafeAdd<T>(INode parent, List<T> list, T item) where T : class, INode
+ {
+ Debug.Assert(parent != null);
+ Debug.Assert((parent is INullable) ? !(parent as INullable).IsNull : true);
+ if (item != null) {
+ list.Add(item);
+ item.Parent = parent;
+ }
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/ParserFactory.cs b/main/contrib/NRefactory/Project/Src/ParserFactory.cs
index 340a44fe03..c94816ac69 100644
--- a/main/contrib/NRefactory/Project/Src/ParserFactory.cs
+++ b/main/contrib/NRefactory/Project/Src/ParserFactory.cs
@@ -1,62 +1,62 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="none" email=""/>
-// <version>$Revision: 1965 $</version>
-// </file>
-
-using System;
-using System.IO;
-using System.Text;
-
-namespace ICSharpCode.NRefactory
-{
- public enum SupportedLanguage {
- CSharp,
- VBNet
- }
-
- /// <summary>
- /// Static helper class that constructs lexer and parser objects.
- /// </summary>
- public static class ParserFactory
- {
- public static Parser.ILexer CreateLexer(SupportedLanguage language, TextReader textReader)
- {
- switch (language) {
- case SupportedLanguage.CSharp:
- return new ICSharpCode.NRefactory.Parser.CSharp.Lexer(textReader);
- case SupportedLanguage.VBNet:
- return new ICSharpCode.NRefactory.Parser.VB.Lexer(textReader);
- }
- throw new System.NotSupportedException(language + " not supported.");
- }
-
- public static IParser CreateParser(SupportedLanguage language, TextReader textReader)
- {
- Parser.ILexer lexer = CreateLexer(language, textReader);
- switch (language) {
- case SupportedLanguage.CSharp:
- return new ICSharpCode.NRefactory.Parser.CSharp.Parser(lexer);
- case SupportedLanguage.VBNet:
- return new ICSharpCode.NRefactory.Parser.VB.Parser(lexer);
- }
- throw new System.NotSupportedException(language + " not supported.");
- }
-
- public static IParser CreateParser(string fileName)
- {
- return CreateParser(fileName, Encoding.UTF8);
- }
-
- public static IParser CreateParser(string fileName, Encoding encoding)
- {
- string ext = Path.GetExtension(fileName);
- if (ext.Equals(".cs", StringComparison.InvariantCultureIgnoreCase))
- return CreateParser(SupportedLanguage.CSharp, new StreamReader(fileName, encoding));
- if (ext.Equals(".vb", StringComparison.InvariantCultureIgnoreCase))
- return CreateParser(SupportedLanguage.VBNet, new StreamReader(fileName, encoding));
- return null;
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="none" email=""/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+using System.IO;
+using System.Text;
+
+namespace ICSharpCode.NRefactory
+{
+ public enum SupportedLanguage {
+ CSharp,
+ VBNet
+ }
+
+ /// <summary>
+ /// Static helper class that constructs lexer and parser objects.
+ /// </summary>
+ public static class ParserFactory
+ {
+ public static Parser.ILexer CreateLexer(SupportedLanguage language, TextReader textReader)
+ {
+ switch (language) {
+ case SupportedLanguage.CSharp:
+ return new ICSharpCode.NRefactory.Parser.CSharp.Lexer(textReader);
+ case SupportedLanguage.VBNet:
+ return new ICSharpCode.NRefactory.Parser.VB.Lexer(textReader);
+ }
+ throw new System.NotSupportedException(language + " not supported.");
+ }
+
+ public static IParser CreateParser(SupportedLanguage language, TextReader textReader)
+ {
+ Parser.ILexer lexer = CreateLexer(language, textReader);
+ switch (language) {
+ case SupportedLanguage.CSharp:
+ return new ICSharpCode.NRefactory.Parser.CSharp.Parser(lexer);
+ case SupportedLanguage.VBNet:
+ return new ICSharpCode.NRefactory.Parser.VB.Parser(lexer);
+ }
+ throw new System.NotSupportedException(language + " not supported.");
+ }
+
+ public static IParser CreateParser(string fileName)
+ {
+ return CreateParser(fileName, Encoding.UTF8);
+ }
+
+ public static IParser CreateParser(string fileName, Encoding encoding)
+ {
+ string ext = Path.GetExtension(fileName);
+ if (ext.Equals(".cs", StringComparison.OrdinalIgnoreCase))
+ return CreateParser(SupportedLanguage.CSharp, new StreamReader(fileName, encoding));
+ if (ext.Equals(".vb", StringComparison.OrdinalIgnoreCase))
+ return CreateParser(SupportedLanguage.VBNet, new StreamReader(fileName, encoding));
+ return null;
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/PrettyPrinter/AbstractOutputFormatter.cs b/main/contrib/NRefactory/Project/Src/PrettyPrinter/AbstractOutputFormatter.cs
index eab0e42302..359b0eda4c 100644
--- a/main/contrib/NRefactory/Project/Src/PrettyPrinter/AbstractOutputFormatter.cs
+++ b/main/contrib/NRefactory/Project/Src/PrettyPrinter/AbstractOutputFormatter.cs
@@ -2,7 +2,7 @@
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 4324 $</version>
+// <version>$Revision: 4482 $</version>
// </file>
using System;
@@ -147,7 +147,6 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
{
WriteInPreviousLine(txt, forceWriteInPreviousBlock, true);
}
-
protected void WriteInPreviousLine(string txt, bool forceWriteInPreviousBlock, bool indent)
{
if (txt.Length == 0) return;
diff --git a/main/contrib/NRefactory/Project/Src/PrettyPrinter/AbstractPrettyPrintOptions.cs b/main/contrib/NRefactory/Project/Src/PrettyPrinter/AbstractPrettyPrintOptions.cs
index 6c21fec500..03c4f6abbd 100644
--- a/main/contrib/NRefactory/Project/Src/PrettyPrinter/AbstractPrettyPrintOptions.cs
+++ b/main/contrib/NRefactory/Project/Src/PrettyPrinter/AbstractPrettyPrintOptions.cs
@@ -1,46 +1,46 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1966 $</version>
-// </file>
-
-namespace ICSharpCode.NRefactory.PrettyPrinter
-{
- /// <summary>
- /// Description of PrettyPrintOptions.
- /// </summary>
- public class AbstractPrettyPrintOptions
- {
- char indentationChar = '\t';
- int tabSize = 4;
- int indentSize = 4;
-
- public char IndentationChar {
- get {
- return indentationChar;
- }
- set {
- indentationChar = value;
- }
- }
-
- public int TabSize {
- get {
- return tabSize;
- }
- set {
- tabSize = value;
- }
- }
-
- public int IndentSize {
- get {
- return indentSize;
- }
- set {
- indentSize = value;
- }
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+namespace ICSharpCode.NRefactory.PrettyPrinter
+{
+ /// <summary>
+ /// Description of PrettyPrintOptions.
+ /// </summary>
+ public class AbstractPrettyPrintOptions
+ {
+ char indentationChar = '\t';
+ int tabSize = 4;
+ int indentSize = 4;
+
+ public char IndentationChar {
+ get {
+ return indentationChar;
+ }
+ set {
+ indentationChar = value;
+ }
+ }
+
+ public int TabSize {
+ get {
+ return tabSize;
+ }
+ set {
+ tabSize = value;
+ }
+ }
+
+ public int IndentSize {
+ get {
+ return indentSize;
+ }
+ set {
+ indentSize = value;
+ }
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs b/main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs
index f93e73db94..903f8f3604 100644
--- a/main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs
+++ b/main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs
@@ -2,7 +2,7 @@
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 4471 $</version>
+// <version>$Revision: 4741 $</version>
// </file>
using System;
@@ -44,6 +44,11 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
public PrettyPrintOptions Options {
get { return prettyPrintOptions; }
+ set {
+ if (value == null)
+ throw new ArgumentNullException();
+ prettyPrintOptions = value;
+ }
}
public IOutputFormatter OutputFormatter {
@@ -589,15 +594,44 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
}
outputFormatter.PrintIdentifier(propertyDeclaration.Name);
- outputFormatter.BeginBrace(this.prettyPrintOptions.PropertyBraceStyle, this.prettyPrintOptions.IndentPropertyBody);
-
- TrackVisit(propertyDeclaration.GetRegion, data);
- TrackVisit(propertyDeclaration.SetRegion, data);
+ OutputGetAndSetRegion(propertyDeclaration.GetRegion, propertyDeclaration.SetRegion);
- outputFormatter.EndBrace(this.prettyPrintOptions.IndentPropertyBody);
return null;
}
+ void OutputGetAndSetRegion(PropertyGetRegion getRegion, PropertySetRegion setRegion)
+ {
+ BraceStyle braceStyle = this.prettyPrintOptions.PropertyBraceStyle;
+
+ if (getRegion.Block.IsNull && setRegion.Block.IsNull && getRegion.Attributes.Count == 0 && setRegion.Attributes.Count == 0
+ && (braceStyle == BraceStyle.EndOfLine || braceStyle == BraceStyle.EndOfLineWithoutSpace))
+ {
+ if (braceStyle == BraceStyle.EndOfLine)
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.OpenCurlyBrace);
+ // automatic property / abstract property:
+ // output in a single line: "string Text { get; set; }"
+ if (!getRegion.IsNull) {
+ outputFormatter.Space();
+ OutputModifier(getRegion.Modifier);
+ outputFormatter.PrintText("get;");
+ }
+ if (!setRegion.IsNull) {
+ outputFormatter.Space();
+ OutputModifier(setRegion.Modifier);
+ outputFormatter.PrintText("set;");
+ }
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.CloseCurlyBrace);
+ outputFormatter.NewLine();
+ } else {
+ outputFormatter.BeginBrace(braceStyle, this.prettyPrintOptions.IndentPropertyBody);
+ TrackVisit(getRegion, null);
+ TrackVisit(setRegion, null);
+ outputFormatter.EndBrace(this.prettyPrintOptions.IndentPropertyBody);
+ }
+ }
+
public override object TrackedVisitPropertyGetRegion(PropertyGetRegion propertyGetRegion, object data)
{
this.VisitAttributes(propertyGetRegion.Attributes, data);
@@ -658,7 +692,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
outputFormatter.PrintToken(Tokens.Semicolon);
outputFormatter.NewLine();
} else {
- outputFormatter.BeginBrace(this.prettyPrintOptions.PropertyBraceStyle, this.prettyPrintOptions.IndentEventBody);
+ outputFormatter.BeginBrace(this.prettyPrintOptions.EventBraceStyle, this.prettyPrintOptions.IndentEventBody);
TrackVisit(eventDeclaration.AddRegion, data);
TrackVisit(eventDeclaration.RemoveRegion, data);
outputFormatter.EndBrace(this.prettyPrintOptions.IndentEventBody);
@@ -786,6 +820,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
} else {
switch (operatorDeclaration.OverloadableOperator) {
case OverloadableOperatorType.Add:
+ case OverloadableOperatorType.UnaryPlus:
outputFormatter.PrintToken(Tokens.Plus);
break;
case OverloadableOperatorType.BitNot:
@@ -859,6 +894,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
outputFormatter.PrintToken(Tokens.GreaterThan);
outputFormatter.PrintToken(Tokens.GreaterThan);
break;
+ case OverloadableOperatorType.UnaryMinus:
case OverloadableOperatorType.Subtract:
outputFormatter.PrintToken(Tokens.Minus);
break;
@@ -950,18 +986,15 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
if (this.prettyPrintOptions.SpacesWithinBrackets) {
outputFormatter.Space();
}
+
outputFormatter.PrintToken(Tokens.CloseSquareBracket);
- outputFormatter.NewLine();
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.OpenCurlyBrace);
- outputFormatter.NewLine();
- ++outputFormatter.IndentationLevel;
+
+ outputFormatter.BeginBrace(this.prettyPrintOptions.PropertyBraceStyle, this.prettyPrintOptions.IndentPropertyBody);
+
TrackVisit(indexerDeclaration.GetRegion, data);
TrackVisit(indexerDeclaration.SetRegion, data);
- --outputFormatter.IndentationLevel;
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.CloseCurlyBrace);
- outputFormatter.NewLine();
+
+ outputFormatter.EndBrace(this.prettyPrintOptions.IndentPropertyBody);
return null;
}
@@ -1268,13 +1301,17 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
outputFormatter.PrintToken(Tokens.CloseParenthesis);
PrintIfSection(ifElseStatement.TrueStatement);
+ bool wasBlock = false;
+ if (ifElseStatement.TrueStatement != null && ifElseStatement.TrueStatement.Count > 0)
+ wasBlock = ifElseStatement.TrueStatement.Last () is BlockStatement;
foreach (ElseIfSection elseIfSection in ifElseStatement.ElseIfSections) {
TrackVisit(elseIfSection, data);
+ wasBlock = elseIfSection.EmbeddedStatement is BlockStatement;
}
if (ifElseStatement.HasElseStatements) {
- if (prettyPrintOptions.PlaceElseOnNewLine) {
+ if (prettyPrintOptions.PlaceElseOnNewLine || (prettyPrintOptions.PlaceNonBlockElseOnNewLine && !wasBlock)) {
outputFormatter.NewLine();
outputFormatter.Indent();
} else {
@@ -1289,33 +1326,31 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
void PrintIfSection(List<Statement> statements)
{
- /*
if (statements.Count == 1 && (statements[0] is BlockStatement)) {
- WriteEmbeddedStatement(statements[0],
- prettyPrintOptions.IfElseBraceForcement,
- prettyPrintOptions.StatementBraceStyle,
- prettyPrintOptions.PlaceElseOnNewLine);
+ OutputBlock((BlockStatement)statements[0],
+ prettyPrintOptions.StatementBraceStyle,
+ prettyPrintOptions.PlaceElseOnNewLine);
return;
- }*/
+ }
/* if (statements.Count != 1 || !(statements[0] is BlockStatement)) {
outputFormatter.Space();
}*/
if (statements.Count != 1) {
outputFormatter.PrintToken(Tokens.OpenCurlyBrace);
+ } else {
outputFormatter.NewLine ();
outputFormatter.IndentationLevel++;
outputFormatter.Indent ();
- foreach (Statement stmt in statements) {
- TrackVisit(stmt, prettyPrintOptions.StatementBraceStyle);
- }
+ }
+
+ foreach (Statement stmt in statements) {
+ TrackVisit(stmt, prettyPrintOptions.StatementBraceStyle);
+ }
+
+ if (statements.Count == 1) {
outputFormatter.IndentationLevel--;
- outputFormatter.PrintToken(Tokens.CloseCurlyBrace);
} else {
- WriteEmbeddedStatement(statements[0],
- prettyPrintOptions.IfElseBraceForcement,
- prettyPrintOptions.StatementBraceStyle,
- false);
-
+ outputFormatter.PrintToken(Tokens.CloseCurlyBrace);
}
/* if (statements.Count != 1 || !(statements[0] is BlockStatement)) {
outputFormatter.Space();
@@ -1325,7 +1360,6 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
public override object TrackedVisitElseIfSection(ElseIfSection elseIfSection, object data)
{
if (prettyPrintOptions.PlaceElseOnNewLine) {
- outputFormatter.NewLine();
outputFormatter.Indent();
} else {
outputFormatter.Space();
@@ -1346,10 +1380,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
}
outputFormatter.PrintToken(Tokens.CloseParenthesis);
- WriteEmbeddedStatement(elseIfSection.EmbeddedStatement,
- prettyPrintOptions.IfElseBraceForcement,
- prettyPrintOptions.StatementBraceStyle,
- false);
+ WriteEmbeddedStatement(elseIfSection.EmbeddedStatement, prettyPrintOptions.IfElseBraceForcement, prettyPrintOptions.StatementBraceStyle, false);
return null;
}
@@ -1407,10 +1438,8 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
outputFormatter.DoNewLine = true;
outputFormatter.DoIndent = true;
- WriteEmbeddedStatement (forStatement.EmbeddedStatement,
- prettyPrintOptions.ForBraceForcement,
- prettyPrintOptions.StatementBraceStyle,
- true);
+ WriteEmbeddedStatement(forStatement.EmbeddedStatement, prettyPrintOptions.ForBraceForcement, prettyPrintOptions.StatementBraceStyle, true);
+
return null;
}
@@ -1678,10 +1707,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
outputFormatter.PrintToken(Tokens.Do);
}
- WriteEmbeddedStatement(doLoopStatement.EmbeddedStatement,
- prettyPrintOptions.WhileBraceForcement,
- prettyPrintOptions.StatementBraceStyle,
- prettyPrintOptions.PlaceWhileOnNewLine);
+ WriteEmbeddedStatement(doLoopStatement.EmbeddedStatement, prettyPrintOptions.WhileBraceForcement, prettyPrintOptions.StatementBraceStyle, prettyPrintOptions.PlaceWhileOnNewLine);
if (doLoopStatement.ConditionPosition == ConditionPosition.End) {
if (prettyPrintOptions.PlaceWhileOnNewLine) {
@@ -1719,10 +1745,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
}
outputFormatter.PrintToken(Tokens.CloseParenthesis);
- WriteEmbeddedStatement(foreachStatement.EmbeddedStatement,
- prettyPrintOptions.ForEachBraceForcement,
- prettyPrintOptions.StatementBraceStyle,
- true);
+ WriteEmbeddedStatement(foreachStatement.EmbeddedStatement, prettyPrintOptions.ForEachBraceForcement, prettyPrintOptions.StatementBraceStyle, true);
return null;
}
@@ -1764,10 +1787,8 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
}
outputFormatter.PrintToken(Tokens.CloseParenthesis);
- WriteEmbeddedStatement(usingStatement.EmbeddedStatement,
- prettyPrintOptions.UsingBraceForcement,
- prettyPrintOptions.StatementBraceStyle,
- true);
+ WriteEmbeddedStatement(usingStatement.EmbeddedStatement, prettyPrintOptions.UsingBraceForcement, prettyPrintOptions.StatementBraceStyle, true);
+
return null;
}
@@ -1792,7 +1813,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
{
outputFormatter.PrintToken(Tokens.Try);
- WriteEmbeddedStatement(tryCatchStatement.StatementBlock, prettyPrintOptions.PlaceCatchOnNewLine);
+ WriteEmbeddedStatement (tryCatchStatement.StatementBlock, prettyPrintOptions.PlaceCatchOnNewLine);
for (int i = 0 ; i < tryCatchStatement.CatchClauses.Count; i++) {
TrackVisit(tryCatchStatement.CatchClauses[i], i == tryCatchStatement.CatchClauses.Count - 1);
}
@@ -1870,10 +1891,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
}
outputFormatter.PrintToken(Tokens.CloseParenthesis);
- WriteEmbeddedStatement(fixedStatement.EmbeddedStatement,
- prettyPrintOptions.FixedBraceForcement,
- prettyPrintOptions.StatementBraceStyle,
- true);
+ WriteEmbeddedStatement(fixedStatement.EmbeddedStatement, prettyPrintOptions.FixedBraceForcement, prettyPrintOptions.StatementBraceStyle, true);
return null;
}
@@ -1971,10 +1989,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
}
outputFormatter.PrintToken(Tokens.CloseParenthesis);
- WriteEmbeddedStatement (forNextStatement.EmbeddedStatement,
- prettyPrintOptions.ForBraceForcement,
- prettyPrintOptions.StatementBraceStyle,
- true);
+ WriteEmbeddedStatement(forNextStatement.EmbeddedStatement, prettyPrintOptions.ForBraceForcement, prettyPrintOptions.StatementBraceStyle, true);
return null;
}
#endregion
@@ -2621,8 +2636,8 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
}
outputFormatter.Space();
outputFormatter.PrintToken(Tokens.LambdaArrow);
- outputFormatter.Space();
if (!lambdaExpression.ExpressionBody.IsNull) {
+ outputFormatter.Space();
TrackVisit(lambdaExpression.ExpressionBody, null);
}
if (!lambdaExpression.StatementBody.IsNull) {
diff --git a/main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/OutputFormatter.cs b/main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/OutputFormatter.cs
index d0b0e466d7..15642fc40d 100644
--- a/main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/OutputFormatter.cs
+++ b/main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/OutputFormatter.cs
@@ -2,7 +2,7 @@
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 4324 $</version>
+// <version>$Revision: 4482 $</version>
// </file>
using System.Collections;
diff --git a/main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/PrettyPrintOptions.cs b/main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/PrettyPrintOptions.cs
index 323ca6fe4e..d4015de268 100644
--- a/main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/PrettyPrintOptions.cs
+++ b/main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/PrettyPrintOptions.cs
@@ -2,7 +2,7 @@
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 4349 $</version>
+// <version>$Revision: 4481 $</version>
// </file>
namespace ICSharpCode.NRefactory.PrettyPrinter
@@ -420,45 +420,11 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
#endregion
#region NewLines
- bool placeCatchOnNewLine = true;
- public bool PlaceCatchOnNewLine {
- get {
- return placeCatchOnNewLine;
- }
- set {
- placeCatchOnNewLine = value;
- }
- }
-
- bool placeFinallyOnNewLine = true;
- public bool PlaceFinallyOnNewLine {
- get {
- return placeFinallyOnNewLine;
- }
- set {
- placeFinallyOnNewLine = value;
- }
- }
-
- bool placeElseOnNewLine = true;
- public bool PlaceElseOnNewLine {
- get {
- return placeElseOnNewLine;
- }
- set {
- placeElseOnNewLine = value;
- }
- }
-
- bool placeWhileOnNewLine = true;
- public bool PlaceWhileOnNewLine {
- get {
- return placeWhileOnNewLine;
- }
- set {
- placeWhileOnNewLine = value;
- }
- }
+ public bool PlaceCatchOnNewLine { get; set; }
+ public bool PlaceFinallyOnNewLine { get; set; }
+ public bool PlaceElseOnNewLine { get; set; }
+ public bool PlaceNonBlockElseOnNewLine { get; set; }
+ public bool PlaceWhileOnNewLine { get; set; }
#endregion
#region Spaces
@@ -960,5 +926,10 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
}
#endregion
#endregion
+
+ public PrettyPrintOptions ()
+ {
+ PlaceNonBlockElseOnNewLine = true;
+ }
}
} \ No newline at end of file
diff --git a/main/contrib/NRefactory/Project/Src/PrettyPrinter/IOutputAstVisitor.cs b/main/contrib/NRefactory/Project/Src/PrettyPrinter/IOutputAstVisitor.cs
index 8e2831b168..95bc6987dd 100644
--- a/main/contrib/NRefactory/Project/Src/PrettyPrinter/IOutputAstVisitor.cs
+++ b/main/contrib/NRefactory/Project/Src/PrettyPrinter/IOutputAstVisitor.cs
@@ -1,56 +1,56 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 2654 $</version>
-// </file>
-
-using System;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.PrettyPrinter
-{
- /// <summary>
- /// Description of IOutputASTVisitor.
- /// </summary>
- public interface IOutputAstVisitor : IAstVisitor
- {
- event Action<INode> BeforeNodeVisit;
- event Action<INode> AfterNodeVisit;
-
- string Text {
- get;
- }
-
- Errors Errors {
- get;
- }
-
- AbstractPrettyPrintOptions Options {
- get;
- }
- IOutputFormatter OutputFormatter {
- get;
- }
- }
- public interface IOutputFormatter
- {
- int IndentationLevel {
- get;
- set;
- }
- string Text {
- get;
- }
- bool IsInMemberBody {
- get;
- set;
- }
- void NewLine();
- void Indent();
- void PrintComment(Comment comment, bool forceWriteInPreviousBlock);
- void PrintPreprocessingDirective(PreprocessingDirective directive, bool forceWriteInPreviousBlock);
- void PrintBlankLine(bool forceWriteInPreviousBlock);
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+using ICSharpCode.NRefactory.Parser;
+using ICSharpCode.NRefactory.Ast;
+
+namespace ICSharpCode.NRefactory.PrettyPrinter
+{
+ /// <summary>
+ /// Description of IOutputASTVisitor.
+ /// </summary>
+ public interface IOutputAstVisitor : IAstVisitor
+ {
+ event Action<INode> BeforeNodeVisit;
+ event Action<INode> AfterNodeVisit;
+
+ string Text {
+ get;
+ }
+
+ Errors Errors {
+ get;
+ }
+
+ AbstractPrettyPrintOptions Options {
+ get;
+ }
+ IOutputFormatter OutputFormatter {
+ get;
+ }
+ }
+ public interface IOutputFormatter
+ {
+ int IndentationLevel {
+ get;
+ set;
+ }
+ string Text {
+ get;
+ }
+ bool IsInMemberBody {
+ get;
+ set;
+ }
+ void NewLine();
+ void Indent();
+ void PrintComment(Comment comment, bool forceWriteInPreviousBlock);
+ void PrintPreprocessingDirective(PreprocessingDirective directive, bool forceWriteInPreviousBlock);
+ void PrintBlankLine(bool forceWriteInPreviousBlock);
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/PrettyPrinter/SpecialNodesInserter.cs b/main/contrib/NRefactory/Project/Src/PrettyPrinter/SpecialNodesInserter.cs
index fab92f919c..cf465a7e44 100644
--- a/main/contrib/NRefactory/Project/Src/PrettyPrinter/SpecialNodesInserter.cs
+++ b/main/contrib/NRefactory/Project/Src/PrettyPrinter/SpecialNodesInserter.cs
@@ -1,146 +1,146 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 2654 $</version>
-// </file>
-
-using System;
-using System.Collections.Generic;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.PrettyPrinter
-{
- public class SpecialOutputVisitor : ISpecialVisitor
- {
- readonly IOutputFormatter formatter;
-
- public SpecialOutputVisitor(IOutputFormatter formatter)
- {
- this.formatter = formatter;
- }
-
- public bool ForceWriteInPreviousLine;
-
- public object Visit(ISpecial special, object data)
- {
- Console.WriteLine("Warning: SpecialOutputVisitor.Visit(ISpecial) called with " + special);
- return data;
- }
-
- public object Visit(BlankLine special, object data)
- {
- formatter.PrintBlankLine(ForceWriteInPreviousLine);
- return data;
- }
-
- public object Visit(Comment special, object data)
- {
- formatter.PrintComment(special, ForceWriteInPreviousLine);
- return data;
- }
-
- public object Visit(PreprocessingDirective special, object data)
- {
- formatter.PrintPreprocessingDirective(special, ForceWriteInPreviousLine);
- return data;
- }
- }
-
- /// <summary>
- /// This class inserts specials between INodes.
- /// </summary>
- public sealed class SpecialNodesInserter : IDisposable
- {
- IEnumerator<ISpecial> enumerator;
- SpecialOutputVisitor visitor;
- bool available; // true when more specials are available
-
- public SpecialNodesInserter(IEnumerable<ISpecial> specials, SpecialOutputVisitor visitor)
- {
- if (specials == null) throw new ArgumentNullException("specials");
- if (visitor == null) throw new ArgumentNullException("visitor");
- enumerator = specials.GetEnumerator();
- this.visitor = visitor;
- available = enumerator.MoveNext();
- }
-
- void WriteCurrent()
- {
- enumerator.Current.AcceptVisitor(visitor, null);
- available = enumerator.MoveNext();
- }
-
- AttributedNode currentAttributedNode;
-
- /// <summary>
- /// Writes all specials up to the start position of the node.
- /// </summary>
- public void AcceptNodeStart(INode node)
- {
- if (node is AttributedNode) {
- currentAttributedNode = node as AttributedNode;
- if (currentAttributedNode.Attributes.Count == 0) {
- AcceptPoint(node.StartLocation);
- currentAttributedNode = null;
- }
- } else {
- AcceptPoint(node.StartLocation);
- }
- }
-
- /// <summary>
- /// Writes all specials up to the end position of the node.
- /// </summary>
- public void AcceptNodeEnd(INode node)
- {
- visitor.ForceWriteInPreviousLine = true;
- AcceptPoint(node.EndLocation);
- visitor.ForceWriteInPreviousLine = false;
- if (currentAttributedNode != null) {
- if (node == currentAttributedNode.Attributes[currentAttributedNode.Attributes.Count - 1]) {
- AcceptPoint(currentAttributedNode.StartLocation);
- currentAttributedNode = null;
- }
- }
- }
-
- /// <summary>
- /// Writes all specials up to the specified location.
- /// </summary>
- public void AcceptPoint(Location loc)
- {
- while (available && enumerator.Current.StartPosition <= loc) {
- WriteCurrent();
- }
- }
-
- /// <summary>
- /// Outputs all missing specials to the writer.
- /// </summary>
- public void Finish()
- {
- while (available) {
- WriteCurrent();
- }
- }
-
- void IDisposable.Dispose()
- {
- Finish();
- }
-
- /// <summary>
- /// Registers a new SpecialNodesInserter with the output visitor.
- /// Make sure to call Finish() (or Dispose()) on the returned SpecialNodesInserter
- /// when the output is finished.
- /// </summary>
- public static SpecialNodesInserter Install(IEnumerable<ISpecial> specials, IOutputAstVisitor outputVisitor)
- {
- SpecialNodesInserter sni = new SpecialNodesInserter(specials, new SpecialOutputVisitor(outputVisitor.OutputFormatter));
- outputVisitor.BeforeNodeVisit += sni.AcceptNodeStart;
- outputVisitor.AfterNodeVisit += sni.AcceptNodeEnd;
- return sni;
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+using System.Collections.Generic;
+using ICSharpCode.NRefactory.Ast;
+
+namespace ICSharpCode.NRefactory.PrettyPrinter
+{
+ public class SpecialOutputVisitor : ISpecialVisitor
+ {
+ readonly IOutputFormatter formatter;
+
+ public SpecialOutputVisitor(IOutputFormatter formatter)
+ {
+ this.formatter = formatter;
+ }
+
+ public bool ForceWriteInPreviousLine;
+
+ public object Visit(ISpecial special, object data)
+ {
+ Console.WriteLine("Warning: SpecialOutputVisitor.Visit(ISpecial) called with " + special);
+ return data;
+ }
+
+ public object Visit(BlankLine special, object data)
+ {
+ formatter.PrintBlankLine(ForceWriteInPreviousLine);
+ return data;
+ }
+
+ public object Visit(Comment special, object data)
+ {
+ formatter.PrintComment(special, ForceWriteInPreviousLine);
+ return data;
+ }
+
+ public object Visit(PreprocessingDirective special, object data)
+ {
+ formatter.PrintPreprocessingDirective(special, ForceWriteInPreviousLine);
+ return data;
+ }
+ }
+
+ /// <summary>
+ /// This class inserts specials between INodes.
+ /// </summary>
+ public sealed class SpecialNodesInserter : IDisposable
+ {
+ IEnumerator<ISpecial> enumerator;
+ SpecialOutputVisitor visitor;
+ bool available; // true when more specials are available
+
+ public SpecialNodesInserter(IEnumerable<ISpecial> specials, SpecialOutputVisitor visitor)
+ {
+ if (specials == null) throw new ArgumentNullException("specials");
+ if (visitor == null) throw new ArgumentNullException("visitor");
+ enumerator = specials.GetEnumerator();
+ this.visitor = visitor;
+ available = enumerator.MoveNext();
+ }
+
+ void WriteCurrent()
+ {
+ enumerator.Current.AcceptVisitor(visitor, null);
+ available = enumerator.MoveNext();
+ }
+
+ AttributedNode currentAttributedNode;
+
+ /// <summary>
+ /// Writes all specials up to the start position of the node.
+ /// </summary>
+ public void AcceptNodeStart(INode node)
+ {
+ if (node is AttributedNode) {
+ currentAttributedNode = node as AttributedNode;
+ if (currentAttributedNode.Attributes.Count == 0) {
+ AcceptPoint(node.StartLocation);
+ currentAttributedNode = null;
+ }
+ } else {
+ AcceptPoint(node.StartLocation);
+ }
+ }
+
+ /// <summary>
+ /// Writes all specials up to the end position of the node.
+ /// </summary>
+ public void AcceptNodeEnd(INode node)
+ {
+ visitor.ForceWriteInPreviousLine = true;
+ AcceptPoint(node.EndLocation);
+ visitor.ForceWriteInPreviousLine = false;
+ if (currentAttributedNode != null) {
+ if (node == currentAttributedNode.Attributes[currentAttributedNode.Attributes.Count - 1]) {
+ AcceptPoint(currentAttributedNode.StartLocation);
+ currentAttributedNode = null;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Writes all specials up to the specified location.
+ /// </summary>
+ public void AcceptPoint(Location loc)
+ {
+ while (available && enumerator.Current.StartPosition <= loc) {
+ WriteCurrent();
+ }
+ }
+
+ /// <summary>
+ /// Outputs all missing specials to the writer.
+ /// </summary>
+ public void Finish()
+ {
+ while (available) {
+ WriteCurrent();
+ }
+ }
+
+ void IDisposable.Dispose()
+ {
+ Finish();
+ }
+
+ /// <summary>
+ /// Registers a new SpecialNodesInserter with the output visitor.
+ /// Make sure to call Finish() (or Dispose()) on the returned SpecialNodesInserter
+ /// when the output is finished.
+ /// </summary>
+ public static SpecialNodesInserter Install(IEnumerable<ISpecial> specials, IOutputAstVisitor outputVisitor)
+ {
+ SpecialNodesInserter sni = new SpecialNodesInserter(specials, new SpecialOutputVisitor(outputVisitor.OutputFormatter));
+ outputVisitor.BeforeNodeVisit += sni.AcceptNodeStart;
+ outputVisitor.AfterNodeVisit += sni.AcceptNodeEnd;
+ return sni;
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetOutputFormatter.cs b/main/contrib/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetOutputFormatter.cs
index 939d09cb54..24f16cdf1b 100644
--- a/main/contrib/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetOutputFormatter.cs
+++ b/main/contrib/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetOutputFormatter.cs
@@ -1,77 +1,77 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 3840 $</version>
-// </file>
-
-using System;
-using ICSharpCode.NRefactory.Parser.VB;
-
-namespace ICSharpCode.NRefactory.PrettyPrinter
-{
- /// <summary>
- /// Description of VBNetOutputFormatter.
- /// </summary>
- public sealed class VBNetOutputFormatter : AbstractOutputFormatter
- {
- public VBNetOutputFormatter(VBNetPrettyPrintOptions prettyPrintOptions) : base(prettyPrintOptions)
- {
- }
-
- public override void PrintToken(int token)
- {
- PrintText(Tokens.GetTokenString(token));
- }
-
- public override void PrintIdentifier(string identifier)
- {
- if (Keywords.IsNonIdentifierKeyword(identifier)) {
- PrintText("[");
- PrintText(identifier);
- PrintText("]");
- } else {
- PrintText(identifier);
- }
- }
-
- public override void PrintComment(Comment comment, bool forceWriteInPreviousBlock)
- {
- switch (comment.CommentType) {
- case CommentType.Block:
- WriteLineInPreviousLine("'" + comment.CommentText.Replace("\n", "\n'"), forceWriteInPreviousBlock);
- break;
- case CommentType.Documentation:
- WriteLineInPreviousLine("'''" + comment.CommentText, forceWriteInPreviousBlock);
- break;
- default:
- WriteLineInPreviousLine("'" + comment.CommentText, forceWriteInPreviousBlock);
- break;
- }
- }
-
- public override void PrintPreprocessingDirective(PreprocessingDirective directive, bool forceWriteInPreviousBlock)
- {
- if (IsInMemberBody
- && (string.Equals(directive.Cmd, "#Region", StringComparison.InvariantCultureIgnoreCase)
- || string.Equals(directive.Cmd, "#End", StringComparison.InvariantCultureIgnoreCase)
- && directive.Arg.StartsWith("Region", StringComparison.InvariantCultureIgnoreCase)))
- {
- WriteLineInPreviousLine("'" + directive.Cmd + " " + directive.Arg, forceWriteInPreviousBlock);
- } else if (!directive.Expression.IsNull) {
- VBNetOutputVisitor visitor = new VBNetOutputVisitor();
- directive.Expression.AcceptVisitor(visitor, null);
- WriteLineInPreviousLine(directive.Cmd + " " + visitor.Text + " Then", forceWriteInPreviousBlock);
- } else {
- base.PrintPreprocessingDirective(directive, forceWriteInPreviousBlock);
- }
- }
-
- public void PrintLineContinuation()
- {
- if (!LastCharacterIsWhiteSpace)
- Space();
- PrintText("_" + Environment.NewLine);
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+using ICSharpCode.NRefactory.Parser.VB;
+
+namespace ICSharpCode.NRefactory.PrettyPrinter
+{
+ /// <summary>
+ /// Description of VBNetOutputFormatter.
+ /// </summary>
+ public sealed class VBNetOutputFormatter : AbstractOutputFormatter
+ {
+ public VBNetOutputFormatter(VBNetPrettyPrintOptions prettyPrintOptions) : base(prettyPrintOptions)
+ {
+ }
+
+ public override void PrintToken(int token)
+ {
+ PrintText(Tokens.GetTokenString(token));
+ }
+
+ public override void PrintIdentifier(string identifier)
+ {
+ if (Keywords.IsNonIdentifierKeyword(identifier)) {
+ PrintText("[");
+ PrintText(identifier);
+ PrintText("]");
+ } else {
+ PrintText(identifier);
+ }
+ }
+
+ public override void PrintComment(Comment comment, bool forceWriteInPreviousBlock)
+ {
+ switch (comment.CommentType) {
+ case CommentType.Block:
+ WriteLineInPreviousLine("'" + comment.CommentText.Replace("\n", "\n'"), forceWriteInPreviousBlock);
+ break;
+ case CommentType.Documentation:
+ WriteLineInPreviousLine("'''" + comment.CommentText, forceWriteInPreviousBlock);
+ break;
+ default:
+ WriteLineInPreviousLine("'" + comment.CommentText, forceWriteInPreviousBlock);
+ break;
+ }
+ }
+
+ public override void PrintPreprocessingDirective(PreprocessingDirective directive, bool forceWriteInPreviousBlock)
+ {
+ if (IsInMemberBody
+ && (string.Equals(directive.Cmd, "#Region", StringComparison.InvariantCultureIgnoreCase)
+ || string.Equals(directive.Cmd, "#End", StringComparison.InvariantCultureIgnoreCase)
+ && directive.Arg.StartsWith("Region", StringComparison.InvariantCultureIgnoreCase)))
+ {
+ WriteLineInPreviousLine("'" + directive.Cmd + " " + directive.Arg, forceWriteInPreviousBlock);
+ } else if (!directive.Expression.IsNull) {
+ VBNetOutputVisitor visitor = new VBNetOutputVisitor();
+ directive.Expression.AcceptVisitor(visitor, null);
+ WriteLineInPreviousLine(directive.Cmd + " " + visitor.Text + " Then", forceWriteInPreviousBlock);
+ } else {
+ base.PrintPreprocessingDirective(directive, forceWriteInPreviousBlock);
+ }
+ }
+
+ public void PrintLineContinuation()
+ {
+ if (!LastCharacterIsWhiteSpace)
+ Space();
+ PrintText("_" + Environment.NewLine);
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetOutputVisitor.cs b/main/contrib/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetOutputVisitor.cs
index 193f51b6fb..4fa090f32c 100644
--- a/main/contrib/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetOutputVisitor.cs
+++ b/main/contrib/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetOutputVisitor.cs
@@ -1,3004 +1,3062 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 3718 $</version>
-// </file>
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Globalization;
-using System.Text;
-
-using ICSharpCode.NRefactory.Ast;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Parser.VB;
-using ICSharpCode.NRefactory.Visitors;
-
-namespace ICSharpCode.NRefactory.PrettyPrinter
-{
- public sealed class VBNetOutputVisitor : NodeTrackingAstVisitor, IOutputAstVisitor
- {
- Errors errors = new Errors();
- VBNetOutputFormatter outputFormatter;
- VBNetPrettyPrintOptions prettyPrintOptions = new VBNetPrettyPrintOptions();
- TypeDeclaration currentType;
-
- Stack<int> exitTokenStack = new Stack<int>();
-
- public string Text {
- get {
- return outputFormatter.Text;
- }
- }
-
- public Errors Errors {
- get {
- return errors;
- }
- }
-
- AbstractPrettyPrintOptions IOutputAstVisitor.Options {
- get { return prettyPrintOptions; }
- }
-
- public VBNetPrettyPrintOptions Options {
- get { return prettyPrintOptions; }
- }
-
- public IOutputFormatter OutputFormatter {
- get {
- return outputFormatter;
- }
- }
-
- public VBNetOutputVisitor()
- {
- outputFormatter = new VBNetOutputFormatter(prettyPrintOptions);
- }
-
- public event Action<INode> BeforeNodeVisit;
- public event Action<INode> AfterNodeVisit;
-
- protected override void BeginVisit(INode node)
- {
- if (BeforeNodeVisit != null) {
- BeforeNodeVisit(node);
- }
- base.BeginVisit(node);
- }
-
- protected override void EndVisit(INode node)
- {
- base.EndVisit(node);
- if (AfterNodeVisit != null) {
- AfterNodeVisit(node);
- }
- }
-
- object TrackedVisit(INode node, object data)
- {
- return node.AcceptVisitor(this, data);
- }
-
- void Error(string text, Location position)
- {
- errors.Error(position.Line, position.Column, text);
- }
-
- void UnsupportedNode(INode node)
- {
- Error(node.GetType().Name + " is unsupported", node.StartLocation);
- }
-
- #region ICSharpCode.NRefactory.Parser.IASTVisitor interface implementation
- public override object TrackedVisitCompilationUnit(CompilationUnit compilationUnit, object data)
- {
- compilationUnit.AcceptChildren(this, data);
- outputFormatter.EndFile();
- return null;
- }
-
- /// <summary>
- /// Converts type name to primitive type name. Returns typeString if typeString is not
- /// a primitive type.
- /// </summary>
- static string ConvertTypeString(string typeString)
- {
- string primitiveType;
- if (TypeReference.PrimitiveTypesVBReverse.TryGetValue(typeString, out primitiveType))
- return primitiveType;
- else
- return typeString;
- }
-
- public override object TrackedVisitTypeReference(TypeReference typeReference, object data)
- {
- if (typeReference == TypeReference.ClassConstraint) {
- outputFormatter.PrintToken(Tokens.Class);
- } else if (typeReference == TypeReference.StructConstraint) {
- outputFormatter.PrintToken(Tokens.Structure);
- } else if (typeReference == TypeReference.NewConstraint) {
- outputFormatter.PrintToken(Tokens.New);
- } else {
- PrintTypeReferenceWithoutArray(typeReference);
- if (typeReference.IsArrayType) {
- PrintArrayRank(typeReference.RankSpecifier, 0);
- }
- }
- return null;
- }
-
- void PrintTypeReferenceWithoutArray(TypeReference typeReference)
- {
- if (typeReference.IsGlobal) {
- outputFormatter.PrintToken(Tokens.Global);
- outputFormatter.PrintToken(Tokens.Dot);
- }
- bool printGenerics = true;
- if (typeReference.IsKeyword) {
- outputFormatter.PrintText(ConvertTypeString(typeReference.Type));
- } else {
- outputFormatter.PrintIdentifier(typeReference.Type);
- }
- if (printGenerics && typeReference.GenericTypes != null && typeReference.GenericTypes.Count > 0) {
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- outputFormatter.PrintToken(Tokens.Of);
- outputFormatter.Space();
- AppendCommaSeparatedList(typeReference.GenericTypes);
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- }
- for (int i = 0; i < typeReference.PointerNestingLevel; ++i) {
- outputFormatter.PrintToken(Tokens.Times);
- }
- }
-
- void PrintArrayRank(int[] rankSpecifier, int startRank)
- {
- for (int i = startRank; i < rankSpecifier.Length; ++i) {
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- for (int j = 0; j < rankSpecifier[i]; ++j) {
- outputFormatter.PrintToken(Tokens.Comma);
- }
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- }
- }
-
- public override object TrackedVisitInnerClassTypeReference(InnerClassTypeReference innerClassTypeReference, object data)
- {
- TrackedVisit(innerClassTypeReference.BaseType, data);
- outputFormatter.PrintToken(Tokens.Dot);
- return VisitTypeReference((TypeReference)innerClassTypeReference, data);
- }
-
- #region Global scope
- bool printAttributeSectionInline; // is set to true when printing parameter's attributes
-
- public override object TrackedVisitAttributeSection(AttributeSection attributeSection, object data)
- {
- if (!printAttributeSectionInline)
- outputFormatter.Indent();
- outputFormatter.PrintText("<");
- if (!string.IsNullOrEmpty(attributeSection.AttributeTarget) && !string.Equals(attributeSection.AttributeTarget, "return", StringComparison.OrdinalIgnoreCase)) {
- outputFormatter.PrintText(char.ToUpperInvariant(attributeSection.AttributeTarget[0]) + attributeSection.AttributeTarget.Substring(1));
- outputFormatter.PrintToken(Tokens.Colon);
- outputFormatter.Space();
- }
- Debug.Assert(attributeSection.Attributes != null);
- AppendCommaSeparatedList(attributeSection.Attributes);
-
- outputFormatter.PrintText(">");
-
- if ("assembly".Equals(attributeSection.AttributeTarget, StringComparison.InvariantCultureIgnoreCase)
- || "module".Equals(attributeSection.AttributeTarget, StringComparison.InvariantCultureIgnoreCase)) {
- outputFormatter.NewLine();
- } else {
- if (printAttributeSectionInline)
- outputFormatter.Space();
- else
- outputFormatter.PrintLineContinuation();
- }
-
- return null;
- }
-
- public override object TrackedVisitAttribute(ICSharpCode.NRefactory.Ast.Attribute attribute, object data)
- {
- outputFormatter.PrintIdentifier(attribute.Name);
- if (attribute.PositionalArguments.Count > 0 || attribute.NamedArguments.Count > 0) {
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- AppendCommaSeparatedList(attribute.PositionalArguments);
-
- if (attribute.NamedArguments.Count > 0) {
- if (attribute.PositionalArguments.Count > 0) {
- outputFormatter.PrintToken(Tokens.Comma);
- outputFormatter.Space();
- }
- AppendCommaSeparatedList(attribute.NamedArguments);
- }
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- }
- return null;
- }
-
- public override object TrackedVisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression, object data)
- {
- outputFormatter.PrintIdentifier(namedArgumentExpression.Name);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Colon);
- outputFormatter.PrintToken(Tokens.Assign);
- outputFormatter.Space();
- TrackedVisit(namedArgumentExpression.Expression, data);
- return null;
- }
-
- public override object TrackedVisitUsing(Using @using, object data)
- {
- Debug.Fail("Should never be called. The usings should be handled in Visit(UsingDeclaration)");
- return null;
- }
-
- public override object TrackedVisitUsingDeclaration(UsingDeclaration usingDeclaration, object data)
- {
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.Imports);
- outputFormatter.Space();
- for (int i = 0; i < usingDeclaration.Usings.Count; ++i) {
- outputFormatter.PrintIdentifier(((Using)usingDeclaration.Usings[i]).Name);
- if (((Using)usingDeclaration.Usings[i]).IsAlias) {
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Assign);
- outputFormatter.Space();
- TrackedVisit(((Using)usingDeclaration.Usings[i]).Alias, data);
- }
- if (i + 1 < usingDeclaration.Usings.Count) {
- outputFormatter.PrintToken(Tokens.Comma);
- outputFormatter.Space();
- }
- }
- outputFormatter.NewLine();
- return null;
- }
-
- public override object TrackedVisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, object data)
- {
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.Namespace);
- outputFormatter.Space();
- outputFormatter.PrintIdentifier(namespaceDeclaration.Name);
- outputFormatter.NewLine();
-
- ++outputFormatter.IndentationLevel;
- namespaceDeclaration.AcceptChildren(this, data);
- --outputFormatter.IndentationLevel;
-
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.End);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Namespace);
- outputFormatter.NewLine();
- return null;
- }
-
- static int GetTypeToken(TypeDeclaration typeDeclaration)
- {
- switch (typeDeclaration.Type) {
- case ClassType.Class:
- return Tokens.Class;
- case ClassType.Enum:
- return Tokens.Enum;
- case ClassType.Interface:
- return Tokens.Interface;
- case ClassType.Struct:
- return Tokens.Structure;
- default:
- return Tokens.Class;
- }
- }
-
- void PrintTemplates(List<TemplateDefinition> templates)
- {
- if (templates != null && templates.Count > 0) {
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- outputFormatter.PrintToken(Tokens.Of);
- outputFormatter.Space();
- AppendCommaSeparatedList(templates);
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- }
- }
-
- public override object TrackedVisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
- {
- VisitAttributes(typeDeclaration.Attributes, data);
-
- outputFormatter.Indent();
- OutputModifier(typeDeclaration.Modifier, true);
-
- int typeToken = GetTypeToken(typeDeclaration);
- outputFormatter.PrintToken(typeToken);
- outputFormatter.Space();
- outputFormatter.PrintIdentifier(typeDeclaration.Name);
-
- PrintTemplates(typeDeclaration.Templates);
-
- if (typeDeclaration.Type == ClassType.Enum
- && typeDeclaration.BaseTypes != null && typeDeclaration.BaseTypes.Count > 0)
- {
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.As);
- outputFormatter.Space();
- foreach (TypeReference baseTypeRef in typeDeclaration.BaseTypes) {
- TrackedVisit(baseTypeRef, data);
- }
- }
-
- outputFormatter.NewLine();
- ++outputFormatter.IndentationLevel;
-
- if (typeDeclaration.BaseTypes != null && typeDeclaration.Type != ClassType.Enum) {
- foreach (TypeReference baseTypeRef in typeDeclaration.BaseTypes) {
- outputFormatter.Indent();
-
- string baseType = baseTypeRef.Type;
- if (baseType.IndexOf('.') >= 0) {
- baseType = baseType.Substring(baseType.LastIndexOf('.') + 1);
- }
- bool baseTypeIsInterface = baseType.Length >= 2 && baseType[0] == 'I' && Char.IsUpper(baseType[1]);
-
- if (!baseTypeIsInterface || typeDeclaration.Type == ClassType.Interface) {
- outputFormatter.PrintToken(Tokens.Inherits);
- } else {
- outputFormatter.PrintToken(Tokens.Implements);
- }
- outputFormatter.Space();
- TrackedVisit(baseTypeRef, data);
- outputFormatter.NewLine();
- }
- }
-
- TypeDeclaration oldType = currentType;
- currentType = typeDeclaration;
-
- if (typeDeclaration.Type == ClassType.Enum) {
- OutputEnumMembers(typeDeclaration, data);
- } else {
- typeDeclaration.AcceptChildren(this, data);
- }
- currentType = oldType;
-
- --outputFormatter.IndentationLevel;
-
-
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.End);
- outputFormatter.Space();
- outputFormatter.PrintToken(typeToken);
- outputFormatter.NewLine();
- return null;
- }
-
- void OutputEnumMembers(TypeDeclaration typeDeclaration, object data)
- {
- foreach (FieldDeclaration fieldDeclaration in typeDeclaration.Children) {
- BeginVisit(fieldDeclaration);
- VariableDeclaration f = (VariableDeclaration)fieldDeclaration.Fields[0];
- VisitAttributes(fieldDeclaration.Attributes, data);
- outputFormatter.Indent();
- outputFormatter.PrintIdentifier(f.Name);
- if (f.Initializer != null && !f.Initializer.IsNull) {
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Assign);
- outputFormatter.Space();
- TrackedVisit(f.Initializer, data);
- }
- outputFormatter.NewLine();
- EndVisit(fieldDeclaration);
- }
- }
-
- public override object TrackedVisitTemplateDefinition(TemplateDefinition templateDefinition, object data)
- {
- VisitAttributes(templateDefinition.Attributes, data);
- outputFormatter.PrintIdentifier(templateDefinition.Name);
- if (templateDefinition.Bases.Count > 0) {
- outputFormatter.PrintText(" As ");
- VisitReturnTypeAttributes(templateDefinition.Attributes, data);
- if (templateDefinition.Bases.Count == 1) {
- TrackedVisit(templateDefinition.Bases[0], data);
- } else {
- outputFormatter.PrintToken(Tokens.OpenCurlyBrace);
- AppendCommaSeparatedList(templateDefinition.Bases);
- outputFormatter.PrintToken(Tokens.CloseCurlyBrace);
- }
- }
- return null;
- }
-
- public override object TrackedVisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data)
- {
- VisitAttributes(delegateDeclaration.Attributes, data);
-
- outputFormatter.Indent();
- OutputModifier(delegateDeclaration.Modifier, true);
- outputFormatter.PrintToken(Tokens.Delegate);
- outputFormatter.Space();
-
- bool isFunction = (delegateDeclaration.ReturnType.Type != "System.Void");
- if (isFunction) {
- outputFormatter.PrintToken(Tokens.Function);
- outputFormatter.Space();
- } else {
- outputFormatter.PrintToken(Tokens.Sub);
- outputFormatter.Space();
- }
- outputFormatter.PrintIdentifier(delegateDeclaration.Name);
-
- PrintTemplates(delegateDeclaration.Templates);
-
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- AppendCommaSeparatedList(delegateDeclaration.Parameters);
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
-
- if (isFunction) {
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.As);
- outputFormatter.Space();
- VisitReturnTypeAttributes(delegateDeclaration.Attributes, data);
- TrackedVisit(delegateDeclaration.ReturnType, data);
- }
- outputFormatter.NewLine();
- return null;
- }
-
- public override object TrackedVisitOptionDeclaration(OptionDeclaration optionDeclaration, object data)
- {
- outputFormatter.PrintToken(Tokens.Option);
- outputFormatter.Space();
- switch (optionDeclaration.OptionType) {
- case OptionType.Strict:
- outputFormatter.PrintToken(Tokens.Strict);
- if (!optionDeclaration.OptionValue) {
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Off);
- }
- break;
- case OptionType.Explicit:
- outputFormatter.PrintToken(Tokens.Explicit);
- outputFormatter.Space();
- if (!optionDeclaration.OptionValue) {
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Off);
- }
- break;
- case OptionType.CompareBinary:
- outputFormatter.PrintToken(Tokens.Compare);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Binary);
- break;
- case OptionType.CompareText:
- outputFormatter.PrintToken(Tokens.Compare);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Text);
- break;
- }
- outputFormatter.NewLine();
- return null;
- }
- #endregion
-
- #region Type level
- TypeReference currentVariableType;
- public override object TrackedVisitFieldDeclaration(FieldDeclaration fieldDeclaration, object data)
- {
-
- VisitAttributes(fieldDeclaration.Attributes, data);
- outputFormatter.Indent();
- if (fieldDeclaration.Modifier == Modifiers.None) {
- outputFormatter.PrintToken(Tokens.Private);
- outputFormatter.Space();
- } else if (fieldDeclaration.Modifier == Modifiers.Dim) {
- outputFormatter.PrintToken(Tokens.Dim);
- outputFormatter.Space();
- } else {
- OutputModifier(fieldDeclaration.Modifier);
- }
- currentVariableType = fieldDeclaration.TypeReference;
- AppendCommaSeparatedList(fieldDeclaration.Fields);
- currentVariableType = null;
-
- outputFormatter.NewLine();
-
- return null;
- }
-
- public override object TrackedVisitVariableDeclaration(VariableDeclaration variableDeclaration, object data)
- {
- outputFormatter.PrintIdentifier(variableDeclaration.Name);
-
- TypeReference varType = currentVariableType;
- if (varType != null && varType.IsNull)
- varType = null;
- if (varType == null && !variableDeclaration.TypeReference.IsNull)
- varType = variableDeclaration.TypeReference;
-
- if (varType != null) {
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.As);
- outputFormatter.Space();
- ObjectCreateExpression init = variableDeclaration.Initializer as ObjectCreateExpression;
- if (init != null && TypeReference.AreEqualReferences(init.CreateType, varType)) {
- TrackedVisit(variableDeclaration.Initializer, data);
- return null;
- } else {
- TrackedVisit(varType, data);
- }
- }
-
- if (!variableDeclaration.Initializer.IsNull) {
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Assign);
- outputFormatter.Space();
- TrackedVisit(variableDeclaration.Initializer, data);
- }
- return null;
- }
-
- public override object TrackedVisitPropertyDeclaration(PropertyDeclaration propertyDeclaration, object data)
- {
- VisitAttributes(propertyDeclaration.Attributes, data);
- outputFormatter.Indent();
- OutputModifier(propertyDeclaration.Modifier);
-
- if ((propertyDeclaration.Modifier & (Modifiers.ReadOnly | Modifiers.WriteOnly)) == Modifiers.None) {
- if (propertyDeclaration.IsReadOnly) {
- outputFormatter.PrintToken(Tokens.ReadOnly);
- outputFormatter.Space();
- } else if (propertyDeclaration.IsWriteOnly) {
- outputFormatter.PrintToken(Tokens.WriteOnly);
- outputFormatter.Space();
- }
- }
-
- outputFormatter.PrintToken(Tokens.Property);
- outputFormatter.Space();
- outputFormatter.PrintIdentifier(propertyDeclaration.Name);
-
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- AppendCommaSeparatedList(propertyDeclaration.Parameters);
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.As);
- outputFormatter.Space();
- VisitReturnTypeAttributes(propertyDeclaration.Attributes, data);
- TrackedVisit(propertyDeclaration.TypeReference, data);
-
- PrintInterfaceImplementations(propertyDeclaration.InterfaceImplementations);
-
- outputFormatter.NewLine();
-
- if (!IsAbstract(propertyDeclaration)) {
- outputFormatter.IsInMemberBody = true;
- ++outputFormatter.IndentationLevel;
- exitTokenStack.Push(Tokens.Property);
- TrackedVisit(propertyDeclaration.GetRegion, data);
- TrackedVisit(propertyDeclaration.SetRegion, data);
- exitTokenStack.Pop();
- --outputFormatter.IndentationLevel;
- outputFormatter.IsInMemberBody = false;
-
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.End);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Property);
- outputFormatter.NewLine();
- }
-
- return null;
- }
-
- public override object TrackedVisitPropertyGetRegion(PropertyGetRegion propertyGetRegion, object data)
- {
- VisitAttributes(propertyGetRegion.Attributes, data);
- outputFormatter.Indent();
- OutputModifier(propertyGetRegion.Modifier);
- outputFormatter.PrintToken(Tokens.Get);
- outputFormatter.NewLine();
-
- ++outputFormatter.IndentationLevel;
- TrackedVisit(propertyGetRegion.Block, data);
- --outputFormatter.IndentationLevel;
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.End);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Get);
- outputFormatter.NewLine();
- return null;
- }
-
- public override object TrackedVisitPropertySetRegion(PropertySetRegion propertySetRegion, object data)
- {
- VisitAttributes(propertySetRegion.Attributes, data);
- outputFormatter.Indent();
- OutputModifier(propertySetRegion.Modifier);
- outputFormatter.PrintToken(Tokens.Set);
- outputFormatter.NewLine();
-
- ++outputFormatter.IndentationLevel;
- TrackedVisit(propertySetRegion.Block, data);
- --outputFormatter.IndentationLevel;
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.End);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Set);
- outputFormatter.NewLine();
- return null;
- }
-
- TypeReference currentEventType = null;
- public override object TrackedVisitEventDeclaration(EventDeclaration eventDeclaration, object data)
- {
- bool customEvent = eventDeclaration.HasAddRegion || eventDeclaration.HasRemoveRegion;
-
- VisitAttributes(eventDeclaration.Attributes, data);
- outputFormatter.Indent();
- OutputModifier(eventDeclaration.Modifier);
- if (customEvent) {
- outputFormatter.PrintText("Custom");
- outputFormatter.Space();
- }
-
- outputFormatter.PrintToken(Tokens.Event);
- outputFormatter.Space();
- outputFormatter.PrintIdentifier(eventDeclaration.Name);
-
- if (eventDeclaration.Parameters.Count > 0) {
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- this.AppendCommaSeparatedList(eventDeclaration.Parameters);
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- }
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.As);
- outputFormatter.Space();
- VisitReturnTypeAttributes(eventDeclaration.Attributes, data);
- TrackedVisit(eventDeclaration.TypeReference, data);
-
- PrintInterfaceImplementations(eventDeclaration.InterfaceImplementations);
-
- if (!eventDeclaration.Initializer.IsNull) {
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Assign);
- outputFormatter.Space();
- TrackedVisit(eventDeclaration.Initializer, data);
- }
-
- outputFormatter.NewLine();
-
- if (customEvent) {
- ++outputFormatter.IndentationLevel;
- currentEventType = eventDeclaration.TypeReference;
- exitTokenStack.Push(Tokens.Sub);
- TrackedVisit(eventDeclaration.AddRegion, data);
- TrackedVisit(eventDeclaration.RemoveRegion, data);
- exitTokenStack.Pop();
- --outputFormatter.IndentationLevel;
-
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.End);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Event);
- outputFormatter.NewLine();
- }
- return null;
- }
-
- void PrintInterfaceImplementations(IList<InterfaceImplementation> list)
- {
- if (list == null || list.Count == 0)
- return;
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Implements);
- for (int i = 0; i < list.Count; i++) {
- if (i > 0)
- outputFormatter.PrintToken(Tokens.Comma);
- outputFormatter.Space();
- TrackedVisit(list[i].InterfaceType, null);
- outputFormatter.PrintToken(Tokens.Dot);
- outputFormatter.PrintIdentifier(list[i].MemberName);
- }
- }
-
- public override object TrackedVisitEventAddRegion(EventAddRegion eventAddRegion, object data)
- {
- VisitAttributes(eventAddRegion.Attributes, data);
- outputFormatter.Indent();
- outputFormatter.PrintText("AddHandler(");
- if (eventAddRegion.Parameters.Count == 0) {
- outputFormatter.PrintToken(Tokens.ByVal);
- outputFormatter.Space();
- outputFormatter.PrintIdentifier("value");
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.As);
- outputFormatter.Space();
- TrackedVisit(currentEventType, data);
- } else {
- this.AppendCommaSeparatedList(eventAddRegion.Parameters);
- }
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- outputFormatter.NewLine();
-
- ++outputFormatter.IndentationLevel;
- TrackedVisit(eventAddRegion.Block, data);
- --outputFormatter.IndentationLevel;
-
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.End);
- outputFormatter.Space();
- outputFormatter.PrintText("AddHandler");
- outputFormatter.NewLine();
- return null;
- }
-
- public override object TrackedVisitEventRemoveRegion(EventRemoveRegion eventRemoveRegion, object data)
- {
- VisitAttributes(eventRemoveRegion.Attributes, data);
- outputFormatter.Indent();
- outputFormatter.PrintText("RemoveHandler");
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- if (eventRemoveRegion.Parameters.Count == 0) {
- outputFormatter.PrintToken(Tokens.ByVal);
- outputFormatter.Space();
- outputFormatter.PrintIdentifier("value");
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.As);
- outputFormatter.Space();
- TrackedVisit(currentEventType, data);
- } else {
- this.AppendCommaSeparatedList(eventRemoveRegion.Parameters);
- }
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- outputFormatter.NewLine();
-
- ++outputFormatter.IndentationLevel;
- TrackedVisit(eventRemoveRegion.Block, data);
- --outputFormatter.IndentationLevel;
-
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.End);
- outputFormatter.Space();
- outputFormatter.PrintText("RemoveHandler");
- outputFormatter.NewLine();
- return null;
- }
-
- public override object TrackedVisitEventRaiseRegion(EventRaiseRegion eventRaiseRegion, object data)
- {
- VisitAttributes(eventRaiseRegion.Attributes, data);
- outputFormatter.Indent();
- outputFormatter.PrintText("RaiseEvent");
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- if (eventRaiseRegion.Parameters.Count == 0) {
- outputFormatter.PrintToken(Tokens.ByVal);
- outputFormatter.Space();
- outputFormatter.PrintIdentifier("value");
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.As);
- outputFormatter.Space();
- TrackedVisit(currentEventType, data);
- } else {
- this.AppendCommaSeparatedList(eventRaiseRegion.Parameters);
- }
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- outputFormatter.NewLine();
-
- ++outputFormatter.IndentationLevel;
- TrackedVisit(eventRaiseRegion.Block, data);
- --outputFormatter.IndentationLevel;
-
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.End);
- outputFormatter.Space();
- outputFormatter.PrintText("RaiseEvent");
- outputFormatter.NewLine();
- return null;
- }
-
- public override object TrackedVisitParameterDeclarationExpression(ParameterDeclarationExpression parameterDeclarationExpression, object data)
- {
- printAttributeSectionInline = true;
- VisitAttributes(parameterDeclarationExpression.Attributes, data);
- printAttributeSectionInline = false;
- OutputModifier(parameterDeclarationExpression.ParamModifier, parameterDeclarationExpression.StartLocation);
- outputFormatter.PrintIdentifier(parameterDeclarationExpression.ParameterName);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.As);
- outputFormatter.Space();
- VisitReturnTypeAttributes(parameterDeclarationExpression.Attributes, data);
- TrackedVisit(parameterDeclarationExpression.TypeReference, data);
- return null;
- }
-
- public override object TrackedVisitMethodDeclaration(MethodDeclaration methodDeclaration, object data)
- {
- VisitAttributes(methodDeclaration.Attributes, data);
- if (methodDeclaration.IsExtensionMethod) {
- outputFormatter.Indent();
- outputFormatter.PrintText("<System.Runtime.CompilerServices.Extension> _");
- outputFormatter.NewLine();
- }
- outputFormatter.Indent();
- OutputModifier(methodDeclaration.Modifier);
-
- bool isSub = methodDeclaration.TypeReference.IsNull ||
- methodDeclaration.TypeReference.Type == "System.Void";
-
- if (isSub) {
- outputFormatter.PrintToken(Tokens.Sub);
- } else {
- outputFormatter.PrintToken(Tokens.Function);
- }
- outputFormatter.Space();
- outputFormatter.PrintIdentifier(methodDeclaration.Name);
-
- PrintTemplates(methodDeclaration.Templates);
-
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- AppendCommaSeparatedList(methodDeclaration.Parameters);
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
-
- if (!isSub) {
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.As);
- outputFormatter.Space();
- VisitReturnTypeAttributes(methodDeclaration.Attributes, data);
- TrackedVisit(methodDeclaration.TypeReference, data);
- }
-
- PrintInterfaceImplementations(methodDeclaration.InterfaceImplementations);
-
- if (methodDeclaration.HandlesClause.Count > 0) {
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Handles);
- for (int i = 0; i < methodDeclaration.HandlesClause.Count; i++) {
- if (i > 0)
- outputFormatter.PrintToken(Tokens.Comma);
- outputFormatter.Space();
- outputFormatter.PrintText(methodDeclaration.HandlesClause[i]);
- }
- }
-
- outputFormatter.NewLine();
-
- if (!IsAbstract(methodDeclaration)) {
- outputFormatter.IsInMemberBody = true;
- BeginVisit(methodDeclaration.Body);
- ++outputFormatter.IndentationLevel;
- exitTokenStack.Push(isSub ? Tokens.Sub : Tokens.Function);
- // we're doing the tracking manually using BeginVisit/EndVisit, so call Tracked... directly
- this.TrackedVisitBlockStatement(methodDeclaration.Body, data);
- exitTokenStack.Pop();
- --outputFormatter.IndentationLevel;
-
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.End);
- outputFormatter.Space();
- if (isSub) {
- outputFormatter.PrintToken(Tokens.Sub);
- } else {
- outputFormatter.PrintToken(Tokens.Function);
- }
- outputFormatter.NewLine();
- EndVisit(methodDeclaration.Body);
- outputFormatter.IsInMemberBody = false;
- }
- return null;
- }
-
- public override object TrackedVisitInterfaceImplementation(InterfaceImplementation interfaceImplementation, object data)
- {
- throw new InvalidOperationException();
- }
-
- bool IsAbstract(AttributedNode node)
- {
- if ((node.Modifier & Modifiers.Abstract) == Modifiers.Abstract)
- return true;
- return currentType != null && currentType.Type == ClassType.Interface;
- }
-
- public override object TrackedVisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data)
- {
- VisitAttributes(constructorDeclaration.Attributes, data);
- outputFormatter.Indent();
- OutputModifier(constructorDeclaration.Modifier);
- outputFormatter.PrintToken(Tokens.Sub);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.New);
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- AppendCommaSeparatedList(constructorDeclaration.Parameters);
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- outputFormatter.NewLine();
-
- outputFormatter.IsInMemberBody = true;
- ++outputFormatter.IndentationLevel;
- exitTokenStack.Push(Tokens.Sub);
-
- TrackedVisit(constructorDeclaration.ConstructorInitializer, data);
-
- TrackedVisit(constructorDeclaration.Body, data);
- exitTokenStack.Pop();
- --outputFormatter.IndentationLevel;
- outputFormatter.IsInMemberBody = false;
-
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.End);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Sub);
- outputFormatter.NewLine();
-
- return null;
- }
-
- public override object TrackedVisitConstructorInitializer(ConstructorInitializer constructorInitializer, object data)
- {
- outputFormatter.Indent();
- if (constructorInitializer.ConstructorInitializerType == ConstructorInitializerType.This) {
- outputFormatter.PrintToken(Tokens.Me);
- } else {
- outputFormatter.PrintToken(Tokens.MyBase);
- }
- outputFormatter.PrintToken(Tokens.Dot);
- outputFormatter.PrintToken(Tokens.New);
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- AppendCommaSeparatedList(constructorInitializer.Arguments);
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
-
- outputFormatter.NewLine();
- return null;
- }
-
- public override object TrackedVisitIndexerDeclaration(IndexerDeclaration indexerDeclaration, object data)
- {
- VisitAttributes(indexerDeclaration.Attributes, data);
- outputFormatter.Indent();
- OutputModifier(indexerDeclaration.Modifier);
- outputFormatter.PrintToken(Tokens.Default);
- outputFormatter.Space();
- if (indexerDeclaration.IsReadOnly) {
- outputFormatter.PrintToken(Tokens.ReadOnly);
- outputFormatter.Space();
- } else if (indexerDeclaration.IsWriteOnly) {
- outputFormatter.PrintToken(Tokens.WriteOnly);
- outputFormatter.Space();
- }
-
- outputFormatter.PrintToken(Tokens.Property);
- outputFormatter.Space();
- outputFormatter.PrintIdentifier("Item");
-
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- AppendCommaSeparatedList(indexerDeclaration.Parameters);
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.As);
- outputFormatter.Space();
- VisitReturnTypeAttributes(indexerDeclaration.Attributes, data);
- TrackedVisit(indexerDeclaration.TypeReference, data);
- PrintInterfaceImplementations(indexerDeclaration.InterfaceImplementations);
-
- outputFormatter.NewLine();
- ++outputFormatter.IndentationLevel;
- exitTokenStack.Push(Tokens.Property);
- TrackedVisit(indexerDeclaration.GetRegion, data);
- TrackedVisit(indexerDeclaration.SetRegion, data);
- exitTokenStack.Pop();
- --outputFormatter.IndentationLevel;
-
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.End);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Property);
- outputFormatter.NewLine();
- return null;
- }
-
- public override object TrackedVisitDestructorDeclaration(DestructorDeclaration destructorDeclaration, object data)
- {
- outputFormatter.Indent();
- outputFormatter.PrintText("Protected Overrides Sub Finalize()");
- outputFormatter.NewLine();
-
- ++outputFormatter.IndentationLevel;
- exitTokenStack.Push(Tokens.Sub);
-
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.Try);
- outputFormatter.NewLine();
-
- ++outputFormatter.IndentationLevel;
- TrackedVisit(destructorDeclaration.Body, data);
- --outputFormatter.IndentationLevel;
-
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.Finally);
- outputFormatter.NewLine();
-
- ++outputFormatter.IndentationLevel;
- outputFormatter.Indent();
- outputFormatter.PrintText("MyBase.Finalize()");
- outputFormatter.NewLine();
- --outputFormatter.IndentationLevel;
-
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.End);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Try);
- outputFormatter.NewLine();
-
- exitTokenStack.Pop();
- --outputFormatter.IndentationLevel;
-
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.End);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Sub);
- outputFormatter.NewLine();
-
- return null;
- }
-
- public override object TrackedVisitOperatorDeclaration(OperatorDeclaration operatorDeclaration, object data)
- {
- VisitAttributes(operatorDeclaration.Attributes, data);
- outputFormatter.Indent();
- OutputModifier(operatorDeclaration.Modifier);
-
- if (operatorDeclaration.IsConversionOperator) {
- if (operatorDeclaration.ConversionType == ConversionType.Implicit) {
- outputFormatter.PrintToken(Tokens.Widening);
- } else {
- outputFormatter.PrintToken(Tokens.Narrowing);
- }
- outputFormatter.Space();
- }
-
- outputFormatter.PrintToken(Tokens.Operator);
- outputFormatter.Space();
-
- int op = -1;
-
- switch(operatorDeclaration.OverloadableOperator)
- {
- case OverloadableOperatorType.Add:
- op = Tokens.Plus;
- break;
- case OverloadableOperatorType.Subtract:
- op = Tokens.Minus;
- break;
- case OverloadableOperatorType.Multiply:
- op = Tokens.Times;
- break;
- case OverloadableOperatorType.Divide:
- op = Tokens.Div;
- break;
- case OverloadableOperatorType.Modulus:
- op = Tokens.Mod;
- break;
- case OverloadableOperatorType.Concat:
- op = Tokens.ConcatString;
- break;
- case OverloadableOperatorType.Not:
- op = Tokens.Not;
- break;
- case OverloadableOperatorType.BitNot:
- op = Tokens.Not;
- break;
- case OverloadableOperatorType.BitwiseAnd:
- op = Tokens.And;
- break;
- case OverloadableOperatorType.BitwiseOr:
- op = Tokens.Or;
- break;
- case OverloadableOperatorType.ExclusiveOr:
- op = Tokens.Xor;
- break;
- case OverloadableOperatorType.ShiftLeft:
- op = Tokens.ShiftLeft;
- break;
- case OverloadableOperatorType.ShiftRight:
- op = Tokens.ShiftRight;
- break;
- case OverloadableOperatorType.GreaterThan:
- op = Tokens.GreaterThan;
- break;
- case OverloadableOperatorType.GreaterThanOrEqual:
- op = Tokens.GreaterEqual;
- break;
- case OverloadableOperatorType.Equality:
- op = Tokens.Assign;
- break;
- case OverloadableOperatorType.InEquality:
- op = Tokens.NotEqual;
- break;
- case OverloadableOperatorType.LessThan:
- op = Tokens.LessThan;
- break;
- case OverloadableOperatorType.LessThanOrEqual:
- op = Tokens.LessEqual;
- break;
- case OverloadableOperatorType.Increment:
- Error("Increment operator is not supported in Visual Basic", operatorDeclaration.StartLocation);
- break;
- case OverloadableOperatorType.Decrement:
- Error("Decrement operator is not supported in Visual Basic", operatorDeclaration.StartLocation);
- break;
- case OverloadableOperatorType.IsTrue:
- outputFormatter.PrintText("IsTrue");
- break;
- case OverloadableOperatorType.IsFalse:
- outputFormatter.PrintText("IsFalse");
- break;
- case OverloadableOperatorType.Like:
- op = Tokens.Like;
- break;
- case OverloadableOperatorType.Power:
- op = Tokens.Power;
- break;
- case OverloadableOperatorType.CType:
- op = Tokens.CType;
- break;
- case OverloadableOperatorType.DivideInteger:
- op = Tokens.DivInteger;
- break;
- }
-
-
-
- if (operatorDeclaration.IsConversionOperator) {
- outputFormatter.PrintToken(Tokens.CType);
- } else {
- if(op != -1) outputFormatter.PrintToken(op);
- }
-
- PrintTemplates(operatorDeclaration.Templates);
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- AppendCommaSeparatedList(operatorDeclaration.Parameters);
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- if (!operatorDeclaration.TypeReference.IsNull) {
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.As);
- outputFormatter.Space();
- VisitReturnTypeAttributes(operatorDeclaration.Attributes, data);
- TrackedVisit(operatorDeclaration.TypeReference, data);
- }
-
- outputFormatter.NewLine();
-
- ++outputFormatter.IndentationLevel;
- TrackedVisit(operatorDeclaration.Body, data);
- --outputFormatter.IndentationLevel;
-
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.End);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Operator);
- outputFormatter.NewLine();
-
- return null;
- }
-
- public override object TrackedVisitDeclareDeclaration(DeclareDeclaration declareDeclaration, object data)
- {
- VisitAttributes(declareDeclaration.Attributes, data);
- outputFormatter.Indent();
- OutputModifier(declareDeclaration.Modifier);
- outputFormatter.PrintToken(Tokens.Declare);
- outputFormatter.Space();
-
- switch (declareDeclaration.Charset) {
- case CharsetModifier.Auto:
- outputFormatter.PrintToken(Tokens.Auto);
- outputFormatter.Space();
- break;
- case CharsetModifier.Unicode:
- outputFormatter.PrintToken(Tokens.Unicode);
- outputFormatter.Space();
- break;
- case CharsetModifier.Ansi:
- outputFormatter.PrintToken(Tokens.Ansi);
- outputFormatter.Space();
- break;
- }
-
- bool isVoid = declareDeclaration.TypeReference.IsNull || declareDeclaration.TypeReference.Type == "System.Void";
- if (isVoid) {
- outputFormatter.PrintToken(Tokens.Sub);
- } else {
- outputFormatter.PrintToken(Tokens.Function);
- }
- outputFormatter.Space();
-
- outputFormatter.PrintIdentifier(declareDeclaration.Name);
-
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Lib);
- outputFormatter.Space();
- outputFormatter.PrintText(ConvertString(declareDeclaration.Library));
- outputFormatter.Space();
-
- if (declareDeclaration.Alias.Length > 0) {
- outputFormatter.PrintToken(Tokens.Alias);
- outputFormatter.Space();
- outputFormatter.PrintText(ConvertString(declareDeclaration.Alias));
- outputFormatter.Space();
- }
-
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- AppendCommaSeparatedList(declareDeclaration.Parameters);
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
-
- if (!isVoid) {
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.As);
- outputFormatter.Space();
- VisitReturnTypeAttributes(declareDeclaration.Attributes, data);
- TrackedVisit(declareDeclaration.TypeReference, data);
- }
-
- outputFormatter.NewLine();
-
- return null;
- }
- #endregion
-
- #region Statements
- public override object TrackedVisitBlockStatement(BlockStatement blockStatement, object data)
- {
- if (blockStatement.Parent is BlockStatement) {
- outputFormatter.Indent();
- outputFormatter.PrintText("If True Then");
- outputFormatter.NewLine();
- outputFormatter.IndentationLevel += 1;
- }
- VisitStatementList(blockStatement.Children);
- if (blockStatement.Parent is BlockStatement) {
- outputFormatter.IndentationLevel -= 1;
- outputFormatter.Indent();
- outputFormatter.PrintText("End If");
- outputFormatter.NewLine();
- }
- return null;
- }
-
- void PrintIndentedBlock(Statement stmt)
- {
- outputFormatter.IndentationLevel += 1;
- if (stmt is BlockStatement) {
- TrackedVisit(stmt, null);
- } else {
- outputFormatter.Indent();
- TrackedVisit(stmt, null);
- outputFormatter.NewLine();
- }
- outputFormatter.IndentationLevel -= 1;
- }
-
- void PrintIndentedBlock(IEnumerable statements)
- {
- outputFormatter.IndentationLevel += 1;
- VisitStatementList(statements);
- outputFormatter.IndentationLevel -= 1;
- }
-
- void VisitStatementList(IEnumerable statements)
- {
- foreach (Statement stmt in statements) {
- if (stmt is BlockStatement) {
- TrackedVisit(stmt, null);
- } else {
- outputFormatter.Indent();
- TrackedVisit(stmt, null);
- outputFormatter.NewLine();
- }
- }
- }
-
- public override object TrackedVisitAddHandlerStatement(AddHandlerStatement addHandlerStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.AddHandler);
- outputFormatter.Space();
- TrackedVisit(addHandlerStatement.EventExpression, data);
- outputFormatter.PrintToken(Tokens.Comma);
- outputFormatter.Space();
- TrackedVisit(addHandlerStatement.HandlerExpression, data);
- return null;
- }
-
- public override object TrackedVisitRemoveHandlerStatement(RemoveHandlerStatement removeHandlerStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.RemoveHandler);
- outputFormatter.Space();
- TrackedVisit(removeHandlerStatement.EventExpression, data);
- outputFormatter.PrintToken(Tokens.Comma);
- outputFormatter.Space();
- TrackedVisit(removeHandlerStatement.HandlerExpression, data);
- return null;
- }
-
- public override object TrackedVisitRaiseEventStatement(RaiseEventStatement raiseEventStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.RaiseEvent);
- outputFormatter.Space();
- outputFormatter.PrintIdentifier(raiseEventStatement.EventName);
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- AppendCommaSeparatedList(raiseEventStatement.Arguments);
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- return null;
- }
-
- public override object TrackedVisitEraseStatement(EraseStatement eraseStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.Erase);
- outputFormatter.Space();
- AppendCommaSeparatedList(eraseStatement.Expressions);
- return null;
- }
-
- public override object TrackedVisitErrorStatement(ErrorStatement errorStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.Error);
- outputFormatter.Space();
- TrackedVisit(errorStatement.Expression, data);
- return null;
- }
-
- public override object TrackedVisitOnErrorStatement(OnErrorStatement onErrorStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.On);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Error);
- outputFormatter.Space();
- TrackedVisit(onErrorStatement.EmbeddedStatement, data);
- return null;
- }
-
- public override object TrackedVisitReDimStatement(ReDimStatement reDimStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.ReDim);
- outputFormatter.Space();
- if (reDimStatement.IsPreserve) {
- outputFormatter.PrintToken(Tokens.Preserve);
- outputFormatter.Space();
- }
-
- AppendCommaSeparatedList(reDimStatement.ReDimClauses);
- return null;
- }
-
- public override object TrackedVisitExpressionStatement(ExpressionStatement expressionStatement, object data)
- {
- TrackedVisit(expressionStatement.Expression, data);
- return null;
- }
-
- public override object TrackedVisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data)
- {
- if (localVariableDeclaration.Modifier != Modifiers.None) {
- OutputModifier(localVariableDeclaration.Modifier);
- }
- if (!isUsingResourceAcquisition) {
- if ((localVariableDeclaration.Modifier & Modifiers.Const) == 0) {
- outputFormatter.PrintToken(Tokens.Dim);
- }
- outputFormatter.Space();
- }
- currentVariableType = localVariableDeclaration.TypeReference;
-
- AppendCommaSeparatedList(localVariableDeclaration.Variables);
- currentVariableType = null;
-
- return null;
- }
-
- public override object TrackedVisitEmptyStatement(EmptyStatement emptyStatement, object data)
- {
- outputFormatter.NewLine();
- return null;
- }
-
- public override object TrackedVisitYieldStatement(YieldStatement yieldStatement, object data)
- {
- UnsupportedNode(yieldStatement);
- return null;
- }
-
- public override object TrackedVisitReturnStatement(ReturnStatement returnStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.Return);
- if (!returnStatement.Expression.IsNull) {
- outputFormatter.Space();
- TrackedVisit(returnStatement.Expression, data);
- }
- return null;
- }
-
- public override object TrackedVisitIfElseStatement(IfElseStatement ifElseStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.If);
- outputFormatter.Space();
- TrackedVisit(ifElseStatement.Condition, data);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Then);
- outputFormatter.NewLine();
-
- PrintIndentedBlock(ifElseStatement.TrueStatement);
-
- foreach (ElseIfSection elseIfSection in ifElseStatement.ElseIfSections) {
- TrackedVisit(elseIfSection, data);
- }
-
- if (ifElseStatement.HasElseStatements) {
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.Else);
- outputFormatter.NewLine();
- PrintIndentedBlock(ifElseStatement.FalseStatement);
- }
-
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.End);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.If);
- return null;
- }
-
- public override object TrackedVisitElseIfSection(ElseIfSection elseIfSection, object data)
- {
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.ElseIf);
- outputFormatter.Space();
- TrackedVisit(elseIfSection.Condition, data);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Then);
- outputFormatter.NewLine();
- PrintIndentedBlock(elseIfSection.EmbeddedStatement);
- return null;
- }
-
- public override object TrackedVisitForStatement(ForStatement forStatement, object data)
- {
- // Is converted to {initializer} while <Condition> {Embedded} {Iterators} end while
- exitTokenStack.Push(Tokens.While);
- bool isFirstLine = true;
- foreach (INode node in forStatement.Initializers) {
- if (!isFirstLine)
- outputFormatter.Indent();
- isFirstLine = false;
- TrackedVisit(node, data);
- outputFormatter.NewLine();
- }
- if (!isFirstLine)
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.While);
- outputFormatter.Space();
- if (forStatement.Condition.IsNull) {
- outputFormatter.PrintToken(Tokens.True);
- } else {
- TrackedVisit(forStatement.Condition, data);
- }
- outputFormatter.NewLine();
-
- PrintIndentedBlock(forStatement.EmbeddedStatement);
- PrintIndentedBlock(forStatement.Iterator);
-
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.End);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.While);
- exitTokenStack.Pop();
- return null;
- }
-
- public override object TrackedVisitLabelStatement(LabelStatement labelStatement, object data)
- {
- outputFormatter.PrintIdentifier(labelStatement.Label);
- outputFormatter.PrintToken(Tokens.Colon);
- return null;
- }
-
- public override object TrackedVisitGotoStatement(GotoStatement gotoStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.GoTo);
- outputFormatter.Space();
- outputFormatter.PrintIdentifier(gotoStatement.Label);
- return null;
- }
-
- public override object TrackedVisitSwitchStatement(SwitchStatement switchStatement, object data)
- {
- exitTokenStack.Push(Tokens.Select);
- outputFormatter.PrintToken(Tokens.Select);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Case);
- outputFormatter.Space();
- TrackedVisit(switchStatement.SwitchExpression, data);
- outputFormatter.NewLine();
- ++outputFormatter.IndentationLevel;
- foreach (SwitchSection section in switchStatement.SwitchSections) {
- TrackedVisit(section, data);
- }
- --outputFormatter.IndentationLevel;
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.End);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Select);
- exitTokenStack.Pop();
- return null;
- }
-
- public override object TrackedVisitSwitchSection(SwitchSection switchSection, object data)
- {
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.Case);
- outputFormatter.Space();
- this.AppendCommaSeparatedList(switchSection.SwitchLabels);
- outputFormatter.NewLine();
-
- PrintIndentedBlock(switchSection.Children);
-
- return null;
- }
-
- public override object TrackedVisitCaseLabel(CaseLabel caseLabel, object data)
- {
- if (caseLabel.IsDefault) {
- outputFormatter.PrintToken(Tokens.Else);
- } else {
- if (caseLabel.BinaryOperatorType != BinaryOperatorType.None) {
- switch (caseLabel.BinaryOperatorType) {
- case BinaryOperatorType.Equality:
- outputFormatter.PrintToken(Tokens.Assign);
- break;
- case BinaryOperatorType.InEquality:
- outputFormatter.PrintToken(Tokens.LessThan);
- outputFormatter.PrintToken(Tokens.GreaterThan);
- break;
-
- case BinaryOperatorType.GreaterThan:
- outputFormatter.PrintToken(Tokens.GreaterThan);
- break;
- case BinaryOperatorType.GreaterThanOrEqual:
- outputFormatter.PrintToken(Tokens.GreaterEqual);
- break;
- case BinaryOperatorType.LessThan:
- outputFormatter.PrintToken(Tokens.LessThan);
- break;
- case BinaryOperatorType.LessThanOrEqual:
- outputFormatter.PrintToken(Tokens.LessEqual);
- break;
- }
- outputFormatter.Space();
- }
-
- TrackedVisit(caseLabel.Label, data);
- if (!caseLabel.ToExpression.IsNull) {
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.To);
- outputFormatter.Space();
- TrackedVisit(caseLabel.ToExpression, data);
- }
- }
-
- return null;
- }
-
- public override object TrackedVisitBreakStatement(BreakStatement breakStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.Exit);
- if (exitTokenStack.Count > 0) {
- outputFormatter.Space();
- outputFormatter.PrintToken(exitTokenStack.Peek());
- }
- return null;
- }
-
- public override object TrackedVisitStopStatement(StopStatement stopStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.Stop);
- return null;
- }
-
- public override object TrackedVisitResumeStatement(ResumeStatement resumeStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.Resume);
- outputFormatter.Space();
- if (resumeStatement.IsResumeNext) {
- outputFormatter.PrintToken(Tokens.Next);
- } else {
- outputFormatter.PrintIdentifier(resumeStatement.LabelName);
- }
- return null;
- }
-
- public override object TrackedVisitEndStatement(EndStatement endStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.End);
- return null;
- }
-
- public override object TrackedVisitContinueStatement(ContinueStatement continueStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.Continue);
- outputFormatter.Space();
- switch (continueStatement.ContinueType) {
- case ContinueType.Do:
- outputFormatter.PrintToken(Tokens.Do);
- break;
- case ContinueType.For:
- outputFormatter.PrintToken(Tokens.For);
- break;
- case ContinueType.While:
- outputFormatter.PrintToken(Tokens.While);
- break;
- default:
- outputFormatter.PrintToken(exitTokenStack.Peek());
- break;
- }
- return null;
- }
-
- public override object TrackedVisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, object data)
- {
- outputFormatter.PrintText("goto case ");
- if (gotoCaseStatement.IsDefaultCase) {
- outputFormatter.PrintText("default");
- } else {
- TrackedVisit(gotoCaseStatement.Expression, null);
- }
- return null;
- }
-
- public override object TrackedVisitDoLoopStatement(DoLoopStatement doLoopStatement, object data)
- {
- if (doLoopStatement.ConditionPosition == ConditionPosition.None) {
- Error(String.Format("Unknown condition position for loop : {0}.", doLoopStatement), doLoopStatement.StartLocation);
- }
-
- if (doLoopStatement.ConditionPosition == ConditionPosition.Start) {
- switch (doLoopStatement.ConditionType) {
- case ConditionType.DoWhile:
- exitTokenStack.Push(Tokens.Do);
- outputFormatter.PrintToken(Tokens.Do);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.While);
- break;
- case ConditionType.While:
- exitTokenStack.Push(Tokens.While);
- outputFormatter.PrintToken(Tokens.While);
- break;
- case ConditionType.Until:
- exitTokenStack.Push(Tokens.Do);
- outputFormatter.PrintToken(Tokens.Do);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.While);
- break;
- default:
- throw new InvalidOperationException();
- }
- outputFormatter.Space();
- TrackedVisit(doLoopStatement.Condition, null);
- } else {
- exitTokenStack.Push(Tokens.Do);
- outputFormatter.PrintToken(Tokens.Do);
- }
-
- outputFormatter.NewLine();
-
- PrintIndentedBlock(doLoopStatement.EmbeddedStatement);
-
- outputFormatter.Indent();
- if (doLoopStatement.ConditionPosition == ConditionPosition.Start && doLoopStatement.ConditionType == ConditionType.While) {
- outputFormatter.PrintToken(Tokens.End);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.While);
- } else {
- outputFormatter.PrintToken(Tokens.Loop);
- }
-
- if (doLoopStatement.ConditionPosition == ConditionPosition.End && !doLoopStatement.Condition.IsNull) {
- outputFormatter.Space();
- switch (doLoopStatement.ConditionType) {
- case ConditionType.While:
- case ConditionType.DoWhile:
- outputFormatter.PrintToken(Tokens.While);
- break;
- case ConditionType.Until:
- outputFormatter.PrintToken(Tokens.Until);
- break;
- }
- outputFormatter.Space();
- TrackedVisit(doLoopStatement.Condition, null);
- }
- exitTokenStack.Pop();
- return null;
- }
-
- public override object TrackedVisitForeachStatement(ForeachStatement foreachStatement, object data)
- {
- exitTokenStack.Push(Tokens.For);
- outputFormatter.PrintToken(Tokens.For);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Each);
- outputFormatter.Space();
-
- // loop control variable
- outputFormatter.PrintIdentifier(foreachStatement.VariableName);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.As);
- outputFormatter.Space();
- TrackedVisit(foreachStatement.TypeReference, data);
-
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.In);
- outputFormatter.Space();
-
- TrackedVisit(foreachStatement.Expression, data);
- outputFormatter.NewLine();
-
- PrintIndentedBlock(foreachStatement.EmbeddedStatement);
-
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.Next);
- if (!foreachStatement.NextExpression.IsNull) {
- outputFormatter.Space();
- TrackedVisit(foreachStatement.NextExpression, data);
- }
- exitTokenStack.Pop();
- return null;
- }
-
- public override object TrackedVisitLockStatement(LockStatement lockStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.SyncLock);
- outputFormatter.Space();
- TrackedVisit(lockStatement.LockExpression, data);
- outputFormatter.NewLine();
-
- PrintIndentedBlock(lockStatement.EmbeddedStatement);
-
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.End);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.SyncLock);
- return null;
- }
-
- bool isUsingResourceAcquisition;
-
- public override object TrackedVisitUsingStatement(UsingStatement usingStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.Using);
- outputFormatter.Space();
-
- isUsingResourceAcquisition = true;
- TrackedVisit(usingStatement.ResourceAcquisition, data);
- isUsingResourceAcquisition = false;
- outputFormatter.NewLine();
-
- PrintIndentedBlock(usingStatement.EmbeddedStatement);
-
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.End);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Using);
-
- return null;
- }
-
- public override object TrackedVisitWithStatement(WithStatement withStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.With);
- outputFormatter.Space();
- TrackedVisit(withStatement.Expression, data);
- outputFormatter.NewLine();
-
- PrintIndentedBlock(withStatement.Body);
-
- outputFormatter.PrintToken(Tokens.End);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.With);
- return null;
- }
-
- public override object TrackedVisitTryCatchStatement(TryCatchStatement tryCatchStatement, object data)
- {
- exitTokenStack.Push(Tokens.Try);
- outputFormatter.PrintToken(Tokens.Try);
- outputFormatter.NewLine();
-
- PrintIndentedBlock(tryCatchStatement.StatementBlock);
-
- foreach (CatchClause catchClause in tryCatchStatement.CatchClauses) {
- TrackedVisit(catchClause, data);
- }
-
- if (!tryCatchStatement.FinallyBlock.IsNull) {
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.Finally);
- outputFormatter.NewLine();
- PrintIndentedBlock(tryCatchStatement.FinallyBlock);
- }
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.End);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Try);
- exitTokenStack.Pop();
- return null;
- }
-
- public override object TrackedVisitCatchClause(CatchClause catchClause, object data)
- {
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.Catch);
-
- if (!catchClause.TypeReference.IsNull) {
- outputFormatter.Space();
- if (catchClause.VariableName.Length > 0) {
- outputFormatter.PrintIdentifier(catchClause.VariableName);
- } else {
- outputFormatter.PrintIdentifier("generatedExceptionName");
- }
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.As);
- outputFormatter.Space();
- outputFormatter.PrintIdentifier(catchClause.TypeReference.Type);
- }
-
- if (!catchClause.Condition.IsNull) {
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.When);
- outputFormatter.Space();
- TrackedVisit(catchClause.Condition, data);
- }
- outputFormatter.NewLine();
-
- PrintIndentedBlock(catchClause.StatementBlock);
-
- return null;
- }
-
- public override object TrackedVisitThrowStatement(ThrowStatement throwStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.Throw);
- if (!throwStatement.Expression.IsNull) {
- outputFormatter.Space();
- TrackedVisit(throwStatement.Expression, data);
- }
- return null;
- }
-
- public override object TrackedVisitFixedStatement(FixedStatement fixedStatement, object data)
- {
- UnsupportedNode(fixedStatement);
- return TrackedVisit(fixedStatement.EmbeddedStatement, data);
- }
-
- public override object TrackedVisitUnsafeStatement(UnsafeStatement unsafeStatement, object data)
- {
- UnsupportedNode(unsafeStatement);
- return TrackedVisit(unsafeStatement.Block, data);
- }
-
- public override object TrackedVisitCheckedStatement(CheckedStatement checkedStatement, object data)
- {
- UnsupportedNode(checkedStatement);
- return TrackedVisit(checkedStatement.Block, data);
- }
-
- public override object TrackedVisitUncheckedStatement(UncheckedStatement uncheckedStatement, object data)
- {
- UnsupportedNode(uncheckedStatement);
- return TrackedVisit(uncheckedStatement.Block, data);
- }
-
- public override object TrackedVisitExitStatement(ExitStatement exitStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.Exit);
- if (exitStatement.ExitType != ExitType.None) {
- outputFormatter.Space();
- switch (exitStatement.ExitType) {
- case ExitType.Sub:
- outputFormatter.PrintToken(Tokens.Sub);
- break;
- case ExitType.Function:
- outputFormatter.PrintToken(Tokens.Function);
- break;
- case ExitType.Property:
- outputFormatter.PrintToken(Tokens.Property);
- break;
- case ExitType.Do:
- outputFormatter.PrintToken(Tokens.Do);
- break;
- case ExitType.For:
- outputFormatter.PrintToken(Tokens.For);
- break;
- case ExitType.Try:
- outputFormatter.PrintToken(Tokens.Try);
- break;
- case ExitType.While:
- outputFormatter.PrintToken(Tokens.While);
- break;
- case ExitType.Select:
- outputFormatter.PrintToken(Tokens.Select);
- break;
- default:
- Error(String.Format("Unsupported exit type : {0}", exitStatement.ExitType), exitStatement.StartLocation);
- break;
- }
- }
-
- return null;
- }
-
- public override object TrackedVisitForNextStatement(ForNextStatement forNextStatement, object data)
- {
- exitTokenStack.Push(Tokens.For);
- outputFormatter.PrintToken(Tokens.For);
- outputFormatter.Space();
-
- if (!forNextStatement.LoopVariableExpression.IsNull) {
- TrackedVisit(forNextStatement.LoopVariableExpression, data);
- } else {
- outputFormatter.PrintIdentifier(forNextStatement.VariableName);
-
- if (!forNextStatement.TypeReference.IsNull) {
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.As);
- outputFormatter.Space();
- TrackedVisit(forNextStatement.TypeReference, data);
- }
- }
-
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Assign);
- outputFormatter.Space();
-
- TrackedVisit(forNextStatement.Start, data);
-
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.To);
- outputFormatter.Space();
-
- TrackedVisit(forNextStatement.End, data);
-
- if (!forNextStatement.Step.IsNull) {
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Step);
- outputFormatter.Space();
- TrackedVisit(forNextStatement.Step, data);
- }
- outputFormatter.NewLine();
-
- PrintIndentedBlock(forNextStatement.EmbeddedStatement);
-
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.Next);
-
- if (forNextStatement.NextExpressions.Count > 0) {
- outputFormatter.Space();
- AppendCommaSeparatedList(forNextStatement.NextExpressions);
- }
- exitTokenStack.Pop();
- return null;
- }
- #endregion
-
- #region Expressions
-
- public override object TrackedVisitClassReferenceExpression(ClassReferenceExpression classReferenceExpression, object data)
- {
- outputFormatter.PrintToken(Tokens.MyClass);
- return null;
- }
-
-
- static string ConvertCharLiteral(char ch)
- {
- if (Char.IsControl(ch)) {
- string charName = GetCharName(ch);
- if (charName != null)
- return "ControlChars." + charName;
- else
- return "ChrW(" + ((int)ch).ToString() + ")";
- } else if (ch == '"') {
- return "\"\"\"\"C";
- } else {
- return "\"" + ch.ToString() + "\"C";
- }
- }
-
- static string GetCharName(char ch)
- {
- switch (ch) {
- case '\b':
- return "Back";
- case '\r':
- return "Cr";
- case '\f':
- return "FormFeed";
- case '\n':
- return "Lf";
- case '\0':
- return "NullChar";
- case '\t':
- return "Tab";
- case '\v':
- return "VerticalTab";
- default:
- return null;
- }
- }
-
- static string ConvertString(string str)
- {
- StringBuilder sb = new StringBuilder();
- bool inString = false;
- foreach (char ch in str) {
- if (char.IsControl(ch)) {
- if (inString) {
- sb.Append('"');
- inString = false;
- }
- if (sb.Length > 0)
- sb.Append(" & ");
- string charName = GetCharName(ch);
- if (charName != null)
- sb.Append("vb" + charName);
- else
- sb.Append("ChrW(" + ((int)ch) + ")");
- } else {
- if (!inString) {
- if (sb.Length > 0)
- sb.Append(" & ");
- sb.Append('"');
- inString = true;
- }
- if (ch == '"') {
- sb.Append("\"\"");
- } else {
- sb.Append(ch);
- }
- }
- }
- if (inString)
- sb.Append('"');
- if (sb.Length == 0)
- return "\"\"";
- return sb.ToString();
- }
-
- public override object TrackedVisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data)
- {
- object val = primitiveExpression.Value;
- if (val == null) {
- outputFormatter.PrintToken(Tokens.Nothing);
- return null;
- }
- if (val is bool) {
- if ((bool)primitiveExpression.Value) {
- outputFormatter.PrintToken(Tokens.True);
- } else {
- outputFormatter.PrintToken(Tokens.False);
- }
- return null;
- }
-
- if (val is string) {
- outputFormatter.PrintText(ConvertString((string)val));
- return null;
- }
-
- if (val is char) {
- outputFormatter.PrintText(ConvertCharLiteral((char)primitiveExpression.Value));
- return null;
- }
-
- if (val is decimal) {
- outputFormatter.PrintText(((decimal)primitiveExpression.Value).ToString(NumberFormatInfo.InvariantInfo) + "D");
- return null;
- }
-
- if (val is float) {
- outputFormatter.PrintText(((float)primitiveExpression.Value).ToString(NumberFormatInfo.InvariantInfo) + "F");
- return null;
- }
-
- if (val is IFormattable) {
- if (primitiveExpression.LiteralFormat == LiteralFormat.HexadecimalNumber) {
- outputFormatter.PrintText("&H");
- outputFormatter.PrintText(((IFormattable)val).ToString("x", NumberFormatInfo.InvariantInfo));
- } else {
- outputFormatter.PrintText(((IFormattable)val).ToString(null, NumberFormatInfo.InvariantInfo));
- }
- } else {
- outputFormatter.PrintText(val.ToString());
- }
-
- return null;
- }
-
- public override object TrackedVisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data)
- {
- int op = 0;
- switch (binaryOperatorExpression.Op) {
- case BinaryOperatorType.Concat:
- op = Tokens.ConcatString;
- break;
-
- case BinaryOperatorType.Add:
- op = Tokens.Plus;
- break;
-
- case BinaryOperatorType.Subtract:
- op = Tokens.Minus;
- break;
-
- case BinaryOperatorType.Multiply:
- op = Tokens.Times;
- break;
-
- case BinaryOperatorType.Divide:
- op = Tokens.Div;
- break;
-
- case BinaryOperatorType.DivideInteger:
- op = Tokens.DivInteger;
- break;
-
- case BinaryOperatorType.Modulus:
- op = Tokens.Mod;
- break;
-
- case BinaryOperatorType.ShiftLeft:
- op = Tokens.ShiftLeft;
- break;
-
- case BinaryOperatorType.ShiftRight:
- op = Tokens.ShiftRight;
- break;
-
- case BinaryOperatorType.BitwiseAnd:
- op = Tokens.And;
- break;
- case BinaryOperatorType.BitwiseOr:
- op = Tokens.Or;
- break;
- case BinaryOperatorType.ExclusiveOr:
- op = Tokens.Xor;
- break;
-
- case BinaryOperatorType.LogicalAnd:
- op = Tokens.AndAlso;
- break;
- case BinaryOperatorType.LogicalOr:
- op = Tokens.OrElse;
- break;
- case BinaryOperatorType.ReferenceEquality:
- op = Tokens.Is;
- break;
- case BinaryOperatorType.ReferenceInequality:
- op = Tokens.IsNot;
- break;
-
- case BinaryOperatorType.Equality:
- op = Tokens.Assign;
- break;
- case BinaryOperatorType.GreaterThan:
- op = Tokens.GreaterThan;
- break;
- case BinaryOperatorType.GreaterThanOrEqual:
- op = Tokens.GreaterEqual;
- break;
- case BinaryOperatorType.InEquality:
- op = Tokens.NotEqual;
- break;
- case BinaryOperatorType.NullCoalescing:
- outputFormatter.PrintText("If(");
- TrackedVisit(binaryOperatorExpression.Left, data);
- outputFormatter.PrintToken(Tokens.Comma);
- outputFormatter.Space();
- TrackedVisit(binaryOperatorExpression.Right, data);
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- return null;
- case BinaryOperatorType.DictionaryAccess:
- {
- PrimitiveExpression pright = binaryOperatorExpression.Right as PrimitiveExpression;
- TrackedVisit(binaryOperatorExpression.Left, data);
- if (pright != null && pright.Value is string) {
- outputFormatter.PrintText("!" + (string)pright.Value);
- } else {
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- TrackedVisit(binaryOperatorExpression.Right, data);
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- }
- return null;
- }
- case BinaryOperatorType.LessThan:
- op = Tokens.LessThan;
- break;
- case BinaryOperatorType.LessThanOrEqual:
- op = Tokens.LessEqual;
- break;
- }
-
-
- BinaryOperatorExpression childBoe = binaryOperatorExpression.Left as BinaryOperatorExpression;
- bool requireParenthesis = childBoe != null && OperatorPrecedence.ComparePrecedenceVB(binaryOperatorExpression.Op, childBoe.Op) > 0;
- if (requireParenthesis)
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- TrackedVisit(binaryOperatorExpression.Left, data);
- if (requireParenthesis)
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
-
- outputFormatter.Space();
- outputFormatter.PrintToken(op);
- outputFormatter.Space();
-
- childBoe = binaryOperatorExpression.Right as BinaryOperatorExpression;
- requireParenthesis = childBoe != null && OperatorPrecedence.ComparePrecedenceVB(binaryOperatorExpression.Op, childBoe.Op) >= 0;
- if (requireParenthesis)
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- TrackedVisit(binaryOperatorExpression.Right, data);
- if (requireParenthesis)
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
-
- return null;
- }
-
- public override object TrackedVisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression, object data)
- {
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- TrackedVisit(parenthesizedExpression.Expression, data);
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- return null;
- }
-
- public override object TrackedVisitInvocationExpression(InvocationExpression invocationExpression, object data)
- {
- TrackedVisit(invocationExpression.TargetObject, data);
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- AppendCommaSeparatedList(invocationExpression.Arguments);
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- return null;
- }
-
- void PrintTypeArguments(List<TypeReference> typeArguments)
- {
- if (typeArguments != null && typeArguments.Count > 0) {
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- outputFormatter.PrintToken(Tokens.Of);
- outputFormatter.Space();
- AppendCommaSeparatedList(typeArguments);
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- }
- }
-
- public override object TrackedVisitIdentifierExpression(IdentifierExpression identifierExpression, object data)
- {
- outputFormatter.PrintIdentifier(identifierExpression.Identifier);
- PrintTypeArguments(identifierExpression.TypeArguments);
- return null;
- }
-
- public override object TrackedVisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, object data)
- {
- TrackedVisit(typeReferenceExpression.TypeReference, data);
- return null;
- }
-
- public override object TrackedVisitUnaryOperatorExpression(UnaryOperatorExpression unaryOperatorExpression, object data)
- {
- switch (unaryOperatorExpression.Op) {
- case UnaryOperatorType.Not:
- case UnaryOperatorType.BitNot:
- outputFormatter.PrintToken(Tokens.Not);
- outputFormatter.Space();
- TrackedVisit(unaryOperatorExpression.Expression, data);
- return null;
-
- case UnaryOperatorType.Decrement:
- outputFormatter.PrintText("System.Threading.Interlocked.Decrement(");
- TrackedVisit(unaryOperatorExpression.Expression, data);
- outputFormatter.PrintText(")");
- return null;
-
- case UnaryOperatorType.Increment:
- outputFormatter.PrintText("System.Threading.Interlocked.Increment(");
- TrackedVisit(unaryOperatorExpression.Expression, data);
- outputFormatter.PrintText(")");
- return null;
-
- case UnaryOperatorType.Minus:
- outputFormatter.PrintToken(Tokens.Minus);
- TrackedVisit(unaryOperatorExpression.Expression, data);
- return null;
-
- case UnaryOperatorType.Plus:
- outputFormatter.PrintToken(Tokens.Plus);
- TrackedVisit(unaryOperatorExpression.Expression, data);
- return null;
-
- case UnaryOperatorType.PostDecrement:
- outputFormatter.PrintText("System.Math.Max(System.Threading.Interlocked.Decrement(");
- TrackedVisit(unaryOperatorExpression.Expression, data);
- outputFormatter.PrintText("),");
- TrackedVisit(unaryOperatorExpression.Expression, data);
- outputFormatter.PrintText(" + 1)");
- return null;
-
- case UnaryOperatorType.PostIncrement:
- outputFormatter.PrintText("System.Math.Max(System.Threading.Interlocked.Increment(");
- TrackedVisit(unaryOperatorExpression.Expression, data);
- outputFormatter.PrintText("),");
- TrackedVisit(unaryOperatorExpression.Expression, data);
- outputFormatter.PrintText(" - 1)");
- return null;
-
- case UnaryOperatorType.Dereference:
- outputFormatter.PrintToken(Tokens.Times);
- return null;
- case UnaryOperatorType.AddressOf:
- outputFormatter.PrintToken(Tokens.AddressOf);
- return null;
- default:
- Error("unknown unary operator: " + unaryOperatorExpression.Op.ToString(), unaryOperatorExpression.StartLocation);
- return null;
- }
- }
-
- public override object TrackedVisitAssignmentExpression(AssignmentExpression assignmentExpression, object data)
- {
- int op = 0;
- bool unsupportedOpAssignment = false;
- switch (assignmentExpression.Op) {
- case AssignmentOperatorType.Assign:
- op = Tokens.Assign;
- break;
- case AssignmentOperatorType.Add:
- op = Tokens.PlusAssign;
- break;
- case AssignmentOperatorType.Subtract:
- op = Tokens.MinusAssign;
- break;
- case AssignmentOperatorType.Multiply:
- op = Tokens.TimesAssign;
- break;
- case AssignmentOperatorType.Divide:
- op = Tokens.DivAssign;
- break;
- case AssignmentOperatorType.ShiftLeft:
- op = Tokens.ShiftLeftAssign;
- break;
- case AssignmentOperatorType.ShiftRight:
- op = Tokens.ShiftRightAssign;
- break;
-
- case AssignmentOperatorType.ExclusiveOr:
- op = Tokens.Xor;
- unsupportedOpAssignment = true;
- break;
- case AssignmentOperatorType.Modulus:
- op = Tokens.Mod;
- unsupportedOpAssignment = true;
- break;
- case AssignmentOperatorType.BitwiseAnd:
- op = Tokens.And;
- unsupportedOpAssignment = true;
- break;
- case AssignmentOperatorType.BitwiseOr:
- op = Tokens.Or;
- unsupportedOpAssignment = true;
- break;
- }
-
- TrackedVisit(assignmentExpression.Left, data);
- outputFormatter.Space();
-
- if (unsupportedOpAssignment) { // left = left OP right
- outputFormatter.PrintToken(Tokens.Assign);
- outputFormatter.Space();
- TrackedVisit(assignmentExpression.Left, data);
- outputFormatter.Space();
- }
-
- outputFormatter.PrintToken(op);
- outputFormatter.Space();
- TrackedVisit(assignmentExpression.Right, data);
-
- return null;
- }
-
- public override object TrackedVisitSizeOfExpression(SizeOfExpression sizeOfExpression, object data)
- {
- UnsupportedNode(sizeOfExpression);
- return null;
- }
-
- public override object TrackedVisitTypeOfExpression(TypeOfExpression typeOfExpression, object data)
- {
- outputFormatter.PrintToken(Tokens.GetType);
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- TrackedVisit(typeOfExpression.TypeReference, data);
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- return null;
- }
-
- public override object TrackedVisitDefaultValueExpression(DefaultValueExpression defaultValueExpression, object data)
- {
- // assigning nothing to a generic type in VB compiles to a DefaultValueExpression
- outputFormatter.PrintToken(Tokens.Nothing);
- return null;
- }
-
- public override object TrackedVisitTypeOfIsExpression(TypeOfIsExpression typeOfIsExpression, object data)
- {
- outputFormatter.PrintToken(Tokens.TypeOf);
- outputFormatter.Space();
- TrackedVisit(typeOfIsExpression.Expression, data);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Is);
- outputFormatter.Space();
- TrackedVisit(typeOfIsExpression.TypeReference, data);
- return null;
- }
-
- public override object TrackedVisitAddressOfExpression(AddressOfExpression addressOfExpression, object data)
- {
- outputFormatter.PrintToken(Tokens.AddressOf);
- outputFormatter.Space();
- TrackedVisit(addressOfExpression.Expression, data);
- return null;
- }
-
- public override object TrackedVisitAnonymousMethodExpression(AnonymousMethodExpression anonymousMethodExpression, object data)
- {
- OutputAnonymousMethodWithStatementBody(anonymousMethodExpression.Parameters, anonymousMethodExpression.Body);
- return null;
- }
-
- public override object TrackedVisitCheckedExpression(CheckedExpression checkedExpression, object data)
- {
- UnsupportedNode(checkedExpression);
- return TrackedVisit(checkedExpression.Expression, data);
- }
-
- public override object TrackedVisitUncheckedExpression(UncheckedExpression uncheckedExpression, object data)
- {
- UnsupportedNode(uncheckedExpression);
- return TrackedVisit(uncheckedExpression.Expression, data);
- }
-
- public override object TrackedVisitPointerReferenceExpression(PointerReferenceExpression pointerReferenceExpression, object data)
- {
- UnsupportedNode(pointerReferenceExpression);
- return null;
- }
-
- public override object TrackedVisitCastExpression(CastExpression castExpression, object data)
- {
- if (castExpression.CastType == CastType.TryCast) {
- return PrintCast(Tokens.TryCast, castExpression);
- }
- if (castExpression.CastType == CastType.Cast || castExpression.CastTo.IsArrayType) {
- return PrintCast(Tokens.DirectCast, castExpression);
- }
- switch (castExpression.CastTo.Type) {
- case "System.Boolean":
- outputFormatter.PrintToken(Tokens.CBool);
- break;
- case "System.Byte":
- outputFormatter.PrintToken(Tokens.CByte);
- break;
- case "System.SByte":
- outputFormatter.PrintToken(Tokens.CSByte);
- break;
- case "System.Char":
- outputFormatter.PrintToken(Tokens.CChar);
- break;
- case "System.DateTime":
- outputFormatter.PrintToken(Tokens.CDate);
- break;
- case "System.Decimal":
- outputFormatter.PrintToken(Tokens.CDec);
- break;
- case "System.Double":
- outputFormatter.PrintToken(Tokens.CDbl);
- break;
- case "System.Int16":
- outputFormatter.PrintToken(Tokens.CShort);
- break;
- case "System.Int32":
- outputFormatter.PrintToken(Tokens.CInt);
- break;
- case "System.Int64":
- outputFormatter.PrintToken(Tokens.CLng);
- break;
- case "System.UInt16":
- outputFormatter.PrintToken(Tokens.CUShort);
- break;
- case "System.UInt32":
- outputFormatter.PrintToken(Tokens.CUInt);
- break;
- case "System.UInt64":
- outputFormatter.PrintToken(Tokens.CULng);
- break;
- case "System.Object":
- outputFormatter.PrintToken(Tokens.CObj);
- break;
- case "System.Single":
- outputFormatter.PrintToken(Tokens.CSng);
- break;
- case "System.String":
- outputFormatter.PrintToken(Tokens.CStr);
- break;
- default:
- return PrintCast(Tokens.CType, castExpression);
- }
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- TrackedVisit(castExpression.Expression, data);
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- return null;
- }
-
- object PrintCast(int castToken, CastExpression castExpression)
- {
- outputFormatter.PrintToken(castToken);
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- TrackedVisit(castExpression.Expression, null);
- outputFormatter.PrintToken(Tokens.Comma);
- outputFormatter.Space();
- TrackedVisit(castExpression.CastTo, null);
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- return null;
- }
-
- public override object TrackedVisitStackAllocExpression(StackAllocExpression stackAllocExpression, object data)
- {
- UnsupportedNode(stackAllocExpression);
- return null;
- }
-
- public override object TrackedVisitIndexerExpression(IndexerExpression indexerExpression, object data)
- {
- TrackedVisit(indexerExpression.TargetObject, data);
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- AppendCommaSeparatedList(indexerExpression.Indexes);
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- return null;
- }
-
- public override object TrackedVisitThisReferenceExpression(ThisReferenceExpression thisReferenceExpression, object data)
- {
- outputFormatter.PrintToken(Tokens.Me);
- return null;
- }
-
- public override object TrackedVisitBaseReferenceExpression(BaseReferenceExpression baseReferenceExpression, object data)
- {
- outputFormatter.PrintToken(Tokens.MyBase);
- return null;
- }
-
- public override object TrackedVisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression, object data)
- {
- outputFormatter.PrintToken(Tokens.New);
- outputFormatter.Space();
- TrackedVisit(objectCreateExpression.CreateType, data);
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- AppendCommaSeparatedList(objectCreateExpression.Parameters);
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- return null;
- }
-
- public override object TrackedVisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object data)
- {
- outputFormatter.PrintToken(Tokens.New);
- outputFormatter.Space();
- PrintTypeReferenceWithoutArray(arrayCreateExpression.CreateType);
-
- if (arrayCreateExpression.Arguments.Count > 0) {
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- AppendCommaSeparatedList(arrayCreateExpression.Arguments);
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- PrintArrayRank(arrayCreateExpression.CreateType.RankSpecifier, 1);
- } else {
- PrintArrayRank(arrayCreateExpression.CreateType.RankSpecifier, 0);
- }
-
- outputFormatter.Space();
-
- if (arrayCreateExpression.ArrayInitializer.IsNull) {
- outputFormatter.PrintToken(Tokens.OpenCurlyBrace);
- outputFormatter.PrintToken(Tokens.CloseCurlyBrace);
- } else {
- TrackedVisit(arrayCreateExpression.ArrayInitializer, data);
- }
- return null;
- }
-
- public override object TrackedVisitCollectionInitializerExpression(CollectionInitializerExpression arrayInitializerExpression, object data)
- {
- outputFormatter.PrintToken(Tokens.OpenCurlyBrace);
- this.AppendCommaSeparatedList(arrayInitializerExpression.CreateExpressions);
- outputFormatter.PrintToken(Tokens.CloseCurlyBrace);
- return null;
- }
-
- public override object TrackedVisitMemberReferenceExpression(MemberReferenceExpression memberReferenceExpression, object data)
- {
- TrackedVisit(memberReferenceExpression.TargetObject, data);
- outputFormatter.PrintToken(Tokens.Dot);
- outputFormatter.PrintIdentifier(memberReferenceExpression.MemberName);
- PrintTypeArguments(memberReferenceExpression.TypeArguments);
- return null;
- }
-
- public override object TrackedVisitDirectionExpression(DirectionExpression directionExpression, object data)
- {
- // VB does not need to specify the direction in method calls
- TrackedVisit(directionExpression.Expression, data);
- return null;
- }
-
-
- public override object TrackedVisitConditionalExpression(ConditionalExpression conditionalExpression, object data)
- {
- outputFormatter.PrintText("If");
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- TrackedVisit(conditionalExpression.Condition, data);
- outputFormatter.PrintToken(Tokens.Comma);
- outputFormatter.Space();
- TrackedVisit(conditionalExpression.TrueExpression, data);
- outputFormatter.PrintToken(Tokens.Comma);
- outputFormatter.Space();
- TrackedVisit(conditionalExpression.FalseExpression, data);
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- return null;
- }
-
- #endregion
- #endregion
-
-
- void OutputModifier(ParameterModifiers modifier, Location position)
- {
- switch (modifier) {
- case ParameterModifiers.None:
- case ParameterModifiers.In:
- if (prettyPrintOptions.OutputByValModifier) {
- outputFormatter.PrintToken(Tokens.ByVal);
- outputFormatter.Space();
- }
- break;
- case ParameterModifiers.Out:
- //Error("Out parameter converted to ByRef", position);
- outputFormatter.PrintToken(Tokens.ByRef);
- outputFormatter.Space();
- break;
- case ParameterModifiers.Params:
- outputFormatter.PrintToken(Tokens.ParamArray);
- outputFormatter.Space();
- break;
- case ParameterModifiers.Ref:
- outputFormatter.PrintToken(Tokens.ByRef);
- outputFormatter.Space();
- break;
- case ParameterModifiers.Optional:
- outputFormatter.PrintToken(Tokens.Optional);
- outputFormatter.Space();
- break;
- default:
- Error(String.Format("Unsupported modifier : {0}", modifier), position);
- break;
- }
- }
-
- void OutputModifier(Modifiers modifier)
- {
- OutputModifier(modifier, false);
- }
-
- void OutputModifier(Modifiers modifier, bool forTypeDecl)
- {
- if ((modifier & Modifiers.Public) == Modifiers.Public) {
- outputFormatter.PrintToken(Tokens.Public);
- outputFormatter.Space();
- } else if ((modifier & Modifiers.Private) == Modifiers.Private) {
- outputFormatter.PrintToken(Tokens.Private);
- outputFormatter.Space();
- } else if ((modifier & (Modifiers.Protected | Modifiers.Internal)) == (Modifiers.Protected | Modifiers.Internal)) {
- outputFormatter.PrintToken(Tokens.Protected);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Friend);
- outputFormatter.Space();
- } else if ((modifier & Modifiers.Internal) == Modifiers.Internal) {
- outputFormatter.PrintToken(Tokens.Friend);
- outputFormatter.Space();
- } else if ((modifier & Modifiers.Protected) == Modifiers.Protected) {
- outputFormatter.PrintToken(Tokens.Protected);
- outputFormatter.Space();
- }
-
- if ((modifier & Modifiers.Static) == Modifiers.Static) {
- outputFormatter.PrintToken(Tokens.Shared);
- outputFormatter.Space();
- }
- if ((modifier & Modifiers.Virtual) == Modifiers.Virtual) {
- outputFormatter.PrintToken(Tokens.Overridable);
- outputFormatter.Space();
- }
- if ((modifier & Modifiers.Abstract) == Modifiers.Abstract) {
- outputFormatter.PrintToken(forTypeDecl ? Tokens.MustInherit : Tokens.MustOverride);
- outputFormatter.Space();
- }
- if ((modifier & Modifiers.Override) == Modifiers.Override) {
- outputFormatter.PrintToken(Tokens.Overloads);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Overrides);
- outputFormatter.Space();
- }
- if ((modifier & Modifiers.New) == Modifiers.New) {
- outputFormatter.PrintToken(Tokens.Shadows);
- outputFormatter.Space();
- }
-
- if ((modifier & Modifiers.Sealed) == Modifiers.Sealed) {
- outputFormatter.PrintToken(forTypeDecl ? Tokens.NotInheritable : Tokens.NotOverridable);
- outputFormatter.Space();
- }
-
- if ((modifier & Modifiers.ReadOnly) == Modifiers.ReadOnly) {
- outputFormatter.PrintToken(Tokens.ReadOnly);
- outputFormatter.Space();
- }
- if ((modifier & Modifiers.WriteOnly) == Modifiers.WriteOnly) {
- outputFormatter.PrintToken(Tokens.WriteOnly);
- outputFormatter.Space();
- }
- if ((modifier & Modifiers.Const) == Modifiers.Const) {
- outputFormatter.PrintToken(Tokens.Const);
- outputFormatter.Space();
- }
- if ((modifier & Modifiers.Partial) == Modifiers.Partial) {
- outputFormatter.PrintToken(Tokens.Partial);
- outputFormatter.Space();
- }
-
- if ((modifier & Modifiers.Extern) == Modifiers.Extern) {
- // not required in VB
- }
-
- if ((modifier & Modifiers.Volatile) == Modifiers.Volatile) {
- Error("'Volatile' modifier not convertable", Location.Empty);
- }
-
- if ((modifier & Modifiers.Unsafe) == Modifiers.Unsafe) {
- Error("'Unsafe' modifier not convertable", Location.Empty);
- }
- }
-
- public void AppendCommaSeparatedList<T>(ICollection<T> list) where T : class, INode
- {
- if (list != null) {
- int i = 0;
- foreach (T node in list) {
- TrackedVisit(node, null);
- if (i + 1 < list.Count) {
- outputFormatter.PrintToken(Tokens.Comma);
- outputFormatter.Space();
- if ((i + 1) % 6 == 0) {
- outputFormatter.PrintLineContinuation();
- outputFormatter.Indent();
- outputFormatter.PrintText("\t");
- }
- }
- i++;
- }
- }
- }
-
- void VisitAttributes(ICollection attributes, object data)
- {
- if (attributes == null) {
- return;
- }
- foreach (AttributeSection section in attributes) {
- if (string.Equals(section.AttributeTarget, "return", StringComparison.OrdinalIgnoreCase))
- continue;
- TrackedVisit(section, data);
- }
- }
-
- void VisitReturnTypeAttributes(ICollection attributes, object data)
- {
- if (attributes == null) {
- return;
- }
- printAttributeSectionInline = true;
- foreach (AttributeSection section in attributes) {
- if (string.Equals(section.AttributeTarget, "return", StringComparison.OrdinalIgnoreCase)) {
- TrackedVisit(section, data);
- }
- }
- printAttributeSectionInline = false;
- }
-
- public override object TrackedVisitLambdaExpression(LambdaExpression lambdaExpression, object data)
- {
- if (!lambdaExpression.ExpressionBody.IsNull) {
- outputFormatter.PrintToken(Tokens.Function);
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- AppendCommaSeparatedList(lambdaExpression.Parameters);
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- outputFormatter.Space();
- return lambdaExpression.ExpressionBody.AcceptVisitor(this, data);
- } else {
- OutputAnonymousMethodWithStatementBody(lambdaExpression.Parameters, lambdaExpression.StatementBody);
- return null;
- }
- }
-
- void OutputAnonymousMethodWithStatementBody(List<ParameterDeclarationExpression> parameters, BlockStatement body)
- {
- Error("VB does not support anonymous methods/lambda expressions with a statement body", body.StartLocation);
-
- outputFormatter.PrintToken(Tokens.Function);
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- AppendCommaSeparatedList(parameters);
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Do);
- outputFormatter.NewLine();
-
- ++outputFormatter.IndentationLevel;
- exitTokenStack.Push(Tokens.Function);
- body.AcceptVisitor(this, null);
- exitTokenStack.Pop();
- --outputFormatter.IndentationLevel;
-
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.End);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Function);
- }
-
- public override object TrackedVisitQueryExpression(QueryExpression queryExpression, object data)
- {
- if (queryExpression.IsQueryContinuation) {
- queryExpression.FromClause.InExpression.AcceptVisitor(this, data);
- }
- outputFormatter.IndentationLevel++;
- if (queryExpression.IsQueryContinuation) {
- outputFormatter.PrintToken(Tokens.Into);
- outputFormatter.PrintIdentifier(queryExpression.FromClause.Identifier);
- } else {
- queryExpression.FromClause.AcceptVisitor(this, data);
- }
- queryExpression.MiddleClauses.ForEach(PrintClause);
- PrintClause(queryExpression.SelectOrGroupClause);
- outputFormatter.IndentationLevel--;
- return null;
- }
-
- void PrintClause(QueryExpressionClause clause)
- {
- if (!clause.IsNull) {
- outputFormatter.PrintLineContinuation();
- outputFormatter.Indent();
- clause.AcceptVisitor(this, null);
- }
- }
-
- public override object TrackedVisitQueryExpressionFromClause(QueryExpressionFromClause fromClause, object data)
- {
- outputFormatter.PrintText("From");
- outputFormatter.Space();
- VisitQueryExpressionFromOrJoinClause(fromClause, data);
- return null;
- }
-
- public override object TrackedVisitQueryExpressionJoinClause(QueryExpressionJoinClause joinClause, object data)
- {
- outputFormatter.PrintText("Join");
- outputFormatter.Space();
- VisitQueryExpressionFromOrJoinClause(joinClause, data);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.On);
- outputFormatter.Space();
- joinClause.OnExpression.AcceptVisitor(this, data);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Assign);
- outputFormatter.Space();
- joinClause.EqualsExpression.AcceptVisitor(this, data);
- if (!string.IsNullOrEmpty(joinClause.IntoIdentifier)) {
- outputFormatter.Space();
- outputFormatter.PrintText("Into");
- outputFormatter.Space();
- outputFormatter.PrintIdentifier(joinClause.IntoIdentifier);
- }
- return null;
- }
-
- void VisitQueryExpressionFromOrJoinClause(QueryExpressionFromOrJoinClause clause, object data)
- {
- outputFormatter.PrintIdentifier(clause.Identifier);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.In);
- outputFormatter.Space();
- clause.InExpression.AcceptVisitor(this, data);
- }
-
- public override object TrackedVisitQueryExpressionLetClause(QueryExpressionLetClause letClause, object data)
- {
- outputFormatter.PrintToken(Tokens.Let);
- outputFormatter.Space();
- outputFormatter.PrintIdentifier(letClause.Identifier);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Assign);
- outputFormatter.Space();
- return letClause.Expression.AcceptVisitor(this, data);
- }
-
- public override object TrackedVisitQueryExpressionGroupClause(QueryExpressionGroupClause groupClause, object data)
- {
- outputFormatter.PrintText("Group");
- outputFormatter.Space();
- groupClause.Projection.AcceptVisitor(this, data);
- outputFormatter.Space();
- outputFormatter.PrintText("By");
- outputFormatter.Space();
- return groupClause.GroupBy.AcceptVisitor(this, data);
- }
-
- public override object TrackedVisitQueryExpressionOrderClause(QueryExpressionOrderClause queryExpressionOrderClause, object data)
- {
- outputFormatter.PrintText("Order By");
- outputFormatter.Space();
- AppendCommaSeparatedList(queryExpressionOrderClause.Orderings);
- return null;
- }
-
- public override object TrackedVisitQueryExpressionOrdering(QueryExpressionOrdering ordering, object data)
- {
- ordering.Criteria.AcceptVisitor(this, data);
- if (ordering.Direction == QueryExpressionOrderingDirection.Ascending) {
- outputFormatter.Space();
- outputFormatter.PrintText("Ascending");
- } else if (ordering.Direction == QueryExpressionOrderingDirection.Descending) {
- outputFormatter.Space();
- outputFormatter.PrintText("Descending");
- }
- return null;
- }
-
- public override object TrackedVisitQueryExpressionSelectClause(QueryExpressionSelectClause selectClause, object data)
- {
- outputFormatter.PrintToken(Tokens.Select);
- outputFormatter.Space();
- return selectClause.Projection.AcceptVisitor(this, data);
- }
-
- public override object TrackedVisitQueryExpressionWhereClause(QueryExpressionWhereClause whereClause, object data)
- {
- outputFormatter.PrintText("Where");
- outputFormatter.Space();
- return whereClause.Condition.AcceptVisitor(this, data);
- }
-
- public override object TrackedVisitExternAliasDirective(ExternAliasDirective externAliasDirective, object data)
- {
- UnsupportedNode(externAliasDirective);
- return null;
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
+// <version>$Revision: 4741 $</version>
+// </file>
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Globalization;
+using System.Text;
+
+using ICSharpCode.NRefactory.Ast;
+using ICSharpCode.NRefactory.Parser;
+using ICSharpCode.NRefactory.Parser.VB;
+using ICSharpCode.NRefactory.Visitors;
+
+namespace ICSharpCode.NRefactory.PrettyPrinter
+{
+ public sealed class VBNetOutputVisitor : NodeTrackingAstVisitor, IOutputAstVisitor
+ {
+ Errors errors = new Errors();
+ VBNetOutputFormatter outputFormatter;
+ VBNetPrettyPrintOptions prettyPrintOptions = new VBNetPrettyPrintOptions();
+ TypeDeclaration currentType;
+
+ Stack<int> exitTokenStack = new Stack<int>();
+
+ public string Text {
+ get {
+ return outputFormatter.Text;
+ }
+ }
+
+ public Errors Errors {
+ get {
+ return errors;
+ }
+ }
+
+ AbstractPrettyPrintOptions IOutputAstVisitor.Options {
+ get { return prettyPrintOptions; }
+ }
+
+ public VBNetPrettyPrintOptions Options {
+ get { return prettyPrintOptions; }
+ }
+
+ public IOutputFormatter OutputFormatter {
+ get {
+ return outputFormatter;
+ }
+ }
+
+ public VBNetOutputVisitor()
+ {
+ outputFormatter = new VBNetOutputFormatter(prettyPrintOptions);
+ }
+
+ public event Action<INode> BeforeNodeVisit;
+ public event Action<INode> AfterNodeVisit;
+
+ protected override void BeginVisit(INode node)
+ {
+ if (BeforeNodeVisit != null) {
+ BeforeNodeVisit(node);
+ }
+ base.BeginVisit(node);
+ }
+
+ protected override void EndVisit(INode node)
+ {
+ base.EndVisit(node);
+ if (AfterNodeVisit != null) {
+ AfterNodeVisit(node);
+ }
+ }
+
+ object TrackedVisit(INode node, object data)
+ {
+ return node.AcceptVisitor(this, data);
+ }
+
+ void Error(string text, Location position)
+ {
+ errors.Error(position.Line, position.Column, text);
+ }
+
+ void UnsupportedNode(INode node)
+ {
+ Error(node.GetType().Name + " is unsupported", node.StartLocation);
+ }
+
+ #region ICSharpCode.NRefactory.Parser.IASTVisitor interface implementation
+ public override object TrackedVisitCompilationUnit(CompilationUnit compilationUnit, object data)
+ {
+ compilationUnit.AcceptChildren(this, data);
+ outputFormatter.EndFile();
+ return null;
+ }
+
+ /// <summary>
+ /// Converts type name to primitive type name. Returns typeString if typeString is not
+ /// a primitive type.
+ /// </summary>
+ static string ConvertTypeString(string typeString)
+ {
+ string primitiveType;
+ if (TypeReference.PrimitiveTypesVBReverse.TryGetValue(typeString, out primitiveType))
+ return primitiveType;
+ else
+ return typeString;
+ }
+
+ public override object TrackedVisitTypeReference(TypeReference typeReference, object data)
+ {
+ if (typeReference == TypeReference.ClassConstraint) {
+ outputFormatter.PrintToken(Tokens.Class);
+ } else if (typeReference == TypeReference.StructConstraint) {
+ outputFormatter.PrintToken(Tokens.Structure);
+ } else if (typeReference == TypeReference.NewConstraint) {
+ outputFormatter.PrintToken(Tokens.New);
+ } else {
+ PrintTypeReferenceWithoutArray(typeReference);
+ if (typeReference.IsArrayType) {
+ PrintArrayRank(typeReference.RankSpecifier, 0);
+ }
+ }
+ return null;
+ }
+
+ void PrintTypeReferenceWithoutArray(TypeReference typeReference)
+ {
+ if (typeReference.IsGlobal) {
+ outputFormatter.PrintToken(Tokens.Global);
+ outputFormatter.PrintToken(Tokens.Dot);
+ }
+ bool printGenerics = true;
+ if (typeReference.IsKeyword) {
+ outputFormatter.PrintText(ConvertTypeString(typeReference.Type));
+ } else {
+ outputFormatter.PrintIdentifier(typeReference.Type);
+ }
+ if (printGenerics && typeReference.GenericTypes != null && typeReference.GenericTypes.Count > 0) {
+ outputFormatter.PrintToken(Tokens.OpenParenthesis);
+ outputFormatter.PrintToken(Tokens.Of);
+ outputFormatter.Space();
+ AppendCommaSeparatedList(typeReference.GenericTypes);
+ outputFormatter.PrintToken(Tokens.CloseParenthesis);
+ }
+ for (int i = 0; i < typeReference.PointerNestingLevel; ++i) {
+ outputFormatter.PrintToken(Tokens.Times);
+ }
+ }
+
+ void PrintArrayRank(int[] rankSpecifier, int startRank)
+ {
+ for (int i = startRank; i < rankSpecifier.Length; ++i) {
+ outputFormatter.PrintToken(Tokens.OpenParenthesis);
+ for (int j = 0; j < rankSpecifier[i]; ++j) {
+ outputFormatter.PrintToken(Tokens.Comma);
+ }
+ outputFormatter.PrintToken(Tokens.CloseParenthesis);
+ }
+ }
+
+ public override object TrackedVisitInnerClassTypeReference(InnerClassTypeReference innerClassTypeReference, object data)
+ {
+ TrackedVisit(innerClassTypeReference.BaseType, data);
+ outputFormatter.PrintToken(Tokens.Dot);
+ return VisitTypeReference((TypeReference)innerClassTypeReference, data);
+ }
+
+ #region Global scope
+ bool printAttributeSectionInline; // is set to true when printing parameter's attributes
+
+ public override object TrackedVisitAttributeSection(AttributeSection attributeSection, object data)
+ {
+ if (!printAttributeSectionInline)
+ outputFormatter.Indent();
+ outputFormatter.PrintText("<");
+ if (!string.IsNullOrEmpty(attributeSection.AttributeTarget) && !string.Equals(attributeSection.AttributeTarget, "return", StringComparison.OrdinalIgnoreCase)) {
+ outputFormatter.PrintText(char.ToUpperInvariant(attributeSection.AttributeTarget[0]) + attributeSection.AttributeTarget.Substring(1));
+ outputFormatter.PrintToken(Tokens.Colon);
+ outputFormatter.Space();
+ }
+ Debug.Assert(attributeSection.Attributes != null);
+ AppendCommaSeparatedList(attributeSection.Attributes);
+
+ outputFormatter.PrintText(">");
+
+ if ("assembly".Equals(attributeSection.AttributeTarget, StringComparison.InvariantCultureIgnoreCase)
+ || "module".Equals(attributeSection.AttributeTarget, StringComparison.InvariantCultureIgnoreCase)) {
+ outputFormatter.NewLine();
+ } else {
+ if (printAttributeSectionInline)
+ outputFormatter.Space();
+ else
+ outputFormatter.PrintLineContinuation();
+ }
+
+ return null;
+ }
+
+ public override object TrackedVisitAttribute(ICSharpCode.NRefactory.Ast.Attribute attribute, object data)
+ {
+ outputFormatter.PrintIdentifier(attribute.Name);
+ if (attribute.PositionalArguments.Count > 0 || attribute.NamedArguments.Count > 0) {
+ outputFormatter.PrintToken(Tokens.OpenParenthesis);
+ AppendCommaSeparatedList(attribute.PositionalArguments);
+
+ if (attribute.NamedArguments.Count > 0) {
+ if (attribute.PositionalArguments.Count > 0) {
+ outputFormatter.PrintToken(Tokens.Comma);
+ outputFormatter.Space();
+ }
+ AppendCommaSeparatedList(attribute.NamedArguments);
+ }
+ outputFormatter.PrintToken(Tokens.CloseParenthesis);
+ }
+ return null;
+ }
+
+ public override object TrackedVisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression, object data)
+ {
+ outputFormatter.PrintIdentifier(namedArgumentExpression.Name);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Colon);
+ outputFormatter.PrintToken(Tokens.Assign);
+ outputFormatter.Space();
+ TrackedVisit(namedArgumentExpression.Expression, data);
+ return null;
+ }
+
+ public override object TrackedVisitUsing(Using @using, object data)
+ {
+ Debug.Fail("Should never be called. The usings should be handled in Visit(UsingDeclaration)");
+ return null;
+ }
+
+ public override object TrackedVisitUsingDeclaration(UsingDeclaration usingDeclaration, object data)
+ {
+ outputFormatter.Indent();
+ outputFormatter.PrintToken(Tokens.Imports);
+ outputFormatter.Space();
+ for (int i = 0; i < usingDeclaration.Usings.Count; ++i) {
+ outputFormatter.PrintIdentifier(((Using)usingDeclaration.Usings[i]).Name);
+ if (((Using)usingDeclaration.Usings[i]).IsAlias) {
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Assign);
+ outputFormatter.Space();
+ TrackedVisit(((Using)usingDeclaration.Usings[i]).Alias, data);
+ }
+ if (i + 1 < usingDeclaration.Usings.Count) {
+ outputFormatter.PrintToken(Tokens.Comma);
+ outputFormatter.Space();
+ }
+ }
+ outputFormatter.NewLine();
+ return null;
+ }
+
+ public override object TrackedVisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, object data)
+ {
+ outputFormatter.Indent();
+ outputFormatter.PrintToken(Tokens.Namespace);
+ outputFormatter.Space();
+ outputFormatter.PrintIdentifier(namespaceDeclaration.Name);
+ outputFormatter.NewLine();
+
+ ++outputFormatter.IndentationLevel;
+ namespaceDeclaration.AcceptChildren(this, data);
+ --outputFormatter.IndentationLevel;
+
+ outputFormatter.Indent();
+ outputFormatter.PrintToken(Tokens.End);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Namespace);
+ outputFormatter.NewLine();
+ return null;
+ }
+
+ static int GetTypeToken(TypeDeclaration typeDeclaration)
+ {
+ switch (typeDeclaration.Type) {
+ case ClassType.Class:
+ return Tokens.Class;
+ case ClassType.Enum:
+ return Tokens.Enum;
+ case ClassType.Interface:
+ return Tokens.Interface;
+ case ClassType.Struct:
+ return Tokens.Structure;
+ default:
+ return Tokens.Class;
+ }
+ }
+
+ void PrintTemplates(List<TemplateDefinition> templates)
+ {
+ if (templates != null && templates.Count > 0) {
+ outputFormatter.PrintToken(Tokens.OpenParenthesis);
+ outputFormatter.PrintToken(Tokens.Of);
+ outputFormatter.Space();
+ AppendCommaSeparatedList(templates);
+ outputFormatter.PrintToken(Tokens.CloseParenthesis);
+ }
+ }
+
+ public override object TrackedVisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
+ {
+ VisitAttributes(typeDeclaration.Attributes, data);
+
+ outputFormatter.Indent();
+ OutputModifier(typeDeclaration.Modifier, true);
+
+ int typeToken = GetTypeToken(typeDeclaration);
+ outputFormatter.PrintToken(typeToken);
+ outputFormatter.Space();
+ outputFormatter.PrintIdentifier(typeDeclaration.Name);
+
+ PrintTemplates(typeDeclaration.Templates);
+
+ if (typeDeclaration.Type == ClassType.Enum
+ && typeDeclaration.BaseTypes != null && typeDeclaration.BaseTypes.Count > 0)
+ {
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.As);
+ outputFormatter.Space();
+ foreach (TypeReference baseTypeRef in typeDeclaration.BaseTypes) {
+ TrackedVisit(baseTypeRef, data);
+ }
+ }
+
+ outputFormatter.NewLine();
+ ++outputFormatter.IndentationLevel;
+
+ if (typeDeclaration.BaseTypes != null && typeDeclaration.Type != ClassType.Enum) {
+ foreach (TypeReference baseTypeRef in typeDeclaration.BaseTypes) {
+ outputFormatter.Indent();
+
+ string baseType = baseTypeRef.Type;
+ if (baseType.IndexOf('.') >= 0) {
+ baseType = baseType.Substring(baseType.LastIndexOf('.') + 1);
+ }
+ bool baseTypeIsInterface = baseType.Length >= 2 && baseType[0] == 'I' && Char.IsUpper(baseType[1]);
+
+ if (!baseTypeIsInterface || typeDeclaration.Type == ClassType.Interface) {
+ outputFormatter.PrintToken(Tokens.Inherits);
+ } else {
+ outputFormatter.PrintToken(Tokens.Implements);
+ }
+ outputFormatter.Space();
+ TrackedVisit(baseTypeRef, data);
+ outputFormatter.NewLine();
+ }
+ }
+
+ TypeDeclaration oldType = currentType;
+ currentType = typeDeclaration;
+
+ if (typeDeclaration.Type == ClassType.Enum) {
+ OutputEnumMembers(typeDeclaration, data);
+ } else {
+ typeDeclaration.AcceptChildren(this, data);
+ }
+ currentType = oldType;
+
+ --outputFormatter.IndentationLevel;
+
+
+ outputFormatter.Indent();
+ outputFormatter.PrintToken(Tokens.End);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(typeToken);
+ outputFormatter.NewLine();
+ return null;
+ }
+
+ void OutputEnumMembers(TypeDeclaration typeDeclaration, object data)
+ {
+ foreach (FieldDeclaration fieldDeclaration in typeDeclaration.Children) {
+ BeginVisit(fieldDeclaration);
+ VariableDeclaration f = (VariableDeclaration)fieldDeclaration.Fields[0];
+ VisitAttributes(fieldDeclaration.Attributes, data);
+ outputFormatter.Indent();
+ outputFormatter.PrintIdentifier(f.Name);
+ if (f.Initializer != null && !f.Initializer.IsNull) {
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Assign);
+ outputFormatter.Space();
+ TrackedVisit(f.Initializer, data);
+ }
+ outputFormatter.NewLine();
+ EndVisit(fieldDeclaration);
+ }
+ }
+
+ public override object TrackedVisitTemplateDefinition(TemplateDefinition templateDefinition, object data)
+ {
+ VisitAttributes(templateDefinition.Attributes, data);
+ outputFormatter.PrintIdentifier(templateDefinition.Name);
+ if (templateDefinition.Bases.Count > 0) {
+ outputFormatter.PrintText(" As ");
+ VisitReturnTypeAttributes(templateDefinition.Attributes, data);
+ if (templateDefinition.Bases.Count == 1) {
+ TrackedVisit(templateDefinition.Bases[0], data);
+ } else {
+ outputFormatter.PrintToken(Tokens.OpenCurlyBrace);
+ AppendCommaSeparatedList(templateDefinition.Bases);
+ outputFormatter.PrintToken(Tokens.CloseCurlyBrace);
+ }
+ }
+ return null;
+ }
+
+ public override object TrackedVisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data)
+ {
+ VisitAttributes(delegateDeclaration.Attributes, data);
+
+ outputFormatter.Indent();
+ OutputModifier(delegateDeclaration.Modifier, true);
+ outputFormatter.PrintToken(Tokens.Delegate);
+ outputFormatter.Space();
+
+ bool isFunction = (delegateDeclaration.ReturnType.Type != "System.Void");
+ if (isFunction) {
+ outputFormatter.PrintToken(Tokens.Function);
+ outputFormatter.Space();
+ } else {
+ outputFormatter.PrintToken(Tokens.Sub);
+ outputFormatter.Space();
+ }
+ outputFormatter.PrintIdentifier(delegateDeclaration.Name);
+
+ PrintTemplates(delegateDeclaration.Templates);
+
+ outputFormatter.PrintToken(Tokens.OpenParenthesis);
+ AppendCommaSeparatedList(delegateDeclaration.Parameters);
+ outputFormatter.PrintToken(Tokens.CloseParenthesis);
+
+ if (isFunction) {
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.As);
+ outputFormatter.Space();
+ VisitReturnTypeAttributes(delegateDeclaration.Attributes, data);
+ TrackedVisit(delegateDeclaration.ReturnType, data);
+ }
+ outputFormatter.NewLine();
+ return null;
+ }
+
+ public override object TrackedVisitOptionDeclaration(OptionDeclaration optionDeclaration, object data)
+ {
+ outputFormatter.PrintToken(Tokens.Option);
+ outputFormatter.Space();
+ switch (optionDeclaration.OptionType) {
+ case OptionType.Strict:
+ outputFormatter.PrintToken(Tokens.Strict);
+ if (!optionDeclaration.OptionValue) {
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Off);
+ }
+ break;
+ case OptionType.Explicit:
+ outputFormatter.PrintToken(Tokens.Explicit);
+ outputFormatter.Space();
+ if (!optionDeclaration.OptionValue) {
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Off);
+ }
+ break;
+ case OptionType.CompareBinary:
+ outputFormatter.PrintToken(Tokens.Compare);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Binary);
+ break;
+ case OptionType.CompareText:
+ outputFormatter.PrintToken(Tokens.Compare);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Text);
+ break;
+ }
+ outputFormatter.NewLine();
+ return null;
+ }
+ #endregion
+
+ #region Type level
+ TypeReference currentVariableType;
+ public override object TrackedVisitFieldDeclaration(FieldDeclaration fieldDeclaration, object data)
+ {
+
+ VisitAttributes(fieldDeclaration.Attributes, data);
+ outputFormatter.Indent();
+ if (fieldDeclaration.Modifier == Modifiers.None) {
+ outputFormatter.PrintToken(Tokens.Private);
+ outputFormatter.Space();
+ } else if (fieldDeclaration.Modifier == Modifiers.Dim) {
+ outputFormatter.PrintToken(Tokens.Dim);
+ outputFormatter.Space();
+ } else {
+ OutputModifier(fieldDeclaration.Modifier);
+ }
+ currentVariableType = fieldDeclaration.TypeReference;
+ AppendCommaSeparatedList(fieldDeclaration.Fields);
+ currentVariableType = null;
+
+ outputFormatter.NewLine();
+
+ return null;
+ }
+
+ public override object TrackedVisitVariableDeclaration(VariableDeclaration variableDeclaration, object data)
+ {
+ outputFormatter.PrintIdentifier(variableDeclaration.Name);
+
+ TypeReference varType = currentVariableType;
+ if (varType != null && varType.IsNull)
+ varType = null;
+ if (varType == null && !variableDeclaration.TypeReference.IsNull)
+ varType = variableDeclaration.TypeReference;
+
+ if (varType != null) {
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.As);
+ outputFormatter.Space();
+ ObjectCreateExpression init = variableDeclaration.Initializer as ObjectCreateExpression;
+ if (init != null && TypeReference.AreEqualReferences(init.CreateType, varType)) {
+ TrackedVisit(variableDeclaration.Initializer, data);
+ return null;
+ } else {
+ TrackedVisit(varType, data);
+ }
+ }
+
+ if (!variableDeclaration.Initializer.IsNull) {
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Assign);
+ outputFormatter.Space();
+ TrackedVisit(variableDeclaration.Initializer, data);
+ }
+ return null;
+ }
+
+ public override object TrackedVisitPropertyDeclaration(PropertyDeclaration propertyDeclaration, object data)
+ {
+ VisitAttributes(propertyDeclaration.Attributes, data);
+ outputFormatter.Indent();
+ OutputModifier(propertyDeclaration.Modifier);
+
+ if ((propertyDeclaration.Modifier & (Modifiers.ReadOnly | Modifiers.WriteOnly)) == Modifiers.None) {
+ if (propertyDeclaration.IsReadOnly) {
+ outputFormatter.PrintToken(Tokens.ReadOnly);
+ outputFormatter.Space();
+ } else if (propertyDeclaration.IsWriteOnly) {
+ outputFormatter.PrintToken(Tokens.WriteOnly);
+ outputFormatter.Space();
+ }
+ }
+
+ outputFormatter.PrintToken(Tokens.Property);
+ outputFormatter.Space();
+ outputFormatter.PrintIdentifier(propertyDeclaration.Name);
+
+ outputFormatter.PrintToken(Tokens.OpenParenthesis);
+ AppendCommaSeparatedList(propertyDeclaration.Parameters);
+ outputFormatter.PrintToken(Tokens.CloseParenthesis);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.As);
+ outputFormatter.Space();
+ VisitReturnTypeAttributes(propertyDeclaration.Attributes, data);
+ TrackedVisit(propertyDeclaration.TypeReference, data);
+
+ PrintInterfaceImplementations(propertyDeclaration.InterfaceImplementations);
+
+ outputFormatter.NewLine();
+
+ if (!IsAbstract(propertyDeclaration)) {
+ outputFormatter.IsInMemberBody = true;
+ ++outputFormatter.IndentationLevel;
+ exitTokenStack.Push(Tokens.Property);
+ TrackedVisit(propertyDeclaration.GetRegion, data);
+ TrackedVisit(propertyDeclaration.SetRegion, data);
+ exitTokenStack.Pop();
+ --outputFormatter.IndentationLevel;
+ outputFormatter.IsInMemberBody = false;
+
+ outputFormatter.Indent();
+ outputFormatter.PrintToken(Tokens.End);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Property);
+ outputFormatter.NewLine();
+ }
+
+ return null;
+ }
+
+ public override object TrackedVisitPropertyGetRegion(PropertyGetRegion propertyGetRegion, object data)
+ {
+ VisitAttributes(propertyGetRegion.Attributes, data);
+ outputFormatter.Indent();
+ OutputModifier(propertyGetRegion.Modifier);
+ outputFormatter.PrintToken(Tokens.Get);
+ outputFormatter.NewLine();
+
+ ++outputFormatter.IndentationLevel;
+ TrackedVisit(propertyGetRegion.Block, data);
+ --outputFormatter.IndentationLevel;
+ outputFormatter.Indent();
+ outputFormatter.PrintToken(Tokens.End);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Get);
+ outputFormatter.NewLine();
+ return null;
+ }
+
+ public override object TrackedVisitPropertySetRegion(PropertySetRegion propertySetRegion, object data)
+ {
+ VisitAttributes(propertySetRegion.Attributes, data);
+ outputFormatter.Indent();
+ OutputModifier(propertySetRegion.Modifier);
+ outputFormatter.PrintToken(Tokens.Set);
+ outputFormatter.NewLine();
+
+ ++outputFormatter.IndentationLevel;
+ TrackedVisit(propertySetRegion.Block, data);
+ --outputFormatter.IndentationLevel;
+ outputFormatter.Indent();
+ outputFormatter.PrintToken(Tokens.End);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Set);
+ outputFormatter.NewLine();
+ return null;
+ }
+
+ TypeReference currentEventType = null;
+ public override object TrackedVisitEventDeclaration(EventDeclaration eventDeclaration, object data)
+ {
+ bool customEvent = eventDeclaration.HasAddRegion || eventDeclaration.HasRemoveRegion;
+
+ VisitAttributes(eventDeclaration.Attributes, data);
+ outputFormatter.Indent();
+ OutputModifier(eventDeclaration.Modifier);
+ if (customEvent) {
+ outputFormatter.PrintText("Custom");
+ outputFormatter.Space();
+ }
+
+ outputFormatter.PrintToken(Tokens.Event);
+ outputFormatter.Space();
+ outputFormatter.PrintIdentifier(eventDeclaration.Name);
+
+ if (eventDeclaration.Parameters.Count > 0) {
+ outputFormatter.PrintToken(Tokens.OpenParenthesis);
+ this.AppendCommaSeparatedList(eventDeclaration.Parameters);
+ outputFormatter.PrintToken(Tokens.CloseParenthesis);
+ }
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.As);
+ outputFormatter.Space();
+ VisitReturnTypeAttributes(eventDeclaration.Attributes, data);
+ TrackedVisit(eventDeclaration.TypeReference, data);
+
+ PrintInterfaceImplementations(eventDeclaration.InterfaceImplementations);
+
+ if (!eventDeclaration.Initializer.IsNull) {
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Assign);
+ outputFormatter.Space();
+ TrackedVisit(eventDeclaration.Initializer, data);
+ }
+
+ outputFormatter.NewLine();
+
+ if (customEvent) {
+ ++outputFormatter.IndentationLevel;
+ currentEventType = eventDeclaration.TypeReference;
+ exitTokenStack.Push(Tokens.Sub);
+ TrackedVisit(eventDeclaration.AddRegion, data);
+ TrackedVisit(eventDeclaration.RemoveRegion, data);
+ exitTokenStack.Pop();
+ --outputFormatter.IndentationLevel;
+
+ outputFormatter.Indent();
+ outputFormatter.PrintToken(Tokens.End);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Event);
+ outputFormatter.NewLine();
+ }
+ return null;
+ }
+
+ void PrintInterfaceImplementations(IList<InterfaceImplementation> list)
+ {
+ if (list == null || list.Count == 0)
+ return;
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Implements);
+ for (int i = 0; i < list.Count; i++) {
+ if (i > 0)
+ outputFormatter.PrintToken(Tokens.Comma);
+ outputFormatter.Space();
+ TrackedVisit(list[i].InterfaceType, null);
+ outputFormatter.PrintToken(Tokens.Dot);
+ outputFormatter.PrintIdentifier(list[i].MemberName);
+ }
+ }
+
+ public override object TrackedVisitEventAddRegion(EventAddRegion eventAddRegion, object data)
+ {
+ VisitAttributes(eventAddRegion.Attributes, data);
+ outputFormatter.Indent();
+ outputFormatter.PrintText("AddHandler(");
+ if (eventAddRegion.Parameters.Count == 0) {
+ outputFormatter.PrintToken(Tokens.ByVal);
+ outputFormatter.Space();
+ outputFormatter.PrintIdentifier("value");
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.As);
+ outputFormatter.Space();
+ TrackedVisit(currentEventType, data);
+ } else {
+ this.AppendCommaSeparatedList(eventAddRegion.Parameters);
+ }
+ outputFormatter.PrintToken(Tokens.CloseParenthesis);
+ outputFormatter.NewLine();
+
+ ++outputFormatter.IndentationLevel;
+ TrackedVisit(eventAddRegion.Block, data);
+ --outputFormatter.IndentationLevel;
+
+ outputFormatter.Indent();
+ outputFormatter.PrintToken(Tokens.End);
+ outputFormatter.Space();
+ outputFormatter.PrintText("AddHandler");
+ outputFormatter.NewLine();
+ return null;
+ }
+
+ public override object TrackedVisitEventRemoveRegion(EventRemoveRegion eventRemoveRegion, object data)
+ {
+ VisitAttributes(eventRemoveRegion.Attributes, data);
+ outputFormatter.Indent();
+ outputFormatter.PrintText("RemoveHandler");
+ outputFormatter.PrintToken(Tokens.OpenParenthesis);
+ if (eventRemoveRegion.Parameters.Count == 0) {
+ outputFormatter.PrintToken(Tokens.ByVal);
+ outputFormatter.Space();
+ outputFormatter.PrintIdentifier("value");
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.As);
+ outputFormatter.Space();
+ TrackedVisit(currentEventType, data);
+ } else {
+ this.AppendCommaSeparatedList(eventRemoveRegion.Parameters);
+ }
+ outputFormatter.PrintToken(Tokens.CloseParenthesis);
+ outputFormatter.NewLine();
+
+ ++outputFormatter.IndentationLevel;
+ TrackedVisit(eventRemoveRegion.Block, data);
+ --outputFormatter.IndentationLevel;
+
+ outputFormatter.Indent();
+ outputFormatter.PrintToken(Tokens.End);
+ outputFormatter.Space();
+ outputFormatter.PrintText("RemoveHandler");
+ outputFormatter.NewLine();
+ return null;
+ }
+
+ public override object TrackedVisitEventRaiseRegion(EventRaiseRegion eventRaiseRegion, object data)
+ {
+ VisitAttributes(eventRaiseRegion.Attributes, data);
+ outputFormatter.Indent();
+ outputFormatter.PrintText("RaiseEvent");
+ outputFormatter.PrintToken(Tokens.OpenParenthesis);
+ if (eventRaiseRegion.Parameters.Count == 0) {
+ outputFormatter.PrintToken(Tokens.ByVal);
+ outputFormatter.Space();
+ outputFormatter.PrintIdentifier("value");
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.As);
+ outputFormatter.Space();
+ TrackedVisit(currentEventType, data);
+ } else {
+ this.AppendCommaSeparatedList(eventRaiseRegion.Parameters);
+ }
+ outputFormatter.PrintToken(Tokens.CloseParenthesis);
+ outputFormatter.NewLine();
+
+ ++outputFormatter.IndentationLevel;
+ TrackedVisit(eventRaiseRegion.Block, data);
+ --outputFormatter.IndentationLevel;
+
+ outputFormatter.Indent();
+ outputFormatter.PrintToken(Tokens.End);
+ outputFormatter.Space();
+ outputFormatter.PrintText("RaiseEvent");
+ outputFormatter.NewLine();
+ return null;
+ }
+
+ public override object TrackedVisitParameterDeclarationExpression(ParameterDeclarationExpression parameterDeclarationExpression, object data)
+ {
+ printAttributeSectionInline = true;
+ VisitAttributes(parameterDeclarationExpression.Attributes, data);
+ printAttributeSectionInline = false;
+ OutputModifier(parameterDeclarationExpression.ParamModifier, parameterDeclarationExpression.StartLocation);
+ outputFormatter.PrintIdentifier(parameterDeclarationExpression.ParameterName);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.As);
+ outputFormatter.Space();
+ VisitReturnTypeAttributes(parameterDeclarationExpression.Attributes, data);
+ TrackedVisit(parameterDeclarationExpression.TypeReference, data);
+ return null;
+ }
+
+ public override object TrackedVisitMethodDeclaration(MethodDeclaration methodDeclaration, object data)
+ {
+ VisitAttributes(methodDeclaration.Attributes, data);
+ if (methodDeclaration.IsExtensionMethod) {
+ outputFormatter.Indent();
+ outputFormatter.PrintText("<System.Runtime.CompilerServices.Extension> _");
+ outputFormatter.NewLine();
+ }
+ outputFormatter.Indent();
+ OutputModifier(methodDeclaration.Modifier);
+
+ bool isSub = methodDeclaration.TypeReference.IsNull ||
+ methodDeclaration.TypeReference.Type == "System.Void";
+
+ if (isSub) {
+ outputFormatter.PrintToken(Tokens.Sub);
+ } else {
+ outputFormatter.PrintToken(Tokens.Function);
+ }
+ outputFormatter.Space();
+ outputFormatter.PrintIdentifier(methodDeclaration.Name);
+
+ PrintTemplates(methodDeclaration.Templates);
+
+ outputFormatter.PrintToken(Tokens.OpenParenthesis);
+ AppendCommaSeparatedList(methodDeclaration.Parameters);
+ outputFormatter.PrintToken(Tokens.CloseParenthesis);
+
+ if (!isSub) {
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.As);
+ outputFormatter.Space();
+ VisitReturnTypeAttributes(methodDeclaration.Attributes, data);
+ TrackedVisit(methodDeclaration.TypeReference, data);
+ }
+
+ PrintInterfaceImplementations(methodDeclaration.InterfaceImplementations);
+
+ if (methodDeclaration.HandlesClause.Count > 0) {
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Handles);
+ for (int i = 0; i < methodDeclaration.HandlesClause.Count; i++) {
+ if (i > 0)
+ outputFormatter.PrintToken(Tokens.Comma);
+ outputFormatter.Space();
+ outputFormatter.PrintText(methodDeclaration.HandlesClause[i]);
+ }
+ }
+
+ outputFormatter.NewLine();
+
+ if (!IsAbstract(methodDeclaration)) {
+ outputFormatter.IsInMemberBody = true;
+ BeginVisit(methodDeclaration.Body);
+ ++outputFormatter.IndentationLevel;
+ exitTokenStack.Push(isSub ? Tokens.Sub : Tokens.Function);
+ // we're doing the tracking manually using BeginVisit/EndVisit, so call Tracked... directly
+ this.TrackedVisitBlockStatement(methodDeclaration.Body, data);
+ exitTokenStack.Pop();
+ --outputFormatter.IndentationLevel;
+
+ outputFormatter.Indent();
+ outputFormatter.PrintToken(Tokens.End);
+ outputFormatter.Space();
+ if (isSub) {
+ outputFormatter.PrintToken(Tokens.Sub);
+ } else {
+ outputFormatter.PrintToken(Tokens.Function);
+ }
+ outputFormatter.NewLine();
+ EndVisit(methodDeclaration.Body);
+ outputFormatter.IsInMemberBody = false;
+ }
+ return null;
+ }
+
+ public override object TrackedVisitInterfaceImplementation(InterfaceImplementation interfaceImplementation, object data)
+ {
+ throw new InvalidOperationException();
+ }
+
+ bool IsAbstract(AttributedNode node)
+ {
+ if ((node.Modifier & Modifiers.Abstract) == Modifiers.Abstract)
+ return true;
+ return currentType != null && currentType.Type == ClassType.Interface;
+ }
+
+ public override object TrackedVisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data)
+ {
+ VisitAttributes(constructorDeclaration.Attributes, data);
+ outputFormatter.Indent();
+ OutputModifier(constructorDeclaration.Modifier);
+ outputFormatter.PrintToken(Tokens.Sub);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.New);
+ outputFormatter.PrintToken(Tokens.OpenParenthesis);
+ AppendCommaSeparatedList(constructorDeclaration.Parameters);
+ outputFormatter.PrintToken(Tokens.CloseParenthesis);
+ outputFormatter.NewLine();
+
+ outputFormatter.IsInMemberBody = true;
+ ++outputFormatter.IndentationLevel;
+ exitTokenStack.Push(Tokens.Sub);
+
+ TrackedVisit(constructorDeclaration.ConstructorInitializer, data);
+
+ TrackedVisit(constructorDeclaration.Body, data);
+ exitTokenStack.Pop();
+ --outputFormatter.IndentationLevel;
+ outputFormatter.IsInMemberBody = false;
+
+ outputFormatter.Indent();
+ outputFormatter.PrintToken(Tokens.End);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Sub);
+ outputFormatter.NewLine();
+
+ return null;
+ }
+
+ public override object TrackedVisitConstructorInitializer(ConstructorInitializer constructorInitializer, object data)
+ {
+ outputFormatter.Indent();
+ if (constructorInitializer.ConstructorInitializerType == ConstructorInitializerType.This) {
+ outputFormatter.PrintToken(Tokens.Me);
+ } else {
+ outputFormatter.PrintToken(Tokens.MyBase);
+ }
+ outputFormatter.PrintToken(Tokens.Dot);
+ outputFormatter.PrintToken(Tokens.New);
+ outputFormatter.PrintToken(Tokens.OpenParenthesis);
+ AppendCommaSeparatedList(constructorInitializer.Arguments);
+ outputFormatter.PrintToken(Tokens.CloseParenthesis);
+
+ outputFormatter.NewLine();
+ return null;
+ }
+
+ public override object TrackedVisitIndexerDeclaration(IndexerDeclaration indexerDeclaration, object data)
+ {
+ VisitAttributes(indexerDeclaration.Attributes, data);
+ outputFormatter.Indent();
+ OutputModifier(indexerDeclaration.Modifier);
+ outputFormatter.PrintToken(Tokens.Default);
+ outputFormatter.Space();
+ if (indexerDeclaration.IsReadOnly) {
+ outputFormatter.PrintToken(Tokens.ReadOnly);
+ outputFormatter.Space();
+ } else if (indexerDeclaration.IsWriteOnly) {
+ outputFormatter.PrintToken(Tokens.WriteOnly);
+ outputFormatter.Space();
+ }
+
+ outputFormatter.PrintToken(Tokens.Property);
+ outputFormatter.Space();
+ outputFormatter.PrintIdentifier("Item");
+
+ outputFormatter.PrintToken(Tokens.OpenParenthesis);
+ AppendCommaSeparatedList(indexerDeclaration.Parameters);
+ outputFormatter.PrintToken(Tokens.CloseParenthesis);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.As);
+ outputFormatter.Space();
+ VisitReturnTypeAttributes(indexerDeclaration.Attributes, data);
+ TrackedVisit(indexerDeclaration.TypeReference, data);
+ PrintInterfaceImplementations(indexerDeclaration.InterfaceImplementations);
+
+ outputFormatter.NewLine();
+ ++outputFormatter.IndentationLevel;
+ exitTokenStack.Push(Tokens.Property);
+ TrackedVisit(indexerDeclaration.GetRegion, data);
+ TrackedVisit(indexerDeclaration.SetRegion, data);
+ exitTokenStack.Pop();
+ --outputFormatter.IndentationLevel;
+
+ outputFormatter.Indent();
+ outputFormatter.PrintToken(Tokens.End);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Property);
+ outputFormatter.NewLine();
+ return null;
+ }
+
+ public override object TrackedVisitDestructorDeclaration(DestructorDeclaration destructorDeclaration, object data)
+ {
+ outputFormatter.Indent();
+ outputFormatter.PrintText("Protected Overrides Sub Finalize()");
+ outputFormatter.NewLine();
+
+ ++outputFormatter.IndentationLevel;
+ exitTokenStack.Push(Tokens.Sub);
+
+ outputFormatter.Indent();
+ outputFormatter.PrintToken(Tokens.Try);
+ outputFormatter.NewLine();
+
+ ++outputFormatter.IndentationLevel;
+ TrackedVisit(destructorDeclaration.Body, data);
+ --outputFormatter.IndentationLevel;
+
+ outputFormatter.Indent();
+ outputFormatter.PrintToken(Tokens.Finally);
+ outputFormatter.NewLine();
+
+ ++outputFormatter.IndentationLevel;
+ outputFormatter.Indent();
+ outputFormatter.PrintText("MyBase.Finalize()");
+ outputFormatter.NewLine();
+ --outputFormatter.IndentationLevel;
+
+ outputFormatter.Indent();
+ outputFormatter.PrintToken(Tokens.End);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Try);
+ outputFormatter.NewLine();
+
+ exitTokenStack.Pop();
+ --outputFormatter.IndentationLevel;
+
+ outputFormatter.Indent();
+ outputFormatter.PrintToken(Tokens.End);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Sub);
+ outputFormatter.NewLine();
+
+ return null;
+ }
+
+ public override object TrackedVisitOperatorDeclaration(OperatorDeclaration operatorDeclaration, object data)
+ {
+ VisitAttributes(operatorDeclaration.Attributes, data);
+ outputFormatter.Indent();
+ OutputModifier(operatorDeclaration.Modifier);
+
+ if (operatorDeclaration.IsConversionOperator) {
+ if (operatorDeclaration.ConversionType == ConversionType.Implicit) {
+ outputFormatter.PrintToken(Tokens.Widening);
+ } else {
+ outputFormatter.PrintToken(Tokens.Narrowing);
+ }
+ outputFormatter.Space();
+ }
+
+ outputFormatter.PrintToken(Tokens.Operator);
+ outputFormatter.Space();
+
+ int op = -1;
+
+ switch(operatorDeclaration.OverloadableOperator)
+ {
+ case OverloadableOperatorType.Add:
+ case OverloadableOperatorType.UnaryPlus:
+ op = Tokens.Plus;
+ break;
+ case OverloadableOperatorType.UnaryMinus:
+ case OverloadableOperatorType.Subtract:
+ op = Tokens.Minus;
+ break;
+ case OverloadableOperatorType.Multiply:
+ op = Tokens.Times;
+ break;
+ case OverloadableOperatorType.Divide:
+ op = Tokens.Div;
+ break;
+ case OverloadableOperatorType.Modulus:
+ op = Tokens.Mod;
+ break;
+ case OverloadableOperatorType.Concat:
+ op = Tokens.ConcatString;
+ break;
+ case OverloadableOperatorType.Not:
+ op = Tokens.Not;
+ break;
+ case OverloadableOperatorType.BitNot:
+ op = Tokens.Not;
+ break;
+ case OverloadableOperatorType.BitwiseAnd:
+ op = Tokens.And;
+ break;
+ case OverloadableOperatorType.BitwiseOr:
+ op = Tokens.Or;
+ break;
+ case OverloadableOperatorType.ExclusiveOr:
+ op = Tokens.Xor;
+ break;
+ case OverloadableOperatorType.ShiftLeft:
+ op = Tokens.ShiftLeft;
+ break;
+ case OverloadableOperatorType.ShiftRight:
+ op = Tokens.ShiftRight;
+ break;
+ case OverloadableOperatorType.GreaterThan:
+ op = Tokens.GreaterThan;
+ break;
+ case OverloadableOperatorType.GreaterThanOrEqual:
+ op = Tokens.GreaterEqual;
+ break;
+ case OverloadableOperatorType.Equality:
+ op = Tokens.Assign;
+ break;
+ case OverloadableOperatorType.InEquality:
+ op = Tokens.NotEqual;
+ break;
+ case OverloadableOperatorType.LessThan:
+ op = Tokens.LessThan;
+ break;
+ case OverloadableOperatorType.LessThanOrEqual:
+ op = Tokens.LessEqual;
+ break;
+ case OverloadableOperatorType.Increment:
+ Error("Increment operator is not supported in Visual Basic", operatorDeclaration.StartLocation);
+ break;
+ case OverloadableOperatorType.Decrement:
+ Error("Decrement operator is not supported in Visual Basic", operatorDeclaration.StartLocation);
+ break;
+ case OverloadableOperatorType.IsTrue:
+ outputFormatter.PrintText("IsTrue");
+ break;
+ case OverloadableOperatorType.IsFalse:
+ outputFormatter.PrintText("IsFalse");
+ break;
+ case OverloadableOperatorType.Like:
+ op = Tokens.Like;
+ break;
+ case OverloadableOperatorType.Power:
+ op = Tokens.Power;
+ break;
+ case OverloadableOperatorType.CType:
+ op = Tokens.CType;
+ break;
+ case OverloadableOperatorType.DivideInteger:
+ op = Tokens.DivInteger;
+ break;
+ }
+
+
+
+ if (operatorDeclaration.IsConversionOperator) {
+ outputFormatter.PrintToken(Tokens.CType);
+ } else {
+ if(op != -1) outputFormatter.PrintToken(op);
+ }
+
+ PrintTemplates(operatorDeclaration.Templates);
+ outputFormatter.PrintToken(Tokens.OpenParenthesis);
+ AppendCommaSeparatedList(operatorDeclaration.Parameters);
+ outputFormatter.PrintToken(Tokens.CloseParenthesis);
+ if (!operatorDeclaration.TypeReference.IsNull) {
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.As);
+ outputFormatter.Space();
+ VisitReturnTypeAttributes(operatorDeclaration.Attributes, data);
+ TrackedVisit(operatorDeclaration.TypeReference, data);
+ }
+
+ outputFormatter.NewLine();
+
+ ++outputFormatter.IndentationLevel;
+ TrackedVisit(operatorDeclaration.Body, data);
+ --outputFormatter.IndentationLevel;
+
+ outputFormatter.Indent();
+ outputFormatter.PrintToken(Tokens.End);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Operator);
+ outputFormatter.NewLine();
+
+ return null;
+ }
+
+ public override object TrackedVisitDeclareDeclaration(DeclareDeclaration declareDeclaration, object data)
+ {
+ VisitAttributes(declareDeclaration.Attributes, data);
+ outputFormatter.Indent();
+ OutputModifier(declareDeclaration.Modifier);
+ outputFormatter.PrintToken(Tokens.Declare);
+ outputFormatter.Space();
+
+ switch (declareDeclaration.Charset) {
+ case CharsetModifier.Auto:
+ outputFormatter.PrintToken(Tokens.Auto);
+ outputFormatter.Space();
+ break;
+ case CharsetModifier.Unicode:
+ outputFormatter.PrintToken(Tokens.Unicode);
+ outputFormatter.Space();
+ break;
+ case CharsetModifier.Ansi:
+ outputFormatter.PrintToken(Tokens.Ansi);
+ outputFormatter.Space();
+ break;
+ }
+
+ bool isVoid = declareDeclaration.TypeReference.IsNull || declareDeclaration.TypeReference.Type == "System.Void";
+ if (isVoid) {
+ outputFormatter.PrintToken(Tokens.Sub);
+ } else {
+ outputFormatter.PrintToken(Tokens.Function);
+ }
+ outputFormatter.Space();
+
+ outputFormatter.PrintIdentifier(declareDeclaration.Name);
+
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Lib);
+ outputFormatter.Space();
+ outputFormatter.PrintText(ConvertString(declareDeclaration.Library));
+ outputFormatter.Space();
+
+ if (declareDeclaration.Alias.Length > 0) {
+ outputFormatter.PrintToken(Tokens.Alias);
+ outputFormatter.Space();
+ outputFormatter.PrintText(ConvertString(declareDeclaration.Alias));
+ outputFormatter.Space();
+ }
+
+ outputFormatter.PrintToken(Tokens.OpenParenthesis);
+ AppendCommaSeparatedList(declareDeclaration.Parameters);
+ outputFormatter.PrintToken(Tokens.CloseParenthesis);
+
+ if (!isVoid) {
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.As);
+ outputFormatter.Space();
+ VisitReturnTypeAttributes(declareDeclaration.Attributes, data);
+ TrackedVisit(declareDeclaration.TypeReference, data);
+ }
+
+ outputFormatter.NewLine();
+
+ return null;
+ }
+ #endregion
+
+ #region Statements
+ public override object TrackedVisitBlockStatement(BlockStatement blockStatement, object data)
+ {
+ if (blockStatement.Parent is BlockStatement) {
+ outputFormatter.Indent();
+ outputFormatter.PrintText("If True Then");
+ outputFormatter.NewLine();
+ outputFormatter.IndentationLevel += 1;
+ }
+ VisitStatementList(blockStatement.Children);
+ if (blockStatement.Parent is BlockStatement) {
+ outputFormatter.IndentationLevel -= 1;
+ outputFormatter.Indent();
+ outputFormatter.PrintText("End If");
+ outputFormatter.NewLine();
+ }
+ return null;
+ }
+
+ void PrintIndentedBlock(Statement stmt)
+ {
+ outputFormatter.IndentationLevel += 1;
+ if (stmt is BlockStatement) {
+ TrackedVisit(stmt, null);
+ } else {
+ outputFormatter.Indent();
+ TrackedVisit(stmt, null);
+ outputFormatter.NewLine();
+ }
+ outputFormatter.IndentationLevel -= 1;
+ }
+
+ void PrintIndentedBlock(IEnumerable statements)
+ {
+ outputFormatter.IndentationLevel += 1;
+ VisitStatementList(statements);
+ outputFormatter.IndentationLevel -= 1;
+ }
+
+ void VisitStatementList(IEnumerable statements)
+ {
+ foreach (Statement stmt in statements) {
+ if (stmt is BlockStatement) {
+ TrackedVisit(stmt, null);
+ } else {
+ outputFormatter.Indent();
+ TrackedVisit(stmt, null);
+ outputFormatter.NewLine();
+ }
+ }
+ }
+
+ public override object TrackedVisitAddHandlerStatement(AddHandlerStatement addHandlerStatement, object data)
+ {
+ outputFormatter.PrintToken(Tokens.AddHandler);
+ outputFormatter.Space();
+ TrackedVisit(addHandlerStatement.EventExpression, data);
+ outputFormatter.PrintToken(Tokens.Comma);
+ outputFormatter.Space();
+ TrackedVisit(addHandlerStatement.HandlerExpression, data);
+ return null;
+ }
+
+ public override object TrackedVisitRemoveHandlerStatement(RemoveHandlerStatement removeHandlerStatement, object data)
+ {
+ outputFormatter.PrintToken(Tokens.RemoveHandler);
+ outputFormatter.Space();
+ TrackedVisit(removeHandlerStatement.EventExpression, data);
+ outputFormatter.PrintToken(Tokens.Comma);
+ outputFormatter.Space();
+ TrackedVisit(removeHandlerStatement.HandlerExpression, data);
+ return null;
+ }
+
+ public override object TrackedVisitRaiseEventStatement(RaiseEventStatement raiseEventStatement, object data)
+ {
+ outputFormatter.PrintToken(Tokens.RaiseEvent);
+ outputFormatter.Space();
+ outputFormatter.PrintIdentifier(raiseEventStatement.EventName);
+ outputFormatter.PrintToken(Tokens.OpenParenthesis);
+ AppendCommaSeparatedList(raiseEventStatement.Arguments);
+ outputFormatter.PrintToken(Tokens.CloseParenthesis);
+ return null;
+ }
+
+ public override object TrackedVisitEraseStatement(EraseStatement eraseStatement, object data)
+ {
+ outputFormatter.PrintToken(Tokens.Erase);
+ outputFormatter.Space();
+ AppendCommaSeparatedList(eraseStatement.Expressions);
+ return null;
+ }
+
+ public override object TrackedVisitErrorStatement(ErrorStatement errorStatement, object data)
+ {
+ outputFormatter.PrintToken(Tokens.Error);
+ outputFormatter.Space();
+ TrackedVisit(errorStatement.Expression, data);
+ return null;
+ }
+
+ public override object TrackedVisitOnErrorStatement(OnErrorStatement onErrorStatement, object data)
+ {
+ outputFormatter.PrintToken(Tokens.On);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Error);
+ outputFormatter.Space();
+ TrackedVisit(onErrorStatement.EmbeddedStatement, data);
+ return null;
+ }
+
+ public override object TrackedVisitReDimStatement(ReDimStatement reDimStatement, object data)
+ {
+ outputFormatter.PrintToken(Tokens.ReDim);
+ outputFormatter.Space();
+ if (reDimStatement.IsPreserve) {
+ outputFormatter.PrintToken(Tokens.Preserve);
+ outputFormatter.Space();
+ }
+
+ AppendCommaSeparatedList(reDimStatement.ReDimClauses);
+ return null;
+ }
+
+ public override object TrackedVisitExpressionStatement(ExpressionStatement expressionStatement, object data)
+ {
+ TrackedVisit(expressionStatement.Expression, data);
+ return null;
+ }
+
+ public override object TrackedVisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data)
+ {
+ if (localVariableDeclaration.Modifier != Modifiers.None) {
+ OutputModifier(localVariableDeclaration.Modifier);
+ }
+ if (!isUsingResourceAcquisition) {
+ if ((localVariableDeclaration.Modifier & Modifiers.Const) == 0) {
+ outputFormatter.PrintToken(Tokens.Dim);
+ }
+ outputFormatter.Space();
+ }
+ currentVariableType = localVariableDeclaration.TypeReference;
+
+ AppendCommaSeparatedList(localVariableDeclaration.Variables);
+ currentVariableType = null;
+
+ return null;
+ }
+
+ public override object TrackedVisitEmptyStatement(EmptyStatement emptyStatement, object data)
+ {
+ outputFormatter.NewLine();
+ return null;
+ }
+
+ public override object TrackedVisitYieldStatement(YieldStatement yieldStatement, object data)
+ {
+ UnsupportedNode(yieldStatement);
+ outputFormatter.PrintText("yield ");
+ TrackedVisit(yieldStatement.Statement, data);
+ return null;
+ }
+
+ public override object TrackedVisitReturnStatement(ReturnStatement returnStatement, object data)
+ {
+ outputFormatter.PrintToken(Tokens.Return);
+ if (!returnStatement.Expression.IsNull) {
+ outputFormatter.Space();
+ TrackedVisit(returnStatement.Expression, data);
+ }
+ return null;
+ }
+
+ public override object TrackedVisitIfElseStatement(IfElseStatement ifElseStatement, object data)
+ {
+ outputFormatter.PrintToken(Tokens.If);
+ outputFormatter.Space();
+ TrackedVisit(ifElseStatement.Condition, data);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Then);
+ outputFormatter.NewLine();
+
+ PrintIndentedBlock(ifElseStatement.TrueStatement);
+
+ foreach (ElseIfSection elseIfSection in ifElseStatement.ElseIfSections) {
+ TrackedVisit(elseIfSection, data);
+ }
+
+ if (ifElseStatement.HasElseStatements) {
+ outputFormatter.Indent();
+ outputFormatter.PrintToken(Tokens.Else);
+ outputFormatter.NewLine();
+ PrintIndentedBlock(ifElseStatement.FalseStatement);
+ }
+
+ outputFormatter.Indent();
+ outputFormatter.PrintToken(Tokens.End);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.If);
+ return null;
+ }
+
+ public override object TrackedVisitElseIfSection(ElseIfSection elseIfSection, object data)
+ {
+ outputFormatter.Indent();
+ outputFormatter.PrintToken(Tokens.ElseIf);
+ outputFormatter.Space();
+ TrackedVisit(elseIfSection.Condition, data);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Then);
+ outputFormatter.NewLine();
+ PrintIndentedBlock(elseIfSection.EmbeddedStatement);
+ return null;
+ }
+
+ public override object TrackedVisitForStatement(ForStatement forStatement, object data)
+ {
+ // Is converted to {initializer} while <Condition> {Embedded} {Iterators} end while
+ exitTokenStack.Push(Tokens.While);
+ bool isFirstLine = true;
+ foreach (INode node in forStatement.Initializers) {
+ if (!isFirstLine)
+ outputFormatter.Indent();
+ isFirstLine = false;
+ TrackedVisit(node, data);
+ outputFormatter.NewLine();
+ }
+ if (!isFirstLine)
+ outputFormatter.Indent();
+ outputFormatter.PrintToken(Tokens.While);
+ outputFormatter.Space();
+ if (forStatement.Condition.IsNull) {
+ outputFormatter.PrintToken(Tokens.True);
+ } else {
+ TrackedVisit(forStatement.Condition, data);
+ }
+ outputFormatter.NewLine();
+
+ PrintIndentedBlock(forStatement.EmbeddedStatement);
+ PrintIndentedBlock(forStatement.Iterator);
+
+ outputFormatter.Indent();
+ outputFormatter.PrintToken(Tokens.End);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.While);
+ exitTokenStack.Pop();
+ return null;
+ }
+
+ public override object TrackedVisitLabelStatement(LabelStatement labelStatement, object data)
+ {
+ outputFormatter.PrintIdentifier(labelStatement.Label);
+ outputFormatter.PrintToken(Tokens.Colon);
+ return null;
+ }
+
+ public override object TrackedVisitGotoStatement(GotoStatement gotoStatement, object data)
+ {
+ outputFormatter.PrintToken(Tokens.GoTo);
+ outputFormatter.Space();
+ outputFormatter.PrintIdentifier(gotoStatement.Label);
+ return null;
+ }
+
+ public override object TrackedVisitSwitchStatement(SwitchStatement switchStatement, object data)
+ {
+ exitTokenStack.Push(Tokens.Select);
+ outputFormatter.PrintToken(Tokens.Select);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Case);
+ outputFormatter.Space();
+ TrackedVisit(switchStatement.SwitchExpression, data);
+ outputFormatter.NewLine();
+ ++outputFormatter.IndentationLevel;
+ foreach (SwitchSection section in switchStatement.SwitchSections) {
+ TrackedVisit(section, data);
+ }
+ --outputFormatter.IndentationLevel;
+ outputFormatter.Indent();
+ outputFormatter.PrintToken(Tokens.End);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Select);
+ exitTokenStack.Pop();
+ return null;
+ }
+
+ public override object TrackedVisitSwitchSection(SwitchSection switchSection, object data)
+ {
+ outputFormatter.Indent();
+ outputFormatter.PrintToken(Tokens.Case);
+ outputFormatter.Space();
+ this.AppendCommaSeparatedList(switchSection.SwitchLabels);
+ outputFormatter.NewLine();
+
+ PrintIndentedBlock(switchSection.Children);
+
+ return null;
+ }
+
+ public override object TrackedVisitCaseLabel(CaseLabel caseLabel, object data)
+ {
+ if (caseLabel.IsDefault) {
+ outputFormatter.PrintToken(Tokens.Else);
+ } else {
+ if (caseLabel.BinaryOperatorType != BinaryOperatorType.None) {
+ switch (caseLabel.BinaryOperatorType) {
+ case BinaryOperatorType.Equality:
+ outputFormatter.PrintToken(Tokens.Assign);
+ break;
+ case BinaryOperatorType.InEquality:
+ outputFormatter.PrintToken(Tokens.LessThan);
+ outputFormatter.PrintToken(Tokens.GreaterThan);
+ break;
+
+ case BinaryOperatorType.GreaterThan:
+ outputFormatter.PrintToken(Tokens.GreaterThan);
+ break;
+ case BinaryOperatorType.GreaterThanOrEqual:
+ outputFormatter.PrintToken(Tokens.GreaterEqual);
+ break;
+ case BinaryOperatorType.LessThan:
+ outputFormatter.PrintToken(Tokens.LessThan);
+ break;
+ case BinaryOperatorType.LessThanOrEqual:
+ outputFormatter.PrintToken(Tokens.LessEqual);
+ break;
+ }
+ outputFormatter.Space();
+ }
+
+ TrackedVisit(caseLabel.Label, data);
+ if (!caseLabel.ToExpression.IsNull) {
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.To);
+ outputFormatter.Space();
+ TrackedVisit(caseLabel.ToExpression, data);
+ }
+ }
+
+ return null;
+ }
+
+ public override object TrackedVisitBreakStatement(BreakStatement breakStatement, object data)
+ {
+ outputFormatter.PrintToken(Tokens.Exit);
+ if (exitTokenStack.Count > 0) {
+ outputFormatter.Space();
+ outputFormatter.PrintToken(exitTokenStack.Peek());
+ }
+ return null;
+ }
+
+ public override object TrackedVisitStopStatement(StopStatement stopStatement, object data)
+ {
+ outputFormatter.PrintToken(Tokens.Stop);
+ return null;
+ }
+
+ public override object TrackedVisitResumeStatement(ResumeStatement resumeStatement, object data)
+ {
+ outputFormatter.PrintToken(Tokens.Resume);
+ outputFormatter.Space();
+ if (resumeStatement.IsResumeNext) {
+ outputFormatter.PrintToken(Tokens.Next);
+ } else {
+ outputFormatter.PrintIdentifier(resumeStatement.LabelName);
+ }
+ return null;
+ }
+
+ public override object TrackedVisitEndStatement(EndStatement endStatement, object data)
+ {
+ outputFormatter.PrintToken(Tokens.End);
+ return null;
+ }
+
+ public override object TrackedVisitContinueStatement(ContinueStatement continueStatement, object data)
+ {
+ outputFormatter.PrintToken(Tokens.Continue);
+ outputFormatter.Space();
+ switch (continueStatement.ContinueType) {
+ case ContinueType.Do:
+ outputFormatter.PrintToken(Tokens.Do);
+ break;
+ case ContinueType.For:
+ outputFormatter.PrintToken(Tokens.For);
+ break;
+ case ContinueType.While:
+ outputFormatter.PrintToken(Tokens.While);
+ break;
+ default:
+ outputFormatter.PrintToken(exitTokenStack.Peek());
+ break;
+ }
+ return null;
+ }
+
+ public override object TrackedVisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, object data)
+ {
+ outputFormatter.PrintText("goto case ");
+ if (gotoCaseStatement.IsDefaultCase) {
+ outputFormatter.PrintText("default");
+ } else {
+ TrackedVisit(gotoCaseStatement.Expression, null);
+ }
+ return null;
+ }
+
+ public override object TrackedVisitDoLoopStatement(DoLoopStatement doLoopStatement, object data)
+ {
+ if (doLoopStatement.ConditionPosition == ConditionPosition.None) {
+ Error(String.Format("Unknown condition position for loop : {0}.", doLoopStatement), doLoopStatement.StartLocation);
+ }
+
+ if (doLoopStatement.ConditionPosition == ConditionPosition.Start) {
+ switch (doLoopStatement.ConditionType) {
+ case ConditionType.DoWhile:
+ exitTokenStack.Push(Tokens.Do);
+ outputFormatter.PrintToken(Tokens.Do);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.While);
+ break;
+ case ConditionType.While:
+ exitTokenStack.Push(Tokens.While);
+ outputFormatter.PrintToken(Tokens.While);
+ break;
+ case ConditionType.Until:
+ exitTokenStack.Push(Tokens.Do);
+ outputFormatter.PrintToken(Tokens.Do);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.While);
+ break;
+ default:
+ throw new InvalidOperationException();
+ }
+ outputFormatter.Space();
+ TrackedVisit(doLoopStatement.Condition, null);
+ } else {
+ exitTokenStack.Push(Tokens.Do);
+ outputFormatter.PrintToken(Tokens.Do);
+ }
+
+ outputFormatter.NewLine();
+
+ PrintIndentedBlock(doLoopStatement.EmbeddedStatement);
+
+ outputFormatter.Indent();
+ if (doLoopStatement.ConditionPosition == ConditionPosition.Start && doLoopStatement.ConditionType == ConditionType.While) {
+ outputFormatter.PrintToken(Tokens.End);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.While);
+ } else {
+ outputFormatter.PrintToken(Tokens.Loop);
+ }
+
+ if (doLoopStatement.ConditionPosition == ConditionPosition.End && !doLoopStatement.Condition.IsNull) {
+ outputFormatter.Space();
+ switch (doLoopStatement.ConditionType) {
+ case ConditionType.While:
+ case ConditionType.DoWhile:
+ outputFormatter.PrintToken(Tokens.While);
+ break;
+ case ConditionType.Until:
+ outputFormatter.PrintToken(Tokens.Until);
+ break;
+ }
+ outputFormatter.Space();
+ TrackedVisit(doLoopStatement.Condition, null);
+ }
+ exitTokenStack.Pop();
+ return null;
+ }
+
+ public override object TrackedVisitForeachStatement(ForeachStatement foreachStatement, object data)
+ {
+ exitTokenStack.Push(Tokens.For);
+ outputFormatter.PrintToken(Tokens.For);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Each);
+ outputFormatter.Space();
+
+ // loop control variable
+ outputFormatter.PrintIdentifier(foreachStatement.VariableName);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.As);
+ outputFormatter.Space();
+ TrackedVisit(foreachStatement.TypeReference, data);
+
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.In);
+ outputFormatter.Space();
+
+ TrackedVisit(foreachStatement.Expression, data);
+ outputFormatter.NewLine();
+
+ PrintIndentedBlock(foreachStatement.EmbeddedStatement);
+
+ outputFormatter.Indent();
+ outputFormatter.PrintToken(Tokens.Next);
+ if (!foreachStatement.NextExpression.IsNull) {
+ outputFormatter.Space();
+ TrackedVisit(foreachStatement.NextExpression, data);
+ }
+ exitTokenStack.Pop();
+ return null;
+ }
+
+ public override object TrackedVisitLockStatement(LockStatement lockStatement, object data)
+ {
+ outputFormatter.PrintToken(Tokens.SyncLock);
+ outputFormatter.Space();
+ TrackedVisit(lockStatement.LockExpression, data);
+ outputFormatter.NewLine();
+
+ PrintIndentedBlock(lockStatement.EmbeddedStatement);
+
+ outputFormatter.Indent();
+ outputFormatter.PrintToken(Tokens.End);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.SyncLock);
+ return null;
+ }
+
+ bool isUsingResourceAcquisition;
+
+ public override object TrackedVisitUsingStatement(UsingStatement usingStatement, object data)
+ {
+ outputFormatter.PrintToken(Tokens.Using);
+ outputFormatter.Space();
+
+ isUsingResourceAcquisition = true;
+ TrackedVisit(usingStatement.ResourceAcquisition, data);
+ isUsingResourceAcquisition = false;
+ outputFormatter.NewLine();
+
+ PrintIndentedBlock(usingStatement.EmbeddedStatement);
+
+ outputFormatter.Indent();
+ outputFormatter.PrintToken(Tokens.End);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Using);
+
+ return null;
+ }
+
+ public override object TrackedVisitWithStatement(WithStatement withStatement, object data)
+ {
+ outputFormatter.PrintToken(Tokens.With);
+ outputFormatter.Space();
+ TrackedVisit(withStatement.Expression, data);
+ outputFormatter.NewLine();
+
+ PrintIndentedBlock(withStatement.Body);
+
+ outputFormatter.PrintToken(Tokens.End);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.With);
+ return null;
+ }
+
+ public override object TrackedVisitTryCatchStatement(TryCatchStatement tryCatchStatement, object data)
+ {
+ exitTokenStack.Push(Tokens.Try);
+ outputFormatter.PrintToken(Tokens.Try);
+ outputFormatter.NewLine();
+
+ PrintIndentedBlock(tryCatchStatement.StatementBlock);
+
+ foreach (CatchClause catchClause in tryCatchStatement.CatchClauses) {
+ TrackedVisit(catchClause, data);
+ }
+
+ if (!tryCatchStatement.FinallyBlock.IsNull) {
+ outputFormatter.Indent();
+ outputFormatter.PrintToken(Tokens.Finally);
+ outputFormatter.NewLine();
+ PrintIndentedBlock(tryCatchStatement.FinallyBlock);
+ }
+ outputFormatter.Indent();
+ outputFormatter.PrintToken(Tokens.End);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Try);
+ exitTokenStack.Pop();
+ return null;
+ }
+
+ public override object TrackedVisitCatchClause(CatchClause catchClause, object data)
+ {
+ outputFormatter.Indent();
+ outputFormatter.PrintToken(Tokens.Catch);
+
+ if (!catchClause.TypeReference.IsNull) {
+ outputFormatter.Space();
+ if (catchClause.VariableName.Length > 0) {
+ outputFormatter.PrintIdentifier(catchClause.VariableName);
+ } else {
+ outputFormatter.PrintIdentifier("generatedExceptionName");
+ }
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.As);
+ outputFormatter.Space();
+ outputFormatter.PrintIdentifier(catchClause.TypeReference.Type);
+ }
+
+ if (!catchClause.Condition.IsNull) {
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.When);
+ outputFormatter.Space();
+ TrackedVisit(catchClause.Condition, data);
+ }
+ outputFormatter.NewLine();
+
+ PrintIndentedBlock(catchClause.StatementBlock);
+
+ return null;
+ }
+
+ public override object TrackedVisitThrowStatement(ThrowStatement throwStatement, object data)
+ {
+ outputFormatter.PrintToken(Tokens.Throw);
+ if (!throwStatement.Expression.IsNull) {
+ outputFormatter.Space();
+ TrackedVisit(throwStatement.Expression, data);
+ }
+ return null;
+ }
+
+ public override object TrackedVisitFixedStatement(FixedStatement fixedStatement, object data)
+ {
+ UnsupportedNode(fixedStatement);
+ return TrackedVisit(fixedStatement.EmbeddedStatement, data);
+ }
+
+ public override object TrackedVisitUnsafeStatement(UnsafeStatement unsafeStatement, object data)
+ {
+ UnsupportedNode(unsafeStatement);
+ return TrackedVisit(unsafeStatement.Block, data);
+ }
+
+ public override object TrackedVisitCheckedStatement(CheckedStatement checkedStatement, object data)
+ {
+ UnsupportedNode(checkedStatement);
+ return TrackedVisit(checkedStatement.Block, data);
+ }
+
+ public override object TrackedVisitUncheckedStatement(UncheckedStatement uncheckedStatement, object data)
+ {
+ UnsupportedNode(uncheckedStatement);
+ return TrackedVisit(uncheckedStatement.Block, data);
+ }
+
+ public override object TrackedVisitExitStatement(ExitStatement exitStatement, object data)
+ {
+ outputFormatter.PrintToken(Tokens.Exit);
+ if (exitStatement.ExitType != ExitType.None) {
+ outputFormatter.Space();
+ switch (exitStatement.ExitType) {
+ case ExitType.Sub:
+ outputFormatter.PrintToken(Tokens.Sub);
+ break;
+ case ExitType.Function:
+ outputFormatter.PrintToken(Tokens.Function);
+ break;
+ case ExitType.Property:
+ outputFormatter.PrintToken(Tokens.Property);
+ break;
+ case ExitType.Do:
+ outputFormatter.PrintToken(Tokens.Do);
+ break;
+ case ExitType.For:
+ outputFormatter.PrintToken(Tokens.For);
+ break;
+ case ExitType.Try:
+ outputFormatter.PrintToken(Tokens.Try);
+ break;
+ case ExitType.While:
+ outputFormatter.PrintToken(Tokens.While);
+ break;
+ case ExitType.Select:
+ outputFormatter.PrintToken(Tokens.Select);
+ break;
+ default:
+ Error(String.Format("Unsupported exit type : {0}", exitStatement.ExitType), exitStatement.StartLocation);
+ break;
+ }
+ }
+
+ return null;
+ }
+
+ public override object TrackedVisitForNextStatement(ForNextStatement forNextStatement, object data)
+ {
+ exitTokenStack.Push(Tokens.For);
+ outputFormatter.PrintToken(Tokens.For);
+ outputFormatter.Space();
+
+ if (!forNextStatement.LoopVariableExpression.IsNull) {
+ TrackedVisit(forNextStatement.LoopVariableExpression, data);
+ } else {
+ outputFormatter.PrintIdentifier(forNextStatement.VariableName);
+
+ if (!forNextStatement.TypeReference.IsNull) {
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.As);
+ outputFormatter.Space();
+ TrackedVisit(forNextStatement.TypeReference, data);
+ }
+ }
+
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Assign);
+ outputFormatter.Space();
+
+ TrackedVisit(forNextStatement.Start, data);
+
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.To);
+ outputFormatter.Space();
+
+ TrackedVisit(forNextStatement.End, data);
+
+ if (!forNextStatement.Step.IsNull) {
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Step);
+ outputFormatter.Space();
+ TrackedVisit(forNextStatement.Step, data);
+ }
+ outputFormatter.NewLine();
+
+ PrintIndentedBlock(forNextStatement.EmbeddedStatement);
+
+ outputFormatter.Indent();
+ outputFormatter.PrintToken(Tokens.Next);
+
+ if (forNextStatement.NextExpressions.Count > 0) {
+ outputFormatter.Space();
+ AppendCommaSeparatedList(forNextStatement.NextExpressions);
+ }
+ exitTokenStack.Pop();
+ return null;
+ }
+ #endregion
+
+ #region Expressions
+
+ public override object TrackedVisitClassReferenceExpression(ClassReferenceExpression classReferenceExpression, object data)
+ {
+ outputFormatter.PrintToken(Tokens.MyClass);
+ return null;
+ }
+
+
+ static string ConvertCharLiteral(char ch)
+ {
+ if (Char.IsControl(ch)) {
+ string charName = GetCharName(ch);
+ if (charName != null)
+ return "ControlChars." + charName;
+ else
+ return "ChrW(" + ((int)ch).ToString() + ")";
+ } else if (ch == '"') {
+ return "\"\"\"\"C";
+ } else {
+ return "\"" + ch.ToString() + "\"C";
+ }
+ }
+
+ static string GetCharName(char ch)
+ {
+ switch (ch) {
+ case '\b':
+ return "Back";
+ case '\r':
+ return "Cr";
+ case '\f':
+ return "FormFeed";
+ case '\n':
+ return "Lf";
+ case '\0':
+ return "NullChar";
+ case '\t':
+ return "Tab";
+ case '\v':
+ return "VerticalTab";
+ default:
+ return null;
+ }
+ }
+
+ static string ConvertString(string str)
+ {
+ StringBuilder sb = new StringBuilder();
+ bool inString = false;
+ foreach (char ch in str) {
+ if (char.IsControl(ch)) {
+ if (inString) {
+ sb.Append('"');
+ inString = false;
+ }
+ if (sb.Length > 0)
+ sb.Append(" & ");
+ string charName = GetCharName(ch);
+ if (charName != null)
+ sb.Append("vb" + charName);
+ else
+ sb.Append("ChrW(" + ((int)ch) + ")");
+ } else {
+ if (!inString) {
+ if (sb.Length > 0)
+ sb.Append(" & ");
+ sb.Append('"');
+ inString = true;
+ }
+ if (ch == '"') {
+ sb.Append("\"\"");
+ } else {
+ sb.Append(ch);
+ }
+ }
+ }
+ if (inString)
+ sb.Append('"');
+ if (sb.Length == 0)
+ return "\"\"";
+ return sb.ToString();
+ }
+
+ public override object TrackedVisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data)
+ {
+ outputFormatter.PrintText(ToVBNetString(primitiveExpression));
+ return null;
+ }
+
+ internal static string ToVBNetString(PrimitiveExpression primitiveExpression)
+ {
+ object val = primitiveExpression.Value;
+ if (val == null) {
+ return "Nothing";
+ }
+ if (val is bool) {
+ if ((bool)primitiveExpression.Value) {
+ return "True";
+ } else {
+ return "False";
+ }
+ }
+
+ if (val is string) {
+ return ConvertString((string)val);
+ }
+
+ if (val is char) {
+ return ConvertCharLiteral((char)primitiveExpression.Value);
+ }
+
+ if (val is decimal) {
+ return ((decimal)primitiveExpression.Value).ToString(NumberFormatInfo.InvariantInfo) + "D";
+ }
+
+ if (val is float) {
+ return ((float)primitiveExpression.Value).ToString(NumberFormatInfo.InvariantInfo) + "F";
+ }
+
+ if (val is double) {
+ string text = ((double)val).ToString(NumberFormatInfo.InvariantInfo);
+ if (text.IndexOf('.') < 0 && text.IndexOf('E') < 0)
+ return text + ".0";
+ else
+ return text;
+ }
+
+ if (val is IFormattable) {
+ StringBuilder b = new StringBuilder();
+ if (primitiveExpression.LiteralFormat == LiteralFormat.HexadecimalNumber) {
+ b.Append("&H");
+ b.Append(((IFormattable)val).ToString("x", NumberFormatInfo.InvariantInfo));
+ } else {
+ b.Append(((IFormattable)val).ToString(null, NumberFormatInfo.InvariantInfo));
+ }
+ if (val is ushort || val is uint || val is ulong) {
+ b.Append('U');
+ if (val is uint)
+ b.Append('I');
+ }
+ if (val is long || val is ulong)
+ b.Append('L');
+ if (val is short || val is ushort)
+ b.Append('S');
+ return b.ToString();
+ } else {
+ return val.ToString();
+ }
+ }
+
+ public override object TrackedVisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data)
+ {
+ int op = 0;
+ switch (binaryOperatorExpression.Op) {
+ case BinaryOperatorType.Concat:
+ op = Tokens.ConcatString;
+ break;
+
+ case BinaryOperatorType.Add:
+ op = Tokens.Plus;
+ break;
+
+ case BinaryOperatorType.Subtract:
+ op = Tokens.Minus;
+ break;
+
+ case BinaryOperatorType.Multiply:
+ op = Tokens.Times;
+ break;
+
+ case BinaryOperatorType.Divide:
+ op = Tokens.Div;
+ break;
+
+ case BinaryOperatorType.DivideInteger:
+ op = Tokens.DivInteger;
+ break;
+
+ case BinaryOperatorType.Modulus:
+ op = Tokens.Mod;
+ break;
+
+ case BinaryOperatorType.ShiftLeft:
+ op = Tokens.ShiftLeft;
+ break;
+
+ case BinaryOperatorType.ShiftRight:
+ op = Tokens.ShiftRight;
+ break;
+
+ case BinaryOperatorType.BitwiseAnd:
+ op = Tokens.And;
+ break;
+ case BinaryOperatorType.BitwiseOr:
+ op = Tokens.Or;
+ break;
+ case BinaryOperatorType.ExclusiveOr:
+ op = Tokens.Xor;
+ break;
+
+ case BinaryOperatorType.LogicalAnd:
+ op = Tokens.AndAlso;
+ break;
+ case BinaryOperatorType.LogicalOr:
+ op = Tokens.OrElse;
+ break;
+ case BinaryOperatorType.ReferenceEquality:
+ op = Tokens.Is;
+ break;
+ case BinaryOperatorType.ReferenceInequality:
+ op = Tokens.IsNot;
+ break;
+
+ case BinaryOperatorType.Equality:
+ op = Tokens.Assign;
+ break;
+ case BinaryOperatorType.GreaterThan:
+ op = Tokens.GreaterThan;
+ break;
+ case BinaryOperatorType.GreaterThanOrEqual:
+ op = Tokens.GreaterEqual;
+ break;
+ case BinaryOperatorType.InEquality:
+ op = Tokens.NotEqual;
+ break;
+ case BinaryOperatorType.NullCoalescing:
+ outputFormatter.PrintText("If(");
+ TrackedVisit(binaryOperatorExpression.Left, data);
+ outputFormatter.PrintToken(Tokens.Comma);
+ outputFormatter.Space();
+ TrackedVisit(binaryOperatorExpression.Right, data);
+ outputFormatter.PrintToken(Tokens.CloseParenthesis);
+ return null;
+ case BinaryOperatorType.DictionaryAccess:
+ {
+ PrimitiveExpression pright = binaryOperatorExpression.Right as PrimitiveExpression;
+ TrackedVisit(binaryOperatorExpression.Left, data);
+ if (pright != null && pright.Value is string) {
+ outputFormatter.PrintText("!" + (string)pright.Value);
+ } else {
+ outputFormatter.PrintToken(Tokens.OpenParenthesis);
+ TrackedVisit(binaryOperatorExpression.Right, data);
+ outputFormatter.PrintToken(Tokens.CloseParenthesis);
+ }
+ return null;
+ }
+ case BinaryOperatorType.LessThan:
+ op = Tokens.LessThan;
+ break;
+ case BinaryOperatorType.LessThanOrEqual:
+ op = Tokens.LessEqual;
+ break;
+ }
+
+
+ BinaryOperatorExpression childBoe = binaryOperatorExpression.Left as BinaryOperatorExpression;
+ bool requireParenthesis = childBoe != null && OperatorPrecedence.ComparePrecedenceVB(binaryOperatorExpression.Op, childBoe.Op) > 0;
+ if (requireParenthesis)
+ outputFormatter.PrintToken(Tokens.OpenParenthesis);
+ TrackedVisit(binaryOperatorExpression.Left, data);
+ if (requireParenthesis)
+ outputFormatter.PrintToken(Tokens.CloseParenthesis);
+
+ outputFormatter.Space();
+ outputFormatter.PrintToken(op);
+ outputFormatter.Space();
+
+ childBoe = binaryOperatorExpression.Right as BinaryOperatorExpression;
+ requireParenthesis = childBoe != null && OperatorPrecedence.ComparePrecedenceVB(binaryOperatorExpression.Op, childBoe.Op) >= 0;
+ if (requireParenthesis)
+ outputFormatter.PrintToken(Tokens.OpenParenthesis);
+ TrackedVisit(binaryOperatorExpression.Right, data);
+ if (requireParenthesis)
+ outputFormatter.PrintToken(Tokens.CloseParenthesis);
+
+ return null;
+ }
+
+ public override object TrackedVisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression, object data)
+ {
+ outputFormatter.PrintToken(Tokens.OpenParenthesis);
+ TrackedVisit(parenthesizedExpression.Expression, data);
+ outputFormatter.PrintToken(Tokens.CloseParenthesis);
+ return null;
+ }
+
+ public override object TrackedVisitInvocationExpression(InvocationExpression invocationExpression, object data)
+ {
+ TrackedVisit(invocationExpression.TargetObject, data);
+ outputFormatter.PrintToken(Tokens.OpenParenthesis);
+ AppendCommaSeparatedList(invocationExpression.Arguments);
+ outputFormatter.PrintToken(Tokens.CloseParenthesis);
+ return null;
+ }
+
+ void PrintTypeArguments(List<TypeReference> typeArguments)
+ {
+ if (typeArguments != null && typeArguments.Count > 0) {
+ outputFormatter.PrintToken(Tokens.OpenParenthesis);
+ outputFormatter.PrintToken(Tokens.Of);
+ outputFormatter.Space();
+ AppendCommaSeparatedList(typeArguments);
+ outputFormatter.PrintToken(Tokens.CloseParenthesis);
+ }
+ }
+
+ public override object TrackedVisitIdentifierExpression(IdentifierExpression identifierExpression, object data)
+ {
+ outputFormatter.PrintIdentifier(identifierExpression.Identifier);
+ PrintTypeArguments(identifierExpression.TypeArguments);
+ return null;
+ }
+
+ public override object TrackedVisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, object data)
+ {
+ TrackedVisit(typeReferenceExpression.TypeReference, data);
+ return null;
+ }
+
+ public override object TrackedVisitUnaryOperatorExpression(UnaryOperatorExpression unaryOperatorExpression, object data)
+ {
+ switch (unaryOperatorExpression.Op) {
+ case UnaryOperatorType.Not:
+ case UnaryOperatorType.BitNot:
+ outputFormatter.PrintToken(Tokens.Not);
+ outputFormatter.Space();
+ TrackedVisit(unaryOperatorExpression.Expression, data);
+ return null;
+
+ case UnaryOperatorType.Decrement:
+ outputFormatter.PrintText("System.Threading.Interlocked.Decrement(");
+ TrackedVisit(unaryOperatorExpression.Expression, data);
+ outputFormatter.PrintText(")");
+ return null;
+
+ case UnaryOperatorType.Increment:
+ outputFormatter.PrintText("System.Threading.Interlocked.Increment(");
+ TrackedVisit(unaryOperatorExpression.Expression, data);
+ outputFormatter.PrintText(")");
+ return null;
+
+ case UnaryOperatorType.Minus:
+ outputFormatter.PrintToken(Tokens.Minus);
+ TrackedVisit(unaryOperatorExpression.Expression, data);
+ return null;
+
+ case UnaryOperatorType.Plus:
+ outputFormatter.PrintToken(Tokens.Plus);
+ TrackedVisit(unaryOperatorExpression.Expression, data);
+ return null;
+
+ case UnaryOperatorType.PostDecrement:
+ outputFormatter.PrintText("System.Math.Max(System.Threading.Interlocked.Decrement(");
+ TrackedVisit(unaryOperatorExpression.Expression, data);
+ outputFormatter.PrintText("),");
+ TrackedVisit(unaryOperatorExpression.Expression, data);
+ outputFormatter.PrintText(" + 1)");
+ return null;
+
+ case UnaryOperatorType.PostIncrement:
+ outputFormatter.PrintText("System.Math.Max(System.Threading.Interlocked.Increment(");
+ TrackedVisit(unaryOperatorExpression.Expression, data);
+ outputFormatter.PrintText("),");
+ TrackedVisit(unaryOperatorExpression.Expression, data);
+ outputFormatter.PrintText(" - 1)");
+ return null;
+
+ case UnaryOperatorType.Dereference:
+ outputFormatter.PrintToken(Tokens.Times);
+ TrackedVisit(unaryOperatorExpression.Expression, data);
+ return null;
+ case UnaryOperatorType.AddressOf:
+ outputFormatter.PrintToken(Tokens.AddressOf);
+ TrackedVisit(unaryOperatorExpression.Expression, data);
+ return null;
+ default:
+ Error("unknown unary operator: " + unaryOperatorExpression.Op.ToString(), unaryOperatorExpression.StartLocation);
+ outputFormatter.PrintText(unaryOperatorExpression.Op.ToString());
+ outputFormatter.PrintText("(");
+ TrackedVisit(unaryOperatorExpression.Expression, data);
+ outputFormatter.PrintText(")");
+ return null;
+ }
+ }
+
+ public override object TrackedVisitAssignmentExpression(AssignmentExpression assignmentExpression, object data)
+ {
+ int op = 0;
+ bool unsupportedOpAssignment = false;
+ switch (assignmentExpression.Op) {
+ case AssignmentOperatorType.Assign:
+ op = Tokens.Assign;
+ break;
+ case AssignmentOperatorType.Add:
+ op = Tokens.PlusAssign;
+ break;
+ case AssignmentOperatorType.Subtract:
+ op = Tokens.MinusAssign;
+ break;
+ case AssignmentOperatorType.Multiply:
+ op = Tokens.TimesAssign;
+ break;
+ case AssignmentOperatorType.Divide:
+ op = Tokens.DivAssign;
+ break;
+ case AssignmentOperatorType.ShiftLeft:
+ op = Tokens.ShiftLeftAssign;
+ break;
+ case AssignmentOperatorType.ShiftRight:
+ op = Tokens.ShiftRightAssign;
+ break;
+
+ case AssignmentOperatorType.ExclusiveOr:
+ op = Tokens.Xor;
+ unsupportedOpAssignment = true;
+ break;
+ case AssignmentOperatorType.Modulus:
+ op = Tokens.Mod;
+ unsupportedOpAssignment = true;
+ break;
+ case AssignmentOperatorType.BitwiseAnd:
+ op = Tokens.And;
+ unsupportedOpAssignment = true;
+ break;
+ case AssignmentOperatorType.BitwiseOr:
+ op = Tokens.Or;
+ unsupportedOpAssignment = true;
+ break;
+ }
+
+ TrackedVisit(assignmentExpression.Left, data);
+ outputFormatter.Space();
+
+ if (unsupportedOpAssignment) { // left = left OP right
+ outputFormatter.PrintToken(Tokens.Assign);
+ outputFormatter.Space();
+ TrackedVisit(assignmentExpression.Left, data);
+ outputFormatter.Space();
+ }
+
+ outputFormatter.PrintToken(op);
+ outputFormatter.Space();
+ TrackedVisit(assignmentExpression.Right, data);
+
+ return null;
+ }
+
+ public override object TrackedVisitSizeOfExpression(SizeOfExpression sizeOfExpression, object data)
+ {
+ if (!sizeOfExpression.TypeReference.IsArrayType && sizeOfExpression.TypeReference.PointerNestingLevel == 0) {
+ switch (sizeOfExpression.TypeReference.Type) {
+ case "System.Byte":
+ case "System.SByte":
+ outputFormatter.PrintText("1");
+ return null;
+ case "System.Char":
+ case "System.Int16":
+ case "System.UInt16":
+ outputFormatter.PrintText("2");
+ return null;
+ case "System.Single":
+ case "System.Int32":
+ case "System.UInt32":
+ outputFormatter.PrintText("4");
+ return null;
+ case "System.Double":
+ case "System.Int64":
+ case "System.UInt64":
+ outputFormatter.PrintText("8");
+ return null;
+ }
+ }
+ UnsupportedNode(sizeOfExpression);
+ outputFormatter.PrintText("sizeof(");
+ TrackedVisit(sizeOfExpression.TypeReference, data);
+ outputFormatter.PrintText(")");
+ return null;
+ }
+
+ public override object TrackedVisitTypeOfExpression(TypeOfExpression typeOfExpression, object data)
+ {
+ outputFormatter.PrintToken(Tokens.GetType);
+ outputFormatter.PrintToken(Tokens.OpenParenthesis);
+ TrackedVisit(typeOfExpression.TypeReference, data);
+ outputFormatter.PrintToken(Tokens.CloseParenthesis);
+ return null;
+ }
+
+ public override object TrackedVisitDefaultValueExpression(DefaultValueExpression defaultValueExpression, object data)
+ {
+ // assigning nothing to a generic type in VB compiles to a DefaultValueExpression
+ outputFormatter.PrintToken(Tokens.Nothing);
+ return null;
+ }
+
+ public override object TrackedVisitTypeOfIsExpression(TypeOfIsExpression typeOfIsExpression, object data)
+ {
+ outputFormatter.PrintToken(Tokens.TypeOf);
+ outputFormatter.Space();
+ TrackedVisit(typeOfIsExpression.Expression, data);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Is);
+ outputFormatter.Space();
+ TrackedVisit(typeOfIsExpression.TypeReference, data);
+ return null;
+ }
+
+ public override object TrackedVisitAddressOfExpression(AddressOfExpression addressOfExpression, object data)
+ {
+ outputFormatter.PrintToken(Tokens.AddressOf);
+ outputFormatter.Space();
+ TrackedVisit(addressOfExpression.Expression, data);
+ return null;
+ }
+
+ public override object TrackedVisitAnonymousMethodExpression(AnonymousMethodExpression anonymousMethodExpression, object data)
+ {
+ OutputAnonymousMethodWithStatementBody(anonymousMethodExpression.Parameters, anonymousMethodExpression.Body);
+ return null;
+ }
+
+ public override object TrackedVisitCheckedExpression(CheckedExpression checkedExpression, object data)
+ {
+ UnsupportedNode(checkedExpression);
+ return TrackedVisit(checkedExpression.Expression, data);
+ }
+
+ public override object TrackedVisitUncheckedExpression(UncheckedExpression uncheckedExpression, object data)
+ {
+ UnsupportedNode(uncheckedExpression);
+ return TrackedVisit(uncheckedExpression.Expression, data);
+ }
+
+ public override object TrackedVisitPointerReferenceExpression(PointerReferenceExpression pointerReferenceExpression, object data)
+ {
+ UnsupportedNode(pointerReferenceExpression);
+ TrackedVisit(pointerReferenceExpression.TargetObject, data);
+ outputFormatter.PrintText(".");
+ outputFormatter.PrintIdentifier(pointerReferenceExpression.MemberName);
+ PrintTypeArguments(pointerReferenceExpression.TypeArguments);
+ return null;
+ }
+
+ public override object TrackedVisitCastExpression(CastExpression castExpression, object data)
+ {
+ if (castExpression.CastType == CastType.TryCast) {
+ return PrintCast(Tokens.TryCast, castExpression);
+ }
+ if (castExpression.CastType == CastType.Cast || castExpression.CastTo.IsArrayType) {
+ return PrintCast(Tokens.DirectCast, castExpression);
+ }
+ switch (castExpression.CastTo.Type) {
+ case "System.Boolean":
+ outputFormatter.PrintToken(Tokens.CBool);
+ break;
+ case "System.Byte":
+ outputFormatter.PrintToken(Tokens.CByte);
+ break;
+ case "System.SByte":
+ outputFormatter.PrintToken(Tokens.CSByte);
+ break;
+ case "System.Char":
+ outputFormatter.PrintToken(Tokens.CChar);
+ break;
+ case "System.DateTime":
+ outputFormatter.PrintToken(Tokens.CDate);
+ break;
+ case "System.Decimal":
+ outputFormatter.PrintToken(Tokens.CDec);
+ break;
+ case "System.Double":
+ outputFormatter.PrintToken(Tokens.CDbl);
+ break;
+ case "System.Int16":
+ outputFormatter.PrintToken(Tokens.CShort);
+ break;
+ case "System.Int32":
+ outputFormatter.PrintToken(Tokens.CInt);
+ break;
+ case "System.Int64":
+ outputFormatter.PrintToken(Tokens.CLng);
+ break;
+ case "System.UInt16":
+ outputFormatter.PrintToken(Tokens.CUShort);
+ break;
+ case "System.UInt32":
+ outputFormatter.PrintToken(Tokens.CUInt);
+ break;
+ case "System.UInt64":
+ outputFormatter.PrintToken(Tokens.CULng);
+ break;
+ case "System.Object":
+ outputFormatter.PrintToken(Tokens.CObj);
+ break;
+ case "System.Single":
+ outputFormatter.PrintToken(Tokens.CSng);
+ break;
+ case "System.String":
+ outputFormatter.PrintToken(Tokens.CStr);
+ break;
+ default:
+ return PrintCast(Tokens.CType, castExpression);
+ }
+ outputFormatter.PrintToken(Tokens.OpenParenthesis);
+ TrackedVisit(castExpression.Expression, data);
+ outputFormatter.PrintToken(Tokens.CloseParenthesis);
+ return null;
+ }
+
+ object PrintCast(int castToken, CastExpression castExpression)
+ {
+ outputFormatter.PrintToken(castToken);
+ outputFormatter.PrintToken(Tokens.OpenParenthesis);
+ TrackedVisit(castExpression.Expression, null);
+ outputFormatter.PrintToken(Tokens.Comma);
+ outputFormatter.Space();
+ TrackedVisit(castExpression.CastTo, null);
+ outputFormatter.PrintToken(Tokens.CloseParenthesis);
+ return null;
+ }
+
+ public override object TrackedVisitStackAllocExpression(StackAllocExpression stackAllocExpression, object data)
+ {
+ UnsupportedNode(stackAllocExpression);
+ outputFormatter.PrintText("stackalloc");
+ return null;
+ }
+
+ public override object TrackedVisitIndexerExpression(IndexerExpression indexerExpression, object data)
+ {
+ TrackedVisit(indexerExpression.TargetObject, data);
+ outputFormatter.PrintToken(Tokens.OpenParenthesis);
+ AppendCommaSeparatedList(indexerExpression.Indexes);
+ outputFormatter.PrintToken(Tokens.CloseParenthesis);
+ return null;
+ }
+
+ public override object TrackedVisitThisReferenceExpression(ThisReferenceExpression thisReferenceExpression, object data)
+ {
+ outputFormatter.PrintToken(Tokens.Me);
+ return null;
+ }
+
+ public override object TrackedVisitBaseReferenceExpression(BaseReferenceExpression baseReferenceExpression, object data)
+ {
+ outputFormatter.PrintToken(Tokens.MyBase);
+ return null;
+ }
+
+ public override object TrackedVisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression, object data)
+ {
+ outputFormatter.PrintToken(Tokens.New);
+ outputFormatter.Space();
+ TrackedVisit(objectCreateExpression.CreateType, data);
+ outputFormatter.PrintToken(Tokens.OpenParenthesis);
+ AppendCommaSeparatedList(objectCreateExpression.Parameters);
+ outputFormatter.PrintToken(Tokens.CloseParenthesis);
+ return null;
+ }
+
+ public override object TrackedVisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object data)
+ {
+ outputFormatter.PrintToken(Tokens.New);
+ outputFormatter.Space();
+ PrintTypeReferenceWithoutArray(arrayCreateExpression.CreateType);
+
+ if (arrayCreateExpression.Arguments.Count > 0) {
+ outputFormatter.PrintToken(Tokens.OpenParenthesis);
+ AppendCommaSeparatedList(arrayCreateExpression.Arguments);
+ outputFormatter.PrintToken(Tokens.CloseParenthesis);
+ PrintArrayRank(arrayCreateExpression.CreateType.RankSpecifier, 1);
+ } else {
+ PrintArrayRank(arrayCreateExpression.CreateType.RankSpecifier, 0);
+ }
+
+ outputFormatter.Space();
+
+ if (arrayCreateExpression.ArrayInitializer.IsNull) {
+ outputFormatter.PrintToken(Tokens.OpenCurlyBrace);
+ outputFormatter.PrintToken(Tokens.CloseCurlyBrace);
+ } else {
+ TrackedVisit(arrayCreateExpression.ArrayInitializer, data);
+ }
+ return null;
+ }
+
+ public override object TrackedVisitCollectionInitializerExpression(CollectionInitializerExpression arrayInitializerExpression, object data)
+ {
+ outputFormatter.PrintToken(Tokens.OpenCurlyBrace);
+ this.AppendCommaSeparatedList(arrayInitializerExpression.CreateExpressions);
+ outputFormatter.PrintToken(Tokens.CloseCurlyBrace);
+ return null;
+ }
+
+ public override object TrackedVisitMemberReferenceExpression(MemberReferenceExpression memberReferenceExpression, object data)
+ {
+ TrackedVisit(memberReferenceExpression.TargetObject, data);
+ outputFormatter.PrintToken(Tokens.Dot);
+ outputFormatter.PrintIdentifier(memberReferenceExpression.MemberName);
+ PrintTypeArguments(memberReferenceExpression.TypeArguments);
+ return null;
+ }
+
+ public override object TrackedVisitDirectionExpression(DirectionExpression directionExpression, object data)
+ {
+ // VB does not need to specify the direction in method calls
+ TrackedVisit(directionExpression.Expression, data);
+ return null;
+ }
+
+
+ public override object TrackedVisitConditionalExpression(ConditionalExpression conditionalExpression, object data)
+ {
+ outputFormatter.PrintText("If");
+ outputFormatter.PrintToken(Tokens.OpenParenthesis);
+ TrackedVisit(conditionalExpression.Condition, data);
+ outputFormatter.PrintToken(Tokens.Comma);
+ outputFormatter.Space();
+ TrackedVisit(conditionalExpression.TrueExpression, data);
+ outputFormatter.PrintToken(Tokens.Comma);
+ outputFormatter.Space();
+ TrackedVisit(conditionalExpression.FalseExpression, data);
+ outputFormatter.PrintToken(Tokens.CloseParenthesis);
+ return null;
+ }
+
+ #endregion
+ #endregion
+
+
+ void OutputModifier(ParameterModifiers modifier, Location position)
+ {
+ switch (modifier) {
+ case ParameterModifiers.None:
+ case ParameterModifiers.In:
+ if (prettyPrintOptions.OutputByValModifier) {
+ outputFormatter.PrintToken(Tokens.ByVal);
+ outputFormatter.Space();
+ }
+ break;
+ case ParameterModifiers.Out:
+ //Error("Out parameter converted to ByRef", position);
+ outputFormatter.PrintToken(Tokens.ByRef);
+ outputFormatter.Space();
+ break;
+ case ParameterModifiers.Params:
+ outputFormatter.PrintToken(Tokens.ParamArray);
+ outputFormatter.Space();
+ break;
+ case ParameterModifiers.Ref:
+ outputFormatter.PrintToken(Tokens.ByRef);
+ outputFormatter.Space();
+ break;
+ case ParameterModifiers.Optional:
+ outputFormatter.PrintToken(Tokens.Optional);
+ outputFormatter.Space();
+ break;
+ default:
+ Error(String.Format("Unsupported modifier : {0}", modifier), position);
+ break;
+ }
+ }
+
+ void OutputModifier(Modifiers modifier)
+ {
+ OutputModifier(modifier, false);
+ }
+
+ void OutputModifier(Modifiers modifier, bool forTypeDecl)
+ {
+ if ((modifier & Modifiers.Public) == Modifiers.Public) {
+ outputFormatter.PrintToken(Tokens.Public);
+ outputFormatter.Space();
+ } else if ((modifier & Modifiers.Private) == Modifiers.Private) {
+ outputFormatter.PrintToken(Tokens.Private);
+ outputFormatter.Space();
+ } else if ((modifier & (Modifiers.Protected | Modifiers.Internal)) == (Modifiers.Protected | Modifiers.Internal)) {
+ outputFormatter.PrintToken(Tokens.Protected);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Friend);
+ outputFormatter.Space();
+ } else if ((modifier & Modifiers.Internal) == Modifiers.Internal) {
+ outputFormatter.PrintToken(Tokens.Friend);
+ outputFormatter.Space();
+ } else if ((modifier & Modifiers.Protected) == Modifiers.Protected) {
+ outputFormatter.PrintToken(Tokens.Protected);
+ outputFormatter.Space();
+ }
+
+ if ((modifier & Modifiers.Static) == Modifiers.Static) {
+ outputFormatter.PrintToken(Tokens.Shared);
+ outputFormatter.Space();
+ }
+ if ((modifier & Modifiers.Virtual) == Modifiers.Virtual) {
+ outputFormatter.PrintToken(Tokens.Overridable);
+ outputFormatter.Space();
+ }
+ if ((modifier & Modifiers.Abstract) == Modifiers.Abstract) {
+ outputFormatter.PrintToken(forTypeDecl ? Tokens.MustInherit : Tokens.MustOverride);
+ outputFormatter.Space();
+ }
+ if ((modifier & Modifiers.Override) == Modifiers.Override) {
+ outputFormatter.PrintToken(Tokens.Overloads);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Overrides);
+ outputFormatter.Space();
+ }
+ if ((modifier & Modifiers.New) == Modifiers.New) {
+ outputFormatter.PrintToken(Tokens.Shadows);
+ outputFormatter.Space();
+ }
+
+ if ((modifier & Modifiers.Sealed) == Modifiers.Sealed) {
+ outputFormatter.PrintToken(forTypeDecl ? Tokens.NotInheritable : Tokens.NotOverridable);
+ outputFormatter.Space();
+ }
+
+ if ((modifier & Modifiers.ReadOnly) == Modifiers.ReadOnly) {
+ outputFormatter.PrintToken(Tokens.ReadOnly);
+ outputFormatter.Space();
+ }
+ if ((modifier & Modifiers.WriteOnly) == Modifiers.WriteOnly) {
+ outputFormatter.PrintToken(Tokens.WriteOnly);
+ outputFormatter.Space();
+ }
+ if ((modifier & Modifiers.Const) == Modifiers.Const) {
+ outputFormatter.PrintToken(Tokens.Const);
+ outputFormatter.Space();
+ }
+ if ((modifier & Modifiers.Partial) == Modifiers.Partial) {
+ outputFormatter.PrintToken(Tokens.Partial);
+ outputFormatter.Space();
+ }
+
+ if ((modifier & Modifiers.Extern) == Modifiers.Extern) {
+ // not required in VB
+ }
+
+ if ((modifier & Modifiers.Volatile) == Modifiers.Volatile) {
+ Error("'Volatile' modifier not convertable", Location.Empty);
+ }
+
+ if ((modifier & Modifiers.Unsafe) == Modifiers.Unsafe) {
+ Error("'Unsafe' modifier not convertable", Location.Empty);
+ }
+ }
+
+ public void AppendCommaSeparatedList<T>(ICollection<T> list) where T : class, INode
+ {
+ if (list != null) {
+ int i = 0;
+ foreach (T node in list) {
+ TrackedVisit(node, null);
+ if (i + 1 < list.Count) {
+ outputFormatter.PrintToken(Tokens.Comma);
+ outputFormatter.Space();
+ if ((i + 1) % 6 == 0) {
+ outputFormatter.PrintLineContinuation();
+ outputFormatter.Indent();
+ outputFormatter.PrintText("\t");
+ }
+ }
+ i++;
+ }
+ }
+ }
+
+ void VisitAttributes(ICollection attributes, object data)
+ {
+ if (attributes == null) {
+ return;
+ }
+ foreach (AttributeSection section in attributes) {
+ if (string.Equals(section.AttributeTarget, "return", StringComparison.OrdinalIgnoreCase))
+ continue;
+ TrackedVisit(section, data);
+ }
+ }
+
+ void VisitReturnTypeAttributes(ICollection attributes, object data)
+ {
+ if (attributes == null) {
+ return;
+ }
+ printAttributeSectionInline = true;
+ foreach (AttributeSection section in attributes) {
+ if (string.Equals(section.AttributeTarget, "return", StringComparison.OrdinalIgnoreCase)) {
+ TrackedVisit(section, data);
+ }
+ }
+ printAttributeSectionInline = false;
+ }
+
+ public override object TrackedVisitLambdaExpression(LambdaExpression lambdaExpression, object data)
+ {
+ if (!lambdaExpression.ExpressionBody.IsNull) {
+ outputFormatter.PrintToken(Tokens.Function);
+ outputFormatter.PrintToken(Tokens.OpenParenthesis);
+ AppendCommaSeparatedList(lambdaExpression.Parameters);
+ outputFormatter.PrintToken(Tokens.CloseParenthesis);
+ outputFormatter.Space();
+ return lambdaExpression.ExpressionBody.AcceptVisitor(this, data);
+ } else {
+ OutputAnonymousMethodWithStatementBody(lambdaExpression.Parameters, lambdaExpression.StatementBody);
+ return null;
+ }
+ }
+
+ void OutputAnonymousMethodWithStatementBody(List<ParameterDeclarationExpression> parameters, BlockStatement body)
+ {
+ Error("VB does not support anonymous methods/lambda expressions with a statement body", body.StartLocation);
+
+ outputFormatter.PrintToken(Tokens.Function);
+ outputFormatter.PrintToken(Tokens.OpenParenthesis);
+ AppendCommaSeparatedList(parameters);
+ outputFormatter.PrintToken(Tokens.CloseParenthesis);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Do);
+ outputFormatter.NewLine();
+
+ ++outputFormatter.IndentationLevel;
+ exitTokenStack.Push(Tokens.Function);
+ body.AcceptVisitor(this, null);
+ exitTokenStack.Pop();
+ --outputFormatter.IndentationLevel;
+
+ outputFormatter.Indent();
+ outputFormatter.PrintToken(Tokens.End);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Function);
+ }
+
+ public override object TrackedVisitQueryExpression(QueryExpression queryExpression, object data)
+ {
+ if (queryExpression.IsQueryContinuation) {
+ queryExpression.FromClause.InExpression.AcceptVisitor(this, data);
+ }
+ outputFormatter.IndentationLevel++;
+ if (queryExpression.IsQueryContinuation) {
+ outputFormatter.PrintToken(Tokens.Into);
+ outputFormatter.PrintIdentifier(queryExpression.FromClause.Identifier);
+ } else {
+ queryExpression.FromClause.AcceptVisitor(this, data);
+ }
+ queryExpression.MiddleClauses.ForEach(PrintClause);
+ PrintClause(queryExpression.SelectOrGroupClause);
+ outputFormatter.IndentationLevel--;
+ return null;
+ }
+
+ void PrintClause(QueryExpressionClause clause)
+ {
+ if (!clause.IsNull) {
+ outputFormatter.PrintLineContinuation();
+ outputFormatter.Indent();
+ clause.AcceptVisitor(this, null);
+ }
+ }
+
+ public override object TrackedVisitQueryExpressionFromClause(QueryExpressionFromClause fromClause, object data)
+ {
+ outputFormatter.PrintText("From");
+ outputFormatter.Space();
+ VisitQueryExpressionFromOrJoinClause(fromClause, data);
+ return null;
+ }
+
+ public override object TrackedVisitQueryExpressionJoinClause(QueryExpressionJoinClause joinClause, object data)
+ {
+ outputFormatter.PrintText("Join");
+ outputFormatter.Space();
+ VisitQueryExpressionFromOrJoinClause(joinClause, data);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.On);
+ outputFormatter.Space();
+ joinClause.OnExpression.AcceptVisitor(this, data);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Assign);
+ outputFormatter.Space();
+ joinClause.EqualsExpression.AcceptVisitor(this, data);
+ if (!string.IsNullOrEmpty(joinClause.IntoIdentifier)) {
+ outputFormatter.Space();
+ outputFormatter.PrintText("Into");
+ outputFormatter.Space();
+ outputFormatter.PrintIdentifier(joinClause.IntoIdentifier);
+ }
+ return null;
+ }
+
+ void VisitQueryExpressionFromOrJoinClause(QueryExpressionFromOrJoinClause clause, object data)
+ {
+ outputFormatter.PrintIdentifier(clause.Identifier);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.In);
+ outputFormatter.Space();
+ clause.InExpression.AcceptVisitor(this, data);
+ }
+
+ public override object TrackedVisitQueryExpressionLetClause(QueryExpressionLetClause letClause, object data)
+ {
+ outputFormatter.PrintToken(Tokens.Let);
+ outputFormatter.Space();
+ outputFormatter.PrintIdentifier(letClause.Identifier);
+ outputFormatter.Space();
+ outputFormatter.PrintToken(Tokens.Assign);
+ outputFormatter.Space();
+ return letClause.Expression.AcceptVisitor(this, data);
+ }
+
+ public override object TrackedVisitQueryExpressionGroupClause(QueryExpressionGroupClause groupClause, object data)
+ {
+ outputFormatter.PrintText("Group");
+ outputFormatter.Space();
+ groupClause.Projection.AcceptVisitor(this, data);
+ outputFormatter.Space();
+ outputFormatter.PrintText("By");
+ outputFormatter.Space();
+ return groupClause.GroupBy.AcceptVisitor(this, data);
+ }
+
+ public override object TrackedVisitQueryExpressionOrderClause(QueryExpressionOrderClause queryExpressionOrderClause, object data)
+ {
+ outputFormatter.PrintText("Order By");
+ outputFormatter.Space();
+ AppendCommaSeparatedList(queryExpressionOrderClause.Orderings);
+ return null;
+ }
+
+ public override object TrackedVisitQueryExpressionOrdering(QueryExpressionOrdering ordering, object data)
+ {
+ ordering.Criteria.AcceptVisitor(this, data);
+ if (ordering.Direction == QueryExpressionOrderingDirection.Ascending) {
+ outputFormatter.Space();
+ outputFormatter.PrintText("Ascending");
+ } else if (ordering.Direction == QueryExpressionOrderingDirection.Descending) {
+ outputFormatter.Space();
+ outputFormatter.PrintText("Descending");
+ }
+ return null;
+ }
+
+ public override object TrackedVisitQueryExpressionSelectClause(QueryExpressionSelectClause selectClause, object data)
+ {
+ outputFormatter.PrintToken(Tokens.Select);
+ outputFormatter.Space();
+ return selectClause.Projection.AcceptVisitor(this, data);
+ }
+
+ public override object TrackedVisitQueryExpressionWhereClause(QueryExpressionWhereClause whereClause, object data)
+ {
+ outputFormatter.PrintText("Where");
+ outputFormatter.Space();
+ return whereClause.Condition.AcceptVisitor(this, data);
+ }
+
+ public override object TrackedVisitExternAliasDirective(ExternAliasDirective externAliasDirective, object data)
+ {
+ UnsupportedNode(externAliasDirective);
+ return null;
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetPrettyPrintOptions.cs b/main/contrib/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetPrettyPrintOptions.cs
index 55ff689c9d..694ec7c2f9 100644
--- a/main/contrib/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetPrettyPrintOptions.cs
+++ b/main/contrib/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetPrettyPrintOptions.cs
@@ -1,22 +1,22 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 2660 $</version>
-// </file>
-
-using System;
-
-namespace ICSharpCode.NRefactory.PrettyPrinter
-{
- /// <summary>
- /// Description of VBNetPrettyPrintOptions.
- /// </summary>
- public class VBNetPrettyPrintOptions : AbstractPrettyPrintOptions
- {
- /// <summary>
- /// Gets/Sets if the optional "ByVal" modifier should be written.
- /// </summary>
- public bool OutputByValModifier { get; set; }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+
+namespace ICSharpCode.NRefactory.PrettyPrinter
+{
+ /// <summary>
+ /// Description of VBNetPrettyPrintOptions.
+ /// </summary>
+ public class VBNetPrettyPrintOptions : AbstractPrettyPrintOptions
+ {
+ /// <summary>
+ /// Gets/Sets if the optional "ByVal" modifier should be written.
+ /// </summary>
+ public bool OutputByValModifier { get; set; }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/SnippetParser.cs b/main/contrib/NRefactory/Project/Src/SnippetParser.cs
index 10af04cffe..8b7e7523e8 100644
--- a/main/contrib/NRefactory/Project/Src/SnippetParser.cs
+++ b/main/contrib/NRefactory/Project/Src/SnippetParser.cs
@@ -1,146 +1,146 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald"/>
-// <version>$Revision: 3531 $</version>
-// </file>
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-
-using ICSharpCode.NRefactory.Ast;
-using ICSharpCode.NRefactory.Parser;
-
-namespace ICSharpCode.NRefactory
-{
- public enum SnippetType
- {
- None,
- CompilationUnit,
- Expression,
- Statements,
- TypeMembers
- }
-
- /// <summary>
- /// The snippet parser supports parsing code snippets that are not valid as a full compilation unit.
- /// </summary>
- public class SnippetParser
- {
- readonly SupportedLanguage language;
-
- public SnippetParser(SupportedLanguage language)
- {
- this.language = language;
- }
-
- /// <summary>
- /// Gets the errors of the last call to Parse(). Returns null if parse was not yet called.
- /// </summary>
- public Errors Errors { get; private set; }
-
- /// <summary>
- /// Gets the specials of the last call to Parse(). Returns null if parse was not yet called.
- /// </summary>
- public List<ISpecial> Specials { get; private set; }
-
- /// <summary>
- /// Gets the snippet type of the last call to Parse(). Returns None if parse was not yet called.
- /// </summary>
- public SnippetType SnippetType { get; private set; }
-
- /// <summary>
- /// Parse the code. The result may be a CompilationUnit, an Expression, a list of statements or a list of class
- /// members.
- /// </summary>
- public INode Parse(string code)
- {
- IParser parser = ParserFactory.CreateParser(language, new StringReader(code));
- parser.Parse();
- this.Errors = parser.Errors;
- this.Specials = parser.Lexer.SpecialTracker.RetrieveSpecials();
- this.SnippetType = SnippetType.CompilationUnit;
- INode result = parser.CompilationUnit;
-
- if (this.Errors.Count > 0) {
- if (language == SupportedLanguage.CSharp) {
- // SEMICOLON HACK : without a trailing semicolon, parsing expressions does not work correctly
- parser = ParserFactory.CreateParser(language, new StringReader(code + ";"));
- } else {
- parser = ParserFactory.CreateParser(language, new StringReader(code));
- }
- Expression expression = parser.ParseExpression();
- if (expression != null && parser.Errors.Count < this.Errors.Count) {
- this.Errors = parser.Errors;
- this.Specials = parser.Lexer.SpecialTracker.RetrieveSpecials();
- this.SnippetType = SnippetType.Expression;
- result = expression;
- }
- }
- if (this.Errors.Count > 0) {
- parser = ParserFactory.CreateParser(language, new StringReader(code));
- BlockStatement block = parser.ParseBlock();
- if (block != null && parser.Errors.Count < this.Errors.Count) {
- this.Errors = parser.Errors;
- this.Specials = parser.Lexer.SpecialTracker.RetrieveSpecials();
- this.SnippetType = SnippetType.Statements;
- result = block;
- }
- }
- if (this.Errors.Count > 0) {
- parser = ParserFactory.CreateParser(language, new StringReader(code));
- List<INode> members = parser.ParseTypeMembers();
- if (members != null && members.Count > 0 && parser.Errors.Count < this.Errors.Count) {
- this.Errors = parser.Errors;
- this.Specials = parser.Lexer.SpecialTracker.RetrieveSpecials();
- this.SnippetType = SnippetType.TypeMembers;
- result = new NodeListNode(members);
- result.StartLocation = members[0].StartLocation;
- result.EndLocation = members[members.Count - 1].EndLocation;
- }
- }
- Debug.Assert(result is CompilationUnit || !result.StartLocation.IsEmpty);
- Debug.Assert(result is CompilationUnit || !result.EndLocation.IsEmpty);
- return result;
- }
-
- sealed class NodeListNode : INode
- {
- List<INode> nodes;
-
- public NodeListNode(List<INode> nodes)
- {
- this.nodes = nodes;
- }
-
- public INode Parent {
- get { return null; }
- set { throw new NotSupportedException(); }
- }
-
- public List<INode> Children {
- get { return nodes; }
- }
-
- public Location StartLocation { get; set; }
- public Location EndLocation { get; set; }
-
- public object UserData { get; set; }
-
- public object AcceptChildren(IAstVisitor visitor, object data)
- {
- foreach (INode n in nodes) {
- n.AcceptVisitor(visitor, data);
- }
- return null;
- }
-
- public object AcceptVisitor(IAstVisitor visitor, object data)
- {
- return AcceptChildren(visitor, data);
- }
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Daniel Grunwald"/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+
+using ICSharpCode.NRefactory.Ast;
+using ICSharpCode.NRefactory.Parser;
+
+namespace ICSharpCode.NRefactory
+{
+ public enum SnippetType
+ {
+ None,
+ CompilationUnit,
+ Expression,
+ Statements,
+ TypeMembers
+ }
+
+ /// <summary>
+ /// The snippet parser supports parsing code snippets that are not valid as a full compilation unit.
+ /// </summary>
+ public class SnippetParser
+ {
+ readonly SupportedLanguage language;
+
+ public SnippetParser(SupportedLanguage language)
+ {
+ this.language = language;
+ }
+
+ /// <summary>
+ /// Gets the errors of the last call to Parse(). Returns null if parse was not yet called.
+ /// </summary>
+ public Errors Errors { get; private set; }
+
+ /// <summary>
+ /// Gets the specials of the last call to Parse(). Returns null if parse was not yet called.
+ /// </summary>
+ public List<ISpecial> Specials { get; private set; }
+
+ /// <summary>
+ /// Gets the snippet type of the last call to Parse(). Returns None if parse was not yet called.
+ /// </summary>
+ public SnippetType SnippetType { get; private set; }
+
+ /// <summary>
+ /// Parse the code. The result may be a CompilationUnit, an Expression, a list of statements or a list of class
+ /// members.
+ /// </summary>
+ public INode Parse(string code)
+ {
+ IParser parser = ParserFactory.CreateParser(language, new StringReader(code));
+ parser.Parse();
+ this.Errors = parser.Errors;
+ this.Specials = parser.Lexer.SpecialTracker.RetrieveSpecials();
+ this.SnippetType = SnippetType.CompilationUnit;
+ INode result = parser.CompilationUnit;
+
+ if (this.Errors.Count > 0) {
+ if (language == SupportedLanguage.CSharp) {
+ // SEMICOLON HACK : without a trailing semicolon, parsing expressions does not work correctly
+ parser = ParserFactory.CreateParser(language, new StringReader(code + ";"));
+ } else {
+ parser = ParserFactory.CreateParser(language, new StringReader(code));
+ }
+ Expression expression = parser.ParseExpression();
+ if (expression != null && parser.Errors.Count < this.Errors.Count) {
+ this.Errors = parser.Errors;
+ this.Specials = parser.Lexer.SpecialTracker.RetrieveSpecials();
+ this.SnippetType = SnippetType.Expression;
+ result = expression;
+ }
+ }
+ if (this.Errors.Count > 0) {
+ parser = ParserFactory.CreateParser(language, new StringReader(code));
+ BlockStatement block = parser.ParseBlock();
+ if (block != null && parser.Errors.Count < this.Errors.Count) {
+ this.Errors = parser.Errors;
+ this.Specials = parser.Lexer.SpecialTracker.RetrieveSpecials();
+ this.SnippetType = SnippetType.Statements;
+ result = block;
+ }
+ }
+ if (this.Errors.Count > 0) {
+ parser = ParserFactory.CreateParser(language, new StringReader(code));
+ List<INode> members = parser.ParseTypeMembers();
+ if (members != null && members.Count > 0 && parser.Errors.Count < this.Errors.Count) {
+ this.Errors = parser.Errors;
+ this.Specials = parser.Lexer.SpecialTracker.RetrieveSpecials();
+ this.SnippetType = SnippetType.TypeMembers;
+ result = new NodeListNode(members);
+ result.StartLocation = members[0].StartLocation;
+ result.EndLocation = members[members.Count - 1].EndLocation;
+ }
+ }
+ Debug.Assert(result is CompilationUnit || !result.StartLocation.IsEmpty);
+ Debug.Assert(result is CompilationUnit || !result.EndLocation.IsEmpty);
+ return result;
+ }
+
+ sealed class NodeListNode : INode
+ {
+ List<INode> nodes;
+
+ public NodeListNode(List<INode> nodes)
+ {
+ this.nodes = nodes;
+ }
+
+ public INode Parent {
+ get { return null; }
+ set { throw new NotSupportedException(); }
+ }
+
+ public List<INode> Children {
+ get { return nodes; }
+ }
+
+ public Location StartLocation { get; set; }
+ public Location EndLocation { get; set; }
+
+ public object UserData { get; set; }
+
+ public object AcceptChildren(IAstVisitor visitor, object data)
+ {
+ foreach (INode n in nodes) {
+ n.AcceptVisitor(visitor, data);
+ }
+ return null;
+ }
+
+ public object AcceptVisitor(IAstVisitor visitor, object data)
+ {
+ return AcceptChildren(visitor, data);
+ }
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Visitors/AbstractASTVisitor.cs b/main/contrib/NRefactory/Project/Src/Visitors/AbstractASTVisitor.cs
index 30f5f877c0..65b09e8ea8 100644
--- a/main/contrib/NRefactory/Project/Src/Visitors/AbstractASTVisitor.cs
+++ b/main/contrib/NRefactory/Project/Src/Visitors/AbstractASTVisitor.cs
@@ -1,1262 +1,1262 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:2.0.50727.3053
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace ICSharpCode.NRefactory.Visitors {
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using ICSharpCode.NRefactory.Ast;
-
-
- public abstract class AbstractAstVisitor : IAstVisitor {
-
- public virtual object VisitAddHandlerStatement(AddHandlerStatement addHandlerStatement, object data) {
- Debug.Assert((addHandlerStatement != null));
- Debug.Assert((addHandlerStatement.EventExpression != null));
- Debug.Assert((addHandlerStatement.HandlerExpression != null));
- addHandlerStatement.EventExpression.AcceptVisitor(this, data);
- return addHandlerStatement.HandlerExpression.AcceptVisitor(this, data);
- }
-
- public virtual object VisitAddressOfExpression(AddressOfExpression addressOfExpression, object data) {
- Debug.Assert((addressOfExpression != null));
- Debug.Assert((addressOfExpression.Expression != null));
- return addressOfExpression.Expression.AcceptVisitor(this, data);
- }
-
- public virtual object VisitAnonymousMethodExpression(AnonymousMethodExpression anonymousMethodExpression, object data) {
- Debug.Assert((anonymousMethodExpression != null));
- Debug.Assert((anonymousMethodExpression.Parameters != null));
- Debug.Assert((anonymousMethodExpression.Body != null));
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.3053
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace ICSharpCode.NRefactory.Visitors {
+ using System;
+ using System.Collections.Generic;
+ using System.Diagnostics;
+ using ICSharpCode.NRefactory.Ast;
+
+
+ public abstract class AbstractAstVisitor : IAstVisitor {
+
+ public virtual object VisitAddHandlerStatement(AddHandlerStatement addHandlerStatement, object data) {
+ Debug.Assert((addHandlerStatement != null));
+ Debug.Assert((addHandlerStatement.EventExpression != null));
+ Debug.Assert((addHandlerStatement.HandlerExpression != null));
+ addHandlerStatement.EventExpression.AcceptVisitor(this, data);
+ return addHandlerStatement.HandlerExpression.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitAddressOfExpression(AddressOfExpression addressOfExpression, object data) {
+ Debug.Assert((addressOfExpression != null));
+ Debug.Assert((addressOfExpression.Expression != null));
+ return addressOfExpression.Expression.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitAnonymousMethodExpression(AnonymousMethodExpression anonymousMethodExpression, object data) {
+ Debug.Assert((anonymousMethodExpression != null));
+ Debug.Assert((anonymousMethodExpression.Parameters != null));
+ Debug.Assert((anonymousMethodExpression.Body != null));
foreach (ParameterDeclarationExpression o in anonymousMethodExpression.Parameters) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return anonymousMethodExpression.Body.AcceptVisitor(this, data);
- }
-
- public virtual object VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object data) {
- Debug.Assert((arrayCreateExpression != null));
- Debug.Assert((arrayCreateExpression.CreateType != null));
- Debug.Assert((arrayCreateExpression.Arguments != null));
- Debug.Assert((arrayCreateExpression.ArrayInitializer != null));
- arrayCreateExpression.CreateType.AcceptVisitor(this, data);
+ }
+ return anonymousMethodExpression.Body.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object data) {
+ Debug.Assert((arrayCreateExpression != null));
+ Debug.Assert((arrayCreateExpression.CreateType != null));
+ Debug.Assert((arrayCreateExpression.Arguments != null));
+ Debug.Assert((arrayCreateExpression.ArrayInitializer != null));
+ arrayCreateExpression.CreateType.AcceptVisitor(this, data);
foreach (Expression o in arrayCreateExpression.Arguments) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return arrayCreateExpression.ArrayInitializer.AcceptVisitor(this, data);
- }
-
- public virtual object VisitAssignmentExpression(AssignmentExpression assignmentExpression, object data) {
- Debug.Assert((assignmentExpression != null));
- Debug.Assert((assignmentExpression.Left != null));
- Debug.Assert((assignmentExpression.Right != null));
- assignmentExpression.Left.AcceptVisitor(this, data);
- return assignmentExpression.Right.AcceptVisitor(this, data);
- }
-
- public virtual object VisitAttribute(ICSharpCode.NRefactory.Ast.Attribute attribute, object data) {
- Debug.Assert((attribute != null));
- Debug.Assert((attribute.PositionalArguments != null));
- Debug.Assert((attribute.NamedArguments != null));
+ }
+ return arrayCreateExpression.ArrayInitializer.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitAssignmentExpression(AssignmentExpression assignmentExpression, object data) {
+ Debug.Assert((assignmentExpression != null));
+ Debug.Assert((assignmentExpression.Left != null));
+ Debug.Assert((assignmentExpression.Right != null));
+ assignmentExpression.Left.AcceptVisitor(this, data);
+ return assignmentExpression.Right.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitAttribute(ICSharpCode.NRefactory.Ast.Attribute attribute, object data) {
+ Debug.Assert((attribute != null));
+ Debug.Assert((attribute.PositionalArguments != null));
+ Debug.Assert((attribute.NamedArguments != null));
foreach (Expression o in attribute.PositionalArguments) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
+ }
foreach (NamedArgumentExpression o in attribute.NamedArguments) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return null;
- }
-
- public virtual object VisitAttributeSection(AttributeSection attributeSection, object data) {
- Debug.Assert((attributeSection != null));
- Debug.Assert((attributeSection.Attributes != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitAttributeSection(AttributeSection attributeSection, object data) {
+ Debug.Assert((attributeSection != null));
+ Debug.Assert((attributeSection.Attributes != null));
foreach (ICSharpCode.NRefactory.Ast.Attribute o in attributeSection.Attributes) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return null;
- }
-
- public virtual object VisitBaseReferenceExpression(BaseReferenceExpression baseReferenceExpression, object data) {
- Debug.Assert((baseReferenceExpression != null));
- return null;
- }
-
- public virtual object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data) {
- Debug.Assert((binaryOperatorExpression != null));
- Debug.Assert((binaryOperatorExpression.Left != null));
- Debug.Assert((binaryOperatorExpression.Right != null));
- binaryOperatorExpression.Left.AcceptVisitor(this, data);
- return binaryOperatorExpression.Right.AcceptVisitor(this, data);
- }
-
- public virtual object VisitBlockStatement(BlockStatement blockStatement, object data) {
- Debug.Assert((blockStatement != null));
- return blockStatement.AcceptChildren(this, data);
- }
-
- public virtual object VisitBreakStatement(BreakStatement breakStatement, object data) {
- Debug.Assert((breakStatement != null));
- return null;
- }
-
- public virtual object VisitCaseLabel(CaseLabel caseLabel, object data) {
- Debug.Assert((caseLabel != null));
- Debug.Assert((caseLabel.Label != null));
- Debug.Assert((caseLabel.ToExpression != null));
- caseLabel.Label.AcceptVisitor(this, data);
- return caseLabel.ToExpression.AcceptVisitor(this, data);
- }
-
- public virtual object VisitCastExpression(CastExpression castExpression, object data) {
- Debug.Assert((castExpression != null));
- Debug.Assert((castExpression.CastTo != null));
- Debug.Assert((castExpression.Expression != null));
- castExpression.CastTo.AcceptVisitor(this, data);
- return castExpression.Expression.AcceptVisitor(this, data);
- }
-
- public virtual object VisitCatchClause(CatchClause catchClause, object data) {
- Debug.Assert((catchClause != null));
- Debug.Assert((catchClause.TypeReference != null));
- Debug.Assert((catchClause.StatementBlock != null));
- Debug.Assert((catchClause.Condition != null));
- catchClause.TypeReference.AcceptVisitor(this, data);
- catchClause.StatementBlock.AcceptVisitor(this, data);
- return catchClause.Condition.AcceptVisitor(this, data);
- }
-
- public virtual object VisitCheckedExpression(CheckedExpression checkedExpression, object data) {
- Debug.Assert((checkedExpression != null));
- Debug.Assert((checkedExpression.Expression != null));
- return checkedExpression.Expression.AcceptVisitor(this, data);
- }
-
- public virtual object VisitCheckedStatement(CheckedStatement checkedStatement, object data) {
- Debug.Assert((checkedStatement != null));
- Debug.Assert((checkedStatement.Block != null));
- return checkedStatement.Block.AcceptVisitor(this, data);
- }
-
- public virtual object VisitClassReferenceExpression(ClassReferenceExpression classReferenceExpression, object data) {
- Debug.Assert((classReferenceExpression != null));
- return null;
- }
-
- public virtual object VisitCollectionInitializerExpression(CollectionInitializerExpression collectionInitializerExpression, object data) {
- Debug.Assert((collectionInitializerExpression != null));
- Debug.Assert((collectionInitializerExpression.CreateExpressions != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitBaseReferenceExpression(BaseReferenceExpression baseReferenceExpression, object data) {
+ Debug.Assert((baseReferenceExpression != null));
+ return null;
+ }
+
+ public virtual object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data) {
+ Debug.Assert((binaryOperatorExpression != null));
+ Debug.Assert((binaryOperatorExpression.Left != null));
+ Debug.Assert((binaryOperatorExpression.Right != null));
+ binaryOperatorExpression.Left.AcceptVisitor(this, data);
+ return binaryOperatorExpression.Right.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitBlockStatement(BlockStatement blockStatement, object data) {
+ Debug.Assert((blockStatement != null));
+ return blockStatement.AcceptChildren(this, data);
+ }
+
+ public virtual object VisitBreakStatement(BreakStatement breakStatement, object data) {
+ Debug.Assert((breakStatement != null));
+ return null;
+ }
+
+ public virtual object VisitCaseLabel(CaseLabel caseLabel, object data) {
+ Debug.Assert((caseLabel != null));
+ Debug.Assert((caseLabel.Label != null));
+ Debug.Assert((caseLabel.ToExpression != null));
+ caseLabel.Label.AcceptVisitor(this, data);
+ return caseLabel.ToExpression.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitCastExpression(CastExpression castExpression, object data) {
+ Debug.Assert((castExpression != null));
+ Debug.Assert((castExpression.CastTo != null));
+ Debug.Assert((castExpression.Expression != null));
+ castExpression.CastTo.AcceptVisitor(this, data);
+ return castExpression.Expression.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitCatchClause(CatchClause catchClause, object data) {
+ Debug.Assert((catchClause != null));
+ Debug.Assert((catchClause.TypeReference != null));
+ Debug.Assert((catchClause.StatementBlock != null));
+ Debug.Assert((catchClause.Condition != null));
+ catchClause.TypeReference.AcceptVisitor(this, data);
+ catchClause.StatementBlock.AcceptVisitor(this, data);
+ return catchClause.Condition.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitCheckedExpression(CheckedExpression checkedExpression, object data) {
+ Debug.Assert((checkedExpression != null));
+ Debug.Assert((checkedExpression.Expression != null));
+ return checkedExpression.Expression.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitCheckedStatement(CheckedStatement checkedStatement, object data) {
+ Debug.Assert((checkedStatement != null));
+ Debug.Assert((checkedStatement.Block != null));
+ return checkedStatement.Block.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitClassReferenceExpression(ClassReferenceExpression classReferenceExpression, object data) {
+ Debug.Assert((classReferenceExpression != null));
+ return null;
+ }
+
+ public virtual object VisitCollectionInitializerExpression(CollectionInitializerExpression collectionInitializerExpression, object data) {
+ Debug.Assert((collectionInitializerExpression != null));
+ Debug.Assert((collectionInitializerExpression.CreateExpressions != null));
foreach (Expression o in collectionInitializerExpression.CreateExpressions) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return null;
- }
-
- public virtual object VisitCompilationUnit(CompilationUnit compilationUnit, object data) {
- Debug.Assert((compilationUnit != null));
- return compilationUnit.AcceptChildren(this, data);
- }
-
- public virtual object VisitConditionalExpression(ConditionalExpression conditionalExpression, object data) {
- Debug.Assert((conditionalExpression != null));
- Debug.Assert((conditionalExpression.Condition != null));
- Debug.Assert((conditionalExpression.TrueExpression != null));
- Debug.Assert((conditionalExpression.FalseExpression != null));
- conditionalExpression.Condition.AcceptVisitor(this, data);
- conditionalExpression.TrueExpression.AcceptVisitor(this, data);
- return conditionalExpression.FalseExpression.AcceptVisitor(this, data);
- }
-
- public virtual object VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data) {
- Debug.Assert((constructorDeclaration != null));
- Debug.Assert((constructorDeclaration.Attributes != null));
- Debug.Assert((constructorDeclaration.Parameters != null));
- Debug.Assert((constructorDeclaration.ConstructorInitializer != null));
- Debug.Assert((constructorDeclaration.Body != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitCompilationUnit(CompilationUnit compilationUnit, object data) {
+ Debug.Assert((compilationUnit != null));
+ return compilationUnit.AcceptChildren(this, data);
+ }
+
+ public virtual object VisitConditionalExpression(ConditionalExpression conditionalExpression, object data) {
+ Debug.Assert((conditionalExpression != null));
+ Debug.Assert((conditionalExpression.Condition != null));
+ Debug.Assert((conditionalExpression.TrueExpression != null));
+ Debug.Assert((conditionalExpression.FalseExpression != null));
+ conditionalExpression.Condition.AcceptVisitor(this, data);
+ conditionalExpression.TrueExpression.AcceptVisitor(this, data);
+ return conditionalExpression.FalseExpression.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data) {
+ Debug.Assert((constructorDeclaration != null));
+ Debug.Assert((constructorDeclaration.Attributes != null));
+ Debug.Assert((constructorDeclaration.Parameters != null));
+ Debug.Assert((constructorDeclaration.ConstructorInitializer != null));
+ Debug.Assert((constructorDeclaration.Body != null));
foreach (AttributeSection o in constructorDeclaration.Attributes) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
+ }
foreach (ParameterDeclarationExpression o in constructorDeclaration.Parameters) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- constructorDeclaration.ConstructorInitializer.AcceptVisitor(this, data);
- return constructorDeclaration.Body.AcceptVisitor(this, data);
- }
-
- public virtual object VisitConstructorInitializer(ConstructorInitializer constructorInitializer, object data) {
- Debug.Assert((constructorInitializer != null));
- Debug.Assert((constructorInitializer.Arguments != null));
+ }
+ constructorDeclaration.ConstructorInitializer.AcceptVisitor(this, data);
+ return constructorDeclaration.Body.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitConstructorInitializer(ConstructorInitializer constructorInitializer, object data) {
+ Debug.Assert((constructorInitializer != null));
+ Debug.Assert((constructorInitializer.Arguments != null));
foreach (Expression o in constructorInitializer.Arguments) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return null;
- }
-
- public virtual object VisitContinueStatement(ContinueStatement continueStatement, object data) {
- Debug.Assert((continueStatement != null));
- return null;
- }
-
- public virtual object VisitDeclareDeclaration(DeclareDeclaration declareDeclaration, object data) {
- Debug.Assert((declareDeclaration != null));
- Debug.Assert((declareDeclaration.Attributes != null));
- Debug.Assert((declareDeclaration.Parameters != null));
- Debug.Assert((declareDeclaration.TypeReference != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitContinueStatement(ContinueStatement continueStatement, object data) {
+ Debug.Assert((continueStatement != null));
+ return null;
+ }
+
+ public virtual object VisitDeclareDeclaration(DeclareDeclaration declareDeclaration, object data) {
+ Debug.Assert((declareDeclaration != null));
+ Debug.Assert((declareDeclaration.Attributes != null));
+ Debug.Assert((declareDeclaration.Parameters != null));
+ Debug.Assert((declareDeclaration.TypeReference != null));
foreach (AttributeSection o in declareDeclaration.Attributes) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
+ }
foreach (ParameterDeclarationExpression o in declareDeclaration.Parameters) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return declareDeclaration.TypeReference.AcceptVisitor(this, data);
- }
-
- public virtual object VisitDefaultValueExpression(DefaultValueExpression defaultValueExpression, object data) {
- Debug.Assert((defaultValueExpression != null));
- Debug.Assert((defaultValueExpression.TypeReference != null));
- return defaultValueExpression.TypeReference.AcceptVisitor(this, data);
- }
-
- public virtual object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data) {
- Debug.Assert((delegateDeclaration != null));
- Debug.Assert((delegateDeclaration.Attributes != null));
- Debug.Assert((delegateDeclaration.ReturnType != null));
- Debug.Assert((delegateDeclaration.Parameters != null));
- Debug.Assert((delegateDeclaration.Templates != null));
+ }
+ return declareDeclaration.TypeReference.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitDefaultValueExpression(DefaultValueExpression defaultValueExpression, object data) {
+ Debug.Assert((defaultValueExpression != null));
+ Debug.Assert((defaultValueExpression.TypeReference != null));
+ return defaultValueExpression.TypeReference.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data) {
+ Debug.Assert((delegateDeclaration != null));
+ Debug.Assert((delegateDeclaration.Attributes != null));
+ Debug.Assert((delegateDeclaration.ReturnType != null));
+ Debug.Assert((delegateDeclaration.Parameters != null));
+ Debug.Assert((delegateDeclaration.Templates != null));
foreach (AttributeSection o in delegateDeclaration.Attributes) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- delegateDeclaration.ReturnType.AcceptVisitor(this, data);
+ }
+ delegateDeclaration.ReturnType.AcceptVisitor(this, data);
foreach (ParameterDeclarationExpression o in delegateDeclaration.Parameters) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
+ }
foreach (TemplateDefinition o in delegateDeclaration.Templates) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return null;
- }
-
- public virtual object VisitDestructorDeclaration(DestructorDeclaration destructorDeclaration, object data) {
- Debug.Assert((destructorDeclaration != null));
- Debug.Assert((destructorDeclaration.Attributes != null));
- Debug.Assert((destructorDeclaration.Body != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitDestructorDeclaration(DestructorDeclaration destructorDeclaration, object data) {
+ Debug.Assert((destructorDeclaration != null));
+ Debug.Assert((destructorDeclaration.Attributes != null));
+ Debug.Assert((destructorDeclaration.Body != null));
foreach (AttributeSection o in destructorDeclaration.Attributes) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return destructorDeclaration.Body.AcceptVisitor(this, data);
- }
-
- public virtual object VisitDirectionExpression(DirectionExpression directionExpression, object data) {
- Debug.Assert((directionExpression != null));
- Debug.Assert((directionExpression.Expression != null));
- return directionExpression.Expression.AcceptVisitor(this, data);
- }
-
- public virtual object VisitDoLoopStatement(DoLoopStatement doLoopStatement, object data) {
- Debug.Assert((doLoopStatement != null));
- Debug.Assert((doLoopStatement.Condition != null));
- Debug.Assert((doLoopStatement.EmbeddedStatement != null));
- doLoopStatement.Condition.AcceptVisitor(this, data);
- return doLoopStatement.EmbeddedStatement.AcceptVisitor(this, data);
- }
-
- public virtual object VisitElseIfSection(ElseIfSection elseIfSection, object data) {
- Debug.Assert((elseIfSection != null));
- Debug.Assert((elseIfSection.Condition != null));
- Debug.Assert((elseIfSection.EmbeddedStatement != null));
- elseIfSection.Condition.AcceptVisitor(this, data);
- return elseIfSection.EmbeddedStatement.AcceptVisitor(this, data);
- }
-
- public virtual object VisitEmptyStatement(EmptyStatement emptyStatement, object data) {
- Debug.Assert((emptyStatement != null));
- return null;
- }
-
- public virtual object VisitEndStatement(EndStatement endStatement, object data) {
- Debug.Assert((endStatement != null));
- return null;
- }
-
- public virtual object VisitEraseStatement(EraseStatement eraseStatement, object data) {
- Debug.Assert((eraseStatement != null));
- Debug.Assert((eraseStatement.Expressions != null));
+ }
+ return destructorDeclaration.Body.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitDirectionExpression(DirectionExpression directionExpression, object data) {
+ Debug.Assert((directionExpression != null));
+ Debug.Assert((directionExpression.Expression != null));
+ return directionExpression.Expression.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitDoLoopStatement(DoLoopStatement doLoopStatement, object data) {
+ Debug.Assert((doLoopStatement != null));
+ Debug.Assert((doLoopStatement.Condition != null));
+ Debug.Assert((doLoopStatement.EmbeddedStatement != null));
+ doLoopStatement.Condition.AcceptVisitor(this, data);
+ return doLoopStatement.EmbeddedStatement.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitElseIfSection(ElseIfSection elseIfSection, object data) {
+ Debug.Assert((elseIfSection != null));
+ Debug.Assert((elseIfSection.Condition != null));
+ Debug.Assert((elseIfSection.EmbeddedStatement != null));
+ elseIfSection.Condition.AcceptVisitor(this, data);
+ return elseIfSection.EmbeddedStatement.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitEmptyStatement(EmptyStatement emptyStatement, object data) {
+ Debug.Assert((emptyStatement != null));
+ return null;
+ }
+
+ public virtual object VisitEndStatement(EndStatement endStatement, object data) {
+ Debug.Assert((endStatement != null));
+ return null;
+ }
+
+ public virtual object VisitEraseStatement(EraseStatement eraseStatement, object data) {
+ Debug.Assert((eraseStatement != null));
+ Debug.Assert((eraseStatement.Expressions != null));
foreach (Expression o in eraseStatement.Expressions) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return null;
- }
-
- public virtual object VisitErrorStatement(ErrorStatement errorStatement, object data) {
- Debug.Assert((errorStatement != null));
- Debug.Assert((errorStatement.Expression != null));
- return errorStatement.Expression.AcceptVisitor(this, data);
- }
-
- public virtual object VisitEventAddRegion(EventAddRegion eventAddRegion, object data) {
- Debug.Assert((eventAddRegion != null));
- Debug.Assert((eventAddRegion.Attributes != null));
- Debug.Assert((eventAddRegion.Block != null));
- Debug.Assert((eventAddRegion.Parameters != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitErrorStatement(ErrorStatement errorStatement, object data) {
+ Debug.Assert((errorStatement != null));
+ Debug.Assert((errorStatement.Expression != null));
+ return errorStatement.Expression.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitEventAddRegion(EventAddRegion eventAddRegion, object data) {
+ Debug.Assert((eventAddRegion != null));
+ Debug.Assert((eventAddRegion.Attributes != null));
+ Debug.Assert((eventAddRegion.Block != null));
+ Debug.Assert((eventAddRegion.Parameters != null));
foreach (AttributeSection o in eventAddRegion.Attributes) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- eventAddRegion.Block.AcceptVisitor(this, data);
+ }
+ eventAddRegion.Block.AcceptVisitor(this, data);
foreach (ParameterDeclarationExpression o in eventAddRegion.Parameters) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return null;
- }
-
- public virtual object VisitEventDeclaration(EventDeclaration eventDeclaration, object data) {
- Debug.Assert((eventDeclaration != null));
- Debug.Assert((eventDeclaration.Attributes != null));
- Debug.Assert((eventDeclaration.Parameters != null));
- Debug.Assert((eventDeclaration.InterfaceImplementations != null));
- Debug.Assert((eventDeclaration.TypeReference != null));
- Debug.Assert((eventDeclaration.AddRegion != null));
- Debug.Assert((eventDeclaration.RemoveRegion != null));
- Debug.Assert((eventDeclaration.RaiseRegion != null));
- Debug.Assert((eventDeclaration.Initializer != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitEventDeclaration(EventDeclaration eventDeclaration, object data) {
+ Debug.Assert((eventDeclaration != null));
+ Debug.Assert((eventDeclaration.Attributes != null));
+ Debug.Assert((eventDeclaration.Parameters != null));
+ Debug.Assert((eventDeclaration.InterfaceImplementations != null));
+ Debug.Assert((eventDeclaration.TypeReference != null));
+ Debug.Assert((eventDeclaration.AddRegion != null));
+ Debug.Assert((eventDeclaration.RemoveRegion != null));
+ Debug.Assert((eventDeclaration.RaiseRegion != null));
+ Debug.Assert((eventDeclaration.Initializer != null));
foreach (AttributeSection o in eventDeclaration.Attributes) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
+ }
foreach (ParameterDeclarationExpression o in eventDeclaration.Parameters) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
+ }
foreach (InterfaceImplementation o in eventDeclaration.InterfaceImplementations) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- eventDeclaration.TypeReference.AcceptVisitor(this, data);
- eventDeclaration.AddRegion.AcceptVisitor(this, data);
- eventDeclaration.RemoveRegion.AcceptVisitor(this, data);
- eventDeclaration.RaiseRegion.AcceptVisitor(this, data);
- return eventDeclaration.Initializer.AcceptVisitor(this, data);
- }
-
- public virtual object VisitEventRaiseRegion(EventRaiseRegion eventRaiseRegion, object data) {
- Debug.Assert((eventRaiseRegion != null));
- Debug.Assert((eventRaiseRegion.Attributes != null));
- Debug.Assert((eventRaiseRegion.Block != null));
- Debug.Assert((eventRaiseRegion.Parameters != null));
+ }
+ eventDeclaration.TypeReference.AcceptVisitor(this, data);
+ eventDeclaration.AddRegion.AcceptVisitor(this, data);
+ eventDeclaration.RemoveRegion.AcceptVisitor(this, data);
+ eventDeclaration.RaiseRegion.AcceptVisitor(this, data);
+ return eventDeclaration.Initializer.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitEventRaiseRegion(EventRaiseRegion eventRaiseRegion, object data) {
+ Debug.Assert((eventRaiseRegion != null));
+ Debug.Assert((eventRaiseRegion.Attributes != null));
+ Debug.Assert((eventRaiseRegion.Block != null));
+ Debug.Assert((eventRaiseRegion.Parameters != null));
foreach (AttributeSection o in eventRaiseRegion.Attributes) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- eventRaiseRegion.Block.AcceptVisitor(this, data);
+ }
+ eventRaiseRegion.Block.AcceptVisitor(this, data);
foreach (ParameterDeclarationExpression o in eventRaiseRegion.Parameters) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return null;
- }
-
- public virtual object VisitEventRemoveRegion(EventRemoveRegion eventRemoveRegion, object data) {
- Debug.Assert((eventRemoveRegion != null));
- Debug.Assert((eventRemoveRegion.Attributes != null));
- Debug.Assert((eventRemoveRegion.Block != null));
- Debug.Assert((eventRemoveRegion.Parameters != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitEventRemoveRegion(EventRemoveRegion eventRemoveRegion, object data) {
+ Debug.Assert((eventRemoveRegion != null));
+ Debug.Assert((eventRemoveRegion.Attributes != null));
+ Debug.Assert((eventRemoveRegion.Block != null));
+ Debug.Assert((eventRemoveRegion.Parameters != null));
foreach (AttributeSection o in eventRemoveRegion.Attributes) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- eventRemoveRegion.Block.AcceptVisitor(this, data);
+ }
+ eventRemoveRegion.Block.AcceptVisitor(this, data);
foreach (ParameterDeclarationExpression o in eventRemoveRegion.Parameters) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return null;
- }
-
- public virtual object VisitExitStatement(ExitStatement exitStatement, object data) {
- Debug.Assert((exitStatement != null));
- return null;
- }
-
- public virtual object VisitExpressionRangeVariable(ExpressionRangeVariable expressionRangeVariable, object data) {
- Debug.Assert((expressionRangeVariable != null));
- Debug.Assert((expressionRangeVariable.Expression != null));
- Debug.Assert((expressionRangeVariable.Type != null));
- expressionRangeVariable.Expression.AcceptVisitor(this, data);
- return expressionRangeVariable.Type.AcceptVisitor(this, data);
- }
-
- public virtual object VisitExpressionStatement(ExpressionStatement expressionStatement, object data) {
- Debug.Assert((expressionStatement != null));
- Debug.Assert((expressionStatement.Expression != null));
- return expressionStatement.Expression.AcceptVisitor(this, data);
- }
-
- public virtual object VisitExternAliasDirective(ExternAliasDirective externAliasDirective, object data) {
- Debug.Assert((externAliasDirective != null));
- return null;
- }
-
- public virtual object VisitFieldDeclaration(FieldDeclaration fieldDeclaration, object data) {
- Debug.Assert((fieldDeclaration != null));
- Debug.Assert((fieldDeclaration.Attributes != null));
- Debug.Assert((fieldDeclaration.TypeReference != null));
- Debug.Assert((fieldDeclaration.Fields != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitExitStatement(ExitStatement exitStatement, object data) {
+ Debug.Assert((exitStatement != null));
+ return null;
+ }
+
+ public virtual object VisitExpressionRangeVariable(ExpressionRangeVariable expressionRangeVariable, object data) {
+ Debug.Assert((expressionRangeVariable != null));
+ Debug.Assert((expressionRangeVariable.Expression != null));
+ Debug.Assert((expressionRangeVariable.Type != null));
+ expressionRangeVariable.Expression.AcceptVisitor(this, data);
+ return expressionRangeVariable.Type.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitExpressionStatement(ExpressionStatement expressionStatement, object data) {
+ Debug.Assert((expressionStatement != null));
+ Debug.Assert((expressionStatement.Expression != null));
+ return expressionStatement.Expression.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitExternAliasDirective(ExternAliasDirective externAliasDirective, object data) {
+ Debug.Assert((externAliasDirective != null));
+ return null;
+ }
+
+ public virtual object VisitFieldDeclaration(FieldDeclaration fieldDeclaration, object data) {
+ Debug.Assert((fieldDeclaration != null));
+ Debug.Assert((fieldDeclaration.Attributes != null));
+ Debug.Assert((fieldDeclaration.TypeReference != null));
+ Debug.Assert((fieldDeclaration.Fields != null));
foreach (AttributeSection o in fieldDeclaration.Attributes) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- fieldDeclaration.TypeReference.AcceptVisitor(this, data);
+ }
+ fieldDeclaration.TypeReference.AcceptVisitor(this, data);
foreach (VariableDeclaration o in fieldDeclaration.Fields) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return null;
- }
-
- public virtual object VisitFixedStatement(FixedStatement fixedStatement, object data) {
- Debug.Assert((fixedStatement != null));
- Debug.Assert((fixedStatement.PointerDeclaration != null));
- Debug.Assert((fixedStatement.EmbeddedStatement != null));
- fixedStatement.PointerDeclaration.AcceptVisitor(this, data);
- return fixedStatement.EmbeddedStatement.AcceptVisitor(this, data);
- }
-
- public virtual object VisitForeachStatement(ForeachStatement foreachStatement, object data) {
- Debug.Assert((foreachStatement != null));
- Debug.Assert((foreachStatement.TypeReference != null));
- Debug.Assert((foreachStatement.Expression != null));
- Debug.Assert((foreachStatement.NextExpression != null));
- Debug.Assert((foreachStatement.EmbeddedStatement != null));
- foreachStatement.TypeReference.AcceptVisitor(this, data);
- foreachStatement.Expression.AcceptVisitor(this, data);
- foreachStatement.NextExpression.AcceptVisitor(this, data);
- return foreachStatement.EmbeddedStatement.AcceptVisitor(this, data);
- }
-
- public virtual object VisitForNextStatement(ForNextStatement forNextStatement, object data) {
- Debug.Assert((forNextStatement != null));
- Debug.Assert((forNextStatement.Start != null));
- Debug.Assert((forNextStatement.End != null));
- Debug.Assert((forNextStatement.Step != null));
- Debug.Assert((forNextStatement.NextExpressions != null));
- Debug.Assert((forNextStatement.TypeReference != null));
- Debug.Assert((forNextStatement.LoopVariableExpression != null));
- Debug.Assert((forNextStatement.EmbeddedStatement != null));
- forNextStatement.Start.AcceptVisitor(this, data);
- forNextStatement.End.AcceptVisitor(this, data);
- forNextStatement.Step.AcceptVisitor(this, data);
+ }
+ return null;
+ }
+
+ public virtual object VisitFixedStatement(FixedStatement fixedStatement, object data) {
+ Debug.Assert((fixedStatement != null));
+ Debug.Assert((fixedStatement.PointerDeclaration != null));
+ Debug.Assert((fixedStatement.EmbeddedStatement != null));
+ fixedStatement.PointerDeclaration.AcceptVisitor(this, data);
+ return fixedStatement.EmbeddedStatement.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitForeachStatement(ForeachStatement foreachStatement, object data) {
+ Debug.Assert((foreachStatement != null));
+ Debug.Assert((foreachStatement.TypeReference != null));
+ Debug.Assert((foreachStatement.Expression != null));
+ Debug.Assert((foreachStatement.NextExpression != null));
+ Debug.Assert((foreachStatement.EmbeddedStatement != null));
+ foreachStatement.TypeReference.AcceptVisitor(this, data);
+ foreachStatement.Expression.AcceptVisitor(this, data);
+ foreachStatement.NextExpression.AcceptVisitor(this, data);
+ return foreachStatement.EmbeddedStatement.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitForNextStatement(ForNextStatement forNextStatement, object data) {
+ Debug.Assert((forNextStatement != null));
+ Debug.Assert((forNextStatement.Start != null));
+ Debug.Assert((forNextStatement.End != null));
+ Debug.Assert((forNextStatement.Step != null));
+ Debug.Assert((forNextStatement.NextExpressions != null));
+ Debug.Assert((forNextStatement.TypeReference != null));
+ Debug.Assert((forNextStatement.LoopVariableExpression != null));
+ Debug.Assert((forNextStatement.EmbeddedStatement != null));
+ forNextStatement.Start.AcceptVisitor(this, data);
+ forNextStatement.End.AcceptVisitor(this, data);
+ forNextStatement.Step.AcceptVisitor(this, data);
foreach (Expression o in forNextStatement.NextExpressions) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- forNextStatement.TypeReference.AcceptVisitor(this, data);
- forNextStatement.LoopVariableExpression.AcceptVisitor(this, data);
- return forNextStatement.EmbeddedStatement.AcceptVisitor(this, data);
- }
-
- public virtual object VisitForStatement(ForStatement forStatement, object data) {
- Debug.Assert((forStatement != null));
- Debug.Assert((forStatement.Initializers != null));
- Debug.Assert((forStatement.Condition != null));
- Debug.Assert((forStatement.Iterator != null));
- Debug.Assert((forStatement.EmbeddedStatement != null));
+ }
+ forNextStatement.TypeReference.AcceptVisitor(this, data);
+ forNextStatement.LoopVariableExpression.AcceptVisitor(this, data);
+ return forNextStatement.EmbeddedStatement.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitForStatement(ForStatement forStatement, object data) {
+ Debug.Assert((forStatement != null));
+ Debug.Assert((forStatement.Initializers != null));
+ Debug.Assert((forStatement.Condition != null));
+ Debug.Assert((forStatement.Iterator != null));
+ Debug.Assert((forStatement.EmbeddedStatement != null));
foreach (Statement o in forStatement.Initializers) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- forStatement.Condition.AcceptVisitor(this, data);
+ }
+ forStatement.Condition.AcceptVisitor(this, data);
foreach (Statement o in forStatement.Iterator) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return forStatement.EmbeddedStatement.AcceptVisitor(this, data);
- }
-
- public virtual object VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, object data) {
- Debug.Assert((gotoCaseStatement != null));
- Debug.Assert((gotoCaseStatement.Expression != null));
- return gotoCaseStatement.Expression.AcceptVisitor(this, data);
- }
-
- public virtual object VisitGotoStatement(GotoStatement gotoStatement, object data) {
- Debug.Assert((gotoStatement != null));
- return null;
- }
-
- public virtual object VisitIdentifierExpression(IdentifierExpression identifierExpression, object data) {
- Debug.Assert((identifierExpression != null));
- Debug.Assert((identifierExpression.TypeArguments != null));
+ }
+ return forStatement.EmbeddedStatement.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, object data) {
+ Debug.Assert((gotoCaseStatement != null));
+ Debug.Assert((gotoCaseStatement.Expression != null));
+ return gotoCaseStatement.Expression.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitGotoStatement(GotoStatement gotoStatement, object data) {
+ Debug.Assert((gotoStatement != null));
+ return null;
+ }
+
+ public virtual object VisitIdentifierExpression(IdentifierExpression identifierExpression, object data) {
+ Debug.Assert((identifierExpression != null));
+ Debug.Assert((identifierExpression.TypeArguments != null));
foreach (TypeReference o in identifierExpression.TypeArguments) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return null;
- }
-
- public virtual object VisitIfElseStatement(IfElseStatement ifElseStatement, object data) {
- Debug.Assert((ifElseStatement != null));
- Debug.Assert((ifElseStatement.Condition != null));
- Debug.Assert((ifElseStatement.TrueStatement != null));
- Debug.Assert((ifElseStatement.FalseStatement != null));
- Debug.Assert((ifElseStatement.ElseIfSections != null));
- ifElseStatement.Condition.AcceptVisitor(this, data);
+ }
+ return null;
+ }
+
+ public virtual object VisitIfElseStatement(IfElseStatement ifElseStatement, object data) {
+ Debug.Assert((ifElseStatement != null));
+ Debug.Assert((ifElseStatement.Condition != null));
+ Debug.Assert((ifElseStatement.TrueStatement != null));
+ Debug.Assert((ifElseStatement.FalseStatement != null));
+ Debug.Assert((ifElseStatement.ElseIfSections != null));
+ ifElseStatement.Condition.AcceptVisitor(this, data);
foreach (Statement o in ifElseStatement.TrueStatement) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
+ }
foreach (Statement o in ifElseStatement.FalseStatement) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
+ }
foreach (ElseIfSection o in ifElseStatement.ElseIfSections) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return null;
- }
-
- public virtual object VisitIndexerDeclaration(IndexerDeclaration indexerDeclaration, object data) {
- Debug.Assert((indexerDeclaration != null));
- Debug.Assert((indexerDeclaration.Attributes != null));
- Debug.Assert((indexerDeclaration.Parameters != null));
- Debug.Assert((indexerDeclaration.InterfaceImplementations != null));
- Debug.Assert((indexerDeclaration.TypeReference != null));
- Debug.Assert((indexerDeclaration.GetRegion != null));
- Debug.Assert((indexerDeclaration.SetRegion != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitIndexerDeclaration(IndexerDeclaration indexerDeclaration, object data) {
+ Debug.Assert((indexerDeclaration != null));
+ Debug.Assert((indexerDeclaration.Attributes != null));
+ Debug.Assert((indexerDeclaration.Parameters != null));
+ Debug.Assert((indexerDeclaration.InterfaceImplementations != null));
+ Debug.Assert((indexerDeclaration.TypeReference != null));
+ Debug.Assert((indexerDeclaration.GetRegion != null));
+ Debug.Assert((indexerDeclaration.SetRegion != null));
foreach (AttributeSection o in indexerDeclaration.Attributes) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
+ }
foreach (ParameterDeclarationExpression o in indexerDeclaration.Parameters) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
+ }
foreach (InterfaceImplementation o in indexerDeclaration.InterfaceImplementations) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- indexerDeclaration.TypeReference.AcceptVisitor(this, data);
- indexerDeclaration.GetRegion.AcceptVisitor(this, data);
- return indexerDeclaration.SetRegion.AcceptVisitor(this, data);
- }
-
- public virtual object VisitIndexerExpression(IndexerExpression indexerExpression, object data) {
- Debug.Assert((indexerExpression != null));
- Debug.Assert((indexerExpression.TargetObject != null));
- Debug.Assert((indexerExpression.Indexes != null));
- indexerExpression.TargetObject.AcceptVisitor(this, data);
+ }
+ indexerDeclaration.TypeReference.AcceptVisitor(this, data);
+ indexerDeclaration.GetRegion.AcceptVisitor(this, data);
+ return indexerDeclaration.SetRegion.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitIndexerExpression(IndexerExpression indexerExpression, object data) {
+ Debug.Assert((indexerExpression != null));
+ Debug.Assert((indexerExpression.TargetObject != null));
+ Debug.Assert((indexerExpression.Indexes != null));
+ indexerExpression.TargetObject.AcceptVisitor(this, data);
foreach (Expression o in indexerExpression.Indexes) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return null;
- }
-
- public virtual object VisitInnerClassTypeReference(InnerClassTypeReference innerClassTypeReference, object data) {
- Debug.Assert((innerClassTypeReference != null));
- Debug.Assert((innerClassTypeReference.GenericTypes != null));
- Debug.Assert((innerClassTypeReference.BaseType != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitInnerClassTypeReference(InnerClassTypeReference innerClassTypeReference, object data) {
+ Debug.Assert((innerClassTypeReference != null));
+ Debug.Assert((innerClassTypeReference.GenericTypes != null));
+ Debug.Assert((innerClassTypeReference.BaseType != null));
foreach (TypeReference o in innerClassTypeReference.GenericTypes) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return innerClassTypeReference.BaseType.AcceptVisitor(this, data);
- }
-
- public virtual object VisitInterfaceImplementation(InterfaceImplementation interfaceImplementation, object data) {
- Debug.Assert((interfaceImplementation != null));
- Debug.Assert((interfaceImplementation.InterfaceType != null));
- return interfaceImplementation.InterfaceType.AcceptVisitor(this, data);
- }
-
- public virtual object VisitInvocationExpression(InvocationExpression invocationExpression, object data) {
- Debug.Assert((invocationExpression != null));
- Debug.Assert((invocationExpression.TargetObject != null));
- Debug.Assert((invocationExpression.Arguments != null));
- invocationExpression.TargetObject.AcceptVisitor(this, data);
+ }
+ return innerClassTypeReference.BaseType.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitInterfaceImplementation(InterfaceImplementation interfaceImplementation, object data) {
+ Debug.Assert((interfaceImplementation != null));
+ Debug.Assert((interfaceImplementation.InterfaceType != null));
+ return interfaceImplementation.InterfaceType.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitInvocationExpression(InvocationExpression invocationExpression, object data) {
+ Debug.Assert((invocationExpression != null));
+ Debug.Assert((invocationExpression.TargetObject != null));
+ Debug.Assert((invocationExpression.Arguments != null));
+ invocationExpression.TargetObject.AcceptVisitor(this, data);
foreach (Expression o in invocationExpression.Arguments) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return null;
- }
-
- public virtual object VisitLabelStatement(LabelStatement labelStatement, object data) {
- Debug.Assert((labelStatement != null));
- return null;
- }
-
- public virtual object VisitLambdaExpression(LambdaExpression lambdaExpression, object data) {
- Debug.Assert((lambdaExpression != null));
- Debug.Assert((lambdaExpression.Parameters != null));
- Debug.Assert((lambdaExpression.StatementBody != null));
- Debug.Assert((lambdaExpression.ExpressionBody != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitLabelStatement(LabelStatement labelStatement, object data) {
+ Debug.Assert((labelStatement != null));
+ return null;
+ }
+
+ public virtual object VisitLambdaExpression(LambdaExpression lambdaExpression, object data) {
+ Debug.Assert((lambdaExpression != null));
+ Debug.Assert((lambdaExpression.Parameters != null));
+ Debug.Assert((lambdaExpression.StatementBody != null));
+ Debug.Assert((lambdaExpression.ExpressionBody != null));
foreach (ParameterDeclarationExpression o in lambdaExpression.Parameters) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- lambdaExpression.StatementBody.AcceptVisitor(this, data);
- return lambdaExpression.ExpressionBody.AcceptVisitor(this, data);
- }
-
- public virtual object VisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data) {
- Debug.Assert((localVariableDeclaration != null));
- Debug.Assert((localVariableDeclaration.TypeReference != null));
- Debug.Assert((localVariableDeclaration.Variables != null));
- localVariableDeclaration.TypeReference.AcceptVisitor(this, data);
+ }
+ lambdaExpression.StatementBody.AcceptVisitor(this, data);
+ return lambdaExpression.ExpressionBody.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data) {
+ Debug.Assert((localVariableDeclaration != null));
+ Debug.Assert((localVariableDeclaration.TypeReference != null));
+ Debug.Assert((localVariableDeclaration.Variables != null));
+ localVariableDeclaration.TypeReference.AcceptVisitor(this, data);
foreach (VariableDeclaration o in localVariableDeclaration.Variables) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return null;
- }
-
- public virtual object VisitLockStatement(LockStatement lockStatement, object data) {
- Debug.Assert((lockStatement != null));
- Debug.Assert((lockStatement.LockExpression != null));
- Debug.Assert((lockStatement.EmbeddedStatement != null));
- lockStatement.LockExpression.AcceptVisitor(this, data);
- return lockStatement.EmbeddedStatement.AcceptVisitor(this, data);
- }
-
- public virtual object VisitMemberReferenceExpression(MemberReferenceExpression memberReferenceExpression, object data) {
- Debug.Assert((memberReferenceExpression != null));
- Debug.Assert((memberReferenceExpression.TargetObject != null));
- Debug.Assert((memberReferenceExpression.TypeArguments != null));
- memberReferenceExpression.TargetObject.AcceptVisitor(this, data);
+ }
+ return null;
+ }
+
+ public virtual object VisitLockStatement(LockStatement lockStatement, object data) {
+ Debug.Assert((lockStatement != null));
+ Debug.Assert((lockStatement.LockExpression != null));
+ Debug.Assert((lockStatement.EmbeddedStatement != null));
+ lockStatement.LockExpression.AcceptVisitor(this, data);
+ return lockStatement.EmbeddedStatement.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitMemberReferenceExpression(MemberReferenceExpression memberReferenceExpression, object data) {
+ Debug.Assert((memberReferenceExpression != null));
+ Debug.Assert((memberReferenceExpression.TargetObject != null));
+ Debug.Assert((memberReferenceExpression.TypeArguments != null));
+ memberReferenceExpression.TargetObject.AcceptVisitor(this, data);
foreach (TypeReference o in memberReferenceExpression.TypeArguments) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return null;
- }
-
- public virtual object VisitMethodDeclaration(MethodDeclaration methodDeclaration, object data) {
- Debug.Assert((methodDeclaration != null));
- Debug.Assert((methodDeclaration.Attributes != null));
- Debug.Assert((methodDeclaration.Parameters != null));
- Debug.Assert((methodDeclaration.InterfaceImplementations != null));
- Debug.Assert((methodDeclaration.TypeReference != null));
- Debug.Assert((methodDeclaration.Body != null));
- Debug.Assert((methodDeclaration.Templates != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitMethodDeclaration(MethodDeclaration methodDeclaration, object data) {
+ Debug.Assert((methodDeclaration != null));
+ Debug.Assert((methodDeclaration.Attributes != null));
+ Debug.Assert((methodDeclaration.Parameters != null));
+ Debug.Assert((methodDeclaration.InterfaceImplementations != null));
+ Debug.Assert((methodDeclaration.TypeReference != null));
+ Debug.Assert((methodDeclaration.Body != null));
+ Debug.Assert((methodDeclaration.Templates != null));
foreach (AttributeSection o in methodDeclaration.Attributes) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
+ }
foreach (ParameterDeclarationExpression o in methodDeclaration.Parameters) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
+ }
foreach (InterfaceImplementation o in methodDeclaration.InterfaceImplementations) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- methodDeclaration.TypeReference.AcceptVisitor(this, data);
- methodDeclaration.Body.AcceptVisitor(this, data);
+ }
+ methodDeclaration.TypeReference.AcceptVisitor(this, data);
+ methodDeclaration.Body.AcceptVisitor(this, data);
foreach (TemplateDefinition o in methodDeclaration.Templates) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return null;
- }
-
- public virtual object VisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression, object data) {
- Debug.Assert((namedArgumentExpression != null));
- Debug.Assert((namedArgumentExpression.Expression != null));
- return namedArgumentExpression.Expression.AcceptVisitor(this, data);
- }
-
- public virtual object VisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, object data) {
- Debug.Assert((namespaceDeclaration != null));
- return namespaceDeclaration.AcceptChildren(this, data);
- }
-
- public virtual object VisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression, object data) {
- Debug.Assert((objectCreateExpression != null));
- Debug.Assert((objectCreateExpression.CreateType != null));
- Debug.Assert((objectCreateExpression.Parameters != null));
- Debug.Assert((objectCreateExpression.ObjectInitializer != null));
- objectCreateExpression.CreateType.AcceptVisitor(this, data);
+ }
+ return null;
+ }
+
+ public virtual object VisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression, object data) {
+ Debug.Assert((namedArgumentExpression != null));
+ Debug.Assert((namedArgumentExpression.Expression != null));
+ return namedArgumentExpression.Expression.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, object data) {
+ Debug.Assert((namespaceDeclaration != null));
+ return namespaceDeclaration.AcceptChildren(this, data);
+ }
+
+ public virtual object VisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression, object data) {
+ Debug.Assert((objectCreateExpression != null));
+ Debug.Assert((objectCreateExpression.CreateType != null));
+ Debug.Assert((objectCreateExpression.Parameters != null));
+ Debug.Assert((objectCreateExpression.ObjectInitializer != null));
+ objectCreateExpression.CreateType.AcceptVisitor(this, data);
foreach (Expression o in objectCreateExpression.Parameters) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return objectCreateExpression.ObjectInitializer.AcceptVisitor(this, data);
- }
-
- public virtual object VisitOnErrorStatement(OnErrorStatement onErrorStatement, object data) {
- Debug.Assert((onErrorStatement != null));
- Debug.Assert((onErrorStatement.EmbeddedStatement != null));
- return onErrorStatement.EmbeddedStatement.AcceptVisitor(this, data);
- }
-
- public virtual object VisitOperatorDeclaration(OperatorDeclaration operatorDeclaration, object data) {
- Debug.Assert((operatorDeclaration != null));
- Debug.Assert((operatorDeclaration.Attributes != null));
- Debug.Assert((operatorDeclaration.Parameters != null));
- Debug.Assert((operatorDeclaration.InterfaceImplementations != null));
- Debug.Assert((operatorDeclaration.TypeReference != null));
- Debug.Assert((operatorDeclaration.Body != null));
- Debug.Assert((operatorDeclaration.Templates != null));
- Debug.Assert((operatorDeclaration.ReturnTypeAttributes != null));
+ }
+ return objectCreateExpression.ObjectInitializer.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitOnErrorStatement(OnErrorStatement onErrorStatement, object data) {
+ Debug.Assert((onErrorStatement != null));
+ Debug.Assert((onErrorStatement.EmbeddedStatement != null));
+ return onErrorStatement.EmbeddedStatement.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitOperatorDeclaration(OperatorDeclaration operatorDeclaration, object data) {
+ Debug.Assert((operatorDeclaration != null));
+ Debug.Assert((operatorDeclaration.Attributes != null));
+ Debug.Assert((operatorDeclaration.Parameters != null));
+ Debug.Assert((operatorDeclaration.InterfaceImplementations != null));
+ Debug.Assert((operatorDeclaration.TypeReference != null));
+ Debug.Assert((operatorDeclaration.Body != null));
+ Debug.Assert((operatorDeclaration.Templates != null));
+ Debug.Assert((operatorDeclaration.ReturnTypeAttributes != null));
foreach (AttributeSection o in operatorDeclaration.Attributes) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
+ }
foreach (ParameterDeclarationExpression o in operatorDeclaration.Parameters) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
+ }
foreach (InterfaceImplementation o in operatorDeclaration.InterfaceImplementations) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- operatorDeclaration.TypeReference.AcceptVisitor(this, data);
- operatorDeclaration.Body.AcceptVisitor(this, data);
+ }
+ operatorDeclaration.TypeReference.AcceptVisitor(this, data);
+ operatorDeclaration.Body.AcceptVisitor(this, data);
foreach (TemplateDefinition o in operatorDeclaration.Templates) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
+ }
foreach (AttributeSection o in operatorDeclaration.ReturnTypeAttributes) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return null;
- }
-
- public virtual object VisitOptionDeclaration(OptionDeclaration optionDeclaration, object data) {
- Debug.Assert((optionDeclaration != null));
- return null;
- }
-
- public virtual object VisitParameterDeclarationExpression(ParameterDeclarationExpression parameterDeclarationExpression, object data) {
- Debug.Assert((parameterDeclarationExpression != null));
- Debug.Assert((parameterDeclarationExpression.Attributes != null));
- Debug.Assert((parameterDeclarationExpression.TypeReference != null));
- Debug.Assert((parameterDeclarationExpression.DefaultValue != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitOptionDeclaration(OptionDeclaration optionDeclaration, object data) {
+ Debug.Assert((optionDeclaration != null));
+ return null;
+ }
+
+ public virtual object VisitParameterDeclarationExpression(ParameterDeclarationExpression parameterDeclarationExpression, object data) {
+ Debug.Assert((parameterDeclarationExpression != null));
+ Debug.Assert((parameterDeclarationExpression.Attributes != null));
+ Debug.Assert((parameterDeclarationExpression.TypeReference != null));
+ Debug.Assert((parameterDeclarationExpression.DefaultValue != null));
foreach (AttributeSection o in parameterDeclarationExpression.Attributes) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- parameterDeclarationExpression.TypeReference.AcceptVisitor(this, data);
- return parameterDeclarationExpression.DefaultValue.AcceptVisitor(this, data);
- }
-
- public virtual object VisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression, object data) {
- Debug.Assert((parenthesizedExpression != null));
- Debug.Assert((parenthesizedExpression.Expression != null));
- return parenthesizedExpression.Expression.AcceptVisitor(this, data);
- }
-
- public virtual object VisitPointerReferenceExpression(PointerReferenceExpression pointerReferenceExpression, object data) {
- Debug.Assert((pointerReferenceExpression != null));
- Debug.Assert((pointerReferenceExpression.TargetObject != null));
- Debug.Assert((pointerReferenceExpression.TypeArguments != null));
- pointerReferenceExpression.TargetObject.AcceptVisitor(this, data);
+ }
+ parameterDeclarationExpression.TypeReference.AcceptVisitor(this, data);
+ return parameterDeclarationExpression.DefaultValue.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression, object data) {
+ Debug.Assert((parenthesizedExpression != null));
+ Debug.Assert((parenthesizedExpression.Expression != null));
+ return parenthesizedExpression.Expression.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitPointerReferenceExpression(PointerReferenceExpression pointerReferenceExpression, object data) {
+ Debug.Assert((pointerReferenceExpression != null));
+ Debug.Assert((pointerReferenceExpression.TargetObject != null));
+ Debug.Assert((pointerReferenceExpression.TypeArguments != null));
+ pointerReferenceExpression.TargetObject.AcceptVisitor(this, data);
foreach (TypeReference o in pointerReferenceExpression.TypeArguments) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return null;
- }
-
- public virtual object VisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data) {
- Debug.Assert((primitiveExpression != null));
- return null;
- }
-
- public virtual object VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration, object data) {
- Debug.Assert((propertyDeclaration != null));
- Debug.Assert((propertyDeclaration.Attributes != null));
- Debug.Assert((propertyDeclaration.Parameters != null));
- Debug.Assert((propertyDeclaration.InterfaceImplementations != null));
- Debug.Assert((propertyDeclaration.TypeReference != null));
- Debug.Assert((propertyDeclaration.GetRegion != null));
- Debug.Assert((propertyDeclaration.SetRegion != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data) {
+ Debug.Assert((primitiveExpression != null));
+ return null;
+ }
+
+ public virtual object VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration, object data) {
+ Debug.Assert((propertyDeclaration != null));
+ Debug.Assert((propertyDeclaration.Attributes != null));
+ Debug.Assert((propertyDeclaration.Parameters != null));
+ Debug.Assert((propertyDeclaration.InterfaceImplementations != null));
+ Debug.Assert((propertyDeclaration.TypeReference != null));
+ Debug.Assert((propertyDeclaration.GetRegion != null));
+ Debug.Assert((propertyDeclaration.SetRegion != null));
foreach (AttributeSection o in propertyDeclaration.Attributes) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
+ }
foreach (ParameterDeclarationExpression o in propertyDeclaration.Parameters) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
+ }
foreach (InterfaceImplementation o in propertyDeclaration.InterfaceImplementations) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- propertyDeclaration.TypeReference.AcceptVisitor(this, data);
- propertyDeclaration.GetRegion.AcceptVisitor(this, data);
- return propertyDeclaration.SetRegion.AcceptVisitor(this, data);
- }
-
- public virtual object VisitPropertyGetRegion(PropertyGetRegion propertyGetRegion, object data) {
- Debug.Assert((propertyGetRegion != null));
- Debug.Assert((propertyGetRegion.Attributes != null));
- Debug.Assert((propertyGetRegion.Block != null));
+ }
+ propertyDeclaration.TypeReference.AcceptVisitor(this, data);
+ propertyDeclaration.GetRegion.AcceptVisitor(this, data);
+ return propertyDeclaration.SetRegion.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitPropertyGetRegion(PropertyGetRegion propertyGetRegion, object data) {
+ Debug.Assert((propertyGetRegion != null));
+ Debug.Assert((propertyGetRegion.Attributes != null));
+ Debug.Assert((propertyGetRegion.Block != null));
foreach (AttributeSection o in propertyGetRegion.Attributes) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return propertyGetRegion.Block.AcceptVisitor(this, data);
- }
-
- public virtual object VisitPropertySetRegion(PropertySetRegion propertySetRegion, object data) {
- Debug.Assert((propertySetRegion != null));
- Debug.Assert((propertySetRegion.Attributes != null));
- Debug.Assert((propertySetRegion.Block != null));
- Debug.Assert((propertySetRegion.Parameters != null));
+ }
+ return propertyGetRegion.Block.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitPropertySetRegion(PropertySetRegion propertySetRegion, object data) {
+ Debug.Assert((propertySetRegion != null));
+ Debug.Assert((propertySetRegion.Attributes != null));
+ Debug.Assert((propertySetRegion.Block != null));
+ Debug.Assert((propertySetRegion.Parameters != null));
foreach (AttributeSection o in propertySetRegion.Attributes) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- propertySetRegion.Block.AcceptVisitor(this, data);
+ }
+ propertySetRegion.Block.AcceptVisitor(this, data);
foreach (ParameterDeclarationExpression o in propertySetRegion.Parameters) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return null;
- }
-
- public virtual object VisitQueryExpression(QueryExpression queryExpression, object data) {
- Debug.Assert((queryExpression != null));
- Debug.Assert((queryExpression.FromClause != null));
- Debug.Assert((queryExpression.MiddleClauses != null));
- Debug.Assert((queryExpression.SelectOrGroupClause != null));
- queryExpression.FromClause.AcceptVisitor(this, data);
+ }
+ return null;
+ }
+
+ public virtual object VisitQueryExpression(QueryExpression queryExpression, object data) {
+ Debug.Assert((queryExpression != null));
+ Debug.Assert((queryExpression.FromClause != null));
+ Debug.Assert((queryExpression.MiddleClauses != null));
+ Debug.Assert((queryExpression.SelectOrGroupClause != null));
+ queryExpression.FromClause.AcceptVisitor(this, data);
foreach (QueryExpressionClause o in queryExpression.MiddleClauses) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return queryExpression.SelectOrGroupClause.AcceptVisitor(this, data);
- }
-
- public virtual object VisitQueryExpressionAggregateClause(QueryExpressionAggregateClause queryExpressionAggregateClause, object data) {
- Debug.Assert((queryExpressionAggregateClause != null));
- Debug.Assert((queryExpressionAggregateClause.FromClause != null));
- Debug.Assert((queryExpressionAggregateClause.MiddleClauses != null));
- Debug.Assert((queryExpressionAggregateClause.IntoVariables != null));
- queryExpressionAggregateClause.FromClause.AcceptVisitor(this, data);
+ }
+ return queryExpression.SelectOrGroupClause.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitQueryExpressionAggregateClause(QueryExpressionAggregateClause queryExpressionAggregateClause, object data) {
+ Debug.Assert((queryExpressionAggregateClause != null));
+ Debug.Assert((queryExpressionAggregateClause.FromClause != null));
+ Debug.Assert((queryExpressionAggregateClause.MiddleClauses != null));
+ Debug.Assert((queryExpressionAggregateClause.IntoVariables != null));
+ queryExpressionAggregateClause.FromClause.AcceptVisitor(this, data);
foreach (QueryExpressionClause o in queryExpressionAggregateClause.MiddleClauses) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
+ }
foreach (ExpressionRangeVariable o in queryExpressionAggregateClause.IntoVariables) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return null;
- }
-
- public virtual object VisitQueryExpressionDistinctClause(QueryExpressionDistinctClause queryExpressionDistinctClause, object data) {
- Debug.Assert((queryExpressionDistinctClause != null));
- return null;
- }
-
- public virtual object VisitQueryExpressionFromClause(QueryExpressionFromClause queryExpressionFromClause, object data) {
- Debug.Assert((queryExpressionFromClause != null));
- Debug.Assert((queryExpressionFromClause.Type != null));
- Debug.Assert((queryExpressionFromClause.InExpression != null));
- queryExpressionFromClause.Type.AcceptVisitor(this, data);
- return queryExpressionFromClause.InExpression.AcceptVisitor(this, data);
- }
-
- public virtual object VisitQueryExpressionGroupClause(QueryExpressionGroupClause queryExpressionGroupClause, object data) {
- Debug.Assert((queryExpressionGroupClause != null));
- Debug.Assert((queryExpressionGroupClause.Projection != null));
- Debug.Assert((queryExpressionGroupClause.GroupBy != null));
- queryExpressionGroupClause.Projection.AcceptVisitor(this, data);
- return queryExpressionGroupClause.GroupBy.AcceptVisitor(this, data);
- }
-
- public virtual object VisitQueryExpressionGroupJoinVBClause(QueryExpressionGroupJoinVBClause queryExpressionGroupJoinVBClause, object data) {
- Debug.Assert((queryExpressionGroupJoinVBClause != null));
- Debug.Assert((queryExpressionGroupJoinVBClause.JoinClause != null));
- Debug.Assert((queryExpressionGroupJoinVBClause.IntoVariables != null));
- queryExpressionGroupJoinVBClause.JoinClause.AcceptVisitor(this, data);
+ }
+ return null;
+ }
+
+ public virtual object VisitQueryExpressionDistinctClause(QueryExpressionDistinctClause queryExpressionDistinctClause, object data) {
+ Debug.Assert((queryExpressionDistinctClause != null));
+ return null;
+ }
+
+ public virtual object VisitQueryExpressionFromClause(QueryExpressionFromClause queryExpressionFromClause, object data) {
+ Debug.Assert((queryExpressionFromClause != null));
+ Debug.Assert((queryExpressionFromClause.Type != null));
+ Debug.Assert((queryExpressionFromClause.InExpression != null));
+ queryExpressionFromClause.Type.AcceptVisitor(this, data);
+ return queryExpressionFromClause.InExpression.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitQueryExpressionGroupClause(QueryExpressionGroupClause queryExpressionGroupClause, object data) {
+ Debug.Assert((queryExpressionGroupClause != null));
+ Debug.Assert((queryExpressionGroupClause.Projection != null));
+ Debug.Assert((queryExpressionGroupClause.GroupBy != null));
+ queryExpressionGroupClause.Projection.AcceptVisitor(this, data);
+ return queryExpressionGroupClause.GroupBy.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitQueryExpressionGroupJoinVBClause(QueryExpressionGroupJoinVBClause queryExpressionGroupJoinVBClause, object data) {
+ Debug.Assert((queryExpressionGroupJoinVBClause != null));
+ Debug.Assert((queryExpressionGroupJoinVBClause.JoinClause != null));
+ Debug.Assert((queryExpressionGroupJoinVBClause.IntoVariables != null));
+ queryExpressionGroupJoinVBClause.JoinClause.AcceptVisitor(this, data);
foreach (ExpressionRangeVariable o in queryExpressionGroupJoinVBClause.IntoVariables) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return null;
- }
-
- public virtual object VisitQueryExpressionGroupVBClause(QueryExpressionGroupVBClause queryExpressionGroupVBClause, object data) {
- Debug.Assert((queryExpressionGroupVBClause != null));
- Debug.Assert((queryExpressionGroupVBClause.GroupVariables != null));
- Debug.Assert((queryExpressionGroupVBClause.ByVariables != null));
- Debug.Assert((queryExpressionGroupVBClause.IntoVariables != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitQueryExpressionGroupVBClause(QueryExpressionGroupVBClause queryExpressionGroupVBClause, object data) {
+ Debug.Assert((queryExpressionGroupVBClause != null));
+ Debug.Assert((queryExpressionGroupVBClause.GroupVariables != null));
+ Debug.Assert((queryExpressionGroupVBClause.ByVariables != null));
+ Debug.Assert((queryExpressionGroupVBClause.IntoVariables != null));
foreach (ExpressionRangeVariable o in queryExpressionGroupVBClause.GroupVariables) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
+ }
foreach (ExpressionRangeVariable o in queryExpressionGroupVBClause.ByVariables) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
+ }
foreach (ExpressionRangeVariable o in queryExpressionGroupVBClause.IntoVariables) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return null;
- }
-
- public virtual object VisitQueryExpressionJoinClause(QueryExpressionJoinClause queryExpressionJoinClause, object data) {
- Debug.Assert((queryExpressionJoinClause != null));
- Debug.Assert((queryExpressionJoinClause.Type != null));
- Debug.Assert((queryExpressionJoinClause.InExpression != null));
- Debug.Assert((queryExpressionJoinClause.OnExpression != null));
- Debug.Assert((queryExpressionJoinClause.EqualsExpression != null));
- queryExpressionJoinClause.Type.AcceptVisitor(this, data);
- queryExpressionJoinClause.InExpression.AcceptVisitor(this, data);
- queryExpressionJoinClause.OnExpression.AcceptVisitor(this, data);
- return queryExpressionJoinClause.EqualsExpression.AcceptVisitor(this, data);
- }
-
- public virtual object VisitQueryExpressionJoinConditionVB(QueryExpressionJoinConditionVB queryExpressionJoinConditionVB, object data) {
- Debug.Assert((queryExpressionJoinConditionVB != null));
- Debug.Assert((queryExpressionJoinConditionVB.LeftSide != null));
- Debug.Assert((queryExpressionJoinConditionVB.RightSide != null));
- queryExpressionJoinConditionVB.LeftSide.AcceptVisitor(this, data);
- return queryExpressionJoinConditionVB.RightSide.AcceptVisitor(this, data);
- }
-
- public virtual object VisitQueryExpressionJoinVBClause(QueryExpressionJoinVBClause queryExpressionJoinVBClause, object data) {
- Debug.Assert((queryExpressionJoinVBClause != null));
- Debug.Assert((queryExpressionJoinVBClause.JoinVariable != null));
- Debug.Assert((queryExpressionJoinVBClause.SubJoin != null));
- Debug.Assert((queryExpressionJoinVBClause.Conditions != null));
- queryExpressionJoinVBClause.JoinVariable.AcceptVisitor(this, data);
- queryExpressionJoinVBClause.SubJoin.AcceptVisitor(this, data);
+ }
+ return null;
+ }
+
+ public virtual object VisitQueryExpressionJoinClause(QueryExpressionJoinClause queryExpressionJoinClause, object data) {
+ Debug.Assert((queryExpressionJoinClause != null));
+ Debug.Assert((queryExpressionJoinClause.Type != null));
+ Debug.Assert((queryExpressionJoinClause.InExpression != null));
+ Debug.Assert((queryExpressionJoinClause.OnExpression != null));
+ Debug.Assert((queryExpressionJoinClause.EqualsExpression != null));
+ queryExpressionJoinClause.Type.AcceptVisitor(this, data);
+ queryExpressionJoinClause.InExpression.AcceptVisitor(this, data);
+ queryExpressionJoinClause.OnExpression.AcceptVisitor(this, data);
+ return queryExpressionJoinClause.EqualsExpression.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitQueryExpressionJoinConditionVB(QueryExpressionJoinConditionVB queryExpressionJoinConditionVB, object data) {
+ Debug.Assert((queryExpressionJoinConditionVB != null));
+ Debug.Assert((queryExpressionJoinConditionVB.LeftSide != null));
+ Debug.Assert((queryExpressionJoinConditionVB.RightSide != null));
+ queryExpressionJoinConditionVB.LeftSide.AcceptVisitor(this, data);
+ return queryExpressionJoinConditionVB.RightSide.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitQueryExpressionJoinVBClause(QueryExpressionJoinVBClause queryExpressionJoinVBClause, object data) {
+ Debug.Assert((queryExpressionJoinVBClause != null));
+ Debug.Assert((queryExpressionJoinVBClause.JoinVariable != null));
+ Debug.Assert((queryExpressionJoinVBClause.SubJoin != null));
+ Debug.Assert((queryExpressionJoinVBClause.Conditions != null));
+ queryExpressionJoinVBClause.JoinVariable.AcceptVisitor(this, data);
+ queryExpressionJoinVBClause.SubJoin.AcceptVisitor(this, data);
foreach (QueryExpressionJoinConditionVB o in queryExpressionJoinVBClause.Conditions) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return null;
- }
-
- public virtual object VisitQueryExpressionLetClause(QueryExpressionLetClause queryExpressionLetClause, object data) {
- Debug.Assert((queryExpressionLetClause != null));
- Debug.Assert((queryExpressionLetClause.Expression != null));
- return queryExpressionLetClause.Expression.AcceptVisitor(this, data);
- }
-
- public virtual object VisitQueryExpressionLetVBClause(QueryExpressionLetVBClause queryExpressionLetVBClause, object data) {
- Debug.Assert((queryExpressionLetVBClause != null));
- Debug.Assert((queryExpressionLetVBClause.Variables != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitQueryExpressionLetClause(QueryExpressionLetClause queryExpressionLetClause, object data) {
+ Debug.Assert((queryExpressionLetClause != null));
+ Debug.Assert((queryExpressionLetClause.Expression != null));
+ return queryExpressionLetClause.Expression.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitQueryExpressionLetVBClause(QueryExpressionLetVBClause queryExpressionLetVBClause, object data) {
+ Debug.Assert((queryExpressionLetVBClause != null));
+ Debug.Assert((queryExpressionLetVBClause.Variables != null));
foreach (ExpressionRangeVariable o in queryExpressionLetVBClause.Variables) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return null;
- }
-
- public virtual object VisitQueryExpressionOrderClause(QueryExpressionOrderClause queryExpressionOrderClause, object data) {
- Debug.Assert((queryExpressionOrderClause != null));
- Debug.Assert((queryExpressionOrderClause.Orderings != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitQueryExpressionOrderClause(QueryExpressionOrderClause queryExpressionOrderClause, object data) {
+ Debug.Assert((queryExpressionOrderClause != null));
+ Debug.Assert((queryExpressionOrderClause.Orderings != null));
foreach (QueryExpressionOrdering o in queryExpressionOrderClause.Orderings) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return null;
- }
-
- public virtual object VisitQueryExpressionOrdering(QueryExpressionOrdering queryExpressionOrdering, object data) {
- Debug.Assert((queryExpressionOrdering != null));
- Debug.Assert((queryExpressionOrdering.Criteria != null));
- return queryExpressionOrdering.Criteria.AcceptVisitor(this, data);
- }
-
- public virtual object VisitQueryExpressionPartitionVBClause(QueryExpressionPartitionVBClause queryExpressionPartitionVBClause, object data) {
- Debug.Assert((queryExpressionPartitionVBClause != null));
- Debug.Assert((queryExpressionPartitionVBClause.Expression != null));
- return queryExpressionPartitionVBClause.Expression.AcceptVisitor(this, data);
- }
-
- public virtual object VisitQueryExpressionSelectClause(QueryExpressionSelectClause queryExpressionSelectClause, object data) {
- Debug.Assert((queryExpressionSelectClause != null));
- Debug.Assert((queryExpressionSelectClause.Projection != null));
- return queryExpressionSelectClause.Projection.AcceptVisitor(this, data);
- }
-
- public virtual object VisitQueryExpressionSelectVBClause(QueryExpressionSelectVBClause queryExpressionSelectVBClause, object data) {
- Debug.Assert((queryExpressionSelectVBClause != null));
- Debug.Assert((queryExpressionSelectVBClause.Variables != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitQueryExpressionOrdering(QueryExpressionOrdering queryExpressionOrdering, object data) {
+ Debug.Assert((queryExpressionOrdering != null));
+ Debug.Assert((queryExpressionOrdering.Criteria != null));
+ return queryExpressionOrdering.Criteria.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitQueryExpressionPartitionVBClause(QueryExpressionPartitionVBClause queryExpressionPartitionVBClause, object data) {
+ Debug.Assert((queryExpressionPartitionVBClause != null));
+ Debug.Assert((queryExpressionPartitionVBClause.Expression != null));
+ return queryExpressionPartitionVBClause.Expression.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitQueryExpressionSelectClause(QueryExpressionSelectClause queryExpressionSelectClause, object data) {
+ Debug.Assert((queryExpressionSelectClause != null));
+ Debug.Assert((queryExpressionSelectClause.Projection != null));
+ return queryExpressionSelectClause.Projection.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitQueryExpressionSelectVBClause(QueryExpressionSelectVBClause queryExpressionSelectVBClause, object data) {
+ Debug.Assert((queryExpressionSelectVBClause != null));
+ Debug.Assert((queryExpressionSelectVBClause.Variables != null));
foreach (ExpressionRangeVariable o in queryExpressionSelectVBClause.Variables) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return null;
- }
-
- public virtual object VisitQueryExpressionWhereClause(QueryExpressionWhereClause queryExpressionWhereClause, object data) {
- Debug.Assert((queryExpressionWhereClause != null));
- Debug.Assert((queryExpressionWhereClause.Condition != null));
- return queryExpressionWhereClause.Condition.AcceptVisitor(this, data);
- }
-
- public virtual object VisitRaiseEventStatement(RaiseEventStatement raiseEventStatement, object data) {
- Debug.Assert((raiseEventStatement != null));
- Debug.Assert((raiseEventStatement.Arguments != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitQueryExpressionWhereClause(QueryExpressionWhereClause queryExpressionWhereClause, object data) {
+ Debug.Assert((queryExpressionWhereClause != null));
+ Debug.Assert((queryExpressionWhereClause.Condition != null));
+ return queryExpressionWhereClause.Condition.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitRaiseEventStatement(RaiseEventStatement raiseEventStatement, object data) {
+ Debug.Assert((raiseEventStatement != null));
+ Debug.Assert((raiseEventStatement.Arguments != null));
foreach (Expression o in raiseEventStatement.Arguments) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return null;
- }
-
- public virtual object VisitReDimStatement(ReDimStatement reDimStatement, object data) {
- Debug.Assert((reDimStatement != null));
- Debug.Assert((reDimStatement.ReDimClauses != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitReDimStatement(ReDimStatement reDimStatement, object data) {
+ Debug.Assert((reDimStatement != null));
+ Debug.Assert((reDimStatement.ReDimClauses != null));
foreach (InvocationExpression o in reDimStatement.ReDimClauses) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return null;
- }
-
- public virtual object VisitRemoveHandlerStatement(RemoveHandlerStatement removeHandlerStatement, object data) {
- Debug.Assert((removeHandlerStatement != null));
- Debug.Assert((removeHandlerStatement.EventExpression != null));
- Debug.Assert((removeHandlerStatement.HandlerExpression != null));
- removeHandlerStatement.EventExpression.AcceptVisitor(this, data);
- return removeHandlerStatement.HandlerExpression.AcceptVisitor(this, data);
- }
-
- public virtual object VisitResumeStatement(ResumeStatement resumeStatement, object data) {
- Debug.Assert((resumeStatement != null));
- return null;
- }
-
- public virtual object VisitReturnStatement(ReturnStatement returnStatement, object data) {
- Debug.Assert((returnStatement != null));
- Debug.Assert((returnStatement.Expression != null));
- return returnStatement.Expression.AcceptVisitor(this, data);
- }
-
- public virtual object VisitSizeOfExpression(SizeOfExpression sizeOfExpression, object data) {
- Debug.Assert((sizeOfExpression != null));
- Debug.Assert((sizeOfExpression.TypeReference != null));
- return sizeOfExpression.TypeReference.AcceptVisitor(this, data);
- }
-
- public virtual object VisitStackAllocExpression(StackAllocExpression stackAllocExpression, object data) {
- Debug.Assert((stackAllocExpression != null));
- Debug.Assert((stackAllocExpression.TypeReference != null));
- Debug.Assert((stackAllocExpression.Expression != null));
- stackAllocExpression.TypeReference.AcceptVisitor(this, data);
- return stackAllocExpression.Expression.AcceptVisitor(this, data);
- }
-
- public virtual object VisitStopStatement(StopStatement stopStatement, object data) {
- Debug.Assert((stopStatement != null));
- return null;
- }
-
- public virtual object VisitSwitchSection(SwitchSection switchSection, object data) {
- Debug.Assert((switchSection != null));
- Debug.Assert((switchSection.SwitchLabels != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitRemoveHandlerStatement(RemoveHandlerStatement removeHandlerStatement, object data) {
+ Debug.Assert((removeHandlerStatement != null));
+ Debug.Assert((removeHandlerStatement.EventExpression != null));
+ Debug.Assert((removeHandlerStatement.HandlerExpression != null));
+ removeHandlerStatement.EventExpression.AcceptVisitor(this, data);
+ return removeHandlerStatement.HandlerExpression.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitResumeStatement(ResumeStatement resumeStatement, object data) {
+ Debug.Assert((resumeStatement != null));
+ return null;
+ }
+
+ public virtual object VisitReturnStatement(ReturnStatement returnStatement, object data) {
+ Debug.Assert((returnStatement != null));
+ Debug.Assert((returnStatement.Expression != null));
+ return returnStatement.Expression.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitSizeOfExpression(SizeOfExpression sizeOfExpression, object data) {
+ Debug.Assert((sizeOfExpression != null));
+ Debug.Assert((sizeOfExpression.TypeReference != null));
+ return sizeOfExpression.TypeReference.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitStackAllocExpression(StackAllocExpression stackAllocExpression, object data) {
+ Debug.Assert((stackAllocExpression != null));
+ Debug.Assert((stackAllocExpression.TypeReference != null));
+ Debug.Assert((stackAllocExpression.Expression != null));
+ stackAllocExpression.TypeReference.AcceptVisitor(this, data);
+ return stackAllocExpression.Expression.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitStopStatement(StopStatement stopStatement, object data) {
+ Debug.Assert((stopStatement != null));
+ return null;
+ }
+
+ public virtual object VisitSwitchSection(SwitchSection switchSection, object data) {
+ Debug.Assert((switchSection != null));
+ Debug.Assert((switchSection.SwitchLabels != null));
foreach (CaseLabel o in switchSection.SwitchLabels) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return switchSection.AcceptChildren(this, data);
- }
-
- public virtual object VisitSwitchStatement(SwitchStatement switchStatement, object data) {
- Debug.Assert((switchStatement != null));
- Debug.Assert((switchStatement.SwitchExpression != null));
- Debug.Assert((switchStatement.SwitchSections != null));
- switchStatement.SwitchExpression.AcceptVisitor(this, data);
+ }
+ return switchSection.AcceptChildren(this, data);
+ }
+
+ public virtual object VisitSwitchStatement(SwitchStatement switchStatement, object data) {
+ Debug.Assert((switchStatement != null));
+ Debug.Assert((switchStatement.SwitchExpression != null));
+ Debug.Assert((switchStatement.SwitchSections != null));
+ switchStatement.SwitchExpression.AcceptVisitor(this, data);
foreach (SwitchSection o in switchStatement.SwitchSections) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return null;
- }
-
- public virtual object VisitTemplateDefinition(TemplateDefinition templateDefinition, object data) {
- Debug.Assert((templateDefinition != null));
- Debug.Assert((templateDefinition.Attributes != null));
- Debug.Assert((templateDefinition.Bases != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitTemplateDefinition(TemplateDefinition templateDefinition, object data) {
+ Debug.Assert((templateDefinition != null));
+ Debug.Assert((templateDefinition.Attributes != null));
+ Debug.Assert((templateDefinition.Bases != null));
foreach (AttributeSection o in templateDefinition.Attributes) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
+ }
foreach (TypeReference o in templateDefinition.Bases) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return null;
- }
-
- public virtual object VisitThisReferenceExpression(ThisReferenceExpression thisReferenceExpression, object data) {
- Debug.Assert((thisReferenceExpression != null));
- return null;
- }
-
- public virtual object VisitThrowStatement(ThrowStatement throwStatement, object data) {
- Debug.Assert((throwStatement != null));
- Debug.Assert((throwStatement.Expression != null));
- return throwStatement.Expression.AcceptVisitor(this, data);
- }
-
- public virtual object VisitTryCatchStatement(TryCatchStatement tryCatchStatement, object data) {
- Debug.Assert((tryCatchStatement != null));
- Debug.Assert((tryCatchStatement.StatementBlock != null));
- Debug.Assert((tryCatchStatement.CatchClauses != null));
- Debug.Assert((tryCatchStatement.FinallyBlock != null));
- tryCatchStatement.StatementBlock.AcceptVisitor(this, data);
+ }
+ return null;
+ }
+
+ public virtual object VisitThisReferenceExpression(ThisReferenceExpression thisReferenceExpression, object data) {
+ Debug.Assert((thisReferenceExpression != null));
+ return null;
+ }
+
+ public virtual object VisitThrowStatement(ThrowStatement throwStatement, object data) {
+ Debug.Assert((throwStatement != null));
+ Debug.Assert((throwStatement.Expression != null));
+ return throwStatement.Expression.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitTryCatchStatement(TryCatchStatement tryCatchStatement, object data) {
+ Debug.Assert((tryCatchStatement != null));
+ Debug.Assert((tryCatchStatement.StatementBlock != null));
+ Debug.Assert((tryCatchStatement.CatchClauses != null));
+ Debug.Assert((tryCatchStatement.FinallyBlock != null));
+ tryCatchStatement.StatementBlock.AcceptVisitor(this, data);
foreach (CatchClause o in tryCatchStatement.CatchClauses) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return tryCatchStatement.FinallyBlock.AcceptVisitor(this, data);
- }
-
- public virtual object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data) {
- Debug.Assert((typeDeclaration != null));
- Debug.Assert((typeDeclaration.Attributes != null));
- Debug.Assert((typeDeclaration.BaseTypes != null));
- Debug.Assert((typeDeclaration.Templates != null));
+ }
+ return tryCatchStatement.FinallyBlock.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data) {
+ Debug.Assert((typeDeclaration != null));
+ Debug.Assert((typeDeclaration.Attributes != null));
+ Debug.Assert((typeDeclaration.BaseTypes != null));
+ Debug.Assert((typeDeclaration.Templates != null));
foreach (AttributeSection o in typeDeclaration.Attributes) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
+ }
foreach (TypeReference o in typeDeclaration.BaseTypes) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
+ }
foreach (TemplateDefinition o in typeDeclaration.Templates) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return typeDeclaration.AcceptChildren(this, data);
- }
-
- public virtual object VisitTypeOfExpression(TypeOfExpression typeOfExpression, object data) {
- Debug.Assert((typeOfExpression != null));
- Debug.Assert((typeOfExpression.TypeReference != null));
- return typeOfExpression.TypeReference.AcceptVisitor(this, data);
- }
-
- public virtual object VisitTypeOfIsExpression(TypeOfIsExpression typeOfIsExpression, object data) {
- Debug.Assert((typeOfIsExpression != null));
- Debug.Assert((typeOfIsExpression.Expression != null));
- Debug.Assert((typeOfIsExpression.TypeReference != null));
- typeOfIsExpression.Expression.AcceptVisitor(this, data);
- return typeOfIsExpression.TypeReference.AcceptVisitor(this, data);
- }
-
- public virtual object VisitTypeReference(TypeReference typeReference, object data) {
- Debug.Assert((typeReference != null));
- Debug.Assert((typeReference.GenericTypes != null));
+ }
+ return typeDeclaration.AcceptChildren(this, data);
+ }
+
+ public virtual object VisitTypeOfExpression(TypeOfExpression typeOfExpression, object data) {
+ Debug.Assert((typeOfExpression != null));
+ Debug.Assert((typeOfExpression.TypeReference != null));
+ return typeOfExpression.TypeReference.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitTypeOfIsExpression(TypeOfIsExpression typeOfIsExpression, object data) {
+ Debug.Assert((typeOfIsExpression != null));
+ Debug.Assert((typeOfIsExpression.Expression != null));
+ Debug.Assert((typeOfIsExpression.TypeReference != null));
+ typeOfIsExpression.Expression.AcceptVisitor(this, data);
+ return typeOfIsExpression.TypeReference.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitTypeReference(TypeReference typeReference, object data) {
+ Debug.Assert((typeReference != null));
+ Debug.Assert((typeReference.GenericTypes != null));
foreach (TypeReference o in typeReference.GenericTypes) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return null;
- }
-
- public virtual object VisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, object data) {
- Debug.Assert((typeReferenceExpression != null));
- Debug.Assert((typeReferenceExpression.TypeReference != null));
- return typeReferenceExpression.TypeReference.AcceptVisitor(this, data);
- }
-
- public virtual object VisitUnaryOperatorExpression(UnaryOperatorExpression unaryOperatorExpression, object data) {
- Debug.Assert((unaryOperatorExpression != null));
- Debug.Assert((unaryOperatorExpression.Expression != null));
- return unaryOperatorExpression.Expression.AcceptVisitor(this, data);
- }
-
- public virtual object VisitUncheckedExpression(UncheckedExpression uncheckedExpression, object data) {
- Debug.Assert((uncheckedExpression != null));
- Debug.Assert((uncheckedExpression.Expression != null));
- return uncheckedExpression.Expression.AcceptVisitor(this, data);
- }
-
- public virtual object VisitUncheckedStatement(UncheckedStatement uncheckedStatement, object data) {
- Debug.Assert((uncheckedStatement != null));
- Debug.Assert((uncheckedStatement.Block != null));
- return uncheckedStatement.Block.AcceptVisitor(this, data);
- }
-
- public virtual object VisitUnsafeStatement(UnsafeStatement unsafeStatement, object data) {
- Debug.Assert((unsafeStatement != null));
- Debug.Assert((unsafeStatement.Block != null));
- return unsafeStatement.Block.AcceptVisitor(this, data);
- }
-
- public virtual object VisitUsing(Using @using, object data) {
- Debug.Assert((@using != null));
- Debug.Assert((@using.Alias != null));
- return @using.Alias.AcceptVisitor(this, data);
- }
-
- public virtual object VisitUsingDeclaration(UsingDeclaration usingDeclaration, object data) {
- Debug.Assert((usingDeclaration != null));
- Debug.Assert((usingDeclaration.Usings != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, object data) {
+ Debug.Assert((typeReferenceExpression != null));
+ Debug.Assert((typeReferenceExpression.TypeReference != null));
+ return typeReferenceExpression.TypeReference.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitUnaryOperatorExpression(UnaryOperatorExpression unaryOperatorExpression, object data) {
+ Debug.Assert((unaryOperatorExpression != null));
+ Debug.Assert((unaryOperatorExpression.Expression != null));
+ return unaryOperatorExpression.Expression.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitUncheckedExpression(UncheckedExpression uncheckedExpression, object data) {
+ Debug.Assert((uncheckedExpression != null));
+ Debug.Assert((uncheckedExpression.Expression != null));
+ return uncheckedExpression.Expression.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitUncheckedStatement(UncheckedStatement uncheckedStatement, object data) {
+ Debug.Assert((uncheckedStatement != null));
+ Debug.Assert((uncheckedStatement.Block != null));
+ return uncheckedStatement.Block.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitUnsafeStatement(UnsafeStatement unsafeStatement, object data) {
+ Debug.Assert((unsafeStatement != null));
+ Debug.Assert((unsafeStatement.Block != null));
+ return unsafeStatement.Block.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitUsing(Using @using, object data) {
+ Debug.Assert((@using != null));
+ Debug.Assert((@using.Alias != null));
+ return @using.Alias.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitUsingDeclaration(UsingDeclaration usingDeclaration, object data) {
+ Debug.Assert((usingDeclaration != null));
+ Debug.Assert((usingDeclaration.Usings != null));
foreach (Using o in usingDeclaration.Usings) {
Debug.Assert(o != null);
o.AcceptVisitor(this, data);
- }
- return null;
- }
-
- public virtual object VisitUsingStatement(UsingStatement usingStatement, object data) {
- Debug.Assert((usingStatement != null));
- Debug.Assert((usingStatement.ResourceAcquisition != null));
- Debug.Assert((usingStatement.EmbeddedStatement != null));
- usingStatement.ResourceAcquisition.AcceptVisitor(this, data);
- return usingStatement.EmbeddedStatement.AcceptVisitor(this, data);
- }
-
- public virtual object VisitVariableDeclaration(VariableDeclaration variableDeclaration, object data) {
- Debug.Assert((variableDeclaration != null));
- Debug.Assert((variableDeclaration.Initializer != null));
- Debug.Assert((variableDeclaration.TypeReference != null));
- Debug.Assert((variableDeclaration.FixedArrayInitialization != null));
- variableDeclaration.Initializer.AcceptVisitor(this, data);
- variableDeclaration.TypeReference.AcceptVisitor(this, data);
- return variableDeclaration.FixedArrayInitialization.AcceptVisitor(this, data);
- }
-
- public virtual object VisitWithStatement(WithStatement withStatement, object data) {
- Debug.Assert((withStatement != null));
- Debug.Assert((withStatement.Expression != null));
- Debug.Assert((withStatement.Body != null));
- withStatement.Expression.AcceptVisitor(this, data);
- return withStatement.Body.AcceptVisitor(this, data);
- }
-
- public virtual object VisitYieldStatement(YieldStatement yieldStatement, object data) {
- Debug.Assert((yieldStatement != null));
- Debug.Assert((yieldStatement.Statement != null));
- return yieldStatement.Statement.AcceptVisitor(this, data);
- }
- }
-}
+ }
+ return null;
+ }
+
+ public virtual object VisitUsingStatement(UsingStatement usingStatement, object data) {
+ Debug.Assert((usingStatement != null));
+ Debug.Assert((usingStatement.ResourceAcquisition != null));
+ Debug.Assert((usingStatement.EmbeddedStatement != null));
+ usingStatement.ResourceAcquisition.AcceptVisitor(this, data);
+ return usingStatement.EmbeddedStatement.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitVariableDeclaration(VariableDeclaration variableDeclaration, object data) {
+ Debug.Assert((variableDeclaration != null));
+ Debug.Assert((variableDeclaration.Initializer != null));
+ Debug.Assert((variableDeclaration.TypeReference != null));
+ Debug.Assert((variableDeclaration.FixedArrayInitialization != null));
+ variableDeclaration.Initializer.AcceptVisitor(this, data);
+ variableDeclaration.TypeReference.AcceptVisitor(this, data);
+ return variableDeclaration.FixedArrayInitialization.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitWithStatement(WithStatement withStatement, object data) {
+ Debug.Assert((withStatement != null));
+ Debug.Assert((withStatement.Expression != null));
+ Debug.Assert((withStatement.Body != null));
+ withStatement.Expression.AcceptVisitor(this, data);
+ return withStatement.Body.AcceptVisitor(this, data);
+ }
+
+ public virtual object VisitYieldStatement(YieldStatement yieldStatement, object data) {
+ Debug.Assert((yieldStatement != null));
+ Debug.Assert((yieldStatement.Statement != null));
+ return yieldStatement.Statement.AcceptVisitor(this, data);
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Visitors/AbstractAstTransformer.cs b/main/contrib/NRefactory/Project/Src/Visitors/AbstractAstTransformer.cs
index 91fefd2761..5cfd9f34c6 100644
--- a/main/contrib/NRefactory/Project/Src/Visitors/AbstractAstTransformer.cs
+++ b/main/contrib/NRefactory/Project/Src/Visitors/AbstractAstTransformer.cs
@@ -1,69 +1,69 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:2.0.50727.3053
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace ICSharpCode.NRefactory.Visitors {
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using ICSharpCode.NRefactory.Ast;
-
-
- /// <summary>
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.3053
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace ICSharpCode.NRefactory.Visitors {
+ using System;
+ using System.Collections.Generic;
+ using System.Diagnostics;
+ using ICSharpCode.NRefactory.Ast;
+
+
+ /// <summary>
/// The AbstractAstTransformer will iterate through the whole AST,
/// just like the AbstractAstVisitor. However, the AbstractAstTransformer allows
/// you to modify the AST at the same time: It does not use 'foreach' internally,
/// so you can add members to collections of parents of the current node (but
/// you cannot insert or delete items as that will make the index used invalid).
/// You can use the methods ReplaceCurrentNode and RemoveCurrentNode to replace
- /// or remove the current node, totally independent from the type of the parent node.
- /// </summary>
- public abstract class AbstractAstTransformer : IAstVisitor {
-
- protected Stack<INode> nodeStack = new Stack<INode>();
-
- public void ReplaceCurrentNode(INode newNode) {
- nodeStack.Pop();
- nodeStack.Push(newNode);
- }
-
- public void RemoveCurrentNode() {
- nodeStack.Pop();
- nodeStack.Push(null);
- }
-
- public virtual object VisitAddHandlerStatement(AddHandlerStatement addHandlerStatement, object data) {
- Debug.Assert((addHandlerStatement != null));
- Debug.Assert((addHandlerStatement.EventExpression != null));
- Debug.Assert((addHandlerStatement.HandlerExpression != null));
- nodeStack.Push(addHandlerStatement.EventExpression);
- addHandlerStatement.EventExpression.AcceptVisitor(this, data);
- addHandlerStatement.EventExpression = ((Expression)(nodeStack.Pop()));
- nodeStack.Push(addHandlerStatement.HandlerExpression);
- addHandlerStatement.HandlerExpression.AcceptVisitor(this, data);
- addHandlerStatement.HandlerExpression = ((Expression)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitAddressOfExpression(AddressOfExpression addressOfExpression, object data) {
- Debug.Assert((addressOfExpression != null));
- Debug.Assert((addressOfExpression.Expression != null));
- nodeStack.Push(addressOfExpression.Expression);
- addressOfExpression.Expression.AcceptVisitor(this, data);
- addressOfExpression.Expression = ((Expression)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitAnonymousMethodExpression(AnonymousMethodExpression anonymousMethodExpression, object data) {
- Debug.Assert((anonymousMethodExpression != null));
- Debug.Assert((anonymousMethodExpression.Parameters != null));
- Debug.Assert((anonymousMethodExpression.Body != null));
+ /// or remove the current node, totally independent from the type of the parent node.
+ /// </summary>
+ public abstract class AbstractAstTransformer : IAstVisitor {
+
+ protected Stack<INode> nodeStack = new Stack<INode>();
+
+ public void ReplaceCurrentNode(INode newNode) {
+ nodeStack.Pop();
+ nodeStack.Push(newNode);
+ }
+
+ public void RemoveCurrentNode() {
+ nodeStack.Pop();
+ nodeStack.Push(null);
+ }
+
+ public virtual object VisitAddHandlerStatement(AddHandlerStatement addHandlerStatement, object data) {
+ Debug.Assert((addHandlerStatement != null));
+ Debug.Assert((addHandlerStatement.EventExpression != null));
+ Debug.Assert((addHandlerStatement.HandlerExpression != null));
+ nodeStack.Push(addHandlerStatement.EventExpression);
+ addHandlerStatement.EventExpression.AcceptVisitor(this, data);
+ addHandlerStatement.EventExpression = ((Expression)(nodeStack.Pop()));
+ nodeStack.Push(addHandlerStatement.HandlerExpression);
+ addHandlerStatement.HandlerExpression.AcceptVisitor(this, data);
+ addHandlerStatement.HandlerExpression = ((Expression)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitAddressOfExpression(AddressOfExpression addressOfExpression, object data) {
+ Debug.Assert((addressOfExpression != null));
+ Debug.Assert((addressOfExpression.Expression != null));
+ nodeStack.Push(addressOfExpression.Expression);
+ addressOfExpression.Expression.AcceptVisitor(this, data);
+ addressOfExpression.Expression = ((Expression)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitAnonymousMethodExpression(AnonymousMethodExpression anonymousMethodExpression, object data) {
+ Debug.Assert((anonymousMethodExpression != null));
+ Debug.Assert((anonymousMethodExpression.Parameters != null));
+ Debug.Assert((anonymousMethodExpression.Body != null));
for (int i = 0; i < anonymousMethodExpression.Parameters.Count; i++) {
ParameterDeclarationExpression o = anonymousMethodExpression.Parameters[i];
Debug.Assert(o != null);
@@ -74,21 +74,21 @@ namespace ICSharpCode.NRefactory.Visitors {
anonymousMethodExpression.Parameters.RemoveAt(i--);
else
anonymousMethodExpression.Parameters[i] = o;
- }
- nodeStack.Push(anonymousMethodExpression.Body);
- anonymousMethodExpression.Body.AcceptVisitor(this, data);
- anonymousMethodExpression.Body = ((BlockStatement)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object data) {
- Debug.Assert((arrayCreateExpression != null));
- Debug.Assert((arrayCreateExpression.CreateType != null));
- Debug.Assert((arrayCreateExpression.Arguments != null));
- Debug.Assert((arrayCreateExpression.ArrayInitializer != null));
- nodeStack.Push(arrayCreateExpression.CreateType);
- arrayCreateExpression.CreateType.AcceptVisitor(this, data);
- arrayCreateExpression.CreateType = ((TypeReference)(nodeStack.Pop()));
+ }
+ nodeStack.Push(anonymousMethodExpression.Body);
+ anonymousMethodExpression.Body.AcceptVisitor(this, data);
+ anonymousMethodExpression.Body = ((BlockStatement)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object data) {
+ Debug.Assert((arrayCreateExpression != null));
+ Debug.Assert((arrayCreateExpression.CreateType != null));
+ Debug.Assert((arrayCreateExpression.Arguments != null));
+ Debug.Assert((arrayCreateExpression.ArrayInitializer != null));
+ nodeStack.Push(arrayCreateExpression.CreateType);
+ arrayCreateExpression.CreateType.AcceptVisitor(this, data);
+ arrayCreateExpression.CreateType = ((TypeReference)(nodeStack.Pop()));
for (int i = 0; i < arrayCreateExpression.Arguments.Count; i++) {
Expression o = arrayCreateExpression.Arguments[i];
Debug.Assert(o != null);
@@ -99,30 +99,30 @@ namespace ICSharpCode.NRefactory.Visitors {
arrayCreateExpression.Arguments.RemoveAt(i--);
else
arrayCreateExpression.Arguments[i] = o;
- }
- nodeStack.Push(arrayCreateExpression.ArrayInitializer);
- arrayCreateExpression.ArrayInitializer.AcceptVisitor(this, data);
- arrayCreateExpression.ArrayInitializer = ((CollectionInitializerExpression)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitAssignmentExpression(AssignmentExpression assignmentExpression, object data) {
- Debug.Assert((assignmentExpression != null));
- Debug.Assert((assignmentExpression.Left != null));
- Debug.Assert((assignmentExpression.Right != null));
- nodeStack.Push(assignmentExpression.Left);
- assignmentExpression.Left.AcceptVisitor(this, data);
- assignmentExpression.Left = ((Expression)(nodeStack.Pop()));
- nodeStack.Push(assignmentExpression.Right);
- assignmentExpression.Right.AcceptVisitor(this, data);
- assignmentExpression.Right = ((Expression)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitAttribute(ICSharpCode.NRefactory.Ast.Attribute attribute, object data) {
- Debug.Assert((attribute != null));
- Debug.Assert((attribute.PositionalArguments != null));
- Debug.Assert((attribute.NamedArguments != null));
+ }
+ nodeStack.Push(arrayCreateExpression.ArrayInitializer);
+ arrayCreateExpression.ArrayInitializer.AcceptVisitor(this, data);
+ arrayCreateExpression.ArrayInitializer = ((CollectionInitializerExpression)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitAssignmentExpression(AssignmentExpression assignmentExpression, object data) {
+ Debug.Assert((assignmentExpression != null));
+ Debug.Assert((assignmentExpression.Left != null));
+ Debug.Assert((assignmentExpression.Right != null));
+ nodeStack.Push(assignmentExpression.Left);
+ assignmentExpression.Left.AcceptVisitor(this, data);
+ assignmentExpression.Left = ((Expression)(nodeStack.Pop()));
+ nodeStack.Push(assignmentExpression.Right);
+ assignmentExpression.Right.AcceptVisitor(this, data);
+ assignmentExpression.Right = ((Expression)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitAttribute(ICSharpCode.NRefactory.Ast.Attribute attribute, object data) {
+ Debug.Assert((attribute != null));
+ Debug.Assert((attribute.PositionalArguments != null));
+ Debug.Assert((attribute.NamedArguments != null));
for (int i = 0; i < attribute.PositionalArguments.Count; i++) {
Expression o = attribute.PositionalArguments[i];
Debug.Assert(o != null);
@@ -133,7 +133,7 @@ namespace ICSharpCode.NRefactory.Visitors {
attribute.PositionalArguments.RemoveAt(i--);
else
attribute.PositionalArguments[i] = o;
- }
+ }
for (int i = 0; i < attribute.NamedArguments.Count; i++) {
NamedArgumentExpression o = attribute.NamedArguments[i];
Debug.Assert(o != null);
@@ -144,13 +144,13 @@ namespace ICSharpCode.NRefactory.Visitors {
attribute.NamedArguments.RemoveAt(i--);
else
attribute.NamedArguments[i] = o;
- }
- return null;
- }
-
- public virtual object VisitAttributeSection(AttributeSection attributeSection, object data) {
- Debug.Assert((attributeSection != null));
- Debug.Assert((attributeSection.Attributes != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitAttributeSection(AttributeSection attributeSection, object data) {
+ Debug.Assert((attributeSection != null));
+ Debug.Assert((attributeSection.Attributes != null));
for (int i = 0; i < attributeSection.Attributes.Count; i++) {
ICSharpCode.NRefactory.Ast.Attribute o = attributeSection.Attributes[i];
Debug.Assert(o != null);
@@ -161,30 +161,30 @@ namespace ICSharpCode.NRefactory.Visitors {
attributeSection.Attributes.RemoveAt(i--);
else
attributeSection.Attributes[i] = o;
- }
- return null;
- }
-
- public virtual object VisitBaseReferenceExpression(BaseReferenceExpression baseReferenceExpression, object data) {
- Debug.Assert((baseReferenceExpression != null));
- return null;
- }
-
- public virtual object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data) {
- Debug.Assert((binaryOperatorExpression != null));
- Debug.Assert((binaryOperatorExpression.Left != null));
- Debug.Assert((binaryOperatorExpression.Right != null));
- nodeStack.Push(binaryOperatorExpression.Left);
- binaryOperatorExpression.Left.AcceptVisitor(this, data);
- binaryOperatorExpression.Left = ((Expression)(nodeStack.Pop()));
- nodeStack.Push(binaryOperatorExpression.Right);
- binaryOperatorExpression.Right.AcceptVisitor(this, data);
- binaryOperatorExpression.Right = ((Expression)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitBlockStatement(BlockStatement blockStatement, object data) {
- Debug.Assert((blockStatement != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitBaseReferenceExpression(BaseReferenceExpression baseReferenceExpression, object data) {
+ Debug.Assert((baseReferenceExpression != null));
+ return null;
+ }
+
+ public virtual object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data) {
+ Debug.Assert((binaryOperatorExpression != null));
+ Debug.Assert((binaryOperatorExpression.Left != null));
+ Debug.Assert((binaryOperatorExpression.Right != null));
+ nodeStack.Push(binaryOperatorExpression.Left);
+ binaryOperatorExpression.Left.AcceptVisitor(this, data);
+ binaryOperatorExpression.Left = ((Expression)(nodeStack.Pop()));
+ nodeStack.Push(binaryOperatorExpression.Right);
+ binaryOperatorExpression.Right.AcceptVisitor(this, data);
+ binaryOperatorExpression.Right = ((Expression)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitBlockStatement(BlockStatement blockStatement, object data) {
+ Debug.Assert((blockStatement != null));
for (int i = 0; i < blockStatement.Children.Count; i++) {
INode o = blockStatement.Children[i];
Debug.Assert(o != null);
@@ -195,84 +195,84 @@ namespace ICSharpCode.NRefactory.Visitors {
blockStatement.Children.RemoveAt(i--);
else
blockStatement.Children[i] = o;
- }
- return null;
- }
-
- public virtual object VisitBreakStatement(BreakStatement breakStatement, object data) {
- Debug.Assert((breakStatement != null));
- return null;
- }
-
- public virtual object VisitCaseLabel(CaseLabel caseLabel, object data) {
- Debug.Assert((caseLabel != null));
- Debug.Assert((caseLabel.Label != null));
- Debug.Assert((caseLabel.ToExpression != null));
- nodeStack.Push(caseLabel.Label);
- caseLabel.Label.AcceptVisitor(this, data);
- caseLabel.Label = ((Expression)(nodeStack.Pop()));
- nodeStack.Push(caseLabel.ToExpression);
- caseLabel.ToExpression.AcceptVisitor(this, data);
- caseLabel.ToExpression = ((Expression)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitCastExpression(CastExpression castExpression, object data) {
- Debug.Assert((castExpression != null));
- Debug.Assert((castExpression.CastTo != null));
- Debug.Assert((castExpression.Expression != null));
- nodeStack.Push(castExpression.CastTo);
- castExpression.CastTo.AcceptVisitor(this, data);
- castExpression.CastTo = ((TypeReference)(nodeStack.Pop()));
- nodeStack.Push(castExpression.Expression);
- castExpression.Expression.AcceptVisitor(this, data);
- castExpression.Expression = ((Expression)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitCatchClause(CatchClause catchClause, object data) {
- Debug.Assert((catchClause != null));
- Debug.Assert((catchClause.TypeReference != null));
- Debug.Assert((catchClause.StatementBlock != null));
- Debug.Assert((catchClause.Condition != null));
- nodeStack.Push(catchClause.TypeReference);
- catchClause.TypeReference.AcceptVisitor(this, data);
- catchClause.TypeReference = ((TypeReference)(nodeStack.Pop()));
- nodeStack.Push(catchClause.StatementBlock);
- catchClause.StatementBlock.AcceptVisitor(this, data);
- catchClause.StatementBlock = ((Statement)(nodeStack.Pop()));
- nodeStack.Push(catchClause.Condition);
- catchClause.Condition.AcceptVisitor(this, data);
- catchClause.Condition = ((Expression)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitCheckedExpression(CheckedExpression checkedExpression, object data) {
- Debug.Assert((checkedExpression != null));
- Debug.Assert((checkedExpression.Expression != null));
- nodeStack.Push(checkedExpression.Expression);
- checkedExpression.Expression.AcceptVisitor(this, data);
- checkedExpression.Expression = ((Expression)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitCheckedStatement(CheckedStatement checkedStatement, object data) {
- Debug.Assert((checkedStatement != null));
- Debug.Assert((checkedStatement.Block != null));
- nodeStack.Push(checkedStatement.Block);
- checkedStatement.Block.AcceptVisitor(this, data);
- checkedStatement.Block = ((Statement)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitClassReferenceExpression(ClassReferenceExpression classReferenceExpression, object data) {
- Debug.Assert((classReferenceExpression != null));
- return null;
- }
-
- public virtual object VisitCollectionInitializerExpression(CollectionInitializerExpression collectionInitializerExpression, object data) {
- Debug.Assert((collectionInitializerExpression != null));
- Debug.Assert((collectionInitializerExpression.CreateExpressions != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitBreakStatement(BreakStatement breakStatement, object data) {
+ Debug.Assert((breakStatement != null));
+ return null;
+ }
+
+ public virtual object VisitCaseLabel(CaseLabel caseLabel, object data) {
+ Debug.Assert((caseLabel != null));
+ Debug.Assert((caseLabel.Label != null));
+ Debug.Assert((caseLabel.ToExpression != null));
+ nodeStack.Push(caseLabel.Label);
+ caseLabel.Label.AcceptVisitor(this, data);
+ caseLabel.Label = ((Expression)(nodeStack.Pop()));
+ nodeStack.Push(caseLabel.ToExpression);
+ caseLabel.ToExpression.AcceptVisitor(this, data);
+ caseLabel.ToExpression = ((Expression)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitCastExpression(CastExpression castExpression, object data) {
+ Debug.Assert((castExpression != null));
+ Debug.Assert((castExpression.CastTo != null));
+ Debug.Assert((castExpression.Expression != null));
+ nodeStack.Push(castExpression.CastTo);
+ castExpression.CastTo.AcceptVisitor(this, data);
+ castExpression.CastTo = ((TypeReference)(nodeStack.Pop()));
+ nodeStack.Push(castExpression.Expression);
+ castExpression.Expression.AcceptVisitor(this, data);
+ castExpression.Expression = ((Expression)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitCatchClause(CatchClause catchClause, object data) {
+ Debug.Assert((catchClause != null));
+ Debug.Assert((catchClause.TypeReference != null));
+ Debug.Assert((catchClause.StatementBlock != null));
+ Debug.Assert((catchClause.Condition != null));
+ nodeStack.Push(catchClause.TypeReference);
+ catchClause.TypeReference.AcceptVisitor(this, data);
+ catchClause.TypeReference = ((TypeReference)(nodeStack.Pop()));
+ nodeStack.Push(catchClause.StatementBlock);
+ catchClause.StatementBlock.AcceptVisitor(this, data);
+ catchClause.StatementBlock = ((Statement)(nodeStack.Pop()));
+ nodeStack.Push(catchClause.Condition);
+ catchClause.Condition.AcceptVisitor(this, data);
+ catchClause.Condition = ((Expression)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitCheckedExpression(CheckedExpression checkedExpression, object data) {
+ Debug.Assert((checkedExpression != null));
+ Debug.Assert((checkedExpression.Expression != null));
+ nodeStack.Push(checkedExpression.Expression);
+ checkedExpression.Expression.AcceptVisitor(this, data);
+ checkedExpression.Expression = ((Expression)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitCheckedStatement(CheckedStatement checkedStatement, object data) {
+ Debug.Assert((checkedStatement != null));
+ Debug.Assert((checkedStatement.Block != null));
+ nodeStack.Push(checkedStatement.Block);
+ checkedStatement.Block.AcceptVisitor(this, data);
+ checkedStatement.Block = ((Statement)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitClassReferenceExpression(ClassReferenceExpression classReferenceExpression, object data) {
+ Debug.Assert((classReferenceExpression != null));
+ return null;
+ }
+
+ public virtual object VisitCollectionInitializerExpression(CollectionInitializerExpression collectionInitializerExpression, object data) {
+ Debug.Assert((collectionInitializerExpression != null));
+ Debug.Assert((collectionInitializerExpression.CreateExpressions != null));
for (int i = 0; i < collectionInitializerExpression.CreateExpressions.Count; i++) {
Expression o = collectionInitializerExpression.CreateExpressions[i];
Debug.Assert(o != null);
@@ -283,12 +283,12 @@ namespace ICSharpCode.NRefactory.Visitors {
collectionInitializerExpression.CreateExpressions.RemoveAt(i--);
else
collectionInitializerExpression.CreateExpressions[i] = o;
- }
- return null;
- }
-
- public virtual object VisitCompilationUnit(CompilationUnit compilationUnit, object data) {
- Debug.Assert((compilationUnit != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitCompilationUnit(CompilationUnit compilationUnit, object data) {
+ Debug.Assert((compilationUnit != null));
for (int i = 0; i < compilationUnit.Children.Count; i++) {
INode o = compilationUnit.Children[i];
Debug.Assert(o != null);
@@ -299,33 +299,33 @@ namespace ICSharpCode.NRefactory.Visitors {
compilationUnit.Children.RemoveAt(i--);
else
compilationUnit.Children[i] = o;
- }
- return null;
- }
-
- public virtual object VisitConditionalExpression(ConditionalExpression conditionalExpression, object data) {
- Debug.Assert((conditionalExpression != null));
- Debug.Assert((conditionalExpression.Condition != null));
- Debug.Assert((conditionalExpression.TrueExpression != null));
- Debug.Assert((conditionalExpression.FalseExpression != null));
- nodeStack.Push(conditionalExpression.Condition);
- conditionalExpression.Condition.AcceptVisitor(this, data);
- conditionalExpression.Condition = ((Expression)(nodeStack.Pop()));
- nodeStack.Push(conditionalExpression.TrueExpression);
- conditionalExpression.TrueExpression.AcceptVisitor(this, data);
- conditionalExpression.TrueExpression = ((Expression)(nodeStack.Pop()));
- nodeStack.Push(conditionalExpression.FalseExpression);
- conditionalExpression.FalseExpression.AcceptVisitor(this, data);
- conditionalExpression.FalseExpression = ((Expression)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data) {
- Debug.Assert((constructorDeclaration != null));
- Debug.Assert((constructorDeclaration.Attributes != null));
- Debug.Assert((constructorDeclaration.Parameters != null));
- Debug.Assert((constructorDeclaration.ConstructorInitializer != null));
- Debug.Assert((constructorDeclaration.Body != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitConditionalExpression(ConditionalExpression conditionalExpression, object data) {
+ Debug.Assert((conditionalExpression != null));
+ Debug.Assert((conditionalExpression.Condition != null));
+ Debug.Assert((conditionalExpression.TrueExpression != null));
+ Debug.Assert((conditionalExpression.FalseExpression != null));
+ nodeStack.Push(conditionalExpression.Condition);
+ conditionalExpression.Condition.AcceptVisitor(this, data);
+ conditionalExpression.Condition = ((Expression)(nodeStack.Pop()));
+ nodeStack.Push(conditionalExpression.TrueExpression);
+ conditionalExpression.TrueExpression.AcceptVisitor(this, data);
+ conditionalExpression.TrueExpression = ((Expression)(nodeStack.Pop()));
+ nodeStack.Push(conditionalExpression.FalseExpression);
+ conditionalExpression.FalseExpression.AcceptVisitor(this, data);
+ conditionalExpression.FalseExpression = ((Expression)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data) {
+ Debug.Assert((constructorDeclaration != null));
+ Debug.Assert((constructorDeclaration.Attributes != null));
+ Debug.Assert((constructorDeclaration.Parameters != null));
+ Debug.Assert((constructorDeclaration.ConstructorInitializer != null));
+ Debug.Assert((constructorDeclaration.Body != null));
for (int i = 0; i < constructorDeclaration.Attributes.Count; i++) {
AttributeSection o = constructorDeclaration.Attributes[i];
Debug.Assert(o != null);
@@ -336,7 +336,7 @@ namespace ICSharpCode.NRefactory.Visitors {
constructorDeclaration.Attributes.RemoveAt(i--);
else
constructorDeclaration.Attributes[i] = o;
- }
+ }
for (int i = 0; i < constructorDeclaration.Parameters.Count; i++) {
ParameterDeclarationExpression o = constructorDeclaration.Parameters[i];
Debug.Assert(o != null);
@@ -347,19 +347,19 @@ namespace ICSharpCode.NRefactory.Visitors {
constructorDeclaration.Parameters.RemoveAt(i--);
else
constructorDeclaration.Parameters[i] = o;
- }
- nodeStack.Push(constructorDeclaration.ConstructorInitializer);
- constructorDeclaration.ConstructorInitializer.AcceptVisitor(this, data);
- constructorDeclaration.ConstructorInitializer = ((ConstructorInitializer)(nodeStack.Pop()));
- nodeStack.Push(constructorDeclaration.Body);
- constructorDeclaration.Body.AcceptVisitor(this, data);
- constructorDeclaration.Body = ((BlockStatement)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitConstructorInitializer(ConstructorInitializer constructorInitializer, object data) {
- Debug.Assert((constructorInitializer != null));
- Debug.Assert((constructorInitializer.Arguments != null));
+ }
+ nodeStack.Push(constructorDeclaration.ConstructorInitializer);
+ constructorDeclaration.ConstructorInitializer.AcceptVisitor(this, data);
+ constructorDeclaration.ConstructorInitializer = ((ConstructorInitializer)(nodeStack.Pop()));
+ nodeStack.Push(constructorDeclaration.Body);
+ constructorDeclaration.Body.AcceptVisitor(this, data);
+ constructorDeclaration.Body = ((BlockStatement)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitConstructorInitializer(ConstructorInitializer constructorInitializer, object data) {
+ Debug.Assert((constructorInitializer != null));
+ Debug.Assert((constructorInitializer.Arguments != null));
for (int i = 0; i < constructorInitializer.Arguments.Count; i++) {
Expression o = constructorInitializer.Arguments[i];
Debug.Assert(o != null);
@@ -370,20 +370,20 @@ namespace ICSharpCode.NRefactory.Visitors {
constructorInitializer.Arguments.RemoveAt(i--);
else
constructorInitializer.Arguments[i] = o;
- }
- return null;
- }
-
- public virtual object VisitContinueStatement(ContinueStatement continueStatement, object data) {
- Debug.Assert((continueStatement != null));
- return null;
- }
-
- public virtual object VisitDeclareDeclaration(DeclareDeclaration declareDeclaration, object data) {
- Debug.Assert((declareDeclaration != null));
- Debug.Assert((declareDeclaration.Attributes != null));
- Debug.Assert((declareDeclaration.Parameters != null));
- Debug.Assert((declareDeclaration.TypeReference != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitContinueStatement(ContinueStatement continueStatement, object data) {
+ Debug.Assert((continueStatement != null));
+ return null;
+ }
+
+ public virtual object VisitDeclareDeclaration(DeclareDeclaration declareDeclaration, object data) {
+ Debug.Assert((declareDeclaration != null));
+ Debug.Assert((declareDeclaration.Attributes != null));
+ Debug.Assert((declareDeclaration.Parameters != null));
+ Debug.Assert((declareDeclaration.TypeReference != null));
for (int i = 0; i < declareDeclaration.Attributes.Count; i++) {
AttributeSection o = declareDeclaration.Attributes[i];
Debug.Assert(o != null);
@@ -394,7 +394,7 @@ namespace ICSharpCode.NRefactory.Visitors {
declareDeclaration.Attributes.RemoveAt(i--);
else
declareDeclaration.Attributes[i] = o;
- }
+ }
for (int i = 0; i < declareDeclaration.Parameters.Count; i++) {
ParameterDeclarationExpression o = declareDeclaration.Parameters[i];
Debug.Assert(o != null);
@@ -405,28 +405,28 @@ namespace ICSharpCode.NRefactory.Visitors {
declareDeclaration.Parameters.RemoveAt(i--);
else
declareDeclaration.Parameters[i] = o;
- }
- nodeStack.Push(declareDeclaration.TypeReference);
- declareDeclaration.TypeReference.AcceptVisitor(this, data);
- declareDeclaration.TypeReference = ((TypeReference)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitDefaultValueExpression(DefaultValueExpression defaultValueExpression, object data) {
- Debug.Assert((defaultValueExpression != null));
- Debug.Assert((defaultValueExpression.TypeReference != null));
- nodeStack.Push(defaultValueExpression.TypeReference);
- defaultValueExpression.TypeReference.AcceptVisitor(this, data);
- defaultValueExpression.TypeReference = ((TypeReference)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data) {
- Debug.Assert((delegateDeclaration != null));
- Debug.Assert((delegateDeclaration.Attributes != null));
- Debug.Assert((delegateDeclaration.ReturnType != null));
- Debug.Assert((delegateDeclaration.Parameters != null));
- Debug.Assert((delegateDeclaration.Templates != null));
+ }
+ nodeStack.Push(declareDeclaration.TypeReference);
+ declareDeclaration.TypeReference.AcceptVisitor(this, data);
+ declareDeclaration.TypeReference = ((TypeReference)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitDefaultValueExpression(DefaultValueExpression defaultValueExpression, object data) {
+ Debug.Assert((defaultValueExpression != null));
+ Debug.Assert((defaultValueExpression.TypeReference != null));
+ nodeStack.Push(defaultValueExpression.TypeReference);
+ defaultValueExpression.TypeReference.AcceptVisitor(this, data);
+ defaultValueExpression.TypeReference = ((TypeReference)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data) {
+ Debug.Assert((delegateDeclaration != null));
+ Debug.Assert((delegateDeclaration.Attributes != null));
+ Debug.Assert((delegateDeclaration.ReturnType != null));
+ Debug.Assert((delegateDeclaration.Parameters != null));
+ Debug.Assert((delegateDeclaration.Templates != null));
for (int i = 0; i < delegateDeclaration.Attributes.Count; i++) {
AttributeSection o = delegateDeclaration.Attributes[i];
Debug.Assert(o != null);
@@ -437,10 +437,10 @@ namespace ICSharpCode.NRefactory.Visitors {
delegateDeclaration.Attributes.RemoveAt(i--);
else
delegateDeclaration.Attributes[i] = o;
- }
- nodeStack.Push(delegateDeclaration.ReturnType);
- delegateDeclaration.ReturnType.AcceptVisitor(this, data);
- delegateDeclaration.ReturnType = ((TypeReference)(nodeStack.Pop()));
+ }
+ nodeStack.Push(delegateDeclaration.ReturnType);
+ delegateDeclaration.ReturnType.AcceptVisitor(this, data);
+ delegateDeclaration.ReturnType = ((TypeReference)(nodeStack.Pop()));
for (int i = 0; i < delegateDeclaration.Parameters.Count; i++) {
ParameterDeclarationExpression o = delegateDeclaration.Parameters[i];
Debug.Assert(o != null);
@@ -451,7 +451,7 @@ namespace ICSharpCode.NRefactory.Visitors {
delegateDeclaration.Parameters.RemoveAt(i--);
else
delegateDeclaration.Parameters[i] = o;
- }
+ }
for (int i = 0; i < delegateDeclaration.Templates.Count; i++) {
TemplateDefinition o = delegateDeclaration.Templates[i];
Debug.Assert(o != null);
@@ -462,14 +462,14 @@ namespace ICSharpCode.NRefactory.Visitors {
delegateDeclaration.Templates.RemoveAt(i--);
else
delegateDeclaration.Templates[i] = o;
- }
- return null;
- }
-
- public virtual object VisitDestructorDeclaration(DestructorDeclaration destructorDeclaration, object data) {
- Debug.Assert((destructorDeclaration != null));
- Debug.Assert((destructorDeclaration.Attributes != null));
- Debug.Assert((destructorDeclaration.Body != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitDestructorDeclaration(DestructorDeclaration destructorDeclaration, object data) {
+ Debug.Assert((destructorDeclaration != null));
+ Debug.Assert((destructorDeclaration.Attributes != null));
+ Debug.Assert((destructorDeclaration.Body != null));
for (int i = 0; i < destructorDeclaration.Attributes.Count; i++) {
AttributeSection o = destructorDeclaration.Attributes[i];
Debug.Assert(o != null);
@@ -480,61 +480,61 @@ namespace ICSharpCode.NRefactory.Visitors {
destructorDeclaration.Attributes.RemoveAt(i--);
else
destructorDeclaration.Attributes[i] = o;
- }
- nodeStack.Push(destructorDeclaration.Body);
- destructorDeclaration.Body.AcceptVisitor(this, data);
- destructorDeclaration.Body = ((BlockStatement)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitDirectionExpression(DirectionExpression directionExpression, object data) {
- Debug.Assert((directionExpression != null));
- Debug.Assert((directionExpression.Expression != null));
- nodeStack.Push(directionExpression.Expression);
- directionExpression.Expression.AcceptVisitor(this, data);
- directionExpression.Expression = ((Expression)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitDoLoopStatement(DoLoopStatement doLoopStatement, object data) {
- Debug.Assert((doLoopStatement != null));
- Debug.Assert((doLoopStatement.Condition != null));
- Debug.Assert((doLoopStatement.EmbeddedStatement != null));
- nodeStack.Push(doLoopStatement.Condition);
- doLoopStatement.Condition.AcceptVisitor(this, data);
- doLoopStatement.Condition = ((Expression)(nodeStack.Pop()));
- nodeStack.Push(doLoopStatement.EmbeddedStatement);
- doLoopStatement.EmbeddedStatement.AcceptVisitor(this, data);
- doLoopStatement.EmbeddedStatement = ((Statement)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitElseIfSection(ElseIfSection elseIfSection, object data) {
- Debug.Assert((elseIfSection != null));
- Debug.Assert((elseIfSection.Condition != null));
- Debug.Assert((elseIfSection.EmbeddedStatement != null));
- nodeStack.Push(elseIfSection.Condition);
- elseIfSection.Condition.AcceptVisitor(this, data);
- elseIfSection.Condition = ((Expression)(nodeStack.Pop()));
- nodeStack.Push(elseIfSection.EmbeddedStatement);
- elseIfSection.EmbeddedStatement.AcceptVisitor(this, data);
- elseIfSection.EmbeddedStatement = ((Statement)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitEmptyStatement(EmptyStatement emptyStatement, object data) {
- Debug.Assert((emptyStatement != null));
- return null;
- }
-
- public virtual object VisitEndStatement(EndStatement endStatement, object data) {
- Debug.Assert((endStatement != null));
- return null;
- }
-
- public virtual object VisitEraseStatement(EraseStatement eraseStatement, object data) {
- Debug.Assert((eraseStatement != null));
- Debug.Assert((eraseStatement.Expressions != null));
+ }
+ nodeStack.Push(destructorDeclaration.Body);
+ destructorDeclaration.Body.AcceptVisitor(this, data);
+ destructorDeclaration.Body = ((BlockStatement)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitDirectionExpression(DirectionExpression directionExpression, object data) {
+ Debug.Assert((directionExpression != null));
+ Debug.Assert((directionExpression.Expression != null));
+ nodeStack.Push(directionExpression.Expression);
+ directionExpression.Expression.AcceptVisitor(this, data);
+ directionExpression.Expression = ((Expression)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitDoLoopStatement(DoLoopStatement doLoopStatement, object data) {
+ Debug.Assert((doLoopStatement != null));
+ Debug.Assert((doLoopStatement.Condition != null));
+ Debug.Assert((doLoopStatement.EmbeddedStatement != null));
+ nodeStack.Push(doLoopStatement.Condition);
+ doLoopStatement.Condition.AcceptVisitor(this, data);
+ doLoopStatement.Condition = ((Expression)(nodeStack.Pop()));
+ nodeStack.Push(doLoopStatement.EmbeddedStatement);
+ doLoopStatement.EmbeddedStatement.AcceptVisitor(this, data);
+ doLoopStatement.EmbeddedStatement = ((Statement)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitElseIfSection(ElseIfSection elseIfSection, object data) {
+ Debug.Assert((elseIfSection != null));
+ Debug.Assert((elseIfSection.Condition != null));
+ Debug.Assert((elseIfSection.EmbeddedStatement != null));
+ nodeStack.Push(elseIfSection.Condition);
+ elseIfSection.Condition.AcceptVisitor(this, data);
+ elseIfSection.Condition = ((Expression)(nodeStack.Pop()));
+ nodeStack.Push(elseIfSection.EmbeddedStatement);
+ elseIfSection.EmbeddedStatement.AcceptVisitor(this, data);
+ elseIfSection.EmbeddedStatement = ((Statement)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitEmptyStatement(EmptyStatement emptyStatement, object data) {
+ Debug.Assert((emptyStatement != null));
+ return null;
+ }
+
+ public virtual object VisitEndStatement(EndStatement endStatement, object data) {
+ Debug.Assert((endStatement != null));
+ return null;
+ }
+
+ public virtual object VisitEraseStatement(EraseStatement eraseStatement, object data) {
+ Debug.Assert((eraseStatement != null));
+ Debug.Assert((eraseStatement.Expressions != null));
for (int i = 0; i < eraseStatement.Expressions.Count; i++) {
Expression o = eraseStatement.Expressions[i];
Debug.Assert(o != null);
@@ -545,24 +545,24 @@ namespace ICSharpCode.NRefactory.Visitors {
eraseStatement.Expressions.RemoveAt(i--);
else
eraseStatement.Expressions[i] = o;
- }
- return null;
- }
-
- public virtual object VisitErrorStatement(ErrorStatement errorStatement, object data) {
- Debug.Assert((errorStatement != null));
- Debug.Assert((errorStatement.Expression != null));
- nodeStack.Push(errorStatement.Expression);
- errorStatement.Expression.AcceptVisitor(this, data);
- errorStatement.Expression = ((Expression)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitEventAddRegion(EventAddRegion eventAddRegion, object data) {
- Debug.Assert((eventAddRegion != null));
- Debug.Assert((eventAddRegion.Attributes != null));
- Debug.Assert((eventAddRegion.Block != null));
- Debug.Assert((eventAddRegion.Parameters != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitErrorStatement(ErrorStatement errorStatement, object data) {
+ Debug.Assert((errorStatement != null));
+ Debug.Assert((errorStatement.Expression != null));
+ nodeStack.Push(errorStatement.Expression);
+ errorStatement.Expression.AcceptVisitor(this, data);
+ errorStatement.Expression = ((Expression)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitEventAddRegion(EventAddRegion eventAddRegion, object data) {
+ Debug.Assert((eventAddRegion != null));
+ Debug.Assert((eventAddRegion.Attributes != null));
+ Debug.Assert((eventAddRegion.Block != null));
+ Debug.Assert((eventAddRegion.Parameters != null));
for (int i = 0; i < eventAddRegion.Attributes.Count; i++) {
AttributeSection o = eventAddRegion.Attributes[i];
Debug.Assert(o != null);
@@ -573,10 +573,10 @@ namespace ICSharpCode.NRefactory.Visitors {
eventAddRegion.Attributes.RemoveAt(i--);
else
eventAddRegion.Attributes[i] = o;
- }
- nodeStack.Push(eventAddRegion.Block);
- eventAddRegion.Block.AcceptVisitor(this, data);
- eventAddRegion.Block = ((BlockStatement)(nodeStack.Pop()));
+ }
+ nodeStack.Push(eventAddRegion.Block);
+ eventAddRegion.Block.AcceptVisitor(this, data);
+ eventAddRegion.Block = ((BlockStatement)(nodeStack.Pop()));
for (int i = 0; i < eventAddRegion.Parameters.Count; i++) {
ParameterDeclarationExpression o = eventAddRegion.Parameters[i];
Debug.Assert(o != null);
@@ -587,20 +587,20 @@ namespace ICSharpCode.NRefactory.Visitors {
eventAddRegion.Parameters.RemoveAt(i--);
else
eventAddRegion.Parameters[i] = o;
- }
- return null;
- }
-
- public virtual object VisitEventDeclaration(EventDeclaration eventDeclaration, object data) {
- Debug.Assert((eventDeclaration != null));
- Debug.Assert((eventDeclaration.Attributes != null));
- Debug.Assert((eventDeclaration.Parameters != null));
- Debug.Assert((eventDeclaration.InterfaceImplementations != null));
- Debug.Assert((eventDeclaration.TypeReference != null));
- Debug.Assert((eventDeclaration.AddRegion != null));
- Debug.Assert((eventDeclaration.RemoveRegion != null));
- Debug.Assert((eventDeclaration.RaiseRegion != null));
- Debug.Assert((eventDeclaration.Initializer != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitEventDeclaration(EventDeclaration eventDeclaration, object data) {
+ Debug.Assert((eventDeclaration != null));
+ Debug.Assert((eventDeclaration.Attributes != null));
+ Debug.Assert((eventDeclaration.Parameters != null));
+ Debug.Assert((eventDeclaration.InterfaceImplementations != null));
+ Debug.Assert((eventDeclaration.TypeReference != null));
+ Debug.Assert((eventDeclaration.AddRegion != null));
+ Debug.Assert((eventDeclaration.RemoveRegion != null));
+ Debug.Assert((eventDeclaration.RaiseRegion != null));
+ Debug.Assert((eventDeclaration.Initializer != null));
for (int i = 0; i < eventDeclaration.Attributes.Count; i++) {
AttributeSection o = eventDeclaration.Attributes[i];
Debug.Assert(o != null);
@@ -611,7 +611,7 @@ namespace ICSharpCode.NRefactory.Visitors {
eventDeclaration.Attributes.RemoveAt(i--);
else
eventDeclaration.Attributes[i] = o;
- }
+ }
for (int i = 0; i < eventDeclaration.Parameters.Count; i++) {
ParameterDeclarationExpression o = eventDeclaration.Parameters[i];
Debug.Assert(o != null);
@@ -622,7 +622,7 @@ namespace ICSharpCode.NRefactory.Visitors {
eventDeclaration.Parameters.RemoveAt(i--);
else
eventDeclaration.Parameters[i] = o;
- }
+ }
for (int i = 0; i < eventDeclaration.InterfaceImplementations.Count; i++) {
InterfaceImplementation o = eventDeclaration.InterfaceImplementations[i];
Debug.Assert(o != null);
@@ -633,30 +633,30 @@ namespace ICSharpCode.NRefactory.Visitors {
eventDeclaration.InterfaceImplementations.RemoveAt(i--);
else
eventDeclaration.InterfaceImplementations[i] = o;
- }
- nodeStack.Push(eventDeclaration.TypeReference);
- eventDeclaration.TypeReference.AcceptVisitor(this, data);
- eventDeclaration.TypeReference = ((TypeReference)(nodeStack.Pop()));
- nodeStack.Push(eventDeclaration.AddRegion);
- eventDeclaration.AddRegion.AcceptVisitor(this, data);
- eventDeclaration.AddRegion = ((EventAddRegion)(nodeStack.Pop()));
- nodeStack.Push(eventDeclaration.RemoveRegion);
- eventDeclaration.RemoveRegion.AcceptVisitor(this, data);
- eventDeclaration.RemoveRegion = ((EventRemoveRegion)(nodeStack.Pop()));
- nodeStack.Push(eventDeclaration.RaiseRegion);
- eventDeclaration.RaiseRegion.AcceptVisitor(this, data);
- eventDeclaration.RaiseRegion = ((EventRaiseRegion)(nodeStack.Pop()));
- nodeStack.Push(eventDeclaration.Initializer);
- eventDeclaration.Initializer.AcceptVisitor(this, data);
- eventDeclaration.Initializer = ((Expression)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitEventRaiseRegion(EventRaiseRegion eventRaiseRegion, object data) {
- Debug.Assert((eventRaiseRegion != null));
- Debug.Assert((eventRaiseRegion.Attributes != null));
- Debug.Assert((eventRaiseRegion.Block != null));
- Debug.Assert((eventRaiseRegion.Parameters != null));
+ }
+ nodeStack.Push(eventDeclaration.TypeReference);
+ eventDeclaration.TypeReference.AcceptVisitor(this, data);
+ eventDeclaration.TypeReference = ((TypeReference)(nodeStack.Pop()));
+ nodeStack.Push(eventDeclaration.AddRegion);
+ eventDeclaration.AddRegion.AcceptVisitor(this, data);
+ eventDeclaration.AddRegion = ((EventAddRegion)(nodeStack.Pop()));
+ nodeStack.Push(eventDeclaration.RemoveRegion);
+ eventDeclaration.RemoveRegion.AcceptVisitor(this, data);
+ eventDeclaration.RemoveRegion = ((EventRemoveRegion)(nodeStack.Pop()));
+ nodeStack.Push(eventDeclaration.RaiseRegion);
+ eventDeclaration.RaiseRegion.AcceptVisitor(this, data);
+ eventDeclaration.RaiseRegion = ((EventRaiseRegion)(nodeStack.Pop()));
+ nodeStack.Push(eventDeclaration.Initializer);
+ eventDeclaration.Initializer.AcceptVisitor(this, data);
+ eventDeclaration.Initializer = ((Expression)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitEventRaiseRegion(EventRaiseRegion eventRaiseRegion, object data) {
+ Debug.Assert((eventRaiseRegion != null));
+ Debug.Assert((eventRaiseRegion.Attributes != null));
+ Debug.Assert((eventRaiseRegion.Block != null));
+ Debug.Assert((eventRaiseRegion.Parameters != null));
for (int i = 0; i < eventRaiseRegion.Attributes.Count; i++) {
AttributeSection o = eventRaiseRegion.Attributes[i];
Debug.Assert(o != null);
@@ -667,10 +667,10 @@ namespace ICSharpCode.NRefactory.Visitors {
eventRaiseRegion.Attributes.RemoveAt(i--);
else
eventRaiseRegion.Attributes[i] = o;
- }
- nodeStack.Push(eventRaiseRegion.Block);
- eventRaiseRegion.Block.AcceptVisitor(this, data);
- eventRaiseRegion.Block = ((BlockStatement)(nodeStack.Pop()));
+ }
+ nodeStack.Push(eventRaiseRegion.Block);
+ eventRaiseRegion.Block.AcceptVisitor(this, data);
+ eventRaiseRegion.Block = ((BlockStatement)(nodeStack.Pop()));
for (int i = 0; i < eventRaiseRegion.Parameters.Count; i++) {
ParameterDeclarationExpression o = eventRaiseRegion.Parameters[i];
Debug.Assert(o != null);
@@ -681,15 +681,15 @@ namespace ICSharpCode.NRefactory.Visitors {
eventRaiseRegion.Parameters.RemoveAt(i--);
else
eventRaiseRegion.Parameters[i] = o;
- }
- return null;
- }
-
- public virtual object VisitEventRemoveRegion(EventRemoveRegion eventRemoveRegion, object data) {
- Debug.Assert((eventRemoveRegion != null));
- Debug.Assert((eventRemoveRegion.Attributes != null));
- Debug.Assert((eventRemoveRegion.Block != null));
- Debug.Assert((eventRemoveRegion.Parameters != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitEventRemoveRegion(EventRemoveRegion eventRemoveRegion, object data) {
+ Debug.Assert((eventRemoveRegion != null));
+ Debug.Assert((eventRemoveRegion.Attributes != null));
+ Debug.Assert((eventRemoveRegion.Block != null));
+ Debug.Assert((eventRemoveRegion.Parameters != null));
for (int i = 0; i < eventRemoveRegion.Attributes.Count; i++) {
AttributeSection o = eventRemoveRegion.Attributes[i];
Debug.Assert(o != null);
@@ -700,10 +700,10 @@ namespace ICSharpCode.NRefactory.Visitors {
eventRemoveRegion.Attributes.RemoveAt(i--);
else
eventRemoveRegion.Attributes[i] = o;
- }
- nodeStack.Push(eventRemoveRegion.Block);
- eventRemoveRegion.Block.AcceptVisitor(this, data);
- eventRemoveRegion.Block = ((BlockStatement)(nodeStack.Pop()));
+ }
+ nodeStack.Push(eventRemoveRegion.Block);
+ eventRemoveRegion.Block.AcceptVisitor(this, data);
+ eventRemoveRegion.Block = ((BlockStatement)(nodeStack.Pop()));
for (int i = 0; i < eventRemoveRegion.Parameters.Count; i++) {
ParameterDeclarationExpression o = eventRemoveRegion.Parameters[i];
Debug.Assert(o != null);
@@ -714,47 +714,47 @@ namespace ICSharpCode.NRefactory.Visitors {
eventRemoveRegion.Parameters.RemoveAt(i--);
else
eventRemoveRegion.Parameters[i] = o;
- }
- return null;
- }
-
- public virtual object VisitExitStatement(ExitStatement exitStatement, object data) {
- Debug.Assert((exitStatement != null));
- return null;
- }
-
- public virtual object VisitExpressionRangeVariable(ExpressionRangeVariable expressionRangeVariable, object data) {
- Debug.Assert((expressionRangeVariable != null));
- Debug.Assert((expressionRangeVariable.Expression != null));
- Debug.Assert((expressionRangeVariable.Type != null));
- nodeStack.Push(expressionRangeVariable.Expression);
- expressionRangeVariable.Expression.AcceptVisitor(this, data);
- expressionRangeVariable.Expression = ((Expression)(nodeStack.Pop()));
- nodeStack.Push(expressionRangeVariable.Type);
- expressionRangeVariable.Type.AcceptVisitor(this, data);
- expressionRangeVariable.Type = ((TypeReference)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitExpressionStatement(ExpressionStatement expressionStatement, object data) {
- Debug.Assert((expressionStatement != null));
- Debug.Assert((expressionStatement.Expression != null));
- nodeStack.Push(expressionStatement.Expression);
- expressionStatement.Expression.AcceptVisitor(this, data);
- expressionStatement.Expression = ((Expression)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitExternAliasDirective(ExternAliasDirective externAliasDirective, object data) {
- Debug.Assert((externAliasDirective != null));
- return null;
- }
-
- public virtual object VisitFieldDeclaration(FieldDeclaration fieldDeclaration, object data) {
- Debug.Assert((fieldDeclaration != null));
- Debug.Assert((fieldDeclaration.Attributes != null));
- Debug.Assert((fieldDeclaration.TypeReference != null));
- Debug.Assert((fieldDeclaration.Fields != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitExitStatement(ExitStatement exitStatement, object data) {
+ Debug.Assert((exitStatement != null));
+ return null;
+ }
+
+ public virtual object VisitExpressionRangeVariable(ExpressionRangeVariable expressionRangeVariable, object data) {
+ Debug.Assert((expressionRangeVariable != null));
+ Debug.Assert((expressionRangeVariable.Expression != null));
+ Debug.Assert((expressionRangeVariable.Type != null));
+ nodeStack.Push(expressionRangeVariable.Expression);
+ expressionRangeVariable.Expression.AcceptVisitor(this, data);
+ expressionRangeVariable.Expression = ((Expression)(nodeStack.Pop()));
+ nodeStack.Push(expressionRangeVariable.Type);
+ expressionRangeVariable.Type.AcceptVisitor(this, data);
+ expressionRangeVariable.Type = ((TypeReference)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitExpressionStatement(ExpressionStatement expressionStatement, object data) {
+ Debug.Assert((expressionStatement != null));
+ Debug.Assert((expressionStatement.Expression != null));
+ nodeStack.Push(expressionStatement.Expression);
+ expressionStatement.Expression.AcceptVisitor(this, data);
+ expressionStatement.Expression = ((Expression)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitExternAliasDirective(ExternAliasDirective externAliasDirective, object data) {
+ Debug.Assert((externAliasDirective != null));
+ return null;
+ }
+
+ public virtual object VisitFieldDeclaration(FieldDeclaration fieldDeclaration, object data) {
+ Debug.Assert((fieldDeclaration != null));
+ Debug.Assert((fieldDeclaration.Attributes != null));
+ Debug.Assert((fieldDeclaration.TypeReference != null));
+ Debug.Assert((fieldDeclaration.Fields != null));
for (int i = 0; i < fieldDeclaration.Attributes.Count; i++) {
AttributeSection o = fieldDeclaration.Attributes[i];
Debug.Assert(o != null);
@@ -765,10 +765,10 @@ namespace ICSharpCode.NRefactory.Visitors {
fieldDeclaration.Attributes.RemoveAt(i--);
else
fieldDeclaration.Attributes[i] = o;
- }
- nodeStack.Push(fieldDeclaration.TypeReference);
- fieldDeclaration.TypeReference.AcceptVisitor(this, data);
- fieldDeclaration.TypeReference = ((TypeReference)(nodeStack.Pop()));
+ }
+ nodeStack.Push(fieldDeclaration.TypeReference);
+ fieldDeclaration.TypeReference.AcceptVisitor(this, data);
+ fieldDeclaration.TypeReference = ((TypeReference)(nodeStack.Pop()));
for (int i = 0; i < fieldDeclaration.Fields.Count; i++) {
VariableDeclaration o = fieldDeclaration.Fields[i];
Debug.Assert(o != null);
@@ -779,62 +779,62 @@ namespace ICSharpCode.NRefactory.Visitors {
fieldDeclaration.Fields.RemoveAt(i--);
else
fieldDeclaration.Fields[i] = o;
- }
- return null;
- }
-
- public virtual object VisitFixedStatement(FixedStatement fixedStatement, object data) {
- Debug.Assert((fixedStatement != null));
- Debug.Assert((fixedStatement.PointerDeclaration != null));
- Debug.Assert((fixedStatement.EmbeddedStatement != null));
- nodeStack.Push(fixedStatement.PointerDeclaration);
- fixedStatement.PointerDeclaration.AcceptVisitor(this, data);
- fixedStatement.PointerDeclaration = ((Statement)(nodeStack.Pop()));
- nodeStack.Push(fixedStatement.EmbeddedStatement);
- fixedStatement.EmbeddedStatement.AcceptVisitor(this, data);
- fixedStatement.EmbeddedStatement = ((Statement)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitForeachStatement(ForeachStatement foreachStatement, object data) {
- Debug.Assert((foreachStatement != null));
- Debug.Assert((foreachStatement.TypeReference != null));
- Debug.Assert((foreachStatement.Expression != null));
- Debug.Assert((foreachStatement.NextExpression != null));
- Debug.Assert((foreachStatement.EmbeddedStatement != null));
- nodeStack.Push(foreachStatement.TypeReference);
- foreachStatement.TypeReference.AcceptVisitor(this, data);
- foreachStatement.TypeReference = ((TypeReference)(nodeStack.Pop()));
- nodeStack.Push(foreachStatement.Expression);
- foreachStatement.Expression.AcceptVisitor(this, data);
- foreachStatement.Expression = ((Expression)(nodeStack.Pop()));
- nodeStack.Push(foreachStatement.NextExpression);
- foreachStatement.NextExpression.AcceptVisitor(this, data);
- foreachStatement.NextExpression = ((Expression)(nodeStack.Pop()));
- nodeStack.Push(foreachStatement.EmbeddedStatement);
- foreachStatement.EmbeddedStatement.AcceptVisitor(this, data);
- foreachStatement.EmbeddedStatement = ((Statement)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitForNextStatement(ForNextStatement forNextStatement, object data) {
- Debug.Assert((forNextStatement != null));
- Debug.Assert((forNextStatement.Start != null));
- Debug.Assert((forNextStatement.End != null));
- Debug.Assert((forNextStatement.Step != null));
- Debug.Assert((forNextStatement.NextExpressions != null));
- Debug.Assert((forNextStatement.TypeReference != null));
- Debug.Assert((forNextStatement.LoopVariableExpression != null));
- Debug.Assert((forNextStatement.EmbeddedStatement != null));
- nodeStack.Push(forNextStatement.Start);
- forNextStatement.Start.AcceptVisitor(this, data);
- forNextStatement.Start = ((Expression)(nodeStack.Pop()));
- nodeStack.Push(forNextStatement.End);
- forNextStatement.End.AcceptVisitor(this, data);
- forNextStatement.End = ((Expression)(nodeStack.Pop()));
- nodeStack.Push(forNextStatement.Step);
- forNextStatement.Step.AcceptVisitor(this, data);
- forNextStatement.Step = ((Expression)(nodeStack.Pop()));
+ }
+ return null;
+ }
+
+ public virtual object VisitFixedStatement(FixedStatement fixedStatement, object data) {
+ Debug.Assert((fixedStatement != null));
+ Debug.Assert((fixedStatement.PointerDeclaration != null));
+ Debug.Assert((fixedStatement.EmbeddedStatement != null));
+ nodeStack.Push(fixedStatement.PointerDeclaration);
+ fixedStatement.PointerDeclaration.AcceptVisitor(this, data);
+ fixedStatement.PointerDeclaration = ((Statement)(nodeStack.Pop()));
+ nodeStack.Push(fixedStatement.EmbeddedStatement);
+ fixedStatement.EmbeddedStatement.AcceptVisitor(this, data);
+ fixedStatement.EmbeddedStatement = ((Statement)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitForeachStatement(ForeachStatement foreachStatement, object data) {
+ Debug.Assert((foreachStatement != null));
+ Debug.Assert((foreachStatement.TypeReference != null));
+ Debug.Assert((foreachStatement.Expression != null));
+ Debug.Assert((foreachStatement.NextExpression != null));
+ Debug.Assert((foreachStatement.EmbeddedStatement != null));
+ nodeStack.Push(foreachStatement.TypeReference);
+ foreachStatement.TypeReference.AcceptVisitor(this, data);
+ foreachStatement.TypeReference = ((TypeReference)(nodeStack.Pop()));
+ nodeStack.Push(foreachStatement.Expression);
+ foreachStatement.Expression.AcceptVisitor(this, data);
+ foreachStatement.Expression = ((Expression)(nodeStack.Pop()));
+ nodeStack.Push(foreachStatement.NextExpression);
+ foreachStatement.NextExpression.AcceptVisitor(this, data);
+ foreachStatement.NextExpression = ((Expression)(nodeStack.Pop()));
+ nodeStack.Push(foreachStatement.EmbeddedStatement);
+ foreachStatement.EmbeddedStatement.AcceptVisitor(this, data);
+ foreachStatement.EmbeddedStatement = ((Statement)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitForNextStatement(ForNextStatement forNextStatement, object data) {
+ Debug.Assert((forNextStatement != null));
+ Debug.Assert((forNextStatement.Start != null));
+ Debug.Assert((forNextStatement.End != null));
+ Debug.Assert((forNextStatement.Step != null));
+ Debug.Assert((forNextStatement.NextExpressions != null));
+ Debug.Assert((forNextStatement.TypeReference != null));
+ Debug.Assert((forNextStatement.LoopVariableExpression != null));
+ Debug.Assert((forNextStatement.EmbeddedStatement != null));
+ nodeStack.Push(forNextStatement.Start);
+ forNextStatement.Start.AcceptVisitor(this, data);
+ forNextStatement.Start = ((Expression)(nodeStack.Pop()));
+ nodeStack.Push(forNextStatement.End);
+ forNextStatement.End.AcceptVisitor(this, data);
+ forNextStatement.End = ((Expression)(nodeStack.Pop()));
+ nodeStack.Push(forNextStatement.Step);
+ forNextStatement.Step.AcceptVisitor(this, data);
+ forNextStatement.Step = ((Expression)(nodeStack.Pop()));
for (int i = 0; i < forNextStatement.NextExpressions.Count; i++) {
Expression o = forNextStatement.NextExpressions[i];
Debug.Assert(o != null);
@@ -845,25 +845,25 @@ namespace ICSharpCode.NRefactory.Visitors {
forNextStatement.NextExpressions.RemoveAt(i--);
else
forNextStatement.NextExpressions[i] = o;
- }
- nodeStack.Push(forNextStatement.TypeReference);
- forNextStatement.TypeReference.AcceptVisitor(this, data);
- forNextStatement.TypeReference = ((TypeReference)(nodeStack.Pop()));
- nodeStack.Push(forNextStatement.LoopVariableExpression);
- forNextStatement.LoopVariableExpression.AcceptVisitor(this, data);
- forNextStatement.LoopVariableExpression = ((Expression)(nodeStack.Pop()));
- nodeStack.Push(forNextStatement.EmbeddedStatement);
- forNextStatement.EmbeddedStatement.AcceptVisitor(this, data);
- forNextStatement.EmbeddedStatement = ((Statement)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitForStatement(ForStatement forStatement, object data) {
- Debug.Assert((forStatement != null));
- Debug.Assert((forStatement.Initializers != null));
- Debug.Assert((forStatement.Condition != null));
- Debug.Assert((forStatement.Iterator != null));
- Debug.Assert((forStatement.EmbeddedStatement != null));
+ }
+ nodeStack.Push(forNextStatement.TypeReference);
+ forNextStatement.TypeReference.AcceptVisitor(this, data);
+ forNextStatement.TypeReference = ((TypeReference)(nodeStack.Pop()));
+ nodeStack.Push(forNextStatement.LoopVariableExpression);
+ forNextStatement.LoopVariableExpression.AcceptVisitor(this, data);
+ forNextStatement.LoopVariableExpression = ((Expression)(nodeStack.Pop()));
+ nodeStack.Push(forNextStatement.EmbeddedStatement);
+ forNextStatement.EmbeddedStatement.AcceptVisitor(this, data);
+ forNextStatement.EmbeddedStatement = ((Statement)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitForStatement(ForStatement forStatement, object data) {
+ Debug.Assert((forStatement != null));
+ Debug.Assert((forStatement.Initializers != null));
+ Debug.Assert((forStatement.Condition != null));
+ Debug.Assert((forStatement.Iterator != null));
+ Debug.Assert((forStatement.EmbeddedStatement != null));
for (int i = 0; i < forStatement.Initializers.Count; i++) {
Statement o = forStatement.Initializers[i];
Debug.Assert(o != null);
@@ -874,10 +874,10 @@ namespace ICSharpCode.NRefactory.Visitors {
forStatement.Initializers.RemoveAt(i--);
else
forStatement.Initializers[i] = o;
- }
- nodeStack.Push(forStatement.Condition);
- forStatement.Condition.AcceptVisitor(this, data);
- forStatement.Condition = ((Expression)(nodeStack.Pop()));
+ }
+ nodeStack.Push(forStatement.Condition);
+ forStatement.Condition.AcceptVisitor(this, data);
+ forStatement.Condition = ((Expression)(nodeStack.Pop()));
for (int i = 0; i < forStatement.Iterator.Count; i++) {
Statement o = forStatement.Iterator[i];
Debug.Assert(o != null);
@@ -888,30 +888,30 @@ namespace ICSharpCode.NRefactory.Visitors {
forStatement.Iterator.RemoveAt(i--);
else
forStatement.Iterator[i] = o;
- }
- nodeStack.Push(forStatement.EmbeddedStatement);
- forStatement.EmbeddedStatement.AcceptVisitor(this, data);
- forStatement.EmbeddedStatement = ((Statement)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, object data) {
- Debug.Assert((gotoCaseStatement != null));
- Debug.Assert((gotoCaseStatement.Expression != null));
- nodeStack.Push(gotoCaseStatement.Expression);
- gotoCaseStatement.Expression.AcceptVisitor(this, data);
- gotoCaseStatement.Expression = ((Expression)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitGotoStatement(GotoStatement gotoStatement, object data) {
- Debug.Assert((gotoStatement != null));
- return null;
- }
-
- public virtual object VisitIdentifierExpression(IdentifierExpression identifierExpression, object data) {
- Debug.Assert((identifierExpression != null));
- Debug.Assert((identifierExpression.TypeArguments != null));
+ }
+ nodeStack.Push(forStatement.EmbeddedStatement);
+ forStatement.EmbeddedStatement.AcceptVisitor(this, data);
+ forStatement.EmbeddedStatement = ((Statement)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, object data) {
+ Debug.Assert((gotoCaseStatement != null));
+ Debug.Assert((gotoCaseStatement.Expression != null));
+ nodeStack.Push(gotoCaseStatement.Expression);
+ gotoCaseStatement.Expression.AcceptVisitor(this, data);
+ gotoCaseStatement.Expression = ((Expression)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitGotoStatement(GotoStatement gotoStatement, object data) {
+ Debug.Assert((gotoStatement != null));
+ return null;
+ }
+
+ public virtual object VisitIdentifierExpression(IdentifierExpression identifierExpression, object data) {
+ Debug.Assert((identifierExpression != null));
+ Debug.Assert((identifierExpression.TypeArguments != null));
for (int i = 0; i < identifierExpression.TypeArguments.Count; i++) {
TypeReference o = identifierExpression.TypeArguments[i];
Debug.Assert(o != null);
@@ -922,19 +922,19 @@ namespace ICSharpCode.NRefactory.Visitors {
identifierExpression.TypeArguments.RemoveAt(i--);
else
identifierExpression.TypeArguments[i] = o;
- }
- return null;
- }
-
- public virtual object VisitIfElseStatement(IfElseStatement ifElseStatement, object data) {
- Debug.Assert((ifElseStatement != null));
- Debug.Assert((ifElseStatement.Condition != null));
- Debug.Assert((ifElseStatement.TrueStatement != null));
- Debug.Assert((ifElseStatement.FalseStatement != null));
- Debug.Assert((ifElseStatement.ElseIfSections != null));
- nodeStack.Push(ifElseStatement.Condition);
- ifElseStatement.Condition.AcceptVisitor(this, data);
- ifElseStatement.Condition = ((Expression)(nodeStack.Pop()));
+ }
+ return null;
+ }
+
+ public virtual object VisitIfElseStatement(IfElseStatement ifElseStatement, object data) {
+ Debug.Assert((ifElseStatement != null));
+ Debug.Assert((ifElseStatement.Condition != null));
+ Debug.Assert((ifElseStatement.TrueStatement != null));
+ Debug.Assert((ifElseStatement.FalseStatement != null));
+ Debug.Assert((ifElseStatement.ElseIfSections != null));
+ nodeStack.Push(ifElseStatement.Condition);
+ ifElseStatement.Condition.AcceptVisitor(this, data);
+ ifElseStatement.Condition = ((Expression)(nodeStack.Pop()));
for (int i = 0; i < ifElseStatement.TrueStatement.Count; i++) {
Statement o = ifElseStatement.TrueStatement[i];
Debug.Assert(o != null);
@@ -945,7 +945,7 @@ namespace ICSharpCode.NRefactory.Visitors {
ifElseStatement.TrueStatement.RemoveAt(i--);
else
ifElseStatement.TrueStatement[i] = o;
- }
+ }
for (int i = 0; i < ifElseStatement.FalseStatement.Count; i++) {
Statement o = ifElseStatement.FalseStatement[i];
Debug.Assert(o != null);
@@ -956,7 +956,7 @@ namespace ICSharpCode.NRefactory.Visitors {
ifElseStatement.FalseStatement.RemoveAt(i--);
else
ifElseStatement.FalseStatement[i] = o;
- }
+ }
for (int i = 0; i < ifElseStatement.ElseIfSections.Count; i++) {
ElseIfSection o = ifElseStatement.ElseIfSections[i];
Debug.Assert(o != null);
@@ -967,18 +967,18 @@ namespace ICSharpCode.NRefactory.Visitors {
ifElseStatement.ElseIfSections.RemoveAt(i--);
else
ifElseStatement.ElseIfSections[i] = o;
- }
- return null;
- }
-
- public virtual object VisitIndexerDeclaration(IndexerDeclaration indexerDeclaration, object data) {
- Debug.Assert((indexerDeclaration != null));
- Debug.Assert((indexerDeclaration.Attributes != null));
- Debug.Assert((indexerDeclaration.Parameters != null));
- Debug.Assert((indexerDeclaration.InterfaceImplementations != null));
- Debug.Assert((indexerDeclaration.TypeReference != null));
- Debug.Assert((indexerDeclaration.GetRegion != null));
- Debug.Assert((indexerDeclaration.SetRegion != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitIndexerDeclaration(IndexerDeclaration indexerDeclaration, object data) {
+ Debug.Assert((indexerDeclaration != null));
+ Debug.Assert((indexerDeclaration.Attributes != null));
+ Debug.Assert((indexerDeclaration.Parameters != null));
+ Debug.Assert((indexerDeclaration.InterfaceImplementations != null));
+ Debug.Assert((indexerDeclaration.TypeReference != null));
+ Debug.Assert((indexerDeclaration.GetRegion != null));
+ Debug.Assert((indexerDeclaration.SetRegion != null));
for (int i = 0; i < indexerDeclaration.Attributes.Count; i++) {
AttributeSection o = indexerDeclaration.Attributes[i];
Debug.Assert(o != null);
@@ -989,7 +989,7 @@ namespace ICSharpCode.NRefactory.Visitors {
indexerDeclaration.Attributes.RemoveAt(i--);
else
indexerDeclaration.Attributes[i] = o;
- }
+ }
for (int i = 0; i < indexerDeclaration.Parameters.Count; i++) {
ParameterDeclarationExpression o = indexerDeclaration.Parameters[i];
Debug.Assert(o != null);
@@ -1000,7 +1000,7 @@ namespace ICSharpCode.NRefactory.Visitors {
indexerDeclaration.Parameters.RemoveAt(i--);
else
indexerDeclaration.Parameters[i] = o;
- }
+ }
for (int i = 0; i < indexerDeclaration.InterfaceImplementations.Count; i++) {
InterfaceImplementation o = indexerDeclaration.InterfaceImplementations[i];
Debug.Assert(o != null);
@@ -1011,26 +1011,26 @@ namespace ICSharpCode.NRefactory.Visitors {
indexerDeclaration.InterfaceImplementations.RemoveAt(i--);
else
indexerDeclaration.InterfaceImplementations[i] = o;
- }
- nodeStack.Push(indexerDeclaration.TypeReference);
- indexerDeclaration.TypeReference.AcceptVisitor(this, data);
- indexerDeclaration.TypeReference = ((TypeReference)(nodeStack.Pop()));
- nodeStack.Push(indexerDeclaration.GetRegion);
- indexerDeclaration.GetRegion.AcceptVisitor(this, data);
- indexerDeclaration.GetRegion = ((PropertyGetRegion)(nodeStack.Pop()));
- nodeStack.Push(indexerDeclaration.SetRegion);
- indexerDeclaration.SetRegion.AcceptVisitor(this, data);
- indexerDeclaration.SetRegion = ((PropertySetRegion)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitIndexerExpression(IndexerExpression indexerExpression, object data) {
- Debug.Assert((indexerExpression != null));
- Debug.Assert((indexerExpression.TargetObject != null));
- Debug.Assert((indexerExpression.Indexes != null));
- nodeStack.Push(indexerExpression.TargetObject);
- indexerExpression.TargetObject.AcceptVisitor(this, data);
- indexerExpression.TargetObject = ((Expression)(nodeStack.Pop()));
+ }
+ nodeStack.Push(indexerDeclaration.TypeReference);
+ indexerDeclaration.TypeReference.AcceptVisitor(this, data);
+ indexerDeclaration.TypeReference = ((TypeReference)(nodeStack.Pop()));
+ nodeStack.Push(indexerDeclaration.GetRegion);
+ indexerDeclaration.GetRegion.AcceptVisitor(this, data);
+ indexerDeclaration.GetRegion = ((PropertyGetRegion)(nodeStack.Pop()));
+ nodeStack.Push(indexerDeclaration.SetRegion);
+ indexerDeclaration.SetRegion.AcceptVisitor(this, data);
+ indexerDeclaration.SetRegion = ((PropertySetRegion)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitIndexerExpression(IndexerExpression indexerExpression, object data) {
+ Debug.Assert((indexerExpression != null));
+ Debug.Assert((indexerExpression.TargetObject != null));
+ Debug.Assert((indexerExpression.Indexes != null));
+ nodeStack.Push(indexerExpression.TargetObject);
+ indexerExpression.TargetObject.AcceptVisitor(this, data);
+ indexerExpression.TargetObject = ((Expression)(nodeStack.Pop()));
for (int i = 0; i < indexerExpression.Indexes.Count; i++) {
Expression o = indexerExpression.Indexes[i];
Debug.Assert(o != null);
@@ -1041,14 +1041,14 @@ namespace ICSharpCode.NRefactory.Visitors {
indexerExpression.Indexes.RemoveAt(i--);
else
indexerExpression.Indexes[i] = o;
- }
- return null;
- }
-
- public virtual object VisitInnerClassTypeReference(InnerClassTypeReference innerClassTypeReference, object data) {
- Debug.Assert((innerClassTypeReference != null));
- Debug.Assert((innerClassTypeReference.GenericTypes != null));
- Debug.Assert((innerClassTypeReference.BaseType != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitInnerClassTypeReference(InnerClassTypeReference innerClassTypeReference, object data) {
+ Debug.Assert((innerClassTypeReference != null));
+ Debug.Assert((innerClassTypeReference.GenericTypes != null));
+ Debug.Assert((innerClassTypeReference.BaseType != null));
for (int i = 0; i < innerClassTypeReference.GenericTypes.Count; i++) {
TypeReference o = innerClassTypeReference.GenericTypes[i];
Debug.Assert(o != null);
@@ -1059,29 +1059,29 @@ namespace ICSharpCode.NRefactory.Visitors {
innerClassTypeReference.GenericTypes.RemoveAt(i--);
else
innerClassTypeReference.GenericTypes[i] = o;
- }
- nodeStack.Push(innerClassTypeReference.BaseType);
- innerClassTypeReference.BaseType.AcceptVisitor(this, data);
- innerClassTypeReference.BaseType = ((TypeReference)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitInterfaceImplementation(InterfaceImplementation interfaceImplementation, object data) {
- Debug.Assert((interfaceImplementation != null));
- Debug.Assert((interfaceImplementation.InterfaceType != null));
- nodeStack.Push(interfaceImplementation.InterfaceType);
- interfaceImplementation.InterfaceType.AcceptVisitor(this, data);
- interfaceImplementation.InterfaceType = ((TypeReference)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitInvocationExpression(InvocationExpression invocationExpression, object data) {
- Debug.Assert((invocationExpression != null));
- Debug.Assert((invocationExpression.TargetObject != null));
- Debug.Assert((invocationExpression.Arguments != null));
- nodeStack.Push(invocationExpression.TargetObject);
- invocationExpression.TargetObject.AcceptVisitor(this, data);
- invocationExpression.TargetObject = ((Expression)(nodeStack.Pop()));
+ }
+ nodeStack.Push(innerClassTypeReference.BaseType);
+ innerClassTypeReference.BaseType.AcceptVisitor(this, data);
+ innerClassTypeReference.BaseType = ((TypeReference)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitInterfaceImplementation(InterfaceImplementation interfaceImplementation, object data) {
+ Debug.Assert((interfaceImplementation != null));
+ Debug.Assert((interfaceImplementation.InterfaceType != null));
+ nodeStack.Push(interfaceImplementation.InterfaceType);
+ interfaceImplementation.InterfaceType.AcceptVisitor(this, data);
+ interfaceImplementation.InterfaceType = ((TypeReference)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitInvocationExpression(InvocationExpression invocationExpression, object data) {
+ Debug.Assert((invocationExpression != null));
+ Debug.Assert((invocationExpression.TargetObject != null));
+ Debug.Assert((invocationExpression.Arguments != null));
+ nodeStack.Push(invocationExpression.TargetObject);
+ invocationExpression.TargetObject.AcceptVisitor(this, data);
+ invocationExpression.TargetObject = ((Expression)(nodeStack.Pop()));
for (int i = 0; i < invocationExpression.Arguments.Count; i++) {
Expression o = invocationExpression.Arguments[i];
Debug.Assert(o != null);
@@ -1092,20 +1092,20 @@ namespace ICSharpCode.NRefactory.Visitors {
invocationExpression.Arguments.RemoveAt(i--);
else
invocationExpression.Arguments[i] = o;
- }
- return null;
- }
-
- public virtual object VisitLabelStatement(LabelStatement labelStatement, object data) {
- Debug.Assert((labelStatement != null));
- return null;
- }
-
- public virtual object VisitLambdaExpression(LambdaExpression lambdaExpression, object data) {
- Debug.Assert((lambdaExpression != null));
- Debug.Assert((lambdaExpression.Parameters != null));
- Debug.Assert((lambdaExpression.StatementBody != null));
- Debug.Assert((lambdaExpression.ExpressionBody != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitLabelStatement(LabelStatement labelStatement, object data) {
+ Debug.Assert((labelStatement != null));
+ return null;
+ }
+
+ public virtual object VisitLambdaExpression(LambdaExpression lambdaExpression, object data) {
+ Debug.Assert((lambdaExpression != null));
+ Debug.Assert((lambdaExpression.Parameters != null));
+ Debug.Assert((lambdaExpression.StatementBody != null));
+ Debug.Assert((lambdaExpression.ExpressionBody != null));
for (int i = 0; i < lambdaExpression.Parameters.Count; i++) {
ParameterDeclarationExpression o = lambdaExpression.Parameters[i];
Debug.Assert(o != null);
@@ -1116,23 +1116,23 @@ namespace ICSharpCode.NRefactory.Visitors {
lambdaExpression.Parameters.RemoveAt(i--);
else
lambdaExpression.Parameters[i] = o;
- }
- nodeStack.Push(lambdaExpression.StatementBody);
- lambdaExpression.StatementBody.AcceptVisitor(this, data);
- lambdaExpression.StatementBody = ((BlockStatement)(nodeStack.Pop()));
- nodeStack.Push(lambdaExpression.ExpressionBody);
- lambdaExpression.ExpressionBody.AcceptVisitor(this, data);
- lambdaExpression.ExpressionBody = ((Expression)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data) {
- Debug.Assert((localVariableDeclaration != null));
- Debug.Assert((localVariableDeclaration.TypeReference != null));
- Debug.Assert((localVariableDeclaration.Variables != null));
- nodeStack.Push(localVariableDeclaration.TypeReference);
- localVariableDeclaration.TypeReference.AcceptVisitor(this, data);
- localVariableDeclaration.TypeReference = ((TypeReference)(nodeStack.Pop()));
+ }
+ nodeStack.Push(lambdaExpression.StatementBody);
+ lambdaExpression.StatementBody.AcceptVisitor(this, data);
+ lambdaExpression.StatementBody = ((BlockStatement)(nodeStack.Pop()));
+ nodeStack.Push(lambdaExpression.ExpressionBody);
+ lambdaExpression.ExpressionBody.AcceptVisitor(this, data);
+ lambdaExpression.ExpressionBody = ((Expression)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data) {
+ Debug.Assert((localVariableDeclaration != null));
+ Debug.Assert((localVariableDeclaration.TypeReference != null));
+ Debug.Assert((localVariableDeclaration.Variables != null));
+ nodeStack.Push(localVariableDeclaration.TypeReference);
+ localVariableDeclaration.TypeReference.AcceptVisitor(this, data);
+ localVariableDeclaration.TypeReference = ((TypeReference)(nodeStack.Pop()));
for (int i = 0; i < localVariableDeclaration.Variables.Count; i++) {
VariableDeclaration o = localVariableDeclaration.Variables[i];
Debug.Assert(o != null);
@@ -1143,30 +1143,30 @@ namespace ICSharpCode.NRefactory.Visitors {
localVariableDeclaration.Variables.RemoveAt(i--);
else
localVariableDeclaration.Variables[i] = o;
- }
- return null;
- }
-
- public virtual object VisitLockStatement(LockStatement lockStatement, object data) {
- Debug.Assert((lockStatement != null));
- Debug.Assert((lockStatement.LockExpression != null));
- Debug.Assert((lockStatement.EmbeddedStatement != null));
- nodeStack.Push(lockStatement.LockExpression);
- lockStatement.LockExpression.AcceptVisitor(this, data);
- lockStatement.LockExpression = ((Expression)(nodeStack.Pop()));
- nodeStack.Push(lockStatement.EmbeddedStatement);
- lockStatement.EmbeddedStatement.AcceptVisitor(this, data);
- lockStatement.EmbeddedStatement = ((Statement)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitMemberReferenceExpression(MemberReferenceExpression memberReferenceExpression, object data) {
- Debug.Assert((memberReferenceExpression != null));
- Debug.Assert((memberReferenceExpression.TargetObject != null));
- Debug.Assert((memberReferenceExpression.TypeArguments != null));
- nodeStack.Push(memberReferenceExpression.TargetObject);
- memberReferenceExpression.TargetObject.AcceptVisitor(this, data);
- memberReferenceExpression.TargetObject = ((Expression)(nodeStack.Pop()));
+ }
+ return null;
+ }
+
+ public virtual object VisitLockStatement(LockStatement lockStatement, object data) {
+ Debug.Assert((lockStatement != null));
+ Debug.Assert((lockStatement.LockExpression != null));
+ Debug.Assert((lockStatement.EmbeddedStatement != null));
+ nodeStack.Push(lockStatement.LockExpression);
+ lockStatement.LockExpression.AcceptVisitor(this, data);
+ lockStatement.LockExpression = ((Expression)(nodeStack.Pop()));
+ nodeStack.Push(lockStatement.EmbeddedStatement);
+ lockStatement.EmbeddedStatement.AcceptVisitor(this, data);
+ lockStatement.EmbeddedStatement = ((Statement)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitMemberReferenceExpression(MemberReferenceExpression memberReferenceExpression, object data) {
+ Debug.Assert((memberReferenceExpression != null));
+ Debug.Assert((memberReferenceExpression.TargetObject != null));
+ Debug.Assert((memberReferenceExpression.TypeArguments != null));
+ nodeStack.Push(memberReferenceExpression.TargetObject);
+ memberReferenceExpression.TargetObject.AcceptVisitor(this, data);
+ memberReferenceExpression.TargetObject = ((Expression)(nodeStack.Pop()));
for (int i = 0; i < memberReferenceExpression.TypeArguments.Count; i++) {
TypeReference o = memberReferenceExpression.TypeArguments[i];
Debug.Assert(o != null);
@@ -1177,18 +1177,18 @@ namespace ICSharpCode.NRefactory.Visitors {
memberReferenceExpression.TypeArguments.RemoveAt(i--);
else
memberReferenceExpression.TypeArguments[i] = o;
- }
- return null;
- }
-
- public virtual object VisitMethodDeclaration(MethodDeclaration methodDeclaration, object data) {
- Debug.Assert((methodDeclaration != null));
- Debug.Assert((methodDeclaration.Attributes != null));
- Debug.Assert((methodDeclaration.Parameters != null));
- Debug.Assert((methodDeclaration.InterfaceImplementations != null));
- Debug.Assert((methodDeclaration.TypeReference != null));
- Debug.Assert((methodDeclaration.Body != null));
- Debug.Assert((methodDeclaration.Templates != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitMethodDeclaration(MethodDeclaration methodDeclaration, object data) {
+ Debug.Assert((methodDeclaration != null));
+ Debug.Assert((methodDeclaration.Attributes != null));
+ Debug.Assert((methodDeclaration.Parameters != null));
+ Debug.Assert((methodDeclaration.InterfaceImplementations != null));
+ Debug.Assert((methodDeclaration.TypeReference != null));
+ Debug.Assert((methodDeclaration.Body != null));
+ Debug.Assert((methodDeclaration.Templates != null));
for (int i = 0; i < methodDeclaration.Attributes.Count; i++) {
AttributeSection o = methodDeclaration.Attributes[i];
Debug.Assert(o != null);
@@ -1199,7 +1199,7 @@ namespace ICSharpCode.NRefactory.Visitors {
methodDeclaration.Attributes.RemoveAt(i--);
else
methodDeclaration.Attributes[i] = o;
- }
+ }
for (int i = 0; i < methodDeclaration.Parameters.Count; i++) {
ParameterDeclarationExpression o = methodDeclaration.Parameters[i];
Debug.Assert(o != null);
@@ -1210,7 +1210,7 @@ namespace ICSharpCode.NRefactory.Visitors {
methodDeclaration.Parameters.RemoveAt(i--);
else
methodDeclaration.Parameters[i] = o;
- }
+ }
for (int i = 0; i < methodDeclaration.InterfaceImplementations.Count; i++) {
InterfaceImplementation o = methodDeclaration.InterfaceImplementations[i];
Debug.Assert(o != null);
@@ -1221,13 +1221,13 @@ namespace ICSharpCode.NRefactory.Visitors {
methodDeclaration.InterfaceImplementations.RemoveAt(i--);
else
methodDeclaration.InterfaceImplementations[i] = o;
- }
- nodeStack.Push(methodDeclaration.TypeReference);
- methodDeclaration.TypeReference.AcceptVisitor(this, data);
- methodDeclaration.TypeReference = ((TypeReference)(nodeStack.Pop()));
- nodeStack.Push(methodDeclaration.Body);
- methodDeclaration.Body.AcceptVisitor(this, data);
- methodDeclaration.Body = ((BlockStatement)(nodeStack.Pop()));
+ }
+ nodeStack.Push(methodDeclaration.TypeReference);
+ methodDeclaration.TypeReference.AcceptVisitor(this, data);
+ methodDeclaration.TypeReference = ((TypeReference)(nodeStack.Pop()));
+ nodeStack.Push(methodDeclaration.Body);
+ methodDeclaration.Body.AcceptVisitor(this, data);
+ methodDeclaration.Body = ((BlockStatement)(nodeStack.Pop()));
for (int i = 0; i < methodDeclaration.Templates.Count; i++) {
TemplateDefinition o = methodDeclaration.Templates[i];
Debug.Assert(o != null);
@@ -1238,21 +1238,21 @@ namespace ICSharpCode.NRefactory.Visitors {
methodDeclaration.Templates.RemoveAt(i--);
else
methodDeclaration.Templates[i] = o;
- }
- return null;
- }
-
- public virtual object VisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression, object data) {
- Debug.Assert((namedArgumentExpression != null));
- Debug.Assert((namedArgumentExpression.Expression != null));
- nodeStack.Push(namedArgumentExpression.Expression);
- namedArgumentExpression.Expression.AcceptVisitor(this, data);
- namedArgumentExpression.Expression = ((Expression)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, object data) {
- Debug.Assert((namespaceDeclaration != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression, object data) {
+ Debug.Assert((namedArgumentExpression != null));
+ Debug.Assert((namedArgumentExpression.Expression != null));
+ nodeStack.Push(namedArgumentExpression.Expression);
+ namedArgumentExpression.Expression.AcceptVisitor(this, data);
+ namedArgumentExpression.Expression = ((Expression)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, object data) {
+ Debug.Assert((namespaceDeclaration != null));
for (int i = 0; i < namespaceDeclaration.Children.Count; i++) {
INode o = namespaceDeclaration.Children[i];
Debug.Assert(o != null);
@@ -1263,18 +1263,18 @@ namespace ICSharpCode.NRefactory.Visitors {
namespaceDeclaration.Children.RemoveAt(i--);
else
namespaceDeclaration.Children[i] = o;
- }
- return null;
- }
-
- public virtual object VisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression, object data) {
- Debug.Assert((objectCreateExpression != null));
- Debug.Assert((objectCreateExpression.CreateType != null));
- Debug.Assert((objectCreateExpression.Parameters != null));
- Debug.Assert((objectCreateExpression.ObjectInitializer != null));
- nodeStack.Push(objectCreateExpression.CreateType);
- objectCreateExpression.CreateType.AcceptVisitor(this, data);
- objectCreateExpression.CreateType = ((TypeReference)(nodeStack.Pop()));
+ }
+ return null;
+ }
+
+ public virtual object VisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression, object data) {
+ Debug.Assert((objectCreateExpression != null));
+ Debug.Assert((objectCreateExpression.CreateType != null));
+ Debug.Assert((objectCreateExpression.Parameters != null));
+ Debug.Assert((objectCreateExpression.ObjectInitializer != null));
+ nodeStack.Push(objectCreateExpression.CreateType);
+ objectCreateExpression.CreateType.AcceptVisitor(this, data);
+ objectCreateExpression.CreateType = ((TypeReference)(nodeStack.Pop()));
for (int i = 0; i < objectCreateExpression.Parameters.Count; i++) {
Expression o = objectCreateExpression.Parameters[i];
Debug.Assert(o != null);
@@ -1285,31 +1285,31 @@ namespace ICSharpCode.NRefactory.Visitors {
objectCreateExpression.Parameters.RemoveAt(i--);
else
objectCreateExpression.Parameters[i] = o;
- }
- nodeStack.Push(objectCreateExpression.ObjectInitializer);
- objectCreateExpression.ObjectInitializer.AcceptVisitor(this, data);
- objectCreateExpression.ObjectInitializer = ((CollectionInitializerExpression)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitOnErrorStatement(OnErrorStatement onErrorStatement, object data) {
- Debug.Assert((onErrorStatement != null));
- Debug.Assert((onErrorStatement.EmbeddedStatement != null));
- nodeStack.Push(onErrorStatement.EmbeddedStatement);
- onErrorStatement.EmbeddedStatement.AcceptVisitor(this, data);
- onErrorStatement.EmbeddedStatement = ((Statement)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitOperatorDeclaration(OperatorDeclaration operatorDeclaration, object data) {
- Debug.Assert((operatorDeclaration != null));
- Debug.Assert((operatorDeclaration.Attributes != null));
- Debug.Assert((operatorDeclaration.Parameters != null));
- Debug.Assert((operatorDeclaration.InterfaceImplementations != null));
- Debug.Assert((operatorDeclaration.TypeReference != null));
- Debug.Assert((operatorDeclaration.Body != null));
- Debug.Assert((operatorDeclaration.Templates != null));
- Debug.Assert((operatorDeclaration.ReturnTypeAttributes != null));
+ }
+ nodeStack.Push(objectCreateExpression.ObjectInitializer);
+ objectCreateExpression.ObjectInitializer.AcceptVisitor(this, data);
+ objectCreateExpression.ObjectInitializer = ((CollectionInitializerExpression)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitOnErrorStatement(OnErrorStatement onErrorStatement, object data) {
+ Debug.Assert((onErrorStatement != null));
+ Debug.Assert((onErrorStatement.EmbeddedStatement != null));
+ nodeStack.Push(onErrorStatement.EmbeddedStatement);
+ onErrorStatement.EmbeddedStatement.AcceptVisitor(this, data);
+ onErrorStatement.EmbeddedStatement = ((Statement)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitOperatorDeclaration(OperatorDeclaration operatorDeclaration, object data) {
+ Debug.Assert((operatorDeclaration != null));
+ Debug.Assert((operatorDeclaration.Attributes != null));
+ Debug.Assert((operatorDeclaration.Parameters != null));
+ Debug.Assert((operatorDeclaration.InterfaceImplementations != null));
+ Debug.Assert((operatorDeclaration.TypeReference != null));
+ Debug.Assert((operatorDeclaration.Body != null));
+ Debug.Assert((operatorDeclaration.Templates != null));
+ Debug.Assert((operatorDeclaration.ReturnTypeAttributes != null));
for (int i = 0; i < operatorDeclaration.Attributes.Count; i++) {
AttributeSection o = operatorDeclaration.Attributes[i];
Debug.Assert(o != null);
@@ -1320,7 +1320,7 @@ namespace ICSharpCode.NRefactory.Visitors {
operatorDeclaration.Attributes.RemoveAt(i--);
else
operatorDeclaration.Attributes[i] = o;
- }
+ }
for (int i = 0; i < operatorDeclaration.Parameters.Count; i++) {
ParameterDeclarationExpression o = operatorDeclaration.Parameters[i];
Debug.Assert(o != null);
@@ -1331,7 +1331,7 @@ namespace ICSharpCode.NRefactory.Visitors {
operatorDeclaration.Parameters.RemoveAt(i--);
else
operatorDeclaration.Parameters[i] = o;
- }
+ }
for (int i = 0; i < operatorDeclaration.InterfaceImplementations.Count; i++) {
InterfaceImplementation o = operatorDeclaration.InterfaceImplementations[i];
Debug.Assert(o != null);
@@ -1342,13 +1342,13 @@ namespace ICSharpCode.NRefactory.Visitors {
operatorDeclaration.InterfaceImplementations.RemoveAt(i--);
else
operatorDeclaration.InterfaceImplementations[i] = o;
- }
- nodeStack.Push(operatorDeclaration.TypeReference);
- operatorDeclaration.TypeReference.AcceptVisitor(this, data);
- operatorDeclaration.TypeReference = ((TypeReference)(nodeStack.Pop()));
- nodeStack.Push(operatorDeclaration.Body);
- operatorDeclaration.Body.AcceptVisitor(this, data);
- operatorDeclaration.Body = ((BlockStatement)(nodeStack.Pop()));
+ }
+ nodeStack.Push(operatorDeclaration.TypeReference);
+ operatorDeclaration.TypeReference.AcceptVisitor(this, data);
+ operatorDeclaration.TypeReference = ((TypeReference)(nodeStack.Pop()));
+ nodeStack.Push(operatorDeclaration.Body);
+ operatorDeclaration.Body.AcceptVisitor(this, data);
+ operatorDeclaration.Body = ((BlockStatement)(nodeStack.Pop()));
for (int i = 0; i < operatorDeclaration.Templates.Count; i++) {
TemplateDefinition o = operatorDeclaration.Templates[i];
Debug.Assert(o != null);
@@ -1359,7 +1359,7 @@ namespace ICSharpCode.NRefactory.Visitors {
operatorDeclaration.Templates.RemoveAt(i--);
else
operatorDeclaration.Templates[i] = o;
- }
+ }
for (int i = 0; i < operatorDeclaration.ReturnTypeAttributes.Count; i++) {
AttributeSection o = operatorDeclaration.ReturnTypeAttributes[i];
Debug.Assert(o != null);
@@ -1370,20 +1370,20 @@ namespace ICSharpCode.NRefactory.Visitors {
operatorDeclaration.ReturnTypeAttributes.RemoveAt(i--);
else
operatorDeclaration.ReturnTypeAttributes[i] = o;
- }
- return null;
- }
-
- public virtual object VisitOptionDeclaration(OptionDeclaration optionDeclaration, object data) {
- Debug.Assert((optionDeclaration != null));
- return null;
- }
-
- public virtual object VisitParameterDeclarationExpression(ParameterDeclarationExpression parameterDeclarationExpression, object data) {
- Debug.Assert((parameterDeclarationExpression != null));
- Debug.Assert((parameterDeclarationExpression.Attributes != null));
- Debug.Assert((parameterDeclarationExpression.TypeReference != null));
- Debug.Assert((parameterDeclarationExpression.DefaultValue != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitOptionDeclaration(OptionDeclaration optionDeclaration, object data) {
+ Debug.Assert((optionDeclaration != null));
+ return null;
+ }
+
+ public virtual object VisitParameterDeclarationExpression(ParameterDeclarationExpression parameterDeclarationExpression, object data) {
+ Debug.Assert((parameterDeclarationExpression != null));
+ Debug.Assert((parameterDeclarationExpression.Attributes != null));
+ Debug.Assert((parameterDeclarationExpression.TypeReference != null));
+ Debug.Assert((parameterDeclarationExpression.DefaultValue != null));
for (int i = 0; i < parameterDeclarationExpression.Attributes.Count; i++) {
AttributeSection o = parameterDeclarationExpression.Attributes[i];
Debug.Assert(o != null);
@@ -1394,32 +1394,32 @@ namespace ICSharpCode.NRefactory.Visitors {
parameterDeclarationExpression.Attributes.RemoveAt(i--);
else
parameterDeclarationExpression.Attributes[i] = o;
- }
- nodeStack.Push(parameterDeclarationExpression.TypeReference);
- parameterDeclarationExpression.TypeReference.AcceptVisitor(this, data);
- parameterDeclarationExpression.TypeReference = ((TypeReference)(nodeStack.Pop()));
- nodeStack.Push(parameterDeclarationExpression.DefaultValue);
- parameterDeclarationExpression.DefaultValue.AcceptVisitor(this, data);
- parameterDeclarationExpression.DefaultValue = ((Expression)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression, object data) {
- Debug.Assert((parenthesizedExpression != null));
- Debug.Assert((parenthesizedExpression.Expression != null));
- nodeStack.Push(parenthesizedExpression.Expression);
- parenthesizedExpression.Expression.AcceptVisitor(this, data);
- parenthesizedExpression.Expression = ((Expression)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitPointerReferenceExpression(PointerReferenceExpression pointerReferenceExpression, object data) {
- Debug.Assert((pointerReferenceExpression != null));
- Debug.Assert((pointerReferenceExpression.TargetObject != null));
- Debug.Assert((pointerReferenceExpression.TypeArguments != null));
- nodeStack.Push(pointerReferenceExpression.TargetObject);
- pointerReferenceExpression.TargetObject.AcceptVisitor(this, data);
- pointerReferenceExpression.TargetObject = ((Expression)(nodeStack.Pop()));
+ }
+ nodeStack.Push(parameterDeclarationExpression.TypeReference);
+ parameterDeclarationExpression.TypeReference.AcceptVisitor(this, data);
+ parameterDeclarationExpression.TypeReference = ((TypeReference)(nodeStack.Pop()));
+ nodeStack.Push(parameterDeclarationExpression.DefaultValue);
+ parameterDeclarationExpression.DefaultValue.AcceptVisitor(this, data);
+ parameterDeclarationExpression.DefaultValue = ((Expression)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression, object data) {
+ Debug.Assert((parenthesizedExpression != null));
+ Debug.Assert((parenthesizedExpression.Expression != null));
+ nodeStack.Push(parenthesizedExpression.Expression);
+ parenthesizedExpression.Expression.AcceptVisitor(this, data);
+ parenthesizedExpression.Expression = ((Expression)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitPointerReferenceExpression(PointerReferenceExpression pointerReferenceExpression, object data) {
+ Debug.Assert((pointerReferenceExpression != null));
+ Debug.Assert((pointerReferenceExpression.TargetObject != null));
+ Debug.Assert((pointerReferenceExpression.TypeArguments != null));
+ nodeStack.Push(pointerReferenceExpression.TargetObject);
+ pointerReferenceExpression.TargetObject.AcceptVisitor(this, data);
+ pointerReferenceExpression.TargetObject = ((Expression)(nodeStack.Pop()));
for (int i = 0; i < pointerReferenceExpression.TypeArguments.Count; i++) {
TypeReference o = pointerReferenceExpression.TypeArguments[i];
Debug.Assert(o != null);
@@ -1430,23 +1430,23 @@ namespace ICSharpCode.NRefactory.Visitors {
pointerReferenceExpression.TypeArguments.RemoveAt(i--);
else
pointerReferenceExpression.TypeArguments[i] = o;
- }
- return null;
- }
-
- public virtual object VisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data) {
- Debug.Assert((primitiveExpression != null));
- return null;
- }
-
- public virtual object VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration, object data) {
- Debug.Assert((propertyDeclaration != null));
- Debug.Assert((propertyDeclaration.Attributes != null));
- Debug.Assert((propertyDeclaration.Parameters != null));
- Debug.Assert((propertyDeclaration.InterfaceImplementations != null));
- Debug.Assert((propertyDeclaration.TypeReference != null));
- Debug.Assert((propertyDeclaration.GetRegion != null));
- Debug.Assert((propertyDeclaration.SetRegion != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data) {
+ Debug.Assert((primitiveExpression != null));
+ return null;
+ }
+
+ public virtual object VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration, object data) {
+ Debug.Assert((propertyDeclaration != null));
+ Debug.Assert((propertyDeclaration.Attributes != null));
+ Debug.Assert((propertyDeclaration.Parameters != null));
+ Debug.Assert((propertyDeclaration.InterfaceImplementations != null));
+ Debug.Assert((propertyDeclaration.TypeReference != null));
+ Debug.Assert((propertyDeclaration.GetRegion != null));
+ Debug.Assert((propertyDeclaration.SetRegion != null));
for (int i = 0; i < propertyDeclaration.Attributes.Count; i++) {
AttributeSection o = propertyDeclaration.Attributes[i];
Debug.Assert(o != null);
@@ -1457,7 +1457,7 @@ namespace ICSharpCode.NRefactory.Visitors {
propertyDeclaration.Attributes.RemoveAt(i--);
else
propertyDeclaration.Attributes[i] = o;
- }
+ }
for (int i = 0; i < propertyDeclaration.Parameters.Count; i++) {
ParameterDeclarationExpression o = propertyDeclaration.Parameters[i];
Debug.Assert(o != null);
@@ -1468,7 +1468,7 @@ namespace ICSharpCode.NRefactory.Visitors {
propertyDeclaration.Parameters.RemoveAt(i--);
else
propertyDeclaration.Parameters[i] = o;
- }
+ }
for (int i = 0; i < propertyDeclaration.InterfaceImplementations.Count; i++) {
InterfaceImplementation o = propertyDeclaration.InterfaceImplementations[i];
Debug.Assert(o != null);
@@ -1479,23 +1479,23 @@ namespace ICSharpCode.NRefactory.Visitors {
propertyDeclaration.InterfaceImplementations.RemoveAt(i--);
else
propertyDeclaration.InterfaceImplementations[i] = o;
- }
- nodeStack.Push(propertyDeclaration.TypeReference);
- propertyDeclaration.TypeReference.AcceptVisitor(this, data);
- propertyDeclaration.TypeReference = ((TypeReference)(nodeStack.Pop()));
- nodeStack.Push(propertyDeclaration.GetRegion);
- propertyDeclaration.GetRegion.AcceptVisitor(this, data);
- propertyDeclaration.GetRegion = ((PropertyGetRegion)(nodeStack.Pop()));
- nodeStack.Push(propertyDeclaration.SetRegion);
- propertyDeclaration.SetRegion.AcceptVisitor(this, data);
- propertyDeclaration.SetRegion = ((PropertySetRegion)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitPropertyGetRegion(PropertyGetRegion propertyGetRegion, object data) {
- Debug.Assert((propertyGetRegion != null));
- Debug.Assert((propertyGetRegion.Attributes != null));
- Debug.Assert((propertyGetRegion.Block != null));
+ }
+ nodeStack.Push(propertyDeclaration.TypeReference);
+ propertyDeclaration.TypeReference.AcceptVisitor(this, data);
+ propertyDeclaration.TypeReference = ((TypeReference)(nodeStack.Pop()));
+ nodeStack.Push(propertyDeclaration.GetRegion);
+ propertyDeclaration.GetRegion.AcceptVisitor(this, data);
+ propertyDeclaration.GetRegion = ((PropertyGetRegion)(nodeStack.Pop()));
+ nodeStack.Push(propertyDeclaration.SetRegion);
+ propertyDeclaration.SetRegion.AcceptVisitor(this, data);
+ propertyDeclaration.SetRegion = ((PropertySetRegion)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitPropertyGetRegion(PropertyGetRegion propertyGetRegion, object data) {
+ Debug.Assert((propertyGetRegion != null));
+ Debug.Assert((propertyGetRegion.Attributes != null));
+ Debug.Assert((propertyGetRegion.Block != null));
for (int i = 0; i < propertyGetRegion.Attributes.Count; i++) {
AttributeSection o = propertyGetRegion.Attributes[i];
Debug.Assert(o != null);
@@ -1506,18 +1506,18 @@ namespace ICSharpCode.NRefactory.Visitors {
propertyGetRegion.Attributes.RemoveAt(i--);
else
propertyGetRegion.Attributes[i] = o;
- }
- nodeStack.Push(propertyGetRegion.Block);
- propertyGetRegion.Block.AcceptVisitor(this, data);
- propertyGetRegion.Block = ((BlockStatement)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitPropertySetRegion(PropertySetRegion propertySetRegion, object data) {
- Debug.Assert((propertySetRegion != null));
- Debug.Assert((propertySetRegion.Attributes != null));
- Debug.Assert((propertySetRegion.Block != null));
- Debug.Assert((propertySetRegion.Parameters != null));
+ }
+ nodeStack.Push(propertyGetRegion.Block);
+ propertyGetRegion.Block.AcceptVisitor(this, data);
+ propertyGetRegion.Block = ((BlockStatement)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitPropertySetRegion(PropertySetRegion propertySetRegion, object data) {
+ Debug.Assert((propertySetRegion != null));
+ Debug.Assert((propertySetRegion.Attributes != null));
+ Debug.Assert((propertySetRegion.Block != null));
+ Debug.Assert((propertySetRegion.Parameters != null));
for (int i = 0; i < propertySetRegion.Attributes.Count; i++) {
AttributeSection o = propertySetRegion.Attributes[i];
Debug.Assert(o != null);
@@ -1528,10 +1528,10 @@ namespace ICSharpCode.NRefactory.Visitors {
propertySetRegion.Attributes.RemoveAt(i--);
else
propertySetRegion.Attributes[i] = o;
- }
- nodeStack.Push(propertySetRegion.Block);
- propertySetRegion.Block.AcceptVisitor(this, data);
- propertySetRegion.Block = ((BlockStatement)(nodeStack.Pop()));
+ }
+ nodeStack.Push(propertySetRegion.Block);
+ propertySetRegion.Block.AcceptVisitor(this, data);
+ propertySetRegion.Block = ((BlockStatement)(nodeStack.Pop()));
for (int i = 0; i < propertySetRegion.Parameters.Count; i++) {
ParameterDeclarationExpression o = propertySetRegion.Parameters[i];
Debug.Assert(o != null);
@@ -1542,18 +1542,18 @@ namespace ICSharpCode.NRefactory.Visitors {
propertySetRegion.Parameters.RemoveAt(i--);
else
propertySetRegion.Parameters[i] = o;
- }
- return null;
- }
-
- public virtual object VisitQueryExpression(QueryExpression queryExpression, object data) {
- Debug.Assert((queryExpression != null));
- Debug.Assert((queryExpression.FromClause != null));
- Debug.Assert((queryExpression.MiddleClauses != null));
- Debug.Assert((queryExpression.SelectOrGroupClause != null));
- nodeStack.Push(queryExpression.FromClause);
- queryExpression.FromClause.AcceptVisitor(this, data);
- queryExpression.FromClause = ((QueryExpressionFromClause)(nodeStack.Pop()));
+ }
+ return null;
+ }
+
+ public virtual object VisitQueryExpression(QueryExpression queryExpression, object data) {
+ Debug.Assert((queryExpression != null));
+ Debug.Assert((queryExpression.FromClause != null));
+ Debug.Assert((queryExpression.MiddleClauses != null));
+ Debug.Assert((queryExpression.SelectOrGroupClause != null));
+ nodeStack.Push(queryExpression.FromClause);
+ queryExpression.FromClause.AcceptVisitor(this, data);
+ queryExpression.FromClause = ((QueryExpressionFromClause)(nodeStack.Pop()));
for (int i = 0; i < queryExpression.MiddleClauses.Count; i++) {
QueryExpressionClause o = queryExpression.MiddleClauses[i];
Debug.Assert(o != null);
@@ -1564,21 +1564,21 @@ namespace ICSharpCode.NRefactory.Visitors {
queryExpression.MiddleClauses.RemoveAt(i--);
else
queryExpression.MiddleClauses[i] = o;
- }
- nodeStack.Push(queryExpression.SelectOrGroupClause);
- queryExpression.SelectOrGroupClause.AcceptVisitor(this, data);
- queryExpression.SelectOrGroupClause = ((QueryExpressionClause)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitQueryExpressionAggregateClause(QueryExpressionAggregateClause queryExpressionAggregateClause, object data) {
- Debug.Assert((queryExpressionAggregateClause != null));
- Debug.Assert((queryExpressionAggregateClause.FromClause != null));
- Debug.Assert((queryExpressionAggregateClause.MiddleClauses != null));
- Debug.Assert((queryExpressionAggregateClause.IntoVariables != null));
- nodeStack.Push(queryExpressionAggregateClause.FromClause);
- queryExpressionAggregateClause.FromClause.AcceptVisitor(this, data);
- queryExpressionAggregateClause.FromClause = ((QueryExpressionFromClause)(nodeStack.Pop()));
+ }
+ nodeStack.Push(queryExpression.SelectOrGroupClause);
+ queryExpression.SelectOrGroupClause.AcceptVisitor(this, data);
+ queryExpression.SelectOrGroupClause = ((QueryExpressionClause)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitQueryExpressionAggregateClause(QueryExpressionAggregateClause queryExpressionAggregateClause, object data) {
+ Debug.Assert((queryExpressionAggregateClause != null));
+ Debug.Assert((queryExpressionAggregateClause.FromClause != null));
+ Debug.Assert((queryExpressionAggregateClause.MiddleClauses != null));
+ Debug.Assert((queryExpressionAggregateClause.IntoVariables != null));
+ nodeStack.Push(queryExpressionAggregateClause.FromClause);
+ queryExpressionAggregateClause.FromClause.AcceptVisitor(this, data);
+ queryExpressionAggregateClause.FromClause = ((QueryExpressionFromClause)(nodeStack.Pop()));
for (int i = 0; i < queryExpressionAggregateClause.MiddleClauses.Count; i++) {
QueryExpressionClause o = queryExpressionAggregateClause.MiddleClauses[i];
Debug.Assert(o != null);
@@ -1589,7 +1589,7 @@ namespace ICSharpCode.NRefactory.Visitors {
queryExpressionAggregateClause.MiddleClauses.RemoveAt(i--);
else
queryExpressionAggregateClause.MiddleClauses[i] = o;
- }
+ }
for (int i = 0; i < queryExpressionAggregateClause.IntoVariables.Count; i++) {
ExpressionRangeVariable o = queryExpressionAggregateClause.IntoVariables[i];
Debug.Assert(o != null);
@@ -1600,48 +1600,48 @@ namespace ICSharpCode.NRefactory.Visitors {
queryExpressionAggregateClause.IntoVariables.RemoveAt(i--);
else
queryExpressionAggregateClause.IntoVariables[i] = o;
- }
- return null;
- }
-
- public virtual object VisitQueryExpressionDistinctClause(QueryExpressionDistinctClause queryExpressionDistinctClause, object data) {
- Debug.Assert((queryExpressionDistinctClause != null));
- return null;
- }
-
- public virtual object VisitQueryExpressionFromClause(QueryExpressionFromClause queryExpressionFromClause, object data) {
- Debug.Assert((queryExpressionFromClause != null));
- Debug.Assert((queryExpressionFromClause.Type != null));
- Debug.Assert((queryExpressionFromClause.InExpression != null));
- nodeStack.Push(queryExpressionFromClause.Type);
- queryExpressionFromClause.Type.AcceptVisitor(this, data);
- queryExpressionFromClause.Type = ((TypeReference)(nodeStack.Pop()));
- nodeStack.Push(queryExpressionFromClause.InExpression);
- queryExpressionFromClause.InExpression.AcceptVisitor(this, data);
- queryExpressionFromClause.InExpression = ((Expression)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitQueryExpressionGroupClause(QueryExpressionGroupClause queryExpressionGroupClause, object data) {
- Debug.Assert((queryExpressionGroupClause != null));
- Debug.Assert((queryExpressionGroupClause.Projection != null));
- Debug.Assert((queryExpressionGroupClause.GroupBy != null));
- nodeStack.Push(queryExpressionGroupClause.Projection);
- queryExpressionGroupClause.Projection.AcceptVisitor(this, data);
- queryExpressionGroupClause.Projection = ((Expression)(nodeStack.Pop()));
- nodeStack.Push(queryExpressionGroupClause.GroupBy);
- queryExpressionGroupClause.GroupBy.AcceptVisitor(this, data);
- queryExpressionGroupClause.GroupBy = ((Expression)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitQueryExpressionGroupJoinVBClause(QueryExpressionGroupJoinVBClause queryExpressionGroupJoinVBClause, object data) {
- Debug.Assert((queryExpressionGroupJoinVBClause != null));
- Debug.Assert((queryExpressionGroupJoinVBClause.JoinClause != null));
- Debug.Assert((queryExpressionGroupJoinVBClause.IntoVariables != null));
- nodeStack.Push(queryExpressionGroupJoinVBClause.JoinClause);
- queryExpressionGroupJoinVBClause.JoinClause.AcceptVisitor(this, data);
- queryExpressionGroupJoinVBClause.JoinClause = ((QueryExpressionJoinVBClause)(nodeStack.Pop()));
+ }
+ return null;
+ }
+
+ public virtual object VisitQueryExpressionDistinctClause(QueryExpressionDistinctClause queryExpressionDistinctClause, object data) {
+ Debug.Assert((queryExpressionDistinctClause != null));
+ return null;
+ }
+
+ public virtual object VisitQueryExpressionFromClause(QueryExpressionFromClause queryExpressionFromClause, object data) {
+ Debug.Assert((queryExpressionFromClause != null));
+ Debug.Assert((queryExpressionFromClause.Type != null));
+ Debug.Assert((queryExpressionFromClause.InExpression != null));
+ nodeStack.Push(queryExpressionFromClause.Type);
+ queryExpressionFromClause.Type.AcceptVisitor(this, data);
+ queryExpressionFromClause.Type = ((TypeReference)(nodeStack.Pop()));
+ nodeStack.Push(queryExpressionFromClause.InExpression);
+ queryExpressionFromClause.InExpression.AcceptVisitor(this, data);
+ queryExpressionFromClause.InExpression = ((Expression)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitQueryExpressionGroupClause(QueryExpressionGroupClause queryExpressionGroupClause, object data) {
+ Debug.Assert((queryExpressionGroupClause != null));
+ Debug.Assert((queryExpressionGroupClause.Projection != null));
+ Debug.Assert((queryExpressionGroupClause.GroupBy != null));
+ nodeStack.Push(queryExpressionGroupClause.Projection);
+ queryExpressionGroupClause.Projection.AcceptVisitor(this, data);
+ queryExpressionGroupClause.Projection = ((Expression)(nodeStack.Pop()));
+ nodeStack.Push(queryExpressionGroupClause.GroupBy);
+ queryExpressionGroupClause.GroupBy.AcceptVisitor(this, data);
+ queryExpressionGroupClause.GroupBy = ((Expression)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitQueryExpressionGroupJoinVBClause(QueryExpressionGroupJoinVBClause queryExpressionGroupJoinVBClause, object data) {
+ Debug.Assert((queryExpressionGroupJoinVBClause != null));
+ Debug.Assert((queryExpressionGroupJoinVBClause.JoinClause != null));
+ Debug.Assert((queryExpressionGroupJoinVBClause.IntoVariables != null));
+ nodeStack.Push(queryExpressionGroupJoinVBClause.JoinClause);
+ queryExpressionGroupJoinVBClause.JoinClause.AcceptVisitor(this, data);
+ queryExpressionGroupJoinVBClause.JoinClause = ((QueryExpressionJoinVBClause)(nodeStack.Pop()));
for (int i = 0; i < queryExpressionGroupJoinVBClause.IntoVariables.Count; i++) {
ExpressionRangeVariable o = queryExpressionGroupJoinVBClause.IntoVariables[i];
Debug.Assert(o != null);
@@ -1652,15 +1652,15 @@ namespace ICSharpCode.NRefactory.Visitors {
queryExpressionGroupJoinVBClause.IntoVariables.RemoveAt(i--);
else
queryExpressionGroupJoinVBClause.IntoVariables[i] = o;
- }
- return null;
- }
-
- public virtual object VisitQueryExpressionGroupVBClause(QueryExpressionGroupVBClause queryExpressionGroupVBClause, object data) {
- Debug.Assert((queryExpressionGroupVBClause != null));
- Debug.Assert((queryExpressionGroupVBClause.GroupVariables != null));
- Debug.Assert((queryExpressionGroupVBClause.ByVariables != null));
- Debug.Assert((queryExpressionGroupVBClause.IntoVariables != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitQueryExpressionGroupVBClause(QueryExpressionGroupVBClause queryExpressionGroupVBClause, object data) {
+ Debug.Assert((queryExpressionGroupVBClause != null));
+ Debug.Assert((queryExpressionGroupVBClause.GroupVariables != null));
+ Debug.Assert((queryExpressionGroupVBClause.ByVariables != null));
+ Debug.Assert((queryExpressionGroupVBClause.IntoVariables != null));
for (int i = 0; i < queryExpressionGroupVBClause.GroupVariables.Count; i++) {
ExpressionRangeVariable o = queryExpressionGroupVBClause.GroupVariables[i];
Debug.Assert(o != null);
@@ -1671,7 +1671,7 @@ namespace ICSharpCode.NRefactory.Visitors {
queryExpressionGroupVBClause.GroupVariables.RemoveAt(i--);
else
queryExpressionGroupVBClause.GroupVariables[i] = o;
- }
+ }
for (int i = 0; i < queryExpressionGroupVBClause.ByVariables.Count; i++) {
ExpressionRangeVariable o = queryExpressionGroupVBClause.ByVariables[i];
Debug.Assert(o != null);
@@ -1682,7 +1682,7 @@ namespace ICSharpCode.NRefactory.Visitors {
queryExpressionGroupVBClause.ByVariables.RemoveAt(i--);
else
queryExpressionGroupVBClause.ByVariables[i] = o;
- }
+ }
for (int i = 0; i < queryExpressionGroupVBClause.IntoVariables.Count; i++) {
ExpressionRangeVariable o = queryExpressionGroupVBClause.IntoVariables[i];
Debug.Assert(o != null);
@@ -1693,55 +1693,55 @@ namespace ICSharpCode.NRefactory.Visitors {
queryExpressionGroupVBClause.IntoVariables.RemoveAt(i--);
else
queryExpressionGroupVBClause.IntoVariables[i] = o;
- }
- return null;
- }
-
- public virtual object VisitQueryExpressionJoinClause(QueryExpressionJoinClause queryExpressionJoinClause, object data) {
- Debug.Assert((queryExpressionJoinClause != null));
- Debug.Assert((queryExpressionJoinClause.Type != null));
- Debug.Assert((queryExpressionJoinClause.InExpression != null));
- Debug.Assert((queryExpressionJoinClause.OnExpression != null));
- Debug.Assert((queryExpressionJoinClause.EqualsExpression != null));
- nodeStack.Push(queryExpressionJoinClause.Type);
- queryExpressionJoinClause.Type.AcceptVisitor(this, data);
- queryExpressionJoinClause.Type = ((TypeReference)(nodeStack.Pop()));
- nodeStack.Push(queryExpressionJoinClause.InExpression);
- queryExpressionJoinClause.InExpression.AcceptVisitor(this, data);
- queryExpressionJoinClause.InExpression = ((Expression)(nodeStack.Pop()));
- nodeStack.Push(queryExpressionJoinClause.OnExpression);
- queryExpressionJoinClause.OnExpression.AcceptVisitor(this, data);
- queryExpressionJoinClause.OnExpression = ((Expression)(nodeStack.Pop()));
- nodeStack.Push(queryExpressionJoinClause.EqualsExpression);
- queryExpressionJoinClause.EqualsExpression.AcceptVisitor(this, data);
- queryExpressionJoinClause.EqualsExpression = ((Expression)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitQueryExpressionJoinConditionVB(QueryExpressionJoinConditionVB queryExpressionJoinConditionVB, object data) {
- Debug.Assert((queryExpressionJoinConditionVB != null));
- Debug.Assert((queryExpressionJoinConditionVB.LeftSide != null));
- Debug.Assert((queryExpressionJoinConditionVB.RightSide != null));
- nodeStack.Push(queryExpressionJoinConditionVB.LeftSide);
- queryExpressionJoinConditionVB.LeftSide.AcceptVisitor(this, data);
- queryExpressionJoinConditionVB.LeftSide = ((Expression)(nodeStack.Pop()));
- nodeStack.Push(queryExpressionJoinConditionVB.RightSide);
- queryExpressionJoinConditionVB.RightSide.AcceptVisitor(this, data);
- queryExpressionJoinConditionVB.RightSide = ((Expression)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitQueryExpressionJoinVBClause(QueryExpressionJoinVBClause queryExpressionJoinVBClause, object data) {
- Debug.Assert((queryExpressionJoinVBClause != null));
- Debug.Assert((queryExpressionJoinVBClause.JoinVariable != null));
- Debug.Assert((queryExpressionJoinVBClause.SubJoin != null));
- Debug.Assert((queryExpressionJoinVBClause.Conditions != null));
- nodeStack.Push(queryExpressionJoinVBClause.JoinVariable);
- queryExpressionJoinVBClause.JoinVariable.AcceptVisitor(this, data);
- queryExpressionJoinVBClause.JoinVariable = ((QueryExpressionFromClause)(nodeStack.Pop()));
- nodeStack.Push(queryExpressionJoinVBClause.SubJoin);
- queryExpressionJoinVBClause.SubJoin.AcceptVisitor(this, data);
- queryExpressionJoinVBClause.SubJoin = ((QueryExpressionJoinVBClause)(nodeStack.Pop()));
+ }
+ return null;
+ }
+
+ public virtual object VisitQueryExpressionJoinClause(QueryExpressionJoinClause queryExpressionJoinClause, object data) {
+ Debug.Assert((queryExpressionJoinClause != null));
+ Debug.Assert((queryExpressionJoinClause.Type != null));
+ Debug.Assert((queryExpressionJoinClause.InExpression != null));
+ Debug.Assert((queryExpressionJoinClause.OnExpression != null));
+ Debug.Assert((queryExpressionJoinClause.EqualsExpression != null));
+ nodeStack.Push(queryExpressionJoinClause.Type);
+ queryExpressionJoinClause.Type.AcceptVisitor(this, data);
+ queryExpressionJoinClause.Type = ((TypeReference)(nodeStack.Pop()));
+ nodeStack.Push(queryExpressionJoinClause.InExpression);
+ queryExpressionJoinClause.InExpression.AcceptVisitor(this, data);
+ queryExpressionJoinClause.InExpression = ((Expression)(nodeStack.Pop()));
+ nodeStack.Push(queryExpressionJoinClause.OnExpression);
+ queryExpressionJoinClause.OnExpression.AcceptVisitor(this, data);
+ queryExpressionJoinClause.OnExpression = ((Expression)(nodeStack.Pop()));
+ nodeStack.Push(queryExpressionJoinClause.EqualsExpression);
+ queryExpressionJoinClause.EqualsExpression.AcceptVisitor(this, data);
+ queryExpressionJoinClause.EqualsExpression = ((Expression)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitQueryExpressionJoinConditionVB(QueryExpressionJoinConditionVB queryExpressionJoinConditionVB, object data) {
+ Debug.Assert((queryExpressionJoinConditionVB != null));
+ Debug.Assert((queryExpressionJoinConditionVB.LeftSide != null));
+ Debug.Assert((queryExpressionJoinConditionVB.RightSide != null));
+ nodeStack.Push(queryExpressionJoinConditionVB.LeftSide);
+ queryExpressionJoinConditionVB.LeftSide.AcceptVisitor(this, data);
+ queryExpressionJoinConditionVB.LeftSide = ((Expression)(nodeStack.Pop()));
+ nodeStack.Push(queryExpressionJoinConditionVB.RightSide);
+ queryExpressionJoinConditionVB.RightSide.AcceptVisitor(this, data);
+ queryExpressionJoinConditionVB.RightSide = ((Expression)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitQueryExpressionJoinVBClause(QueryExpressionJoinVBClause queryExpressionJoinVBClause, object data) {
+ Debug.Assert((queryExpressionJoinVBClause != null));
+ Debug.Assert((queryExpressionJoinVBClause.JoinVariable != null));
+ Debug.Assert((queryExpressionJoinVBClause.SubJoin != null));
+ Debug.Assert((queryExpressionJoinVBClause.Conditions != null));
+ nodeStack.Push(queryExpressionJoinVBClause.JoinVariable);
+ queryExpressionJoinVBClause.JoinVariable.AcceptVisitor(this, data);
+ queryExpressionJoinVBClause.JoinVariable = ((QueryExpressionFromClause)(nodeStack.Pop()));
+ nodeStack.Push(queryExpressionJoinVBClause.SubJoin);
+ queryExpressionJoinVBClause.SubJoin.AcceptVisitor(this, data);
+ queryExpressionJoinVBClause.SubJoin = ((QueryExpressionJoinVBClause)(nodeStack.Pop()));
for (int i = 0; i < queryExpressionJoinVBClause.Conditions.Count; i++) {
QueryExpressionJoinConditionVB o = queryExpressionJoinVBClause.Conditions[i];
Debug.Assert(o != null);
@@ -1752,22 +1752,22 @@ namespace ICSharpCode.NRefactory.Visitors {
queryExpressionJoinVBClause.Conditions.RemoveAt(i--);
else
queryExpressionJoinVBClause.Conditions[i] = o;
- }
- return null;
- }
-
- public virtual object VisitQueryExpressionLetClause(QueryExpressionLetClause queryExpressionLetClause, object data) {
- Debug.Assert((queryExpressionLetClause != null));
- Debug.Assert((queryExpressionLetClause.Expression != null));
- nodeStack.Push(queryExpressionLetClause.Expression);
- queryExpressionLetClause.Expression.AcceptVisitor(this, data);
- queryExpressionLetClause.Expression = ((Expression)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitQueryExpressionLetVBClause(QueryExpressionLetVBClause queryExpressionLetVBClause, object data) {
- Debug.Assert((queryExpressionLetVBClause != null));
- Debug.Assert((queryExpressionLetVBClause.Variables != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitQueryExpressionLetClause(QueryExpressionLetClause queryExpressionLetClause, object data) {
+ Debug.Assert((queryExpressionLetClause != null));
+ Debug.Assert((queryExpressionLetClause.Expression != null));
+ nodeStack.Push(queryExpressionLetClause.Expression);
+ queryExpressionLetClause.Expression.AcceptVisitor(this, data);
+ queryExpressionLetClause.Expression = ((Expression)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitQueryExpressionLetVBClause(QueryExpressionLetVBClause queryExpressionLetVBClause, object data) {
+ Debug.Assert((queryExpressionLetVBClause != null));
+ Debug.Assert((queryExpressionLetVBClause.Variables != null));
for (int i = 0; i < queryExpressionLetVBClause.Variables.Count; i++) {
ExpressionRangeVariable o = queryExpressionLetVBClause.Variables[i];
Debug.Assert(o != null);
@@ -1778,13 +1778,13 @@ namespace ICSharpCode.NRefactory.Visitors {
queryExpressionLetVBClause.Variables.RemoveAt(i--);
else
queryExpressionLetVBClause.Variables[i] = o;
- }
- return null;
- }
-
- public virtual object VisitQueryExpressionOrderClause(QueryExpressionOrderClause queryExpressionOrderClause, object data) {
- Debug.Assert((queryExpressionOrderClause != null));
- Debug.Assert((queryExpressionOrderClause.Orderings != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitQueryExpressionOrderClause(QueryExpressionOrderClause queryExpressionOrderClause, object data) {
+ Debug.Assert((queryExpressionOrderClause != null));
+ Debug.Assert((queryExpressionOrderClause.Orderings != null));
for (int i = 0; i < queryExpressionOrderClause.Orderings.Count; i++) {
QueryExpressionOrdering o = queryExpressionOrderClause.Orderings[i];
Debug.Assert(o != null);
@@ -1795,40 +1795,40 @@ namespace ICSharpCode.NRefactory.Visitors {
queryExpressionOrderClause.Orderings.RemoveAt(i--);
else
queryExpressionOrderClause.Orderings[i] = o;
- }
- return null;
- }
-
- public virtual object VisitQueryExpressionOrdering(QueryExpressionOrdering queryExpressionOrdering, object data) {
- Debug.Assert((queryExpressionOrdering != null));
- Debug.Assert((queryExpressionOrdering.Criteria != null));
- nodeStack.Push(queryExpressionOrdering.Criteria);
- queryExpressionOrdering.Criteria.AcceptVisitor(this, data);
- queryExpressionOrdering.Criteria = ((Expression)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitQueryExpressionPartitionVBClause(QueryExpressionPartitionVBClause queryExpressionPartitionVBClause, object data) {
- Debug.Assert((queryExpressionPartitionVBClause != null));
- Debug.Assert((queryExpressionPartitionVBClause.Expression != null));
- nodeStack.Push(queryExpressionPartitionVBClause.Expression);
- queryExpressionPartitionVBClause.Expression.AcceptVisitor(this, data);
- queryExpressionPartitionVBClause.Expression = ((Expression)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitQueryExpressionSelectClause(QueryExpressionSelectClause queryExpressionSelectClause, object data) {
- Debug.Assert((queryExpressionSelectClause != null));
- Debug.Assert((queryExpressionSelectClause.Projection != null));
- nodeStack.Push(queryExpressionSelectClause.Projection);
- queryExpressionSelectClause.Projection.AcceptVisitor(this, data);
- queryExpressionSelectClause.Projection = ((Expression)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitQueryExpressionSelectVBClause(QueryExpressionSelectVBClause queryExpressionSelectVBClause, object data) {
- Debug.Assert((queryExpressionSelectVBClause != null));
- Debug.Assert((queryExpressionSelectVBClause.Variables != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitQueryExpressionOrdering(QueryExpressionOrdering queryExpressionOrdering, object data) {
+ Debug.Assert((queryExpressionOrdering != null));
+ Debug.Assert((queryExpressionOrdering.Criteria != null));
+ nodeStack.Push(queryExpressionOrdering.Criteria);
+ queryExpressionOrdering.Criteria.AcceptVisitor(this, data);
+ queryExpressionOrdering.Criteria = ((Expression)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitQueryExpressionPartitionVBClause(QueryExpressionPartitionVBClause queryExpressionPartitionVBClause, object data) {
+ Debug.Assert((queryExpressionPartitionVBClause != null));
+ Debug.Assert((queryExpressionPartitionVBClause.Expression != null));
+ nodeStack.Push(queryExpressionPartitionVBClause.Expression);
+ queryExpressionPartitionVBClause.Expression.AcceptVisitor(this, data);
+ queryExpressionPartitionVBClause.Expression = ((Expression)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitQueryExpressionSelectClause(QueryExpressionSelectClause queryExpressionSelectClause, object data) {
+ Debug.Assert((queryExpressionSelectClause != null));
+ Debug.Assert((queryExpressionSelectClause.Projection != null));
+ nodeStack.Push(queryExpressionSelectClause.Projection);
+ queryExpressionSelectClause.Projection.AcceptVisitor(this, data);
+ queryExpressionSelectClause.Projection = ((Expression)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitQueryExpressionSelectVBClause(QueryExpressionSelectVBClause queryExpressionSelectVBClause, object data) {
+ Debug.Assert((queryExpressionSelectVBClause != null));
+ Debug.Assert((queryExpressionSelectVBClause.Variables != null));
for (int i = 0; i < queryExpressionSelectVBClause.Variables.Count; i++) {
ExpressionRangeVariable o = queryExpressionSelectVBClause.Variables[i];
Debug.Assert(o != null);
@@ -1839,22 +1839,22 @@ namespace ICSharpCode.NRefactory.Visitors {
queryExpressionSelectVBClause.Variables.RemoveAt(i--);
else
queryExpressionSelectVBClause.Variables[i] = o;
- }
- return null;
- }
-
- public virtual object VisitQueryExpressionWhereClause(QueryExpressionWhereClause queryExpressionWhereClause, object data) {
- Debug.Assert((queryExpressionWhereClause != null));
- Debug.Assert((queryExpressionWhereClause.Condition != null));
- nodeStack.Push(queryExpressionWhereClause.Condition);
- queryExpressionWhereClause.Condition.AcceptVisitor(this, data);
- queryExpressionWhereClause.Condition = ((Expression)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitRaiseEventStatement(RaiseEventStatement raiseEventStatement, object data) {
- Debug.Assert((raiseEventStatement != null));
- Debug.Assert((raiseEventStatement.Arguments != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitQueryExpressionWhereClause(QueryExpressionWhereClause queryExpressionWhereClause, object data) {
+ Debug.Assert((queryExpressionWhereClause != null));
+ Debug.Assert((queryExpressionWhereClause.Condition != null));
+ nodeStack.Push(queryExpressionWhereClause.Condition);
+ queryExpressionWhereClause.Condition.AcceptVisitor(this, data);
+ queryExpressionWhereClause.Condition = ((Expression)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitRaiseEventStatement(RaiseEventStatement raiseEventStatement, object data) {
+ Debug.Assert((raiseEventStatement != null));
+ Debug.Assert((raiseEventStatement.Arguments != null));
for (int i = 0; i < raiseEventStatement.Arguments.Count; i++) {
Expression o = raiseEventStatement.Arguments[i];
Debug.Assert(o != null);
@@ -1865,13 +1865,13 @@ namespace ICSharpCode.NRefactory.Visitors {
raiseEventStatement.Arguments.RemoveAt(i--);
else
raiseEventStatement.Arguments[i] = o;
- }
- return null;
- }
-
- public virtual object VisitReDimStatement(ReDimStatement reDimStatement, object data) {
- Debug.Assert((reDimStatement != null));
- Debug.Assert((reDimStatement.ReDimClauses != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitReDimStatement(ReDimStatement reDimStatement, object data) {
+ Debug.Assert((reDimStatement != null));
+ Debug.Assert((reDimStatement.ReDimClauses != null));
for (int i = 0; i < reDimStatement.ReDimClauses.Count; i++) {
InvocationExpression o = reDimStatement.ReDimClauses[i];
Debug.Assert(o != null);
@@ -1882,67 +1882,67 @@ namespace ICSharpCode.NRefactory.Visitors {
reDimStatement.ReDimClauses.RemoveAt(i--);
else
reDimStatement.ReDimClauses[i] = o;
- }
- return null;
- }
-
- public virtual object VisitRemoveHandlerStatement(RemoveHandlerStatement removeHandlerStatement, object data) {
- Debug.Assert((removeHandlerStatement != null));
- Debug.Assert((removeHandlerStatement.EventExpression != null));
- Debug.Assert((removeHandlerStatement.HandlerExpression != null));
- nodeStack.Push(removeHandlerStatement.EventExpression);
- removeHandlerStatement.EventExpression.AcceptVisitor(this, data);
- removeHandlerStatement.EventExpression = ((Expression)(nodeStack.Pop()));
- nodeStack.Push(removeHandlerStatement.HandlerExpression);
- removeHandlerStatement.HandlerExpression.AcceptVisitor(this, data);
- removeHandlerStatement.HandlerExpression = ((Expression)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitResumeStatement(ResumeStatement resumeStatement, object data) {
- Debug.Assert((resumeStatement != null));
- return null;
- }
-
- public virtual object VisitReturnStatement(ReturnStatement returnStatement, object data) {
- Debug.Assert((returnStatement != null));
- Debug.Assert((returnStatement.Expression != null));
- nodeStack.Push(returnStatement.Expression);
- returnStatement.Expression.AcceptVisitor(this, data);
- returnStatement.Expression = ((Expression)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitSizeOfExpression(SizeOfExpression sizeOfExpression, object data) {
- Debug.Assert((sizeOfExpression != null));
- Debug.Assert((sizeOfExpression.TypeReference != null));
- nodeStack.Push(sizeOfExpression.TypeReference);
- sizeOfExpression.TypeReference.AcceptVisitor(this, data);
- sizeOfExpression.TypeReference = ((TypeReference)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitStackAllocExpression(StackAllocExpression stackAllocExpression, object data) {
- Debug.Assert((stackAllocExpression != null));
- Debug.Assert((stackAllocExpression.TypeReference != null));
- Debug.Assert((stackAllocExpression.Expression != null));
- nodeStack.Push(stackAllocExpression.TypeReference);
- stackAllocExpression.TypeReference.AcceptVisitor(this, data);
- stackAllocExpression.TypeReference = ((TypeReference)(nodeStack.Pop()));
- nodeStack.Push(stackAllocExpression.Expression);
- stackAllocExpression.Expression.AcceptVisitor(this, data);
- stackAllocExpression.Expression = ((Expression)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitStopStatement(StopStatement stopStatement, object data) {
- Debug.Assert((stopStatement != null));
- return null;
- }
-
- public virtual object VisitSwitchSection(SwitchSection switchSection, object data) {
- Debug.Assert((switchSection != null));
- Debug.Assert((switchSection.SwitchLabels != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitRemoveHandlerStatement(RemoveHandlerStatement removeHandlerStatement, object data) {
+ Debug.Assert((removeHandlerStatement != null));
+ Debug.Assert((removeHandlerStatement.EventExpression != null));
+ Debug.Assert((removeHandlerStatement.HandlerExpression != null));
+ nodeStack.Push(removeHandlerStatement.EventExpression);
+ removeHandlerStatement.EventExpression.AcceptVisitor(this, data);
+ removeHandlerStatement.EventExpression = ((Expression)(nodeStack.Pop()));
+ nodeStack.Push(removeHandlerStatement.HandlerExpression);
+ removeHandlerStatement.HandlerExpression.AcceptVisitor(this, data);
+ removeHandlerStatement.HandlerExpression = ((Expression)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitResumeStatement(ResumeStatement resumeStatement, object data) {
+ Debug.Assert((resumeStatement != null));
+ return null;
+ }
+
+ public virtual object VisitReturnStatement(ReturnStatement returnStatement, object data) {
+ Debug.Assert((returnStatement != null));
+ Debug.Assert((returnStatement.Expression != null));
+ nodeStack.Push(returnStatement.Expression);
+ returnStatement.Expression.AcceptVisitor(this, data);
+ returnStatement.Expression = ((Expression)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitSizeOfExpression(SizeOfExpression sizeOfExpression, object data) {
+ Debug.Assert((sizeOfExpression != null));
+ Debug.Assert((sizeOfExpression.TypeReference != null));
+ nodeStack.Push(sizeOfExpression.TypeReference);
+ sizeOfExpression.TypeReference.AcceptVisitor(this, data);
+ sizeOfExpression.TypeReference = ((TypeReference)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitStackAllocExpression(StackAllocExpression stackAllocExpression, object data) {
+ Debug.Assert((stackAllocExpression != null));
+ Debug.Assert((stackAllocExpression.TypeReference != null));
+ Debug.Assert((stackAllocExpression.Expression != null));
+ nodeStack.Push(stackAllocExpression.TypeReference);
+ stackAllocExpression.TypeReference.AcceptVisitor(this, data);
+ stackAllocExpression.TypeReference = ((TypeReference)(nodeStack.Pop()));
+ nodeStack.Push(stackAllocExpression.Expression);
+ stackAllocExpression.Expression.AcceptVisitor(this, data);
+ stackAllocExpression.Expression = ((Expression)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitStopStatement(StopStatement stopStatement, object data) {
+ Debug.Assert((stopStatement != null));
+ return null;
+ }
+
+ public virtual object VisitSwitchSection(SwitchSection switchSection, object data) {
+ Debug.Assert((switchSection != null));
+ Debug.Assert((switchSection.SwitchLabels != null));
for (int i = 0; i < switchSection.SwitchLabels.Count; i++) {
CaseLabel o = switchSection.SwitchLabels[i];
Debug.Assert(o != null);
@@ -1953,7 +1953,7 @@ namespace ICSharpCode.NRefactory.Visitors {
switchSection.SwitchLabels.RemoveAt(i--);
else
switchSection.SwitchLabels[i] = o;
- }
+ }
for (int i = 0; i < switchSection.Children.Count; i++) {
INode o = switchSection.Children[i];
Debug.Assert(o != null);
@@ -1964,17 +1964,17 @@ namespace ICSharpCode.NRefactory.Visitors {
switchSection.Children.RemoveAt(i--);
else
switchSection.Children[i] = o;
- }
- return null;
- }
-
- public virtual object VisitSwitchStatement(SwitchStatement switchStatement, object data) {
- Debug.Assert((switchStatement != null));
- Debug.Assert((switchStatement.SwitchExpression != null));
- Debug.Assert((switchStatement.SwitchSections != null));
- nodeStack.Push(switchStatement.SwitchExpression);
- switchStatement.SwitchExpression.AcceptVisitor(this, data);
- switchStatement.SwitchExpression = ((Expression)(nodeStack.Pop()));
+ }
+ return null;
+ }
+
+ public virtual object VisitSwitchStatement(SwitchStatement switchStatement, object data) {
+ Debug.Assert((switchStatement != null));
+ Debug.Assert((switchStatement.SwitchExpression != null));
+ Debug.Assert((switchStatement.SwitchSections != null));
+ nodeStack.Push(switchStatement.SwitchExpression);
+ switchStatement.SwitchExpression.AcceptVisitor(this, data);
+ switchStatement.SwitchExpression = ((Expression)(nodeStack.Pop()));
for (int i = 0; i < switchStatement.SwitchSections.Count; i++) {
SwitchSection o = switchStatement.SwitchSections[i];
Debug.Assert(o != null);
@@ -1985,14 +1985,14 @@ namespace ICSharpCode.NRefactory.Visitors {
switchStatement.SwitchSections.RemoveAt(i--);
else
switchStatement.SwitchSections[i] = o;
- }
- return null;
- }
-
- public virtual object VisitTemplateDefinition(TemplateDefinition templateDefinition, object data) {
- Debug.Assert((templateDefinition != null));
- Debug.Assert((templateDefinition.Attributes != null));
- Debug.Assert((templateDefinition.Bases != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitTemplateDefinition(TemplateDefinition templateDefinition, object data) {
+ Debug.Assert((templateDefinition != null));
+ Debug.Assert((templateDefinition.Attributes != null));
+ Debug.Assert((templateDefinition.Bases != null));
for (int i = 0; i < templateDefinition.Attributes.Count; i++) {
AttributeSection o = templateDefinition.Attributes[i];
Debug.Assert(o != null);
@@ -2003,7 +2003,7 @@ namespace ICSharpCode.NRefactory.Visitors {
templateDefinition.Attributes.RemoveAt(i--);
else
templateDefinition.Attributes[i] = o;
- }
+ }
for (int i = 0; i < templateDefinition.Bases.Count; i++) {
TypeReference o = templateDefinition.Bases[i];
Debug.Assert(o != null);
@@ -2014,32 +2014,32 @@ namespace ICSharpCode.NRefactory.Visitors {
templateDefinition.Bases.RemoveAt(i--);
else
templateDefinition.Bases[i] = o;
- }
- return null;
- }
-
- public virtual object VisitThisReferenceExpression(ThisReferenceExpression thisReferenceExpression, object data) {
- Debug.Assert((thisReferenceExpression != null));
- return null;
- }
-
- public virtual object VisitThrowStatement(ThrowStatement throwStatement, object data) {
- Debug.Assert((throwStatement != null));
- Debug.Assert((throwStatement.Expression != null));
- nodeStack.Push(throwStatement.Expression);
- throwStatement.Expression.AcceptVisitor(this, data);
- throwStatement.Expression = ((Expression)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitTryCatchStatement(TryCatchStatement tryCatchStatement, object data) {
- Debug.Assert((tryCatchStatement != null));
- Debug.Assert((tryCatchStatement.StatementBlock != null));
- Debug.Assert((tryCatchStatement.CatchClauses != null));
- Debug.Assert((tryCatchStatement.FinallyBlock != null));
- nodeStack.Push(tryCatchStatement.StatementBlock);
- tryCatchStatement.StatementBlock.AcceptVisitor(this, data);
- tryCatchStatement.StatementBlock = ((Statement)(nodeStack.Pop()));
+ }
+ return null;
+ }
+
+ public virtual object VisitThisReferenceExpression(ThisReferenceExpression thisReferenceExpression, object data) {
+ Debug.Assert((thisReferenceExpression != null));
+ return null;
+ }
+
+ public virtual object VisitThrowStatement(ThrowStatement throwStatement, object data) {
+ Debug.Assert((throwStatement != null));
+ Debug.Assert((throwStatement.Expression != null));
+ nodeStack.Push(throwStatement.Expression);
+ throwStatement.Expression.AcceptVisitor(this, data);
+ throwStatement.Expression = ((Expression)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitTryCatchStatement(TryCatchStatement tryCatchStatement, object data) {
+ Debug.Assert((tryCatchStatement != null));
+ Debug.Assert((tryCatchStatement.StatementBlock != null));
+ Debug.Assert((tryCatchStatement.CatchClauses != null));
+ Debug.Assert((tryCatchStatement.FinallyBlock != null));
+ nodeStack.Push(tryCatchStatement.StatementBlock);
+ tryCatchStatement.StatementBlock.AcceptVisitor(this, data);
+ tryCatchStatement.StatementBlock = ((Statement)(nodeStack.Pop()));
for (int i = 0; i < tryCatchStatement.CatchClauses.Count; i++) {
CatchClause o = tryCatchStatement.CatchClauses[i];
Debug.Assert(o != null);
@@ -2050,18 +2050,18 @@ namespace ICSharpCode.NRefactory.Visitors {
tryCatchStatement.CatchClauses.RemoveAt(i--);
else
tryCatchStatement.CatchClauses[i] = o;
- }
- nodeStack.Push(tryCatchStatement.FinallyBlock);
- tryCatchStatement.FinallyBlock.AcceptVisitor(this, data);
- tryCatchStatement.FinallyBlock = ((Statement)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data) {
- Debug.Assert((typeDeclaration != null));
- Debug.Assert((typeDeclaration.Attributes != null));
- Debug.Assert((typeDeclaration.BaseTypes != null));
- Debug.Assert((typeDeclaration.Templates != null));
+ }
+ nodeStack.Push(tryCatchStatement.FinallyBlock);
+ tryCatchStatement.FinallyBlock.AcceptVisitor(this, data);
+ tryCatchStatement.FinallyBlock = ((Statement)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data) {
+ Debug.Assert((typeDeclaration != null));
+ Debug.Assert((typeDeclaration.Attributes != null));
+ Debug.Assert((typeDeclaration.BaseTypes != null));
+ Debug.Assert((typeDeclaration.Templates != null));
for (int i = 0; i < typeDeclaration.Attributes.Count; i++) {
AttributeSection o = typeDeclaration.Attributes[i];
Debug.Assert(o != null);
@@ -2072,7 +2072,7 @@ namespace ICSharpCode.NRefactory.Visitors {
typeDeclaration.Attributes.RemoveAt(i--);
else
typeDeclaration.Attributes[i] = o;
- }
+ }
for (int i = 0; i < typeDeclaration.BaseTypes.Count; i++) {
TypeReference o = typeDeclaration.BaseTypes[i];
Debug.Assert(o != null);
@@ -2083,7 +2083,7 @@ namespace ICSharpCode.NRefactory.Visitors {
typeDeclaration.BaseTypes.RemoveAt(i--);
else
typeDeclaration.BaseTypes[i] = o;
- }
+ }
for (int i = 0; i < typeDeclaration.Templates.Count; i++) {
TemplateDefinition o = typeDeclaration.Templates[i];
Debug.Assert(o != null);
@@ -2094,7 +2094,7 @@ namespace ICSharpCode.NRefactory.Visitors {
typeDeclaration.Templates.RemoveAt(i--);
else
typeDeclaration.Templates[i] = o;
- }
+ }
for (int i = 0; i < typeDeclaration.Children.Count; i++) {
INode o = typeDeclaration.Children[i];
Debug.Assert(o != null);
@@ -2105,35 +2105,35 @@ namespace ICSharpCode.NRefactory.Visitors {
typeDeclaration.Children.RemoveAt(i--);
else
typeDeclaration.Children[i] = o;
- }
- return null;
- }
-
- public virtual object VisitTypeOfExpression(TypeOfExpression typeOfExpression, object data) {
- Debug.Assert((typeOfExpression != null));
- Debug.Assert((typeOfExpression.TypeReference != null));
- nodeStack.Push(typeOfExpression.TypeReference);
- typeOfExpression.TypeReference.AcceptVisitor(this, data);
- typeOfExpression.TypeReference = ((TypeReference)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitTypeOfIsExpression(TypeOfIsExpression typeOfIsExpression, object data) {
- Debug.Assert((typeOfIsExpression != null));
- Debug.Assert((typeOfIsExpression.Expression != null));
- Debug.Assert((typeOfIsExpression.TypeReference != null));
- nodeStack.Push(typeOfIsExpression.Expression);
- typeOfIsExpression.Expression.AcceptVisitor(this, data);
- typeOfIsExpression.Expression = ((Expression)(nodeStack.Pop()));
- nodeStack.Push(typeOfIsExpression.TypeReference);
- typeOfIsExpression.TypeReference.AcceptVisitor(this, data);
- typeOfIsExpression.TypeReference = ((TypeReference)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitTypeReference(TypeReference typeReference, object data) {
- Debug.Assert((typeReference != null));
- Debug.Assert((typeReference.GenericTypes != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitTypeOfExpression(TypeOfExpression typeOfExpression, object data) {
+ Debug.Assert((typeOfExpression != null));
+ Debug.Assert((typeOfExpression.TypeReference != null));
+ nodeStack.Push(typeOfExpression.TypeReference);
+ typeOfExpression.TypeReference.AcceptVisitor(this, data);
+ typeOfExpression.TypeReference = ((TypeReference)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitTypeOfIsExpression(TypeOfIsExpression typeOfIsExpression, object data) {
+ Debug.Assert((typeOfIsExpression != null));
+ Debug.Assert((typeOfIsExpression.Expression != null));
+ Debug.Assert((typeOfIsExpression.TypeReference != null));
+ nodeStack.Push(typeOfIsExpression.Expression);
+ typeOfIsExpression.Expression.AcceptVisitor(this, data);
+ typeOfIsExpression.Expression = ((Expression)(nodeStack.Pop()));
+ nodeStack.Push(typeOfIsExpression.TypeReference);
+ typeOfIsExpression.TypeReference.AcceptVisitor(this, data);
+ typeOfIsExpression.TypeReference = ((TypeReference)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitTypeReference(TypeReference typeReference, object data) {
+ Debug.Assert((typeReference != null));
+ Debug.Assert((typeReference.GenericTypes != null));
for (int i = 0; i < typeReference.GenericTypes.Count; i++) {
TypeReference o = typeReference.GenericTypes[i];
Debug.Assert(o != null);
@@ -2144,67 +2144,67 @@ namespace ICSharpCode.NRefactory.Visitors {
typeReference.GenericTypes.RemoveAt(i--);
else
typeReference.GenericTypes[i] = o;
- }
- return null;
- }
-
- public virtual object VisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, object data) {
- Debug.Assert((typeReferenceExpression != null));
- Debug.Assert((typeReferenceExpression.TypeReference != null));
- nodeStack.Push(typeReferenceExpression.TypeReference);
- typeReferenceExpression.TypeReference.AcceptVisitor(this, data);
- typeReferenceExpression.TypeReference = ((TypeReference)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitUnaryOperatorExpression(UnaryOperatorExpression unaryOperatorExpression, object data) {
- Debug.Assert((unaryOperatorExpression != null));
- Debug.Assert((unaryOperatorExpression.Expression != null));
- nodeStack.Push(unaryOperatorExpression.Expression);
- unaryOperatorExpression.Expression.AcceptVisitor(this, data);
- unaryOperatorExpression.Expression = ((Expression)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitUncheckedExpression(UncheckedExpression uncheckedExpression, object data) {
- Debug.Assert((uncheckedExpression != null));
- Debug.Assert((uncheckedExpression.Expression != null));
- nodeStack.Push(uncheckedExpression.Expression);
- uncheckedExpression.Expression.AcceptVisitor(this, data);
- uncheckedExpression.Expression = ((Expression)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitUncheckedStatement(UncheckedStatement uncheckedStatement, object data) {
- Debug.Assert((uncheckedStatement != null));
- Debug.Assert((uncheckedStatement.Block != null));
- nodeStack.Push(uncheckedStatement.Block);
- uncheckedStatement.Block.AcceptVisitor(this, data);
- uncheckedStatement.Block = ((Statement)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitUnsafeStatement(UnsafeStatement unsafeStatement, object data) {
- Debug.Assert((unsafeStatement != null));
- Debug.Assert((unsafeStatement.Block != null));
- nodeStack.Push(unsafeStatement.Block);
- unsafeStatement.Block.AcceptVisitor(this, data);
- unsafeStatement.Block = ((Statement)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitUsing(Using @using, object data) {
- Debug.Assert((@using != null));
- Debug.Assert((@using.Alias != null));
- nodeStack.Push(@using.Alias);
- @using.Alias.AcceptVisitor(this, data);
- @using.Alias = ((TypeReference)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitUsingDeclaration(UsingDeclaration usingDeclaration, object data) {
- Debug.Assert((usingDeclaration != null));
- Debug.Assert((usingDeclaration.Usings != null));
+ }
+ return null;
+ }
+
+ public virtual object VisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, object data) {
+ Debug.Assert((typeReferenceExpression != null));
+ Debug.Assert((typeReferenceExpression.TypeReference != null));
+ nodeStack.Push(typeReferenceExpression.TypeReference);
+ typeReferenceExpression.TypeReference.AcceptVisitor(this, data);
+ typeReferenceExpression.TypeReference = ((TypeReference)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitUnaryOperatorExpression(UnaryOperatorExpression unaryOperatorExpression, object data) {
+ Debug.Assert((unaryOperatorExpression != null));
+ Debug.Assert((unaryOperatorExpression.Expression != null));
+ nodeStack.Push(unaryOperatorExpression.Expression);
+ unaryOperatorExpression.Expression.AcceptVisitor(this, data);
+ unaryOperatorExpression.Expression = ((Expression)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitUncheckedExpression(UncheckedExpression uncheckedExpression, object data) {
+ Debug.Assert((uncheckedExpression != null));
+ Debug.Assert((uncheckedExpression.Expression != null));
+ nodeStack.Push(uncheckedExpression.Expression);
+ uncheckedExpression.Expression.AcceptVisitor(this, data);
+ uncheckedExpression.Expression = ((Expression)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitUncheckedStatement(UncheckedStatement uncheckedStatement, object data) {
+ Debug.Assert((uncheckedStatement != null));
+ Debug.Assert((uncheckedStatement.Block != null));
+ nodeStack.Push(uncheckedStatement.Block);
+ uncheckedStatement.Block.AcceptVisitor(this, data);
+ uncheckedStatement.Block = ((Statement)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitUnsafeStatement(UnsafeStatement unsafeStatement, object data) {
+ Debug.Assert((unsafeStatement != null));
+ Debug.Assert((unsafeStatement.Block != null));
+ nodeStack.Push(unsafeStatement.Block);
+ unsafeStatement.Block.AcceptVisitor(this, data);
+ unsafeStatement.Block = ((Statement)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitUsing(Using @using, object data) {
+ Debug.Assert((@using != null));
+ Debug.Assert((@using.Alias != null));
+ nodeStack.Push(@using.Alias);
+ @using.Alias.AcceptVisitor(this, data);
+ @using.Alias = ((TypeReference)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitUsingDeclaration(UsingDeclaration usingDeclaration, object data) {
+ Debug.Assert((usingDeclaration != null));
+ Debug.Assert((usingDeclaration.Usings != null));
for (int i = 0; i < usingDeclaration.Usings.Count; i++) {
Using o = usingDeclaration.Usings[i];
Debug.Assert(o != null);
@@ -2215,60 +2215,60 @@ namespace ICSharpCode.NRefactory.Visitors {
usingDeclaration.Usings.RemoveAt(i--);
else
usingDeclaration.Usings[i] = o;
- }
- return null;
- }
-
- public virtual object VisitUsingStatement(UsingStatement usingStatement, object data) {
- Debug.Assert((usingStatement != null));
- Debug.Assert((usingStatement.ResourceAcquisition != null));
- Debug.Assert((usingStatement.EmbeddedStatement != null));
- nodeStack.Push(usingStatement.ResourceAcquisition);
- usingStatement.ResourceAcquisition.AcceptVisitor(this, data);
- usingStatement.ResourceAcquisition = ((Statement)(nodeStack.Pop()));
- nodeStack.Push(usingStatement.EmbeddedStatement);
- usingStatement.EmbeddedStatement.AcceptVisitor(this, data);
- usingStatement.EmbeddedStatement = ((Statement)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitVariableDeclaration(VariableDeclaration variableDeclaration, object data) {
- Debug.Assert((variableDeclaration != null));
- Debug.Assert((variableDeclaration.Initializer != null));
- Debug.Assert((variableDeclaration.TypeReference != null));
- Debug.Assert((variableDeclaration.FixedArrayInitialization != null));
- nodeStack.Push(variableDeclaration.Initializer);
- variableDeclaration.Initializer.AcceptVisitor(this, data);
- variableDeclaration.Initializer = ((Expression)(nodeStack.Pop()));
- nodeStack.Push(variableDeclaration.TypeReference);
- variableDeclaration.TypeReference.AcceptVisitor(this, data);
- variableDeclaration.TypeReference = ((TypeReference)(nodeStack.Pop()));
- nodeStack.Push(variableDeclaration.FixedArrayInitialization);
- variableDeclaration.FixedArrayInitialization.AcceptVisitor(this, data);
- variableDeclaration.FixedArrayInitialization = ((Expression)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitWithStatement(WithStatement withStatement, object data) {
- Debug.Assert((withStatement != null));
- Debug.Assert((withStatement.Expression != null));
- Debug.Assert((withStatement.Body != null));
- nodeStack.Push(withStatement.Expression);
- withStatement.Expression.AcceptVisitor(this, data);
- withStatement.Expression = ((Expression)(nodeStack.Pop()));
- nodeStack.Push(withStatement.Body);
- withStatement.Body.AcceptVisitor(this, data);
- withStatement.Body = ((BlockStatement)(nodeStack.Pop()));
- return null;
- }
-
- public virtual object VisitYieldStatement(YieldStatement yieldStatement, object data) {
- Debug.Assert((yieldStatement != null));
- Debug.Assert((yieldStatement.Statement != null));
- nodeStack.Push(yieldStatement.Statement);
- yieldStatement.Statement.AcceptVisitor(this, data);
- yieldStatement.Statement = ((Statement)(nodeStack.Pop()));
- return null;
- }
- }
-}
+ }
+ return null;
+ }
+
+ public virtual object VisitUsingStatement(UsingStatement usingStatement, object data) {
+ Debug.Assert((usingStatement != null));
+ Debug.Assert((usingStatement.ResourceAcquisition != null));
+ Debug.Assert((usingStatement.EmbeddedStatement != null));
+ nodeStack.Push(usingStatement.ResourceAcquisition);
+ usingStatement.ResourceAcquisition.AcceptVisitor(this, data);
+ usingStatement.ResourceAcquisition = ((Statement)(nodeStack.Pop()));
+ nodeStack.Push(usingStatement.EmbeddedStatement);
+ usingStatement.EmbeddedStatement.AcceptVisitor(this, data);
+ usingStatement.EmbeddedStatement = ((Statement)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitVariableDeclaration(VariableDeclaration variableDeclaration, object data) {
+ Debug.Assert((variableDeclaration != null));
+ Debug.Assert((variableDeclaration.Initializer != null));
+ Debug.Assert((variableDeclaration.TypeReference != null));
+ Debug.Assert((variableDeclaration.FixedArrayInitialization != null));
+ nodeStack.Push(variableDeclaration.Initializer);
+ variableDeclaration.Initializer.AcceptVisitor(this, data);
+ variableDeclaration.Initializer = ((Expression)(nodeStack.Pop()));
+ nodeStack.Push(variableDeclaration.TypeReference);
+ variableDeclaration.TypeReference.AcceptVisitor(this, data);
+ variableDeclaration.TypeReference = ((TypeReference)(nodeStack.Pop()));
+ nodeStack.Push(variableDeclaration.FixedArrayInitialization);
+ variableDeclaration.FixedArrayInitialization.AcceptVisitor(this, data);
+ variableDeclaration.FixedArrayInitialization = ((Expression)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitWithStatement(WithStatement withStatement, object data) {
+ Debug.Assert((withStatement != null));
+ Debug.Assert((withStatement.Expression != null));
+ Debug.Assert((withStatement.Body != null));
+ nodeStack.Push(withStatement.Expression);
+ withStatement.Expression.AcceptVisitor(this, data);
+ withStatement.Expression = ((Expression)(nodeStack.Pop()));
+ nodeStack.Push(withStatement.Body);
+ withStatement.Body.AcceptVisitor(this, data);
+ withStatement.Body = ((BlockStatement)(nodeStack.Pop()));
+ return null;
+ }
+
+ public virtual object VisitYieldStatement(YieldStatement yieldStatement, object data) {
+ Debug.Assert((yieldStatement != null));
+ Debug.Assert((yieldStatement.Statement != null));
+ nodeStack.Push(yieldStatement.Statement);
+ yieldStatement.Statement.AcceptVisitor(this, data);
+ yieldStatement.Statement = ((Statement)(nodeStack.Pop()));
+ return null;
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Visitors/CSharpConstructsConvertVisitor.cs b/main/contrib/NRefactory/Project/Src/Visitors/CSharpConstructsConvertVisitor.cs
index db434a11bb..e0b072c9f4 100644
--- a/main/contrib/NRefactory/Project/Src/Visitors/CSharpConstructsConvertVisitor.cs
+++ b/main/contrib/NRefactory/Project/Src/Visitors/CSharpConstructsConvertVisitor.cs
@@ -1,234 +1,234 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 3660 $</version>
-// </file>
-
-using System;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Visitors
-{
- /// <summary>
- /// Converts special C# constructs to use more general AST classes.
- /// </summary>
- public class CSharpConstructsConvertVisitor : ConvertVisitorBase
- {
- // The following conversions are implemented:
- // a == null -> a Is Nothing
- // a != null -> a Is Not Nothing
- // i++ / ++i as statement: convert to i += 1
- // i-- / --i as statement: convert to i -= 1
- // ForStatement -> ForNextStatement when for-loop is simple
- // if (Event != null) Event(this, bla); -> RaiseEvent Event(this, bla)
- // Casts to value types are marked as conversions
-
- public override object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data)
- {
- if (binaryOperatorExpression.Op == BinaryOperatorType.Equality || binaryOperatorExpression.Op == BinaryOperatorType.InEquality) {
- if (IsNullLiteralExpression(binaryOperatorExpression.Left)) {
- Expression tmp = binaryOperatorExpression.Left;
- binaryOperatorExpression.Left = binaryOperatorExpression.Right;
- binaryOperatorExpression.Right = tmp;
- }
- if (IsNullLiteralExpression(binaryOperatorExpression.Right)) {
- if (binaryOperatorExpression.Op == BinaryOperatorType.Equality) {
- binaryOperatorExpression.Op = BinaryOperatorType.ReferenceEquality;
- } else {
- binaryOperatorExpression.Op = BinaryOperatorType.ReferenceInequality;
- }
- }
- }
- return base.VisitBinaryOperatorExpression(binaryOperatorExpression, data);
- }
-
- static bool IsNullLiteralExpression(Expression expr)
- {
- PrimitiveExpression pe = expr as PrimitiveExpression;
- if (pe == null) return false;
- return pe.Value == null;
- }
-
-
- public override object VisitExpressionStatement(ExpressionStatement expressionStatement, object data)
- {
- UnaryOperatorExpression uoe = expressionStatement.Expression as UnaryOperatorExpression;
- if (uoe != null) {
- switch (uoe.Op) {
- case UnaryOperatorType.Increment:
- case UnaryOperatorType.PostIncrement:
- expressionStatement.Expression = new AssignmentExpression(uoe.Expression, AssignmentOperatorType.Add, new PrimitiveExpression(1, "1"));
- break;
- case UnaryOperatorType.Decrement:
- case UnaryOperatorType.PostDecrement:
- expressionStatement.Expression = new AssignmentExpression(uoe.Expression, AssignmentOperatorType.Subtract, new PrimitiveExpression(1, "1"));
- break;
- }
- }
- return base.VisitExpressionStatement(expressionStatement, data);
- }
-
- public override object VisitIfElseStatement(IfElseStatement ifElseStatement, object data)
- {
- BinaryOperatorExpression boe = ifElseStatement.Condition as BinaryOperatorExpression;
- // the BinaryOperatorExpression might be inside a ParenthesizedExpression
- if (boe == null && ifElseStatement.Condition is ParenthesizedExpression) {
- boe = (ifElseStatement.Condition as ParenthesizedExpression).Expression as BinaryOperatorExpression;
- }
- if (ifElseStatement.ElseIfSections.Count == 0
- && ifElseStatement.FalseStatement.Count == 0
- && ifElseStatement.TrueStatement.Count == 1
- && boe != null
- && boe.Op == BinaryOperatorType.InEquality
- && (IsNullLiteralExpression(boe.Left) || IsNullLiteralExpression(boe.Right))
- )
- {
- string ident = GetPossibleEventName(boe.Left) ?? GetPossibleEventName(boe.Right);
- ExpressionStatement se = ifElseStatement.TrueStatement[0] as ExpressionStatement;
- if (se == null) {
- BlockStatement block = ifElseStatement.TrueStatement[0] as BlockStatement;
- if (block != null && block.Children.Count == 1) {
- se = block.Children[0] as ExpressionStatement;
- }
- }
- if (ident != null && se != null) {
- InvocationExpression ie = se.Expression as InvocationExpression;
- if (ie != null && GetPossibleEventName(ie.TargetObject) == ident) {
- ReplaceCurrentNode(new RaiseEventStatement(ident, ie.Arguments));
- }
- }
- }
- return base.VisitIfElseStatement(ifElseStatement, data);
- }
-
- string GetPossibleEventName(Expression expression)
- {
- IdentifierExpression ident = expression as IdentifierExpression;
- if (ident != null)
- return ident.Identifier;
- MemberReferenceExpression fre = expression as MemberReferenceExpression;
- if (fre != null && fre.TargetObject is ThisReferenceExpression)
- return fre.MemberName;
- return null;
- }
-
- public override object VisitForStatement(ForStatement forStatement, object data)
- {
- base.VisitForStatement(forStatement, data);
- ConvertForStatement(forStatement);
- return null;
- }
-
- void ConvertForStatement(ForStatement forStatement)
- {
- // ForStatement -> ForNextStatement when for-loop is simple
-
- // only the following forms of the for-statement are allowed:
- // for (TypeReference name = start; name < oneAfterEnd; name += step)
- // for (name = start; name < oneAfterEnd; name += step)
- // for (TypeReference name = start; name <= end; name += step)
- // for (name = start; name <= end; name += step)
- // for (TypeReference name = start; name > oneAfterEnd; name -= step)
- // for (name = start; name > oneAfterEnd; name -= step)
- // for (TypeReference name = start; name >= end; name -= step)
- // for (name = start; name >= end; name -= step)
-
- // check if the form is valid and collect TypeReference, name, start, end and step
- if (forStatement.Initializers.Count != 1)
- return;
- if (forStatement.Iterator.Count != 1)
- return;
- ExpressionStatement statement = forStatement.Iterator[0] as ExpressionStatement;
- if (statement == null)
- return;
- AssignmentExpression iterator = statement.Expression as AssignmentExpression;
- if (iterator == null || (iterator.Op != AssignmentOperatorType.Add && iterator.Op != AssignmentOperatorType.Subtract))
- return;
- IdentifierExpression iteratorIdentifier = iterator.Left as IdentifierExpression;
- if (iteratorIdentifier == null)
- return;
- PrimitiveExpression stepExpression = iterator.Right as PrimitiveExpression;
- if (stepExpression == null || !(stepExpression.Value is int))
- return;
- int step = (int)stepExpression.Value;
- if (iterator.Op == AssignmentOperatorType.Subtract)
- step = -step;
-
- BinaryOperatorExpression condition = forStatement.Condition as BinaryOperatorExpression;
- if (condition == null || !(condition.Left is IdentifierExpression))
- return;
- if ((condition.Left as IdentifierExpression).Identifier != iteratorIdentifier.Identifier)
- return;
- Expression end;
- if (iterator.Op == AssignmentOperatorType.Subtract) {
- if (condition.Op == BinaryOperatorType.GreaterThanOrEqual) {
- end = condition.Right;
- } else if (condition.Op == BinaryOperatorType.GreaterThan) {
- end = Expression.AddInteger(condition.Right, 1);
- } else {
- return;
- }
- } else {
- if (condition.Op == BinaryOperatorType.LessThanOrEqual) {
- end = condition.Right;
- } else if (condition.Op == BinaryOperatorType.LessThan) {
- end = Expression.AddInteger(condition.Right, -1);
- } else {
- return;
- }
- }
-
- Expression start;
- TypeReference typeReference = null;
- LocalVariableDeclaration varDecl = forStatement.Initializers[0] as LocalVariableDeclaration;
- if (varDecl != null) {
- if (varDecl.Variables.Count != 1
- || varDecl.Variables[0].Name != iteratorIdentifier.Identifier
- || varDecl.Variables[0].Initializer == null)
- return;
- typeReference = varDecl.GetTypeForVariable(0);
- start = varDecl.Variables[0].Initializer;
- } else {
- statement = forStatement.Initializers[0] as ExpressionStatement;
- if (statement == null)
- return;
- AssignmentExpression assign = statement.Expression as AssignmentExpression;
- if (assign == null || assign.Op != AssignmentOperatorType.Assign)
- return;
- if (!(assign.Left is IdentifierExpression))
- return;
- if ((assign.Left as IdentifierExpression).Identifier != iteratorIdentifier.Identifier)
- return;
- start = assign.Right;
- }
-
- ReplaceCurrentNode(
- new ForNextStatement {
- TypeReference = typeReference,
- VariableName = iteratorIdentifier.Identifier,
- Start = start,
- End = end,
- Step = (step == 1) ? null : new PrimitiveExpression(step, step.ToString(System.Globalization.NumberFormatInfo.InvariantInfo)),
- EmbeddedStatement = forStatement.EmbeddedStatement
- });
- }
-
- public override object VisitCastExpression(CastExpression castExpression, object data)
- {
- if (castExpression.CastType == CastType.Cast) {
- // Casts to value types are marked as conversions
- // this code only supports primitive types, user-defined value types are handled by
- // the DOM-aware CSharpToVBNetConvertVisitor
- string type;
- if (TypeReference.PrimitiveTypesCSharpReverse.TryGetValue(castExpression.CastTo.Type, out type)) {
- if (type != "object" && type != "string") {
- // type is value type
- castExpression.CastType = CastType.Conversion;
- }
- }
- }
- return base.VisitCastExpression(castExpression, data);
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+using ICSharpCode.NRefactory.Ast;
+
+namespace ICSharpCode.NRefactory.Visitors
+{
+ /// <summary>
+ /// Converts special C# constructs to use more general AST classes.
+ /// </summary>
+ public class CSharpConstructsConvertVisitor : ConvertVisitorBase
+ {
+ // The following conversions are implemented:
+ // a == null -> a Is Nothing
+ // a != null -> a Is Not Nothing
+ // i++ / ++i as statement: convert to i += 1
+ // i-- / --i as statement: convert to i -= 1
+ // ForStatement -> ForNextStatement when for-loop is simple
+ // if (Event != null) Event(this, bla); -> RaiseEvent Event(this, bla)
+ // Casts to value types are marked as conversions
+
+ public override object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data)
+ {
+ if (binaryOperatorExpression.Op == BinaryOperatorType.Equality || binaryOperatorExpression.Op == BinaryOperatorType.InEquality) {
+ if (IsNullLiteralExpression(binaryOperatorExpression.Left)) {
+ Expression tmp = binaryOperatorExpression.Left;
+ binaryOperatorExpression.Left = binaryOperatorExpression.Right;
+ binaryOperatorExpression.Right = tmp;
+ }
+ if (IsNullLiteralExpression(binaryOperatorExpression.Right)) {
+ if (binaryOperatorExpression.Op == BinaryOperatorType.Equality) {
+ binaryOperatorExpression.Op = BinaryOperatorType.ReferenceEquality;
+ } else {
+ binaryOperatorExpression.Op = BinaryOperatorType.ReferenceInequality;
+ }
+ }
+ }
+ return base.VisitBinaryOperatorExpression(binaryOperatorExpression, data);
+ }
+
+ static bool IsNullLiteralExpression(Expression expr)
+ {
+ PrimitiveExpression pe = expr as PrimitiveExpression;
+ if (pe == null) return false;
+ return pe.Value == null;
+ }
+
+
+ public override object VisitExpressionStatement(ExpressionStatement expressionStatement, object data)
+ {
+ UnaryOperatorExpression uoe = expressionStatement.Expression as UnaryOperatorExpression;
+ if (uoe != null) {
+ switch (uoe.Op) {
+ case UnaryOperatorType.Increment:
+ case UnaryOperatorType.PostIncrement:
+ expressionStatement.Expression = new AssignmentExpression(uoe.Expression, AssignmentOperatorType.Add, new PrimitiveExpression(1, "1"));
+ break;
+ case UnaryOperatorType.Decrement:
+ case UnaryOperatorType.PostDecrement:
+ expressionStatement.Expression = new AssignmentExpression(uoe.Expression, AssignmentOperatorType.Subtract, new PrimitiveExpression(1, "1"));
+ break;
+ }
+ }
+ return base.VisitExpressionStatement(expressionStatement, data);
+ }
+
+ public override object VisitIfElseStatement(IfElseStatement ifElseStatement, object data)
+ {
+ BinaryOperatorExpression boe = ifElseStatement.Condition as BinaryOperatorExpression;
+ // the BinaryOperatorExpression might be inside a ParenthesizedExpression
+ if (boe == null && ifElseStatement.Condition is ParenthesizedExpression) {
+ boe = (ifElseStatement.Condition as ParenthesizedExpression).Expression as BinaryOperatorExpression;
+ }
+ if (ifElseStatement.ElseIfSections.Count == 0
+ && ifElseStatement.FalseStatement.Count == 0
+ && ifElseStatement.TrueStatement.Count == 1
+ && boe != null
+ && boe.Op == BinaryOperatorType.InEquality
+ && (IsNullLiteralExpression(boe.Left) || IsNullLiteralExpression(boe.Right))
+ )
+ {
+ string ident = GetPossibleEventName(boe.Left) ?? GetPossibleEventName(boe.Right);
+ ExpressionStatement se = ifElseStatement.TrueStatement[0] as ExpressionStatement;
+ if (se == null) {
+ BlockStatement block = ifElseStatement.TrueStatement[0] as BlockStatement;
+ if (block != null && block.Children.Count == 1) {
+ se = block.Children[0] as ExpressionStatement;
+ }
+ }
+ if (ident != null && se != null) {
+ InvocationExpression ie = se.Expression as InvocationExpression;
+ if (ie != null && GetPossibleEventName(ie.TargetObject) == ident) {
+ ReplaceCurrentNode(new RaiseEventStatement(ident, ie.Arguments));
+ }
+ }
+ }
+ return base.VisitIfElseStatement(ifElseStatement, data);
+ }
+
+ string GetPossibleEventName(Expression expression)
+ {
+ IdentifierExpression ident = expression as IdentifierExpression;
+ if (ident != null)
+ return ident.Identifier;
+ MemberReferenceExpression fre = expression as MemberReferenceExpression;
+ if (fre != null && fre.TargetObject is ThisReferenceExpression)
+ return fre.MemberName;
+ return null;
+ }
+
+ public override object VisitForStatement(ForStatement forStatement, object data)
+ {
+ base.VisitForStatement(forStatement, data);
+ ConvertForStatement(forStatement);
+ return null;
+ }
+
+ void ConvertForStatement(ForStatement forStatement)
+ {
+ // ForStatement -> ForNextStatement when for-loop is simple
+
+ // only the following forms of the for-statement are allowed:
+ // for (TypeReference name = start; name < oneAfterEnd; name += step)
+ // for (name = start; name < oneAfterEnd; name += step)
+ // for (TypeReference name = start; name <= end; name += step)
+ // for (name = start; name <= end; name += step)
+ // for (TypeReference name = start; name > oneAfterEnd; name -= step)
+ // for (name = start; name > oneAfterEnd; name -= step)
+ // for (TypeReference name = start; name >= end; name -= step)
+ // for (name = start; name >= end; name -= step)
+
+ // check if the form is valid and collect TypeReference, name, start, end and step
+ if (forStatement.Initializers.Count != 1)
+ return;
+ if (forStatement.Iterator.Count != 1)
+ return;
+ ExpressionStatement statement = forStatement.Iterator[0] as ExpressionStatement;
+ if (statement == null)
+ return;
+ AssignmentExpression iterator = statement.Expression as AssignmentExpression;
+ if (iterator == null || (iterator.Op != AssignmentOperatorType.Add && iterator.Op != AssignmentOperatorType.Subtract))
+ return;
+ IdentifierExpression iteratorIdentifier = iterator.Left as IdentifierExpression;
+ if (iteratorIdentifier == null)
+ return;
+ PrimitiveExpression stepExpression = iterator.Right as PrimitiveExpression;
+ if (stepExpression == null || !(stepExpression.Value is int))
+ return;
+ int step = (int)stepExpression.Value;
+ if (iterator.Op == AssignmentOperatorType.Subtract)
+ step = -step;
+
+ BinaryOperatorExpression condition = forStatement.Condition as BinaryOperatorExpression;
+ if (condition == null || !(condition.Left is IdentifierExpression))
+ return;
+ if ((condition.Left as IdentifierExpression).Identifier != iteratorIdentifier.Identifier)
+ return;
+ Expression end;
+ if (iterator.Op == AssignmentOperatorType.Subtract) {
+ if (condition.Op == BinaryOperatorType.GreaterThanOrEqual) {
+ end = condition.Right;
+ } else if (condition.Op == BinaryOperatorType.GreaterThan) {
+ end = Expression.AddInteger(condition.Right, 1);
+ } else {
+ return;
+ }
+ } else {
+ if (condition.Op == BinaryOperatorType.LessThanOrEqual) {
+ end = condition.Right;
+ } else if (condition.Op == BinaryOperatorType.LessThan) {
+ end = Expression.AddInteger(condition.Right, -1);
+ } else {
+ return;
+ }
+ }
+
+ Expression start;
+ TypeReference typeReference = null;
+ LocalVariableDeclaration varDecl = forStatement.Initializers[0] as LocalVariableDeclaration;
+ if (varDecl != null) {
+ if (varDecl.Variables.Count != 1
+ || varDecl.Variables[0].Name != iteratorIdentifier.Identifier
+ || varDecl.Variables[0].Initializer == null)
+ return;
+ typeReference = varDecl.GetTypeForVariable(0);
+ start = varDecl.Variables[0].Initializer;
+ } else {
+ statement = forStatement.Initializers[0] as ExpressionStatement;
+ if (statement == null)
+ return;
+ AssignmentExpression assign = statement.Expression as AssignmentExpression;
+ if (assign == null || assign.Op != AssignmentOperatorType.Assign)
+ return;
+ if (!(assign.Left is IdentifierExpression))
+ return;
+ if ((assign.Left as IdentifierExpression).Identifier != iteratorIdentifier.Identifier)
+ return;
+ start = assign.Right;
+ }
+
+ ReplaceCurrentNode(
+ new ForNextStatement {
+ TypeReference = typeReference,
+ VariableName = iteratorIdentifier.Identifier,
+ Start = start,
+ End = end,
+ Step = (step == 1) ? null : new PrimitiveExpression(step, step.ToString(System.Globalization.NumberFormatInfo.InvariantInfo)),
+ EmbeddedStatement = forStatement.EmbeddedStatement
+ });
+ }
+
+ public override object VisitCastExpression(CastExpression castExpression, object data)
+ {
+ if (castExpression.CastType == CastType.Cast) {
+ // Casts to value types are marked as conversions
+ // this code only supports primitive types, user-defined value types are handled by
+ // the DOM-aware CSharpToVBNetConvertVisitor
+ string type;
+ if (TypeReference.PrimitiveTypesCSharpReverse.TryGetValue(castExpression.CastTo.Type, out type)) {
+ if (type != "object" && type != "string") {
+ // type is value type
+ castExpression.CastType = CastType.Conversion;
+ }
+ }
+ }
+ return base.VisitCastExpression(castExpression, data);
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Visitors/CodeDOMOutputVisitor.cs b/main/contrib/NRefactory/Project/Src/Visitors/CodeDOMOutputVisitor.cs
index 602f8cd425..9bcd658303 100644
--- a/main/contrib/NRefactory/Project/Src/Visitors/CodeDOMOutputVisitor.cs
+++ b/main/contrib/NRefactory/Project/Src/Visitors/CodeDOMOutputVisitor.cs
@@ -1,1731 +1,1684 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 3833 $</version>
-// </file>
-
-using System;
-using System.CodeDom;
-using System.Collections;
-using System.Collections.Generic;
-using System.Reflection;
-using System.Text;
-
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Visitors
-{
- public class CodeDomVisitor : AbstractAstVisitor
- {
- Stack<CodeNamespace> namespaceDeclarations = new Stack<CodeNamespace>();
- Stack<CodeTypeDeclaration> typeDeclarations = new Stack<CodeTypeDeclaration>();
- Stack<CodeStatementCollection> codeStack = new Stack<CodeStatementCollection>();
- List<CodeVariableDeclarationStatement> variables = new List<CodeVariableDeclarationStatement>();
- List<CodeParameterDeclarationExpression> parameters = new List<CodeParameterDeclarationExpression>();
- Stack<Breakable> breakableStack = new Stack<Breakable>();
-
- IEnumerator<ISpecial> specials;
- bool specialsAvailable;
-
- TypeDeclaration currentTypeDeclaration = null;
-
- IEnvironmentInformationProvider environmentInformationProvider = DummyEnvironmentInformationProvider.Instance;
-
- // track break and continue statements
- class Breakable
- {
- public static int NextId = 0;
-
- public int Id = 0;
- public bool IsBreak = false;
- public bool IsContinue = false;
- public bool AllowContinue = true;
-
- public Breakable()
- {
- Id = ++NextId;
- }
-
- public Breakable(bool allowContinue)
- : this()
- {
- AllowContinue = allowContinue;
- }
- }
-
- public IEnvironmentInformationProvider EnvironmentInformationProvider {
- get { return environmentInformationProvider; }
- set {
- if (value == null)
- throw new ArgumentNullException("value");
- environmentInformationProvider = value;
- }
- }
-
- // dummy collection used to swallow statements
- CodeStatementCollection NullStmtCollection = new CodeStatementCollection();
-
- public CodeCompileUnit codeCompileUnit = new CodeCompileUnit();
-
- public CodeDomVisitor () : this (null)
- {
- }
-
- public CodeDomVisitor (IEnumerable<ISpecial> specials)
- {
- if (specials != null)
- this.specials = specials.GetEnumerator ();
- specialsAvailable = this.specials != null && this.specials.MoveNext ();
- }
-
- // RG
- //
- // Initialise Scope Variables for Current Method
- void InitMethodScope()
- {
- usingId = 0;
- foreachId = 0;
- switchId = 0;
- doId = 0;
- Breakable.NextId = 0;
- variables.Clear();
- parameters.Clear();
- }
-
- CodeTypeReference ConvType(TypeReference type)
- {
- if (type == null) {
- throw new ArgumentNullException("type");
- }
- if (string.IsNullOrEmpty(type.Type)) {
- throw new InvalidOperationException("empty type");
- }
-
- CodeTypeReference t = new CodeTypeReference(type.Type);
- foreach (TypeReference gt in type.GenericTypes) {
- t.TypeArguments.Add(ConvType(gt));
- }
- if (type.IsArrayType) {
- for (int i = type.RankSpecifier.Length - 1; i >= 0; --i)
- {
- t = new CodeTypeReference(t, type.RankSpecifier[i] + 1);
- }
- }
-
- return t;
- }
-
- void AddStmt(CodeStatement stmt, INode flushCommentsToStart)
- {
- if (codeStack.Count == 0)
- return;
- CodeStatementCollection stmtCollection = codeStack.Peek();
- if (stmtCollection != null) {
- FlushComments (flushCommentsToStart, stmtCollection);
- stmtCollection.Add(stmt);
- }
- }
-
- static MemberAttributes ConvMemberAttributes(Modifiers modifier)
- {
- MemberAttributes attr = (MemberAttributes)0;
-
- if ((modifier & Modifiers.Abstract) != 0)
- attr |= MemberAttributes.Abstract;
- if ((modifier & Modifiers.Const) != 0)
- attr |= MemberAttributes.Const;
- if ((modifier & Modifiers.Sealed) != 0)
- attr |= MemberAttributes.Final;
- if ((modifier & Modifiers.New) != 0)
- attr |= MemberAttributes.New;
- if ((modifier & Modifiers.Virtual) != 0)
- attr |= MemberAttributes.Overloaded;
- if ((modifier & Modifiers.Override) != 0)
- attr |= MemberAttributes.Override;
- if ((modifier & Modifiers.Static) != 0)
- attr |= MemberAttributes.Static;
-
- if ((modifier & Modifiers.Public) != 0)
- attr |= MemberAttributes.Public;
- else if ((modifier & Modifiers.Internal) != 0 && (modifier & Modifiers.Protected) != 0)
- attr |= MemberAttributes.FamilyOrAssembly;
- else if ((modifier & Modifiers.Internal) != 0)
- attr |= MemberAttributes.Assembly;
- else if ((modifier & Modifiers.Protected) != 0)
- attr |= MemberAttributes.Family;
- else if ((modifier & Modifiers.Private) != 0)
- attr |= MemberAttributes.Private;
-
- return attr;
- }
-
- static TypeAttributes ConvTypeAttributes(Modifiers modifier)
- {
- TypeAttributes attr = (TypeAttributes)0;
- if ((modifier & Modifiers.Abstract) != 0)
- attr |= TypeAttributes.Abstract;
- if ((modifier & Modifiers.Sealed) != 0)
- attr |= TypeAttributes.Sealed;
- if ((modifier & Modifiers.Static) != 0)
- attr |= TypeAttributes.Abstract | TypeAttributes.Sealed;
-
- if ((modifier & Modifiers.Public) != 0)
- attr |= TypeAttributes.Public;
- else
- attr |= TypeAttributes.NotPublic;
-
- return attr;
- }
-
- #region inserting specials
-
- void FlushComments (INode toStartOf, IList commentable)
- {
- FlushComments (toStartOf.StartLocation, commentable);
- }
-
- void FlushComments (Location toLocation, IList commentable)
- {
- while (commentable != null && specialsAvailable && specials.Current.StartPosition <= toLocation) {
- Comment cmt = specials.Current as Comment;
- if (cmt != null)
- commentable.Add (new CodeCommentStatement (cmt.CommentText, cmt.CommentType == CommentType.Documentation));
- specialsAvailable = specials.MoveNext ();
- }
- }
-
- #endregion
-
-
- #region ICSharpCode.SharpRefactory.Parser.IASTVisitor interface implementation
- public override object VisitCompilationUnit(CompilationUnit compilationUnit, object data)
- {
- if (compilationUnit == null) {
- throw new ArgumentNullException("compilationUnit");
- }
- CodeNamespace globalNamespace = new CodeNamespace("Global");
- //namespaces.Add(globalNamespace);
- namespaceDeclarations.Push(globalNamespace);
- compilationUnit.AcceptChildren(this, data);
- codeCompileUnit.Namespaces.Add(globalNamespace);
- return globalNamespace;
- }
-
- public override object VisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, object data)
- {
- CodeNamespace currentNamespace = new CodeNamespace(namespaceDeclaration.Name);
- //namespaces.Add(currentNamespace);
- // add imports from mother namespace
- foreach (CodeNamespaceImport import in ((CodeNamespace)namespaceDeclarations.Peek()).Imports) {
- currentNamespace.Imports.Add(import);
- }
- FlushComments (namespaceDeclaration, currentNamespace.Comments);
- namespaceDeclarations.Push(currentNamespace);
- namespaceDeclaration.AcceptChildren(this, data);
- namespaceDeclarations.Pop();
- codeCompileUnit.Namespaces.Add(currentNamespace);
-
- // Nested namespaces are not allowed in CodeDOM
- return null;
- }
-
- public override object VisitUsingDeclaration(UsingDeclaration usingDeclaration, object data)
- {
- foreach (Using u in usingDeclaration.Usings) {
- namespaceDeclarations.Peek().Imports.Add(new CodeNamespaceImport(u.Name));
- }
- return null;
- }
-
- // RG
- public override object VisitEventDeclaration(EventDeclaration eventDeclaration, object data)
- {
- CodeMemberEvent evt = new CodeMemberEvent();
- evt.Type = ConvType(eventDeclaration.TypeReference);
- evt.Name = eventDeclaration.Name;
- FlushComments (eventDeclaration, evt.Comments);
- evt.Attributes = ConvMemberAttributes(eventDeclaration.Modifier);
-
- typeDeclarations.Peek().Members.Add(evt);
-
- return null;
- }
-
- public override object VisitAttributeSection(AttributeSection attributeSection, object data)
- {
- return null;
- }
-
- // RG: CodeTypeReferenceExpression
- public override object VisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, object data)
- {
- return new CodeTypeReferenceExpression(ConvType(typeReferenceExpression.TypeReference));
- }
-
- public override object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
- {
- TypeDeclaration oldTypeDeclaration = currentTypeDeclaration;
- this.currentTypeDeclaration = typeDeclaration;
- CodeTypeDeclaration codeTypeDeclaration = new CodeTypeDeclaration(typeDeclaration.Name);
- codeTypeDeclaration.TypeAttributes = ConvTypeAttributes(typeDeclaration.Modifier);
- codeTypeDeclaration.IsClass = typeDeclaration.Type == ClassType.Class;
- codeTypeDeclaration.IsEnum = typeDeclaration.Type == ClassType.Enum;
- codeTypeDeclaration.IsInterface = typeDeclaration.Type == ClassType.Interface;
- codeTypeDeclaration.IsStruct = typeDeclaration.Type == ClassType.Struct;
- codeTypeDeclaration.IsPartial = (typeDeclaration.Modifier & Modifiers.Partial) != 0;
-
- if (typeDeclaration.BaseTypes != null) {
- foreach (TypeReference typeRef in typeDeclaration.BaseTypes) {
- codeTypeDeclaration.BaseTypes.Add(ConvType(typeRef));
- }
- }
-
- FlushComments (typeDeclaration, codeTypeDeclaration.Comments);
-
- typeDeclarations.Push(codeTypeDeclaration);
- typeDeclaration.AcceptChildren(this, data);
- typeDeclarations.Pop();
-
- if (typeDeclarations.Count > 0) {
- typeDeclarations.Peek().Members.Add(codeTypeDeclaration);
- } else {
- namespaceDeclarations.Peek().Types.Add(codeTypeDeclaration);
- }
- currentTypeDeclaration = oldTypeDeclaration;
-
- return null;
- }
-
- public override object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data)
- {
- CodeTypeDelegate codeTypeDelegate = new CodeTypeDelegate(delegateDeclaration.Name);
- codeTypeDelegate.Attributes = ConvMemberAttributes(delegateDeclaration.Modifier);
- codeTypeDelegate.ReturnType = ConvType(delegateDeclaration.ReturnType);
-
- FlushComments (delegateDeclaration, codeTypeDelegate.Comments);
-
- foreach (ParameterDeclarationExpression parameter in delegateDeclaration.Parameters)
- {
- codeTypeDelegate.Parameters.Add((CodeParameterDeclarationExpression)VisitParameterDeclarationExpression(parameter, data));
- }
-
- if (typeDeclarations.Count > 0)
- {
- typeDeclarations.Peek().Members.Add(codeTypeDelegate);
- }
- else
- {
- namespaceDeclarations.Peek().Types.Add(codeTypeDelegate);
- }
-
- return null;
- }
-
- public override object VisitVariableDeclaration(VariableDeclaration variableDeclaration, object data)
- {
- return null;
- }
-
- public override object VisitFieldDeclaration(FieldDeclaration fieldDeclaration, object data)
- {
- for (int i = 0; i < fieldDeclaration.Fields.Count; ++i) {
- VariableDeclaration field = (VariableDeclaration)fieldDeclaration.Fields[i];
-
- if ((fieldDeclaration.Modifier & Modifiers.WithEvents) != 0) {
- //this.withEventsFields.Add(field);
- }
- TypeReference fieldType = fieldDeclaration.GetTypeForField(i);
-
- if (fieldType.IsNull) {
- fieldType = new TypeReference(typeDeclarations.Peek().Name);
- }
-
- CodeMemberField memberField = new CodeMemberField(ConvType(fieldType), field.Name);
- FlushComments (field, memberField.Comments);
- memberField.Attributes = ConvMemberAttributes(fieldDeclaration.Modifier);
- if (!field.Initializer.IsNull) {
- memberField.InitExpression = (CodeExpression)field.Initializer.AcceptVisitor(this, data);
- }
-
- typeDeclarations.Peek().Members.Add(memberField);
- }
-
- return null;
- }
-
- public override object VisitMethodDeclaration(MethodDeclaration methodDeclaration, object data)
- {
- InitMethodScope();
-
- CodeMemberMethod memberMethod = new CodeMemberMethod();
- memberMethod.Name = methodDeclaration.Name;
- memberMethod.Attributes = ConvMemberAttributes(methodDeclaration.Modifier);
-
- FlushComments (methodDeclaration, memberMethod.Comments);
-
- // RG: Private Interface Decl
- if ((memberMethod.Attributes & MemberAttributes.Public) != MemberAttributes.Public &&
- methodDeclaration.InterfaceImplementations.Count > 0)
- {
- memberMethod.PrivateImplementationType = ConvType(methodDeclaration.InterfaceImplementations[0].InterfaceType);
- }
-
- codeStack.Push(memberMethod.Statements);
-
- typeDeclarations.Peek().Members.Add(memberMethod);
-
- // Add Method Parameters
- parameters.Clear();
-
- foreach (ParameterDeclarationExpression parameter in methodDeclaration.Parameters)
- {
- memberMethod.Parameters.Add((CodeParameterDeclarationExpression)VisitParameterDeclarationExpression(parameter, data));
- }
-
- usingId = 0; // RG
- foreachId = 0;
- switchId = 0;
- doId = 0;
- Breakable.NextId = 0;
- variables.Clear();
- methodDeclaration.Body.AcceptChildren(this, data);
-
- FlushComments (methodDeclaration.EndLocation, memberMethod.Statements);
-
- codeStack.Pop();
-
- return null;
- }
-
- // RG
- public override object VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration, object data)
- {
- CodeMemberProperty memberProperty = new CodeMemberProperty();
- memberProperty.Name = propertyDeclaration.Name;
- memberProperty.Attributes = ConvMemberAttributes(propertyDeclaration.Modifier);
- memberProperty.HasGet = propertyDeclaration.HasGetRegion;
- memberProperty.HasSet = propertyDeclaration.HasSetRegion;
- memberProperty.Type = ConvType(propertyDeclaration.TypeReference);
- FlushComments (propertyDeclaration, memberProperty.Comments);
-
- typeDeclarations.Peek().Members.Add(memberProperty);
-
- // Add Method Parameters
- foreach (ParameterDeclarationExpression parameter in propertyDeclaration.Parameters)
- {
- memberProperty.Parameters.Add((CodeParameterDeclarationExpression)VisitParameterDeclarationExpression(parameter, data));
- }
-
- if (memberProperty.HasGet)
- {
- codeStack.Push(memberProperty.GetStatements);
- propertyDeclaration.GetRegion.Block.AcceptChildren(this, data);
- codeStack.Pop();
- }
-
- if (memberProperty.HasSet)
- {
- codeStack.Push(memberProperty.SetStatements);
- propertyDeclaration.SetRegion.Block.AcceptChildren(this, data);
- codeStack.Pop();
- }
-
- return null;
- }
-
- public override object VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data)
- {
- InitMethodScope();
-
- CodeConstructor memberMethod = new CodeConstructor();
- memberMethod.Attributes = ConvMemberAttributes(constructorDeclaration.Modifier);
-
- FlushComments (constructorDeclaration, memberMethod.Comments);
-
- typeDeclarations.Peek().Members.Add(memberMethod);
-
- codeStack.Push(NullStmtCollection);
- foreach (ParameterDeclarationExpression parameter in constructorDeclaration.Parameters)
- {
- memberMethod.Parameters.Add((CodeParameterDeclarationExpression)VisitParameterDeclarationExpression(parameter, data));
- }
-
- if (constructorDeclaration.ConstructorInitializer != null)
- {
- if (constructorDeclaration.ConstructorInitializer.ConstructorInitializerType == ConstructorInitializerType.Base)
- {
- if (constructorDeclaration.ConstructorInitializer.Arguments.Count == 0)
- {
- memberMethod.BaseConstructorArgs.Add(new CodeSnippetExpression());
- }
-
- foreach (Expression o in constructorDeclaration.ConstructorInitializer.Arguments)
- {
- memberMethod.BaseConstructorArgs.Add((CodeExpression)o.AcceptVisitor(this, data));
- }
- }
-
- if (constructorDeclaration.ConstructorInitializer.ConstructorInitializerType == ConstructorInitializerType.This)
- {
- if (constructorDeclaration.ConstructorInitializer.Arguments.Count == 0)
- {
- memberMethod.ChainedConstructorArgs.Add(new CodeSnippetExpression());
- }
-
- foreach (Expression o in constructorDeclaration.ConstructorInitializer.Arguments)
- {
- memberMethod.ChainedConstructorArgs.Add((CodeExpression)o.AcceptVisitor(this, data));
- }
- }
- }
- codeStack.Pop();
-
- codeStack.Push(memberMethod.Statements);
- constructorDeclaration.Body.AcceptChildren(this, data);
- codeStack.Pop();
-
- return null;
- }
-
- public override object VisitBlockStatement(BlockStatement blockStatement, object data)
- {
- blockStatement.AcceptChildren(this, data);
- return null;
- }
-
- public override object VisitExpressionStatement(ExpressionStatement expressionStatement, object data)
- {
- object exp = expressionStatement.Expression.AcceptVisitor(this, data);
- if (exp is CodeExpression) {
- AddStmt (new CodeExpressionStatement((CodeExpression)exp), expressionStatement);
- }
- return exp;
- }
-
- public override object VisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data)
- {
- CodeVariableDeclarationStatement declStmt = null;
-
- for (int i = 0; i < localVariableDeclaration.Variables.Count; ++i) {
- CodeTypeReference type = ConvType(localVariableDeclaration.GetTypeForVariable(i) ?? new TypeReference("System.Object", true));
- VariableDeclaration var = (VariableDeclaration)localVariableDeclaration.Variables[i];
- if (!var.Initializer.IsNull) {
- declStmt = new CodeVariableDeclarationStatement(type,
- var.Name,
- (CodeExpression)((INode)var.Initializer).AcceptVisitor(this, data));
- } else {
- declStmt = new CodeVariableDeclarationStatement(type,
- var.Name);
- }
- variables.Add(declStmt);
- AddStmt(declStmt, localVariableDeclaration);
- }
-
- return declStmt;
- }
-
- public override object VisitEmptyStatement(EmptyStatement emptyStatement, object data)
- {
- CodeSnippetStatement emptyStmt = new CodeSnippetStatement();
-
- AddStmt(emptyStmt, emptyStatement);
-
- return emptyStmt;
- }
-
- public override object VisitReturnStatement(ReturnStatement returnStatement, object data)
- {
- CodeMethodReturnStatement returnStmt;
- if (returnStatement.Expression.IsNull)
- returnStmt = new CodeMethodReturnStatement();
- else
- returnStmt = new CodeMethodReturnStatement((CodeExpression)returnStatement.Expression.AcceptVisitor(this,data));
-
- AddStmt(returnStmt, returnStatement);
-
- return returnStmt;
- }
-
- public override object VisitIfElseStatement(IfElseStatement ifElseStatement, object data)
- {
- CodeConditionStatement ifStmt = new CodeConditionStatement();
- AddStmt(ifStmt, ifElseStatement);
-
- ifStmt.Condition = (CodeExpression)ifElseStatement.Condition.AcceptVisitor(this, data);
-
- codeStack.Push(ifStmt.TrueStatements);
- foreach (Statement stmt in ifElseStatement.TrueStatement) {
- if (stmt is BlockStatement) {
- stmt.AcceptChildren(this, data);
- } else {
- stmt.AcceptVisitor(this, data);
- }
- }
- codeStack.Pop();
-
- codeStack.Push(ifStmt.FalseStatements);
- foreach (Statement stmt in ifElseStatement.FalseStatement) {
- if (stmt is BlockStatement) {
- stmt.AcceptChildren(this, data);
- } else {
- stmt.AcceptVisitor(this, data);
- }
- }
- codeStack.Pop();
-
- return ifStmt;
- }
-
- int foreachId = 0; // in case of nested foreach statments
-
- public override object VisitForeachStatement(ForeachStatement foreachStatement, object data)
- {
- // RG:
- // foreach (T t in x)
- // {
- // stmts;
- // }
- //
- // Emulate with
- //
- // for (System.Collections.IEnumerator _it = x.GetEnumerator(); _it.MoveNext(); )
- // {
- // T t = ((T)_it.Current);
- //
- // stmts;
- // }
-
- foreachId++;
- string name = "_it" + foreachId.ToString();
-
- CodeIterationStatement _for1 = new CodeIterationStatement();
- breakableStack.Push(new Breakable());
-
- AddStmt(_for1, foreachStatement);
-
- // init
- CodeVariableDeclarationStatement _decl2 = new CodeVariableDeclarationStatement();
- CodeMethodInvokeExpression _invoke1 = new CodeMethodInvokeExpression();
- CodeMethodReferenceExpression _GetEnumerator_method1 = new CodeMethodReferenceExpression();
- _GetEnumerator_method1.MethodName = "GetEnumerator";
-
- //CodeCastExpression _cast1 = new CodeCastExpression();
- //codeStack.Push(NullStmtCollection);
- //_cast1.Expression = (CodeExpression)foreachStatement.Expression.AcceptVisitor(this, data);
- //codeStack.Pop();
- //CodeTypeReference _IEnumerable_type1 = new CodeTypeReference("System.Collections.IEnumerable");
- //_cast1.TargetType = _IEnumerable_type1;
-
- //_GetEnumerator_method1.TargetObject = _cast1;
-
- codeStack.Push(NullStmtCollection);
- _GetEnumerator_method1.TargetObject = (CodeExpression)foreachStatement.Expression.AcceptVisitor(this, data);
- codeStack.Pop();
-
- _invoke1.Method = _GetEnumerator_method1;
- _decl2.InitExpression = _invoke1;
- _decl2.Name = name;
- CodeTypeReference _IEnumerator_type1 = new CodeTypeReference("System.Collections.IEnumerator");
- _decl2.Type = _IEnumerator_type1;
- _for1.InitStatement = _decl2;
-
- // Condition
- CodeMethodInvokeExpression _invoke2 = new CodeMethodInvokeExpression();
- CodeMethodReferenceExpression _MoveNext_method1 = new CodeMethodReferenceExpression();
- _MoveNext_method1.MethodName = "MoveNext";
- CodeVariableReferenceExpression _arg2 = new CodeVariableReferenceExpression();
- _arg2.VariableName = name;
- _MoveNext_method1.TargetObject = _arg2;
- _invoke2.Method = _MoveNext_method1;
- _for1.TestExpression = _invoke2;
-
- // Empty Increment
- _for1.IncrementStatement = new CodeExpressionStatement(new CodeSnippetExpression());
-
- // T t = ((T)_it.Current);
- CodeVariableDeclarationStatement _decl3 = new CodeVariableDeclarationStatement();
- CodeCastExpression _cast2 = new CodeCastExpression();
- CodePropertyReferenceExpression _prop1 = new CodePropertyReferenceExpression();
- _prop1.PropertyName = "Current";
- CodeVariableReferenceExpression _arg3 = new CodeVariableReferenceExpression();
- _arg3.VariableName = name;
- _prop1.TargetObject = _arg3;
- _cast2.Expression = _prop1;
- CodeTypeReference _System_String_type5 = ConvType(foreachStatement.TypeReference);
- _cast2.TargetType = _System_String_type5;
- _decl3.InitExpression = _cast2;
- _decl3.Name = foreachStatement.VariableName;
- CodeTypeReference _System_String_type6 = ConvType(foreachStatement.TypeReference);
- _decl3.Type = _System_String_type6;
- _for1.Statements.Add(_decl3);
- _for1.Statements.Add(new CodeSnippetStatement());
-
- codeStack.Push(_for1.Statements);
- foreachStatement.EmbeddedStatement.AcceptVisitor(this, data);
- codeStack.Pop();
-
- Breakable breakable = breakableStack.Pop();
-
- if (breakable.IsContinue)
- {
- _for1.Statements.Add(new CodeSnippetStatement());
- _for1.Statements.Add(new CodeLabeledStatement("continue" + breakable.Id, new CodeExpressionStatement(new CodeSnippetExpression())));
- }
-
- if (breakable.IsBreak)
- {
- AddStmt(new CodeLabeledStatement("break" + breakable.Id, new CodeExpressionStatement(new CodeSnippetExpression())), null);
- }
-
- return _for1;
- }
-
- int doId = 0;
-
- // RG:
- public override object VisitDoLoopStatement(DoLoopStatement doLoopStatement, object data)
- {
- CodeIterationStatement forLoop = new CodeIterationStatement();
- breakableStack.Push(new Breakable());
-
- AddStmt(forLoop, doLoopStatement);
-
- codeStack.Push(NullStmtCollection);
-
- if (doLoopStatement.ConditionPosition == ConditionPosition.End)
- {
- // do { } while (expr);
- //
- // emulate with:
- // for (bool _do = true; _do; _do = expr) {}
- //
- doId++;
- string name = "_do" + doId;
-
- forLoop.InitStatement = new CodeVariableDeclarationStatement(typeof(System.Boolean), name, new CodePrimitiveExpression(true));
- forLoop.TestExpression = new CodeVariableReferenceExpression(name);
-
- forLoop.IncrementStatement = new CodeAssignStatement(new CodeVariableReferenceExpression(name),
- doLoopStatement.Condition == null ? new CodePrimitiveExpression(true) : (CodeExpression)doLoopStatement.Condition.AcceptVisitor(this, data));
- }
- else
- {
- // while (expr) {}
- //
- // emulate with:
- // for (; expr;) {}
- //
-
- // Empty Init and Increment Statements
- forLoop.InitStatement = new CodeExpressionStatement(new CodeSnippetExpression());
- forLoop.IncrementStatement = new CodeExpressionStatement(new CodeSnippetExpression());
-
- if (doLoopStatement.Condition == null)
- {
- forLoop.TestExpression = new CodePrimitiveExpression(true);
- }
- else
- {
- forLoop.TestExpression = (CodeExpression)doLoopStatement.Condition.AcceptVisitor(this, data);
- }
- }
-
- codeStack.Pop();
-
- codeStack.Push(forLoop.Statements);
- doLoopStatement.EmbeddedStatement.AcceptVisitor(this, data);
- codeStack.Pop();
-
- if (forLoop.Statements.Count == 0)
- {
- forLoop.Statements.Add(new CodeSnippetStatement());
- }
-
- Breakable breakable = breakableStack.Pop();
-
- if (breakable.IsContinue)
- {
- forLoop.Statements.Add(new CodeSnippetStatement());
- forLoop.Statements.Add(new CodeLabeledStatement("continue" + breakable.Id, new CodeExpressionStatement(new CodeSnippetExpression())));
- }
-
- if (breakable.IsBreak)
- {
- AddStmt(new CodeLabeledStatement("break" + breakable.Id, new CodeExpressionStatement(new CodeSnippetExpression())), null);
- }
-
- return forLoop;
- }
-
- public override object VisitForStatement(ForStatement forStatement, object data)
- {
- CodeIterationStatement forLoop = new CodeIterationStatement();
- breakableStack.Push(new Breakable());
-
- AddStmt(forLoop, forStatement);
-
- codeStack.Push(NullStmtCollection);
-
- if (forStatement.Initializers.Count > 0)
- {
- if (forStatement.Initializers.Count > 1)
- {
- throw new NotSupportedException("CodeDom does not support Multiple For-Loop Initializer Statements");
- }
-
- foreach (object o in forStatement.Initializers)
- {
- if (o is Expression)
- {
- forLoop.InitStatement = new CodeExpressionStatement((CodeExpression)((Expression)o).AcceptVisitor(this, data));
- }
- if (o is Statement)
- {
- forLoop.InitStatement = (CodeStatement)((Statement)o).AcceptVisitor(this, data);
- }
- }
- }
- else
- {
- // RG: need to handle empty InitStatement
- forLoop.InitStatement = new CodeExpressionStatement(new CodeSnippetExpression());
- }
-
- if (forStatement.Condition == null) {
- forLoop.TestExpression = new CodePrimitiveExpression(true);
- } else {
- forLoop.TestExpression = (CodeExpression)forStatement.Condition.AcceptVisitor(this, data);
- }
-
- codeStack.Push(forLoop.Statements);
- forStatement.EmbeddedStatement.AcceptVisitor(this, data);
- codeStack.Pop();
-
- if (forStatement.Iterator.Count > 0)
- {
- if (forStatement.Initializers.Count > 1)
- {
- throw new NotSupportedException("CodeDom does not support Multiple For-Loop Iterator Statements");
- }
-
- foreach (Statement stmt in forStatement.Iterator)
- {
- forLoop.IncrementStatement = (CodeStatement)stmt.AcceptVisitor(this, data);
- }
- }
- else
- {
- // RG: need to handle empty IncrementStatement
- forLoop.IncrementStatement = new CodeExpressionStatement(new CodeSnippetExpression());
- }
-
- codeStack.Pop();
-
- Breakable breakable = breakableStack.Pop();
-
- if (breakable.IsContinue)
- {
- forLoop.Statements.Add(new CodeSnippetStatement());
- forLoop.Statements.Add(new CodeLabeledStatement("continue" + breakable.Id, new CodeExpressionStatement(new CodeSnippetExpression())));
- }
-
- if (breakable.IsBreak)
- {
- AddStmt(new CodeLabeledStatement("break" + breakable.Id, new CodeExpressionStatement(new CodeSnippetExpression())), null);
- }
-
- return forLoop;
- }
-
- public override object VisitLabelStatement(LabelStatement labelStatement, object data)
- {
- System.CodeDom.CodeLabeledStatement labelStmt = new CodeLabeledStatement(labelStatement.Label);
-
- // Add Statement to Current Statement Collection
- AddStmt(labelStmt, labelStatement);
-
- return labelStmt;
- }
-
- public override object VisitGotoStatement(GotoStatement gotoStatement, object data)
- {
- System.CodeDom.CodeGotoStatement gotoStmt = new CodeGotoStatement(gotoStatement.Label);
-
- // Add Statement to Current Statement Collection
- AddStmt(gotoStmt, gotoStatement);
-
- return gotoStmt;
- }
-
- // RG
- int switchId = 0;
-
- public override object VisitSwitchStatement(SwitchStatement switchStatement, object data)
- {
- // switch(arg) { case label1: expr1; case label2: expr2; default: expr3; }
- //
- // Emulate With:
- //
- // object _switch1 = arg;
- // if (arg.Equals(label1))
- // {
- // expr1;
- // }
- // else
- // {
- // if (arg.Equals(label2))
- // {
- // expr2;
- // }
- // else
- // {
- // expr3;
- // }
- // }
- //
-
- switchId++; // in case nested switch() statements
- string name = "_switch" + switchId.ToString();
-
- breakableStack.Push(new Breakable(false));
-
- bool isSwitchArg = false;
-
- CodeVariableReferenceExpression switchArg = null;
- SwitchSection defaultSection = null;
-
- // get default section
- foreach (SwitchSection section in switchStatement.SwitchSections)
- {
- foreach (CaseLabel label in section.SwitchLabels)
- {
- if (label.IsDefault)
- {
- defaultSection = section;
- break;
- }
- }
-
- if (defaultSection != null)
- break;
- }
-
-
- CodeConditionStatement _if = null;
-
- // get default section
- foreach (SwitchSection section in switchStatement.SwitchSections)
- {
- if (section != defaultSection)
- {
- if (!isSwitchArg)
- {
- isSwitchArg = true;
-
- codeStack.Push(NullStmtCollection);
- CodeVariableDeclarationStatement switchStmt = new CodeVariableDeclarationStatement("System.Object", name, (CodeExpression)switchStatement.SwitchExpression.AcceptVisitor(this, data));
- codeStack.Pop();
-
- switchArg = new CodeVariableReferenceExpression(name);
-
- AddStmt(switchStmt, section);
- AddStmt(new CodeSnippetStatement(), null);
- }
-
- codeStack.Push(NullStmtCollection);
-
- CodeExpression condition = null;
- foreach (CaseLabel label in section.SwitchLabels)
- {
- CodeMethodInvokeExpression cond = new CodeMethodInvokeExpression(switchArg, "Equals", (CodeExpression)label.Label.AcceptVisitor(this, data));
- if (condition == null)
- {
- condition = cond;
- }
- else
- {
- condition = new CodeBinaryOperatorExpression(condition, CodeBinaryOperatorType.BooleanOr, cond);
- }
- }
-
- codeStack.Pop();
-
- if (_if == null)
- {
- _if = new CodeConditionStatement();
- _if.Condition = condition;
-
- AddStmt(_if, null);
- }
- else
- {
- CodeConditionStatement _if2 = new CodeConditionStatement();
- _if2.Condition = condition;
-
- _if.FalseStatements.Add(_if2);
-
- _if = _if2;
- }
-
- codeStack.Push(_if.TrueStatements);
-
- for (int i = 0; i < section.Children.Count; i++)
- {
- INode stmt = section.Children[i];
-
- if (i == section.Children.Count - 1 && stmt is BreakStatement)
- break;
-
- stmt.AcceptVisitor(this, data);
- }
-
- codeStack.Pop();
- }
- }
-
- if (defaultSection != null)
- {
- if (_if != null)
- codeStack.Push(_if.FalseStatements);
-
- for (int i = 0; i < defaultSection.Children.Count; i++)
- {
- INode stmt = defaultSection.Children[i];
-
- if (i == defaultSection.Children.Count - 1 && stmt is BreakStatement)
- break;
-
- stmt.AcceptVisitor(this, data);
- }
-
- if (_if != null)
- codeStack.Pop();
- }
-
- Breakable breakable = breakableStack.Pop();
-
- if (breakable.IsContinue)
- {
- throw new Exception("Continue Inside Switch Not Supported");
- }
-
- if (breakable.IsBreak)
- {
- AddStmt(new CodeLabeledStatement("break" + breakable.Id, new CodeExpressionStatement(new CodeSnippetExpression())), null);
- }
-
- return null;
- }
-
- public override object VisitTryCatchStatement(TryCatchStatement tryCatchStatement, object data)
- {
- // add a try-catch-finally
- CodeTryCatchFinallyStatement tryStmt = new CodeTryCatchFinallyStatement();
-
- codeStack.Push(tryStmt.TryStatements);
-
- tryCatchStatement.StatementBlock.AcceptChildren(this, data);
- codeStack.Pop();
-
- if (!tryCatchStatement.FinallyBlock.IsNull) {
- codeStack.Push(tryStmt.FinallyStatements);
-
- tryCatchStatement.FinallyBlock.AcceptChildren(this,data);
- codeStack.Pop();
- }
-
- foreach (CatchClause clause in tryCatchStatement.CatchClauses)
- {
- CodeCatchClause catchClause = new CodeCatchClause(clause.VariableName);
- catchClause.CatchExceptionType = ConvType(clause.TypeReference);
- tryStmt.CatchClauses.Add(catchClause);
-
- codeStack.Push(catchClause.Statements);
-
- clause.StatementBlock.AcceptChildren(this, data);
- codeStack.Pop();
- }
-
- // Add Statement to Current Statement Collection
- AddStmt(tryStmt, tryCatchStatement);
-
- return tryStmt;
- }
-
- public override object VisitThrowStatement(ThrowStatement throwStatement, object data)
- {
- CodeThrowExceptionStatement throwStmt = new CodeThrowExceptionStatement((CodeExpression)throwStatement.Expression.AcceptVisitor(this, data));
-
- // Add Statement to Current Statement Collection
- AddStmt(throwStmt, throwStatement);
-
- return throwStmt;
- }
-
- public override object VisitFixedStatement(FixedStatement fixedStatement, object data)
- {
- throw new NotSupportedException("CodeDom does not support Fixed Statement");
- }
-
- #region Expressions
- public override object VisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data)
- {
- return new CodePrimitiveExpression(primitiveExpression.Value);
- }
-
- public override object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data)
- {
- CodeBinaryOperatorType op = CodeBinaryOperatorType.Add;
- switch (binaryOperatorExpression.Op) {
- case BinaryOperatorType.Add:
- op = CodeBinaryOperatorType.Add;
- break;
- case BinaryOperatorType.BitwiseAnd:
- op = CodeBinaryOperatorType.BitwiseAnd;
- break;
- case BinaryOperatorType.BitwiseOr:
- op = CodeBinaryOperatorType.BitwiseOr;
- break;
- case BinaryOperatorType.LogicalAnd:
- op = CodeBinaryOperatorType.BooleanAnd;
- break;
- case BinaryOperatorType.LogicalOr:
- op = CodeBinaryOperatorType.BooleanOr;
- break;
- case BinaryOperatorType.Divide:
- case BinaryOperatorType.DivideInteger:
- op = CodeBinaryOperatorType.Divide;
- break;
- case BinaryOperatorType.GreaterThan:
- op = CodeBinaryOperatorType.GreaterThan;
- break;
- case BinaryOperatorType.GreaterThanOrEqual:
- op = CodeBinaryOperatorType.GreaterThanOrEqual;
- break;
- case BinaryOperatorType.Equality:
- case BinaryOperatorType.InEquality:
- op = CodeBinaryOperatorType.ValueEquality;
- break;
- case BinaryOperatorType.LessThan:
- op = CodeBinaryOperatorType.LessThan;
- break;
- case BinaryOperatorType.LessThanOrEqual:
- op = CodeBinaryOperatorType.LessThanOrEqual;
- break;
- case BinaryOperatorType.Modulus:
- op = CodeBinaryOperatorType.Modulus;
- break;
- case BinaryOperatorType.Multiply:
- op = CodeBinaryOperatorType.Multiply;
- break;
- case BinaryOperatorType.Subtract:
- op = CodeBinaryOperatorType.Subtract;
- break;
- case BinaryOperatorType.ShiftLeft:
- case BinaryOperatorType.ShiftRight:
- // CodeDOM suxx
- op = CodeBinaryOperatorType.Multiply;
- break;
- case BinaryOperatorType.ReferenceEquality:
- op = CodeBinaryOperatorType.IdentityEquality;
- break;
- case BinaryOperatorType.ReferenceInequality:
- op = CodeBinaryOperatorType.IdentityInequality;
- break;
-
- case BinaryOperatorType.ExclusiveOr:
- // CodeDom doesn't support ExclusiveOr
- op = CodeBinaryOperatorType.BitwiseAnd;
- break;
- }
-
- System.Diagnostics.Debug.Assert(!binaryOperatorExpression.Left.IsNull);
- System.Diagnostics.Debug.Assert(!binaryOperatorExpression.Right.IsNull);
-
- var cboe = new CodeBinaryOperatorExpression(
- (CodeExpression)binaryOperatorExpression.Left.AcceptVisitor(this, data),
- op,
- (CodeExpression)binaryOperatorExpression.Right.AcceptVisitor(this, data));
- if (binaryOperatorExpression.Op == BinaryOperatorType.InEquality) {
- cboe = new CodeBinaryOperatorExpression(cboe, CodeBinaryOperatorType.ValueEquality, new CodePrimitiveExpression(false));
- }
- return cboe;
- }
-
- public override object VisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression, object data)
- {
- return parenthesizedExpression.Expression.AcceptVisitor(this, data);
- }
-
- public override object VisitInvocationExpression(InvocationExpression invocationExpression, object data)
- {
- Expression target = invocationExpression.TargetObject;
- CodeExpression targetExpr;
- string methodName = null;
- if (target == null) {
- targetExpr = new CodeThisReferenceExpression();
- } else if (target is MemberReferenceExpression) {
- MemberReferenceExpression fRef = (MemberReferenceExpression)target;
- targetExpr = null;
- if (fRef.TargetObject is MemberReferenceExpression) {
- if (IsPossibleTypeReference((MemberReferenceExpression)fRef.TargetObject)) {
- targetExpr = ConvertToTypeReference((MemberReferenceExpression)fRef.TargetObject);
- }
- }
- if (targetExpr == null)
- targetExpr = (CodeExpression)fRef.TargetObject.AcceptVisitor(this, data);
-
- methodName = fRef.MemberName;
- // HACK for : Microsoft.VisualBasic.ChrW(NUMBER)
- if (methodName == "ChrW") {
- return new CodeCastExpression("System.Char", GetExpressionList(invocationExpression.Arguments)[0]);
- }
- } else if (target is IdentifierExpression) {
- targetExpr = new CodeThisReferenceExpression();
- methodName = ((IdentifierExpression)target).Identifier;
- } else {
- targetExpr = (CodeExpression)target.AcceptVisitor(this, data);
- }
- return new CodeMethodInvokeExpression(targetExpr, methodName, GetExpressionList(invocationExpression.Arguments));
- }
-
- public override object VisitIdentifierExpression(IdentifierExpression identifierExpression, object data)
- {
- if (!IsLocalVariable(identifierExpression.Identifier) && IsField(identifierExpression.Identifier)) {
- return new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), identifierExpression.Identifier);
- }
- return new CodeVariableReferenceExpression(identifierExpression.Identifier);
- }
-
- public override object VisitUnaryOperatorExpression(UnaryOperatorExpression unaryOperatorExpression, object data)
- {
- CodeExpression var;
- CodeAssignStatement assign;
-
- switch (unaryOperatorExpression.Op) {
- case UnaryOperatorType.Minus:
- if (unaryOperatorExpression.Expression is PrimitiveExpression) {
- PrimitiveExpression expression = (PrimitiveExpression)unaryOperatorExpression.Expression;
- if (expression.Value is int) {
- return new CodePrimitiveExpression(- (int)expression.Value);
- }
- if (expression.Value is System.UInt32 || expression.Value is System.UInt16) {
- return new CodePrimitiveExpression(Int32.Parse("-" + expression.StringValue));
- }
-
- if (expression.Value is long) {
- return new CodePrimitiveExpression(- (long)expression.Value);
- }
- if (expression.Value is double) {
- return new CodePrimitiveExpression(- (double)expression.Value);
- }
- if (expression.Value is float) {
- return new CodePrimitiveExpression(- (float)expression.Value);
- }
-
- }
- return new CodeBinaryOperatorExpression(new CodePrimitiveExpression(0),
- CodeBinaryOperatorType.Subtract,
- (CodeExpression)unaryOperatorExpression.Expression.AcceptVisitor(this, data));
- case UnaryOperatorType.Plus:
- return unaryOperatorExpression.Expression.AcceptVisitor(this, data);
-
- case UnaryOperatorType.PostIncrement:
- // emulate i++, with i = i + 1
- var = (CodeExpression)unaryOperatorExpression.Expression.AcceptVisitor(this, data);
-
- assign = new CodeAssignStatement(var,
- new CodeBinaryOperatorExpression(var,
- CodeBinaryOperatorType.Add,
- new CodePrimitiveExpression(1)));
-
- AddStmt(assign, unaryOperatorExpression);
-
- return assign;
-
- //return new CodeAssignStatement(var,
- // new CodeBinaryOperatorExpression(var,
- // CodeBinaryOperatorType.Add,
- // new CodePrimitiveExpression(1)));
-
- // RG: needs to return an Expression - Not a Statement
- //return new CodeBinaryOperatorExpression(var,
- // CodeBinaryOperatorType.Assign,
- // new CodeBinaryOperatorExpression(var,
- // CodeBinaryOperatorType.Add,
- // new CodePrimitiveExpression(1)));
-
- case UnaryOperatorType.PostDecrement:
- // emulate i--, with i = i - 1
- var = (CodeExpression)unaryOperatorExpression.Expression.AcceptVisitor(this, data);
-
- assign = new CodeAssignStatement(var,
- new CodeBinaryOperatorExpression(var,
- CodeBinaryOperatorType.Subtract,
- new CodePrimitiveExpression(1)));
-
- AddStmt(assign, unaryOperatorExpression);
-
- return assign;
-
- //return new CodeAssignStatement(var,
- // new CodeBinaryOperatorExpression(var,
- // CodeBinaryOperatorType.Subtract,
- // new CodePrimitiveExpression(1)));
-
- // RG: needs to return an Expression - Not a Statement
- //return new CodeBinaryOperatorExpression(var,
- // CodeBinaryOperatorType.Assign,
- // new CodeBinaryOperatorExpression(var,
- // CodeBinaryOperatorType.Subtract,
- // new CodePrimitiveExpression(1)));
-
- case UnaryOperatorType.Decrement:
- // emulate --i, with i = i - 1
- var = (CodeExpression)unaryOperatorExpression.Expression.AcceptVisitor(this, data);
-
- assign = new CodeAssignStatement(var,
- new CodeBinaryOperatorExpression(var,
- CodeBinaryOperatorType.Subtract,
- new CodePrimitiveExpression(1)));
- AddStmt(assign, unaryOperatorExpression);
-
- return assign;
- //return new CodeAssignStatement(var,
- // new CodeBinaryOperatorExpression(var,
- // CodeBinaryOperatorType.Subtract,
- // new CodePrimitiveExpression(1)));
-
- //return new CodeBinaryOperatorExpression(var,
- // CodeBinaryOperatorType.Assign,
- // new CodeBinaryOperatorExpression(var,
- // CodeBinaryOperatorType.Subtract,
- // new CodePrimitiveExpression(1)));
-
- case UnaryOperatorType.Increment:
- // emulate ++i, with i = i + 1
- var = (CodeExpression)unaryOperatorExpression.Expression.AcceptVisitor(this, data);
-
- assign = new CodeAssignStatement(var,
- new CodeBinaryOperatorExpression(var,
- CodeBinaryOperatorType.Add,
- new CodePrimitiveExpression(1)));
-
- AddStmt(assign, unaryOperatorExpression);
-
- return assign;
-
- //return new CodeAssignStatement(var,
- // new CodeBinaryOperatorExpression(var,
- // CodeBinaryOperatorType.Add,
- // new CodePrimitiveExpression(1)));
-
- //return new CodeBinaryOperatorExpression(var,
- // CodeBinaryOperatorType.Assign,
- // new CodeBinaryOperatorExpression(var,
- // CodeBinaryOperatorType.Add,
- // new CodePrimitiveExpression(1)));
-
- // RG:
- case UnaryOperatorType.Not:
- // emulate !a with a == false
- var = (CodeExpression)unaryOperatorExpression.Expression.AcceptVisitor(this, data);
-
- CodeBinaryOperatorExpression cboe = var as CodeBinaryOperatorExpression;
- if (cboe != null && cboe.Operator == CodeBinaryOperatorType.IdentityEquality) {
- return new CodeBinaryOperatorExpression(cboe.Left, CodeBinaryOperatorType.IdentityInequality, cboe.Right);
- } else {
- return new CodeBinaryOperatorExpression(var,CodeBinaryOperatorType.ValueEquality, new CodePrimitiveExpression(false));
- }
-
- default:
- throw new NotSupportedException("CodeDom does not support Unary Operators");
- }
- }
-
- bool methodReference = false;
-
- void AddEventHandler(Expression eventExpr, Expression handler, object data)
- {
- methodReference = true;
- CodeExpression methodInvoker = (CodeExpression)handler.AcceptVisitor(this, data);
- methodReference = false;
- if (!(methodInvoker is CodeObjectCreateExpression)) {
- // we need to create an event handler here
- methodInvoker = new CodeObjectCreateExpression(new CodeTypeReference("System.EventHandler"), methodInvoker);
- }
-
- if (eventExpr is IdentifierExpression) {
- AddStmt(new CodeAttachEventStatement(new CodeEventReferenceExpression(new CodeThisReferenceExpression(), ((IdentifierExpression)eventExpr).Identifier),
- methodInvoker), eventExpr);
- } else {
- MemberReferenceExpression fr = (MemberReferenceExpression)eventExpr;
- AddStmt(new CodeAttachEventStatement(new CodeEventReferenceExpression((CodeExpression)fr.TargetObject.AcceptVisitor(this, data), fr.MemberName),
- methodInvoker), eventExpr);
- }
- }
-
- public override object VisitAssignmentExpression(AssignmentExpression assignmentExpression, object data)
- {
- if (assignmentExpression.Op == AssignmentOperatorType.Add) {
- AddEventHandler(assignmentExpression.Left, assignmentExpression.Right, data);
- } else {
- if (assignmentExpression.Left is IdentifierExpression) {
- AddStmt(new CodeAssignStatement((CodeExpression)assignmentExpression.Left.AcceptVisitor(this, null), (CodeExpression)assignmentExpression.Right.AcceptVisitor(this, null)), assignmentExpression);
- } else {
- AddStmt(new CodeAssignStatement((CodeExpression)assignmentExpression.Left.AcceptVisitor(this, null), (CodeExpression)assignmentExpression.Right.AcceptVisitor(this, null)), assignmentExpression);
- }
- }
- return null;
- }
-
- public override object VisitAddHandlerStatement(AddHandlerStatement addHandlerStatement, object data)
- {
- AddEventHandler(addHandlerStatement.EventExpression, addHandlerStatement.HandlerExpression, data);
- return null;
- }
-
- public override object VisitAddressOfExpression(AddressOfExpression addressOfExpression, object data)
- {
- return addressOfExpression.Expression.AcceptVisitor(this, data);
- }
-
- public override object VisitUsing(Using @using, object data)
- {
- return base.VisitUsing(@using, data);
- }
-
- // RG
- int usingId = 0;
-
- public override object VisitUsingStatement(UsingStatement usingStatement, object data)
- {
- // using (new expr) { stmts; }
- //
- // emulate with
- // object _dispose;
- // try
- // {
- // _dispose = new expr;
- //
- // stmts;
- // }
- // finally
- // {
- // if (((_dispose != null)
- // && (typeof(System.IDisposable).IsInstanceOfType(_dispose) == true)))
- // {
- // ((System.IDisposable)(_dispose)).Dispose();
- // }
- // }
- //
-
- usingId++; // in case nested using() statements
- string name = "_dispose" + usingId.ToString();
-
- CodeVariableDeclarationStatement disposable = new CodeVariableDeclarationStatement("System.Object", name, new CodePrimitiveExpression(null));
-
- AddStmt(disposable, usingStatement);
-
- CodeTryCatchFinallyStatement tryStmt = new CodeTryCatchFinallyStatement();
-
- CodeVariableReferenceExpression left1 = new CodeVariableReferenceExpression(name);
-
- codeStack.Push(NullStmtCollection); // send statements to nul Statement collection
- CodeExpression right1 = (CodeExpression)usingStatement.ResourceAcquisition.AcceptVisitor(this, data);
- codeStack.Pop();
-
- CodeAssignStatement assign1 = new CodeAssignStatement(left1, right1);
-
- tryStmt.TryStatements.Add(assign1);
- tryStmt.TryStatements.Add(new CodeSnippetStatement());
-
- codeStack.Push(tryStmt.TryStatements);
- usingStatement.EmbeddedStatement.AcceptChildren(this, data);
- codeStack.Pop();
-
- CodeMethodInvokeExpression isInstanceOfType = new CodeMethodInvokeExpression(new CodeTypeOfExpression(typeof(IDisposable)), "IsInstanceOfType", new CodeExpression[] { left1 });
-
- CodeConditionStatement if1 = new CodeConditionStatement();
- if1.Condition = new CodeBinaryOperatorExpression(new CodeBinaryOperatorExpression(left1, CodeBinaryOperatorType.IdentityInequality, new CodePrimitiveExpression(null)),
- CodeBinaryOperatorType.BooleanAnd,
- new CodeBinaryOperatorExpression(isInstanceOfType, CodeBinaryOperatorType.IdentityEquality, new CodePrimitiveExpression(true)));
- if1.TrueStatements.Add(new CodeMethodInvokeExpression(new CodeCastExpression(typeof(IDisposable),left1), "Dispose", new CodeExpression[] { }));
-
- tryStmt.FinallyStatements.Add(if1);
-
- // Add Statement to Current Statement Collection
- AddStmt(tryStmt, null);
-
- return null;
- }
-
- public override object VisitTypeOfExpression(TypeOfExpression typeOfExpression, object data)
- {
- return new CodeTypeOfExpression(ConvType(typeOfExpression.TypeReference));
- }
-
- public override object VisitCastExpression(CastExpression castExpression, object data)
- {
- CodeTypeReference typeRef = ConvType(castExpression.CastTo);
- return new CodeCastExpression(typeRef, (CodeExpression)castExpression.Expression.AcceptVisitor(this, data));
- }
-
- public override object VisitIndexerExpression(IndexerExpression indexerExpression, object data)
- {
- return new CodeIndexerExpression((CodeExpression)indexerExpression.TargetObject.AcceptVisitor(this, data), GetExpressionList(indexerExpression.Indexes));
- }
-
- public override object VisitThisReferenceExpression(ThisReferenceExpression thisReferenceExpression, object data)
- {
- return new CodeThisReferenceExpression();
- }
-
- public override object VisitBaseReferenceExpression(BaseReferenceExpression baseReferenceExpression, object data)
- {
- return new CodeBaseReferenceExpression();
- }
-
- public override object VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object data)
- {
- if (arrayCreateExpression.ArrayInitializer.IsNull) {
- return new CodeArrayCreateExpression(ConvType(arrayCreateExpression.CreateType),
- arrayCreateExpression.Arguments[0].AcceptVisitor(this, data) as CodeExpression);
- }
- return new CodeArrayCreateExpression(ConvType(arrayCreateExpression.CreateType),
- GetExpressionList(arrayCreateExpression.ArrayInitializer.CreateExpressions));
- }
-
- public override object VisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression, object data)
- {
- return new CodeObjectCreateExpression(ConvType(objectCreateExpression.CreateType),
- objectCreateExpression.Parameters == null ? null : GetExpressionList(objectCreateExpression.Parameters));
- }
-
- public override object VisitParameterDeclarationExpression(ParameterDeclarationExpression parameterDeclarationExpression, object data)
- {
- CodeParameterDeclarationExpression parameter = new CodeParameterDeclarationExpression(ConvType(parameterDeclarationExpression.TypeReference), parameterDeclarationExpression.ParameterName);
-
- parameters.Add(parameter);
-
- return parameter;
- }
-
- public override object VisitBreakStatement(BreakStatement breakStatement, object data)
- {
- // RG:
- // break;
- //
- // emulate with:
- // goto break1;
- //
- Breakable breakable = breakableStack.Peek();
-
- breakable.IsBreak = true;
-
- CodeGotoStatement breakStmt = new CodeGotoStatement("break" + breakable.Id);
-
- AddStmt(breakStmt, breakStatement);
-
- return breakStmt;
- }
-
- public override object VisitContinueStatement(ContinueStatement continueStatement, object data)
- {
- // RG:
- // continue;
- //
- // emulate with:
- // goto continue1;
- //
- Breakable breakable = breakableStack.Peek();
-
- // Is continuable?
- if (!breakable.AllowContinue)
- {
- // walk stack to find first continuable item
- Breakable[] stack = breakableStack.ToArray();
- foreach (Breakable b in stack)
- {
- if (b.AllowContinue)
- {
- breakable = b;
- break;
- }
- }
- }
-
- breakable.IsContinue = true;
-
- CodeGotoStatement continueStmt = new CodeGotoStatement("continue" + breakable.Id);
-
- AddStmt(continueStmt, continueStatement);
-
- return continueStmt;
- }
-
- bool IsField(string type, int typeParameterCount, string fieldName)
- {
- bool isField = environmentInformationProvider.HasField(type, typeParameterCount, fieldName);
-
- if (!isField) {
- int idx = type.LastIndexOf('.');
- if (idx >= 0) {
- type = type.Substring(0, idx) + "+" + type.Substring(idx + 1);
- isField = IsField(type, typeParameterCount, fieldName);
- }
- }
-
- return isField;
- }
-
- bool IsFieldReferenceExpression(MemberReferenceExpression fieldReferenceExpression)
- {
- if (fieldReferenceExpression.TargetObject is ThisReferenceExpression
- || fieldReferenceExpression.TargetObject is BaseReferenceExpression)
- {
- //field detection for fields\props inherited from base classes
- return IsField(fieldReferenceExpression.MemberName);
- }
- return false;
- }
-
- public override object VisitMemberReferenceExpression(MemberReferenceExpression fieldReferenceExpression, object data)
- {
- if (methodReference) {
- methodReference = false;
- return new CodeMethodReferenceExpression((CodeExpression)fieldReferenceExpression.TargetObject.AcceptVisitor(this, data), fieldReferenceExpression.MemberName);
- }
- if (IsFieldReferenceExpression(fieldReferenceExpression)) {
- return new CodeFieldReferenceExpression((CodeExpression)fieldReferenceExpression.TargetObject.AcceptVisitor(this, data),
- fieldReferenceExpression.MemberName);
- } else {
- if (fieldReferenceExpression.TargetObject is MemberReferenceExpression) {
- if (IsPossibleTypeReference((MemberReferenceExpression)fieldReferenceExpression.TargetObject)) {
- CodeTypeReferenceExpression typeRef = ConvertToTypeReference((MemberReferenceExpression)fieldReferenceExpression.TargetObject);
- if (IsField(typeRef.Type.BaseType, typeRef.Type.TypeArguments.Count, fieldReferenceExpression.MemberName)) {
- return new CodeFieldReferenceExpression(typeRef,
- fieldReferenceExpression.MemberName);
- } else {
- return new CodePropertyReferenceExpression(typeRef,
- fieldReferenceExpression.MemberName);
- }
- }
- }
-
- CodeExpression codeExpression = (CodeExpression)fieldReferenceExpression.TargetObject.AcceptVisitor(this, data);
- return new CodePropertyReferenceExpression(codeExpression,
- fieldReferenceExpression.MemberName);
- }
- }
-
- #endregion
-
- #endregion
- bool IsPossibleTypeReference(MemberReferenceExpression fieldReferenceExpression)
- {
- while (fieldReferenceExpression.TargetObject is MemberReferenceExpression) {
- fieldReferenceExpression = (MemberReferenceExpression)fieldReferenceExpression.TargetObject;
- }
- IdentifierExpression identifier = fieldReferenceExpression.TargetObject as IdentifierExpression;
- if (identifier != null)
- return !IsField(identifier.Identifier) && !IsLocalVariable(identifier.Identifier);
- TypeReferenceExpression tre = fieldReferenceExpression.TargetObject as TypeReferenceExpression;
- if (tre != null)
- return true;
- return false;
- }
-
- bool IsLocalVariable(string identifier)
- {
- foreach (CodeVariableDeclarationStatement variable in variables) {
- if (variable.Name == identifier)
- return true;
- }
-
- foreach (CodeParameterDeclarationExpression parameter in parameters)
- {
- if (parameter.Name == identifier)
- return true;
- }
-
- return false;
- }
-
- bool IsField(string identifier)
- {
- if (currentTypeDeclaration == null) // e.g. in unit tests
- return false;
- foreach (INode node in currentTypeDeclaration.Children) {
- if (node is FieldDeclaration) {
- FieldDeclaration fd = (FieldDeclaration)node;
- if (fd.GetVariableDeclaration(identifier) != null) {
- return true;
- }
- }
- }
- //field detection for fields\props inherited from base classes
- if (currentTypeDeclaration.BaseTypes.Count > 0) {
- return IsField(currentTypeDeclaration.BaseTypes[0].Type, currentTypeDeclaration.BaseTypes[0].GenericTypes.Count, identifier);
- }
- return false;
- }
-
- static CodeTypeReferenceExpression ConvertToTypeReference(MemberReferenceExpression fieldReferenceExpression)
- {
- StringBuilder type = new StringBuilder("");
-
- while (fieldReferenceExpression.TargetObject is MemberReferenceExpression) {
- type.Insert(0,'.');
- type.Insert(1,fieldReferenceExpression.MemberName.ToCharArray());
- fieldReferenceExpression = (MemberReferenceExpression)fieldReferenceExpression.TargetObject;
- }
-
- type.Insert(0,'.');
- type.Insert(1,fieldReferenceExpression.MemberName.ToCharArray());
-
- if (fieldReferenceExpression.TargetObject is IdentifierExpression) {
- type.Insert(0, ((IdentifierExpression)fieldReferenceExpression.TargetObject).Identifier.ToCharArray());
- string oldType = type.ToString();
- int idx = oldType.LastIndexOf('.');
- while (idx > 0) {
- if (Type.GetType(type.ToString()) != null) {
- break;
- }
- string stype = type.ToString().Substring(idx + 1);
- type = new StringBuilder(type.ToString().Substring(0, idx));
- type.Append("+");
- type.Append(stype);
- idx = type.ToString().LastIndexOf('.');
- }
- if (Type.GetType(type.ToString()) == null) {
- type = new StringBuilder(oldType);
- }
- return new CodeTypeReferenceExpression(type.ToString());
- } else if (fieldReferenceExpression.TargetObject is TypeReferenceExpression) {
- type.Insert(0, ((TypeReferenceExpression)fieldReferenceExpression.TargetObject).TypeReference.Type);
- return new CodeTypeReferenceExpression(type.ToString());
- } else {
- return null;
- }
- }
-
- CodeExpression[] GetExpressionList(IList expressionList)
- {
- if (expressionList == null) {
- return new CodeExpression[0];
- }
- CodeExpression[] list = new CodeExpression[expressionList.Count];
- for (int i = 0; i < expressionList.Count; ++i) {
- list[i] = (CodeExpression)((Expression)expressionList[i]).AcceptVisitor(this, null);
- if (list[i] == null) {
- list[i] = new CodePrimitiveExpression(0);
- }
- }
- return list;
- }
-
-
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+using System.CodeDom;
+using System.Collections;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text;
+
+using ICSharpCode.NRefactory.Ast;
+
+namespace ICSharpCode.NRefactory.Visitors
+{
+ public class CodeDomVisitor : AbstractAstVisitor
+ {
+ Stack<CodeNamespace> namespaceDeclarations = new Stack<CodeNamespace>();
+ Stack<CodeTypeDeclaration> typeDeclarations = new Stack<CodeTypeDeclaration>();
+ Stack<CodeStatementCollection> codeStack = new Stack<CodeStatementCollection>();
+ List<CodeVariableDeclarationStatement> variables = new List<CodeVariableDeclarationStatement>();
+ List<CodeParameterDeclarationExpression> parameters = new List<CodeParameterDeclarationExpression>();
+ Stack<Breakable> breakableStack = new Stack<Breakable>();
+
+ TypeDeclaration currentTypeDeclaration = null;
+
+ IEnvironmentInformationProvider environmentInformationProvider = DummyEnvironmentInformationProvider.Instance;
+
+ // track break and continue statements
+ class Breakable
+ {
+ public static int NextId = 0;
+
+ public int Id = 0;
+ public bool IsBreak = false;
+ public bool IsContinue = false;
+ public bool AllowContinue = true;
+
+ public Breakable()
+ {
+ Id = ++NextId;
+ }
+
+ public Breakable(bool allowContinue)
+ : this()
+ {
+ AllowContinue = allowContinue;
+ }
+ }
+
+ public IEnvironmentInformationProvider EnvironmentInformationProvider {
+ get { return environmentInformationProvider; }
+ set {
+ if (value == null)
+ throw new ArgumentNullException("value");
+ environmentInformationProvider = value;
+ }
+ }
+
+ // dummy collection used to swallow statements
+ CodeStatementCollection NullStmtCollection = new CodeStatementCollection();
+
+ public CodeCompileUnit codeCompileUnit = new CodeCompileUnit();
+
+ // RG
+ //
+ // Initialise Scope Variables for Current Method
+ void InitMethodScope()
+ {
+ usingId = 0;
+ foreachId = 0;
+ switchId = 0;
+ doId = 0;
+ Breakable.NextId = 0;
+ variables.Clear();
+ parameters.Clear();
+ }
+
+ CodeTypeReference ConvType(TypeReference type)
+ {
+ if (type == null) {
+ throw new ArgumentNullException("type");
+ }
+ if (string.IsNullOrEmpty(type.Type)) {
+ throw new InvalidOperationException("empty type");
+ }
+
+ CodeTypeReference t = new CodeTypeReference(type.Type);
+ foreach (TypeReference gt in type.GenericTypes) {
+ t.TypeArguments.Add(ConvType(gt));
+ }
+ if (type.IsArrayType) {
+ for (int i = type.RankSpecifier.Length - 1; i >= 0; --i)
+ {
+ t = new CodeTypeReference(t, type.RankSpecifier[i] + 1);
+ }
+ }
+
+ return t;
+ }
+
+ void AddStmt(CodeStatement stmt)
+ {
+ if (codeStack.Count == 0)
+ return;
+ CodeStatementCollection stmtCollection = codeStack.Peek();
+ if (stmtCollection != null) {
+ stmtCollection.Add(stmt);
+ }
+ }
+
+ static MemberAttributes ConvMemberAttributes(Modifiers modifier)
+ {
+ MemberAttributes attr = (MemberAttributes)0;
+
+ if ((modifier & Modifiers.Abstract) != 0)
+ attr |= MemberAttributes.Abstract;
+ if ((modifier & Modifiers.Const) != 0)
+ attr |= MemberAttributes.Const;
+ if ((modifier & Modifiers.Sealed) != 0)
+ attr |= MemberAttributes.Final;
+ if ((modifier & Modifiers.New) != 0)
+ attr |= MemberAttributes.New;
+ if ((modifier & Modifiers.Virtual) != 0)
+ attr |= MemberAttributes.Overloaded;
+ if ((modifier & Modifiers.Override) != 0)
+ attr |= MemberAttributes.Override;
+ if ((modifier & Modifiers.Static) != 0)
+ attr |= MemberAttributes.Static;
+
+ if ((modifier & Modifiers.Public) != 0)
+ attr |= MemberAttributes.Public;
+ else if ((modifier & Modifiers.Internal) != 0 && (modifier & Modifiers.Protected) != 0)
+ attr |= MemberAttributes.FamilyOrAssembly;
+ else if ((modifier & Modifiers.Internal) != 0)
+ attr |= MemberAttributes.Assembly;
+ else if ((modifier & Modifiers.Protected) != 0)
+ attr |= MemberAttributes.Family;
+ else if ((modifier & Modifiers.Private) != 0)
+ attr |= MemberAttributes.Private;
+
+ return attr;
+ }
+
+ static TypeAttributes ConvTypeAttributes(Modifiers modifier)
+ {
+ TypeAttributes attr = (TypeAttributes)0;
+ if ((modifier & Modifiers.Abstract) != 0)
+ attr |= TypeAttributes.Abstract;
+ if ((modifier & Modifiers.Sealed) != 0)
+ attr |= TypeAttributes.Sealed;
+ if ((modifier & Modifiers.Static) != 0)
+ attr |= TypeAttributes.Abstract | TypeAttributes.Sealed;
+
+ if ((modifier & Modifiers.Public) != 0)
+ attr |= TypeAttributes.Public;
+ else
+ attr |= TypeAttributes.NotPublic;
+
+ return attr;
+ }
+
+ #region ICSharpCode.SharpRefactory.Parser.IASTVisitor interface implementation
+ public override object VisitCompilationUnit(CompilationUnit compilationUnit, object data)
+ {
+ if (compilationUnit == null) {
+ throw new ArgumentNullException("compilationUnit");
+ }
+ CodeNamespace globalNamespace = new CodeNamespace("Global");
+ //namespaces.Add(globalNamespace);
+ namespaceDeclarations.Push(globalNamespace);
+ compilationUnit.AcceptChildren(this, data);
+ codeCompileUnit.Namespaces.Add(globalNamespace);
+ return globalNamespace;
+ }
+
+ public override object VisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, object data)
+ {
+ CodeNamespace currentNamespace = new CodeNamespace(namespaceDeclaration.Name);
+ //namespaces.Add(currentNamespace);
+ // add imports from mother namespace
+ foreach (CodeNamespaceImport import in ((CodeNamespace)namespaceDeclarations.Peek()).Imports) {
+ currentNamespace.Imports.Add(import);
+ }
+ namespaceDeclarations.Push(currentNamespace);
+ namespaceDeclaration.AcceptChildren(this, data);
+ namespaceDeclarations.Pop();
+ codeCompileUnit.Namespaces.Add(currentNamespace);
+
+ // Nested namespaces are not allowed in CodeDOM
+ return null;
+ }
+
+ public override object VisitUsingDeclaration(UsingDeclaration usingDeclaration, object data)
+ {
+ foreach (Using u in usingDeclaration.Usings) {
+ namespaceDeclarations.Peek().Imports.Add(new CodeNamespaceImport(u.Name));
+ }
+ return null;
+ }
+
+ // RG
+ public override object VisitEventDeclaration(EventDeclaration eventDeclaration, object data)
+ {
+ CodeMemberEvent evt = new CodeMemberEvent();
+ evt.Type = ConvType(eventDeclaration.TypeReference);
+ evt.Name = eventDeclaration.Name;
+
+ evt.Attributes = ConvMemberAttributes(eventDeclaration.Modifier);
+
+ typeDeclarations.Peek().Members.Add(evt);
+
+ return null;
+ }
+
+ public override object VisitAttributeSection(AttributeSection attributeSection, object data)
+ {
+ return null;
+ }
+
+ // RG: CodeTypeReferenceExpression
+ public override object VisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, object data)
+ {
+ return new CodeTypeReferenceExpression(ConvType(typeReferenceExpression.TypeReference));
+ }
+
+ public override object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
+ {
+ TypeDeclaration oldTypeDeclaration = currentTypeDeclaration;
+ this.currentTypeDeclaration = typeDeclaration;
+ CodeTypeDeclaration codeTypeDeclaration = new CodeTypeDeclaration(typeDeclaration.Name);
+ codeTypeDeclaration.TypeAttributes = ConvTypeAttributes(typeDeclaration.Modifier);
+ codeTypeDeclaration.IsClass = typeDeclaration.Type == ClassType.Class;
+ codeTypeDeclaration.IsEnum = typeDeclaration.Type == ClassType.Enum;
+ codeTypeDeclaration.IsInterface = typeDeclaration.Type == ClassType.Interface;
+ codeTypeDeclaration.IsStruct = typeDeclaration.Type == ClassType.Struct;
+ codeTypeDeclaration.IsPartial = (typeDeclaration.Modifier & Modifiers.Partial) != 0;
+
+ if (typeDeclaration.BaseTypes != null) {
+ foreach (TypeReference typeRef in typeDeclaration.BaseTypes) {
+ codeTypeDeclaration.BaseTypes.Add(ConvType(typeRef));
+ }
+ }
+
+ typeDeclarations.Push(codeTypeDeclaration);
+ typeDeclaration.AcceptChildren(this, data);
+ typeDeclarations.Pop();
+
+ if (typeDeclarations.Count > 0) {
+ typeDeclarations.Peek().Members.Add(codeTypeDeclaration);
+ } else {
+ namespaceDeclarations.Peek().Types.Add(codeTypeDeclaration);
+ }
+ currentTypeDeclaration = oldTypeDeclaration;
+
+ return null;
+ }
+
+ public override object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data)
+ {
+ CodeTypeDelegate codeTypeDelegate = new CodeTypeDelegate(delegateDeclaration.Name);
+ codeTypeDelegate.Attributes = ConvMemberAttributes(delegateDeclaration.Modifier);
+ codeTypeDelegate.ReturnType = ConvType(delegateDeclaration.ReturnType);
+
+ foreach (ParameterDeclarationExpression parameter in delegateDeclaration.Parameters)
+ {
+ codeTypeDelegate.Parameters.Add((CodeParameterDeclarationExpression)VisitParameterDeclarationExpression(parameter, data));
+ }
+
+ if (typeDeclarations.Count > 0)
+ {
+ typeDeclarations.Peek().Members.Add(codeTypeDelegate);
+ }
+ else
+ {
+ namespaceDeclarations.Peek().Types.Add(codeTypeDelegate);
+ }
+
+ return null;
+ }
+
+ public override object VisitVariableDeclaration(VariableDeclaration variableDeclaration, object data)
+ {
+ return null;
+ }
+
+ public override object VisitFieldDeclaration(FieldDeclaration fieldDeclaration, object data)
+ {
+ for (int i = 0; i < fieldDeclaration.Fields.Count; ++i) {
+ VariableDeclaration field = (VariableDeclaration)fieldDeclaration.Fields[i];
+
+ if ((fieldDeclaration.Modifier & Modifiers.WithEvents) != 0) {
+ //this.withEventsFields.Add(field);
+ }
+ TypeReference fieldType = fieldDeclaration.GetTypeForField(i);
+
+ if (fieldType.IsNull) {
+ fieldType = new TypeReference(typeDeclarations.Peek().Name);
+ }
+
+ CodeMemberField memberField = new CodeMemberField(ConvType(fieldType), field.Name);
+ memberField.Attributes = ConvMemberAttributes(fieldDeclaration.Modifier);
+ if (!field.Initializer.IsNull) {
+ memberField.InitExpression = (CodeExpression)field.Initializer.AcceptVisitor(this, data);
+ }
+
+ typeDeclarations.Peek().Members.Add(memberField);
+ }
+
+ return null;
+ }
+
+ public override object VisitMethodDeclaration(MethodDeclaration methodDeclaration, object data)
+ {
+ InitMethodScope();
+
+ CodeMemberMethod memberMethod = new CodeMemberMethod();
+ memberMethod.Name = methodDeclaration.Name;
+ memberMethod.Attributes = ConvMemberAttributes(methodDeclaration.Modifier);
+
+ // RG: Private Interface Decl
+ if ((memberMethod.Attributes & MemberAttributes.Public) != MemberAttributes.Public &&
+ methodDeclaration.InterfaceImplementations.Count > 0)
+ {
+ memberMethod.PrivateImplementationType = ConvType(methodDeclaration.InterfaceImplementations[0].InterfaceType);
+ }
+
+ codeStack.Push(memberMethod.Statements);
+
+ typeDeclarations.Peek().Members.Add(memberMethod);
+
+ // Add Method Parameters
+ parameters.Clear();
+
+ foreach (ParameterDeclarationExpression parameter in methodDeclaration.Parameters)
+ {
+ memberMethod.Parameters.Add((CodeParameterDeclarationExpression)VisitParameterDeclarationExpression(parameter, data));
+ }
+
+ usingId = 0; // RG
+ foreachId = 0;
+ switchId = 0;
+ doId = 0;
+ Breakable.NextId = 0;
+ variables.Clear();
+ methodDeclaration.Body.AcceptChildren(this, data);
+
+ codeStack.Pop();
+
+ return null;
+ }
+
+ // RG
+ public override object VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration, object data)
+ {
+ CodeMemberProperty memberProperty = new CodeMemberProperty();
+ memberProperty.Name = propertyDeclaration.Name;
+ memberProperty.Attributes = ConvMemberAttributes(propertyDeclaration.Modifier);
+ memberProperty.HasGet = propertyDeclaration.HasGetRegion;
+ memberProperty.HasSet = propertyDeclaration.HasSetRegion;
+ memberProperty.Type = ConvType(propertyDeclaration.TypeReference);
+
+ typeDeclarations.Peek().Members.Add(memberProperty);
+
+ // Add Method Parameters
+ foreach (ParameterDeclarationExpression parameter in propertyDeclaration.Parameters)
+ {
+ memberProperty.Parameters.Add((CodeParameterDeclarationExpression)VisitParameterDeclarationExpression(parameter, data));
+ }
+
+ if (memberProperty.HasGet)
+ {
+ codeStack.Push(memberProperty.GetStatements);
+ propertyDeclaration.GetRegion.Block.AcceptChildren(this, data);
+ codeStack.Pop();
+ }
+
+ if (memberProperty.HasSet)
+ {
+ codeStack.Push(memberProperty.SetStatements);
+ propertyDeclaration.SetRegion.Block.AcceptChildren(this, data);
+ codeStack.Pop();
+ }
+
+ return null;
+ }
+
+ public override object VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data)
+ {
+ InitMethodScope();
+
+ CodeConstructor memberMethod = new CodeConstructor();
+ memberMethod.Attributes = ConvMemberAttributes(constructorDeclaration.Modifier);
+
+ typeDeclarations.Peek().Members.Add(memberMethod);
+
+ codeStack.Push(NullStmtCollection);
+ foreach (ParameterDeclarationExpression parameter in constructorDeclaration.Parameters)
+ {
+ memberMethod.Parameters.Add((CodeParameterDeclarationExpression)VisitParameterDeclarationExpression(parameter, data));
+ }
+
+ if (constructorDeclaration.ConstructorInitializer != null)
+ {
+ if (constructorDeclaration.ConstructorInitializer.ConstructorInitializerType == ConstructorInitializerType.Base)
+ {
+ if (constructorDeclaration.ConstructorInitializer.Arguments.Count == 0)
+ {
+ memberMethod.BaseConstructorArgs.Add(new CodeSnippetExpression());
+ }
+
+ foreach (Expression o in constructorDeclaration.ConstructorInitializer.Arguments)
+ {
+ memberMethod.BaseConstructorArgs.Add((CodeExpression)o.AcceptVisitor(this, data));
+ }
+ }
+
+ if (constructorDeclaration.ConstructorInitializer.ConstructorInitializerType == ConstructorInitializerType.This)
+ {
+ if (constructorDeclaration.ConstructorInitializer.Arguments.Count == 0)
+ {
+ memberMethod.ChainedConstructorArgs.Add(new CodeSnippetExpression());
+ }
+
+ foreach (Expression o in constructorDeclaration.ConstructorInitializer.Arguments)
+ {
+ memberMethod.ChainedConstructorArgs.Add((CodeExpression)o.AcceptVisitor(this, data));
+ }
+ }
+ }
+ codeStack.Pop();
+
+ codeStack.Push(memberMethod.Statements);
+ constructorDeclaration.Body.AcceptChildren(this, data);
+ codeStack.Pop();
+
+ return null;
+ }
+
+ public override object VisitBlockStatement(BlockStatement blockStatement, object data)
+ {
+ blockStatement.AcceptChildren(this, data);
+ return null;
+ }
+
+ public override object VisitExpressionStatement(ExpressionStatement expressionStatement, object data)
+ {
+ object exp = expressionStatement.Expression.AcceptVisitor(this, data);
+ if (exp is CodeExpression) {
+ AddStmt(new CodeExpressionStatement((CodeExpression)exp));
+ }
+ return exp;
+ }
+
+ public override object VisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data)
+ {
+ CodeVariableDeclarationStatement declStmt = null;
+
+ for (int i = 0; i < localVariableDeclaration.Variables.Count; ++i) {
+ CodeTypeReference type = ConvType(localVariableDeclaration.GetTypeForVariable(i) ?? new TypeReference("System.Object", true));
+ VariableDeclaration var = (VariableDeclaration)localVariableDeclaration.Variables[i];
+ if (!var.Initializer.IsNull) {
+ declStmt = new CodeVariableDeclarationStatement(type,
+ var.Name,
+ (CodeExpression)((INode)var.Initializer).AcceptVisitor(this, data));
+ } else {
+ declStmt = new CodeVariableDeclarationStatement(type,
+ var.Name);
+ }
+ variables.Add(declStmt);
+ AddStmt(declStmt);
+ }
+
+ return declStmt;
+ }
+
+ public override object VisitEmptyStatement(EmptyStatement emptyStatement, object data)
+ {
+ CodeSnippetStatement emptyStmt = new CodeSnippetStatement();
+
+ AddStmt(emptyStmt);
+
+ return emptyStmt;
+ }
+
+ public override object VisitReturnStatement(ReturnStatement returnStatement, object data)
+ {
+ CodeMethodReturnStatement returnStmt;
+ if (returnStatement.Expression.IsNull)
+ returnStmt = new CodeMethodReturnStatement();
+ else
+ returnStmt = new CodeMethodReturnStatement((CodeExpression)returnStatement.Expression.AcceptVisitor(this,data));
+
+ AddStmt(returnStmt);
+
+ return returnStmt;
+ }
+
+ public override object VisitIfElseStatement(IfElseStatement ifElseStatement, object data)
+ {
+ CodeConditionStatement ifStmt = new CodeConditionStatement();
+
+ ifStmt.Condition = (CodeExpression)ifElseStatement.Condition.AcceptVisitor(this, data);
+
+ codeStack.Push(ifStmt.TrueStatements);
+ foreach (Statement stmt in ifElseStatement.TrueStatement) {
+ if (stmt is BlockStatement) {
+ stmt.AcceptChildren(this, data);
+ } else {
+ stmt.AcceptVisitor(this, data);
+ }
+ }
+ codeStack.Pop();
+
+ codeStack.Push(ifStmt.FalseStatements);
+ foreach (Statement stmt in ifElseStatement.FalseStatement) {
+ if (stmt is BlockStatement) {
+ stmt.AcceptChildren(this, data);
+ } else {
+ stmt.AcceptVisitor(this, data);
+ }
+ }
+ codeStack.Pop();
+
+ AddStmt(ifStmt);
+
+ return ifStmt;
+ }
+
+ int foreachId = 0; // in case of nested foreach statments
+
+ public override object VisitForeachStatement(ForeachStatement foreachStatement, object data)
+ {
+ // RG:
+ // foreach (T t in x)
+ // {
+ // stmts;
+ // }
+ //
+ // Emulate with
+ //
+ // for (System.Collections.IEnumerator _it = x.GetEnumerator(); _it.MoveNext(); )
+ // {
+ // T t = ((T)_it.Current);
+ //
+ // stmts;
+ // }
+
+ foreachId++;
+ string name = "_it" + foreachId.ToString();
+
+ CodeIterationStatement _for1 = new CodeIterationStatement();
+ breakableStack.Push(new Breakable());
+
+ // init
+ CodeVariableDeclarationStatement _decl2 = new CodeVariableDeclarationStatement();
+ CodeMethodInvokeExpression _invoke1 = new CodeMethodInvokeExpression();
+ CodeMethodReferenceExpression _GetEnumerator_method1 = new CodeMethodReferenceExpression();
+ _GetEnumerator_method1.MethodName = "GetEnumerator";
+
+ //CodeCastExpression _cast1 = new CodeCastExpression();
+ //codeStack.Push(NullStmtCollection);
+ //_cast1.Expression = (CodeExpression)foreachStatement.Expression.AcceptVisitor(this, data);
+ //codeStack.Pop();
+ //CodeTypeReference _IEnumerable_type1 = new CodeTypeReference("System.Collections.IEnumerable");
+ //_cast1.TargetType = _IEnumerable_type1;
+
+ //_GetEnumerator_method1.TargetObject = _cast1;
+
+ codeStack.Push(NullStmtCollection);
+ _GetEnumerator_method1.TargetObject = (CodeExpression)foreachStatement.Expression.AcceptVisitor(this, data);
+ codeStack.Pop();
+
+ _invoke1.Method = _GetEnumerator_method1;
+ _decl2.InitExpression = _invoke1;
+ _decl2.Name = name;
+ CodeTypeReference _IEnumerator_type1 = new CodeTypeReference("System.Collections.IEnumerator");
+ _decl2.Type = _IEnumerator_type1;
+ _for1.InitStatement = _decl2;
+
+ // Condition
+ CodeMethodInvokeExpression _invoke2 = new CodeMethodInvokeExpression();
+ CodeMethodReferenceExpression _MoveNext_method1 = new CodeMethodReferenceExpression();
+ _MoveNext_method1.MethodName = "MoveNext";
+ CodeVariableReferenceExpression _arg2 = new CodeVariableReferenceExpression();
+ _arg2.VariableName = name;
+ _MoveNext_method1.TargetObject = _arg2;
+ _invoke2.Method = _MoveNext_method1;
+ _for1.TestExpression = _invoke2;
+
+ // Empty Increment
+ _for1.IncrementStatement = new CodeExpressionStatement(new CodeSnippetExpression());
+
+ // T t = ((T)_it.Current);
+ CodeVariableDeclarationStatement _decl3 = new CodeVariableDeclarationStatement();
+ CodeCastExpression _cast2 = new CodeCastExpression();
+ CodePropertyReferenceExpression _prop1 = new CodePropertyReferenceExpression();
+ _prop1.PropertyName = "Current";
+ CodeVariableReferenceExpression _arg3 = new CodeVariableReferenceExpression();
+ _arg3.VariableName = name;
+ _prop1.TargetObject = _arg3;
+ _cast2.Expression = _prop1;
+ CodeTypeReference _System_String_type5 = ConvType(foreachStatement.TypeReference);
+ _cast2.TargetType = _System_String_type5;
+ _decl3.InitExpression = _cast2;
+ _decl3.Name = foreachStatement.VariableName;
+ CodeTypeReference _System_String_type6 = ConvType(foreachStatement.TypeReference);
+ _decl3.Type = _System_String_type6;
+ _for1.Statements.Add(_decl3);
+ _for1.Statements.Add(new CodeSnippetStatement());
+
+ codeStack.Push(_for1.Statements);
+ foreachStatement.EmbeddedStatement.AcceptVisitor(this, data);
+ codeStack.Pop();
+
+ Breakable breakable = breakableStack.Pop();
+
+ if (breakable.IsContinue)
+ {
+ _for1.Statements.Add(new CodeSnippetStatement());
+ _for1.Statements.Add(new CodeLabeledStatement("continue" + breakable.Id, new CodeExpressionStatement(new CodeSnippetExpression())));
+ }
+
+ AddStmt(_for1);
+
+ if (breakable.IsBreak)
+ {
+ AddStmt(new CodeLabeledStatement("break" + breakable.Id, new CodeExpressionStatement(new CodeSnippetExpression())));
+ }
+
+ return _for1;
+ }
+
+ int doId = 0;
+
+ // RG:
+ public override object VisitDoLoopStatement(DoLoopStatement doLoopStatement, object data)
+ {
+ CodeIterationStatement forLoop = new CodeIterationStatement();
+ breakableStack.Push(new Breakable());
+
+ codeStack.Push(NullStmtCollection);
+
+ if (doLoopStatement.ConditionPosition == ConditionPosition.End)
+ {
+ // do { } while (expr);
+ //
+ // emulate with:
+ // for (bool _do = true; _do; _do = expr) {}
+ //
+ doId++;
+ string name = "_do" + doId;
+
+ forLoop.InitStatement = new CodeVariableDeclarationStatement(typeof(System.Boolean), name, new CodePrimitiveExpression(true));
+ forLoop.TestExpression = new CodeVariableReferenceExpression(name);
+
+ forLoop.IncrementStatement = new CodeAssignStatement(new CodeVariableReferenceExpression(name),
+ doLoopStatement.Condition == null ? new CodePrimitiveExpression(true) : (CodeExpression)doLoopStatement.Condition.AcceptVisitor(this, data));
+ }
+ else
+ {
+ // while (expr) {}
+ //
+ // emulate with:
+ // for (; expr;) {}
+ //
+
+ // Empty Init and Increment Statements
+ forLoop.InitStatement = new CodeExpressionStatement(new CodeSnippetExpression());
+ forLoop.IncrementStatement = new CodeExpressionStatement(new CodeSnippetExpression());
+
+ if (doLoopStatement.Condition == null)
+ {
+ forLoop.TestExpression = new CodePrimitiveExpression(true);
+ }
+ else
+ {
+ forLoop.TestExpression = (CodeExpression)doLoopStatement.Condition.AcceptVisitor(this, data);
+ }
+ }
+
+ codeStack.Pop();
+
+ codeStack.Push(forLoop.Statements);
+ doLoopStatement.EmbeddedStatement.AcceptVisitor(this, data);
+ codeStack.Pop();
+
+ if (forLoop.Statements.Count == 0)
+ {
+ forLoop.Statements.Add(new CodeSnippetStatement());
+ }
+
+ Breakable breakable = breakableStack.Pop();
+
+ if (breakable.IsContinue)
+ {
+ forLoop.Statements.Add(new CodeSnippetStatement());
+ forLoop.Statements.Add(new CodeLabeledStatement("continue" + breakable.Id, new CodeExpressionStatement(new CodeSnippetExpression())));
+ }
+
+ AddStmt(forLoop);
+
+ if (breakable.IsBreak)
+ {
+ AddStmt(new CodeLabeledStatement("break" + breakable.Id, new CodeExpressionStatement(new CodeSnippetExpression())));
+ }
+
+ return forLoop;
+ }
+
+ public override object VisitForStatement(ForStatement forStatement, object data)
+ {
+ CodeIterationStatement forLoop = new CodeIterationStatement();
+ breakableStack.Push(new Breakable());
+
+ codeStack.Push(NullStmtCollection);
+
+ if (forStatement.Initializers.Count > 0)
+ {
+ if (forStatement.Initializers.Count > 1)
+ {
+ throw new NotSupportedException("CodeDom does not support Multiple For-Loop Initializer Statements");
+ }
+
+ foreach (object o in forStatement.Initializers)
+ {
+ if (o is Expression)
+ {
+ forLoop.InitStatement = new CodeExpressionStatement((CodeExpression)((Expression)o).AcceptVisitor(this, data));
+ }
+ if (o is Statement)
+ {
+ forLoop.InitStatement = (CodeStatement)((Statement)o).AcceptVisitor(this, data);
+ }
+ }
+ }
+ else
+ {
+ // RG: need to handle empty InitStatement
+ forLoop.InitStatement = new CodeExpressionStatement(new CodeSnippetExpression());
+ }
+
+ if (forStatement.Condition == null) {
+ forLoop.TestExpression = new CodePrimitiveExpression(true);
+ } else {
+ forLoop.TestExpression = (CodeExpression)forStatement.Condition.AcceptVisitor(this, data);
+ }
+
+ codeStack.Push(forLoop.Statements);
+ forStatement.EmbeddedStatement.AcceptVisitor(this, data);
+ codeStack.Pop();
+
+ if (forStatement.Iterator.Count > 0)
+ {
+ if (forStatement.Initializers.Count > 1)
+ {
+ throw new NotSupportedException("CodeDom does not support Multiple For-Loop Iterator Statements");
+ }
+
+ foreach (Statement stmt in forStatement.Iterator)
+ {
+ forLoop.IncrementStatement = (CodeStatement)stmt.AcceptVisitor(this, data);
+ }
+ }
+ else
+ {
+ // RG: need to handle empty IncrementStatement
+ forLoop.IncrementStatement = new CodeExpressionStatement(new CodeSnippetExpression());
+ }
+
+ codeStack.Pop();
+
+ Breakable breakable = breakableStack.Pop();
+
+ if (breakable.IsContinue)
+ {
+ forLoop.Statements.Add(new CodeSnippetStatement());
+ forLoop.Statements.Add(new CodeLabeledStatement("continue" + breakable.Id, new CodeExpressionStatement(new CodeSnippetExpression())));
+ }
+
+ AddStmt(forLoop);
+
+ if (breakable.IsBreak)
+ {
+ AddStmt(new CodeLabeledStatement("break" + breakable.Id, new CodeExpressionStatement(new CodeSnippetExpression())));
+ }
+
+ return forLoop;
+ }
+
+ public override object VisitLabelStatement(LabelStatement labelStatement, object data)
+ {
+ System.CodeDom.CodeLabeledStatement labelStmt = new CodeLabeledStatement(labelStatement.Label);
+
+ // Add Statement to Current Statement Collection
+ AddStmt(labelStmt);
+
+ return labelStmt;
+ }
+
+ public override object VisitGotoStatement(GotoStatement gotoStatement, object data)
+ {
+ System.CodeDom.CodeGotoStatement gotoStmt = new CodeGotoStatement(gotoStatement.Label);
+
+ // Add Statement to Current Statement Collection
+ AddStmt(gotoStmt);
+
+ return gotoStmt;
+ }
+
+ // RG
+ int switchId = 0;
+
+ public override object VisitSwitchStatement(SwitchStatement switchStatement, object data)
+ {
+ // switch(arg) { case label1: expr1; case label2: expr2; default: expr3; }
+ //
+ // Emulate With:
+ //
+ // object _switch1 = arg;
+ // if (arg.Equals(label1))
+ // {
+ // expr1;
+ // }
+ // else
+ // {
+ // if (arg.Equals(label2))
+ // {
+ // expr2;
+ // }
+ // else
+ // {
+ // expr3;
+ // }
+ // }
+ //
+
+ switchId++; // in case nested switch() statements
+ string name = "_switch" + switchId.ToString();
+
+ breakableStack.Push(new Breakable(false));
+
+ bool isSwitchArg = false;
+
+ CodeVariableReferenceExpression switchArg = null;
+ SwitchSection defaultSection = null;
+
+ // get default section
+ foreach (SwitchSection section in switchStatement.SwitchSections)
+ {
+ foreach (CaseLabel label in section.SwitchLabels)
+ {
+ if (label.IsDefault)
+ {
+ defaultSection = section;
+ break;
+ }
+ }
+
+ if (defaultSection != null)
+ break;
+ }
+
+
+ CodeConditionStatement _if = null;
+
+ // get default section
+ foreach (SwitchSection section in switchStatement.SwitchSections)
+ {
+ if (section != defaultSection)
+ {
+ if (!isSwitchArg)
+ {
+ isSwitchArg = true;
+
+ codeStack.Push(NullStmtCollection);
+ CodeVariableDeclarationStatement switchStmt = new CodeVariableDeclarationStatement("System.Object", name, (CodeExpression)switchStatement.SwitchExpression.AcceptVisitor(this, data));
+ codeStack.Pop();
+
+ switchArg = new CodeVariableReferenceExpression(name);
+
+ AddStmt(switchStmt);
+ AddStmt(new CodeSnippetStatement());
+ }
+
+ codeStack.Push(NullStmtCollection);
+
+ CodeExpression condition = null;
+ foreach (CaseLabel label in section.SwitchLabels)
+ {
+ CodeMethodInvokeExpression cond = new CodeMethodInvokeExpression(switchArg, "Equals", (CodeExpression)label.Label.AcceptVisitor(this, data));
+ if (condition == null)
+ {
+ condition = cond;
+ }
+ else
+ {
+ condition = new CodeBinaryOperatorExpression(condition, CodeBinaryOperatorType.BooleanOr, cond);
+ }
+ }
+
+ codeStack.Pop();
+
+ if (_if == null)
+ {
+ _if = new CodeConditionStatement();
+ _if.Condition = condition;
+
+ AddStmt(_if);
+ }
+ else
+ {
+ CodeConditionStatement _if2 = new CodeConditionStatement();
+ _if2.Condition = condition;
+
+ _if.FalseStatements.Add(_if2);
+
+ _if = _if2;
+ }
+
+ codeStack.Push(_if.TrueStatements);
+
+ for (int i = 0; i < section.Children.Count; i++)
+ {
+ INode stmt = section.Children[i];
+
+ if (i == section.Children.Count - 1 && stmt is BreakStatement)
+ break;
+
+ stmt.AcceptVisitor(this, data);
+ }
+
+ codeStack.Pop();
+ }
+ }
+
+ if (defaultSection != null)
+ {
+ if (_if != null)
+ codeStack.Push(_if.FalseStatements);
+
+ for (int i = 0; i < defaultSection.Children.Count; i++)
+ {
+ INode stmt = defaultSection.Children[i];
+
+ if (i == defaultSection.Children.Count - 1 && stmt is BreakStatement)
+ break;
+
+ stmt.AcceptVisitor(this, data);
+ }
+
+ if (_if != null)
+ codeStack.Pop();
+ }
+
+ Breakable breakable = breakableStack.Pop();
+
+ if (breakable.IsContinue)
+ {
+ throw new Exception("Continue Inside Switch Not Supported");
+ }
+
+ if (breakable.IsBreak)
+ {
+ AddStmt(new CodeLabeledStatement("break" + breakable.Id, new CodeExpressionStatement(new CodeSnippetExpression())));
+ }
+
+ return null;
+ }
+
+ public override object VisitTryCatchStatement(TryCatchStatement tryCatchStatement, object data)
+ {
+ // add a try-catch-finally
+ CodeTryCatchFinallyStatement tryStmt = new CodeTryCatchFinallyStatement();
+
+ codeStack.Push(tryStmt.TryStatements);
+
+ tryCatchStatement.StatementBlock.AcceptChildren(this, data);
+ codeStack.Pop();
+
+ if (!tryCatchStatement.FinallyBlock.IsNull) {
+ codeStack.Push(tryStmt.FinallyStatements);
+
+ tryCatchStatement.FinallyBlock.AcceptChildren(this,data);
+ codeStack.Pop();
+ }
+
+ foreach (CatchClause clause in tryCatchStatement.CatchClauses)
+ {
+ CodeCatchClause catchClause = new CodeCatchClause(clause.VariableName);
+ catchClause.CatchExceptionType = ConvType(clause.TypeReference);
+ tryStmt.CatchClauses.Add(catchClause);
+
+ codeStack.Push(catchClause.Statements);
+
+ clause.StatementBlock.AcceptChildren(this, data);
+ codeStack.Pop();
+ }
+
+ // Add Statement to Current Statement Collection
+ AddStmt(tryStmt);
+
+ return tryStmt;
+ }
+
+ public override object VisitThrowStatement(ThrowStatement throwStatement, object data)
+ {
+ CodeThrowExceptionStatement throwStmt = new CodeThrowExceptionStatement((CodeExpression)throwStatement.Expression.AcceptVisitor(this, data));
+
+ // Add Statement to Current Statement Collection
+ AddStmt(throwStmt);
+
+ return throwStmt;
+ }
+
+ public override object VisitFixedStatement(FixedStatement fixedStatement, object data)
+ {
+ throw new NotSupportedException("CodeDom does not support Fixed Statement");
+ }
+
+ #region Expressions
+ public override object VisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data)
+ {
+ return new CodePrimitiveExpression(primitiveExpression.Value);
+ }
+
+ public override object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data)
+ {
+ CodeBinaryOperatorType op = CodeBinaryOperatorType.Add;
+ switch (binaryOperatorExpression.Op) {
+ case BinaryOperatorType.Add:
+ op = CodeBinaryOperatorType.Add;
+ break;
+ case BinaryOperatorType.BitwiseAnd:
+ op = CodeBinaryOperatorType.BitwiseAnd;
+ break;
+ case BinaryOperatorType.BitwiseOr:
+ op = CodeBinaryOperatorType.BitwiseOr;
+ break;
+ case BinaryOperatorType.LogicalAnd:
+ op = CodeBinaryOperatorType.BooleanAnd;
+ break;
+ case BinaryOperatorType.LogicalOr:
+ op = CodeBinaryOperatorType.BooleanOr;
+ break;
+ case BinaryOperatorType.Divide:
+ case BinaryOperatorType.DivideInteger:
+ op = CodeBinaryOperatorType.Divide;
+ break;
+ case BinaryOperatorType.GreaterThan:
+ op = CodeBinaryOperatorType.GreaterThan;
+ break;
+ case BinaryOperatorType.GreaterThanOrEqual:
+ op = CodeBinaryOperatorType.GreaterThanOrEqual;
+ break;
+ case BinaryOperatorType.Equality:
+ case BinaryOperatorType.InEquality:
+ op = CodeBinaryOperatorType.ValueEquality;
+ break;
+ case BinaryOperatorType.LessThan:
+ op = CodeBinaryOperatorType.LessThan;
+ break;
+ case BinaryOperatorType.LessThanOrEqual:
+ op = CodeBinaryOperatorType.LessThanOrEqual;
+ break;
+ case BinaryOperatorType.Modulus:
+ op = CodeBinaryOperatorType.Modulus;
+ break;
+ case BinaryOperatorType.Multiply:
+ op = CodeBinaryOperatorType.Multiply;
+ break;
+ case BinaryOperatorType.Subtract:
+ op = CodeBinaryOperatorType.Subtract;
+ break;
+ case BinaryOperatorType.ShiftLeft:
+ case BinaryOperatorType.ShiftRight:
+ // CodeDOM suxx
+ op = CodeBinaryOperatorType.Multiply;
+ break;
+ case BinaryOperatorType.ReferenceEquality:
+ op = CodeBinaryOperatorType.IdentityEquality;
+ break;
+ case BinaryOperatorType.ReferenceInequality:
+ op = CodeBinaryOperatorType.IdentityInequality;
+ break;
+
+ case BinaryOperatorType.ExclusiveOr:
+ // CodeDom doesn't support ExclusiveOr
+ op = CodeBinaryOperatorType.BitwiseAnd;
+ break;
+ }
+
+ System.Diagnostics.Debug.Assert(!binaryOperatorExpression.Left.IsNull);
+ System.Diagnostics.Debug.Assert(!binaryOperatorExpression.Right.IsNull);
+
+ var cboe = new CodeBinaryOperatorExpression(
+ (CodeExpression)binaryOperatorExpression.Left.AcceptVisitor(this, data),
+ op,
+ (CodeExpression)binaryOperatorExpression.Right.AcceptVisitor(this, data));
+ if (binaryOperatorExpression.Op == BinaryOperatorType.InEquality) {
+ cboe = new CodeBinaryOperatorExpression(cboe, CodeBinaryOperatorType.ValueEquality, new CodePrimitiveExpression(false));
+ }
+ return cboe;
+ }
+
+ public override object VisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression, object data)
+ {
+ return parenthesizedExpression.Expression.AcceptVisitor(this, data);
+ }
+
+ public override object VisitInvocationExpression(InvocationExpression invocationExpression, object data)
+ {
+ Expression target = invocationExpression.TargetObject;
+ CodeExpression targetExpr;
+ string methodName = null;
+ if (target == null) {
+ targetExpr = new CodeThisReferenceExpression();
+ } else if (target is MemberReferenceExpression) {
+ MemberReferenceExpression fRef = (MemberReferenceExpression)target;
+ targetExpr = null;
+ if (fRef.TargetObject is MemberReferenceExpression) {
+ if (IsPossibleTypeReference((MemberReferenceExpression)fRef.TargetObject)) {
+ targetExpr = ConvertToTypeReference((MemberReferenceExpression)fRef.TargetObject);
+ }
+ }
+ if (targetExpr == null)
+ targetExpr = (CodeExpression)fRef.TargetObject.AcceptVisitor(this, data);
+
+ methodName = fRef.MemberName;
+ // HACK for : Microsoft.VisualBasic.ChrW(NUMBER)
+ if (methodName == "ChrW") {
+ return new CodeCastExpression("System.Char", GetExpressionList(invocationExpression.Arguments)[0]);
+ }
+ } else if (target is IdentifierExpression) {
+ targetExpr = new CodeThisReferenceExpression();
+ methodName = ((IdentifierExpression)target).Identifier;
+ } else {
+ targetExpr = (CodeExpression)target.AcceptVisitor(this, data);
+ }
+ return new CodeMethodInvokeExpression(targetExpr, methodName, GetExpressionList(invocationExpression.Arguments));
+ }
+
+ public override object VisitIdentifierExpression(IdentifierExpression identifierExpression, object data)
+ {
+ if (!IsLocalVariable(identifierExpression.Identifier) && IsField(identifierExpression.Identifier)) {
+ return new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), identifierExpression.Identifier);
+ }
+ return new CodeVariableReferenceExpression(identifierExpression.Identifier);
+ }
+
+ public override object VisitUnaryOperatorExpression(UnaryOperatorExpression unaryOperatorExpression, object data)
+ {
+ CodeExpression var;
+ CodeAssignStatement assign;
+
+ switch (unaryOperatorExpression.Op) {
+ case UnaryOperatorType.Minus:
+ if (unaryOperatorExpression.Expression is PrimitiveExpression) {
+ PrimitiveExpression expression = (PrimitiveExpression)unaryOperatorExpression.Expression;
+ if (expression.Value is int) {
+ return new CodePrimitiveExpression(- (int)expression.Value);
+ }
+ if (expression.Value is System.UInt32 || expression.Value is System.UInt16) {
+ return new CodePrimitiveExpression(Int32.Parse("-" + expression.StringValue));
+ }
+
+ if (expression.Value is long) {
+ return new CodePrimitiveExpression(- (long)expression.Value);
+ }
+ if (expression.Value is double) {
+ return new CodePrimitiveExpression(- (double)expression.Value);
+ }
+ if (expression.Value is float) {
+ return new CodePrimitiveExpression(- (float)expression.Value);
+ }
+
+ }
+ return new CodeBinaryOperatorExpression(new CodePrimitiveExpression(0),
+ CodeBinaryOperatorType.Subtract,
+ (CodeExpression)unaryOperatorExpression.Expression.AcceptVisitor(this, data));
+ case UnaryOperatorType.Plus:
+ return unaryOperatorExpression.Expression.AcceptVisitor(this, data);
+
+ case UnaryOperatorType.PostIncrement:
+ // emulate i++, with i = i + 1
+ var = (CodeExpression)unaryOperatorExpression.Expression.AcceptVisitor(this, data);
+
+ assign = new CodeAssignStatement(var,
+ new CodeBinaryOperatorExpression(var,
+ CodeBinaryOperatorType.Add,
+ new CodePrimitiveExpression(1)));
+
+ AddStmt(assign);
+
+ return assign;
+
+ //return new CodeAssignStatement(var,
+ // new CodeBinaryOperatorExpression(var,
+ // CodeBinaryOperatorType.Add,
+ // new CodePrimitiveExpression(1)));
+
+ // RG: needs to return an Expression - Not a Statement
+ //return new CodeBinaryOperatorExpression(var,
+ // CodeBinaryOperatorType.Assign,
+ // new CodeBinaryOperatorExpression(var,
+ // CodeBinaryOperatorType.Add,
+ // new CodePrimitiveExpression(1)));
+
+ case UnaryOperatorType.PostDecrement:
+ // emulate i--, with i = i - 1
+ var = (CodeExpression)unaryOperatorExpression.Expression.AcceptVisitor(this, data);
+
+ assign = new CodeAssignStatement(var,
+ new CodeBinaryOperatorExpression(var,
+ CodeBinaryOperatorType.Subtract,
+ new CodePrimitiveExpression(1)));
+
+ AddStmt(assign);
+
+ return assign;
+
+ //return new CodeAssignStatement(var,
+ // new CodeBinaryOperatorExpression(var,
+ // CodeBinaryOperatorType.Subtract,
+ // new CodePrimitiveExpression(1)));
+
+ // RG: needs to return an Expression - Not a Statement
+ //return new CodeBinaryOperatorExpression(var,
+ // CodeBinaryOperatorType.Assign,
+ // new CodeBinaryOperatorExpression(var,
+ // CodeBinaryOperatorType.Subtract,
+ // new CodePrimitiveExpression(1)));
+
+ case UnaryOperatorType.Decrement:
+ // emulate --i, with i = i - 1
+ var = (CodeExpression)unaryOperatorExpression.Expression.AcceptVisitor(this, data);
+
+ assign = new CodeAssignStatement(var,
+ new CodeBinaryOperatorExpression(var,
+ CodeBinaryOperatorType.Subtract,
+ new CodePrimitiveExpression(1)));
+ AddStmt(assign);
+
+ return assign;
+ //return new CodeAssignStatement(var,
+ // new CodeBinaryOperatorExpression(var,
+ // CodeBinaryOperatorType.Subtract,
+ // new CodePrimitiveExpression(1)));
+
+ //return new CodeBinaryOperatorExpression(var,
+ // CodeBinaryOperatorType.Assign,
+ // new CodeBinaryOperatorExpression(var,
+ // CodeBinaryOperatorType.Subtract,
+ // new CodePrimitiveExpression(1)));
+
+ case UnaryOperatorType.Increment:
+ // emulate ++i, with i = i + 1
+ var = (CodeExpression)unaryOperatorExpression.Expression.AcceptVisitor(this, data);
+
+ assign = new CodeAssignStatement(var,
+ new CodeBinaryOperatorExpression(var,
+ CodeBinaryOperatorType.Add,
+ new CodePrimitiveExpression(1)));
+
+ AddStmt(assign);
+
+ return assign;
+
+ //return new CodeAssignStatement(var,
+ // new CodeBinaryOperatorExpression(var,
+ // CodeBinaryOperatorType.Add,
+ // new CodePrimitiveExpression(1)));
+
+ //return new CodeBinaryOperatorExpression(var,
+ // CodeBinaryOperatorType.Assign,
+ // new CodeBinaryOperatorExpression(var,
+ // CodeBinaryOperatorType.Add,
+ // new CodePrimitiveExpression(1)));
+
+ // RG:
+ case UnaryOperatorType.Not:
+ // emulate !a with a == false
+ var = (CodeExpression)unaryOperatorExpression.Expression.AcceptVisitor(this, data);
+
+ CodeBinaryOperatorExpression cboe = var as CodeBinaryOperatorExpression;
+ if (cboe != null && cboe.Operator == CodeBinaryOperatorType.IdentityEquality) {
+ return new CodeBinaryOperatorExpression(cboe.Left, CodeBinaryOperatorType.IdentityInequality, cboe.Right);
+ } else {
+ return new CodeBinaryOperatorExpression(var,CodeBinaryOperatorType.ValueEquality, new CodePrimitiveExpression(false));
+ }
+
+ default:
+ throw new NotSupportedException("CodeDom does not support Unary Operators");
+ }
+ }
+
+ bool methodReference = false;
+
+ void AddEventHandler(Expression eventExpr, Expression handler, object data)
+ {
+ methodReference = true;
+ CodeExpression methodInvoker = (CodeExpression)handler.AcceptVisitor(this, data);
+ methodReference = false;
+ if (!(methodInvoker is CodeObjectCreateExpression)) {
+ // we need to create an event handler here
+ methodInvoker = new CodeObjectCreateExpression(new CodeTypeReference("System.EventHandler"), methodInvoker);
+ }
+
+ if (eventExpr is IdentifierExpression) {
+ AddStmt(new CodeAttachEventStatement(new CodeEventReferenceExpression(new CodeThisReferenceExpression(), ((IdentifierExpression)eventExpr).Identifier),
+ methodInvoker));
+ } else {
+ MemberReferenceExpression fr = (MemberReferenceExpression)eventExpr;
+ AddStmt(new CodeAttachEventStatement(new CodeEventReferenceExpression((CodeExpression)fr.TargetObject.AcceptVisitor(this, data), fr.MemberName),
+ methodInvoker));
+ }
+ }
+
+ public override object VisitAssignmentExpression(AssignmentExpression assignmentExpression, object data)
+ {
+ if (assignmentExpression.Op == AssignmentOperatorType.Add) {
+ AddEventHandler(assignmentExpression.Left, assignmentExpression.Right, data);
+ } else {
+ if (assignmentExpression.Left is IdentifierExpression) {
+ AddStmt(new CodeAssignStatement((CodeExpression)assignmentExpression.Left.AcceptVisitor(this, null), (CodeExpression)assignmentExpression.Right.AcceptVisitor(this, null)));
+ } else {
+ AddStmt(new CodeAssignStatement((CodeExpression)assignmentExpression.Left.AcceptVisitor(this, null), (CodeExpression)assignmentExpression.Right.AcceptVisitor(this, null)));
+ }
+ }
+ return null;
+ }
+
+ public override object VisitAddHandlerStatement(AddHandlerStatement addHandlerStatement, object data)
+ {
+ AddEventHandler(addHandlerStatement.EventExpression, addHandlerStatement.HandlerExpression, data);
+ return null;
+ }
+
+ public override object VisitAddressOfExpression(AddressOfExpression addressOfExpression, object data)
+ {
+ return addressOfExpression.Expression.AcceptVisitor(this, data);
+ }
+
+ public override object VisitUsing(Using @using, object data)
+ {
+ return base.VisitUsing(@using, data);
+ }
+
+ // RG
+ int usingId = 0;
+
+ public override object VisitUsingStatement(UsingStatement usingStatement, object data)
+ {
+ // using (new expr) { stmts; }
+ //
+ // emulate with
+ // object _dispose;
+ // try
+ // {
+ // _dispose = new expr;
+ //
+ // stmts;
+ // }
+ // finally
+ // {
+ // if (((_dispose != null)
+ // && (typeof(System.IDisposable).IsInstanceOfType(_dispose) == true)))
+ // {
+ // ((System.IDisposable)(_dispose)).Dispose();
+ // }
+ // }
+ //
+
+ usingId++; // in case nested using() statements
+ string name = "_dispose" + usingId.ToString();
+
+ CodeVariableDeclarationStatement disposable = new CodeVariableDeclarationStatement("System.Object", name, new CodePrimitiveExpression(null));
+
+ AddStmt(disposable);
+
+ CodeTryCatchFinallyStatement tryStmt = new CodeTryCatchFinallyStatement();
+
+ CodeVariableReferenceExpression left1 = new CodeVariableReferenceExpression(name);
+
+ codeStack.Push(NullStmtCollection); // send statements to nul Statement collection
+ CodeExpression right1 = (CodeExpression)usingStatement.ResourceAcquisition.AcceptVisitor(this, data);
+ codeStack.Pop();
+
+ CodeAssignStatement assign1 = new CodeAssignStatement(left1, right1);
+
+ tryStmt.TryStatements.Add(assign1);
+ tryStmt.TryStatements.Add(new CodeSnippetStatement());
+
+ codeStack.Push(tryStmt.TryStatements);
+ usingStatement.EmbeddedStatement.AcceptChildren(this, data);
+ codeStack.Pop();
+
+ CodeMethodInvokeExpression isInstanceOfType = new CodeMethodInvokeExpression(new CodeTypeOfExpression(typeof(IDisposable)), "IsInstanceOfType", new CodeExpression[] { left1 });
+
+ CodeConditionStatement if1 = new CodeConditionStatement();
+ if1.Condition = new CodeBinaryOperatorExpression(new CodeBinaryOperatorExpression(left1, CodeBinaryOperatorType.IdentityInequality, new CodePrimitiveExpression(null)),
+ CodeBinaryOperatorType.BooleanAnd,
+ new CodeBinaryOperatorExpression(isInstanceOfType, CodeBinaryOperatorType.IdentityEquality, new CodePrimitiveExpression(true)));
+ if1.TrueStatements.Add(new CodeMethodInvokeExpression(new CodeCastExpression(typeof(IDisposable),left1), "Dispose", new CodeExpression[] { }));
+
+ tryStmt.FinallyStatements.Add(if1);
+
+ // Add Statement to Current Statement Collection
+ AddStmt(tryStmt);
+
+ return null;
+ }
+
+ public override object VisitTypeOfExpression(TypeOfExpression typeOfExpression, object data)
+ {
+ return new CodeTypeOfExpression(ConvType(typeOfExpression.TypeReference));
+ }
+
+ public override object VisitCastExpression(CastExpression castExpression, object data)
+ {
+ CodeTypeReference typeRef = ConvType(castExpression.CastTo);
+ return new CodeCastExpression(typeRef, (CodeExpression)castExpression.Expression.AcceptVisitor(this, data));
+ }
+
+ public override object VisitIndexerExpression(IndexerExpression indexerExpression, object data)
+ {
+ return new CodeIndexerExpression((CodeExpression)indexerExpression.TargetObject.AcceptVisitor(this, data), GetExpressionList(indexerExpression.Indexes));
+ }
+
+ public override object VisitThisReferenceExpression(ThisReferenceExpression thisReferenceExpression, object data)
+ {
+ return new CodeThisReferenceExpression();
+ }
+
+ public override object VisitBaseReferenceExpression(BaseReferenceExpression baseReferenceExpression, object data)
+ {
+ return new CodeBaseReferenceExpression();
+ }
+
+ public override object VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object data)
+ {
+ if (arrayCreateExpression.ArrayInitializer.IsNull) {
+ return new CodeArrayCreateExpression(ConvType(arrayCreateExpression.CreateType),
+ arrayCreateExpression.Arguments[0].AcceptVisitor(this, data) as CodeExpression);
+ }
+ return new CodeArrayCreateExpression(ConvType(arrayCreateExpression.CreateType),
+ GetExpressionList(arrayCreateExpression.ArrayInitializer.CreateExpressions));
+ }
+
+ public override object VisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression, object data)
+ {
+ return new CodeObjectCreateExpression(ConvType(objectCreateExpression.CreateType),
+ objectCreateExpression.Parameters == null ? null : GetExpressionList(objectCreateExpression.Parameters));
+ }
+
+ public override object VisitParameterDeclarationExpression(ParameterDeclarationExpression parameterDeclarationExpression, object data)
+ {
+ CodeParameterDeclarationExpression parameter = new CodeParameterDeclarationExpression(ConvType(parameterDeclarationExpression.TypeReference), parameterDeclarationExpression.ParameterName);
+
+ parameters.Add(parameter);
+
+ return parameter;
+ }
+
+ public override object VisitBreakStatement(BreakStatement breakStatement, object data)
+ {
+ // RG:
+ // break;
+ //
+ // emulate with:
+ // goto break1;
+ //
+ Breakable breakable = breakableStack.Peek();
+
+ breakable.IsBreak = true;
+
+ CodeGotoStatement breakStmt = new CodeGotoStatement("break" + breakable.Id);
+
+ AddStmt(breakStmt);
+
+ return breakStmt;
+ }
+
+ public override object VisitContinueStatement(ContinueStatement continueStatement, object data)
+ {
+ // RG:
+ // continue;
+ //
+ // emulate with:
+ // goto continue1;
+ //
+ Breakable breakable = breakableStack.Peek();
+
+ // Is continuable?
+ if (!breakable.AllowContinue)
+ {
+ // walk stack to find first continuable item
+ Breakable[] stack = breakableStack.ToArray();
+ foreach (Breakable b in stack)
+ {
+ if (b.AllowContinue)
+ {
+ breakable = b;
+ break;
+ }
+ }
+ }
+
+ breakable.IsContinue = true;
+
+ CodeGotoStatement continueStmt = new CodeGotoStatement("continue" + breakable.Id);
+
+ AddStmt(continueStmt);
+
+ return continueStmt;
+ }
+
+ bool IsField(string type, int typeParameterCount, string fieldName)
+ {
+ bool isField = environmentInformationProvider.HasField(type, typeParameterCount, fieldName);
+
+ if (!isField) {
+ int idx = type.LastIndexOf('.');
+ if (idx >= 0) {
+ type = type.Substring(0, idx) + "+" + type.Substring(idx + 1);
+ isField = IsField(type, typeParameterCount, fieldName);
+ }
+ }
+
+ return isField;
+ }
+
+ bool IsFieldReferenceExpression(MemberReferenceExpression fieldReferenceExpression)
+ {
+ if (fieldReferenceExpression.TargetObject is ThisReferenceExpression
+ || fieldReferenceExpression.TargetObject is BaseReferenceExpression)
+ {
+ //field detection for fields\props inherited from base classes
+ return IsField(fieldReferenceExpression.MemberName);
+ }
+ return false;
+ }
+
+ public override object VisitMemberReferenceExpression(MemberReferenceExpression fieldReferenceExpression, object data)
+ {
+ if (methodReference) {
+ methodReference = false;
+ return new CodeMethodReferenceExpression((CodeExpression)fieldReferenceExpression.TargetObject.AcceptVisitor(this, data), fieldReferenceExpression.MemberName);
+ }
+ if (IsFieldReferenceExpression(fieldReferenceExpression)) {
+ return new CodeFieldReferenceExpression((CodeExpression)fieldReferenceExpression.TargetObject.AcceptVisitor(this, data),
+ fieldReferenceExpression.MemberName);
+ } else {
+ if (fieldReferenceExpression.TargetObject is MemberReferenceExpression) {
+ if (IsPossibleTypeReference((MemberReferenceExpression)fieldReferenceExpression.TargetObject)) {
+ CodeTypeReferenceExpression typeRef = ConvertToTypeReference((MemberReferenceExpression)fieldReferenceExpression.TargetObject);
+ if (IsField(typeRef.Type.BaseType, typeRef.Type.TypeArguments.Count, fieldReferenceExpression.MemberName)) {
+ return new CodeFieldReferenceExpression(typeRef,
+ fieldReferenceExpression.MemberName);
+ } else {
+ return new CodePropertyReferenceExpression(typeRef,
+ fieldReferenceExpression.MemberName);
+ }
+ }
+ }
+
+ CodeExpression codeExpression = (CodeExpression)fieldReferenceExpression.TargetObject.AcceptVisitor(this, data);
+ return new CodePropertyReferenceExpression(codeExpression,
+ fieldReferenceExpression.MemberName);
+ }
+ }
+
+ #endregion
+
+ #endregion
+ bool IsPossibleTypeReference(MemberReferenceExpression fieldReferenceExpression)
+ {
+ while (fieldReferenceExpression.TargetObject is MemberReferenceExpression) {
+ fieldReferenceExpression = (MemberReferenceExpression)fieldReferenceExpression.TargetObject;
+ }
+ IdentifierExpression identifier = fieldReferenceExpression.TargetObject as IdentifierExpression;
+ if (identifier != null)
+ return !IsField(identifier.Identifier) && !IsLocalVariable(identifier.Identifier);
+ TypeReferenceExpression tre = fieldReferenceExpression.TargetObject as TypeReferenceExpression;
+ if (tre != null)
+ return true;
+ return false;
+ }
+
+ bool IsLocalVariable(string identifier)
+ {
+ foreach (CodeVariableDeclarationStatement variable in variables) {
+ if (variable.Name == identifier)
+ return true;
+ }
+
+ foreach (CodeParameterDeclarationExpression parameter in parameters)
+ {
+ if (parameter.Name == identifier)
+ return true;
+ }
+
+ return false;
+ }
+
+ bool IsField(string identifier)
+ {
+ if (currentTypeDeclaration == null) // e.g. in unit tests
+ return false;
+ foreach (INode node in currentTypeDeclaration.Children) {
+ if (node is FieldDeclaration) {
+ FieldDeclaration fd = (FieldDeclaration)node;
+ if (fd.GetVariableDeclaration(identifier) != null) {
+ return true;
+ }
+ }
+ }
+ //field detection for fields\props inherited from base classes
+ if (currentTypeDeclaration.BaseTypes.Count > 0) {
+ return IsField(currentTypeDeclaration.BaseTypes[0].Type, currentTypeDeclaration.BaseTypes[0].GenericTypes.Count, identifier);
+ }
+ return false;
+ }
+
+ static CodeTypeReferenceExpression ConvertToTypeReference(MemberReferenceExpression fieldReferenceExpression)
+ {
+ StringBuilder type = new StringBuilder("");
+
+ while (fieldReferenceExpression.TargetObject is MemberReferenceExpression) {
+ type.Insert(0,'.');
+ type.Insert(1,fieldReferenceExpression.MemberName.ToCharArray());
+ fieldReferenceExpression = (MemberReferenceExpression)fieldReferenceExpression.TargetObject;
+ }
+
+ type.Insert(0,'.');
+ type.Insert(1,fieldReferenceExpression.MemberName.ToCharArray());
+
+ if (fieldReferenceExpression.TargetObject is IdentifierExpression) {
+ type.Insert(0, ((IdentifierExpression)fieldReferenceExpression.TargetObject).Identifier.ToCharArray());
+ string oldType = type.ToString();
+ int idx = oldType.LastIndexOf('.');
+ while (idx > 0) {
+ if (Type.GetType(type.ToString()) != null) {
+ break;
+ }
+ string stype = type.ToString().Substring(idx + 1);
+ type = new StringBuilder(type.ToString().Substring(0, idx));
+ type.Append("+");
+ type.Append(stype);
+ idx = type.ToString().LastIndexOf('.');
+ }
+ if (Type.GetType(type.ToString()) == null) {
+ type = new StringBuilder(oldType);
+ }
+ return new CodeTypeReferenceExpression(type.ToString());
+ } else if (fieldReferenceExpression.TargetObject is TypeReferenceExpression) {
+ type.Insert(0, ((TypeReferenceExpression)fieldReferenceExpression.TargetObject).TypeReference.Type);
+ return new CodeTypeReferenceExpression(type.ToString());
+ } else {
+ return null;
+ }
+ }
+
+ CodeExpression[] GetExpressionList(IList expressionList)
+ {
+ if (expressionList == null) {
+ return new CodeExpression[0];
+ }
+ CodeExpression[] list = new CodeExpression[expressionList.Count];
+ for (int i = 0; i < expressionList.Count; ++i) {
+ list[i] = (CodeExpression)((Expression)expressionList[i]).AcceptVisitor(this, null);
+ if (list[i] == null) {
+ list[i] = new CodePrimitiveExpression(0);
+ }
+ }
+ return list;
+ }
+
+
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Visitors/CodeDOMVerboseOutputGenerator.cs b/main/contrib/NRefactory/Project/Src/Visitors/CodeDOMVerboseOutputGenerator.cs
index abd6f2b280..f902aa88a3 100644
--- a/main/contrib/NRefactory/Project/Src/Visitors/CodeDOMVerboseOutputGenerator.cs
+++ b/main/contrib/NRefactory/Project/Src/Visitors/CodeDOMVerboseOutputGenerator.cs
@@ -1,360 +1,360 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 2661 $</version>
-// </file>
-
-using System;
-using System.CodeDom;
-using System.CodeDom.Compiler;
-using System.IO;
-using System.Security.Permissions;
-
-namespace ICSharpCode.NRefactory.Visitors
-{
- [PermissionSet(SecurityAction.InheritanceDemand, Name = "FullTrust")]
- [PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")]
- public class CodeDomVerboseOutputGenerator : System.CodeDom.Compiler.CodeGenerator
- {
- #region System.CodeDom.Compiler.CodeGenerator abstract class implementation
- protected override string NullToken {
- get {
- return "[NULL]";
- }
- }
-
- protected override void OutputType(CodeTypeReference typeRef)
- {
- Output.Write("[CodeTypeReference: {0}", typeRef.BaseType);
- if (typeRef.ArrayRank > 0) {
- Output.Write(" Rank:" + typeRef.ArrayRank);
- }
- Output.Write("]");
- }
-
- protected override void GenerateArrayCreateExpression(CodeArrayCreateExpression e)
- {
- Output.Write("[CodeArrayCreateExpression: {0}]", e.ToString());
- }
-
- protected override void GenerateBaseReferenceExpression(CodeBaseReferenceExpression e)
- {
- Output.Write("[CodeBaseReferenceExpression: {0}]", e.ToString());
- }
-
- protected override void GenerateCastExpression(CodeCastExpression e)
- {
- Output.Write("[CodeCastExpression: {0}]", e.ToString());
- }
-
- protected override void GenerateDelegateCreateExpression(CodeDelegateCreateExpression e)
- {
- Output.Write("[CodeDelegateCreateExpression: {0}]", e.ToString());
- }
-
- protected override void GenerateFieldReferenceExpression(CodeFieldReferenceExpression e)
- {
- Output.Write("[CodeFieldReferenceExpression: Name={0}, Target=", e.FieldName);
- this.GenerateExpression(e.TargetObject);
- Output.Write("]");
- }
-
- protected override void GenerateMethodReferenceExpression(CodeMethodReferenceExpression e)
- {
- Output.Write("[CodeMethodReferenceExpression: Name={0}, Target=", e.MethodName);
- this.GenerateExpression(e.TargetObject);
- Output.Write("]");
- }
-
- protected override void GenerateEventReferenceExpression(CodeEventReferenceExpression e)
- {
- Output.Write("[CodeEventReferenceExpression: Name={0}, Target=", e.EventName);
- this.GenerateExpression(e.TargetObject);
- Output.Write("]");
- }
-
- protected override void GenerateArgumentReferenceExpression(CodeArgumentReferenceExpression e)
- {
- Output.Write("[CodeArgumentReferenceExpression: {0}]", e.ToString());
- }
-
- protected override void GenerateVariableReferenceExpression(CodeVariableReferenceExpression e)
- {
- Output.Write("[CodeVariableReferenceExpression: Name={0}]", e.VariableName);
- }
-
- protected override void GenerateIndexerExpression(CodeIndexerExpression e)
- {
- Output.Write("[CodeIndexerExpression: {0}]", e.ToString());
- }
-
- protected override void GenerateArrayIndexerExpression(CodeArrayIndexerExpression e)
- {
- Output.Write("[CodeArrayIndexerExpression: {0}]", e.ToString());
- }
-
- protected override void GenerateSnippetExpression(CodeSnippetExpression e)
- {
- Output.Write("[CodeSnippetExpression: {0}]", e.ToString());
- }
-
- protected override void GenerateMethodInvokeExpression(CodeMethodInvokeExpression e)
- {
- Output.Write("[CodeMethodInvokeExpression: Method=");
- GenerateMethodReferenceExpression(e.Method);
- Output.Write(", Parameters=");
- bool first = true;
- foreach (CodeExpression expr in e.Parameters) {
- if (first) first = false; else Output.Write(", ");
- this.GenerateExpression(expr);
- }
- Output.Write("]");
- }
-
- protected override void GenerateDelegateInvokeExpression(CodeDelegateInvokeExpression e)
- {
- Output.Write("[CodeDelegateInvokeExpression: {0}]", e.ToString());
- }
-
- protected override void GenerateObjectCreateExpression(CodeObjectCreateExpression e)
- {
- Output.Write("[CodeObjectCreateExpression: Type={0}, Parameters=", e.CreateType.BaseType);
- bool first = true;
- foreach (CodeExpression expr in e.Parameters) {
- if (first) first = false; else Output.Write(", ");
- this.GenerateExpression(expr);
- }
- Output.Write("]");
- }
-
- protected override void GeneratePropertyReferenceExpression(CodePropertyReferenceExpression e)
- {
- Output.Write("[CodePropertyReferenceExpression: Name={0}, Target=", e.PropertyName);
- this.GenerateExpression(e.TargetObject);
- Output.Write("]");
- }
-
- protected override void GeneratePropertySetValueReferenceExpression(CodePropertySetValueReferenceExpression e)
- {
- Output.Write("[CodePropertySetValueReferenceExpression: {0}]", e.ToString());
- }
-
- protected override void GenerateThisReferenceExpression(CodeThisReferenceExpression e)
- {
- Output.Write("[CodeThisReferenceExpression]");
- }
-
- protected override void GenerateExpressionStatement(CodeExpressionStatement e)
- {
- Output.Write("[CodeExpressionStatement:");
- base.GenerateExpression(e.Expression);
- Output.WriteLine("]");
- }
-
- protected override void GenerateIterationStatement(CodeIterationStatement e)
- {
- Output.WriteLine("[CodeIterationStatement: {0}]", e.ToString());
- }
-
- protected override void GenerateThrowExceptionStatement(CodeThrowExceptionStatement e)
- {
- Output.WriteLine("[CodeThrowExceptionStatement: {0}]", e.ToString());
- }
-
- protected override void GenerateComment(CodeComment e)
- {
- Output.WriteLine("[CodeComment: {0}]", e.ToString());
- }
-
- protected override void GenerateMethodReturnStatement(CodeMethodReturnStatement e)
- {
- Output.WriteLine("[CodeMethodReturnStatement: {0}]", e.ToString());
- }
-
- protected override void GenerateConditionStatement(CodeConditionStatement e)
- {
- Output.WriteLine("[GenerateConditionStatement: {0}]", e.ToString());
- }
-
- protected override void GenerateTryCatchFinallyStatement(CodeTryCatchFinallyStatement e)
- {
- Output.WriteLine("[CodeTryCatchFinallyStatement: {0}]", e.ToString());
- }
-
- protected override void GenerateAssignStatement(CodeAssignStatement e)
- {
- Output.Write("[CodeAssignStatement: Left=");
- base.GenerateExpression(e.Left);
- Output.Write(", Right=");
- base.GenerateExpression(e.Right);
- Output.WriteLine("]");
- }
-
- protected override void GenerateAttachEventStatement(CodeAttachEventStatement e)
- {
- Output.WriteLine("[CodeAttachEventStatement: {0}]", e.ToString());
- }
-
- protected override void GenerateRemoveEventStatement(CodeRemoveEventStatement e)
- {
- Output.WriteLine("[CodeRemoveEventStatement: {0}]", e.ToString());
- }
-
- protected override void GenerateGotoStatement(CodeGotoStatement e)
- {
- Output.WriteLine("[CodeGotoStatement: {0}]", e.ToString());
- }
-
- protected override void GenerateLabeledStatement(CodeLabeledStatement e)
- {
- Output.WriteLine("[CodeLabeledStatement: {0}]", e.ToString());
- }
-
- protected override void GenerateVariableDeclarationStatement(CodeVariableDeclarationStatement e)
- {
- Output.WriteLine("[CodeVariableDeclarationStatement: {0}]", e.ToString());
- }
-
- protected override void GenerateLinePragmaStart(CodeLinePragma e)
- {
- Output.WriteLine("[CodeLinePragma: {0}]", e.ToString());
- }
-
- protected override void GenerateLinePragmaEnd(CodeLinePragma e)
- {
- Output.WriteLine("[CodeLinePragma: {0}]", e.ToString());
- }
-
- protected override void GenerateEvent(CodeMemberEvent e, CodeTypeDeclaration c)
- {
- Output.WriteLine("[CodeMemberEvent: {0}]", e.ToString());
- }
-
- protected override void GenerateField(CodeMemberField e)
- {
- Output.Write("[CodeMemberField: Name={0}, Type=", e.Name);
- Output.Write(e.Type.BaseType);
- Output.WriteLine("]");
- }
-
- protected override void GenerateSnippetMember(CodeSnippetTypeMember e)
- {
- Output.WriteLine("[CodeSnippetTypeMember: {0}]", e.ToString());
- }
-
- protected override void GenerateEntryPointMethod(CodeEntryPointMethod e, CodeTypeDeclaration c)
- {
- Output.WriteLine("[CodeEntryPointMethod: {0}]", e.ToString());
- }
-
- public void PublicGenerateCodeFromStatement(CodeStatement e, TextWriter w, CodeGeneratorOptions o)
- {
- ((ICodeGenerator)this).GenerateCodeFromStatement(e, w, o);
- }
-
- protected override void GenerateMethod(CodeMemberMethod e, CodeTypeDeclaration c)
- {
- Output.WriteLine("[CodeMemberMethod: Name={0}, Parameterns={1}]", e.Name, e.Parameters.Count);
- ++Indent;
- GenerateStatements(e.Statements);
- --Indent;
- }
-
- protected override void GenerateProperty(CodeMemberProperty e, CodeTypeDeclaration c)
- {
- Output.WriteLine("[CodeMemberProperty : {0}]", e.ToString());
- }
-
- protected override void GenerateConstructor(CodeConstructor e, CodeTypeDeclaration c)
- {
- Output.WriteLine("[CodeConstructor : {0}]", e.ToString());
- ++Indent;
- GenerateStatements(e.Statements);
- --Indent;
- }
-
- protected override void GenerateTypeConstructor(CodeTypeConstructor e)
- {
- Output.WriteLine("[CodeTypeConstructor : {0}]", e.ToString());
- }
-
- protected override void GenerateTypeStart(CodeTypeDeclaration e)
- {
- Output.WriteLine("[CodeTypeDeclaration : {0}]", e.ToString());
- }
-
- protected override void GenerateTypeEnd(CodeTypeDeclaration e)
- {
- Output.WriteLine("[CodeTypeDeclaration: {0}]", e.ToString());
- }
-
- protected override void GenerateNamespaceStart(CodeNamespace e)
- {
- Output.WriteLine("[CodeNamespaceStart: {0}]", e.ToString());
- }
-
- protected override void GenerateNamespaceEnd(CodeNamespace e)
- {
- Output.WriteLine("[CodeNamespaceEnd: {0}]", e.ToString());
- }
-
- protected override void GenerateNamespaceImport(CodeNamespaceImport e)
- {
- Output.WriteLine("[CodeNamespaceImport: {0}]", e.ToString());
- }
-
- protected override void GenerateAttributeDeclarationsStart(CodeAttributeDeclarationCollection attributes)
- {
- Output.WriteLine("[CodeAttributeDeclarationCollection: {0}]", attributes.ToString());
- }
-
- protected override void GenerateAttributeDeclarationsEnd(CodeAttributeDeclarationCollection attributes)
- {
- Output.WriteLine("[CodeAttributeDeclarationCollection: {0}]", attributes.ToString());
- }
-
- protected override void GeneratePrimitiveExpression(CodePrimitiveExpression e)
- {
- if (e.Value == null) {
- Output.WriteLine("[CodePrimitiveExpression: null]");
- } else {
- Output.Write("[CodePrimitiveExpression: ");
- base.GeneratePrimitiveExpression(e);
- Output.WriteLine(" (" + e.Value.GetType().Name + ")]");
- }
- }
-
- protected override bool Supports(GeneratorSupport support)
- {
- return true;
- }
-
- protected override bool IsValidIdentifier(string value)
- {
- return true;
- }
-
- protected override string CreateEscapedIdentifier(string value)
- {
- return value;
- }
-
- protected override string CreateValidIdentifier(string value)
- {
- return value;
- }
-
- protected override string GetTypeOutput(CodeTypeReference value)
- {
- return value.ToString();
- }
-
- protected override string QuoteSnippetString(string value)
- {
- return "\"" + value + "\"";
- }
-
- #endregion
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+using System.CodeDom;
+using System.CodeDom.Compiler;
+using System.IO;
+using System.Security.Permissions;
+
+namespace ICSharpCode.NRefactory.Visitors
+{
+ [PermissionSet(SecurityAction.InheritanceDemand, Name = "FullTrust")]
+ [PermissionSet(SecurityAction.LinkDemand, Name = "FullTrust")]
+ public class CodeDomVerboseOutputGenerator : System.CodeDom.Compiler.CodeGenerator
+ {
+ #region System.CodeDom.Compiler.CodeGenerator abstract class implementation
+ protected override string NullToken {
+ get {
+ return "[NULL]";
+ }
+ }
+
+ protected override void OutputType(CodeTypeReference typeRef)
+ {
+ Output.Write("[CodeTypeReference: {0}", typeRef.BaseType);
+ if (typeRef.ArrayRank > 0) {
+ Output.Write(" Rank:" + typeRef.ArrayRank);
+ }
+ Output.Write("]");
+ }
+
+ protected override void GenerateArrayCreateExpression(CodeArrayCreateExpression e)
+ {
+ Output.Write("[CodeArrayCreateExpression: {0}]", e.ToString());
+ }
+
+ protected override void GenerateBaseReferenceExpression(CodeBaseReferenceExpression e)
+ {
+ Output.Write("[CodeBaseReferenceExpression: {0}]", e.ToString());
+ }
+
+ protected override void GenerateCastExpression(CodeCastExpression e)
+ {
+ Output.Write("[CodeCastExpression: {0}]", e.ToString());
+ }
+
+ protected override void GenerateDelegateCreateExpression(CodeDelegateCreateExpression e)
+ {
+ Output.Write("[CodeDelegateCreateExpression: {0}]", e.ToString());
+ }
+
+ protected override void GenerateFieldReferenceExpression(CodeFieldReferenceExpression e)
+ {
+ Output.Write("[CodeFieldReferenceExpression: Name={0}, Target=", e.FieldName);
+ this.GenerateExpression(e.TargetObject);
+ Output.Write("]");
+ }
+
+ protected override void GenerateMethodReferenceExpression(CodeMethodReferenceExpression e)
+ {
+ Output.Write("[CodeMethodReferenceExpression: Name={0}, Target=", e.MethodName);
+ this.GenerateExpression(e.TargetObject);
+ Output.Write("]");
+ }
+
+ protected override void GenerateEventReferenceExpression(CodeEventReferenceExpression e)
+ {
+ Output.Write("[CodeEventReferenceExpression: Name={0}, Target=", e.EventName);
+ this.GenerateExpression(e.TargetObject);
+ Output.Write("]");
+ }
+
+ protected override void GenerateArgumentReferenceExpression(CodeArgumentReferenceExpression e)
+ {
+ Output.Write("[CodeArgumentReferenceExpression: {0}]", e.ToString());
+ }
+
+ protected override void GenerateVariableReferenceExpression(CodeVariableReferenceExpression e)
+ {
+ Output.Write("[CodeVariableReferenceExpression: Name={0}]", e.VariableName);
+ }
+
+ protected override void GenerateIndexerExpression(CodeIndexerExpression e)
+ {
+ Output.Write("[CodeIndexerExpression: {0}]", e.ToString());
+ }
+
+ protected override void GenerateArrayIndexerExpression(CodeArrayIndexerExpression e)
+ {
+ Output.Write("[CodeArrayIndexerExpression: {0}]", e.ToString());
+ }
+
+ protected override void GenerateSnippetExpression(CodeSnippetExpression e)
+ {
+ Output.Write("[CodeSnippetExpression: {0}]", e.ToString());
+ }
+
+ protected override void GenerateMethodInvokeExpression(CodeMethodInvokeExpression e)
+ {
+ Output.Write("[CodeMethodInvokeExpression: Method=");
+ GenerateMethodReferenceExpression(e.Method);
+ Output.Write(", Parameters=");
+ bool first = true;
+ foreach (CodeExpression expr in e.Parameters) {
+ if (first) first = false; else Output.Write(", ");
+ this.GenerateExpression(expr);
+ }
+ Output.Write("]");
+ }
+
+ protected override void GenerateDelegateInvokeExpression(CodeDelegateInvokeExpression e)
+ {
+ Output.Write("[CodeDelegateInvokeExpression: {0}]", e.ToString());
+ }
+
+ protected override void GenerateObjectCreateExpression(CodeObjectCreateExpression e)
+ {
+ Output.Write("[CodeObjectCreateExpression: Type={0}, Parameters=", e.CreateType.BaseType);
+ bool first = true;
+ foreach (CodeExpression expr in e.Parameters) {
+ if (first) first = false; else Output.Write(", ");
+ this.GenerateExpression(expr);
+ }
+ Output.Write("]");
+ }
+
+ protected override void GeneratePropertyReferenceExpression(CodePropertyReferenceExpression e)
+ {
+ Output.Write("[CodePropertyReferenceExpression: Name={0}, Target=", e.PropertyName);
+ this.GenerateExpression(e.TargetObject);
+ Output.Write("]");
+ }
+
+ protected override void GeneratePropertySetValueReferenceExpression(CodePropertySetValueReferenceExpression e)
+ {
+ Output.Write("[CodePropertySetValueReferenceExpression: {0}]", e.ToString());
+ }
+
+ protected override void GenerateThisReferenceExpression(CodeThisReferenceExpression e)
+ {
+ Output.Write("[CodeThisReferenceExpression]");
+ }
+
+ protected override void GenerateExpressionStatement(CodeExpressionStatement e)
+ {
+ Output.Write("[CodeExpressionStatement:");
+ base.GenerateExpression(e.Expression);
+ Output.WriteLine("]");
+ }
+
+ protected override void GenerateIterationStatement(CodeIterationStatement e)
+ {
+ Output.WriteLine("[CodeIterationStatement: {0}]", e.ToString());
+ }
+
+ protected override void GenerateThrowExceptionStatement(CodeThrowExceptionStatement e)
+ {
+ Output.WriteLine("[CodeThrowExceptionStatement: {0}]", e.ToString());
+ }
+
+ protected override void GenerateComment(CodeComment e)
+ {
+ Output.WriteLine("[CodeComment: {0}]", e.ToString());
+ }
+
+ protected override void GenerateMethodReturnStatement(CodeMethodReturnStatement e)
+ {
+ Output.WriteLine("[CodeMethodReturnStatement: {0}]", e.ToString());
+ }
+
+ protected override void GenerateConditionStatement(CodeConditionStatement e)
+ {
+ Output.WriteLine("[GenerateConditionStatement: {0}]", e.ToString());
+ }
+
+ protected override void GenerateTryCatchFinallyStatement(CodeTryCatchFinallyStatement e)
+ {
+ Output.WriteLine("[CodeTryCatchFinallyStatement: {0}]", e.ToString());
+ }
+
+ protected override void GenerateAssignStatement(CodeAssignStatement e)
+ {
+ Output.Write("[CodeAssignStatement: Left=");
+ base.GenerateExpression(e.Left);
+ Output.Write(", Right=");
+ base.GenerateExpression(e.Right);
+ Output.WriteLine("]");
+ }
+
+ protected override void GenerateAttachEventStatement(CodeAttachEventStatement e)
+ {
+ Output.WriteLine("[CodeAttachEventStatement: {0}]", e.ToString());
+ }
+
+ protected override void GenerateRemoveEventStatement(CodeRemoveEventStatement e)
+ {
+ Output.WriteLine("[CodeRemoveEventStatement: {0}]", e.ToString());
+ }
+
+ protected override void GenerateGotoStatement(CodeGotoStatement e)
+ {
+ Output.WriteLine("[CodeGotoStatement: {0}]", e.ToString());
+ }
+
+ protected override void GenerateLabeledStatement(CodeLabeledStatement e)
+ {
+ Output.WriteLine("[CodeLabeledStatement: {0}]", e.ToString());
+ }
+
+ protected override void GenerateVariableDeclarationStatement(CodeVariableDeclarationStatement e)
+ {
+ Output.WriteLine("[CodeVariableDeclarationStatement: {0}]", e.ToString());
+ }
+
+ protected override void GenerateLinePragmaStart(CodeLinePragma e)
+ {
+ Output.WriteLine("[CodeLinePragma: {0}]", e.ToString());
+ }
+
+ protected override void GenerateLinePragmaEnd(CodeLinePragma e)
+ {
+ Output.WriteLine("[CodeLinePragma: {0}]", e.ToString());
+ }
+
+ protected override void GenerateEvent(CodeMemberEvent e, CodeTypeDeclaration c)
+ {
+ Output.WriteLine("[CodeMemberEvent: {0}]", e.ToString());
+ }
+
+ protected override void GenerateField(CodeMemberField e)
+ {
+ Output.Write("[CodeMemberField: Name={0}, Type=", e.Name);
+ Output.Write(e.Type.BaseType);
+ Output.WriteLine("]");
+ }
+
+ protected override void GenerateSnippetMember(CodeSnippetTypeMember e)
+ {
+ Output.WriteLine("[CodeSnippetTypeMember: {0}]", e.ToString());
+ }
+
+ protected override void GenerateEntryPointMethod(CodeEntryPointMethod e, CodeTypeDeclaration c)
+ {
+ Output.WriteLine("[CodeEntryPointMethod: {0}]", e.ToString());
+ }
+
+ public void PublicGenerateCodeFromStatement(CodeStatement e, TextWriter w, CodeGeneratorOptions o)
+ {
+ ((ICodeGenerator)this).GenerateCodeFromStatement(e, w, o);
+ }
+
+ protected override void GenerateMethod(CodeMemberMethod e, CodeTypeDeclaration c)
+ {
+ Output.WriteLine("[CodeMemberMethod: Name={0}, Parameterns={1}]", e.Name, e.Parameters.Count);
+ ++Indent;
+ GenerateStatements(e.Statements);
+ --Indent;
+ }
+
+ protected override void GenerateProperty(CodeMemberProperty e, CodeTypeDeclaration c)
+ {
+ Output.WriteLine("[CodeMemberProperty : {0}]", e.ToString());
+ }
+
+ protected override void GenerateConstructor(CodeConstructor e, CodeTypeDeclaration c)
+ {
+ Output.WriteLine("[CodeConstructor : {0}]", e.ToString());
+ ++Indent;
+ GenerateStatements(e.Statements);
+ --Indent;
+ }
+
+ protected override void GenerateTypeConstructor(CodeTypeConstructor e)
+ {
+ Output.WriteLine("[CodeTypeConstructor : {0}]", e.ToString());
+ }
+
+ protected override void GenerateTypeStart(CodeTypeDeclaration e)
+ {
+ Output.WriteLine("[CodeTypeDeclaration : {0}]", e.ToString());
+ }
+
+ protected override void GenerateTypeEnd(CodeTypeDeclaration e)
+ {
+ Output.WriteLine("[CodeTypeDeclaration: {0}]", e.ToString());
+ }
+
+ protected override void GenerateNamespaceStart(CodeNamespace e)
+ {
+ Output.WriteLine("[CodeNamespaceStart: {0}]", e.ToString());
+ }
+
+ protected override void GenerateNamespaceEnd(CodeNamespace e)
+ {
+ Output.WriteLine("[CodeNamespaceEnd: {0}]", e.ToString());
+ }
+
+ protected override void GenerateNamespaceImport(CodeNamespaceImport e)
+ {
+ Output.WriteLine("[CodeNamespaceImport: {0}]", e.ToString());
+ }
+
+ protected override void GenerateAttributeDeclarationsStart(CodeAttributeDeclarationCollection attributes)
+ {
+ Output.WriteLine("[CodeAttributeDeclarationCollection: {0}]", attributes.ToString());
+ }
+
+ protected override void GenerateAttributeDeclarationsEnd(CodeAttributeDeclarationCollection attributes)
+ {
+ Output.WriteLine("[CodeAttributeDeclarationCollection: {0}]", attributes.ToString());
+ }
+
+ protected override void GeneratePrimitiveExpression(CodePrimitiveExpression e)
+ {
+ if (e.Value == null) {
+ Output.WriteLine("[CodePrimitiveExpression: null]");
+ } else {
+ Output.Write("[CodePrimitiveExpression: ");
+ base.GeneratePrimitiveExpression(e);
+ Output.WriteLine(" (" + e.Value.GetType().Name + ")]");
+ }
+ }
+
+ protected override bool Supports(GeneratorSupport support)
+ {
+ return true;
+ }
+
+ protected override bool IsValidIdentifier(string value)
+ {
+ return true;
+ }
+
+ protected override string CreateEscapedIdentifier(string value)
+ {
+ return value;
+ }
+
+ protected override string CreateValidIdentifier(string value)
+ {
+ return value;
+ }
+
+ protected override string GetTypeOutput(CodeTypeReference value)
+ {
+ return value.ToString();
+ }
+
+ protected override string QuoteSnippetString(string value)
+ {
+ return "\"" + value + "\"";
+ }
+
+ #endregion
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Visitors/ConvertVisitorBase.cs b/main/contrib/NRefactory/Project/Src/Visitors/ConvertVisitorBase.cs
index 79118418f4..cd44d0c6ca 100644
--- a/main/contrib/NRefactory/Project/Src/Visitors/ConvertVisitorBase.cs
+++ b/main/contrib/NRefactory/Project/Src/Visitors/ConvertVisitorBase.cs
@@ -1,28 +1,28 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 2655 $</version>
-// </file>
-
-using System;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Visitors
-{
- /// <summary>
- /// Base class for the conversion visitors.
- /// </summary>
- public class ConvertVisitorBase : AbstractAstTransformer
- {
- // inserting before current position is not allowed in a Transformer
- // but inserting after it is possible
- protected void InsertAfterSibling(INode sibling, INode newNode)
- {
- if (sibling == null || sibling.Parent == null) return;
- int index = sibling.Parent.Children.IndexOf(sibling);
- sibling.Parent.Children.Insert(index + 1, newNode);
- newNode.Parent = sibling.Parent;
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+using ICSharpCode.NRefactory.Ast;
+
+namespace ICSharpCode.NRefactory.Visitors
+{
+ /// <summary>
+ /// Base class for the conversion visitors.
+ /// </summary>
+ public class ConvertVisitorBase : AbstractAstTransformer
+ {
+ // inserting before current position is not allowed in a Transformer
+ // but inserting after it is possible
+ protected void InsertAfterSibling(INode sibling, INode newNode)
+ {
+ if (sibling == null || sibling.Parent == null) return;
+ int index = sibling.Parent.Children.IndexOf(sibling);
+ sibling.Parent.Children.Insert(index + 1, newNode);
+ newNode.Parent = sibling.Parent;
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Visitors/LookupTableVisitor.cs b/main/contrib/NRefactory/Project/Src/Visitors/LookupTableVisitor.cs
index b6eaf4b8b4..7fafdcd783 100644
--- a/main/contrib/NRefactory/Project/Src/Visitors/LookupTableVisitor.cs
+++ b/main/contrib/NRefactory/Project/Src/Visitors/LookupTableVisitor.cs
@@ -2,7 +2,7 @@
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="none" email=""/>
-// <version>$Revision: 4482 $</version>
+// <version>$Revision: 4527 $</version>
// </file>
using System;
@@ -69,12 +69,6 @@ namespace ICSharpCode.NRefactory.Visitors
}
}
- public override object VisitCompilationUnit (ICSharpCode.NRefactory.Ast.CompilationUnit compilationUnit, object data)
- {
- variables.Clear ();
- return base.VisitCompilationUnit (compilationUnit, data);
- }
-
public void AddVariable(TypeReference typeRef, string name,
Location startPos, Location endPos, bool isConst,
bool isLoopVariable, Expression initializer,
@@ -107,6 +101,12 @@ namespace ICSharpCode.NRefactory.Visitors
}
}
+ public override object VisitCompilationUnit (ICSharpCode.NRefactory.Ast.CompilationUnit compilationUnit, object data)
+ {
+ variables.Clear ();
+ return base.VisitCompilationUnit (compilationUnit, data);
+ }
+
public override object VisitBlockStatement(BlockStatement blockStatement, object data)
{
endLocationStack.Push(blockStatement.EndLocation);
diff --git a/main/contrib/NRefactory/Project/Src/Visitors/NodeTrackingAstVisitor.cs b/main/contrib/NRefactory/Project/Src/Visitors/NodeTrackingAstVisitor.cs
index 6eb62edf27..6bda232c37 100644
--- a/main/contrib/NRefactory/Project/Src/Visitors/NodeTrackingAstVisitor.cs
+++ b/main/contrib/NRefactory/Project/Src/Visitors/NodeTrackingAstVisitor.cs
@@ -1,1376 +1,1376 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:2.0.50727.3053
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace ICSharpCode.NRefactory.Visitors {
- using System;
- using ICSharpCode.NRefactory.Ast;
-
-
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.3053
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace ICSharpCode.NRefactory.Visitors {
+ using System;
+ using ICSharpCode.NRefactory.Ast;
+
+
/// <summary>
/// The NodeTrackingAstVisitor will iterate through the whole AST,
/// just like the AbstractAstVisitor, and calls the virtual methods
/// BeginVisit and EndVisit for each node being visited.
- /// </summary>
+ /// </summary>
/// <remarks>
/// base.Visit(node, data) calls this.TrackedVisit(node, data), so if
/// you want to visit child nodes using the default visiting behaviour,
/// use base.TrackedVisit(parentNode, data).
- /// </remarks>
- public abstract class NodeTrackingAstVisitor : AbstractAstVisitor {
-
- protected virtual void BeginVisit(INode node) {
- }
-
- protected virtual void EndVisit(INode node) {
- }
-
- public sealed override object VisitAddHandlerStatement(AddHandlerStatement addHandlerStatement, object data) {
- this.BeginVisit(addHandlerStatement);
- object result = this.TrackedVisitAddHandlerStatement(addHandlerStatement, data);
- this.EndVisit(addHandlerStatement);
- return result;
- }
-
- public sealed override object VisitAddressOfExpression(AddressOfExpression addressOfExpression, object data) {
- this.BeginVisit(addressOfExpression);
- object result = this.TrackedVisitAddressOfExpression(addressOfExpression, data);
- this.EndVisit(addressOfExpression);
- return result;
- }
-
- public sealed override object VisitAnonymousMethodExpression(AnonymousMethodExpression anonymousMethodExpression, object data) {
- this.BeginVisit(anonymousMethodExpression);
- object result = this.TrackedVisitAnonymousMethodExpression(anonymousMethodExpression, data);
- this.EndVisit(anonymousMethodExpression);
- return result;
- }
-
- public sealed override object VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object data) {
- this.BeginVisit(arrayCreateExpression);
- object result = this.TrackedVisitArrayCreateExpression(arrayCreateExpression, data);
- this.EndVisit(arrayCreateExpression);
- return result;
- }
-
- public sealed override object VisitAssignmentExpression(AssignmentExpression assignmentExpression, object data) {
- this.BeginVisit(assignmentExpression);
- object result = this.TrackedVisitAssignmentExpression(assignmentExpression, data);
- this.EndVisit(assignmentExpression);
- return result;
- }
-
- public sealed override object VisitAttribute(ICSharpCode.NRefactory.Ast.Attribute attribute, object data) {
- this.BeginVisit(attribute);
- object result = this.TrackedVisitAttribute(attribute, data);
- this.EndVisit(attribute);
- return result;
- }
-
- public sealed override object VisitAttributeSection(AttributeSection attributeSection, object data) {
- this.BeginVisit(attributeSection);
- object result = this.TrackedVisitAttributeSection(attributeSection, data);
- this.EndVisit(attributeSection);
- return result;
- }
-
- public sealed override object VisitBaseReferenceExpression(BaseReferenceExpression baseReferenceExpression, object data) {
- this.BeginVisit(baseReferenceExpression);
- object result = this.TrackedVisitBaseReferenceExpression(baseReferenceExpression, data);
- this.EndVisit(baseReferenceExpression);
- return result;
- }
-
- public sealed override object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data) {
- this.BeginVisit(binaryOperatorExpression);
- object result = this.TrackedVisitBinaryOperatorExpression(binaryOperatorExpression, data);
- this.EndVisit(binaryOperatorExpression);
- return result;
- }
-
- public sealed override object VisitBlockStatement(BlockStatement blockStatement, object data) {
- this.BeginVisit(blockStatement);
- object result = this.TrackedVisitBlockStatement(blockStatement, data);
- this.EndVisit(blockStatement);
- return result;
- }
-
- public sealed override object VisitBreakStatement(BreakStatement breakStatement, object data) {
- this.BeginVisit(breakStatement);
- object result = this.TrackedVisitBreakStatement(breakStatement, data);
- this.EndVisit(breakStatement);
- return result;
- }
-
- public sealed override object VisitCaseLabel(CaseLabel caseLabel, object data) {
- this.BeginVisit(caseLabel);
- object result = this.TrackedVisitCaseLabel(caseLabel, data);
- this.EndVisit(caseLabel);
- return result;
- }
-
- public sealed override object VisitCastExpression(CastExpression castExpression, object data) {
- this.BeginVisit(castExpression);
- object result = this.TrackedVisitCastExpression(castExpression, data);
- this.EndVisit(castExpression);
- return result;
- }
-
- public sealed override object VisitCatchClause(CatchClause catchClause, object data) {
- this.BeginVisit(catchClause);
- object result = this.TrackedVisitCatchClause(catchClause, data);
- this.EndVisit(catchClause);
- return result;
- }
-
- public sealed override object VisitCheckedExpression(CheckedExpression checkedExpression, object data) {
- this.BeginVisit(checkedExpression);
- object result = this.TrackedVisitCheckedExpression(checkedExpression, data);
- this.EndVisit(checkedExpression);
- return result;
- }
-
- public sealed override object VisitCheckedStatement(CheckedStatement checkedStatement, object data) {
- this.BeginVisit(checkedStatement);
- object result = this.TrackedVisitCheckedStatement(checkedStatement, data);
- this.EndVisit(checkedStatement);
- return result;
- }
-
- public sealed override object VisitClassReferenceExpression(ClassReferenceExpression classReferenceExpression, object data) {
- this.BeginVisit(classReferenceExpression);
- object result = this.TrackedVisitClassReferenceExpression(classReferenceExpression, data);
- this.EndVisit(classReferenceExpression);
- return result;
- }
-
- public sealed override object VisitCollectionInitializerExpression(CollectionInitializerExpression collectionInitializerExpression, object data) {
- this.BeginVisit(collectionInitializerExpression);
- object result = this.TrackedVisitCollectionInitializerExpression(collectionInitializerExpression, data);
- this.EndVisit(collectionInitializerExpression);
- return result;
- }
-
- public sealed override object VisitCompilationUnit(CompilationUnit compilationUnit, object data) {
- this.BeginVisit(compilationUnit);
- object result = this.TrackedVisitCompilationUnit(compilationUnit, data);
- this.EndVisit(compilationUnit);
- return result;
- }
-
- public sealed override object VisitConditionalExpression(ConditionalExpression conditionalExpression, object data) {
- this.BeginVisit(conditionalExpression);
- object result = this.TrackedVisitConditionalExpression(conditionalExpression, data);
- this.EndVisit(conditionalExpression);
- return result;
- }
-
- public sealed override object VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data) {
- this.BeginVisit(constructorDeclaration);
- object result = this.TrackedVisitConstructorDeclaration(constructorDeclaration, data);
- this.EndVisit(constructorDeclaration);
- return result;
- }
-
- public sealed override object VisitConstructorInitializer(ConstructorInitializer constructorInitializer, object data) {
- this.BeginVisit(constructorInitializer);
- object result = this.TrackedVisitConstructorInitializer(constructorInitializer, data);
- this.EndVisit(constructorInitializer);
- return result;
- }
-
- public sealed override object VisitContinueStatement(ContinueStatement continueStatement, object data) {
- this.BeginVisit(continueStatement);
- object result = this.TrackedVisitContinueStatement(continueStatement, data);
- this.EndVisit(continueStatement);
- return result;
- }
-
- public sealed override object VisitDeclareDeclaration(DeclareDeclaration declareDeclaration, object data) {
- this.BeginVisit(declareDeclaration);
- object result = this.TrackedVisitDeclareDeclaration(declareDeclaration, data);
- this.EndVisit(declareDeclaration);
- return result;
- }
-
- public sealed override object VisitDefaultValueExpression(DefaultValueExpression defaultValueExpression, object data) {
- this.BeginVisit(defaultValueExpression);
- object result = this.TrackedVisitDefaultValueExpression(defaultValueExpression, data);
- this.EndVisit(defaultValueExpression);
- return result;
- }
-
- public sealed override object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data) {
- this.BeginVisit(delegateDeclaration);
- object result = this.TrackedVisitDelegateDeclaration(delegateDeclaration, data);
- this.EndVisit(delegateDeclaration);
- return result;
- }
-
- public sealed override object VisitDestructorDeclaration(DestructorDeclaration destructorDeclaration, object data) {
- this.BeginVisit(destructorDeclaration);
- object result = this.TrackedVisitDestructorDeclaration(destructorDeclaration, data);
- this.EndVisit(destructorDeclaration);
- return result;
- }
-
- public sealed override object VisitDirectionExpression(DirectionExpression directionExpression, object data) {
- this.BeginVisit(directionExpression);
- object result = this.TrackedVisitDirectionExpression(directionExpression, data);
- this.EndVisit(directionExpression);
- return result;
- }
-
- public sealed override object VisitDoLoopStatement(DoLoopStatement doLoopStatement, object data) {
- this.BeginVisit(doLoopStatement);
- object result = this.TrackedVisitDoLoopStatement(doLoopStatement, data);
- this.EndVisit(doLoopStatement);
- return result;
- }
-
- public sealed override object VisitElseIfSection(ElseIfSection elseIfSection, object data) {
- this.BeginVisit(elseIfSection);
- object result = this.TrackedVisitElseIfSection(elseIfSection, data);
- this.EndVisit(elseIfSection);
- return result;
- }
-
- public sealed override object VisitEmptyStatement(EmptyStatement emptyStatement, object data) {
- this.BeginVisit(emptyStatement);
- object result = this.TrackedVisitEmptyStatement(emptyStatement, data);
- this.EndVisit(emptyStatement);
- return result;
- }
-
- public sealed override object VisitEndStatement(EndStatement endStatement, object data) {
- this.BeginVisit(endStatement);
- object result = this.TrackedVisitEndStatement(endStatement, data);
- this.EndVisit(endStatement);
- return result;
- }
-
- public sealed override object VisitEraseStatement(EraseStatement eraseStatement, object data) {
- this.BeginVisit(eraseStatement);
- object result = this.TrackedVisitEraseStatement(eraseStatement, data);
- this.EndVisit(eraseStatement);
- return result;
- }
-
- public sealed override object VisitErrorStatement(ErrorStatement errorStatement, object data) {
- this.BeginVisit(errorStatement);
- object result = this.TrackedVisitErrorStatement(errorStatement, data);
- this.EndVisit(errorStatement);
- return result;
- }
-
- public sealed override object VisitEventAddRegion(EventAddRegion eventAddRegion, object data) {
- this.BeginVisit(eventAddRegion);
- object result = this.TrackedVisitEventAddRegion(eventAddRegion, data);
- this.EndVisit(eventAddRegion);
- return result;
- }
-
- public sealed override object VisitEventDeclaration(EventDeclaration eventDeclaration, object data) {
- this.BeginVisit(eventDeclaration);
- object result = this.TrackedVisitEventDeclaration(eventDeclaration, data);
- this.EndVisit(eventDeclaration);
- return result;
- }
-
- public sealed override object VisitEventRaiseRegion(EventRaiseRegion eventRaiseRegion, object data) {
- this.BeginVisit(eventRaiseRegion);
- object result = this.TrackedVisitEventRaiseRegion(eventRaiseRegion, data);
- this.EndVisit(eventRaiseRegion);
- return result;
- }
-
- public sealed override object VisitEventRemoveRegion(EventRemoveRegion eventRemoveRegion, object data) {
- this.BeginVisit(eventRemoveRegion);
- object result = this.TrackedVisitEventRemoveRegion(eventRemoveRegion, data);
- this.EndVisit(eventRemoveRegion);
- return result;
- }
-
- public sealed override object VisitExitStatement(ExitStatement exitStatement, object data) {
- this.BeginVisit(exitStatement);
- object result = this.TrackedVisitExitStatement(exitStatement, data);
- this.EndVisit(exitStatement);
- return result;
- }
-
- public sealed override object VisitExpressionRangeVariable(ExpressionRangeVariable expressionRangeVariable, object data) {
- this.BeginVisit(expressionRangeVariable);
- object result = this.TrackedVisitExpressionRangeVariable(expressionRangeVariable, data);
- this.EndVisit(expressionRangeVariable);
- return result;
- }
-
- public sealed override object VisitExpressionStatement(ExpressionStatement expressionStatement, object data) {
- this.BeginVisit(expressionStatement);
- object result = this.TrackedVisitExpressionStatement(expressionStatement, data);
- this.EndVisit(expressionStatement);
- return result;
- }
-
- public sealed override object VisitExternAliasDirective(ExternAliasDirective externAliasDirective, object data) {
- this.BeginVisit(externAliasDirective);
- object result = this.TrackedVisitExternAliasDirective(externAliasDirective, data);
- this.EndVisit(externAliasDirective);
- return result;
- }
-
- public sealed override object VisitFieldDeclaration(FieldDeclaration fieldDeclaration, object data) {
- this.BeginVisit(fieldDeclaration);
- object result = this.TrackedVisitFieldDeclaration(fieldDeclaration, data);
- this.EndVisit(fieldDeclaration);
- return result;
- }
-
- public sealed override object VisitFixedStatement(FixedStatement fixedStatement, object data) {
- this.BeginVisit(fixedStatement);
- object result = this.TrackedVisitFixedStatement(fixedStatement, data);
- this.EndVisit(fixedStatement);
- return result;
- }
-
- public sealed override object VisitForeachStatement(ForeachStatement foreachStatement, object data) {
- this.BeginVisit(foreachStatement);
- object result = this.TrackedVisitForeachStatement(foreachStatement, data);
- this.EndVisit(foreachStatement);
- return result;
- }
-
- public sealed override object VisitForNextStatement(ForNextStatement forNextStatement, object data) {
- this.BeginVisit(forNextStatement);
- object result = this.TrackedVisitForNextStatement(forNextStatement, data);
- this.EndVisit(forNextStatement);
- return result;
- }
-
- public sealed override object VisitForStatement(ForStatement forStatement, object data) {
- this.BeginVisit(forStatement);
- object result = this.TrackedVisitForStatement(forStatement, data);
- this.EndVisit(forStatement);
- return result;
- }
-
- public sealed override object VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, object data) {
- this.BeginVisit(gotoCaseStatement);
- object result = this.TrackedVisitGotoCaseStatement(gotoCaseStatement, data);
- this.EndVisit(gotoCaseStatement);
- return result;
- }
-
- public sealed override object VisitGotoStatement(GotoStatement gotoStatement, object data) {
- this.BeginVisit(gotoStatement);
- object result = this.TrackedVisitGotoStatement(gotoStatement, data);
- this.EndVisit(gotoStatement);
- return result;
- }
-
- public sealed override object VisitIdentifierExpression(IdentifierExpression identifierExpression, object data) {
- this.BeginVisit(identifierExpression);
- object result = this.TrackedVisitIdentifierExpression(identifierExpression, data);
- this.EndVisit(identifierExpression);
- return result;
- }
-
- public sealed override object VisitIfElseStatement(IfElseStatement ifElseStatement, object data) {
- this.BeginVisit(ifElseStatement);
- object result = this.TrackedVisitIfElseStatement(ifElseStatement, data);
- this.EndVisit(ifElseStatement);
- return result;
- }
-
- public sealed override object VisitIndexerDeclaration(IndexerDeclaration indexerDeclaration, object data) {
- this.BeginVisit(indexerDeclaration);
- object result = this.TrackedVisitIndexerDeclaration(indexerDeclaration, data);
- this.EndVisit(indexerDeclaration);
- return result;
- }
-
- public sealed override object VisitIndexerExpression(IndexerExpression indexerExpression, object data) {
- this.BeginVisit(indexerExpression);
- object result = this.TrackedVisitIndexerExpression(indexerExpression, data);
- this.EndVisit(indexerExpression);
- return result;
- }
-
- public sealed override object VisitInnerClassTypeReference(InnerClassTypeReference innerClassTypeReference, object data) {
- this.BeginVisit(innerClassTypeReference);
- object result = this.TrackedVisitInnerClassTypeReference(innerClassTypeReference, data);
- this.EndVisit(innerClassTypeReference);
- return result;
- }
-
- public sealed override object VisitInterfaceImplementation(InterfaceImplementation interfaceImplementation, object data) {
- this.BeginVisit(interfaceImplementation);
- object result = this.TrackedVisitInterfaceImplementation(interfaceImplementation, data);
- this.EndVisit(interfaceImplementation);
- return result;
- }
-
- public sealed override object VisitInvocationExpression(InvocationExpression invocationExpression, object data) {
- this.BeginVisit(invocationExpression);
- object result = this.TrackedVisitInvocationExpression(invocationExpression, data);
- this.EndVisit(invocationExpression);
- return result;
- }
-
- public sealed override object VisitLabelStatement(LabelStatement labelStatement, object data) {
- this.BeginVisit(labelStatement);
- object result = this.TrackedVisitLabelStatement(labelStatement, data);
- this.EndVisit(labelStatement);
- return result;
- }
-
- public sealed override object VisitLambdaExpression(LambdaExpression lambdaExpression, object data) {
- this.BeginVisit(lambdaExpression);
- object result = this.TrackedVisitLambdaExpression(lambdaExpression, data);
- this.EndVisit(lambdaExpression);
- return result;
- }
-
- public sealed override object VisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data) {
- this.BeginVisit(localVariableDeclaration);
- object result = this.TrackedVisitLocalVariableDeclaration(localVariableDeclaration, data);
- this.EndVisit(localVariableDeclaration);
- return result;
- }
-
- public sealed override object VisitLockStatement(LockStatement lockStatement, object data) {
- this.BeginVisit(lockStatement);
- object result = this.TrackedVisitLockStatement(lockStatement, data);
- this.EndVisit(lockStatement);
- return result;
- }
-
- public sealed override object VisitMemberReferenceExpression(MemberReferenceExpression memberReferenceExpression, object data) {
- this.BeginVisit(memberReferenceExpression);
- object result = this.TrackedVisitMemberReferenceExpression(memberReferenceExpression, data);
- this.EndVisit(memberReferenceExpression);
- return result;
- }
-
- public sealed override object VisitMethodDeclaration(MethodDeclaration methodDeclaration, object data) {
- this.BeginVisit(methodDeclaration);
- object result = this.TrackedVisitMethodDeclaration(methodDeclaration, data);
- this.EndVisit(methodDeclaration);
- return result;
- }
-
- public sealed override object VisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression, object data) {
- this.BeginVisit(namedArgumentExpression);
- object result = this.TrackedVisitNamedArgumentExpression(namedArgumentExpression, data);
- this.EndVisit(namedArgumentExpression);
- return result;
- }
-
- public sealed override object VisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, object data) {
- this.BeginVisit(namespaceDeclaration);
- object result = this.TrackedVisitNamespaceDeclaration(namespaceDeclaration, data);
- this.EndVisit(namespaceDeclaration);
- return result;
- }
-
- public sealed override object VisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression, object data) {
- this.BeginVisit(objectCreateExpression);
- object result = this.TrackedVisitObjectCreateExpression(objectCreateExpression, data);
- this.EndVisit(objectCreateExpression);
- return result;
- }
-
- public sealed override object VisitOnErrorStatement(OnErrorStatement onErrorStatement, object data) {
- this.BeginVisit(onErrorStatement);
- object result = this.TrackedVisitOnErrorStatement(onErrorStatement, data);
- this.EndVisit(onErrorStatement);
- return result;
- }
-
- public sealed override object VisitOperatorDeclaration(OperatorDeclaration operatorDeclaration, object data) {
- this.BeginVisit(operatorDeclaration);
- object result = this.TrackedVisitOperatorDeclaration(operatorDeclaration, data);
- this.EndVisit(operatorDeclaration);
- return result;
- }
-
- public sealed override object VisitOptionDeclaration(OptionDeclaration optionDeclaration, object data) {
- this.BeginVisit(optionDeclaration);
- object result = this.TrackedVisitOptionDeclaration(optionDeclaration, data);
- this.EndVisit(optionDeclaration);
- return result;
- }
-
- public sealed override object VisitParameterDeclarationExpression(ParameterDeclarationExpression parameterDeclarationExpression, object data) {
- this.BeginVisit(parameterDeclarationExpression);
- object result = this.TrackedVisitParameterDeclarationExpression(parameterDeclarationExpression, data);
- this.EndVisit(parameterDeclarationExpression);
- return result;
- }
-
- public sealed override object VisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression, object data) {
- this.BeginVisit(parenthesizedExpression);
- object result = this.TrackedVisitParenthesizedExpression(parenthesizedExpression, data);
- this.EndVisit(parenthesizedExpression);
- return result;
- }
-
- public sealed override object VisitPointerReferenceExpression(PointerReferenceExpression pointerReferenceExpression, object data) {
- this.BeginVisit(pointerReferenceExpression);
- object result = this.TrackedVisitPointerReferenceExpression(pointerReferenceExpression, data);
- this.EndVisit(pointerReferenceExpression);
- return result;
- }
-
- public sealed override object VisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data) {
- this.BeginVisit(primitiveExpression);
- object result = this.TrackedVisitPrimitiveExpression(primitiveExpression, data);
- this.EndVisit(primitiveExpression);
- return result;
- }
-
- public sealed override object VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration, object data) {
- this.BeginVisit(propertyDeclaration);
- object result = this.TrackedVisitPropertyDeclaration(propertyDeclaration, data);
- this.EndVisit(propertyDeclaration);
- return result;
- }
-
- public sealed override object VisitPropertyGetRegion(PropertyGetRegion propertyGetRegion, object data) {
- this.BeginVisit(propertyGetRegion);
- object result = this.TrackedVisitPropertyGetRegion(propertyGetRegion, data);
- this.EndVisit(propertyGetRegion);
- return result;
- }
-
- public sealed override object VisitPropertySetRegion(PropertySetRegion propertySetRegion, object data) {
- this.BeginVisit(propertySetRegion);
- object result = this.TrackedVisitPropertySetRegion(propertySetRegion, data);
- this.EndVisit(propertySetRegion);
- return result;
- }
-
- public sealed override object VisitQueryExpression(QueryExpression queryExpression, object data) {
- this.BeginVisit(queryExpression);
- object result = this.TrackedVisitQueryExpression(queryExpression, data);
- this.EndVisit(queryExpression);
- return result;
- }
-
- public sealed override object VisitQueryExpressionAggregateClause(QueryExpressionAggregateClause queryExpressionAggregateClause, object data) {
- this.BeginVisit(queryExpressionAggregateClause);
- object result = this.TrackedVisitQueryExpressionAggregateClause(queryExpressionAggregateClause, data);
- this.EndVisit(queryExpressionAggregateClause);
- return result;
- }
-
- public sealed override object VisitQueryExpressionDistinctClause(QueryExpressionDistinctClause queryExpressionDistinctClause, object data) {
- this.BeginVisit(queryExpressionDistinctClause);
- object result = this.TrackedVisitQueryExpressionDistinctClause(queryExpressionDistinctClause, data);
- this.EndVisit(queryExpressionDistinctClause);
- return result;
- }
-
- public sealed override object VisitQueryExpressionFromClause(QueryExpressionFromClause queryExpressionFromClause, object data) {
- this.BeginVisit(queryExpressionFromClause);
- object result = this.TrackedVisitQueryExpressionFromClause(queryExpressionFromClause, data);
- this.EndVisit(queryExpressionFromClause);
- return result;
- }
-
- public sealed override object VisitQueryExpressionGroupClause(QueryExpressionGroupClause queryExpressionGroupClause, object data) {
- this.BeginVisit(queryExpressionGroupClause);
- object result = this.TrackedVisitQueryExpressionGroupClause(queryExpressionGroupClause, data);
- this.EndVisit(queryExpressionGroupClause);
- return result;
- }
-
- public sealed override object VisitQueryExpressionGroupJoinVBClause(QueryExpressionGroupJoinVBClause queryExpressionGroupJoinVBClause, object data) {
- this.BeginVisit(queryExpressionGroupJoinVBClause);
- object result = this.TrackedVisitQueryExpressionGroupJoinVBClause(queryExpressionGroupJoinVBClause, data);
- this.EndVisit(queryExpressionGroupJoinVBClause);
- return result;
- }
-
- public sealed override object VisitQueryExpressionGroupVBClause(QueryExpressionGroupVBClause queryExpressionGroupVBClause, object data) {
- this.BeginVisit(queryExpressionGroupVBClause);
- object result = this.TrackedVisitQueryExpressionGroupVBClause(queryExpressionGroupVBClause, data);
- this.EndVisit(queryExpressionGroupVBClause);
- return result;
- }
-
- public sealed override object VisitQueryExpressionJoinClause(QueryExpressionJoinClause queryExpressionJoinClause, object data) {
- this.BeginVisit(queryExpressionJoinClause);
- object result = this.TrackedVisitQueryExpressionJoinClause(queryExpressionJoinClause, data);
- this.EndVisit(queryExpressionJoinClause);
- return result;
- }
-
- public sealed override object VisitQueryExpressionJoinConditionVB(QueryExpressionJoinConditionVB queryExpressionJoinConditionVB, object data) {
- this.BeginVisit(queryExpressionJoinConditionVB);
- object result = this.TrackedVisitQueryExpressionJoinConditionVB(queryExpressionJoinConditionVB, data);
- this.EndVisit(queryExpressionJoinConditionVB);
- return result;
- }
-
- public sealed override object VisitQueryExpressionJoinVBClause(QueryExpressionJoinVBClause queryExpressionJoinVBClause, object data) {
- this.BeginVisit(queryExpressionJoinVBClause);
- object result = this.TrackedVisitQueryExpressionJoinVBClause(queryExpressionJoinVBClause, data);
- this.EndVisit(queryExpressionJoinVBClause);
- return result;
- }
-
- public sealed override object VisitQueryExpressionLetClause(QueryExpressionLetClause queryExpressionLetClause, object data) {
- this.BeginVisit(queryExpressionLetClause);
- object result = this.TrackedVisitQueryExpressionLetClause(queryExpressionLetClause, data);
- this.EndVisit(queryExpressionLetClause);
- return result;
- }
-
- public sealed override object VisitQueryExpressionLetVBClause(QueryExpressionLetVBClause queryExpressionLetVBClause, object data) {
- this.BeginVisit(queryExpressionLetVBClause);
- object result = this.TrackedVisitQueryExpressionLetVBClause(queryExpressionLetVBClause, data);
- this.EndVisit(queryExpressionLetVBClause);
- return result;
- }
-
- public sealed override object VisitQueryExpressionOrderClause(QueryExpressionOrderClause queryExpressionOrderClause, object data) {
- this.BeginVisit(queryExpressionOrderClause);
- object result = this.TrackedVisitQueryExpressionOrderClause(queryExpressionOrderClause, data);
- this.EndVisit(queryExpressionOrderClause);
- return result;
- }
-
- public sealed override object VisitQueryExpressionOrdering(QueryExpressionOrdering queryExpressionOrdering, object data) {
- this.BeginVisit(queryExpressionOrdering);
- object result = this.TrackedVisitQueryExpressionOrdering(queryExpressionOrdering, data);
- this.EndVisit(queryExpressionOrdering);
- return result;
- }
-
- public sealed override object VisitQueryExpressionPartitionVBClause(QueryExpressionPartitionVBClause queryExpressionPartitionVBClause, object data) {
- this.BeginVisit(queryExpressionPartitionVBClause);
- object result = this.TrackedVisitQueryExpressionPartitionVBClause(queryExpressionPartitionVBClause, data);
- this.EndVisit(queryExpressionPartitionVBClause);
- return result;
- }
-
- public sealed override object VisitQueryExpressionSelectClause(QueryExpressionSelectClause queryExpressionSelectClause, object data) {
- this.BeginVisit(queryExpressionSelectClause);
- object result = this.TrackedVisitQueryExpressionSelectClause(queryExpressionSelectClause, data);
- this.EndVisit(queryExpressionSelectClause);
- return result;
- }
-
- public sealed override object VisitQueryExpressionSelectVBClause(QueryExpressionSelectVBClause queryExpressionSelectVBClause, object data) {
- this.BeginVisit(queryExpressionSelectVBClause);
- object result = this.TrackedVisitQueryExpressionSelectVBClause(queryExpressionSelectVBClause, data);
- this.EndVisit(queryExpressionSelectVBClause);
- return result;
- }
-
- public sealed override object VisitQueryExpressionWhereClause(QueryExpressionWhereClause queryExpressionWhereClause, object data) {
- this.BeginVisit(queryExpressionWhereClause);
- object result = this.TrackedVisitQueryExpressionWhereClause(queryExpressionWhereClause, data);
- this.EndVisit(queryExpressionWhereClause);
- return result;
- }
-
- public sealed override object VisitRaiseEventStatement(RaiseEventStatement raiseEventStatement, object data) {
- this.BeginVisit(raiseEventStatement);
- object result = this.TrackedVisitRaiseEventStatement(raiseEventStatement, data);
- this.EndVisit(raiseEventStatement);
- return result;
- }
-
- public sealed override object VisitReDimStatement(ReDimStatement reDimStatement, object data) {
- this.BeginVisit(reDimStatement);
- object result = this.TrackedVisitReDimStatement(reDimStatement, data);
- this.EndVisit(reDimStatement);
- return result;
- }
-
- public sealed override object VisitRemoveHandlerStatement(RemoveHandlerStatement removeHandlerStatement, object data) {
- this.BeginVisit(removeHandlerStatement);
- object result = this.TrackedVisitRemoveHandlerStatement(removeHandlerStatement, data);
- this.EndVisit(removeHandlerStatement);
- return result;
- }
-
- public sealed override object VisitResumeStatement(ResumeStatement resumeStatement, object data) {
- this.BeginVisit(resumeStatement);
- object result = this.TrackedVisitResumeStatement(resumeStatement, data);
- this.EndVisit(resumeStatement);
- return result;
- }
-
- public sealed override object VisitReturnStatement(ReturnStatement returnStatement, object data) {
- this.BeginVisit(returnStatement);
- object result = this.TrackedVisitReturnStatement(returnStatement, data);
- this.EndVisit(returnStatement);
- return result;
- }
-
- public sealed override object VisitSizeOfExpression(SizeOfExpression sizeOfExpression, object data) {
- this.BeginVisit(sizeOfExpression);
- object result = this.TrackedVisitSizeOfExpression(sizeOfExpression, data);
- this.EndVisit(sizeOfExpression);
- return result;
- }
-
- public sealed override object VisitStackAllocExpression(StackAllocExpression stackAllocExpression, object data) {
- this.BeginVisit(stackAllocExpression);
- object result = this.TrackedVisitStackAllocExpression(stackAllocExpression, data);
- this.EndVisit(stackAllocExpression);
- return result;
- }
-
- public sealed override object VisitStopStatement(StopStatement stopStatement, object data) {
- this.BeginVisit(stopStatement);
- object result = this.TrackedVisitStopStatement(stopStatement, data);
- this.EndVisit(stopStatement);
- return result;
- }
-
- public sealed override object VisitSwitchSection(SwitchSection switchSection, object data) {
- this.BeginVisit(switchSection);
- object result = this.TrackedVisitSwitchSection(switchSection, data);
- this.EndVisit(switchSection);
- return result;
- }
-
- public sealed override object VisitSwitchStatement(SwitchStatement switchStatement, object data) {
- this.BeginVisit(switchStatement);
- object result = this.TrackedVisitSwitchStatement(switchStatement, data);
- this.EndVisit(switchStatement);
- return result;
- }
-
- public sealed override object VisitTemplateDefinition(TemplateDefinition templateDefinition, object data) {
- this.BeginVisit(templateDefinition);
- object result = this.TrackedVisitTemplateDefinition(templateDefinition, data);
- this.EndVisit(templateDefinition);
- return result;
- }
-
- public sealed override object VisitThisReferenceExpression(ThisReferenceExpression thisReferenceExpression, object data) {
- this.BeginVisit(thisReferenceExpression);
- object result = this.TrackedVisitThisReferenceExpression(thisReferenceExpression, data);
- this.EndVisit(thisReferenceExpression);
- return result;
- }
-
- public sealed override object VisitThrowStatement(ThrowStatement throwStatement, object data) {
- this.BeginVisit(throwStatement);
- object result = this.TrackedVisitThrowStatement(throwStatement, data);
- this.EndVisit(throwStatement);
- return result;
- }
-
- public sealed override object VisitTryCatchStatement(TryCatchStatement tryCatchStatement, object data) {
- this.BeginVisit(tryCatchStatement);
- object result = this.TrackedVisitTryCatchStatement(tryCatchStatement, data);
- this.EndVisit(tryCatchStatement);
- return result;
- }
-
- public sealed override object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data) {
- this.BeginVisit(typeDeclaration);
- object result = this.TrackedVisitTypeDeclaration(typeDeclaration, data);
- this.EndVisit(typeDeclaration);
- return result;
- }
-
- public sealed override object VisitTypeOfExpression(TypeOfExpression typeOfExpression, object data) {
- this.BeginVisit(typeOfExpression);
- object result = this.TrackedVisitTypeOfExpression(typeOfExpression, data);
- this.EndVisit(typeOfExpression);
- return result;
- }
-
- public sealed override object VisitTypeOfIsExpression(TypeOfIsExpression typeOfIsExpression, object data) {
- this.BeginVisit(typeOfIsExpression);
- object result = this.TrackedVisitTypeOfIsExpression(typeOfIsExpression, data);
- this.EndVisit(typeOfIsExpression);
- return result;
- }
-
- public sealed override object VisitTypeReference(TypeReference typeReference, object data) {
- this.BeginVisit(typeReference);
- object result = this.TrackedVisitTypeReference(typeReference, data);
- this.EndVisit(typeReference);
- return result;
- }
-
- public sealed override object VisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, object data) {
- this.BeginVisit(typeReferenceExpression);
- object result = this.TrackedVisitTypeReferenceExpression(typeReferenceExpression, data);
- this.EndVisit(typeReferenceExpression);
- return result;
- }
-
- public sealed override object VisitUnaryOperatorExpression(UnaryOperatorExpression unaryOperatorExpression, object data) {
- this.BeginVisit(unaryOperatorExpression);
- object result = this.TrackedVisitUnaryOperatorExpression(unaryOperatorExpression, data);
- this.EndVisit(unaryOperatorExpression);
- return result;
- }
-
- public sealed override object VisitUncheckedExpression(UncheckedExpression uncheckedExpression, object data) {
- this.BeginVisit(uncheckedExpression);
- object result = this.TrackedVisitUncheckedExpression(uncheckedExpression, data);
- this.EndVisit(uncheckedExpression);
- return result;
- }
-
- public sealed override object VisitUncheckedStatement(UncheckedStatement uncheckedStatement, object data) {
- this.BeginVisit(uncheckedStatement);
- object result = this.TrackedVisitUncheckedStatement(uncheckedStatement, data);
- this.EndVisit(uncheckedStatement);
- return result;
- }
-
- public sealed override object VisitUnsafeStatement(UnsafeStatement unsafeStatement, object data) {
- this.BeginVisit(unsafeStatement);
- object result = this.TrackedVisitUnsafeStatement(unsafeStatement, data);
- this.EndVisit(unsafeStatement);
- return result;
- }
-
- public sealed override object VisitUsing(Using @using, object data) {
- this.BeginVisit(@using);
- object result = this.TrackedVisitUsing(@using, data);
- this.EndVisit(@using);
- return result;
- }
-
- public sealed override object VisitUsingDeclaration(UsingDeclaration usingDeclaration, object data) {
- this.BeginVisit(usingDeclaration);
- object result = this.TrackedVisitUsingDeclaration(usingDeclaration, data);
- this.EndVisit(usingDeclaration);
- return result;
- }
-
- public sealed override object VisitUsingStatement(UsingStatement usingStatement, object data) {
- this.BeginVisit(usingStatement);
- object result = this.TrackedVisitUsingStatement(usingStatement, data);
- this.EndVisit(usingStatement);
- return result;
- }
-
- public sealed override object VisitVariableDeclaration(VariableDeclaration variableDeclaration, object data) {
- this.BeginVisit(variableDeclaration);
- object result = this.TrackedVisitVariableDeclaration(variableDeclaration, data);
- this.EndVisit(variableDeclaration);
- return result;
- }
-
- public sealed override object VisitWithStatement(WithStatement withStatement, object data) {
- this.BeginVisit(withStatement);
- object result = this.TrackedVisitWithStatement(withStatement, data);
- this.EndVisit(withStatement);
- return result;
- }
-
- public sealed override object VisitYieldStatement(YieldStatement yieldStatement, object data) {
- this.BeginVisit(yieldStatement);
- object result = this.TrackedVisitYieldStatement(yieldStatement, data);
- this.EndVisit(yieldStatement);
- return result;
- }
-
- public virtual object TrackedVisitAddHandlerStatement(AddHandlerStatement addHandlerStatement, object data) {
- return base.VisitAddHandlerStatement(addHandlerStatement, data);
- }
-
- public virtual object TrackedVisitAddressOfExpression(AddressOfExpression addressOfExpression, object data) {
- return base.VisitAddressOfExpression(addressOfExpression, data);
- }
-
- public virtual object TrackedVisitAnonymousMethodExpression(AnonymousMethodExpression anonymousMethodExpression, object data) {
- return base.VisitAnonymousMethodExpression(anonymousMethodExpression, data);
- }
-
- public virtual object TrackedVisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object data) {
- return base.VisitArrayCreateExpression(arrayCreateExpression, data);
- }
-
- public virtual object TrackedVisitAssignmentExpression(AssignmentExpression assignmentExpression, object data) {
- return base.VisitAssignmentExpression(assignmentExpression, data);
- }
-
- public virtual object TrackedVisitAttribute(ICSharpCode.NRefactory.Ast.Attribute attribute, object data) {
- return base.VisitAttribute(attribute, data);
- }
-
- public virtual object TrackedVisitAttributeSection(AttributeSection attributeSection, object data) {
- return base.VisitAttributeSection(attributeSection, data);
- }
-
- public virtual object TrackedVisitBaseReferenceExpression(BaseReferenceExpression baseReferenceExpression, object data) {
- return base.VisitBaseReferenceExpression(baseReferenceExpression, data);
- }
-
- public virtual object TrackedVisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data) {
- return base.VisitBinaryOperatorExpression(binaryOperatorExpression, data);
- }
-
- public virtual object TrackedVisitBlockStatement(BlockStatement blockStatement, object data) {
- return base.VisitBlockStatement(blockStatement, data);
- }
-
- public virtual object TrackedVisitBreakStatement(BreakStatement breakStatement, object data) {
- return base.VisitBreakStatement(breakStatement, data);
- }
-
- public virtual object TrackedVisitCaseLabel(CaseLabel caseLabel, object data) {
- return base.VisitCaseLabel(caseLabel, data);
- }
-
- public virtual object TrackedVisitCastExpression(CastExpression castExpression, object data) {
- return base.VisitCastExpression(castExpression, data);
- }
-
- public virtual object TrackedVisitCatchClause(CatchClause catchClause, object data) {
- return base.VisitCatchClause(catchClause, data);
- }
-
- public virtual object TrackedVisitCheckedExpression(CheckedExpression checkedExpression, object data) {
- return base.VisitCheckedExpression(checkedExpression, data);
- }
-
- public virtual object TrackedVisitCheckedStatement(CheckedStatement checkedStatement, object data) {
- return base.VisitCheckedStatement(checkedStatement, data);
- }
-
- public virtual object TrackedVisitClassReferenceExpression(ClassReferenceExpression classReferenceExpression, object data) {
- return base.VisitClassReferenceExpression(classReferenceExpression, data);
- }
-
- public virtual object TrackedVisitCollectionInitializerExpression(CollectionInitializerExpression collectionInitializerExpression, object data) {
- return base.VisitCollectionInitializerExpression(collectionInitializerExpression, data);
- }
-
- public virtual object TrackedVisitCompilationUnit(CompilationUnit compilationUnit, object data) {
- return base.VisitCompilationUnit(compilationUnit, data);
- }
-
- public virtual object TrackedVisitConditionalExpression(ConditionalExpression conditionalExpression, object data) {
- return base.VisitConditionalExpression(conditionalExpression, data);
- }
-
- public virtual object TrackedVisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data) {
- return base.VisitConstructorDeclaration(constructorDeclaration, data);
- }
-
- public virtual object TrackedVisitConstructorInitializer(ConstructorInitializer constructorInitializer, object data) {
- return base.VisitConstructorInitializer(constructorInitializer, data);
- }
-
- public virtual object TrackedVisitContinueStatement(ContinueStatement continueStatement, object data) {
- return base.VisitContinueStatement(continueStatement, data);
- }
-
- public virtual object TrackedVisitDeclareDeclaration(DeclareDeclaration declareDeclaration, object data) {
- return base.VisitDeclareDeclaration(declareDeclaration, data);
- }
-
- public virtual object TrackedVisitDefaultValueExpression(DefaultValueExpression defaultValueExpression, object data) {
- return base.VisitDefaultValueExpression(defaultValueExpression, data);
- }
-
- public virtual object TrackedVisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data) {
- return base.VisitDelegateDeclaration(delegateDeclaration, data);
- }
-
- public virtual object TrackedVisitDestructorDeclaration(DestructorDeclaration destructorDeclaration, object data) {
- return base.VisitDestructorDeclaration(destructorDeclaration, data);
- }
-
- public virtual object TrackedVisitDirectionExpression(DirectionExpression directionExpression, object data) {
- return base.VisitDirectionExpression(directionExpression, data);
- }
-
- public virtual object TrackedVisitDoLoopStatement(DoLoopStatement doLoopStatement, object data) {
- return base.VisitDoLoopStatement(doLoopStatement, data);
- }
-
- public virtual object TrackedVisitElseIfSection(ElseIfSection elseIfSection, object data) {
- return base.VisitElseIfSection(elseIfSection, data);
- }
-
- public virtual object TrackedVisitEmptyStatement(EmptyStatement emptyStatement, object data) {
- return base.VisitEmptyStatement(emptyStatement, data);
- }
-
- public virtual object TrackedVisitEndStatement(EndStatement endStatement, object data) {
- return base.VisitEndStatement(endStatement, data);
- }
-
- public virtual object TrackedVisitEraseStatement(EraseStatement eraseStatement, object data) {
- return base.VisitEraseStatement(eraseStatement, data);
- }
-
- public virtual object TrackedVisitErrorStatement(ErrorStatement errorStatement, object data) {
- return base.VisitErrorStatement(errorStatement, data);
- }
-
- public virtual object TrackedVisitEventAddRegion(EventAddRegion eventAddRegion, object data) {
- return base.VisitEventAddRegion(eventAddRegion, data);
- }
-
- public virtual object TrackedVisitEventDeclaration(EventDeclaration eventDeclaration, object data) {
- return base.VisitEventDeclaration(eventDeclaration, data);
- }
-
- public virtual object TrackedVisitEventRaiseRegion(EventRaiseRegion eventRaiseRegion, object data) {
- return base.VisitEventRaiseRegion(eventRaiseRegion, data);
- }
-
- public virtual object TrackedVisitEventRemoveRegion(EventRemoveRegion eventRemoveRegion, object data) {
- return base.VisitEventRemoveRegion(eventRemoveRegion, data);
- }
-
- public virtual object TrackedVisitExitStatement(ExitStatement exitStatement, object data) {
- return base.VisitExitStatement(exitStatement, data);
- }
-
- public virtual object TrackedVisitExpressionRangeVariable(ExpressionRangeVariable expressionRangeVariable, object data) {
- return base.VisitExpressionRangeVariable(expressionRangeVariable, data);
- }
-
- public virtual object TrackedVisitExpressionStatement(ExpressionStatement expressionStatement, object data) {
- return base.VisitExpressionStatement(expressionStatement, data);
- }
-
- public virtual object TrackedVisitExternAliasDirective(ExternAliasDirective externAliasDirective, object data) {
- return base.VisitExternAliasDirective(externAliasDirective, data);
- }
-
- public virtual object TrackedVisitFieldDeclaration(FieldDeclaration fieldDeclaration, object data) {
- return base.VisitFieldDeclaration(fieldDeclaration, data);
- }
-
- public virtual object TrackedVisitFixedStatement(FixedStatement fixedStatement, object data) {
- return base.VisitFixedStatement(fixedStatement, data);
- }
-
- public virtual object TrackedVisitForeachStatement(ForeachStatement foreachStatement, object data) {
- return base.VisitForeachStatement(foreachStatement, data);
- }
-
- public virtual object TrackedVisitForNextStatement(ForNextStatement forNextStatement, object data) {
- return base.VisitForNextStatement(forNextStatement, data);
- }
-
- public virtual object TrackedVisitForStatement(ForStatement forStatement, object data) {
- return base.VisitForStatement(forStatement, data);
- }
-
- public virtual object TrackedVisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, object data) {
- return base.VisitGotoCaseStatement(gotoCaseStatement, data);
- }
-
- public virtual object TrackedVisitGotoStatement(GotoStatement gotoStatement, object data) {
- return base.VisitGotoStatement(gotoStatement, data);
- }
-
- public virtual object TrackedVisitIdentifierExpression(IdentifierExpression identifierExpression, object data) {
- return base.VisitIdentifierExpression(identifierExpression, data);
- }
-
- public virtual object TrackedVisitIfElseStatement(IfElseStatement ifElseStatement, object data) {
- return base.VisitIfElseStatement(ifElseStatement, data);
- }
-
- public virtual object TrackedVisitIndexerDeclaration(IndexerDeclaration indexerDeclaration, object data) {
- return base.VisitIndexerDeclaration(indexerDeclaration, data);
- }
-
- public virtual object TrackedVisitIndexerExpression(IndexerExpression indexerExpression, object data) {
- return base.VisitIndexerExpression(indexerExpression, data);
- }
-
- public virtual object TrackedVisitInnerClassTypeReference(InnerClassTypeReference innerClassTypeReference, object data) {
- return base.VisitInnerClassTypeReference(innerClassTypeReference, data);
- }
-
- public virtual object TrackedVisitInterfaceImplementation(InterfaceImplementation interfaceImplementation, object data) {
- return base.VisitInterfaceImplementation(interfaceImplementation, data);
- }
-
- public virtual object TrackedVisitInvocationExpression(InvocationExpression invocationExpression, object data) {
- return base.VisitInvocationExpression(invocationExpression, data);
- }
-
- public virtual object TrackedVisitLabelStatement(LabelStatement labelStatement, object data) {
- return base.VisitLabelStatement(labelStatement, data);
- }
-
- public virtual object TrackedVisitLambdaExpression(LambdaExpression lambdaExpression, object data) {
- return base.VisitLambdaExpression(lambdaExpression, data);
- }
-
- public virtual object TrackedVisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data) {
- return base.VisitLocalVariableDeclaration(localVariableDeclaration, data);
- }
-
- public virtual object TrackedVisitLockStatement(LockStatement lockStatement, object data) {
- return base.VisitLockStatement(lockStatement, data);
- }
-
- public virtual object TrackedVisitMemberReferenceExpression(MemberReferenceExpression memberReferenceExpression, object data) {
- return base.VisitMemberReferenceExpression(memberReferenceExpression, data);
- }
-
- public virtual object TrackedVisitMethodDeclaration(MethodDeclaration methodDeclaration, object data) {
- return base.VisitMethodDeclaration(methodDeclaration, data);
- }
-
- public virtual object TrackedVisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression, object data) {
- return base.VisitNamedArgumentExpression(namedArgumentExpression, data);
- }
-
- public virtual object TrackedVisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, object data) {
- return base.VisitNamespaceDeclaration(namespaceDeclaration, data);
- }
-
- public virtual object TrackedVisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression, object data) {
- return base.VisitObjectCreateExpression(objectCreateExpression, data);
- }
-
- public virtual object TrackedVisitOnErrorStatement(OnErrorStatement onErrorStatement, object data) {
- return base.VisitOnErrorStatement(onErrorStatement, data);
- }
-
- public virtual object TrackedVisitOperatorDeclaration(OperatorDeclaration operatorDeclaration, object data) {
- return base.VisitOperatorDeclaration(operatorDeclaration, data);
- }
-
- public virtual object TrackedVisitOptionDeclaration(OptionDeclaration optionDeclaration, object data) {
- return base.VisitOptionDeclaration(optionDeclaration, data);
- }
-
- public virtual object TrackedVisitParameterDeclarationExpression(ParameterDeclarationExpression parameterDeclarationExpression, object data) {
- return base.VisitParameterDeclarationExpression(parameterDeclarationExpression, data);
- }
-
- public virtual object TrackedVisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression, object data) {
- return base.VisitParenthesizedExpression(parenthesizedExpression, data);
- }
-
- public virtual object TrackedVisitPointerReferenceExpression(PointerReferenceExpression pointerReferenceExpression, object data) {
- return base.VisitPointerReferenceExpression(pointerReferenceExpression, data);
- }
-
- public virtual object TrackedVisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data) {
- return base.VisitPrimitiveExpression(primitiveExpression, data);
- }
-
- public virtual object TrackedVisitPropertyDeclaration(PropertyDeclaration propertyDeclaration, object data) {
- return base.VisitPropertyDeclaration(propertyDeclaration, data);
- }
-
- public virtual object TrackedVisitPropertyGetRegion(PropertyGetRegion propertyGetRegion, object data) {
- return base.VisitPropertyGetRegion(propertyGetRegion, data);
- }
-
- public virtual object TrackedVisitPropertySetRegion(PropertySetRegion propertySetRegion, object data) {
- return base.VisitPropertySetRegion(propertySetRegion, data);
- }
-
- public virtual object TrackedVisitQueryExpression(QueryExpression queryExpression, object data) {
- return base.VisitQueryExpression(queryExpression, data);
- }
-
- public virtual object TrackedVisitQueryExpressionAggregateClause(QueryExpressionAggregateClause queryExpressionAggregateClause, object data) {
- return base.VisitQueryExpressionAggregateClause(queryExpressionAggregateClause, data);
- }
-
- public virtual object TrackedVisitQueryExpressionDistinctClause(QueryExpressionDistinctClause queryExpressionDistinctClause, object data) {
- return base.VisitQueryExpressionDistinctClause(queryExpressionDistinctClause, data);
- }
-
- public virtual object TrackedVisitQueryExpressionFromClause(QueryExpressionFromClause queryExpressionFromClause, object data) {
- return base.VisitQueryExpressionFromClause(queryExpressionFromClause, data);
- }
-
- public virtual object TrackedVisitQueryExpressionGroupClause(QueryExpressionGroupClause queryExpressionGroupClause, object data) {
- return base.VisitQueryExpressionGroupClause(queryExpressionGroupClause, data);
- }
-
- public virtual object TrackedVisitQueryExpressionGroupJoinVBClause(QueryExpressionGroupJoinVBClause queryExpressionGroupJoinVBClause, object data) {
- return base.VisitQueryExpressionGroupJoinVBClause(queryExpressionGroupJoinVBClause, data);
- }
-
- public virtual object TrackedVisitQueryExpressionGroupVBClause(QueryExpressionGroupVBClause queryExpressionGroupVBClause, object data) {
- return base.VisitQueryExpressionGroupVBClause(queryExpressionGroupVBClause, data);
- }
-
- public virtual object TrackedVisitQueryExpressionJoinClause(QueryExpressionJoinClause queryExpressionJoinClause, object data) {
- return base.VisitQueryExpressionJoinClause(queryExpressionJoinClause, data);
- }
-
- public virtual object TrackedVisitQueryExpressionJoinConditionVB(QueryExpressionJoinConditionVB queryExpressionJoinConditionVB, object data) {
- return base.VisitQueryExpressionJoinConditionVB(queryExpressionJoinConditionVB, data);
- }
-
- public virtual object TrackedVisitQueryExpressionJoinVBClause(QueryExpressionJoinVBClause queryExpressionJoinVBClause, object data) {
- return base.VisitQueryExpressionJoinVBClause(queryExpressionJoinVBClause, data);
- }
-
- public virtual object TrackedVisitQueryExpressionLetClause(QueryExpressionLetClause queryExpressionLetClause, object data) {
- return base.VisitQueryExpressionLetClause(queryExpressionLetClause, data);
- }
-
- public virtual object TrackedVisitQueryExpressionLetVBClause(QueryExpressionLetVBClause queryExpressionLetVBClause, object data) {
- return base.VisitQueryExpressionLetVBClause(queryExpressionLetVBClause, data);
- }
-
- public virtual object TrackedVisitQueryExpressionOrderClause(QueryExpressionOrderClause queryExpressionOrderClause, object data) {
- return base.VisitQueryExpressionOrderClause(queryExpressionOrderClause, data);
- }
-
- public virtual object TrackedVisitQueryExpressionOrdering(QueryExpressionOrdering queryExpressionOrdering, object data) {
- return base.VisitQueryExpressionOrdering(queryExpressionOrdering, data);
- }
-
- public virtual object TrackedVisitQueryExpressionPartitionVBClause(QueryExpressionPartitionVBClause queryExpressionPartitionVBClause, object data) {
- return base.VisitQueryExpressionPartitionVBClause(queryExpressionPartitionVBClause, data);
- }
-
- public virtual object TrackedVisitQueryExpressionSelectClause(QueryExpressionSelectClause queryExpressionSelectClause, object data) {
- return base.VisitQueryExpressionSelectClause(queryExpressionSelectClause, data);
- }
-
- public virtual object TrackedVisitQueryExpressionSelectVBClause(QueryExpressionSelectVBClause queryExpressionSelectVBClause, object data) {
- return base.VisitQueryExpressionSelectVBClause(queryExpressionSelectVBClause, data);
- }
-
- public virtual object TrackedVisitQueryExpressionWhereClause(QueryExpressionWhereClause queryExpressionWhereClause, object data) {
- return base.VisitQueryExpressionWhereClause(queryExpressionWhereClause, data);
- }
-
- public virtual object TrackedVisitRaiseEventStatement(RaiseEventStatement raiseEventStatement, object data) {
- return base.VisitRaiseEventStatement(raiseEventStatement, data);
- }
-
- public virtual object TrackedVisitReDimStatement(ReDimStatement reDimStatement, object data) {
- return base.VisitReDimStatement(reDimStatement, data);
- }
-
- public virtual object TrackedVisitRemoveHandlerStatement(RemoveHandlerStatement removeHandlerStatement, object data) {
- return base.VisitRemoveHandlerStatement(removeHandlerStatement, data);
- }
-
- public virtual object TrackedVisitResumeStatement(ResumeStatement resumeStatement, object data) {
- return base.VisitResumeStatement(resumeStatement, data);
- }
-
- public virtual object TrackedVisitReturnStatement(ReturnStatement returnStatement, object data) {
- return base.VisitReturnStatement(returnStatement, data);
- }
-
- public virtual object TrackedVisitSizeOfExpression(SizeOfExpression sizeOfExpression, object data) {
- return base.VisitSizeOfExpression(sizeOfExpression, data);
- }
-
- public virtual object TrackedVisitStackAllocExpression(StackAllocExpression stackAllocExpression, object data) {
- return base.VisitStackAllocExpression(stackAllocExpression, data);
- }
-
- public virtual object TrackedVisitStopStatement(StopStatement stopStatement, object data) {
- return base.VisitStopStatement(stopStatement, data);
- }
-
- public virtual object TrackedVisitSwitchSection(SwitchSection switchSection, object data) {
- return base.VisitSwitchSection(switchSection, data);
- }
-
- public virtual object TrackedVisitSwitchStatement(SwitchStatement switchStatement, object data) {
- return base.VisitSwitchStatement(switchStatement, data);
- }
-
- public virtual object TrackedVisitTemplateDefinition(TemplateDefinition templateDefinition, object data) {
- return base.VisitTemplateDefinition(templateDefinition, data);
- }
-
- public virtual object TrackedVisitThisReferenceExpression(ThisReferenceExpression thisReferenceExpression, object data) {
- return base.VisitThisReferenceExpression(thisReferenceExpression, data);
- }
-
- public virtual object TrackedVisitThrowStatement(ThrowStatement throwStatement, object data) {
- return base.VisitThrowStatement(throwStatement, data);
- }
-
- public virtual object TrackedVisitTryCatchStatement(TryCatchStatement tryCatchStatement, object data) {
- return base.VisitTryCatchStatement(tryCatchStatement, data);
- }
-
- public virtual object TrackedVisitTypeDeclaration(TypeDeclaration typeDeclaration, object data) {
- return base.VisitTypeDeclaration(typeDeclaration, data);
- }
-
- public virtual object TrackedVisitTypeOfExpression(TypeOfExpression typeOfExpression, object data) {
- return base.VisitTypeOfExpression(typeOfExpression, data);
- }
-
- public virtual object TrackedVisitTypeOfIsExpression(TypeOfIsExpression typeOfIsExpression, object data) {
- return base.VisitTypeOfIsExpression(typeOfIsExpression, data);
- }
-
- public virtual object TrackedVisitTypeReference(TypeReference typeReference, object data) {
- return base.VisitTypeReference(typeReference, data);
- }
-
- public virtual object TrackedVisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, object data) {
- return base.VisitTypeReferenceExpression(typeReferenceExpression, data);
- }
-
- public virtual object TrackedVisitUnaryOperatorExpression(UnaryOperatorExpression unaryOperatorExpression, object data) {
- return base.VisitUnaryOperatorExpression(unaryOperatorExpression, data);
- }
-
- public virtual object TrackedVisitUncheckedExpression(UncheckedExpression uncheckedExpression, object data) {
- return base.VisitUncheckedExpression(uncheckedExpression, data);
- }
-
- public virtual object TrackedVisitUncheckedStatement(UncheckedStatement uncheckedStatement, object data) {
- return base.VisitUncheckedStatement(uncheckedStatement, data);
- }
-
- public virtual object TrackedVisitUnsafeStatement(UnsafeStatement unsafeStatement, object data) {
- return base.VisitUnsafeStatement(unsafeStatement, data);
- }
-
- public virtual object TrackedVisitUsing(Using @using, object data) {
- return base.VisitUsing(@using, data);
- }
-
- public virtual object TrackedVisitUsingDeclaration(UsingDeclaration usingDeclaration, object data) {
- return base.VisitUsingDeclaration(usingDeclaration, data);
- }
-
- public virtual object TrackedVisitUsingStatement(UsingStatement usingStatement, object data) {
- return base.VisitUsingStatement(usingStatement, data);
- }
-
- public virtual object TrackedVisitVariableDeclaration(VariableDeclaration variableDeclaration, object data) {
- return base.VisitVariableDeclaration(variableDeclaration, data);
- }
-
- public virtual object TrackedVisitWithStatement(WithStatement withStatement, object data) {
- return base.VisitWithStatement(withStatement, data);
- }
-
- public virtual object TrackedVisitYieldStatement(YieldStatement yieldStatement, object data) {
- return base.VisitYieldStatement(yieldStatement, data);
- }
- }
-}
+ /// </remarks>
+ public abstract class NodeTrackingAstVisitor : AbstractAstVisitor {
+
+ protected virtual void BeginVisit(INode node) {
+ }
+
+ protected virtual void EndVisit(INode node) {
+ }
+
+ public sealed override object VisitAddHandlerStatement(AddHandlerStatement addHandlerStatement, object data) {
+ this.BeginVisit(addHandlerStatement);
+ object result = this.TrackedVisitAddHandlerStatement(addHandlerStatement, data);
+ this.EndVisit(addHandlerStatement);
+ return result;
+ }
+
+ public sealed override object VisitAddressOfExpression(AddressOfExpression addressOfExpression, object data) {
+ this.BeginVisit(addressOfExpression);
+ object result = this.TrackedVisitAddressOfExpression(addressOfExpression, data);
+ this.EndVisit(addressOfExpression);
+ return result;
+ }
+
+ public sealed override object VisitAnonymousMethodExpression(AnonymousMethodExpression anonymousMethodExpression, object data) {
+ this.BeginVisit(anonymousMethodExpression);
+ object result = this.TrackedVisitAnonymousMethodExpression(anonymousMethodExpression, data);
+ this.EndVisit(anonymousMethodExpression);
+ return result;
+ }
+
+ public sealed override object VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object data) {
+ this.BeginVisit(arrayCreateExpression);
+ object result = this.TrackedVisitArrayCreateExpression(arrayCreateExpression, data);
+ this.EndVisit(arrayCreateExpression);
+ return result;
+ }
+
+ public sealed override object VisitAssignmentExpression(AssignmentExpression assignmentExpression, object data) {
+ this.BeginVisit(assignmentExpression);
+ object result = this.TrackedVisitAssignmentExpression(assignmentExpression, data);
+ this.EndVisit(assignmentExpression);
+ return result;
+ }
+
+ public sealed override object VisitAttribute(ICSharpCode.NRefactory.Ast.Attribute attribute, object data) {
+ this.BeginVisit(attribute);
+ object result = this.TrackedVisitAttribute(attribute, data);
+ this.EndVisit(attribute);
+ return result;
+ }
+
+ public sealed override object VisitAttributeSection(AttributeSection attributeSection, object data) {
+ this.BeginVisit(attributeSection);
+ object result = this.TrackedVisitAttributeSection(attributeSection, data);
+ this.EndVisit(attributeSection);
+ return result;
+ }
+
+ public sealed override object VisitBaseReferenceExpression(BaseReferenceExpression baseReferenceExpression, object data) {
+ this.BeginVisit(baseReferenceExpression);
+ object result = this.TrackedVisitBaseReferenceExpression(baseReferenceExpression, data);
+ this.EndVisit(baseReferenceExpression);
+ return result;
+ }
+
+ public sealed override object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data) {
+ this.BeginVisit(binaryOperatorExpression);
+ object result = this.TrackedVisitBinaryOperatorExpression(binaryOperatorExpression, data);
+ this.EndVisit(binaryOperatorExpression);
+ return result;
+ }
+
+ public sealed override object VisitBlockStatement(BlockStatement blockStatement, object data) {
+ this.BeginVisit(blockStatement);
+ object result = this.TrackedVisitBlockStatement(blockStatement, data);
+ this.EndVisit(blockStatement);
+ return result;
+ }
+
+ public sealed override object VisitBreakStatement(BreakStatement breakStatement, object data) {
+ this.BeginVisit(breakStatement);
+ object result = this.TrackedVisitBreakStatement(breakStatement, data);
+ this.EndVisit(breakStatement);
+ return result;
+ }
+
+ public sealed override object VisitCaseLabel(CaseLabel caseLabel, object data) {
+ this.BeginVisit(caseLabel);
+ object result = this.TrackedVisitCaseLabel(caseLabel, data);
+ this.EndVisit(caseLabel);
+ return result;
+ }
+
+ public sealed override object VisitCastExpression(CastExpression castExpression, object data) {
+ this.BeginVisit(castExpression);
+ object result = this.TrackedVisitCastExpression(castExpression, data);
+ this.EndVisit(castExpression);
+ return result;
+ }
+
+ public sealed override object VisitCatchClause(CatchClause catchClause, object data) {
+ this.BeginVisit(catchClause);
+ object result = this.TrackedVisitCatchClause(catchClause, data);
+ this.EndVisit(catchClause);
+ return result;
+ }
+
+ public sealed override object VisitCheckedExpression(CheckedExpression checkedExpression, object data) {
+ this.BeginVisit(checkedExpression);
+ object result = this.TrackedVisitCheckedExpression(checkedExpression, data);
+ this.EndVisit(checkedExpression);
+ return result;
+ }
+
+ public sealed override object VisitCheckedStatement(CheckedStatement checkedStatement, object data) {
+ this.BeginVisit(checkedStatement);
+ object result = this.TrackedVisitCheckedStatement(checkedStatement, data);
+ this.EndVisit(checkedStatement);
+ return result;
+ }
+
+ public sealed override object VisitClassReferenceExpression(ClassReferenceExpression classReferenceExpression, object data) {
+ this.BeginVisit(classReferenceExpression);
+ object result = this.TrackedVisitClassReferenceExpression(classReferenceExpression, data);
+ this.EndVisit(classReferenceExpression);
+ return result;
+ }
+
+ public sealed override object VisitCollectionInitializerExpression(CollectionInitializerExpression collectionInitializerExpression, object data) {
+ this.BeginVisit(collectionInitializerExpression);
+ object result = this.TrackedVisitCollectionInitializerExpression(collectionInitializerExpression, data);
+ this.EndVisit(collectionInitializerExpression);
+ return result;
+ }
+
+ public sealed override object VisitCompilationUnit(CompilationUnit compilationUnit, object data) {
+ this.BeginVisit(compilationUnit);
+ object result = this.TrackedVisitCompilationUnit(compilationUnit, data);
+ this.EndVisit(compilationUnit);
+ return result;
+ }
+
+ public sealed override object VisitConditionalExpression(ConditionalExpression conditionalExpression, object data) {
+ this.BeginVisit(conditionalExpression);
+ object result = this.TrackedVisitConditionalExpression(conditionalExpression, data);
+ this.EndVisit(conditionalExpression);
+ return result;
+ }
+
+ public sealed override object VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data) {
+ this.BeginVisit(constructorDeclaration);
+ object result = this.TrackedVisitConstructorDeclaration(constructorDeclaration, data);
+ this.EndVisit(constructorDeclaration);
+ return result;
+ }
+
+ public sealed override object VisitConstructorInitializer(ConstructorInitializer constructorInitializer, object data) {
+ this.BeginVisit(constructorInitializer);
+ object result = this.TrackedVisitConstructorInitializer(constructorInitializer, data);
+ this.EndVisit(constructorInitializer);
+ return result;
+ }
+
+ public sealed override object VisitContinueStatement(ContinueStatement continueStatement, object data) {
+ this.BeginVisit(continueStatement);
+ object result = this.TrackedVisitContinueStatement(continueStatement, data);
+ this.EndVisit(continueStatement);
+ return result;
+ }
+
+ public sealed override object VisitDeclareDeclaration(DeclareDeclaration declareDeclaration, object data) {
+ this.BeginVisit(declareDeclaration);
+ object result = this.TrackedVisitDeclareDeclaration(declareDeclaration, data);
+ this.EndVisit(declareDeclaration);
+ return result;
+ }
+
+ public sealed override object VisitDefaultValueExpression(DefaultValueExpression defaultValueExpression, object data) {
+ this.BeginVisit(defaultValueExpression);
+ object result = this.TrackedVisitDefaultValueExpression(defaultValueExpression, data);
+ this.EndVisit(defaultValueExpression);
+ return result;
+ }
+
+ public sealed override object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data) {
+ this.BeginVisit(delegateDeclaration);
+ object result = this.TrackedVisitDelegateDeclaration(delegateDeclaration, data);
+ this.EndVisit(delegateDeclaration);
+ return result;
+ }
+
+ public sealed override object VisitDestructorDeclaration(DestructorDeclaration destructorDeclaration, object data) {
+ this.BeginVisit(destructorDeclaration);
+ object result = this.TrackedVisitDestructorDeclaration(destructorDeclaration, data);
+ this.EndVisit(destructorDeclaration);
+ return result;
+ }
+
+ public sealed override object VisitDirectionExpression(DirectionExpression directionExpression, object data) {
+ this.BeginVisit(directionExpression);
+ object result = this.TrackedVisitDirectionExpression(directionExpression, data);
+ this.EndVisit(directionExpression);
+ return result;
+ }
+
+ public sealed override object VisitDoLoopStatement(DoLoopStatement doLoopStatement, object data) {
+ this.BeginVisit(doLoopStatement);
+ object result = this.TrackedVisitDoLoopStatement(doLoopStatement, data);
+ this.EndVisit(doLoopStatement);
+ return result;
+ }
+
+ public sealed override object VisitElseIfSection(ElseIfSection elseIfSection, object data) {
+ this.BeginVisit(elseIfSection);
+ object result = this.TrackedVisitElseIfSection(elseIfSection, data);
+ this.EndVisit(elseIfSection);
+ return result;
+ }
+
+ public sealed override object VisitEmptyStatement(EmptyStatement emptyStatement, object data) {
+ this.BeginVisit(emptyStatement);
+ object result = this.TrackedVisitEmptyStatement(emptyStatement, data);
+ this.EndVisit(emptyStatement);
+ return result;
+ }
+
+ public sealed override object VisitEndStatement(EndStatement endStatement, object data) {
+ this.BeginVisit(endStatement);
+ object result = this.TrackedVisitEndStatement(endStatement, data);
+ this.EndVisit(endStatement);
+ return result;
+ }
+
+ public sealed override object VisitEraseStatement(EraseStatement eraseStatement, object data) {
+ this.BeginVisit(eraseStatement);
+ object result = this.TrackedVisitEraseStatement(eraseStatement, data);
+ this.EndVisit(eraseStatement);
+ return result;
+ }
+
+ public sealed override object VisitErrorStatement(ErrorStatement errorStatement, object data) {
+ this.BeginVisit(errorStatement);
+ object result = this.TrackedVisitErrorStatement(errorStatement, data);
+ this.EndVisit(errorStatement);
+ return result;
+ }
+
+ public sealed override object VisitEventAddRegion(EventAddRegion eventAddRegion, object data) {
+ this.BeginVisit(eventAddRegion);
+ object result = this.TrackedVisitEventAddRegion(eventAddRegion, data);
+ this.EndVisit(eventAddRegion);
+ return result;
+ }
+
+ public sealed override object VisitEventDeclaration(EventDeclaration eventDeclaration, object data) {
+ this.BeginVisit(eventDeclaration);
+ object result = this.TrackedVisitEventDeclaration(eventDeclaration, data);
+ this.EndVisit(eventDeclaration);
+ return result;
+ }
+
+ public sealed override object VisitEventRaiseRegion(EventRaiseRegion eventRaiseRegion, object data) {
+ this.BeginVisit(eventRaiseRegion);
+ object result = this.TrackedVisitEventRaiseRegion(eventRaiseRegion, data);
+ this.EndVisit(eventRaiseRegion);
+ return result;
+ }
+
+ public sealed override object VisitEventRemoveRegion(EventRemoveRegion eventRemoveRegion, object data) {
+ this.BeginVisit(eventRemoveRegion);
+ object result = this.TrackedVisitEventRemoveRegion(eventRemoveRegion, data);
+ this.EndVisit(eventRemoveRegion);
+ return result;
+ }
+
+ public sealed override object VisitExitStatement(ExitStatement exitStatement, object data) {
+ this.BeginVisit(exitStatement);
+ object result = this.TrackedVisitExitStatement(exitStatement, data);
+ this.EndVisit(exitStatement);
+ return result;
+ }
+
+ public sealed override object VisitExpressionRangeVariable(ExpressionRangeVariable expressionRangeVariable, object data) {
+ this.BeginVisit(expressionRangeVariable);
+ object result = this.TrackedVisitExpressionRangeVariable(expressionRangeVariable, data);
+ this.EndVisit(expressionRangeVariable);
+ return result;
+ }
+
+ public sealed override object VisitExpressionStatement(ExpressionStatement expressionStatement, object data) {
+ this.BeginVisit(expressionStatement);
+ object result = this.TrackedVisitExpressionStatement(expressionStatement, data);
+ this.EndVisit(expressionStatement);
+ return result;
+ }
+
+ public sealed override object VisitExternAliasDirective(ExternAliasDirective externAliasDirective, object data) {
+ this.BeginVisit(externAliasDirective);
+ object result = this.TrackedVisitExternAliasDirective(externAliasDirective, data);
+ this.EndVisit(externAliasDirective);
+ return result;
+ }
+
+ public sealed override object VisitFieldDeclaration(FieldDeclaration fieldDeclaration, object data) {
+ this.BeginVisit(fieldDeclaration);
+ object result = this.TrackedVisitFieldDeclaration(fieldDeclaration, data);
+ this.EndVisit(fieldDeclaration);
+ return result;
+ }
+
+ public sealed override object VisitFixedStatement(FixedStatement fixedStatement, object data) {
+ this.BeginVisit(fixedStatement);
+ object result = this.TrackedVisitFixedStatement(fixedStatement, data);
+ this.EndVisit(fixedStatement);
+ return result;
+ }
+
+ public sealed override object VisitForeachStatement(ForeachStatement foreachStatement, object data) {
+ this.BeginVisit(foreachStatement);
+ object result = this.TrackedVisitForeachStatement(foreachStatement, data);
+ this.EndVisit(foreachStatement);
+ return result;
+ }
+
+ public sealed override object VisitForNextStatement(ForNextStatement forNextStatement, object data) {
+ this.BeginVisit(forNextStatement);
+ object result = this.TrackedVisitForNextStatement(forNextStatement, data);
+ this.EndVisit(forNextStatement);
+ return result;
+ }
+
+ public sealed override object VisitForStatement(ForStatement forStatement, object data) {
+ this.BeginVisit(forStatement);
+ object result = this.TrackedVisitForStatement(forStatement, data);
+ this.EndVisit(forStatement);
+ return result;
+ }
+
+ public sealed override object VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, object data) {
+ this.BeginVisit(gotoCaseStatement);
+ object result = this.TrackedVisitGotoCaseStatement(gotoCaseStatement, data);
+ this.EndVisit(gotoCaseStatement);
+ return result;
+ }
+
+ public sealed override object VisitGotoStatement(GotoStatement gotoStatement, object data) {
+ this.BeginVisit(gotoStatement);
+ object result = this.TrackedVisitGotoStatement(gotoStatement, data);
+ this.EndVisit(gotoStatement);
+ return result;
+ }
+
+ public sealed override object VisitIdentifierExpression(IdentifierExpression identifierExpression, object data) {
+ this.BeginVisit(identifierExpression);
+ object result = this.TrackedVisitIdentifierExpression(identifierExpression, data);
+ this.EndVisit(identifierExpression);
+ return result;
+ }
+
+ public sealed override object VisitIfElseStatement(IfElseStatement ifElseStatement, object data) {
+ this.BeginVisit(ifElseStatement);
+ object result = this.TrackedVisitIfElseStatement(ifElseStatement, data);
+ this.EndVisit(ifElseStatement);
+ return result;
+ }
+
+ public sealed override object VisitIndexerDeclaration(IndexerDeclaration indexerDeclaration, object data) {
+ this.BeginVisit(indexerDeclaration);
+ object result = this.TrackedVisitIndexerDeclaration(indexerDeclaration, data);
+ this.EndVisit(indexerDeclaration);
+ return result;
+ }
+
+ public sealed override object VisitIndexerExpression(IndexerExpression indexerExpression, object data) {
+ this.BeginVisit(indexerExpression);
+ object result = this.TrackedVisitIndexerExpression(indexerExpression, data);
+ this.EndVisit(indexerExpression);
+ return result;
+ }
+
+ public sealed override object VisitInnerClassTypeReference(InnerClassTypeReference innerClassTypeReference, object data) {
+ this.BeginVisit(innerClassTypeReference);
+ object result = this.TrackedVisitInnerClassTypeReference(innerClassTypeReference, data);
+ this.EndVisit(innerClassTypeReference);
+ return result;
+ }
+
+ public sealed override object VisitInterfaceImplementation(InterfaceImplementation interfaceImplementation, object data) {
+ this.BeginVisit(interfaceImplementation);
+ object result = this.TrackedVisitInterfaceImplementation(interfaceImplementation, data);
+ this.EndVisit(interfaceImplementation);
+ return result;
+ }
+
+ public sealed override object VisitInvocationExpression(InvocationExpression invocationExpression, object data) {
+ this.BeginVisit(invocationExpression);
+ object result = this.TrackedVisitInvocationExpression(invocationExpression, data);
+ this.EndVisit(invocationExpression);
+ return result;
+ }
+
+ public sealed override object VisitLabelStatement(LabelStatement labelStatement, object data) {
+ this.BeginVisit(labelStatement);
+ object result = this.TrackedVisitLabelStatement(labelStatement, data);
+ this.EndVisit(labelStatement);
+ return result;
+ }
+
+ public sealed override object VisitLambdaExpression(LambdaExpression lambdaExpression, object data) {
+ this.BeginVisit(lambdaExpression);
+ object result = this.TrackedVisitLambdaExpression(lambdaExpression, data);
+ this.EndVisit(lambdaExpression);
+ return result;
+ }
+
+ public sealed override object VisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data) {
+ this.BeginVisit(localVariableDeclaration);
+ object result = this.TrackedVisitLocalVariableDeclaration(localVariableDeclaration, data);
+ this.EndVisit(localVariableDeclaration);
+ return result;
+ }
+
+ public sealed override object VisitLockStatement(LockStatement lockStatement, object data) {
+ this.BeginVisit(lockStatement);
+ object result = this.TrackedVisitLockStatement(lockStatement, data);
+ this.EndVisit(lockStatement);
+ return result;
+ }
+
+ public sealed override object VisitMemberReferenceExpression(MemberReferenceExpression memberReferenceExpression, object data) {
+ this.BeginVisit(memberReferenceExpression);
+ object result = this.TrackedVisitMemberReferenceExpression(memberReferenceExpression, data);
+ this.EndVisit(memberReferenceExpression);
+ return result;
+ }
+
+ public sealed override object VisitMethodDeclaration(MethodDeclaration methodDeclaration, object data) {
+ this.BeginVisit(methodDeclaration);
+ object result = this.TrackedVisitMethodDeclaration(methodDeclaration, data);
+ this.EndVisit(methodDeclaration);
+ return result;
+ }
+
+ public sealed override object VisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression, object data) {
+ this.BeginVisit(namedArgumentExpression);
+ object result = this.TrackedVisitNamedArgumentExpression(namedArgumentExpression, data);
+ this.EndVisit(namedArgumentExpression);
+ return result;
+ }
+
+ public sealed override object VisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, object data) {
+ this.BeginVisit(namespaceDeclaration);
+ object result = this.TrackedVisitNamespaceDeclaration(namespaceDeclaration, data);
+ this.EndVisit(namespaceDeclaration);
+ return result;
+ }
+
+ public sealed override object VisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression, object data) {
+ this.BeginVisit(objectCreateExpression);
+ object result = this.TrackedVisitObjectCreateExpression(objectCreateExpression, data);
+ this.EndVisit(objectCreateExpression);
+ return result;
+ }
+
+ public sealed override object VisitOnErrorStatement(OnErrorStatement onErrorStatement, object data) {
+ this.BeginVisit(onErrorStatement);
+ object result = this.TrackedVisitOnErrorStatement(onErrorStatement, data);
+ this.EndVisit(onErrorStatement);
+ return result;
+ }
+
+ public sealed override object VisitOperatorDeclaration(OperatorDeclaration operatorDeclaration, object data) {
+ this.BeginVisit(operatorDeclaration);
+ object result = this.TrackedVisitOperatorDeclaration(operatorDeclaration, data);
+ this.EndVisit(operatorDeclaration);
+ return result;
+ }
+
+ public sealed override object VisitOptionDeclaration(OptionDeclaration optionDeclaration, object data) {
+ this.BeginVisit(optionDeclaration);
+ object result = this.TrackedVisitOptionDeclaration(optionDeclaration, data);
+ this.EndVisit(optionDeclaration);
+ return result;
+ }
+
+ public sealed override object VisitParameterDeclarationExpression(ParameterDeclarationExpression parameterDeclarationExpression, object data) {
+ this.BeginVisit(parameterDeclarationExpression);
+ object result = this.TrackedVisitParameterDeclarationExpression(parameterDeclarationExpression, data);
+ this.EndVisit(parameterDeclarationExpression);
+ return result;
+ }
+
+ public sealed override object VisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression, object data) {
+ this.BeginVisit(parenthesizedExpression);
+ object result = this.TrackedVisitParenthesizedExpression(parenthesizedExpression, data);
+ this.EndVisit(parenthesizedExpression);
+ return result;
+ }
+
+ public sealed override object VisitPointerReferenceExpression(PointerReferenceExpression pointerReferenceExpression, object data) {
+ this.BeginVisit(pointerReferenceExpression);
+ object result = this.TrackedVisitPointerReferenceExpression(pointerReferenceExpression, data);
+ this.EndVisit(pointerReferenceExpression);
+ return result;
+ }
+
+ public sealed override object VisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data) {
+ this.BeginVisit(primitiveExpression);
+ object result = this.TrackedVisitPrimitiveExpression(primitiveExpression, data);
+ this.EndVisit(primitiveExpression);
+ return result;
+ }
+
+ public sealed override object VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration, object data) {
+ this.BeginVisit(propertyDeclaration);
+ object result = this.TrackedVisitPropertyDeclaration(propertyDeclaration, data);
+ this.EndVisit(propertyDeclaration);
+ return result;
+ }
+
+ public sealed override object VisitPropertyGetRegion(PropertyGetRegion propertyGetRegion, object data) {
+ this.BeginVisit(propertyGetRegion);
+ object result = this.TrackedVisitPropertyGetRegion(propertyGetRegion, data);
+ this.EndVisit(propertyGetRegion);
+ return result;
+ }
+
+ public sealed override object VisitPropertySetRegion(PropertySetRegion propertySetRegion, object data) {
+ this.BeginVisit(propertySetRegion);
+ object result = this.TrackedVisitPropertySetRegion(propertySetRegion, data);
+ this.EndVisit(propertySetRegion);
+ return result;
+ }
+
+ public sealed override object VisitQueryExpression(QueryExpression queryExpression, object data) {
+ this.BeginVisit(queryExpression);
+ object result = this.TrackedVisitQueryExpression(queryExpression, data);
+ this.EndVisit(queryExpression);
+ return result;
+ }
+
+ public sealed override object VisitQueryExpressionAggregateClause(QueryExpressionAggregateClause queryExpressionAggregateClause, object data) {
+ this.BeginVisit(queryExpressionAggregateClause);
+ object result = this.TrackedVisitQueryExpressionAggregateClause(queryExpressionAggregateClause, data);
+ this.EndVisit(queryExpressionAggregateClause);
+ return result;
+ }
+
+ public sealed override object VisitQueryExpressionDistinctClause(QueryExpressionDistinctClause queryExpressionDistinctClause, object data) {
+ this.BeginVisit(queryExpressionDistinctClause);
+ object result = this.TrackedVisitQueryExpressionDistinctClause(queryExpressionDistinctClause, data);
+ this.EndVisit(queryExpressionDistinctClause);
+ return result;
+ }
+
+ public sealed override object VisitQueryExpressionFromClause(QueryExpressionFromClause queryExpressionFromClause, object data) {
+ this.BeginVisit(queryExpressionFromClause);
+ object result = this.TrackedVisitQueryExpressionFromClause(queryExpressionFromClause, data);
+ this.EndVisit(queryExpressionFromClause);
+ return result;
+ }
+
+ public sealed override object VisitQueryExpressionGroupClause(QueryExpressionGroupClause queryExpressionGroupClause, object data) {
+ this.BeginVisit(queryExpressionGroupClause);
+ object result = this.TrackedVisitQueryExpressionGroupClause(queryExpressionGroupClause, data);
+ this.EndVisit(queryExpressionGroupClause);
+ return result;
+ }
+
+ public sealed override object VisitQueryExpressionGroupJoinVBClause(QueryExpressionGroupJoinVBClause queryExpressionGroupJoinVBClause, object data) {
+ this.BeginVisit(queryExpressionGroupJoinVBClause);
+ object result = this.TrackedVisitQueryExpressionGroupJoinVBClause(queryExpressionGroupJoinVBClause, data);
+ this.EndVisit(queryExpressionGroupJoinVBClause);
+ return result;
+ }
+
+ public sealed override object VisitQueryExpressionGroupVBClause(QueryExpressionGroupVBClause queryExpressionGroupVBClause, object data) {
+ this.BeginVisit(queryExpressionGroupVBClause);
+ object result = this.TrackedVisitQueryExpressionGroupVBClause(queryExpressionGroupVBClause, data);
+ this.EndVisit(queryExpressionGroupVBClause);
+ return result;
+ }
+
+ public sealed override object VisitQueryExpressionJoinClause(QueryExpressionJoinClause queryExpressionJoinClause, object data) {
+ this.BeginVisit(queryExpressionJoinClause);
+ object result = this.TrackedVisitQueryExpressionJoinClause(queryExpressionJoinClause, data);
+ this.EndVisit(queryExpressionJoinClause);
+ return result;
+ }
+
+ public sealed override object VisitQueryExpressionJoinConditionVB(QueryExpressionJoinConditionVB queryExpressionJoinConditionVB, object data) {
+ this.BeginVisit(queryExpressionJoinConditionVB);
+ object result = this.TrackedVisitQueryExpressionJoinConditionVB(queryExpressionJoinConditionVB, data);
+ this.EndVisit(queryExpressionJoinConditionVB);
+ return result;
+ }
+
+ public sealed override object VisitQueryExpressionJoinVBClause(QueryExpressionJoinVBClause queryExpressionJoinVBClause, object data) {
+ this.BeginVisit(queryExpressionJoinVBClause);
+ object result = this.TrackedVisitQueryExpressionJoinVBClause(queryExpressionJoinVBClause, data);
+ this.EndVisit(queryExpressionJoinVBClause);
+ return result;
+ }
+
+ public sealed override object VisitQueryExpressionLetClause(QueryExpressionLetClause queryExpressionLetClause, object data) {
+ this.BeginVisit(queryExpressionLetClause);
+ object result = this.TrackedVisitQueryExpressionLetClause(queryExpressionLetClause, data);
+ this.EndVisit(queryExpressionLetClause);
+ return result;
+ }
+
+ public sealed override object VisitQueryExpressionLetVBClause(QueryExpressionLetVBClause queryExpressionLetVBClause, object data) {
+ this.BeginVisit(queryExpressionLetVBClause);
+ object result = this.TrackedVisitQueryExpressionLetVBClause(queryExpressionLetVBClause, data);
+ this.EndVisit(queryExpressionLetVBClause);
+ return result;
+ }
+
+ public sealed override object VisitQueryExpressionOrderClause(QueryExpressionOrderClause queryExpressionOrderClause, object data) {
+ this.BeginVisit(queryExpressionOrderClause);
+ object result = this.TrackedVisitQueryExpressionOrderClause(queryExpressionOrderClause, data);
+ this.EndVisit(queryExpressionOrderClause);
+ return result;
+ }
+
+ public sealed override object VisitQueryExpressionOrdering(QueryExpressionOrdering queryExpressionOrdering, object data) {
+ this.BeginVisit(queryExpressionOrdering);
+ object result = this.TrackedVisitQueryExpressionOrdering(queryExpressionOrdering, data);
+ this.EndVisit(queryExpressionOrdering);
+ return result;
+ }
+
+ public sealed override object VisitQueryExpressionPartitionVBClause(QueryExpressionPartitionVBClause queryExpressionPartitionVBClause, object data) {
+ this.BeginVisit(queryExpressionPartitionVBClause);
+ object result = this.TrackedVisitQueryExpressionPartitionVBClause(queryExpressionPartitionVBClause, data);
+ this.EndVisit(queryExpressionPartitionVBClause);
+ return result;
+ }
+
+ public sealed override object VisitQueryExpressionSelectClause(QueryExpressionSelectClause queryExpressionSelectClause, object data) {
+ this.BeginVisit(queryExpressionSelectClause);
+ object result = this.TrackedVisitQueryExpressionSelectClause(queryExpressionSelectClause, data);
+ this.EndVisit(queryExpressionSelectClause);
+ return result;
+ }
+
+ public sealed override object VisitQueryExpressionSelectVBClause(QueryExpressionSelectVBClause queryExpressionSelectVBClause, object data) {
+ this.BeginVisit(queryExpressionSelectVBClause);
+ object result = this.TrackedVisitQueryExpressionSelectVBClause(queryExpressionSelectVBClause, data);
+ this.EndVisit(queryExpressionSelectVBClause);
+ return result;
+ }
+
+ public sealed override object VisitQueryExpressionWhereClause(QueryExpressionWhereClause queryExpressionWhereClause, object data) {
+ this.BeginVisit(queryExpressionWhereClause);
+ object result = this.TrackedVisitQueryExpressionWhereClause(queryExpressionWhereClause, data);
+ this.EndVisit(queryExpressionWhereClause);
+ return result;
+ }
+
+ public sealed override object VisitRaiseEventStatement(RaiseEventStatement raiseEventStatement, object data) {
+ this.BeginVisit(raiseEventStatement);
+ object result = this.TrackedVisitRaiseEventStatement(raiseEventStatement, data);
+ this.EndVisit(raiseEventStatement);
+ return result;
+ }
+
+ public sealed override object VisitReDimStatement(ReDimStatement reDimStatement, object data) {
+ this.BeginVisit(reDimStatement);
+ object result = this.TrackedVisitReDimStatement(reDimStatement, data);
+ this.EndVisit(reDimStatement);
+ return result;
+ }
+
+ public sealed override object VisitRemoveHandlerStatement(RemoveHandlerStatement removeHandlerStatement, object data) {
+ this.BeginVisit(removeHandlerStatement);
+ object result = this.TrackedVisitRemoveHandlerStatement(removeHandlerStatement, data);
+ this.EndVisit(removeHandlerStatement);
+ return result;
+ }
+
+ public sealed override object VisitResumeStatement(ResumeStatement resumeStatement, object data) {
+ this.BeginVisit(resumeStatement);
+ object result = this.TrackedVisitResumeStatement(resumeStatement, data);
+ this.EndVisit(resumeStatement);
+ return result;
+ }
+
+ public sealed override object VisitReturnStatement(ReturnStatement returnStatement, object data) {
+ this.BeginVisit(returnStatement);
+ object result = this.TrackedVisitReturnStatement(returnStatement, data);
+ this.EndVisit(returnStatement);
+ return result;
+ }
+
+ public sealed override object VisitSizeOfExpression(SizeOfExpression sizeOfExpression, object data) {
+ this.BeginVisit(sizeOfExpression);
+ object result = this.TrackedVisitSizeOfExpression(sizeOfExpression, data);
+ this.EndVisit(sizeOfExpression);
+ return result;
+ }
+
+ public sealed override object VisitStackAllocExpression(StackAllocExpression stackAllocExpression, object data) {
+ this.BeginVisit(stackAllocExpression);
+ object result = this.TrackedVisitStackAllocExpression(stackAllocExpression, data);
+ this.EndVisit(stackAllocExpression);
+ return result;
+ }
+
+ public sealed override object VisitStopStatement(StopStatement stopStatement, object data) {
+ this.BeginVisit(stopStatement);
+ object result = this.TrackedVisitStopStatement(stopStatement, data);
+ this.EndVisit(stopStatement);
+ return result;
+ }
+
+ public sealed override object VisitSwitchSection(SwitchSection switchSection, object data) {
+ this.BeginVisit(switchSection);
+ object result = this.TrackedVisitSwitchSection(switchSection, data);
+ this.EndVisit(switchSection);
+ return result;
+ }
+
+ public sealed override object VisitSwitchStatement(SwitchStatement switchStatement, object data) {
+ this.BeginVisit(switchStatement);
+ object result = this.TrackedVisitSwitchStatement(switchStatement, data);
+ this.EndVisit(switchStatement);
+ return result;
+ }
+
+ public sealed override object VisitTemplateDefinition(TemplateDefinition templateDefinition, object data) {
+ this.BeginVisit(templateDefinition);
+ object result = this.TrackedVisitTemplateDefinition(templateDefinition, data);
+ this.EndVisit(templateDefinition);
+ return result;
+ }
+
+ public sealed override object VisitThisReferenceExpression(ThisReferenceExpression thisReferenceExpression, object data) {
+ this.BeginVisit(thisReferenceExpression);
+ object result = this.TrackedVisitThisReferenceExpression(thisReferenceExpression, data);
+ this.EndVisit(thisReferenceExpression);
+ return result;
+ }
+
+ public sealed override object VisitThrowStatement(ThrowStatement throwStatement, object data) {
+ this.BeginVisit(throwStatement);
+ object result = this.TrackedVisitThrowStatement(throwStatement, data);
+ this.EndVisit(throwStatement);
+ return result;
+ }
+
+ public sealed override object VisitTryCatchStatement(TryCatchStatement tryCatchStatement, object data) {
+ this.BeginVisit(tryCatchStatement);
+ object result = this.TrackedVisitTryCatchStatement(tryCatchStatement, data);
+ this.EndVisit(tryCatchStatement);
+ return result;
+ }
+
+ public sealed override object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data) {
+ this.BeginVisit(typeDeclaration);
+ object result = this.TrackedVisitTypeDeclaration(typeDeclaration, data);
+ this.EndVisit(typeDeclaration);
+ return result;
+ }
+
+ public sealed override object VisitTypeOfExpression(TypeOfExpression typeOfExpression, object data) {
+ this.BeginVisit(typeOfExpression);
+ object result = this.TrackedVisitTypeOfExpression(typeOfExpression, data);
+ this.EndVisit(typeOfExpression);
+ return result;
+ }
+
+ public sealed override object VisitTypeOfIsExpression(TypeOfIsExpression typeOfIsExpression, object data) {
+ this.BeginVisit(typeOfIsExpression);
+ object result = this.TrackedVisitTypeOfIsExpression(typeOfIsExpression, data);
+ this.EndVisit(typeOfIsExpression);
+ return result;
+ }
+
+ public sealed override object VisitTypeReference(TypeReference typeReference, object data) {
+ this.BeginVisit(typeReference);
+ object result = this.TrackedVisitTypeReference(typeReference, data);
+ this.EndVisit(typeReference);
+ return result;
+ }
+
+ public sealed override object VisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, object data) {
+ this.BeginVisit(typeReferenceExpression);
+ object result = this.TrackedVisitTypeReferenceExpression(typeReferenceExpression, data);
+ this.EndVisit(typeReferenceExpression);
+ return result;
+ }
+
+ public sealed override object VisitUnaryOperatorExpression(UnaryOperatorExpression unaryOperatorExpression, object data) {
+ this.BeginVisit(unaryOperatorExpression);
+ object result = this.TrackedVisitUnaryOperatorExpression(unaryOperatorExpression, data);
+ this.EndVisit(unaryOperatorExpression);
+ return result;
+ }
+
+ public sealed override object VisitUncheckedExpression(UncheckedExpression uncheckedExpression, object data) {
+ this.BeginVisit(uncheckedExpression);
+ object result = this.TrackedVisitUncheckedExpression(uncheckedExpression, data);
+ this.EndVisit(uncheckedExpression);
+ return result;
+ }
+
+ public sealed override object VisitUncheckedStatement(UncheckedStatement uncheckedStatement, object data) {
+ this.BeginVisit(uncheckedStatement);
+ object result = this.TrackedVisitUncheckedStatement(uncheckedStatement, data);
+ this.EndVisit(uncheckedStatement);
+ return result;
+ }
+
+ public sealed override object VisitUnsafeStatement(UnsafeStatement unsafeStatement, object data) {
+ this.BeginVisit(unsafeStatement);
+ object result = this.TrackedVisitUnsafeStatement(unsafeStatement, data);
+ this.EndVisit(unsafeStatement);
+ return result;
+ }
+
+ public sealed override object VisitUsing(Using @using, object data) {
+ this.BeginVisit(@using);
+ object result = this.TrackedVisitUsing(@using, data);
+ this.EndVisit(@using);
+ return result;
+ }
+
+ public sealed override object VisitUsingDeclaration(UsingDeclaration usingDeclaration, object data) {
+ this.BeginVisit(usingDeclaration);
+ object result = this.TrackedVisitUsingDeclaration(usingDeclaration, data);
+ this.EndVisit(usingDeclaration);
+ return result;
+ }
+
+ public sealed override object VisitUsingStatement(UsingStatement usingStatement, object data) {
+ this.BeginVisit(usingStatement);
+ object result = this.TrackedVisitUsingStatement(usingStatement, data);
+ this.EndVisit(usingStatement);
+ return result;
+ }
+
+ public sealed override object VisitVariableDeclaration(VariableDeclaration variableDeclaration, object data) {
+ this.BeginVisit(variableDeclaration);
+ object result = this.TrackedVisitVariableDeclaration(variableDeclaration, data);
+ this.EndVisit(variableDeclaration);
+ return result;
+ }
+
+ public sealed override object VisitWithStatement(WithStatement withStatement, object data) {
+ this.BeginVisit(withStatement);
+ object result = this.TrackedVisitWithStatement(withStatement, data);
+ this.EndVisit(withStatement);
+ return result;
+ }
+
+ public sealed override object VisitYieldStatement(YieldStatement yieldStatement, object data) {
+ this.BeginVisit(yieldStatement);
+ object result = this.TrackedVisitYieldStatement(yieldStatement, data);
+ this.EndVisit(yieldStatement);
+ return result;
+ }
+
+ public virtual object TrackedVisitAddHandlerStatement(AddHandlerStatement addHandlerStatement, object data) {
+ return base.VisitAddHandlerStatement(addHandlerStatement, data);
+ }
+
+ public virtual object TrackedVisitAddressOfExpression(AddressOfExpression addressOfExpression, object data) {
+ return base.VisitAddressOfExpression(addressOfExpression, data);
+ }
+
+ public virtual object TrackedVisitAnonymousMethodExpression(AnonymousMethodExpression anonymousMethodExpression, object data) {
+ return base.VisitAnonymousMethodExpression(anonymousMethodExpression, data);
+ }
+
+ public virtual object TrackedVisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object data) {
+ return base.VisitArrayCreateExpression(arrayCreateExpression, data);
+ }
+
+ public virtual object TrackedVisitAssignmentExpression(AssignmentExpression assignmentExpression, object data) {
+ return base.VisitAssignmentExpression(assignmentExpression, data);
+ }
+
+ public virtual object TrackedVisitAttribute(ICSharpCode.NRefactory.Ast.Attribute attribute, object data) {
+ return base.VisitAttribute(attribute, data);
+ }
+
+ public virtual object TrackedVisitAttributeSection(AttributeSection attributeSection, object data) {
+ return base.VisitAttributeSection(attributeSection, data);
+ }
+
+ public virtual object TrackedVisitBaseReferenceExpression(BaseReferenceExpression baseReferenceExpression, object data) {
+ return base.VisitBaseReferenceExpression(baseReferenceExpression, data);
+ }
+
+ public virtual object TrackedVisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data) {
+ return base.VisitBinaryOperatorExpression(binaryOperatorExpression, data);
+ }
+
+ public virtual object TrackedVisitBlockStatement(BlockStatement blockStatement, object data) {
+ return base.VisitBlockStatement(blockStatement, data);
+ }
+
+ public virtual object TrackedVisitBreakStatement(BreakStatement breakStatement, object data) {
+ return base.VisitBreakStatement(breakStatement, data);
+ }
+
+ public virtual object TrackedVisitCaseLabel(CaseLabel caseLabel, object data) {
+ return base.VisitCaseLabel(caseLabel, data);
+ }
+
+ public virtual object TrackedVisitCastExpression(CastExpression castExpression, object data) {
+ return base.VisitCastExpression(castExpression, data);
+ }
+
+ public virtual object TrackedVisitCatchClause(CatchClause catchClause, object data) {
+ return base.VisitCatchClause(catchClause, data);
+ }
+
+ public virtual object TrackedVisitCheckedExpression(CheckedExpression checkedExpression, object data) {
+ return base.VisitCheckedExpression(checkedExpression, data);
+ }
+
+ public virtual object TrackedVisitCheckedStatement(CheckedStatement checkedStatement, object data) {
+ return base.VisitCheckedStatement(checkedStatement, data);
+ }
+
+ public virtual object TrackedVisitClassReferenceExpression(ClassReferenceExpression classReferenceExpression, object data) {
+ return base.VisitClassReferenceExpression(classReferenceExpression, data);
+ }
+
+ public virtual object TrackedVisitCollectionInitializerExpression(CollectionInitializerExpression collectionInitializerExpression, object data) {
+ return base.VisitCollectionInitializerExpression(collectionInitializerExpression, data);
+ }
+
+ public virtual object TrackedVisitCompilationUnit(CompilationUnit compilationUnit, object data) {
+ return base.VisitCompilationUnit(compilationUnit, data);
+ }
+
+ public virtual object TrackedVisitConditionalExpression(ConditionalExpression conditionalExpression, object data) {
+ return base.VisitConditionalExpression(conditionalExpression, data);
+ }
+
+ public virtual object TrackedVisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data) {
+ return base.VisitConstructorDeclaration(constructorDeclaration, data);
+ }
+
+ public virtual object TrackedVisitConstructorInitializer(ConstructorInitializer constructorInitializer, object data) {
+ return base.VisitConstructorInitializer(constructorInitializer, data);
+ }
+
+ public virtual object TrackedVisitContinueStatement(ContinueStatement continueStatement, object data) {
+ return base.VisitContinueStatement(continueStatement, data);
+ }
+
+ public virtual object TrackedVisitDeclareDeclaration(DeclareDeclaration declareDeclaration, object data) {
+ return base.VisitDeclareDeclaration(declareDeclaration, data);
+ }
+
+ public virtual object TrackedVisitDefaultValueExpression(DefaultValueExpression defaultValueExpression, object data) {
+ return base.VisitDefaultValueExpression(defaultValueExpression, data);
+ }
+
+ public virtual object TrackedVisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data) {
+ return base.VisitDelegateDeclaration(delegateDeclaration, data);
+ }
+
+ public virtual object TrackedVisitDestructorDeclaration(DestructorDeclaration destructorDeclaration, object data) {
+ return base.VisitDestructorDeclaration(destructorDeclaration, data);
+ }
+
+ public virtual object TrackedVisitDirectionExpression(DirectionExpression directionExpression, object data) {
+ return base.VisitDirectionExpression(directionExpression, data);
+ }
+
+ public virtual object TrackedVisitDoLoopStatement(DoLoopStatement doLoopStatement, object data) {
+ return base.VisitDoLoopStatement(doLoopStatement, data);
+ }
+
+ public virtual object TrackedVisitElseIfSection(ElseIfSection elseIfSection, object data) {
+ return base.VisitElseIfSection(elseIfSection, data);
+ }
+
+ public virtual object TrackedVisitEmptyStatement(EmptyStatement emptyStatement, object data) {
+ return base.VisitEmptyStatement(emptyStatement, data);
+ }
+
+ public virtual object TrackedVisitEndStatement(EndStatement endStatement, object data) {
+ return base.VisitEndStatement(endStatement, data);
+ }
+
+ public virtual object TrackedVisitEraseStatement(EraseStatement eraseStatement, object data) {
+ return base.VisitEraseStatement(eraseStatement, data);
+ }
+
+ public virtual object TrackedVisitErrorStatement(ErrorStatement errorStatement, object data) {
+ return base.VisitErrorStatement(errorStatement, data);
+ }
+
+ public virtual object TrackedVisitEventAddRegion(EventAddRegion eventAddRegion, object data) {
+ return base.VisitEventAddRegion(eventAddRegion, data);
+ }
+
+ public virtual object TrackedVisitEventDeclaration(EventDeclaration eventDeclaration, object data) {
+ return base.VisitEventDeclaration(eventDeclaration, data);
+ }
+
+ public virtual object TrackedVisitEventRaiseRegion(EventRaiseRegion eventRaiseRegion, object data) {
+ return base.VisitEventRaiseRegion(eventRaiseRegion, data);
+ }
+
+ public virtual object TrackedVisitEventRemoveRegion(EventRemoveRegion eventRemoveRegion, object data) {
+ return base.VisitEventRemoveRegion(eventRemoveRegion, data);
+ }
+
+ public virtual object TrackedVisitExitStatement(ExitStatement exitStatement, object data) {
+ return base.VisitExitStatement(exitStatement, data);
+ }
+
+ public virtual object TrackedVisitExpressionRangeVariable(ExpressionRangeVariable expressionRangeVariable, object data) {
+ return base.VisitExpressionRangeVariable(expressionRangeVariable, data);
+ }
+
+ public virtual object TrackedVisitExpressionStatement(ExpressionStatement expressionStatement, object data) {
+ return base.VisitExpressionStatement(expressionStatement, data);
+ }
+
+ public virtual object TrackedVisitExternAliasDirective(ExternAliasDirective externAliasDirective, object data) {
+ return base.VisitExternAliasDirective(externAliasDirective, data);
+ }
+
+ public virtual object TrackedVisitFieldDeclaration(FieldDeclaration fieldDeclaration, object data) {
+ return base.VisitFieldDeclaration(fieldDeclaration, data);
+ }
+
+ public virtual object TrackedVisitFixedStatement(FixedStatement fixedStatement, object data) {
+ return base.VisitFixedStatement(fixedStatement, data);
+ }
+
+ public virtual object TrackedVisitForeachStatement(ForeachStatement foreachStatement, object data) {
+ return base.VisitForeachStatement(foreachStatement, data);
+ }
+
+ public virtual object TrackedVisitForNextStatement(ForNextStatement forNextStatement, object data) {
+ return base.VisitForNextStatement(forNextStatement, data);
+ }
+
+ public virtual object TrackedVisitForStatement(ForStatement forStatement, object data) {
+ return base.VisitForStatement(forStatement, data);
+ }
+
+ public virtual object TrackedVisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, object data) {
+ return base.VisitGotoCaseStatement(gotoCaseStatement, data);
+ }
+
+ public virtual object TrackedVisitGotoStatement(GotoStatement gotoStatement, object data) {
+ return base.VisitGotoStatement(gotoStatement, data);
+ }
+
+ public virtual object TrackedVisitIdentifierExpression(IdentifierExpression identifierExpression, object data) {
+ return base.VisitIdentifierExpression(identifierExpression, data);
+ }
+
+ public virtual object TrackedVisitIfElseStatement(IfElseStatement ifElseStatement, object data) {
+ return base.VisitIfElseStatement(ifElseStatement, data);
+ }
+
+ public virtual object TrackedVisitIndexerDeclaration(IndexerDeclaration indexerDeclaration, object data) {
+ return base.VisitIndexerDeclaration(indexerDeclaration, data);
+ }
+
+ public virtual object TrackedVisitIndexerExpression(IndexerExpression indexerExpression, object data) {
+ return base.VisitIndexerExpression(indexerExpression, data);
+ }
+
+ public virtual object TrackedVisitInnerClassTypeReference(InnerClassTypeReference innerClassTypeReference, object data) {
+ return base.VisitInnerClassTypeReference(innerClassTypeReference, data);
+ }
+
+ public virtual object TrackedVisitInterfaceImplementation(InterfaceImplementation interfaceImplementation, object data) {
+ return base.VisitInterfaceImplementation(interfaceImplementation, data);
+ }
+
+ public virtual object TrackedVisitInvocationExpression(InvocationExpression invocationExpression, object data) {
+ return base.VisitInvocationExpression(invocationExpression, data);
+ }
+
+ public virtual object TrackedVisitLabelStatement(LabelStatement labelStatement, object data) {
+ return base.VisitLabelStatement(labelStatement, data);
+ }
+
+ public virtual object TrackedVisitLambdaExpression(LambdaExpression lambdaExpression, object data) {
+ return base.VisitLambdaExpression(lambdaExpression, data);
+ }
+
+ public virtual object TrackedVisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data) {
+ return base.VisitLocalVariableDeclaration(localVariableDeclaration, data);
+ }
+
+ public virtual object TrackedVisitLockStatement(LockStatement lockStatement, object data) {
+ return base.VisitLockStatement(lockStatement, data);
+ }
+
+ public virtual object TrackedVisitMemberReferenceExpression(MemberReferenceExpression memberReferenceExpression, object data) {
+ return base.VisitMemberReferenceExpression(memberReferenceExpression, data);
+ }
+
+ public virtual object TrackedVisitMethodDeclaration(MethodDeclaration methodDeclaration, object data) {
+ return base.VisitMethodDeclaration(methodDeclaration, data);
+ }
+
+ public virtual object TrackedVisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression, object data) {
+ return base.VisitNamedArgumentExpression(namedArgumentExpression, data);
+ }
+
+ public virtual object TrackedVisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, object data) {
+ return base.VisitNamespaceDeclaration(namespaceDeclaration, data);
+ }
+
+ public virtual object TrackedVisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression, object data) {
+ return base.VisitObjectCreateExpression(objectCreateExpression, data);
+ }
+
+ public virtual object TrackedVisitOnErrorStatement(OnErrorStatement onErrorStatement, object data) {
+ return base.VisitOnErrorStatement(onErrorStatement, data);
+ }
+
+ public virtual object TrackedVisitOperatorDeclaration(OperatorDeclaration operatorDeclaration, object data) {
+ return base.VisitOperatorDeclaration(operatorDeclaration, data);
+ }
+
+ public virtual object TrackedVisitOptionDeclaration(OptionDeclaration optionDeclaration, object data) {
+ return base.VisitOptionDeclaration(optionDeclaration, data);
+ }
+
+ public virtual object TrackedVisitParameterDeclarationExpression(ParameterDeclarationExpression parameterDeclarationExpression, object data) {
+ return base.VisitParameterDeclarationExpression(parameterDeclarationExpression, data);
+ }
+
+ public virtual object TrackedVisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression, object data) {
+ return base.VisitParenthesizedExpression(parenthesizedExpression, data);
+ }
+
+ public virtual object TrackedVisitPointerReferenceExpression(PointerReferenceExpression pointerReferenceExpression, object data) {
+ return base.VisitPointerReferenceExpression(pointerReferenceExpression, data);
+ }
+
+ public virtual object TrackedVisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data) {
+ return base.VisitPrimitiveExpression(primitiveExpression, data);
+ }
+
+ public virtual object TrackedVisitPropertyDeclaration(PropertyDeclaration propertyDeclaration, object data) {
+ return base.VisitPropertyDeclaration(propertyDeclaration, data);
+ }
+
+ public virtual object TrackedVisitPropertyGetRegion(PropertyGetRegion propertyGetRegion, object data) {
+ return base.VisitPropertyGetRegion(propertyGetRegion, data);
+ }
+
+ public virtual object TrackedVisitPropertySetRegion(PropertySetRegion propertySetRegion, object data) {
+ return base.VisitPropertySetRegion(propertySetRegion, data);
+ }
+
+ public virtual object TrackedVisitQueryExpression(QueryExpression queryExpression, object data) {
+ return base.VisitQueryExpression(queryExpression, data);
+ }
+
+ public virtual object TrackedVisitQueryExpressionAggregateClause(QueryExpressionAggregateClause queryExpressionAggregateClause, object data) {
+ return base.VisitQueryExpressionAggregateClause(queryExpressionAggregateClause, data);
+ }
+
+ public virtual object TrackedVisitQueryExpressionDistinctClause(QueryExpressionDistinctClause queryExpressionDistinctClause, object data) {
+ return base.VisitQueryExpressionDistinctClause(queryExpressionDistinctClause, data);
+ }
+
+ public virtual object TrackedVisitQueryExpressionFromClause(QueryExpressionFromClause queryExpressionFromClause, object data) {
+ return base.VisitQueryExpressionFromClause(queryExpressionFromClause, data);
+ }
+
+ public virtual object TrackedVisitQueryExpressionGroupClause(QueryExpressionGroupClause queryExpressionGroupClause, object data) {
+ return base.VisitQueryExpressionGroupClause(queryExpressionGroupClause, data);
+ }
+
+ public virtual object TrackedVisitQueryExpressionGroupJoinVBClause(QueryExpressionGroupJoinVBClause queryExpressionGroupJoinVBClause, object data) {
+ return base.VisitQueryExpressionGroupJoinVBClause(queryExpressionGroupJoinVBClause, data);
+ }
+
+ public virtual object TrackedVisitQueryExpressionGroupVBClause(QueryExpressionGroupVBClause queryExpressionGroupVBClause, object data) {
+ return base.VisitQueryExpressionGroupVBClause(queryExpressionGroupVBClause, data);
+ }
+
+ public virtual object TrackedVisitQueryExpressionJoinClause(QueryExpressionJoinClause queryExpressionJoinClause, object data) {
+ return base.VisitQueryExpressionJoinClause(queryExpressionJoinClause, data);
+ }
+
+ public virtual object TrackedVisitQueryExpressionJoinConditionVB(QueryExpressionJoinConditionVB queryExpressionJoinConditionVB, object data) {
+ return base.VisitQueryExpressionJoinConditionVB(queryExpressionJoinConditionVB, data);
+ }
+
+ public virtual object TrackedVisitQueryExpressionJoinVBClause(QueryExpressionJoinVBClause queryExpressionJoinVBClause, object data) {
+ return base.VisitQueryExpressionJoinVBClause(queryExpressionJoinVBClause, data);
+ }
+
+ public virtual object TrackedVisitQueryExpressionLetClause(QueryExpressionLetClause queryExpressionLetClause, object data) {
+ return base.VisitQueryExpressionLetClause(queryExpressionLetClause, data);
+ }
+
+ public virtual object TrackedVisitQueryExpressionLetVBClause(QueryExpressionLetVBClause queryExpressionLetVBClause, object data) {
+ return base.VisitQueryExpressionLetVBClause(queryExpressionLetVBClause, data);
+ }
+
+ public virtual object TrackedVisitQueryExpressionOrderClause(QueryExpressionOrderClause queryExpressionOrderClause, object data) {
+ return base.VisitQueryExpressionOrderClause(queryExpressionOrderClause, data);
+ }
+
+ public virtual object TrackedVisitQueryExpressionOrdering(QueryExpressionOrdering queryExpressionOrdering, object data) {
+ return base.VisitQueryExpressionOrdering(queryExpressionOrdering, data);
+ }
+
+ public virtual object TrackedVisitQueryExpressionPartitionVBClause(QueryExpressionPartitionVBClause queryExpressionPartitionVBClause, object data) {
+ return base.VisitQueryExpressionPartitionVBClause(queryExpressionPartitionVBClause, data);
+ }
+
+ public virtual object TrackedVisitQueryExpressionSelectClause(QueryExpressionSelectClause queryExpressionSelectClause, object data) {
+ return base.VisitQueryExpressionSelectClause(queryExpressionSelectClause, data);
+ }
+
+ public virtual object TrackedVisitQueryExpressionSelectVBClause(QueryExpressionSelectVBClause queryExpressionSelectVBClause, object data) {
+ return base.VisitQueryExpressionSelectVBClause(queryExpressionSelectVBClause, data);
+ }
+
+ public virtual object TrackedVisitQueryExpressionWhereClause(QueryExpressionWhereClause queryExpressionWhereClause, object data) {
+ return base.VisitQueryExpressionWhereClause(queryExpressionWhereClause, data);
+ }
+
+ public virtual object TrackedVisitRaiseEventStatement(RaiseEventStatement raiseEventStatement, object data) {
+ return base.VisitRaiseEventStatement(raiseEventStatement, data);
+ }
+
+ public virtual object TrackedVisitReDimStatement(ReDimStatement reDimStatement, object data) {
+ return base.VisitReDimStatement(reDimStatement, data);
+ }
+
+ public virtual object TrackedVisitRemoveHandlerStatement(RemoveHandlerStatement removeHandlerStatement, object data) {
+ return base.VisitRemoveHandlerStatement(removeHandlerStatement, data);
+ }
+
+ public virtual object TrackedVisitResumeStatement(ResumeStatement resumeStatement, object data) {
+ return base.VisitResumeStatement(resumeStatement, data);
+ }
+
+ public virtual object TrackedVisitReturnStatement(ReturnStatement returnStatement, object data) {
+ return base.VisitReturnStatement(returnStatement, data);
+ }
+
+ public virtual object TrackedVisitSizeOfExpression(SizeOfExpression sizeOfExpression, object data) {
+ return base.VisitSizeOfExpression(sizeOfExpression, data);
+ }
+
+ public virtual object TrackedVisitStackAllocExpression(StackAllocExpression stackAllocExpression, object data) {
+ return base.VisitStackAllocExpression(stackAllocExpression, data);
+ }
+
+ public virtual object TrackedVisitStopStatement(StopStatement stopStatement, object data) {
+ return base.VisitStopStatement(stopStatement, data);
+ }
+
+ public virtual object TrackedVisitSwitchSection(SwitchSection switchSection, object data) {
+ return base.VisitSwitchSection(switchSection, data);
+ }
+
+ public virtual object TrackedVisitSwitchStatement(SwitchStatement switchStatement, object data) {
+ return base.VisitSwitchStatement(switchStatement, data);
+ }
+
+ public virtual object TrackedVisitTemplateDefinition(TemplateDefinition templateDefinition, object data) {
+ return base.VisitTemplateDefinition(templateDefinition, data);
+ }
+
+ public virtual object TrackedVisitThisReferenceExpression(ThisReferenceExpression thisReferenceExpression, object data) {
+ return base.VisitThisReferenceExpression(thisReferenceExpression, data);
+ }
+
+ public virtual object TrackedVisitThrowStatement(ThrowStatement throwStatement, object data) {
+ return base.VisitThrowStatement(throwStatement, data);
+ }
+
+ public virtual object TrackedVisitTryCatchStatement(TryCatchStatement tryCatchStatement, object data) {
+ return base.VisitTryCatchStatement(tryCatchStatement, data);
+ }
+
+ public virtual object TrackedVisitTypeDeclaration(TypeDeclaration typeDeclaration, object data) {
+ return base.VisitTypeDeclaration(typeDeclaration, data);
+ }
+
+ public virtual object TrackedVisitTypeOfExpression(TypeOfExpression typeOfExpression, object data) {
+ return base.VisitTypeOfExpression(typeOfExpression, data);
+ }
+
+ public virtual object TrackedVisitTypeOfIsExpression(TypeOfIsExpression typeOfIsExpression, object data) {
+ return base.VisitTypeOfIsExpression(typeOfIsExpression, data);
+ }
+
+ public virtual object TrackedVisitTypeReference(TypeReference typeReference, object data) {
+ return base.VisitTypeReference(typeReference, data);
+ }
+
+ public virtual object TrackedVisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, object data) {
+ return base.VisitTypeReferenceExpression(typeReferenceExpression, data);
+ }
+
+ public virtual object TrackedVisitUnaryOperatorExpression(UnaryOperatorExpression unaryOperatorExpression, object data) {
+ return base.VisitUnaryOperatorExpression(unaryOperatorExpression, data);
+ }
+
+ public virtual object TrackedVisitUncheckedExpression(UncheckedExpression uncheckedExpression, object data) {
+ return base.VisitUncheckedExpression(uncheckedExpression, data);
+ }
+
+ public virtual object TrackedVisitUncheckedStatement(UncheckedStatement uncheckedStatement, object data) {
+ return base.VisitUncheckedStatement(uncheckedStatement, data);
+ }
+
+ public virtual object TrackedVisitUnsafeStatement(UnsafeStatement unsafeStatement, object data) {
+ return base.VisitUnsafeStatement(unsafeStatement, data);
+ }
+
+ public virtual object TrackedVisitUsing(Using @using, object data) {
+ return base.VisitUsing(@using, data);
+ }
+
+ public virtual object TrackedVisitUsingDeclaration(UsingDeclaration usingDeclaration, object data) {
+ return base.VisitUsingDeclaration(usingDeclaration, data);
+ }
+
+ public virtual object TrackedVisitUsingStatement(UsingStatement usingStatement, object data) {
+ return base.VisitUsingStatement(usingStatement, data);
+ }
+
+ public virtual object TrackedVisitVariableDeclaration(VariableDeclaration variableDeclaration, object data) {
+ return base.VisitVariableDeclaration(variableDeclaration, data);
+ }
+
+ public virtual object TrackedVisitWithStatement(WithStatement withStatement, object data) {
+ return base.VisitWithStatement(withStatement, data);
+ }
+
+ public virtual object TrackedVisitYieldStatement(YieldStatement yieldStatement, object data) {
+ return base.VisitYieldStatement(yieldStatement, data);
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Visitors/NotImplementedAstVisitor.cs b/main/contrib/NRefactory/Project/Src/Visitors/NotImplementedAstVisitor.cs
index 8c1fdb0102..a8f6a61c1e 100644
--- a/main/contrib/NRefactory/Project/Src/Visitors/NotImplementedAstVisitor.cs
+++ b/main/contrib/NRefactory/Project/Src/Visitors/NotImplementedAstVisitor.cs
@@ -1,509 +1,509 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:2.0.50727.3053
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace ICSharpCode.NRefactory.Visitors {
- using System;
- using ICSharpCode.NRefactory.Ast;
-
-
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.3053
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace ICSharpCode.NRefactory.Visitors {
+ using System;
+ using ICSharpCode.NRefactory.Ast;
+
+
/// <summary>
/// IAstVisitor implementation that always throws NotImplementedExceptions.
- /// </summary>
- public class NotImplementedAstVisitor : IAstVisitor {
-
- public virtual object VisitAddHandlerStatement(AddHandlerStatement addHandlerStatement, object data) {
- throw new global::System.NotImplementedException("AddHandlerStatement");
- }
-
- public virtual object VisitAddressOfExpression(AddressOfExpression addressOfExpression, object data) {
- throw new global::System.NotImplementedException("AddressOfExpression");
- }
-
- public virtual object VisitAnonymousMethodExpression(AnonymousMethodExpression anonymousMethodExpression, object data) {
- throw new global::System.NotImplementedException("AnonymousMethodExpression");
- }
-
- public virtual object VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object data) {
- throw new global::System.NotImplementedException("ArrayCreateExpression");
- }
-
- public virtual object VisitAssignmentExpression(AssignmentExpression assignmentExpression, object data) {
- throw new global::System.NotImplementedException("AssignmentExpression");
- }
-
- public virtual object VisitAttribute(ICSharpCode.NRefactory.Ast.Attribute attribute, object data) {
- throw new global::System.NotImplementedException("Attribute");
- }
-
- public virtual object VisitAttributeSection(AttributeSection attributeSection, object data) {
- throw new global::System.NotImplementedException("AttributeSection");
- }
-
- public virtual object VisitBaseReferenceExpression(BaseReferenceExpression baseReferenceExpression, object data) {
- throw new global::System.NotImplementedException("BaseReferenceExpression");
- }
-
- public virtual object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data) {
- throw new global::System.NotImplementedException("BinaryOperatorExpression");
- }
-
- public virtual object VisitBlockStatement(BlockStatement blockStatement, object data) {
- throw new global::System.NotImplementedException("BlockStatement");
- }
-
- public virtual object VisitBreakStatement(BreakStatement breakStatement, object data) {
- throw new global::System.NotImplementedException("BreakStatement");
- }
-
- public virtual object VisitCaseLabel(CaseLabel caseLabel, object data) {
- throw new global::System.NotImplementedException("CaseLabel");
- }
-
- public virtual object VisitCastExpression(CastExpression castExpression, object data) {
- throw new global::System.NotImplementedException("CastExpression");
- }
-
- public virtual object VisitCatchClause(CatchClause catchClause, object data) {
- throw new global::System.NotImplementedException("CatchClause");
- }
-
- public virtual object VisitCheckedExpression(CheckedExpression checkedExpression, object data) {
- throw new global::System.NotImplementedException("CheckedExpression");
- }
-
- public virtual object VisitCheckedStatement(CheckedStatement checkedStatement, object data) {
- throw new global::System.NotImplementedException("CheckedStatement");
- }
-
- public virtual object VisitClassReferenceExpression(ClassReferenceExpression classReferenceExpression, object data) {
- throw new global::System.NotImplementedException("ClassReferenceExpression");
- }
-
- public virtual object VisitCollectionInitializerExpression(CollectionInitializerExpression collectionInitializerExpression, object data) {
- throw new global::System.NotImplementedException("CollectionInitializerExpression");
- }
-
- public virtual object VisitCompilationUnit(CompilationUnit compilationUnit, object data) {
- throw new global::System.NotImplementedException("CompilationUnit");
- }
-
- public virtual object VisitConditionalExpression(ConditionalExpression conditionalExpression, object data) {
- throw new global::System.NotImplementedException("ConditionalExpression");
- }
-
- public virtual object VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data) {
- throw new global::System.NotImplementedException("ConstructorDeclaration");
- }
-
- public virtual object VisitConstructorInitializer(ConstructorInitializer constructorInitializer, object data) {
- throw new global::System.NotImplementedException("ConstructorInitializer");
- }
-
- public virtual object VisitContinueStatement(ContinueStatement continueStatement, object data) {
- throw new global::System.NotImplementedException("ContinueStatement");
- }
-
- public virtual object VisitDeclareDeclaration(DeclareDeclaration declareDeclaration, object data) {
- throw new global::System.NotImplementedException("DeclareDeclaration");
- }
-
- public virtual object VisitDefaultValueExpression(DefaultValueExpression defaultValueExpression, object data) {
- throw new global::System.NotImplementedException("DefaultValueExpression");
- }
-
- public virtual object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data) {
- throw new global::System.NotImplementedException("DelegateDeclaration");
- }
-
- public virtual object VisitDestructorDeclaration(DestructorDeclaration destructorDeclaration, object data) {
- throw new global::System.NotImplementedException("DestructorDeclaration");
- }
-
- public virtual object VisitDirectionExpression(DirectionExpression directionExpression, object data) {
- throw new global::System.NotImplementedException("DirectionExpression");
- }
-
- public virtual object VisitDoLoopStatement(DoLoopStatement doLoopStatement, object data) {
- throw new global::System.NotImplementedException("DoLoopStatement");
- }
-
- public virtual object VisitElseIfSection(ElseIfSection elseIfSection, object data) {
- throw new global::System.NotImplementedException("ElseIfSection");
- }
-
- public virtual object VisitEmptyStatement(EmptyStatement emptyStatement, object data) {
- throw new global::System.NotImplementedException("EmptyStatement");
- }
-
- public virtual object VisitEndStatement(EndStatement endStatement, object data) {
- throw new global::System.NotImplementedException("EndStatement");
- }
-
- public virtual object VisitEraseStatement(EraseStatement eraseStatement, object data) {
- throw new global::System.NotImplementedException("EraseStatement");
- }
-
- public virtual object VisitErrorStatement(ErrorStatement errorStatement, object data) {
- throw new global::System.NotImplementedException("ErrorStatement");
- }
-
- public virtual object VisitEventAddRegion(EventAddRegion eventAddRegion, object data) {
- throw new global::System.NotImplementedException("EventAddRegion");
- }
-
- public virtual object VisitEventDeclaration(EventDeclaration eventDeclaration, object data) {
- throw new global::System.NotImplementedException("EventDeclaration");
- }
-
- public virtual object VisitEventRaiseRegion(EventRaiseRegion eventRaiseRegion, object data) {
- throw new global::System.NotImplementedException("EventRaiseRegion");
- }
-
- public virtual object VisitEventRemoveRegion(EventRemoveRegion eventRemoveRegion, object data) {
- throw new global::System.NotImplementedException("EventRemoveRegion");
- }
-
- public virtual object VisitExitStatement(ExitStatement exitStatement, object data) {
- throw new global::System.NotImplementedException("ExitStatement");
- }
-
- public virtual object VisitExpressionRangeVariable(ExpressionRangeVariable expressionRangeVariable, object data) {
- throw new global::System.NotImplementedException("ExpressionRangeVariable");
- }
-
- public virtual object VisitExpressionStatement(ExpressionStatement expressionStatement, object data) {
- throw new global::System.NotImplementedException("ExpressionStatement");
- }
-
- public virtual object VisitExternAliasDirective(ExternAliasDirective externAliasDirective, object data) {
- throw new global::System.NotImplementedException("ExternAliasDirective");
- }
-
- public virtual object VisitFieldDeclaration(FieldDeclaration fieldDeclaration, object data) {
- throw new global::System.NotImplementedException("FieldDeclaration");
- }
-
- public virtual object VisitFixedStatement(FixedStatement fixedStatement, object data) {
- throw new global::System.NotImplementedException("FixedStatement");
- }
-
- public virtual object VisitForeachStatement(ForeachStatement foreachStatement, object data) {
- throw new global::System.NotImplementedException("ForeachStatement");
- }
-
- public virtual object VisitForNextStatement(ForNextStatement forNextStatement, object data) {
- throw new global::System.NotImplementedException("ForNextStatement");
- }
-
- public virtual object VisitForStatement(ForStatement forStatement, object data) {
- throw new global::System.NotImplementedException("ForStatement");
- }
-
- public virtual object VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, object data) {
- throw new global::System.NotImplementedException("GotoCaseStatement");
- }
-
- public virtual object VisitGotoStatement(GotoStatement gotoStatement, object data) {
- throw new global::System.NotImplementedException("GotoStatement");
- }
-
- public virtual object VisitIdentifierExpression(IdentifierExpression identifierExpression, object data) {
- throw new global::System.NotImplementedException("IdentifierExpression");
- }
-
- public virtual object VisitIfElseStatement(IfElseStatement ifElseStatement, object data) {
- throw new global::System.NotImplementedException("IfElseStatement");
- }
-
- public virtual object VisitIndexerDeclaration(IndexerDeclaration indexerDeclaration, object data) {
- throw new global::System.NotImplementedException("IndexerDeclaration");
- }
-
- public virtual object VisitIndexerExpression(IndexerExpression indexerExpression, object data) {
- throw new global::System.NotImplementedException("IndexerExpression");
- }
-
- public virtual object VisitInnerClassTypeReference(InnerClassTypeReference innerClassTypeReference, object data) {
- throw new global::System.NotImplementedException("InnerClassTypeReference");
- }
-
- public virtual object VisitInterfaceImplementation(InterfaceImplementation interfaceImplementation, object data) {
- throw new global::System.NotImplementedException("InterfaceImplementation");
- }
-
- public virtual object VisitInvocationExpression(InvocationExpression invocationExpression, object data) {
- throw new global::System.NotImplementedException("InvocationExpression");
- }
-
- public virtual object VisitLabelStatement(LabelStatement labelStatement, object data) {
- throw new global::System.NotImplementedException("LabelStatement");
- }
-
- public virtual object VisitLambdaExpression(LambdaExpression lambdaExpression, object data) {
- throw new global::System.NotImplementedException("LambdaExpression");
- }
-
- public virtual object VisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data) {
- throw new global::System.NotImplementedException("LocalVariableDeclaration");
- }
-
- public virtual object VisitLockStatement(LockStatement lockStatement, object data) {
- throw new global::System.NotImplementedException("LockStatement");
- }
-
- public virtual object VisitMemberReferenceExpression(MemberReferenceExpression memberReferenceExpression, object data) {
- throw new global::System.NotImplementedException("MemberReferenceExpression");
- }
-
- public virtual object VisitMethodDeclaration(MethodDeclaration methodDeclaration, object data) {
- throw new global::System.NotImplementedException("MethodDeclaration");
- }
-
- public virtual object VisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression, object data) {
- throw new global::System.NotImplementedException("NamedArgumentExpression");
- }
-
- public virtual object VisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, object data) {
- throw new global::System.NotImplementedException("NamespaceDeclaration");
- }
-
- public virtual object VisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression, object data) {
- throw new global::System.NotImplementedException("ObjectCreateExpression");
- }
-
- public virtual object VisitOnErrorStatement(OnErrorStatement onErrorStatement, object data) {
- throw new global::System.NotImplementedException("OnErrorStatement");
- }
-
- public virtual object VisitOperatorDeclaration(OperatorDeclaration operatorDeclaration, object data) {
- throw new global::System.NotImplementedException("OperatorDeclaration");
- }
-
- public virtual object VisitOptionDeclaration(OptionDeclaration optionDeclaration, object data) {
- throw new global::System.NotImplementedException("OptionDeclaration");
- }
-
- public virtual object VisitParameterDeclarationExpression(ParameterDeclarationExpression parameterDeclarationExpression, object data) {
- throw new global::System.NotImplementedException("ParameterDeclarationExpression");
- }
-
- public virtual object VisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression, object data) {
- throw new global::System.NotImplementedException("ParenthesizedExpression");
- }
-
- public virtual object VisitPointerReferenceExpression(PointerReferenceExpression pointerReferenceExpression, object data) {
- throw new global::System.NotImplementedException("PointerReferenceExpression");
- }
-
- public virtual object VisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data) {
- throw new global::System.NotImplementedException("PrimitiveExpression");
- }
-
- public virtual object VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration, object data) {
- throw new global::System.NotImplementedException("PropertyDeclaration");
- }
-
- public virtual object VisitPropertyGetRegion(PropertyGetRegion propertyGetRegion, object data) {
- throw new global::System.NotImplementedException("PropertyGetRegion");
- }
-
- public virtual object VisitPropertySetRegion(PropertySetRegion propertySetRegion, object data) {
- throw new global::System.NotImplementedException("PropertySetRegion");
- }
-
- public virtual object VisitQueryExpression(QueryExpression queryExpression, object data) {
- throw new global::System.NotImplementedException("QueryExpression");
- }
-
- public virtual object VisitQueryExpressionAggregateClause(QueryExpressionAggregateClause queryExpressionAggregateClause, object data) {
- throw new global::System.NotImplementedException("QueryExpressionAggregateClause");
- }
-
- public virtual object VisitQueryExpressionDistinctClause(QueryExpressionDistinctClause queryExpressionDistinctClause, object data) {
- throw new global::System.NotImplementedException("QueryExpressionDistinctClause");
- }
-
- public virtual object VisitQueryExpressionFromClause(QueryExpressionFromClause queryExpressionFromClause, object data) {
- throw new global::System.NotImplementedException("QueryExpressionFromClause");
- }
-
- public virtual object VisitQueryExpressionGroupClause(QueryExpressionGroupClause queryExpressionGroupClause, object data) {
- throw new global::System.NotImplementedException("QueryExpressionGroupClause");
- }
-
- public virtual object VisitQueryExpressionGroupJoinVBClause(QueryExpressionGroupJoinVBClause queryExpressionGroupJoinVBClause, object data) {
- throw new global::System.NotImplementedException("QueryExpressionGroupJoinVBClause");
- }
-
- public virtual object VisitQueryExpressionGroupVBClause(QueryExpressionGroupVBClause queryExpressionGroupVBClause, object data) {
- throw new global::System.NotImplementedException("QueryExpressionGroupVBClause");
- }
-
- public virtual object VisitQueryExpressionJoinClause(QueryExpressionJoinClause queryExpressionJoinClause, object data) {
- throw new global::System.NotImplementedException("QueryExpressionJoinClause");
- }
-
- public virtual object VisitQueryExpressionJoinConditionVB(QueryExpressionJoinConditionVB queryExpressionJoinConditionVB, object data) {
- throw new global::System.NotImplementedException("QueryExpressionJoinConditionVB");
- }
-
- public virtual object VisitQueryExpressionJoinVBClause(QueryExpressionJoinVBClause queryExpressionJoinVBClause, object data) {
- throw new global::System.NotImplementedException("QueryExpressionJoinVBClause");
- }
-
- public virtual object VisitQueryExpressionLetClause(QueryExpressionLetClause queryExpressionLetClause, object data) {
- throw new global::System.NotImplementedException("QueryExpressionLetClause");
- }
-
- public virtual object VisitQueryExpressionLetVBClause(QueryExpressionLetVBClause queryExpressionLetVBClause, object data) {
- throw new global::System.NotImplementedException("QueryExpressionLetVBClause");
- }
-
- public virtual object VisitQueryExpressionOrderClause(QueryExpressionOrderClause queryExpressionOrderClause, object data) {
- throw new global::System.NotImplementedException("QueryExpressionOrderClause");
- }
-
- public virtual object VisitQueryExpressionOrdering(QueryExpressionOrdering queryExpressionOrdering, object data) {
- throw new global::System.NotImplementedException("QueryExpressionOrdering");
- }
-
- public virtual object VisitQueryExpressionPartitionVBClause(QueryExpressionPartitionVBClause queryExpressionPartitionVBClause, object data) {
- throw new global::System.NotImplementedException("QueryExpressionPartitionVBClause");
- }
-
- public virtual object VisitQueryExpressionSelectClause(QueryExpressionSelectClause queryExpressionSelectClause, object data) {
- throw new global::System.NotImplementedException("QueryExpressionSelectClause");
- }
-
- public virtual object VisitQueryExpressionSelectVBClause(QueryExpressionSelectVBClause queryExpressionSelectVBClause, object data) {
- throw new global::System.NotImplementedException("QueryExpressionSelectVBClause");
- }
-
- public virtual object VisitQueryExpressionWhereClause(QueryExpressionWhereClause queryExpressionWhereClause, object data) {
- throw new global::System.NotImplementedException("QueryExpressionWhereClause");
- }
-
- public virtual object VisitRaiseEventStatement(RaiseEventStatement raiseEventStatement, object data) {
- throw new global::System.NotImplementedException("RaiseEventStatement");
- }
-
- public virtual object VisitReDimStatement(ReDimStatement reDimStatement, object data) {
- throw new global::System.NotImplementedException("ReDimStatement");
- }
-
- public virtual object VisitRemoveHandlerStatement(RemoveHandlerStatement removeHandlerStatement, object data) {
- throw new global::System.NotImplementedException("RemoveHandlerStatement");
- }
-
- public virtual object VisitResumeStatement(ResumeStatement resumeStatement, object data) {
- throw new global::System.NotImplementedException("ResumeStatement");
- }
-
- public virtual object VisitReturnStatement(ReturnStatement returnStatement, object data) {
- throw new global::System.NotImplementedException("ReturnStatement");
- }
-
- public virtual object VisitSizeOfExpression(SizeOfExpression sizeOfExpression, object data) {
- throw new global::System.NotImplementedException("SizeOfExpression");
- }
-
- public virtual object VisitStackAllocExpression(StackAllocExpression stackAllocExpression, object data) {
- throw new global::System.NotImplementedException("StackAllocExpression");
- }
-
- public virtual object VisitStopStatement(StopStatement stopStatement, object data) {
- throw new global::System.NotImplementedException("StopStatement");
- }
-
- public virtual object VisitSwitchSection(SwitchSection switchSection, object data) {
- throw new global::System.NotImplementedException("SwitchSection");
- }
-
- public virtual object VisitSwitchStatement(SwitchStatement switchStatement, object data) {
- throw new global::System.NotImplementedException("SwitchStatement");
- }
-
- public virtual object VisitTemplateDefinition(TemplateDefinition templateDefinition, object data) {
- throw new global::System.NotImplementedException("TemplateDefinition");
- }
-
- public virtual object VisitThisReferenceExpression(ThisReferenceExpression thisReferenceExpression, object data) {
- throw new global::System.NotImplementedException("ThisReferenceExpression");
- }
-
- public virtual object VisitThrowStatement(ThrowStatement throwStatement, object data) {
- throw new global::System.NotImplementedException("ThrowStatement");
- }
-
- public virtual object VisitTryCatchStatement(TryCatchStatement tryCatchStatement, object data) {
- throw new global::System.NotImplementedException("TryCatchStatement");
- }
-
- public virtual object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data) {
- throw new global::System.NotImplementedException("TypeDeclaration");
- }
-
- public virtual object VisitTypeOfExpression(TypeOfExpression typeOfExpression, object data) {
- throw new global::System.NotImplementedException("TypeOfExpression");
- }
-
- public virtual object VisitTypeOfIsExpression(TypeOfIsExpression typeOfIsExpression, object data) {
- throw new global::System.NotImplementedException("TypeOfIsExpression");
- }
-
- public virtual object VisitTypeReference(TypeReference typeReference, object data) {
- throw new global::System.NotImplementedException("TypeReference");
- }
-
- public virtual object VisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, object data) {
- throw new global::System.NotImplementedException("TypeReferenceExpression");
- }
-
- public virtual object VisitUnaryOperatorExpression(UnaryOperatorExpression unaryOperatorExpression, object data) {
- throw new global::System.NotImplementedException("UnaryOperatorExpression");
- }
-
- public virtual object VisitUncheckedExpression(UncheckedExpression uncheckedExpression, object data) {
- throw new global::System.NotImplementedException("UncheckedExpression");
- }
-
- public virtual object VisitUncheckedStatement(UncheckedStatement uncheckedStatement, object data) {
- throw new global::System.NotImplementedException("UncheckedStatement");
- }
-
- public virtual object VisitUnsafeStatement(UnsafeStatement unsafeStatement, object data) {
- throw new global::System.NotImplementedException("UnsafeStatement");
- }
-
- public virtual object VisitUsing(Using @using, object data) {
- throw new global::System.NotImplementedException("Using");
- }
-
- public virtual object VisitUsingDeclaration(UsingDeclaration usingDeclaration, object data) {
- throw new global::System.NotImplementedException("UsingDeclaration");
- }
-
- public virtual object VisitUsingStatement(UsingStatement usingStatement, object data) {
- throw new global::System.NotImplementedException("UsingStatement");
- }
-
- public virtual object VisitVariableDeclaration(VariableDeclaration variableDeclaration, object data) {
- throw new global::System.NotImplementedException("VariableDeclaration");
- }
-
- public virtual object VisitWithStatement(WithStatement withStatement, object data) {
- throw new global::System.NotImplementedException("WithStatement");
- }
-
- public virtual object VisitYieldStatement(YieldStatement yieldStatement, object data) {
- throw new global::System.NotImplementedException("YieldStatement");
- }
- }
-}
+ /// </summary>
+ public class NotImplementedAstVisitor : IAstVisitor {
+
+ public virtual object VisitAddHandlerStatement(AddHandlerStatement addHandlerStatement, object data) {
+ throw new global::System.NotImplementedException("AddHandlerStatement");
+ }
+
+ public virtual object VisitAddressOfExpression(AddressOfExpression addressOfExpression, object data) {
+ throw new global::System.NotImplementedException("AddressOfExpression");
+ }
+
+ public virtual object VisitAnonymousMethodExpression(AnonymousMethodExpression anonymousMethodExpression, object data) {
+ throw new global::System.NotImplementedException("AnonymousMethodExpression");
+ }
+
+ public virtual object VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object data) {
+ throw new global::System.NotImplementedException("ArrayCreateExpression");
+ }
+
+ public virtual object VisitAssignmentExpression(AssignmentExpression assignmentExpression, object data) {
+ throw new global::System.NotImplementedException("AssignmentExpression");
+ }
+
+ public virtual object VisitAttribute(ICSharpCode.NRefactory.Ast.Attribute attribute, object data) {
+ throw new global::System.NotImplementedException("Attribute");
+ }
+
+ public virtual object VisitAttributeSection(AttributeSection attributeSection, object data) {
+ throw new global::System.NotImplementedException("AttributeSection");
+ }
+
+ public virtual object VisitBaseReferenceExpression(BaseReferenceExpression baseReferenceExpression, object data) {
+ throw new global::System.NotImplementedException("BaseReferenceExpression");
+ }
+
+ public virtual object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data) {
+ throw new global::System.NotImplementedException("BinaryOperatorExpression");
+ }
+
+ public virtual object VisitBlockStatement(BlockStatement blockStatement, object data) {
+ throw new global::System.NotImplementedException("BlockStatement");
+ }
+
+ public virtual object VisitBreakStatement(BreakStatement breakStatement, object data) {
+ throw new global::System.NotImplementedException("BreakStatement");
+ }
+
+ public virtual object VisitCaseLabel(CaseLabel caseLabel, object data) {
+ throw new global::System.NotImplementedException("CaseLabel");
+ }
+
+ public virtual object VisitCastExpression(CastExpression castExpression, object data) {
+ throw new global::System.NotImplementedException("CastExpression");
+ }
+
+ public virtual object VisitCatchClause(CatchClause catchClause, object data) {
+ throw new global::System.NotImplementedException("CatchClause");
+ }
+
+ public virtual object VisitCheckedExpression(CheckedExpression checkedExpression, object data) {
+ throw new global::System.NotImplementedException("CheckedExpression");
+ }
+
+ public virtual object VisitCheckedStatement(CheckedStatement checkedStatement, object data) {
+ throw new global::System.NotImplementedException("CheckedStatement");
+ }
+
+ public virtual object VisitClassReferenceExpression(ClassReferenceExpression classReferenceExpression, object data) {
+ throw new global::System.NotImplementedException("ClassReferenceExpression");
+ }
+
+ public virtual object VisitCollectionInitializerExpression(CollectionInitializerExpression collectionInitializerExpression, object data) {
+ throw new global::System.NotImplementedException("CollectionInitializerExpression");
+ }
+
+ public virtual object VisitCompilationUnit(CompilationUnit compilationUnit, object data) {
+ throw new global::System.NotImplementedException("CompilationUnit");
+ }
+
+ public virtual object VisitConditionalExpression(ConditionalExpression conditionalExpression, object data) {
+ throw new global::System.NotImplementedException("ConditionalExpression");
+ }
+
+ public virtual object VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data) {
+ throw new global::System.NotImplementedException("ConstructorDeclaration");
+ }
+
+ public virtual object VisitConstructorInitializer(ConstructorInitializer constructorInitializer, object data) {
+ throw new global::System.NotImplementedException("ConstructorInitializer");
+ }
+
+ public virtual object VisitContinueStatement(ContinueStatement continueStatement, object data) {
+ throw new global::System.NotImplementedException("ContinueStatement");
+ }
+
+ public virtual object VisitDeclareDeclaration(DeclareDeclaration declareDeclaration, object data) {
+ throw new global::System.NotImplementedException("DeclareDeclaration");
+ }
+
+ public virtual object VisitDefaultValueExpression(DefaultValueExpression defaultValueExpression, object data) {
+ throw new global::System.NotImplementedException("DefaultValueExpression");
+ }
+
+ public virtual object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data) {
+ throw new global::System.NotImplementedException("DelegateDeclaration");
+ }
+
+ public virtual object VisitDestructorDeclaration(DestructorDeclaration destructorDeclaration, object data) {
+ throw new global::System.NotImplementedException("DestructorDeclaration");
+ }
+
+ public virtual object VisitDirectionExpression(DirectionExpression directionExpression, object data) {
+ throw new global::System.NotImplementedException("DirectionExpression");
+ }
+
+ public virtual object VisitDoLoopStatement(DoLoopStatement doLoopStatement, object data) {
+ throw new global::System.NotImplementedException("DoLoopStatement");
+ }
+
+ public virtual object VisitElseIfSection(ElseIfSection elseIfSection, object data) {
+ throw new global::System.NotImplementedException("ElseIfSection");
+ }
+
+ public virtual object VisitEmptyStatement(EmptyStatement emptyStatement, object data) {
+ throw new global::System.NotImplementedException("EmptyStatement");
+ }
+
+ public virtual object VisitEndStatement(EndStatement endStatement, object data) {
+ throw new global::System.NotImplementedException("EndStatement");
+ }
+
+ public virtual object VisitEraseStatement(EraseStatement eraseStatement, object data) {
+ throw new global::System.NotImplementedException("EraseStatement");
+ }
+
+ public virtual object VisitErrorStatement(ErrorStatement errorStatement, object data) {
+ throw new global::System.NotImplementedException("ErrorStatement");
+ }
+
+ public virtual object VisitEventAddRegion(EventAddRegion eventAddRegion, object data) {
+ throw new global::System.NotImplementedException("EventAddRegion");
+ }
+
+ public virtual object VisitEventDeclaration(EventDeclaration eventDeclaration, object data) {
+ throw new global::System.NotImplementedException("EventDeclaration");
+ }
+
+ public virtual object VisitEventRaiseRegion(EventRaiseRegion eventRaiseRegion, object data) {
+ throw new global::System.NotImplementedException("EventRaiseRegion");
+ }
+
+ public virtual object VisitEventRemoveRegion(EventRemoveRegion eventRemoveRegion, object data) {
+ throw new global::System.NotImplementedException("EventRemoveRegion");
+ }
+
+ public virtual object VisitExitStatement(ExitStatement exitStatement, object data) {
+ throw new global::System.NotImplementedException("ExitStatement");
+ }
+
+ public virtual object VisitExpressionRangeVariable(ExpressionRangeVariable expressionRangeVariable, object data) {
+ throw new global::System.NotImplementedException("ExpressionRangeVariable");
+ }
+
+ public virtual object VisitExpressionStatement(ExpressionStatement expressionStatement, object data) {
+ throw new global::System.NotImplementedException("ExpressionStatement");
+ }
+
+ public virtual object VisitExternAliasDirective(ExternAliasDirective externAliasDirective, object data) {
+ throw new global::System.NotImplementedException("ExternAliasDirective");
+ }
+
+ public virtual object VisitFieldDeclaration(FieldDeclaration fieldDeclaration, object data) {
+ throw new global::System.NotImplementedException("FieldDeclaration");
+ }
+
+ public virtual object VisitFixedStatement(FixedStatement fixedStatement, object data) {
+ throw new global::System.NotImplementedException("FixedStatement");
+ }
+
+ public virtual object VisitForeachStatement(ForeachStatement foreachStatement, object data) {
+ throw new global::System.NotImplementedException("ForeachStatement");
+ }
+
+ public virtual object VisitForNextStatement(ForNextStatement forNextStatement, object data) {
+ throw new global::System.NotImplementedException("ForNextStatement");
+ }
+
+ public virtual object VisitForStatement(ForStatement forStatement, object data) {
+ throw new global::System.NotImplementedException("ForStatement");
+ }
+
+ public virtual object VisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, object data) {
+ throw new global::System.NotImplementedException("GotoCaseStatement");
+ }
+
+ public virtual object VisitGotoStatement(GotoStatement gotoStatement, object data) {
+ throw new global::System.NotImplementedException("GotoStatement");
+ }
+
+ public virtual object VisitIdentifierExpression(IdentifierExpression identifierExpression, object data) {
+ throw new global::System.NotImplementedException("IdentifierExpression");
+ }
+
+ public virtual object VisitIfElseStatement(IfElseStatement ifElseStatement, object data) {
+ throw new global::System.NotImplementedException("IfElseStatement");
+ }
+
+ public virtual object VisitIndexerDeclaration(IndexerDeclaration indexerDeclaration, object data) {
+ throw new global::System.NotImplementedException("IndexerDeclaration");
+ }
+
+ public virtual object VisitIndexerExpression(IndexerExpression indexerExpression, object data) {
+ throw new global::System.NotImplementedException("IndexerExpression");
+ }
+
+ public virtual object VisitInnerClassTypeReference(InnerClassTypeReference innerClassTypeReference, object data) {
+ throw new global::System.NotImplementedException("InnerClassTypeReference");
+ }
+
+ public virtual object VisitInterfaceImplementation(InterfaceImplementation interfaceImplementation, object data) {
+ throw new global::System.NotImplementedException("InterfaceImplementation");
+ }
+
+ public virtual object VisitInvocationExpression(InvocationExpression invocationExpression, object data) {
+ throw new global::System.NotImplementedException("InvocationExpression");
+ }
+
+ public virtual object VisitLabelStatement(LabelStatement labelStatement, object data) {
+ throw new global::System.NotImplementedException("LabelStatement");
+ }
+
+ public virtual object VisitLambdaExpression(LambdaExpression lambdaExpression, object data) {
+ throw new global::System.NotImplementedException("LambdaExpression");
+ }
+
+ public virtual object VisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data) {
+ throw new global::System.NotImplementedException("LocalVariableDeclaration");
+ }
+
+ public virtual object VisitLockStatement(LockStatement lockStatement, object data) {
+ throw new global::System.NotImplementedException("LockStatement");
+ }
+
+ public virtual object VisitMemberReferenceExpression(MemberReferenceExpression memberReferenceExpression, object data) {
+ throw new global::System.NotImplementedException("MemberReferenceExpression");
+ }
+
+ public virtual object VisitMethodDeclaration(MethodDeclaration methodDeclaration, object data) {
+ throw new global::System.NotImplementedException("MethodDeclaration");
+ }
+
+ public virtual object VisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression, object data) {
+ throw new global::System.NotImplementedException("NamedArgumentExpression");
+ }
+
+ public virtual object VisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration, object data) {
+ throw new global::System.NotImplementedException("NamespaceDeclaration");
+ }
+
+ public virtual object VisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression, object data) {
+ throw new global::System.NotImplementedException("ObjectCreateExpression");
+ }
+
+ public virtual object VisitOnErrorStatement(OnErrorStatement onErrorStatement, object data) {
+ throw new global::System.NotImplementedException("OnErrorStatement");
+ }
+
+ public virtual object VisitOperatorDeclaration(OperatorDeclaration operatorDeclaration, object data) {
+ throw new global::System.NotImplementedException("OperatorDeclaration");
+ }
+
+ public virtual object VisitOptionDeclaration(OptionDeclaration optionDeclaration, object data) {
+ throw new global::System.NotImplementedException("OptionDeclaration");
+ }
+
+ public virtual object VisitParameterDeclarationExpression(ParameterDeclarationExpression parameterDeclarationExpression, object data) {
+ throw new global::System.NotImplementedException("ParameterDeclarationExpression");
+ }
+
+ public virtual object VisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression, object data) {
+ throw new global::System.NotImplementedException("ParenthesizedExpression");
+ }
+
+ public virtual object VisitPointerReferenceExpression(PointerReferenceExpression pointerReferenceExpression, object data) {
+ throw new global::System.NotImplementedException("PointerReferenceExpression");
+ }
+
+ public virtual object VisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data) {
+ throw new global::System.NotImplementedException("PrimitiveExpression");
+ }
+
+ public virtual object VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration, object data) {
+ throw new global::System.NotImplementedException("PropertyDeclaration");
+ }
+
+ public virtual object VisitPropertyGetRegion(PropertyGetRegion propertyGetRegion, object data) {
+ throw new global::System.NotImplementedException("PropertyGetRegion");
+ }
+
+ public virtual object VisitPropertySetRegion(PropertySetRegion propertySetRegion, object data) {
+ throw new global::System.NotImplementedException("PropertySetRegion");
+ }
+
+ public virtual object VisitQueryExpression(QueryExpression queryExpression, object data) {
+ throw new global::System.NotImplementedException("QueryExpression");
+ }
+
+ public virtual object VisitQueryExpressionAggregateClause(QueryExpressionAggregateClause queryExpressionAggregateClause, object data) {
+ throw new global::System.NotImplementedException("QueryExpressionAggregateClause");
+ }
+
+ public virtual object VisitQueryExpressionDistinctClause(QueryExpressionDistinctClause queryExpressionDistinctClause, object data) {
+ throw new global::System.NotImplementedException("QueryExpressionDistinctClause");
+ }
+
+ public virtual object VisitQueryExpressionFromClause(QueryExpressionFromClause queryExpressionFromClause, object data) {
+ throw new global::System.NotImplementedException("QueryExpressionFromClause");
+ }
+
+ public virtual object VisitQueryExpressionGroupClause(QueryExpressionGroupClause queryExpressionGroupClause, object data) {
+ throw new global::System.NotImplementedException("QueryExpressionGroupClause");
+ }
+
+ public virtual object VisitQueryExpressionGroupJoinVBClause(QueryExpressionGroupJoinVBClause queryExpressionGroupJoinVBClause, object data) {
+ throw new global::System.NotImplementedException("QueryExpressionGroupJoinVBClause");
+ }
+
+ public virtual object VisitQueryExpressionGroupVBClause(QueryExpressionGroupVBClause queryExpressionGroupVBClause, object data) {
+ throw new global::System.NotImplementedException("QueryExpressionGroupVBClause");
+ }
+
+ public virtual object VisitQueryExpressionJoinClause(QueryExpressionJoinClause queryExpressionJoinClause, object data) {
+ throw new global::System.NotImplementedException("QueryExpressionJoinClause");
+ }
+
+ public virtual object VisitQueryExpressionJoinConditionVB(QueryExpressionJoinConditionVB queryExpressionJoinConditionVB, object data) {
+ throw new global::System.NotImplementedException("QueryExpressionJoinConditionVB");
+ }
+
+ public virtual object VisitQueryExpressionJoinVBClause(QueryExpressionJoinVBClause queryExpressionJoinVBClause, object data) {
+ throw new global::System.NotImplementedException("QueryExpressionJoinVBClause");
+ }
+
+ public virtual object VisitQueryExpressionLetClause(QueryExpressionLetClause queryExpressionLetClause, object data) {
+ throw new global::System.NotImplementedException("QueryExpressionLetClause");
+ }
+
+ public virtual object VisitQueryExpressionLetVBClause(QueryExpressionLetVBClause queryExpressionLetVBClause, object data) {
+ throw new global::System.NotImplementedException("QueryExpressionLetVBClause");
+ }
+
+ public virtual object VisitQueryExpressionOrderClause(QueryExpressionOrderClause queryExpressionOrderClause, object data) {
+ throw new global::System.NotImplementedException("QueryExpressionOrderClause");
+ }
+
+ public virtual object VisitQueryExpressionOrdering(QueryExpressionOrdering queryExpressionOrdering, object data) {
+ throw new global::System.NotImplementedException("QueryExpressionOrdering");
+ }
+
+ public virtual object VisitQueryExpressionPartitionVBClause(QueryExpressionPartitionVBClause queryExpressionPartitionVBClause, object data) {
+ throw new global::System.NotImplementedException("QueryExpressionPartitionVBClause");
+ }
+
+ public virtual object VisitQueryExpressionSelectClause(QueryExpressionSelectClause queryExpressionSelectClause, object data) {
+ throw new global::System.NotImplementedException("QueryExpressionSelectClause");
+ }
+
+ public virtual object VisitQueryExpressionSelectVBClause(QueryExpressionSelectVBClause queryExpressionSelectVBClause, object data) {
+ throw new global::System.NotImplementedException("QueryExpressionSelectVBClause");
+ }
+
+ public virtual object VisitQueryExpressionWhereClause(QueryExpressionWhereClause queryExpressionWhereClause, object data) {
+ throw new global::System.NotImplementedException("QueryExpressionWhereClause");
+ }
+
+ public virtual object VisitRaiseEventStatement(RaiseEventStatement raiseEventStatement, object data) {
+ throw new global::System.NotImplementedException("RaiseEventStatement");
+ }
+
+ public virtual object VisitReDimStatement(ReDimStatement reDimStatement, object data) {
+ throw new global::System.NotImplementedException("ReDimStatement");
+ }
+
+ public virtual object VisitRemoveHandlerStatement(RemoveHandlerStatement removeHandlerStatement, object data) {
+ throw new global::System.NotImplementedException("RemoveHandlerStatement");
+ }
+
+ public virtual object VisitResumeStatement(ResumeStatement resumeStatement, object data) {
+ throw new global::System.NotImplementedException("ResumeStatement");
+ }
+
+ public virtual object VisitReturnStatement(ReturnStatement returnStatement, object data) {
+ throw new global::System.NotImplementedException("ReturnStatement");
+ }
+
+ public virtual object VisitSizeOfExpression(SizeOfExpression sizeOfExpression, object data) {
+ throw new global::System.NotImplementedException("SizeOfExpression");
+ }
+
+ public virtual object VisitStackAllocExpression(StackAllocExpression stackAllocExpression, object data) {
+ throw new global::System.NotImplementedException("StackAllocExpression");
+ }
+
+ public virtual object VisitStopStatement(StopStatement stopStatement, object data) {
+ throw new global::System.NotImplementedException("StopStatement");
+ }
+
+ public virtual object VisitSwitchSection(SwitchSection switchSection, object data) {
+ throw new global::System.NotImplementedException("SwitchSection");
+ }
+
+ public virtual object VisitSwitchStatement(SwitchStatement switchStatement, object data) {
+ throw new global::System.NotImplementedException("SwitchStatement");
+ }
+
+ public virtual object VisitTemplateDefinition(TemplateDefinition templateDefinition, object data) {
+ throw new global::System.NotImplementedException("TemplateDefinition");
+ }
+
+ public virtual object VisitThisReferenceExpression(ThisReferenceExpression thisReferenceExpression, object data) {
+ throw new global::System.NotImplementedException("ThisReferenceExpression");
+ }
+
+ public virtual object VisitThrowStatement(ThrowStatement throwStatement, object data) {
+ throw new global::System.NotImplementedException("ThrowStatement");
+ }
+
+ public virtual object VisitTryCatchStatement(TryCatchStatement tryCatchStatement, object data) {
+ throw new global::System.NotImplementedException("TryCatchStatement");
+ }
+
+ public virtual object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data) {
+ throw new global::System.NotImplementedException("TypeDeclaration");
+ }
+
+ public virtual object VisitTypeOfExpression(TypeOfExpression typeOfExpression, object data) {
+ throw new global::System.NotImplementedException("TypeOfExpression");
+ }
+
+ public virtual object VisitTypeOfIsExpression(TypeOfIsExpression typeOfIsExpression, object data) {
+ throw new global::System.NotImplementedException("TypeOfIsExpression");
+ }
+
+ public virtual object VisitTypeReference(TypeReference typeReference, object data) {
+ throw new global::System.NotImplementedException("TypeReference");
+ }
+
+ public virtual object VisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, object data) {
+ throw new global::System.NotImplementedException("TypeReferenceExpression");
+ }
+
+ public virtual object VisitUnaryOperatorExpression(UnaryOperatorExpression unaryOperatorExpression, object data) {
+ throw new global::System.NotImplementedException("UnaryOperatorExpression");
+ }
+
+ public virtual object VisitUncheckedExpression(UncheckedExpression uncheckedExpression, object data) {
+ throw new global::System.NotImplementedException("UncheckedExpression");
+ }
+
+ public virtual object VisitUncheckedStatement(UncheckedStatement uncheckedStatement, object data) {
+ throw new global::System.NotImplementedException("UncheckedStatement");
+ }
+
+ public virtual object VisitUnsafeStatement(UnsafeStatement unsafeStatement, object data) {
+ throw new global::System.NotImplementedException("UnsafeStatement");
+ }
+
+ public virtual object VisitUsing(Using @using, object data) {
+ throw new global::System.NotImplementedException("Using");
+ }
+
+ public virtual object VisitUsingDeclaration(UsingDeclaration usingDeclaration, object data) {
+ throw new global::System.NotImplementedException("UsingDeclaration");
+ }
+
+ public virtual object VisitUsingStatement(UsingStatement usingStatement, object data) {
+ throw new global::System.NotImplementedException("UsingStatement");
+ }
+
+ public virtual object VisitVariableDeclaration(VariableDeclaration variableDeclaration, object data) {
+ throw new global::System.NotImplementedException("VariableDeclaration");
+ }
+
+ public virtual object VisitWithStatement(WithStatement withStatement, object data) {
+ throw new global::System.NotImplementedException("WithStatement");
+ }
+
+ public virtual object VisitYieldStatement(YieldStatement yieldStatement, object data) {
+ throw new global::System.NotImplementedException("YieldStatement");
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Visitors/PrefixFieldsVisitor.cs b/main/contrib/NRefactory/Project/Src/Visitors/PrefixFieldsVisitor.cs
index d7d3ce3060..4c86eafdaa 100644
--- a/main/contrib/NRefactory/Project/Src/Visitors/PrefixFieldsVisitor.cs
+++ b/main/contrib/NRefactory/Project/Src/Visitors/PrefixFieldsVisitor.cs
@@ -1,147 +1,147 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 2819 $</version>
-// </file>
-
-using System;
-using System.Collections.Generic;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Visitors
-{
- /// <summary>
- /// Prefixes the names of the specified fields with the prefix and replaces the use.
- /// </summary>
- public class PrefixFieldsVisitor : AbstractAstVisitor
- {
- List<VariableDeclaration> fields;
- List<string> curBlock = new List<string>();
- Stack<List<string>> blocks = new Stack<List<string>>();
- string prefix;
-
- public PrefixFieldsVisitor(List<VariableDeclaration> fields, string prefix)
- {
- this.fields = fields;
- this.prefix = prefix;
- }
-
- public void Run(INode typeDeclaration)
- {
- typeDeclaration.AcceptVisitor(this, null);
- foreach (VariableDeclaration decl in fields) {
- decl.Name = prefix + decl.Name;
- }
- }
-
- public override object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
- {
- Push();
- object result = base.VisitTypeDeclaration(typeDeclaration, data);
- Pop();
- return result;
- }
-
- public override object VisitBlockStatement(BlockStatement blockStatement, object data)
- {
- Push();
- object result = base.VisitBlockStatement(blockStatement, data);
- Pop();
- return result;
- }
-
- public override object VisitMethodDeclaration(MethodDeclaration methodDeclaration, object data)
- {
- Push();
- object result = base.VisitMethodDeclaration(methodDeclaration, data);
- Pop();
- return result;
- }
-
- public override object VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration, object data)
- {
- Push();
- object result = base.VisitPropertyDeclaration(propertyDeclaration, data);
- Pop();
- return result;
- }
-
- public override object VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data)
- {
- Push();
- object result = base.VisitConstructorDeclaration(constructorDeclaration, data);
- Pop();
- return result;
- }
-
- private void Push()
- {
- blocks.Push(curBlock);
- curBlock = new List<string>();
- }
-
- private void Pop()
- {
- curBlock = blocks.Pop();
- }
-
- public override object VisitVariableDeclaration(VariableDeclaration variableDeclaration, object data)
- {
- // process local variables only
- if (fields.Contains(variableDeclaration)) {
- return null;
- }
- curBlock.Add(variableDeclaration.Name);
- return base.VisitVariableDeclaration(variableDeclaration, data);
- }
-
- public override object VisitParameterDeclarationExpression(ParameterDeclarationExpression parameterDeclarationExpression, object data)
- {
- curBlock.Add(parameterDeclarationExpression.ParameterName);
- //print("add parameter ${parameterDeclarationExpression.ParameterName} to block")
- return base.VisitParameterDeclarationExpression(parameterDeclarationExpression, data);
- }
-
- public override object VisitForeachStatement(ForeachStatement foreachStatement, object data)
- {
- curBlock.Add(foreachStatement.VariableName);
- return base.VisitForeachStatement(foreachStatement, data);
- }
-
- public override object VisitIdentifierExpression(IdentifierExpression identifierExpression, object data)
- {
- string name = identifierExpression.Identifier;
- foreach (VariableDeclaration var in fields) {
- if (var.Name == name && !IsLocal(name)) {
- identifierExpression.Identifier = prefix + name;
- break;
- }
- }
- return base.VisitIdentifierExpression(identifierExpression, data);
- }
-
- public override object VisitMemberReferenceExpression(MemberReferenceExpression fieldReferenceExpression, object data)
- {
- if (fieldReferenceExpression.TargetObject is ThisReferenceExpression) {
- string name = fieldReferenceExpression.MemberName;
- foreach (VariableDeclaration var in fields) {
- if (var.Name == name) {
- fieldReferenceExpression.MemberName = prefix + name;
- break;
- }
- }
- }
- return base.VisitMemberReferenceExpression(fieldReferenceExpression, data);
- }
-
- bool IsLocal(string name)
- {
- foreach (List<string> block in blocks) {
- if (block.Contains(name))
- return true;
- }
- return curBlock.Contains(name);
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+using System.Collections.Generic;
+using ICSharpCode.NRefactory.Ast;
+
+namespace ICSharpCode.NRefactory.Visitors
+{
+ /// <summary>
+ /// Prefixes the names of the specified fields with the prefix and replaces the use.
+ /// </summary>
+ public class PrefixFieldsVisitor : AbstractAstVisitor
+ {
+ List<VariableDeclaration> fields;
+ List<string> curBlock = new List<string>();
+ Stack<List<string>> blocks = new Stack<List<string>>();
+ string prefix;
+
+ public PrefixFieldsVisitor(List<VariableDeclaration> fields, string prefix)
+ {
+ this.fields = fields;
+ this.prefix = prefix;
+ }
+
+ public void Run(INode typeDeclaration)
+ {
+ typeDeclaration.AcceptVisitor(this, null);
+ foreach (VariableDeclaration decl in fields) {
+ decl.Name = prefix + decl.Name;
+ }
+ }
+
+ public override object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
+ {
+ Push();
+ object result = base.VisitTypeDeclaration(typeDeclaration, data);
+ Pop();
+ return result;
+ }
+
+ public override object VisitBlockStatement(BlockStatement blockStatement, object data)
+ {
+ Push();
+ object result = base.VisitBlockStatement(blockStatement, data);
+ Pop();
+ return result;
+ }
+
+ public override object VisitMethodDeclaration(MethodDeclaration methodDeclaration, object data)
+ {
+ Push();
+ object result = base.VisitMethodDeclaration(methodDeclaration, data);
+ Pop();
+ return result;
+ }
+
+ public override object VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration, object data)
+ {
+ Push();
+ object result = base.VisitPropertyDeclaration(propertyDeclaration, data);
+ Pop();
+ return result;
+ }
+
+ public override object VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data)
+ {
+ Push();
+ object result = base.VisitConstructorDeclaration(constructorDeclaration, data);
+ Pop();
+ return result;
+ }
+
+ private void Push()
+ {
+ blocks.Push(curBlock);
+ curBlock = new List<string>();
+ }
+
+ private void Pop()
+ {
+ curBlock = blocks.Pop();
+ }
+
+ public override object VisitVariableDeclaration(VariableDeclaration variableDeclaration, object data)
+ {
+ // process local variables only
+ if (fields.Contains(variableDeclaration)) {
+ return null;
+ }
+ curBlock.Add(variableDeclaration.Name);
+ return base.VisitVariableDeclaration(variableDeclaration, data);
+ }
+
+ public override object VisitParameterDeclarationExpression(ParameterDeclarationExpression parameterDeclarationExpression, object data)
+ {
+ curBlock.Add(parameterDeclarationExpression.ParameterName);
+ //print("add parameter ${parameterDeclarationExpression.ParameterName} to block")
+ return base.VisitParameterDeclarationExpression(parameterDeclarationExpression, data);
+ }
+
+ public override object VisitForeachStatement(ForeachStatement foreachStatement, object data)
+ {
+ curBlock.Add(foreachStatement.VariableName);
+ return base.VisitForeachStatement(foreachStatement, data);
+ }
+
+ public override object VisitIdentifierExpression(IdentifierExpression identifierExpression, object data)
+ {
+ string name = identifierExpression.Identifier;
+ foreach (VariableDeclaration var in fields) {
+ if (var.Name == name && !IsLocal(name)) {
+ identifierExpression.Identifier = prefix + name;
+ break;
+ }
+ }
+ return base.VisitIdentifierExpression(identifierExpression, data);
+ }
+
+ public override object VisitMemberReferenceExpression(MemberReferenceExpression fieldReferenceExpression, object data)
+ {
+ if (fieldReferenceExpression.TargetObject is ThisReferenceExpression) {
+ string name = fieldReferenceExpression.MemberName;
+ foreach (VariableDeclaration var in fields) {
+ if (var.Name == name) {
+ fieldReferenceExpression.MemberName = prefix + name;
+ break;
+ }
+ }
+ }
+ return base.VisitMemberReferenceExpression(fieldReferenceExpression, data);
+ }
+
+ bool IsLocal(string name)
+ {
+ foreach (List<string> block in blocks) {
+ if (block.Contains(name))
+ return true;
+ }
+ return curBlock.Contains(name);
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Visitors/RenameIdentifierVisitor.cs b/main/contrib/NRefactory/Project/Src/Visitors/RenameIdentifierVisitor.cs
index 70b80f05e5..0df254c6b7 100644
--- a/main/contrib/NRefactory/Project/Src/Visitors/RenameIdentifierVisitor.cs
+++ b/main/contrib/NRefactory/Project/Src/Visitors/RenameIdentifierVisitor.cs
@@ -1,65 +1,65 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 2191 $</version>
-// </file>
-
-using System;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Visitors
-{
- class RenameIdentifierVisitor : AbstractAstVisitor
- {
- protected StringComparer nameComparer;
- protected string from, to;
-
- public RenameIdentifierVisitor(string from, string to, StringComparer nameComparer)
- {
- this.nameComparer = nameComparer;
- this.from = from;
- this.to = to;
- }
-
- public override object VisitIdentifierExpression(IdentifierExpression identifierExpression, object data)
- {
- if (nameComparer.Equals(identifierExpression.Identifier, from)) {
- identifierExpression.Identifier = to;
- }
- return base.VisitIdentifierExpression(identifierExpression, data);
- }
- }
-
- sealed class RenameLocalVariableVisitor : RenameIdentifierVisitor
- {
- public RenameLocalVariableVisitor(string from, string to, StringComparer nameComparer)
- : base(from, to, nameComparer)
- {
- }
-
- public override object VisitVariableDeclaration(VariableDeclaration variableDeclaration, object data)
- {
- if (nameComparer.Equals(from, variableDeclaration.Name)) {
- variableDeclaration.Name = to;
- }
- return base.VisitVariableDeclaration(variableDeclaration, data);
- }
-
- public override object VisitParameterDeclarationExpression(ParameterDeclarationExpression parameterDeclarationExpression, object data)
- {
- if (nameComparer.Equals(from, parameterDeclarationExpression.ParameterName)) {
- parameterDeclarationExpression.ParameterName = to;
- }
- return base.VisitParameterDeclarationExpression(parameterDeclarationExpression, data);
- }
-
- public override object VisitForeachStatement(ForeachStatement foreachStatement, object data)
- {
- if (nameComparer.Equals(from, foreachStatement.VariableName)) {
- foreachStatement.VariableName = to;
- }
- return base.VisitForeachStatement(foreachStatement, data);
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+using ICSharpCode.NRefactory.Ast;
+
+namespace ICSharpCode.NRefactory.Visitors
+{
+ class RenameIdentifierVisitor : AbstractAstVisitor
+ {
+ protected StringComparer nameComparer;
+ protected string from, to;
+
+ public RenameIdentifierVisitor(string from, string to, StringComparer nameComparer)
+ {
+ this.nameComparer = nameComparer;
+ this.from = from;
+ this.to = to;
+ }
+
+ public override object VisitIdentifierExpression(IdentifierExpression identifierExpression, object data)
+ {
+ if (nameComparer.Equals(identifierExpression.Identifier, from)) {
+ identifierExpression.Identifier = to;
+ }
+ return base.VisitIdentifierExpression(identifierExpression, data);
+ }
+ }
+
+ sealed class RenameLocalVariableVisitor : RenameIdentifierVisitor
+ {
+ public RenameLocalVariableVisitor(string from, string to, StringComparer nameComparer)
+ : base(from, to, nameComparer)
+ {
+ }
+
+ public override object VisitVariableDeclaration(VariableDeclaration variableDeclaration, object data)
+ {
+ if (nameComparer.Equals(from, variableDeclaration.Name)) {
+ variableDeclaration.Name = to;
+ }
+ return base.VisitVariableDeclaration(variableDeclaration, data);
+ }
+
+ public override object VisitParameterDeclarationExpression(ParameterDeclarationExpression parameterDeclarationExpression, object data)
+ {
+ if (nameComparer.Equals(from, parameterDeclarationExpression.ParameterName)) {
+ parameterDeclarationExpression.ParameterName = to;
+ }
+ return base.VisitParameterDeclarationExpression(parameterDeclarationExpression, data);
+ }
+
+ public override object VisitForeachStatement(ForeachStatement foreachStatement, object data)
+ {
+ if (nameComparer.Equals(from, foreachStatement.VariableName)) {
+ foreachStatement.VariableName = to;
+ }
+ return base.VisitForeachStatement(foreachStatement, data);
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Visitors/SetParentVisitor.cs b/main/contrib/NRefactory/Project/Src/Visitors/SetParentVisitor.cs
index 3935a079cb..817829fb3e 100644
--- a/main/contrib/NRefactory/Project/Src/Visitors/SetParentVisitor.cs
+++ b/main/contrib/NRefactory/Project/Src/Visitors/SetParentVisitor.cs
@@ -1,37 +1,37 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <author name="Daniel Grunwald"/>
-// <version>$Revision: 3717 $</version>
-// </file>
-
-using System;
-using ICSharpCode.NRefactory.Ast;
-using System.Collections.Generic;
-
-namespace ICSharpCode.NRefactory.Visitors
-{
- /// <summary>
- /// Sets the parent property on all nodes in the tree.
- /// </summary>
- public class SetParentVisitor : NodeTrackingAstVisitor
- {
- Stack<INode> nodeStack = new Stack<INode>();
-
- public SetParentVisitor()
- {
- nodeStack.Push(null);
- }
-
- protected override void BeginVisit(INode node)
- {
- node.Parent = nodeStack.Peek();
- nodeStack.Push(node);
- }
-
- protected override void EndVisit(INode node)
- {
- nodeStack.Pop();
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <author name="Daniel Grunwald"/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using System;
+using ICSharpCode.NRefactory.Ast;
+using System.Collections.Generic;
+
+namespace ICSharpCode.NRefactory.Visitors
+{
+ /// <summary>
+ /// Sets the parent property on all nodes in the tree.
+ /// </summary>
+ public class SetParentVisitor : NodeTrackingAstVisitor
+ {
+ Stack<INode> nodeStack = new Stack<INode>();
+
+ public SetParentVisitor()
+ {
+ nodeStack.Push(null);
+ }
+
+ protected override void BeginVisit(INode node)
+ {
+ node.Parent = nodeStack.Peek();
+ nodeStack.Push(node);
+ }
+
+ protected override void EndVisit(INode node)
+ {
+ nodeStack.Pop();
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Visitors/ToCSharpConvertVisitor.cs b/main/contrib/NRefactory/Project/Src/Visitors/ToCSharpConvertVisitor.cs
index aae5a7e21f..729f6d17ba 100644
--- a/main/contrib/NRefactory/Project/Src/Visitors/ToCSharpConvertVisitor.cs
+++ b/main/contrib/NRefactory/Project/Src/Visitors/ToCSharpConvertVisitor.cs
@@ -1,230 +1,278 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 3660 $</version>
-// </file>
-
-using System;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Visitors
-{
- /// <summary>
- /// Converts elements not supported by C# to their C# representation.
- /// Not all elements are converted here, most simple elements (e.g. StopStatement)
- /// are converted in the output visitor.
- /// </summary>
- public class ToCSharpConvertVisitor : ConvertVisitorBase
- {
- // The following conversions are implemented:
- // Public Event EventName(param As String) -> automatic delegate declaration
- // static variables inside methods become fields
- // Explicit interface implementation:
- // => create additional member for implementing the interface
- // or convert to implicit interface implementation
- // Modules: make all members static
-
- public override object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
- {
- if (typeDeclaration.Type == ClassType.Module) {
- typeDeclaration.Type = ClassType.Class;
- typeDeclaration.Modifier |= Modifiers.Static;
- foreach (INode node in typeDeclaration.Children) {
- MemberNode aNode = node as MemberNode;
- if (aNode != null) {
- aNode.Modifier |= Modifiers.Static;
- }
- FieldDeclaration fd = node as FieldDeclaration;
- if (fd != null) {
- if ((fd.Modifier & Modifiers.Const) == 0)
- fd.Modifier |= Modifiers.Static;
- }
- }
- }
-
- return base.VisitTypeDeclaration(typeDeclaration, data);
- }
-
- public override object VisitEventDeclaration(EventDeclaration eventDeclaration, object data)
- {
- if (!eventDeclaration.HasAddRegion && !eventDeclaration.HasRaiseRegion && !eventDeclaration.HasRemoveRegion) {
- if (eventDeclaration.TypeReference.IsNull) {
- DelegateDeclaration dd = new DelegateDeclaration(eventDeclaration.Modifier, null);
- dd.Name = eventDeclaration.Name + "EventHandler";
- dd.Parameters = eventDeclaration.Parameters;
- dd.ReturnType = new TypeReference("System.Void", true);
- dd.Parent = eventDeclaration.Parent;
- eventDeclaration.Parameters = null;
- InsertAfterSibling(eventDeclaration, dd);
- eventDeclaration.TypeReference = new TypeReference(dd.Name);
- }
- }
- return base.VisitEventDeclaration(eventDeclaration, data);
- }
-
- public override object VisitMethodDeclaration(MethodDeclaration methodDeclaration, object data)
- {
- ConvertInterfaceImplementation(methodDeclaration);
- return base.VisitMethodDeclaration(methodDeclaration, data);
- }
-
- void ConvertInterfaceImplementation(MethodDeclaration member)
- {
- // members without modifiers are already C# explicit interface implementations, do not convert them
- if (member.Modifier == Modifiers.None)
- return;
- while (member.InterfaceImplementations.Count > 0) {
- InterfaceImplementation impl = member.InterfaceImplementations[0];
- member.InterfaceImplementations.RemoveAt(0);
- if (member.Name != impl.MemberName) {
- MethodDeclaration newMember = new MethodDeclaration {
- Name = impl.MemberName,
- TypeReference = member.TypeReference,
- Parameters = member.Parameters,
- Body = new BlockStatement()
- };
- InvocationExpression callExpression = new InvocationExpression(new IdentifierExpression(member.Name));
- foreach (ParameterDeclarationExpression decl in member.Parameters) {
- callExpression.Arguments.Add(new IdentifierExpression(decl.ParameterName));
- }
- if (member.TypeReference.Type == "System.Void") {
- newMember.Body.AddChild(new ExpressionStatement(callExpression));
- } else {
- newMember.Body.AddChild(new ReturnStatement(callExpression));
- }
- newMember.InterfaceImplementations.Add(impl);
- InsertAfterSibling(member, newMember);
- }
- }
- }
-
- public override object VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration, object data)
- {
- ConvertInterfaceImplementation(propertyDeclaration);
- return base.VisitPropertyDeclaration(propertyDeclaration, data);
- }
-
- void ConvertInterfaceImplementation(PropertyDeclaration member)
- {
- // members without modifiers are already C# explicit interface implementations, do not convert them
- if (member.Modifier == Modifiers.None)
- return;
- while (member.InterfaceImplementations.Count > 0) {
- InterfaceImplementation impl = member.InterfaceImplementations[0];
- member.InterfaceImplementations.RemoveAt(0);
- if (member.Name != impl.MemberName) {
- PropertyDeclaration newMember = new PropertyDeclaration(Modifiers.None, null, impl.MemberName, null);
- newMember.TypeReference = member.TypeReference;
- if (member.HasGetRegion) {
- newMember.GetRegion = new PropertyGetRegion(new BlockStatement(), null);
- newMember.GetRegion.Block.AddChild(new ReturnStatement(new IdentifierExpression(member.Name)));
- }
- if (member.HasSetRegion) {
- newMember.SetRegion = new PropertySetRegion(new BlockStatement(), null);
- newMember.SetRegion.Block.AddChild(new ExpressionStatement(
- new AssignmentExpression(
- new IdentifierExpression(member.Name),
- AssignmentOperatorType.Assign,
- new IdentifierExpression("value")
- )));
- }
- newMember.Parameters = member.Parameters;
- newMember.InterfaceImplementations.Add(impl);
- InsertAfterSibling(member, newMember);
- }
- }
- }
-
- public override object VisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data)
- {
- base.VisitLocalVariableDeclaration(localVariableDeclaration, data);
- if ((localVariableDeclaration.Modifier & Modifiers.Static) == Modifiers.Static) {
- INode parent = localVariableDeclaration.Parent;
- while (parent != null && !IsTypeLevel(parent)) {
- parent = parent.Parent;
- }
- if (parent != null) {
- INode type = parent.Parent;
- if (type != null) {
- int pos = type.Children.IndexOf(parent);
- if (pos >= 0) {
- FieldDeclaration field = new FieldDeclaration(null);
- field.TypeReference = localVariableDeclaration.TypeReference;
- field.Modifier = Modifiers.Static;
- field.Fields = localVariableDeclaration.Variables;
- new PrefixFieldsVisitor(field.Fields, "static_" + GetTypeLevelEntityName(parent) + "_").Run(parent);
- type.Children.Insert(pos + 1, field);
- RemoveCurrentNode();
- }
- }
- }
- }
- return null;
- }
-
- public override object VisitWithStatement(WithStatement withStatement, object data)
- {
- withStatement.Body.AcceptVisitor(new ReplaceWithAccessTransformer(withStatement.Expression), data);
- base.VisitWithStatement(withStatement, data);
- ReplaceCurrentNode(withStatement.Body);
- return null;
- }
-
- sealed class ReplaceWithAccessTransformer : AbstractAstTransformer
- {
- readonly Expression replaceWith;
-
- public ReplaceWithAccessTransformer(Expression replaceWith)
- {
- this.replaceWith = replaceWith;
- }
-
- public override object VisitMemberReferenceExpression(MemberReferenceExpression fieldReferenceExpression, object data)
- {
- if (fieldReferenceExpression.TargetObject.IsNull) {
- fieldReferenceExpression.TargetObject = replaceWith;
- return null;
- } else {
- return base.VisitMemberReferenceExpression(fieldReferenceExpression, data);
- }
- }
-
- public override object VisitWithStatement(WithStatement withStatement, object data)
- {
- // do not visit the body of the WithStatement
- return withStatement.Expression.AcceptVisitor(this, data);
- }
- }
-
- static bool IsTypeLevel(INode node)
- {
- return node is MethodDeclaration || node is PropertyDeclaration || node is EventDeclaration
- || node is OperatorDeclaration || node is FieldDeclaration;
- }
-
- static string GetTypeLevelEntityName(INode node)
- {
- if (node is ParametrizedNode)
- return ((ParametrizedNode)node).Name;
- else if (node is FieldDeclaration)
- return ((FieldDeclaration)node).Fields[0].Name;
- else
- throw new ArgumentException();
- }
-
- public override object VisitSwitchSection(SwitchSection switchSection, object data)
- {
- // Check if a 'break' should be auto inserted.
- if (switchSection.Children.Count == 0 ||
- !(switchSection.Children[switchSection.Children.Count - 1] is BreakStatement ||
- switchSection.Children[switchSection.Children.Count - 1] is ContinueStatement ||
- switchSection.Children[switchSection.Children.Count - 1] is ThrowStatement ||
- switchSection.Children[switchSection.Children.Count - 1] is ReturnStatement))
- {
- switchSection.Children.Add(new BreakStatement());
- }
- return base.VisitSwitchSection(switchSection, data);
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
+// <version>$Revision: 4570 $</version>
+// </file>
+
+using ICSharpCode.NRefactory.AstBuilder;
+using System;
+using ICSharpCode.NRefactory.Ast;
+
+namespace ICSharpCode.NRefactory.Visitors
+{
+ /// <summary>
+ /// Converts elements not supported by C# to their C# representation.
+ /// Not all elements are converted here, most simple elements (e.g. StopStatement)
+ /// are converted in the output visitor.
+ /// </summary>
+ public class ToCSharpConvertVisitor : ConvertVisitorBase
+ {
+ // The following conversions are implemented:
+ // Public Event EventName(param As String) -> automatic delegate declaration
+ // static variables inside methods become fields
+ // Explicit interface implementation:
+ // => create additional member for implementing the interface
+ // or convert to implicit interface implementation
+ // Modules: make all members static
+ // Use Convert.ToInt32 for VB casts
+
+ public override object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
+ {
+ if (typeDeclaration.Type == ClassType.Module) {
+ typeDeclaration.Type = ClassType.Class;
+ typeDeclaration.Modifier |= Modifiers.Static;
+ foreach (INode node in typeDeclaration.Children) {
+ MemberNode aNode = node as MemberNode;
+ if (aNode != null) {
+ aNode.Modifier |= Modifiers.Static;
+ }
+ FieldDeclaration fd = node as FieldDeclaration;
+ if (fd != null) {
+ if ((fd.Modifier & Modifiers.Const) == 0)
+ fd.Modifier |= Modifiers.Static;
+ }
+ }
+ }
+
+ return base.VisitTypeDeclaration(typeDeclaration, data);
+ }
+
+ public override object VisitEventDeclaration(EventDeclaration eventDeclaration, object data)
+ {
+ if (!eventDeclaration.HasAddRegion && !eventDeclaration.HasRaiseRegion && !eventDeclaration.HasRemoveRegion) {
+ if (eventDeclaration.TypeReference.IsNull) {
+ DelegateDeclaration dd = new DelegateDeclaration(eventDeclaration.Modifier, null);
+ dd.Name = eventDeclaration.Name + "EventHandler";
+ dd.Parameters = eventDeclaration.Parameters;
+ dd.ReturnType = new TypeReference("System.Void", true);
+ dd.Parent = eventDeclaration.Parent;
+ eventDeclaration.Parameters = null;
+ InsertAfterSibling(eventDeclaration, dd);
+ eventDeclaration.TypeReference = new TypeReference(dd.Name);
+ }
+ }
+ return base.VisitEventDeclaration(eventDeclaration, data);
+ }
+
+ public override object VisitMethodDeclaration(MethodDeclaration methodDeclaration, object data)
+ {
+ ConvertInterfaceImplementation(methodDeclaration);
+ return base.VisitMethodDeclaration(methodDeclaration, data);
+ }
+
+ void ConvertInterfaceImplementation(MethodDeclaration member)
+ {
+ // members without modifiers are already C# explicit interface implementations, do not convert them
+ if (member.Modifier == Modifiers.None)
+ return;
+ while (member.InterfaceImplementations.Count > 0) {
+ InterfaceImplementation impl = member.InterfaceImplementations[0];
+ member.InterfaceImplementations.RemoveAt(0);
+ if (member.Name != impl.MemberName) {
+ MethodDeclaration newMember = new MethodDeclaration {
+ Name = impl.MemberName,
+ TypeReference = member.TypeReference,
+ Parameters = member.Parameters,
+ Body = new BlockStatement()
+ };
+ InvocationExpression callExpression = new InvocationExpression(new IdentifierExpression(member.Name));
+ foreach (ParameterDeclarationExpression decl in member.Parameters) {
+ callExpression.Arguments.Add(new IdentifierExpression(decl.ParameterName));
+ }
+ if (member.TypeReference.Type == "System.Void") {
+ newMember.Body.AddChild(new ExpressionStatement(callExpression));
+ } else {
+ newMember.Body.AddChild(new ReturnStatement(callExpression));
+ }
+ newMember.InterfaceImplementations.Add(impl);
+ InsertAfterSibling(member, newMember);
+ }
+ }
+ }
+
+ public override object VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration, object data)
+ {
+ ConvertInterfaceImplementation(propertyDeclaration);
+ return base.VisitPropertyDeclaration(propertyDeclaration, data);
+ }
+
+ void ConvertInterfaceImplementation(PropertyDeclaration member)
+ {
+ // members without modifiers are already C# explicit interface implementations, do not convert them
+ if (member.Modifier == Modifiers.None)
+ return;
+ while (member.InterfaceImplementations.Count > 0) {
+ InterfaceImplementation impl = member.InterfaceImplementations[0];
+ member.InterfaceImplementations.RemoveAt(0);
+ if (member.Name != impl.MemberName) {
+ PropertyDeclaration newMember = new PropertyDeclaration(Modifiers.None, null, impl.MemberName, null);
+ newMember.TypeReference = member.TypeReference;
+ if (member.HasGetRegion) {
+ newMember.GetRegion = new PropertyGetRegion(new BlockStatement(), null);
+ newMember.GetRegion.Block.AddChild(new ReturnStatement(new IdentifierExpression(member.Name)));
+ }
+ if (member.HasSetRegion) {
+ newMember.SetRegion = new PropertySetRegion(new BlockStatement(), null);
+ newMember.SetRegion.Block.AddChild(new ExpressionStatement(
+ new AssignmentExpression(
+ new IdentifierExpression(member.Name),
+ AssignmentOperatorType.Assign,
+ new IdentifierExpression("value")
+ )));
+ }
+ newMember.Parameters = member.Parameters;
+ newMember.InterfaceImplementations.Add(impl);
+ InsertAfterSibling(member, newMember);
+ }
+ }
+ }
+
+ public override object VisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data)
+ {
+ base.VisitLocalVariableDeclaration(localVariableDeclaration, data);
+ if ((localVariableDeclaration.Modifier & Modifiers.Static) == Modifiers.Static) {
+ INode parent = localVariableDeclaration.Parent;
+ while (parent != null && !IsTypeLevel(parent)) {
+ parent = parent.Parent;
+ }
+ if (parent != null) {
+ INode type = parent.Parent;
+ if (type != null) {
+ int pos = type.Children.IndexOf(parent);
+ if (pos >= 0) {
+ FieldDeclaration field = new FieldDeclaration(null);
+ field.TypeReference = localVariableDeclaration.TypeReference;
+ field.Modifier = Modifiers.Static;
+ field.Fields = localVariableDeclaration.Variables;
+ new PrefixFieldsVisitor(field.Fields, "static_" + GetTypeLevelEntityName(parent) + "_").Run(parent);
+ type.Children.Insert(pos + 1, field);
+ RemoveCurrentNode();
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ public override object VisitWithStatement(WithStatement withStatement, object data)
+ {
+ withStatement.Body.AcceptVisitor(new ReplaceWithAccessTransformer(withStatement.Expression), data);
+ base.VisitWithStatement(withStatement, data);
+ ReplaceCurrentNode(withStatement.Body);
+ return null;
+ }
+
+ sealed class ReplaceWithAccessTransformer : AbstractAstTransformer
+ {
+ readonly Expression replaceWith;
+
+ public ReplaceWithAccessTransformer(Expression replaceWith)
+ {
+ this.replaceWith = replaceWith;
+ }
+
+ public override object VisitMemberReferenceExpression(MemberReferenceExpression fieldReferenceExpression, object data)
+ {
+ if (fieldReferenceExpression.TargetObject.IsNull) {
+ fieldReferenceExpression.TargetObject = replaceWith;
+ return null;
+ } else {
+ return base.VisitMemberReferenceExpression(fieldReferenceExpression, data);
+ }
+ }
+
+ public override object VisitWithStatement(WithStatement withStatement, object data)
+ {
+ // do not visit the body of the WithStatement
+ return withStatement.Expression.AcceptVisitor(this, data);
+ }
+ }
+
+ static bool IsTypeLevel(INode node)
+ {
+ return node is MethodDeclaration || node is PropertyDeclaration || node is EventDeclaration
+ || node is OperatorDeclaration || node is FieldDeclaration;
+ }
+
+ static string GetTypeLevelEntityName(INode node)
+ {
+ if (node is ParametrizedNode)
+ return ((ParametrizedNode)node).Name;
+ else if (node is FieldDeclaration)
+ return ((FieldDeclaration)node).Fields[0].Name;
+ else
+ throw new ArgumentException();
+ }
+
+ public override object VisitSwitchSection(SwitchSection switchSection, object data)
+ {
+ // Check if a 'break' should be auto inserted.
+ if (switchSection.Children.Count == 0 ||
+ !(switchSection.Children[switchSection.Children.Count - 1] is BreakStatement ||
+ switchSection.Children[switchSection.Children.Count - 1] is ContinueStatement ||
+ switchSection.Children[switchSection.Children.Count - 1] is ThrowStatement ||
+ switchSection.Children[switchSection.Children.Count - 1] is ReturnStatement))
+ {
+ switchSection.Children.Add(new BreakStatement());
+ }
+ return base.VisitSwitchSection(switchSection, data);
+ }
+
+ public override object VisitCastExpression(CastExpression castExpression, object data)
+ {
+ base.VisitCastExpression(castExpression, data);
+ if (castExpression.CastType == CastType.Conversion || castExpression.CastType == CastType.PrimitiveConversion) {
+ switch (castExpression.CastTo.Type) {
+ case "System.Boolean":
+ return ReplacePrimitiveCastWithConvertMethodCall(castExpression, "ToBoolean");
+ case "System.Byte":
+ return ReplacePrimitiveCastWithConvertMethodCall(castExpression, "ToByte");
+ case "System.Char":
+ return ReplacePrimitiveCastWithConvertMethodCall(castExpression, "ToChar");
+ case "System.DateTime":
+ return ReplacePrimitiveCastWithConvertMethodCall(castExpression, "ToDateTime");
+ case "System.Decimal":
+ return ReplacePrimitiveCastWithConvertMethodCall(castExpression, "ToDecimal");
+ case "System.Double":
+ return ReplacePrimitiveCastWithConvertMethodCall(castExpression, "ToDouble");
+ case "System.Int16":
+ return ReplacePrimitiveCastWithConvertMethodCall(castExpression, "ToInt16");
+ case "System.Int32":
+ return ReplacePrimitiveCastWithConvertMethodCall(castExpression, "ToInt32");
+ case "System.Int64":
+ return ReplacePrimitiveCastWithConvertMethodCall(castExpression, "ToInt64");
+ case "System.SByte":
+ return ReplacePrimitiveCastWithConvertMethodCall(castExpression, "ToSByte");
+ case "System.Single":
+ return ReplacePrimitiveCastWithConvertMethodCall(castExpression, "ToSingle");
+ case "System.String":
+ return ReplacePrimitiveCastWithConvertMethodCall(castExpression, "ToString");
+ case "System.UInt16":
+ return ReplacePrimitiveCastWithConvertMethodCall(castExpression, "ToUInt16");
+ case "System.UInt32":
+ return ReplacePrimitiveCastWithConvertMethodCall(castExpression, "ToUInt32");
+ case "System.UInt64":
+ return ReplacePrimitiveCastWithConvertMethodCall(castExpression, "ToUInt64");
+ }
+ }
+ return null;
+ }
+
+ object ReplacePrimitiveCastWithConvertMethodCall(CastExpression castExpression, string methodName)
+ {
+ ReplaceCurrentNode(ExpressionBuilder.Identifier("Convert").Call(methodName, castExpression.Expression));
+ return null;
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Visitors/ToVBNetConvertVisitor.cs b/main/contrib/NRefactory/Project/Src/Visitors/ToVBNetConvertVisitor.cs
index a905bd1024..500dfd13eb 100644
--- a/main/contrib/NRefactory/Project/Src/Visitors/ToVBNetConvertVisitor.cs
+++ b/main/contrib/NRefactory/Project/Src/Visitors/ToVBNetConvertVisitor.cs
@@ -1,351 +1,383 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 2819 $</version>
-// </file>
-
-using System;
-using System.Collections.Generic;
-using ICSharpCode.NRefactory.Ast;
-using Attribute = ICSharpCode.NRefactory.Ast.Attribute;
-
-namespace ICSharpCode.NRefactory.Visitors
-{
- /// <summary>
- /// Converts elements not supported by VB to their VB representation.
- /// Not all elements are converted here, most simple elements (e.g. ConditionalExpression)
- /// are converted in the output visitor.
- /// </summary>
- public class ToVBNetConvertVisitor : ConvertVisitorBase
- {
- // The following conversions are implemented:
- // Conflicting field/property names -> m_field
- // Conflicting variable names inside methods
- // Anonymous methods are put into new methods
- // Simple event handler creation is replaced with AddressOfExpression
- // Move Imports-statements out of namespaces
- // Parenthesis around Cast expressions remove - these are syntax errors in VB.NET
- // Decrease array creation size - VB specifies upper bound instead of array length
-
- List<INode> nodesToMoveToCompilationUnit = new List<INode>();
-
- public override object VisitCompilationUnit(CompilationUnit compilationUnit, object data)
- {
- base.VisitCompilationUnit(compilationUnit, data);
- for (int i = 0; i < nodesToMoveToCompilationUnit.Count; i++) {
- compilationUnit.Children.Insert(i, nodesToMoveToCompilationUnit[i]);
- nodesToMoveToCompilationUnit[i].Parent = compilationUnit;
- }
- return null;
- }
-
- public override object VisitUsingDeclaration(UsingDeclaration usingDeclaration, object data)
- {
- base.VisitUsingDeclaration(usingDeclaration, data);
- if (usingDeclaration.Parent is NamespaceDeclaration) {
- nodesToMoveToCompilationUnit.Add(usingDeclaration);
- RemoveCurrentNode();
- }
- return null;
- }
-
- TypeDeclaration currentType;
-
- public override object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
- {
- // fix default inner type visibility
- if (currentType != null && (typeDeclaration.Modifier & Modifiers.Visibility) == 0)
- typeDeclaration.Modifier |= Modifiers.Private;
-
- TypeDeclaration outerType = currentType;
- currentType = typeDeclaration;
-
- if ((typeDeclaration.Modifier & Modifiers.Static) == Modifiers.Static) {
- typeDeclaration.Modifier &= ~Modifiers.Static;
- typeDeclaration.Modifier |= Modifiers.Sealed;
- typeDeclaration.Children.Insert(0, new ConstructorDeclaration("#ctor", Modifiers.Private, null, null));
- }
-
- // Conflicting field/property names -> m_field
- List<string> properties = new List<string>();
- foreach (object o in typeDeclaration.Children) {
- PropertyDeclaration pd = o as PropertyDeclaration;
- if (pd != null) {
- properties.Add(pd.Name);
- }
- }
- List<VariableDeclaration> conflicts = new List<VariableDeclaration>();
- foreach (object o in typeDeclaration.Children) {
- FieldDeclaration fd = o as FieldDeclaration;
- if (fd != null) {
- foreach (VariableDeclaration var in fd.Fields) {
- string name = var.Name;
- foreach (string propertyName in properties) {
- if (name.Equals(propertyName, StringComparison.InvariantCultureIgnoreCase)) {
- conflicts.Add(var);
- }
- }
- }
- }
- }
- new PrefixFieldsVisitor(conflicts, "m_").Run(typeDeclaration);
- base.VisitTypeDeclaration(typeDeclaration, data);
- currentType = outerType;
-
- return null;
- }
-
- public override object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data)
- {
- // fix default inner type visibility
- if (currentType != null && (delegateDeclaration.Modifier & Modifiers.Visibility) == 0)
- delegateDeclaration.Modifier |= Modifiers.Private;
-
- return base.VisitDelegateDeclaration(delegateDeclaration, data);
- }
-
- public override object VisitExpressionStatement(ExpressionStatement expressionStatement, object data)
- {
- base.VisitExpressionStatement(expressionStatement, data);
- AssignmentExpression ass = expressionStatement.Expression as AssignmentExpression;
- if (ass != null && ass.Right is AddressOfExpression) {
- if (ass.Op == AssignmentOperatorType.Add) {
- ReplaceCurrentNode(new AddHandlerStatement(ass.Left, ass.Right));
- } else if (ass.Op == AssignmentOperatorType.Subtract) {
- ReplaceCurrentNode(new RemoveHandlerStatement(ass.Left, ass.Right));
- }
- }
- return null;
- }
-
- static string GetMemberNameOnThisReference(Expression expr)
- {
- IdentifierExpression ident = expr as IdentifierExpression;
- if (ident != null)
- return ident.Identifier;
- MemberReferenceExpression fre = expr as MemberReferenceExpression;
- if (fre != null && fre.TargetObject is ThisReferenceExpression)
- return fre.MemberName;
- return null;
- }
-
- public override object VisitAnonymousMethodExpression(AnonymousMethodExpression anonymousMethodExpression, object data)
- {
- base.VisitAnonymousMethodExpression(anonymousMethodExpression, data);
- if (anonymousMethodExpression.Body.Children.Count == 1) {
- ReturnStatement rs = anonymousMethodExpression.Body.Children[0] as ReturnStatement;
- if (rs != null) {
- LambdaExpression lambda = new LambdaExpression();
- lambda.ExpressionBody = rs.Expression;
- lambda.Parameters = anonymousMethodExpression.Parameters;
- ReplaceCurrentNode(lambda);
- }
- }
- return null;
- }
-
- public override object VisitAssignmentExpression(AssignmentExpression assignmentExpression, object data)
- {
- base.VisitAssignmentExpression(assignmentExpression, data);
- if (assignmentExpression.Op == AssignmentOperatorType.Assign && !(assignmentExpression.Parent is ExpressionStatement)) {
- AddInlineAssignHelper();
- ReplaceCurrentNode(
- new InvocationExpression(
- new IdentifierExpression("InlineAssignHelper"),
- new List<Expression> { assignmentExpression.Left, assignmentExpression.Right }
- ));
- }
- return null;
- }
-
- void AddInlineAssignHelper()
- {
- MethodDeclaration method;
- foreach (INode node in currentType.Children) {
- method = node as MethodDeclaration;
- if (method != null && method.Name == "InlineAssignHelper") {
- // inline assign helper already exists
- return;
- }
- }
-
- method = new MethodDeclaration {
- Name = "InlineAssignHelper",
- Modifier = Modifiers.Private | Modifiers.Static,
- TypeReference = new TypeReference("T"),
- Parameters = new List<ParameterDeclarationExpression> {
- new ParameterDeclarationExpression(new TypeReference("T"), "target", ParameterModifiers.Ref),
- new ParameterDeclarationExpression(new TypeReference("T"), "value")
- }};
- method.Templates.Add(new TemplateDefinition("T", null));
- method.Body = new BlockStatement();
- method.Body.AddChild(new ExpressionStatement(new AssignmentExpression(
- new IdentifierExpression("target"),
- AssignmentOperatorType.Assign,
- new IdentifierExpression("value"))));
- method.Body.AddChild(new ReturnStatement(new IdentifierExpression("value")));
- currentType.AddChild(method);
- }
-
- bool IsClassType(ClassType c)
- {
- if (currentType == null) return false;
- return currentType.Type == c;
- }
-
- public override object VisitMethodDeclaration(MethodDeclaration methodDeclaration, object data)
- {
- if (!IsClassType(ClassType.Interface) && (methodDeclaration.Modifier & Modifiers.Visibility) == 0)
- methodDeclaration.Modifier |= Modifiers.Private;
-
- base.VisitMethodDeclaration(methodDeclaration, data);
-
- const Modifiers externStatic = Modifiers.Static | Modifiers.Extern;
- if ((methodDeclaration.Modifier & externStatic) == externStatic
- && methodDeclaration.Body.IsNull)
- {
- foreach (AttributeSection sec in methodDeclaration.Attributes) {
- foreach (Attribute att in sec.Attributes) {
- if ("DllImport".Equals(att.Name, StringComparison.InvariantCultureIgnoreCase)) {
- if (ConvertPInvoke(methodDeclaration, att)) {
- sec.Attributes.Remove(att);
- break;
- }
- }
- }
- if (sec.Attributes.Count == 0) {
- methodDeclaration.Attributes.Remove(sec);
- break;
- }
- }
- }
-
- ToVBNetRenameConflictingVariablesVisitor.RenameConflicting(methodDeclaration);
-
- return null;
- }
-
- bool ConvertPInvoke(MethodDeclaration method, ICSharpCode.NRefactory.Ast.Attribute att)
- {
- if (att.PositionalArguments.Count != 1)
- return false;
- PrimitiveExpression pe = att.PositionalArguments[0] as PrimitiveExpression;
- if (pe == null || !(pe.Value is string))
- return false;
- string libraryName = (string)pe.Value;
- string alias = null;
- bool setLastError = false;
- bool exactSpelling = false;
- CharsetModifier charSet = CharsetModifier.Auto;
- foreach (NamedArgumentExpression arg in att.NamedArguments) {
- switch (arg.Name) {
- case "SetLastError":
- pe = arg.Expression as PrimitiveExpression;
- if (pe != null && pe.Value is bool)
- setLastError = (bool)pe.Value;
- else
- return false;
- break;
- case "ExactSpelling":
- pe = arg.Expression as PrimitiveExpression;
- if (pe != null && pe.Value is bool)
- exactSpelling = (bool)pe.Value;
- else
- return false;
- break;
- case "CharSet":
- {
- MemberReferenceExpression fre = arg.Expression as MemberReferenceExpression;
- if (fre == null || !(fre.TargetObject is IdentifierExpression))
- return false;
- if ((fre.TargetObject as IdentifierExpression).Identifier != "CharSet")
- return false;
- switch (fre.MemberName) {
- case "Unicode":
- charSet = CharsetModifier.Unicode;
- break;
- case "Auto":
- charSet = CharsetModifier.Auto;
- break;
- case "Ansi":
- charSet = CharsetModifier.Ansi;
- break;
- default:
- return false;
- }
- }
- break;
- case "EntryPoint":
- pe = arg.Expression as PrimitiveExpression;
- if (pe != null)
- alias = pe.Value as string;
- break;
- default:
- return false;
- }
- }
- if (setLastError && exactSpelling) {
- // Only P/Invokes with SetLastError and ExactSpelling can be converted to a DeclareDeclaration
- const Modifiers removeModifiers = Modifiers.Static | Modifiers.Extern;
- DeclareDeclaration decl = new DeclareDeclaration(method.Name, method.Modifier &~ removeModifiers,
- method.TypeReference,
- method.Parameters,
- method.Attributes,
- libraryName, alias, charSet);
- ReplaceCurrentNode(decl);
- base.VisitDeclareDeclaration(decl, null);
- return true;
- } else {
- return false;
- }
- }
-
- public override object VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration, object data)
- {
- if (!IsClassType(ClassType.Interface) && (propertyDeclaration.Modifier & Modifiers.Visibility) == 0)
- propertyDeclaration.Modifier |= Modifiers.Private;
- base.VisitPropertyDeclaration(propertyDeclaration, data);
-
- ToVBNetRenameConflictingVariablesVisitor.RenameConflicting(propertyDeclaration);
-
- return null;
- }
-
- public override object VisitEventDeclaration(EventDeclaration eventDeclaration, object data)
- {
- if (!IsClassType(ClassType.Interface) && (eventDeclaration.Modifier & Modifiers.Visibility) == 0)
- eventDeclaration.Modifier |= Modifiers.Private;
- return base.VisitEventDeclaration(eventDeclaration, data);
- }
-
- public override object VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data)
- {
- // make constructor private if visiblity is not set (unless constructor is static)
- if ((constructorDeclaration.Modifier & (Modifiers.Visibility | Modifiers.Static)) == 0)
- constructorDeclaration.Modifier |= Modifiers.Private;
- base.VisitConstructorDeclaration(constructorDeclaration, data);
-
- ToVBNetRenameConflictingVariablesVisitor.RenameConflicting(constructorDeclaration);
-
- return null;
- }
-
- public override object VisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression, object data)
- {
- base.VisitParenthesizedExpression(parenthesizedExpression, data);
- if (parenthesizedExpression.Expression is CastExpression) {
- ReplaceCurrentNode(parenthesizedExpression.Expression); // remove parenthesis
- }
- return null;
- }
-
- public override object VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object data)
- {
- for (int i = 0; i < arrayCreateExpression.Arguments.Count; i++) {
- arrayCreateExpression.Arguments[i] = Expression.AddInteger(arrayCreateExpression.Arguments[i], -1);
- }
- return base.VisitArrayCreateExpression(arrayCreateExpression, data);
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
+// <version>$Revision: 4570 $</version>
+// </file>
+
+using System;
+using System.Collections.Generic;
+using ICSharpCode.NRefactory.Ast;
+using ICSharpCode.NRefactory.AstBuilder;
+using Attribute = ICSharpCode.NRefactory.Ast.Attribute;
+
+namespace ICSharpCode.NRefactory.Visitors
+{
+ /// <summary>
+ /// Converts elements not supported by VB to their VB representation.
+ /// Not all elements are converted here, most simple elements (e.g. ConditionalExpression)
+ /// are converted in the output visitor.
+ /// </summary>
+ public class ToVBNetConvertVisitor : ConvertVisitorBase
+ {
+ // The following conversions are implemented:
+ // Conflicting field/property names -> m_field
+ // Conflicting variable names inside methods
+ // Anonymous methods are put into new methods
+ // Simple event handler creation is replaced with AddressOfExpression
+ // Move Imports-statements out of namespaces
+ // Parenthesis around Cast expressions remove - these are syntax errors in VB.NET
+ // Decrease array creation size - VB specifies upper bound instead of array length
+ // Automatic properties are converted to explicit implementation
+
+ List<INode> nodesToMoveToCompilationUnit = new List<INode>();
+
+ public override object VisitCompilationUnit(CompilationUnit compilationUnit, object data)
+ {
+ base.VisitCompilationUnit(compilationUnit, data);
+ for (int i = 0; i < nodesToMoveToCompilationUnit.Count; i++) {
+ compilationUnit.Children.Insert(i, nodesToMoveToCompilationUnit[i]);
+ nodesToMoveToCompilationUnit[i].Parent = compilationUnit;
+ }
+ return null;
+ }
+
+ public override object VisitUsingDeclaration(UsingDeclaration usingDeclaration, object data)
+ {
+ base.VisitUsingDeclaration(usingDeclaration, data);
+ if (usingDeclaration.Parent is NamespaceDeclaration) {
+ nodesToMoveToCompilationUnit.Add(usingDeclaration);
+ RemoveCurrentNode();
+ }
+ return null;
+ }
+
+ TypeDeclaration currentType;
+
+ public override object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
+ {
+ // fix default inner type visibility
+ if (currentType != null && (typeDeclaration.Modifier & Modifiers.Visibility) == 0)
+ typeDeclaration.Modifier |= Modifiers.Private;
+
+ TypeDeclaration outerType = currentType;
+ currentType = typeDeclaration;
+
+ if ((typeDeclaration.Modifier & Modifiers.Static) == Modifiers.Static) {
+ typeDeclaration.Modifier &= ~Modifiers.Static;
+ typeDeclaration.Modifier |= Modifiers.Sealed;
+ typeDeclaration.Children.Insert(0, new ConstructorDeclaration("#ctor", Modifiers.Private, null, null));
+ }
+
+ // Conflicting field/property names -> m_field
+ List<string> properties = new List<string>();
+ foreach (object o in typeDeclaration.Children) {
+ PropertyDeclaration pd = o as PropertyDeclaration;
+ if (pd != null) {
+ properties.Add(pd.Name);
+ }
+ }
+ List<VariableDeclaration> conflicts = new List<VariableDeclaration>();
+ foreach (object o in typeDeclaration.Children) {
+ FieldDeclaration fd = o as FieldDeclaration;
+ if (fd != null) {
+ foreach (VariableDeclaration var in fd.Fields) {
+ string name = var.Name;
+ foreach (string propertyName in properties) {
+ if (name.Equals(propertyName, StringComparison.InvariantCultureIgnoreCase)) {
+ conflicts.Add(var);
+ }
+ }
+ }
+ }
+ }
+ new PrefixFieldsVisitor(conflicts, "m_").Run(typeDeclaration);
+ base.VisitTypeDeclaration(typeDeclaration, data);
+ currentType = outerType;
+
+ return null;
+ }
+
+ public override object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data)
+ {
+ // fix default inner type visibility
+ if (currentType != null && (delegateDeclaration.Modifier & Modifiers.Visibility) == 0)
+ delegateDeclaration.Modifier |= Modifiers.Private;
+
+ return base.VisitDelegateDeclaration(delegateDeclaration, data);
+ }
+
+ public override object VisitExpressionStatement(ExpressionStatement expressionStatement, object data)
+ {
+ base.VisitExpressionStatement(expressionStatement, data);
+ AssignmentExpression ass = expressionStatement.Expression as AssignmentExpression;
+ if (ass != null && ass.Right is AddressOfExpression) {
+ if (ass.Op == AssignmentOperatorType.Add) {
+ ReplaceCurrentNode(new AddHandlerStatement(ass.Left, ass.Right));
+ } else if (ass.Op == AssignmentOperatorType.Subtract) {
+ ReplaceCurrentNode(new RemoveHandlerStatement(ass.Left, ass.Right));
+ }
+ }
+ return null;
+ }
+
+ static string GetMemberNameOnThisReference(Expression expr)
+ {
+ IdentifierExpression ident = expr as IdentifierExpression;
+ if (ident != null)
+ return ident.Identifier;
+ MemberReferenceExpression fre = expr as MemberReferenceExpression;
+ if (fre != null && fre.TargetObject is ThisReferenceExpression)
+ return fre.MemberName;
+ return null;
+ }
+
+ public override object VisitAnonymousMethodExpression(AnonymousMethodExpression anonymousMethodExpression, object data)
+ {
+ base.VisitAnonymousMethodExpression(anonymousMethodExpression, data);
+ if (anonymousMethodExpression.Body.Children.Count == 1) {
+ ReturnStatement rs = anonymousMethodExpression.Body.Children[0] as ReturnStatement;
+ if (rs != null) {
+ LambdaExpression lambda = new LambdaExpression();
+ lambda.ExpressionBody = rs.Expression;
+ lambda.Parameters = anonymousMethodExpression.Parameters;
+ ReplaceCurrentNode(lambda);
+ }
+ }
+ return null;
+ }
+
+ public override object VisitAssignmentExpression(AssignmentExpression assignmentExpression, object data)
+ {
+ base.VisitAssignmentExpression(assignmentExpression, data);
+ if (assignmentExpression.Op == AssignmentOperatorType.Assign && !(assignmentExpression.Parent is ExpressionStatement)) {
+ AddInlineAssignHelper();
+ ReplaceCurrentNode(
+ new InvocationExpression(
+ new IdentifierExpression("InlineAssignHelper"),
+ new List<Expression> { assignmentExpression.Left, assignmentExpression.Right }
+ ));
+ }
+ return null;
+ }
+
+ void AddInlineAssignHelper()
+ {
+ MethodDeclaration method;
+ foreach (INode node in currentType.Children) {
+ method = node as MethodDeclaration;
+ if (method != null && method.Name == "InlineAssignHelper") {
+ // inline assign helper already exists
+ return;
+ }
+ }
+
+ method = new MethodDeclaration {
+ Name = "InlineAssignHelper",
+ Modifier = Modifiers.Private | Modifiers.Static,
+ TypeReference = new TypeReference("T"),
+ Parameters = new List<ParameterDeclarationExpression> {
+ new ParameterDeclarationExpression(new TypeReference("T"), "target", ParameterModifiers.Ref),
+ new ParameterDeclarationExpression(new TypeReference("T"), "value")
+ }};
+ method.Templates.Add(new TemplateDefinition("T", null));
+ method.Body = new BlockStatement();
+ method.Body.AddChild(new ExpressionStatement(new AssignmentExpression(
+ new IdentifierExpression("target"),
+ AssignmentOperatorType.Assign,
+ new IdentifierExpression("value"))));
+ method.Body.AddChild(new ReturnStatement(new IdentifierExpression("value")));
+ currentType.AddChild(method);
+ }
+
+ bool IsClassType(ClassType c)
+ {
+ if (currentType == null) return false;
+ return currentType.Type == c;
+ }
+
+ public override object VisitMethodDeclaration(MethodDeclaration methodDeclaration, object data)
+ {
+ if (!IsClassType(ClassType.Interface) && (methodDeclaration.Modifier & Modifiers.Visibility) == 0)
+ methodDeclaration.Modifier |= Modifiers.Private;
+
+ base.VisitMethodDeclaration(methodDeclaration, data);
+
+ const Modifiers externStatic = Modifiers.Static | Modifiers.Extern;
+ if ((methodDeclaration.Modifier & externStatic) == externStatic
+ && methodDeclaration.Body.IsNull)
+ {
+ foreach (AttributeSection sec in methodDeclaration.Attributes) {
+ foreach (Attribute att in sec.Attributes) {
+ if ("DllImport".Equals(att.Name, StringComparison.InvariantCultureIgnoreCase)) {
+ if (ConvertPInvoke(methodDeclaration, att)) {
+ sec.Attributes.Remove(att);
+ break;
+ }
+ }
+ }
+ if (sec.Attributes.Count == 0) {
+ methodDeclaration.Attributes.Remove(sec);
+ break;
+ }
+ }
+ }
+
+ ToVBNetRenameConflictingVariablesVisitor.RenameConflicting(methodDeclaration);
+
+ return null;
+ }
+
+ bool ConvertPInvoke(MethodDeclaration method, ICSharpCode.NRefactory.Ast.Attribute att)
+ {
+ if (att.PositionalArguments.Count != 1)
+ return false;
+ PrimitiveExpression pe = att.PositionalArguments[0] as PrimitiveExpression;
+ if (pe == null || !(pe.Value is string))
+ return false;
+ string libraryName = (string)pe.Value;
+ string alias = null;
+ bool setLastError = false;
+ bool exactSpelling = false;
+ CharsetModifier charSet = CharsetModifier.Auto;
+ foreach (NamedArgumentExpression arg in att.NamedArguments) {
+ switch (arg.Name) {
+ case "SetLastError":
+ pe = arg.Expression as PrimitiveExpression;
+ if (pe != null && pe.Value is bool)
+ setLastError = (bool)pe.Value;
+ else
+ return false;
+ break;
+ case "ExactSpelling":
+ pe = arg.Expression as PrimitiveExpression;
+ if (pe != null && pe.Value is bool)
+ exactSpelling = (bool)pe.Value;
+ else
+ return false;
+ break;
+ case "CharSet":
+ {
+ MemberReferenceExpression fre = arg.Expression as MemberReferenceExpression;
+ if (fre == null || !(fre.TargetObject is IdentifierExpression))
+ return false;
+ if ((fre.TargetObject as IdentifierExpression).Identifier != "CharSet")
+ return false;
+ switch (fre.MemberName) {
+ case "Unicode":
+ charSet = CharsetModifier.Unicode;
+ break;
+ case "Auto":
+ charSet = CharsetModifier.Auto;
+ break;
+ case "Ansi":
+ charSet = CharsetModifier.Ansi;
+ break;
+ default:
+ return false;
+ }
+ }
+ break;
+ case "EntryPoint":
+ pe = arg.Expression as PrimitiveExpression;
+ if (pe != null)
+ alias = pe.Value as string;
+ break;
+ default:
+ return false;
+ }
+ }
+ if (setLastError && exactSpelling) {
+ // Only P/Invokes with SetLastError and ExactSpelling can be converted to a DeclareDeclaration
+ const Modifiers removeModifiers = Modifiers.Static | Modifiers.Extern;
+ DeclareDeclaration decl = new DeclareDeclaration(method.Name, method.Modifier &~ removeModifiers,
+ method.TypeReference,
+ method.Parameters,
+ method.Attributes,
+ libraryName, alias, charSet);
+ ReplaceCurrentNode(decl);
+ base.VisitDeclareDeclaration(decl, null);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public override object VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration, object data)
+ {
+ if (!IsClassType(ClassType.Interface) && (propertyDeclaration.Modifier & Modifiers.Visibility) == 0)
+ propertyDeclaration.Modifier |= Modifiers.Private;
+ base.VisitPropertyDeclaration(propertyDeclaration, data);
+
+ ToVBNetRenameConflictingVariablesVisitor.RenameConflicting(propertyDeclaration);
+
+ if (!IsClassType(ClassType.Interface) && (propertyDeclaration.Modifier & Modifiers.Abstract) == 0) {
+ if (propertyDeclaration.HasGetRegion && propertyDeclaration.HasSetRegion) {
+ if (propertyDeclaration.GetRegion.Block.IsNull && propertyDeclaration.SetRegion.Block.IsNull) {
+ // automatically implemented property
+ string fieldName = "m_" + propertyDeclaration.Name;
+ Modifiers fieldModifier = propertyDeclaration.Modifier & ~(Modifiers.Visibility) | Modifiers.Private;
+ FieldDeclaration newField = new FieldDeclaration(null, propertyDeclaration.TypeReference, fieldModifier);
+ newField.Fields.Add(new VariableDeclaration(fieldName));
+ InsertAfterSibling(propertyDeclaration, newField);
+
+ propertyDeclaration.GetRegion.Block = new BlockStatement();
+ propertyDeclaration.GetRegion.Block.Return(ExpressionBuilder.Identifier(fieldName));
+ propertyDeclaration.SetRegion.Block = new BlockStatement();
+ propertyDeclaration.SetRegion.Block.Assign(ExpressionBuilder.Identifier(fieldName), ExpressionBuilder.Identifier("Value"));
+
+ }
+ }
+ }
+
+ return null;
+ }
+
+ public override object VisitEventDeclaration(EventDeclaration eventDeclaration, object data)
+ {
+ if (!IsClassType(ClassType.Interface) && (eventDeclaration.Modifier & Modifiers.Visibility) == 0)
+ eventDeclaration.Modifier |= Modifiers.Private;
+ return base.VisitEventDeclaration(eventDeclaration, data);
+ }
+
+ public override object VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data)
+ {
+ // make constructor private if visiblity is not set (unless constructor is static)
+ if ((constructorDeclaration.Modifier & (Modifiers.Visibility | Modifiers.Static)) == 0)
+ constructorDeclaration.Modifier |= Modifiers.Private;
+ base.VisitConstructorDeclaration(constructorDeclaration, data);
+
+ ToVBNetRenameConflictingVariablesVisitor.RenameConflicting(constructorDeclaration);
+
+ return null;
+ }
+
+ public override object VisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression, object data)
+ {
+ base.VisitParenthesizedExpression(parenthesizedExpression, data);
+ if (parenthesizedExpression.Expression is CastExpression) {
+ ReplaceCurrentNode(parenthesizedExpression.Expression); // remove parenthesis around casts
+ } else if (parenthesizedExpression.Parent is CastExpression) {
+ ReplaceCurrentNode(parenthesizedExpression.Expression); // remove parenthesis inside casts
+ }
+ return null;
+ }
+
+ public override object VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object data)
+ {
+ for (int i = 0; i < arrayCreateExpression.Arguments.Count; i++) {
+ arrayCreateExpression.Arguments[i] = Expression.AddInteger(arrayCreateExpression.Arguments[i], -1);
+ }
+ return base.VisitArrayCreateExpression(arrayCreateExpression, data);
+ }
+
+ public override object VisitDefaultValueExpression(DefaultValueExpression defaultValueExpression, object data)
+ {
+ base.VisitDefaultValueExpression(defaultValueExpression, data);
+ Expression defaultValue = ExpressionBuilder.CreateDefaultValueForType(defaultValueExpression.TypeReference);
+ if (!(defaultValue is DefaultValueExpression))
+ ReplaceCurrentNode(defaultValue);
+ return null;
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Visitors/ToVBNetRenameConflictingVariables.cs b/main/contrib/NRefactory/Project/Src/Visitors/ToVBNetRenameConflictingVariables.cs
index 376819205b..bc166dce4a 100644
--- a/main/contrib/NRefactory/Project/Src/Visitors/ToVBNetRenameConflictingVariables.cs
+++ b/main/contrib/NRefactory/Project/Src/Visitors/ToVBNetRenameConflictingVariables.cs
@@ -1,91 +1,91 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 2357 $</version>
-// </file>
-
-using System;
-using System.Collections.Generic;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Visitors
-{
- /// <summary>
- /// Renames local variables if they conflict with other locals, fields or parameters.
- /// </summary>
- static class ToVBNetRenameConflictingVariablesVisitor
- {
- public static void RenameConflicting(ParametrizedNode method)
- {
- // variable name => case sensitive variable name
- // value is null if there are multiple casings for the variable -> the variable is conflicting
- Dictionary<string, string> caseInsensitive = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);
-
- LookupTableVisitor ltv = new LookupTableVisitor(SupportedLanguage.CSharp);
- method.AcceptVisitor(ltv, null);
-
- // add method parameters to caseInsensitive
- foreach (ParameterDeclarationExpression pde in method.Parameters) {
- AddVariableToDict(caseInsensitive, pde.ParameterName, true);
- }
-
- // add local variables to caseInsensitive
- foreach (KeyValuePair<string, List<LocalLookupVariable>> var in ltv.Variables) {
- AddVariableToDict(caseInsensitive, var.Key, true);
- }
-
- // add used identifiers to caseInsensitive
- FindIdentifiersVisitor fvv = new FindIdentifiersVisitor();
- method.AcceptVisitor(fvv, null);
-
- foreach (KeyValuePair<string, string> pair in fvv.usedIdentifiers) {
- AddVariableToDict(caseInsensitive, pair.Key, false);
- }
-
- int index = 0;
- foreach (ParameterDeclarationExpression pde in method.Parameters) {
- if (caseInsensitive[pde.ParameterName] == null) {
- RenameVariable(method, pde.ParameterName, ref index);
- }
- }
- foreach (KeyValuePair<string, List<LocalLookupVariable>> var in ltv.Variables) {
- if (caseInsensitive[var.Key] == null) {
- RenameVariable(method, var.Key, ref index);
- }
- }
- }
-
- static void RenameVariable(INode method, string from, ref int index)
- {
- index += 1;
- method.AcceptVisitor(new RenameLocalVariableVisitor(from, from + "__" + index, StringComparer.InvariantCulture), null);
- }
-
- static void AddVariableToDict(Dictionary<string, string> caseInsensitive, string varName, bool hasDeclaration)
- {
- string existing;
- if (caseInsensitive.TryGetValue(varName, out existing)) {
- if (existing != null && existing != varName) {
- caseInsensitive[varName] = null;
- }
- } else {
- if (hasDeclaration) {
- caseInsensitive.Add(varName, varName);
- }
- }
- }
-
- sealed class FindIdentifiersVisitor : AbstractAstVisitor
- {
- // use dictionary as HashSet to remember used identifiers
- internal readonly Dictionary<string, string> usedIdentifiers = new Dictionary<string, string>();
-
- public override object VisitIdentifierExpression(IdentifierExpression identifierExpression, object data)
- {
- usedIdentifiers[identifierExpression.Identifier] = null;
- return null;
- }
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
+// <version>$Revision: 4570 $</version>
+// </file>
+
+using System;
+using System.Collections.Generic;
+using ICSharpCode.NRefactory.Ast;
+
+namespace ICSharpCode.NRefactory.Visitors
+{
+ /// <summary>
+ /// Renames local variables if they conflict with other locals, fields or parameters.
+ /// </summary>
+ static class ToVBNetRenameConflictingVariablesVisitor
+ {
+ public static void RenameConflicting(ParametrizedNode method)
+ {
+ // variable name => case sensitive variable name
+ // value is null if there are multiple casings for the variable -> the variable is conflicting
+ Dictionary<string, string> caseInsensitive = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
+
+ LookupTableVisitor ltv = new LookupTableVisitor(SupportedLanguage.CSharp);
+ method.AcceptVisitor(ltv, null);
+
+ // add method parameters to caseInsensitive
+ foreach (ParameterDeclarationExpression pde in method.Parameters) {
+ AddVariableToDict(caseInsensitive, pde.ParameterName, true);
+ }
+
+ // add local variables to caseInsensitive
+ foreach (KeyValuePair<string, List<LocalLookupVariable>> var in ltv.Variables) {
+ AddVariableToDict(caseInsensitive, var.Key, true);
+ }
+
+ // add used identifiers to caseInsensitive
+ FindIdentifiersVisitor fvv = new FindIdentifiersVisitor();
+ method.AcceptVisitor(fvv, null);
+
+ foreach (KeyValuePair<string, string> pair in fvv.usedIdentifiers) {
+ AddVariableToDict(caseInsensitive, pair.Key, false);
+ }
+
+ int index = 0;
+ foreach (ParameterDeclarationExpression pde in method.Parameters) {
+ if (caseInsensitive[pde.ParameterName] == null) {
+ RenameVariable(method, pde.ParameterName, ref index);
+ }
+ }
+ foreach (KeyValuePair<string, List<LocalLookupVariable>> var in ltv.Variables) {
+ if (caseInsensitive[var.Key] == null) {
+ RenameVariable(method, var.Key, ref index);
+ }
+ }
+ }
+
+ static void RenameVariable(INode method, string from, ref int index)
+ {
+ index += 1;
+ method.AcceptVisitor(new RenameLocalVariableVisitor(from, from + "__" + index, StringComparer.Ordinal), null);
+ }
+
+ static void AddVariableToDict(Dictionary<string, string> caseInsensitive, string varName, bool hasDeclaration)
+ {
+ string existing;
+ if (caseInsensitive.TryGetValue(varName, out existing)) {
+ if (existing != null && existing != varName) {
+ caseInsensitive[varName] = null;
+ }
+ } else {
+ if (hasDeclaration) {
+ caseInsensitive.Add(varName, varName);
+ }
+ }
+ }
+
+ sealed class FindIdentifiersVisitor : AbstractAstVisitor
+ {
+ // use dictionary as HashSet to remember used identifiers
+ internal readonly Dictionary<string, string> usedIdentifiers = new Dictionary<string, string>();
+
+ public override object VisitIdentifierExpression(IdentifierExpression identifierExpression, object data)
+ {
+ usedIdentifiers[identifierExpression.Identifier] = null;
+ return null;
+ }
+ }
+ }
+}
diff --git a/main/contrib/NRefactory/Project/Src/Visitors/VBNetConstructsConvertVisitor.cs b/main/contrib/NRefactory/Project/Src/Visitors/VBNetConstructsConvertVisitor.cs
index 0f2ade9654..749ee1e68c 100644
--- a/main/contrib/NRefactory/Project/Src/Visitors/VBNetConstructsConvertVisitor.cs
+++ b/main/contrib/NRefactory/Project/Src/Visitors/VBNetConstructsConvertVisitor.cs
@@ -1,507 +1,507 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 3832 $</version>
-// </file>
-
-using ICSharpCode.NRefactory.AstBuilder;
-using System;
-using System.Collections.Generic;
-using System.Reflection;
-using ICSharpCode.NRefactory.Ast;
-using Attribute = ICSharpCode.NRefactory.Ast.Attribute;
-
-namespace ICSharpCode.NRefactory.Visitors
-{
- /// <summary>
- /// Converts special VB constructs to use more general AST classes.
- /// </summary>
- public class VBNetConstructsConvertVisitor : ConvertVisitorBase
- {
- // The following conversions are implemented:
- // MyBase.New() and MyClass.New() calls inside the constructor are converted to :base() and :this()
- // Add Public Modifier to inner types, methods, properties and fields in structures
- // Override Finalize => Destructor
- // IIF(cond, true, false) => ConditionalExpression
- // Built-in methods => Prefix with class name
- // Function A() \n A = SomeValue \n End Function -> convert to return statement
- // Array creation => add 1 to upper bound to get array length
- // Comparison with empty string literal -> string.IsNullOrEmpty
- // Add default value to local variable declarations without initializer
-
- /// <summary>
- /// Specifies whether the "Add default value to local variable declarations without initializer"
- /// operation is executed by this convert visitor.
- /// </summary>
- public bool AddDefaultValueInitializerToLocalVariableDeclarations = true;
-
- Dictionary<string, string> usings;
- List<UsingDeclaration> addedUsings;
- TypeDeclaration currentTypeDeclaration;
-
- public override object VisitCompilationUnit(CompilationUnit compilationUnit, object data)
- {
- usings = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);
- addedUsings = new List<UsingDeclaration>();
- base.VisitCompilationUnit(compilationUnit, data);
- int i;
- for (i = 0; i < compilationUnit.Children.Count; i++) {
- if (!(compilationUnit.Children[i] is UsingDeclaration))
- break;
- }
- foreach (UsingDeclaration decl in addedUsings) {
- decl.Parent = compilationUnit;
- compilationUnit.Children.Insert(i++, decl);
- }
- usings = null;
- addedUsings = null;
- return null;
- }
-
- public override object VisitUsing(Using @using, object data)
- {
- if (usings != null && !@using.IsAlias) {
- usings[@using.Name] = @using.Name;
- }
- return base.VisitUsing(@using, data);
- }
-
- public override object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
- {
- // fix default visibility of inner classes
- if (currentTypeDeclaration != null && (typeDeclaration.Modifier & Modifiers.Visibility) == 0)
- typeDeclaration.Modifier |= Modifiers.Public;
-
- TypeDeclaration oldTypeDeclaration = currentTypeDeclaration;
- currentTypeDeclaration = typeDeclaration;
- base.VisitTypeDeclaration(typeDeclaration, data);
- currentTypeDeclaration = oldTypeDeclaration;
- return null;
- }
-
- public override object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data)
- {
- // fix default visibility of inner classes
- if (currentTypeDeclaration != null && (delegateDeclaration.Modifier & Modifiers.Visibility) == 0)
- delegateDeclaration.Modifier |= Modifiers.Public;
-
- return base.VisitDelegateDeclaration(delegateDeclaration, data);
- }
-
- bool IsClassType(ClassType c)
- {
- if (currentTypeDeclaration == null) return false;
- return currentTypeDeclaration.Type == c;
- }
-
- public override object VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data)
- {
- // make constructor public if visiblity is not set (unless constructor is static)
- if ((constructorDeclaration.Modifier & (Modifiers.Visibility | Modifiers.Static)) == 0)
- constructorDeclaration.Modifier |= Modifiers.Public;
-
- // MyBase.New() and MyClass.New() calls inside the constructor are converted to :base() and :this()
- BlockStatement body = constructorDeclaration.Body;
- if (body != null && body.Children.Count > 0) {
- ExpressionStatement se = body.Children[0] as ExpressionStatement;
- if (se != null) {
- InvocationExpression ie = se.Expression as InvocationExpression;
- if (ie != null) {
- MemberReferenceExpression fre = ie.TargetObject as MemberReferenceExpression;
- if (fre != null && "New".Equals(fre.MemberName, StringComparison.InvariantCultureIgnoreCase)) {
- if (fre.TargetObject is BaseReferenceExpression || fre.TargetObject is ClassReferenceExpression || fre.TargetObject is ThisReferenceExpression) {
- body.Children.RemoveAt(0);
- ConstructorInitializer ci = new ConstructorInitializer();
- ci.Arguments = ie.Arguments;
- if (fre.TargetObject is BaseReferenceExpression)
- ci.ConstructorInitializerType = ConstructorInitializerType.Base;
- else
- ci.ConstructorInitializerType = ConstructorInitializerType.This;
- constructorDeclaration.ConstructorInitializer = ci;
- }
- }
- }
- }
- }
- return base.VisitConstructorDeclaration(constructorDeclaration, data);
- }
-
- public override object VisitDeclareDeclaration(DeclareDeclaration declareDeclaration, object data)
- {
- if (usings != null && !usings.ContainsKey("System.Runtime.InteropServices")) {
- UsingDeclaration @using = new UsingDeclaration("System.Runtime.InteropServices");
- addedUsings.Add(@using);
- base.VisitUsingDeclaration(@using, data);
- }
-
- MethodDeclaration method = new MethodDeclaration {
- Name = declareDeclaration.Name,
- Modifier = declareDeclaration.Modifier,
- TypeReference = declareDeclaration.TypeReference,
- Parameters = declareDeclaration.Parameters,
- Attributes = declareDeclaration.Attributes
- };
-
- if ((method.Modifier & Modifiers.Visibility) == 0)
- method.Modifier |= Modifiers.Public;
- method.Modifier |= Modifiers.Extern | Modifiers.Static;
-
- if (method.TypeReference.IsNull) {
- method.TypeReference = new TypeReference("System.Void", true);
- }
-
- Attribute att = new Attribute("DllImport", null, null);
- att.PositionalArguments.Add(CreateStringLiteral(declareDeclaration.Library));
- if (declareDeclaration.Alias.Length > 0) {
- att.NamedArguments.Add(new NamedArgumentExpression("EntryPoint", CreateStringLiteral(declareDeclaration.Alias)));
- }
- switch (declareDeclaration.Charset) {
- case CharsetModifier.Auto:
- att.NamedArguments.Add(new NamedArgumentExpression("CharSet",
- new MemberReferenceExpression(new IdentifierExpression("CharSet"),
- "Auto")));
- break;
- case CharsetModifier.Unicode:
- att.NamedArguments.Add(new NamedArgumentExpression("CharSet",
- new MemberReferenceExpression(new IdentifierExpression("CharSet"),
- "Unicode")));
- break;
- default:
- att.NamedArguments.Add(new NamedArgumentExpression("CharSet",
- new MemberReferenceExpression(new IdentifierExpression("CharSet"),
- "Ansi")));
- break;
- }
- att.NamedArguments.Add(new NamedArgumentExpression("SetLastError", new PrimitiveExpression(true, true.ToString())));
- att.NamedArguments.Add(new NamedArgumentExpression("ExactSpelling", new PrimitiveExpression(true, true.ToString())));
- method.Attributes.Add(new AttributeSection { Attributes = { att } });
- ReplaceCurrentNode(method);
- return base.VisitMethodDeclaration(method, data);
- }
-
- static PrimitiveExpression CreateStringLiteral(string text)
- {
- return new PrimitiveExpression(text, text);
- }
-
- public override object VisitMethodDeclaration(MethodDeclaration methodDeclaration, object data)
- {
- if (!IsClassType(ClassType.Interface) && (methodDeclaration.Modifier & Modifiers.Visibility) == 0)
- methodDeclaration.Modifier |= Modifiers.Public;
-
- if ("Finalize".Equals(methodDeclaration.Name, StringComparison.InvariantCultureIgnoreCase)
- && methodDeclaration.Parameters.Count == 0
- && methodDeclaration.Modifier == (Modifiers.Protected | Modifiers.Override)
- && methodDeclaration.Body.Children.Count == 1)
- {
- TryCatchStatement tcs = methodDeclaration.Body.Children[0] as TryCatchStatement;
- if (tcs != null
- && tcs.StatementBlock is BlockStatement
- && tcs.CatchClauses.Count == 0
- && tcs.FinallyBlock is BlockStatement
- && tcs.FinallyBlock.Children.Count == 1)
- {
- ExpressionStatement se = tcs.FinallyBlock.Children[0] as ExpressionStatement;
- if (se != null) {
- InvocationExpression ie = se.Expression as InvocationExpression;
- if (ie != null
- && ie.Arguments.Count == 0
- && ie.TargetObject is MemberReferenceExpression
- && (ie.TargetObject as MemberReferenceExpression).TargetObject is BaseReferenceExpression
- && "Finalize".Equals((ie.TargetObject as MemberReferenceExpression).MemberName, StringComparison.InvariantCultureIgnoreCase))
- {
- DestructorDeclaration des = new DestructorDeclaration("Destructor", Modifiers.None, methodDeclaration.Attributes);
- ReplaceCurrentNode(des);
- des.Body = (BlockStatement)tcs.StatementBlock;
- return base.VisitDestructorDeclaration(des, data);
- }
- }
- }
- }
-
- if ((methodDeclaration.Modifier & (Modifiers.Static | Modifiers.Extern)) == Modifiers.Static
- && methodDeclaration.Body.Children.Count == 0)
- {
- foreach (AttributeSection sec in methodDeclaration.Attributes) {
- foreach (Attribute att in sec.Attributes) {
- if ("DllImport".Equals(att.Name, StringComparison.InvariantCultureIgnoreCase)) {
- methodDeclaration.Modifier |= Modifiers.Extern;
- methodDeclaration.Body = null;
- }
- }
- }
- }
-
- if (methodDeclaration.TypeReference.Type != "System.Void" && methodDeclaration.Body.Children.Count > 0) {
- if (IsAssignmentTo(methodDeclaration.Body.Children[methodDeclaration.Body.Children.Count - 1], methodDeclaration.Name))
- {
- Expression returnValue = GetAssignmentFromStatement(methodDeclaration.Body.Children[methodDeclaration.Body.Children.Count - 1]).Right;
- methodDeclaration.Body.Children.RemoveAt(methodDeclaration.Body.Children.Count - 1);
- methodDeclaration.Body.Return(returnValue);
- } else {
- ReturnStatementForFunctionAssignment visitor = new ReturnStatementForFunctionAssignment(methodDeclaration.Name);
- methodDeclaration.Body.AcceptVisitor(visitor, null);
- if (visitor.replacementCount > 0) {
- Expression init;
- init = ExpressionBuilder.CreateDefaultValueForType(methodDeclaration.TypeReference);
- methodDeclaration.Body.Children.Insert(0, new LocalVariableDeclaration(new VariableDeclaration(FunctionReturnValueName, init, methodDeclaration.TypeReference)));
- methodDeclaration.Body.Children[0].Parent = methodDeclaration.Body;
- methodDeclaration.Body.Return(new IdentifierExpression(FunctionReturnValueName));
- }
- }
- }
-
- return base.VisitMethodDeclaration(methodDeclaration, data);
- }
-
- public const string FunctionReturnValueName = "functionReturnValue";
-
- static AssignmentExpression GetAssignmentFromStatement(INode statement)
- {
- ExpressionStatement se = statement as ExpressionStatement;
- if (se == null) return null;
- return se.Expression as AssignmentExpression;
- }
-
- static bool IsAssignmentTo(INode statement, string varName)
- {
- AssignmentExpression ass = GetAssignmentFromStatement(statement);
- if (ass == null) return false;
- IdentifierExpression ident = ass.Left as IdentifierExpression;
- if (ident == null) return false;
- return ident.Identifier.Equals(varName, StringComparison.InvariantCultureIgnoreCase);
- }
-
- #region Create return statement for assignment to function name
- class ReturnStatementForFunctionAssignment : AbstractAstTransformer
- {
- string functionName;
- internal int replacementCount = 0;
-
- public ReturnStatementForFunctionAssignment(string functionName)
- {
- this.functionName = functionName;
- }
-
- public override object VisitIdentifierExpression(IdentifierExpression identifierExpression, object data)
- {
- if (identifierExpression.Identifier.Equals(functionName, StringComparison.InvariantCultureIgnoreCase)) {
- if (!(identifierExpression.Parent is AddressOfExpression) && !(identifierExpression.Parent is InvocationExpression)) {
- identifierExpression.Identifier = FunctionReturnValueName;
- replacementCount++;
- }
- }
- return base.VisitIdentifierExpression(identifierExpression, data);
- }
- }
- #endregion
-
- public override object VisitFieldDeclaration(FieldDeclaration fieldDeclaration, object data)
- {
- fieldDeclaration.Modifier &= ~Modifiers.Dim; // remove "Dim" flag
- if (IsClassType(ClassType.Struct)) {
- if ((fieldDeclaration.Modifier & Modifiers.Visibility) == 0)
- fieldDeclaration.Modifier |= Modifiers.Public;
- }
- return base.VisitFieldDeclaration(fieldDeclaration, data);
- }
-
- public override object VisitEventDeclaration(EventDeclaration eventDeclaration, object data)
- {
- if (!IsClassType(ClassType.Interface) && (eventDeclaration.Modifier & Modifiers.Visibility) == 0)
- eventDeclaration.Modifier |= Modifiers.Public;
-
- return base.VisitEventDeclaration(eventDeclaration, data);
- }
-
- public override object VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration, object data)
- {
- if (!IsClassType(ClassType.Interface) && (propertyDeclaration.Modifier & Modifiers.Visibility) == 0)
- propertyDeclaration.Modifier |= Modifiers.Public;
-
- if (propertyDeclaration.HasSetRegion) {
- string from = "Value";
- if (propertyDeclaration.SetRegion.Parameters.Count > 0) {
- ParameterDeclarationExpression p = propertyDeclaration.SetRegion.Parameters[0];
- from = p.ParameterName;
- p.ParameterName = "Value";
- }
- propertyDeclaration.SetRegion.AcceptVisitor(new RenameIdentifierVisitor(from, "value", StringComparer.InvariantCultureIgnoreCase), null);
- }
-
- return base.VisitPropertyDeclaration(propertyDeclaration, data);
- }
-
- static volatile Dictionary<string, Expression> constantTable;
- static volatile Dictionary<string, Expression> methodTable;
-
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1802:UseLiteralsWhereAppropriate")]
- public static readonly string VBAssemblyName = "Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
-
- static Dictionary<string, Expression> CreateDictionary(params string[] classNames)
- {
- Dictionary<string, Expression> d = new Dictionary<string, Expression>(StringComparer.InvariantCultureIgnoreCase);
- Assembly asm = Assembly.Load(VBAssemblyName);
- foreach (string className in classNames) {
- Type type = asm.GetType("Microsoft.VisualBasic." + className);
- Expression expr = new IdentifierExpression(className);
- foreach (MemberInfo member in type.GetMembers()) {
- if (member.DeclaringType == type) { // only direct members
- d[member.Name] = expr;
- }
- }
- }
- return d;
- }
-
- public override object VisitIdentifierExpression(IdentifierExpression identifierExpression, object data)
- {
- if (constantTable == null) {
- constantTable = CreateDictionary("Constants");
- }
- Expression expr;
- if (constantTable.TryGetValue(identifierExpression.Identifier, out expr)) {
- MemberReferenceExpression fre = new MemberReferenceExpression(expr, identifierExpression.Identifier);
- ReplaceCurrentNode(fre);
- return base.VisitMemberReferenceExpression(fre, data);
- }
- return base.VisitIdentifierExpression(identifierExpression, data);
- }
-
- public override object VisitInvocationExpression(InvocationExpression invocationExpression, object data)
- {
- IdentifierExpression ident = invocationExpression.TargetObject as IdentifierExpression;
- if (ident != null) {
- if ("IIF".Equals(ident.Identifier, StringComparison.InvariantCultureIgnoreCase)
- && invocationExpression.Arguments.Count == 3)
- {
- ConditionalExpression ce = new ConditionalExpression(invocationExpression.Arguments[0],
- invocationExpression.Arguments[1],
- invocationExpression.Arguments[2]);
- ReplaceCurrentNode(new ParenthesizedExpression(ce));
- return base.VisitConditionalExpression(ce, data);
- }
- if ("IsNothing".Equals(ident.Identifier, StringComparison.InvariantCultureIgnoreCase)
- && invocationExpression.Arguments.Count == 1)
- {
- BinaryOperatorExpression boe = new BinaryOperatorExpression(invocationExpression.Arguments[0],
- BinaryOperatorType.ReferenceEquality,
- new PrimitiveExpression(null, "null"));
- ReplaceCurrentNode(new ParenthesizedExpression(boe));
- return base.VisitBinaryOperatorExpression(boe, data);
- }
- if (methodTable == null) {
- methodTable = CreateDictionary("Conversion", "FileSystem", "Financial", "Information",
- "Interaction", "Strings", "VBMath");
- }
- Expression expr;
- if (methodTable.TryGetValue(ident.Identifier, out expr)) {
- MemberReferenceExpression fre = new MemberReferenceExpression(expr, ident.Identifier);
- invocationExpression.TargetObject = fre;
- }
- }
- return base.VisitInvocationExpression(invocationExpression, data);
- }
-
- public override object VisitUnaryOperatorExpression(UnaryOperatorExpression unaryOperatorExpression, object data)
- {
- base.VisitUnaryOperatorExpression(unaryOperatorExpression, data);
- if (unaryOperatorExpression.Op == UnaryOperatorType.Not) {
- if (unaryOperatorExpression.Expression is BinaryOperatorExpression) {
- unaryOperatorExpression.Expression = new ParenthesizedExpression(unaryOperatorExpression.Expression);
- }
- ParenthesizedExpression pe = unaryOperatorExpression.Expression as ParenthesizedExpression;
- if (pe != null) {
- BinaryOperatorExpression boe = pe.Expression as BinaryOperatorExpression;
- if (boe != null && boe.Op == BinaryOperatorType.ReferenceEquality) {
- boe.Op = BinaryOperatorType.ReferenceInequality;
- ReplaceCurrentNode(pe);
- }
- }
- }
- return null;
- }
-
- public override object VisitUsingStatement(UsingStatement usingStatement, object data)
- {
- LocalVariableDeclaration lvd = usingStatement.ResourceAcquisition as LocalVariableDeclaration;
- if (lvd != null && lvd.Variables.Count > 1) {
- usingStatement.ResourceAcquisition = new LocalVariableDeclaration(lvd.Variables[0]);
- for (int i = 1; i < lvd.Variables.Count; i++) {
- UsingStatement n = new UsingStatement(new LocalVariableDeclaration(lvd.Variables[i]),
- usingStatement.EmbeddedStatement);
- usingStatement.EmbeddedStatement = new BlockStatement();
- usingStatement.EmbeddedStatement.AddChild(n);
- usingStatement = n;
- }
- }
- return base.VisitUsingStatement(usingStatement, data);
- }
-
- public override object VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object data)
- {
- for (int i = 0; i < arrayCreateExpression.Arguments.Count; i++) {
- arrayCreateExpression.Arguments[i] = Expression.AddInteger(arrayCreateExpression.Arguments[i], 1);
- }
- if (arrayCreateExpression.ArrayInitializer.CreateExpressions.Count == 0) {
- arrayCreateExpression.ArrayInitializer = null;
- }
- return base.VisitArrayCreateExpression(arrayCreateExpression, data);
- }
-
- bool IsEmptyStringLiteral(Expression expression)
- {
- PrimitiveExpression pe = expression as PrimitiveExpression;
- if (pe != null) {
- return (pe.Value as string) == "";
- } else {
- return false;
- }
- }
-
- Expression CallStringIsNullOrEmpty(Expression stringVariable)
- {
- List<Expression> arguments = new List<Expression>();
- arguments.Add(stringVariable);
- return new InvocationExpression(
- new MemberReferenceExpression(new TypeReferenceExpression(new TypeReference("System.String", true)), "IsNullOrEmpty"),
- arguments);
- }
-
- public override object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data)
- {
- base.VisitBinaryOperatorExpression(binaryOperatorExpression, data);
- if (IsEmptyStringLiteral(binaryOperatorExpression.Right)) {
- if (binaryOperatorExpression.Op == BinaryOperatorType.Equality) {
- ReplaceCurrentNode(CallStringIsNullOrEmpty(binaryOperatorExpression.Left));
- } else if (binaryOperatorExpression.Op == BinaryOperatorType.InEquality) {
- ReplaceCurrentNode(new UnaryOperatorExpression(CallStringIsNullOrEmpty(binaryOperatorExpression.Left),
- UnaryOperatorType.Not));
- }
- } else if (IsEmptyStringLiteral(binaryOperatorExpression.Left)) {
- if (binaryOperatorExpression.Op == BinaryOperatorType.Equality) {
- ReplaceCurrentNode(CallStringIsNullOrEmpty(binaryOperatorExpression.Right));
- } else if (binaryOperatorExpression.Op == BinaryOperatorType.InEquality) {
- ReplaceCurrentNode(new UnaryOperatorExpression(CallStringIsNullOrEmpty(binaryOperatorExpression.Right),
- UnaryOperatorType.Not));
- }
- }
- return null;
- }
-
- public override object VisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data)
- {
- if (AddDefaultValueInitializerToLocalVariableDeclarations) {
- for (int i = 0; i < localVariableDeclaration.Variables.Count; i++) {
- VariableDeclaration decl = localVariableDeclaration.Variables[i];
- if (decl.FixedArrayInitialization.IsNull && decl.Initializer.IsNull) {
- TypeReference type = localVariableDeclaration.GetTypeForVariable(i);
- decl.Initializer = ExpressionBuilder.CreateDefaultValueForType(type);
- }
- }
- }
- return base.VisitLocalVariableDeclaration(localVariableDeclaration, data);
- }
- }
-}
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
+// <version>$Revision: 4482 $</version>
+// </file>
+
+using ICSharpCode.NRefactory.AstBuilder;
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using ICSharpCode.NRefactory.Ast;
+using Attribute = ICSharpCode.NRefactory.Ast.Attribute;
+
+namespace ICSharpCode.NRefactory.Visitors
+{
+ /// <summary>
+ /// Converts special VB constructs to use more general AST classes.
+ /// </summary>
+ public class VBNetConstructsConvertVisitor : ConvertVisitorBase
+ {
+ // The following conversions are implemented:
+ // MyBase.New() and MyClass.New() calls inside the constructor are converted to :base() and :this()
+ // Add Public Modifier to inner types, methods, properties and fields in structures
+ // Override Finalize => Destructor
+ // IIF(cond, true, false) => ConditionalExpression
+ // Built-in methods => Prefix with class name
+ // Function A() \n A = SomeValue \n End Function -> convert to return statement
+ // Array creation => add 1 to upper bound to get array length
+ // Comparison with empty string literal -> string.IsNullOrEmpty
+ // Add default value to local variable declarations without initializer
+
+ /// <summary>
+ /// Specifies whether the "Add default value to local variable declarations without initializer"
+ /// operation is executed by this convert visitor.
+ /// </summary>
+ public bool AddDefaultValueInitializerToLocalVariableDeclarations = true;
+
+ Dictionary<string, string> usings;
+ List<UsingDeclaration> addedUsings;
+ TypeDeclaration currentTypeDeclaration;
+
+ public override object VisitCompilationUnit(CompilationUnit compilationUnit, object data)
+ {
+ usings = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);
+ addedUsings = new List<UsingDeclaration>();
+ base.VisitCompilationUnit(compilationUnit, data);
+ int i;
+ for (i = 0; i < compilationUnit.Children.Count; i++) {
+ if (!(compilationUnit.Children[i] is UsingDeclaration))
+ break;
+ }
+ foreach (UsingDeclaration decl in addedUsings) {
+ decl.Parent = compilationUnit;
+ compilationUnit.Children.Insert(i++, decl);
+ }
+ usings = null;
+ addedUsings = null;
+ return null;
+ }
+
+ public override object VisitUsing(Using @using, object data)
+ {
+ if (usings != null && !@using.IsAlias) {
+ usings[@using.Name] = @using.Name;
+ }
+ return base.VisitUsing(@using, data);
+ }
+
+ public override object VisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
+ {
+ // fix default visibility of inner classes
+ if (currentTypeDeclaration != null && (typeDeclaration.Modifier & Modifiers.Visibility) == 0)
+ typeDeclaration.Modifier |= Modifiers.Public;
+
+ TypeDeclaration oldTypeDeclaration = currentTypeDeclaration;
+ currentTypeDeclaration = typeDeclaration;
+ base.VisitTypeDeclaration(typeDeclaration, data);
+ currentTypeDeclaration = oldTypeDeclaration;
+ return null;
+ }
+
+ public override object VisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data)
+ {
+ // fix default visibility of inner classes
+ if (currentTypeDeclaration != null && (delegateDeclaration.Modifier & Modifiers.Visibility) == 0)
+ delegateDeclaration.Modifier |= Modifiers.Public;
+
+ return base.VisitDelegateDeclaration(delegateDeclaration, data);
+ }
+
+ bool IsClassType(ClassType c)
+ {
+ if (currentTypeDeclaration == null) return false;
+ return currentTypeDeclaration.Type == c;
+ }
+
+ public override object VisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data)
+ {
+ // make constructor public if visiblity is not set (unless constructor is static)
+ if ((constructorDeclaration.Modifier & (Modifiers.Visibility | Modifiers.Static)) == 0)
+ constructorDeclaration.Modifier |= Modifiers.Public;
+
+ // MyBase.New() and MyClass.New() calls inside the constructor are converted to :base() and :this()
+ BlockStatement body = constructorDeclaration.Body;
+ if (body != null && body.Children.Count > 0) {
+ ExpressionStatement se = body.Children[0] as ExpressionStatement;
+ if (se != null) {
+ InvocationExpression ie = se.Expression as InvocationExpression;
+ if (ie != null) {
+ MemberReferenceExpression fre = ie.TargetObject as MemberReferenceExpression;
+ if (fre != null && "New".Equals(fre.MemberName, StringComparison.InvariantCultureIgnoreCase)) {
+ if (fre.TargetObject is BaseReferenceExpression || fre.TargetObject is ClassReferenceExpression || fre.TargetObject is ThisReferenceExpression) {
+ body.Children.RemoveAt(0);
+ ConstructorInitializer ci = new ConstructorInitializer();
+ ci.Arguments = ie.Arguments;
+ if (fre.TargetObject is BaseReferenceExpression)
+ ci.ConstructorInitializerType = ConstructorInitializerType.Base;
+ else
+ ci.ConstructorInitializerType = ConstructorInitializerType.This;
+ constructorDeclaration.ConstructorInitializer = ci;
+ }
+ }
+ }
+ }
+ }
+ return base.VisitConstructorDeclaration(constructorDeclaration, data);
+ }
+
+ public override object VisitDeclareDeclaration(DeclareDeclaration declareDeclaration, object data)
+ {
+ if (usings != null && !usings.ContainsKey("System.Runtime.InteropServices")) {
+ UsingDeclaration @using = new UsingDeclaration("System.Runtime.InteropServices");
+ addedUsings.Add(@using);
+ base.VisitUsingDeclaration(@using, data);
+ }
+
+ MethodDeclaration method = new MethodDeclaration {
+ Name = declareDeclaration.Name,
+ Modifier = declareDeclaration.Modifier,
+ TypeReference = declareDeclaration.TypeReference,
+ Parameters = declareDeclaration.Parameters,
+ Attributes = declareDeclaration.Attributes
+ };
+
+ if ((method.Modifier & Modifiers.Visibility) == 0)
+ method.Modifier |= Modifiers.Public;
+ method.Modifier |= Modifiers.Extern | Modifiers.Static;
+
+ if (method.TypeReference.IsNull) {
+ method.TypeReference = new TypeReference("System.Void", true);
+ }
+
+ Attribute att = new Attribute("DllImport", null, null);
+ att.PositionalArguments.Add(CreateStringLiteral(declareDeclaration.Library));
+ if (declareDeclaration.Alias.Length > 0) {
+ att.NamedArguments.Add(new NamedArgumentExpression("EntryPoint", CreateStringLiteral(declareDeclaration.Alias)));
+ }
+ switch (declareDeclaration.Charset) {
+ case CharsetModifier.Auto:
+ att.NamedArguments.Add(new NamedArgumentExpression("CharSet",
+ new MemberReferenceExpression(new IdentifierExpression("CharSet"),
+ "Auto")));
+ break;
+ case CharsetModifier.Unicode:
+ att.NamedArguments.Add(new NamedArgumentExpression("CharSet",
+ new MemberReferenceExpression(new IdentifierExpression("CharSet"),
+ "Unicode")));
+ break;
+ default:
+ att.NamedArguments.Add(new NamedArgumentExpression("CharSet",
+ new MemberReferenceExpression(new IdentifierExpression("CharSet"),
+ "Ansi")));
+ break;
+ }
+ att.NamedArguments.Add(new NamedArgumentExpression("SetLastError", new PrimitiveExpression(true, true.ToString())));
+ att.NamedArguments.Add(new NamedArgumentExpression("ExactSpelling", new PrimitiveExpression(true, true.ToString())));
+ method.Attributes.Add(new AttributeSection { Attributes = { att } });
+ ReplaceCurrentNode(method);
+ return base.VisitMethodDeclaration(method, data);
+ }
+
+ static PrimitiveExpression CreateStringLiteral(string text)
+ {
+ return new PrimitiveExpression(text, text);
+ }
+
+ public override object VisitMethodDeclaration(MethodDeclaration methodDeclaration, object data)
+ {
+ if (!IsClassType(ClassType.Interface) && (methodDeclaration.Modifier & Modifiers.Visibility) == 0)
+ methodDeclaration.Modifier |= Modifiers.Public;
+
+ if ("Finalize".Equals(methodDeclaration.Name, StringComparison.InvariantCultureIgnoreCase)
+ && methodDeclaration.Parameters.Count == 0
+ && methodDeclaration.Modifier == (Modifiers.Protected | Modifiers.Override)
+ && methodDeclaration.Body.Children.Count == 1)
+ {
+ TryCatchStatement tcs = methodDeclaration.Body.Children[0] as TryCatchStatement;
+ if (tcs != null
+ && tcs.StatementBlock is BlockStatement
+ && tcs.CatchClauses.Count == 0
+ && tcs.FinallyBlock is BlockStatement
+ && tcs.FinallyBlock.Children.Count == 1)
+ {
+ ExpressionStatement se = tcs.FinallyBlock.Children[0] as ExpressionStatement;
+ if (se != null) {
+ InvocationExpression ie = se.Expression as InvocationExpression;
+ if (ie != null
+ && ie.Arguments.Count == 0
+ && ie.TargetObject is MemberReferenceExpression
+ && (ie.TargetObject as MemberReferenceExpression).TargetObject is BaseReferenceExpression
+ && "Finalize".Equals((ie.TargetObject as MemberReferenceExpression).MemberName, StringComparison.InvariantCultureIgnoreCase))
+ {
+ DestructorDeclaration des = new DestructorDeclaration("Destructor", Modifiers.None, methodDeclaration.Attributes);
+ ReplaceCurrentNode(des);
+ des.Body = (BlockStatement)tcs.StatementBlock;
+ return base.VisitDestructorDeclaration(des, data);
+ }
+ }
+ }
+ }
+
+ if ((methodDeclaration.Modifier & (Modifiers.Static | Modifiers.Extern)) == Modifiers.Static
+ && methodDeclaration.Body.Children.Count == 0)
+ {
+ foreach (AttributeSection sec in methodDeclaration.Attributes) {
+ foreach (Attribute att in sec.Attributes) {
+ if ("DllImport".Equals(att.Name, StringComparison.InvariantCultureIgnoreCase)) {
+ methodDeclaration.Modifier |= Modifiers.Extern;
+ methodDeclaration.Body = null;
+ }
+ }
+ }
+ }
+
+ if (methodDeclaration.TypeReference.Type != "System.Void" && methodDeclaration.Body.Children.Count > 0) {
+ if (IsAssignmentTo(methodDeclaration.Body.Children[methodDeclaration.Body.Children.Count - 1], methodDeclaration.Name))
+ {
+ Expression returnValue = GetAssignmentFromStatement(methodDeclaration.Body.Children[methodDeclaration.Body.Children.Count - 1]).Right;
+ methodDeclaration.Body.Children.RemoveAt(methodDeclaration.Body.Children.Count - 1);
+ methodDeclaration.Body.Return(returnValue);
+ } else {
+ ReturnStatementForFunctionAssignment visitor = new ReturnStatementForFunctionAssignment(methodDeclaration.Name);
+ methodDeclaration.Body.AcceptVisitor(visitor, null);
+ if (visitor.replacementCount > 0) {
+ Expression init;
+ init = ExpressionBuilder.CreateDefaultValueForType(methodDeclaration.TypeReference);
+ methodDeclaration.Body.Children.Insert(0, new LocalVariableDeclaration(new VariableDeclaration(FunctionReturnValueName, init, methodDeclaration.TypeReference)));
+ methodDeclaration.Body.Children[0].Parent = methodDeclaration.Body;
+ methodDeclaration.Body.Return(new IdentifierExpression(FunctionReturnValueName));
+ }
+ }
+ }
+
+ return base.VisitMethodDeclaration(methodDeclaration, data);
+ }
+
+ public const string FunctionReturnValueName = "functionReturnValue";
+
+ static AssignmentExpression GetAssignmentFromStatement(INode statement)
+ {
+ ExpressionStatement se = statement as ExpressionStatement;
+ if (se == null) return null;
+ return se.Expression as AssignmentExpression;
+ }
+
+ static bool IsAssignmentTo(INode statement, string varName)
+ {
+ AssignmentExpression ass = GetAssignmentFromStatement(statement);
+ if (ass == null) return false;
+ IdentifierExpression ident = ass.Left as IdentifierExpression;
+ if (ident == null) return false;
+ return ident.Identifier.Equals(varName, StringComparison.InvariantCultureIgnoreCase);
+ }
+
+ #region Create return statement for assignment to function name
+ class ReturnStatementForFunctionAssignment : AbstractAstTransformer
+ {
+ string functionName;
+ internal int replacementCount = 0;
+
+ public ReturnStatementForFunctionAssignment(string functionName)
+ {
+ this.functionName = functionName;
+ }
+
+ public override object VisitIdentifierExpression(IdentifierExpression identifierExpression, object data)
+ {
+ if (identifierExpression.Identifier.Equals(functionName, StringComparison.InvariantCultureIgnoreCase)) {
+ if (!(identifierExpression.Parent is AddressOfExpression) && !(identifierExpression.Parent is InvocationExpression)) {
+ identifierExpression.Identifier = FunctionReturnValueName;
+ replacementCount++;
+ }
+ }
+ return base.VisitIdentifierExpression(identifierExpression, data);
+ }
+ }
+ #endregion
+
+ public override object VisitFieldDeclaration(FieldDeclaration fieldDeclaration, object data)
+ {
+ fieldDeclaration.Modifier &= ~Modifiers.Dim; // remove "Dim" flag
+ if (IsClassType(ClassType.Struct)) {
+ if ((fieldDeclaration.Modifier & Modifiers.Visibility) == 0)
+ fieldDeclaration.Modifier |= Modifiers.Public;
+ }
+ return base.VisitFieldDeclaration(fieldDeclaration, data);
+ }
+
+ public override object VisitEventDeclaration(EventDeclaration eventDeclaration, object data)
+ {
+ if (!IsClassType(ClassType.Interface) && (eventDeclaration.Modifier & Modifiers.Visibility) == 0)
+ eventDeclaration.Modifier |= Modifiers.Public;
+
+ return base.VisitEventDeclaration(eventDeclaration, data);
+ }
+
+ public override object VisitPropertyDeclaration(PropertyDeclaration propertyDeclaration, object data)
+ {
+ if (!IsClassType(ClassType.Interface) && (propertyDeclaration.Modifier & Modifiers.Visibility) == 0)
+ propertyDeclaration.Modifier |= Modifiers.Public;
+
+ if (propertyDeclaration.HasSetRegion) {
+ string from = "Value";
+ if (propertyDeclaration.SetRegion.Parameters.Count > 0) {
+ ParameterDeclarationExpression p = propertyDeclaration.SetRegion.Parameters[0];
+ from = p.ParameterName;
+ p.ParameterName = "Value";
+ }
+ propertyDeclaration.SetRegion.AcceptVisitor(new RenameIdentifierVisitor(from, "value", StringComparer.InvariantCultureIgnoreCase), null);
+ }
+
+ return base.VisitPropertyDeclaration(propertyDeclaration, data);
+ }
+
+ static volatile Dictionary<string, Expression> constantTable;
+ static volatile Dictionary<string, Expression> methodTable;
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1802:UseLiteralsWhereAppropriate")]
+ public static readonly string VBAssemblyName = "Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
+
+ static Dictionary<string, Expression> CreateDictionary(params string[] classNames)
+ {
+ Dictionary<string, Expression> d = new Dictionary<string, Expression>(StringComparer.InvariantCultureIgnoreCase);
+ Assembly asm = Assembly.Load(VBAssemblyName);
+ foreach (string className in classNames) {
+ Type type = asm.GetType("Microsoft.VisualBasic." + className);
+ Expression expr = new IdentifierExpression(className);
+ foreach (MemberInfo member in type.GetMembers()) {
+ if (member.DeclaringType == type) { // only direct members
+ d[member.Name] = expr;
+ }
+ }
+ }
+ return d;
+ }
+
+ public override object VisitIdentifierExpression(IdentifierExpression identifierExpression, object data)
+ {
+ if (constantTable == null) {
+ constantTable = CreateDictionary("Constants");
+ }
+ Expression expr;
+ if (constantTable.TryGetValue(identifierExpression.Identifier, out expr)) {
+ MemberReferenceExpression fre = new MemberReferenceExpression(expr, identifierExpression.Identifier);
+ ReplaceCurrentNode(fre);
+ return base.VisitMemberReferenceExpression(fre, data);
+ }
+ return base.VisitIdentifierExpression(identifierExpression, data);
+ }
+
+ public override object VisitInvocationExpression(InvocationExpression invocationExpression, object data)
+ {
+ IdentifierExpression ident = invocationExpression.TargetObject as IdentifierExpression;
+ if (ident != null) {
+ if ("IIF".Equals(ident.Identifier, StringComparison.InvariantCultureIgnoreCase)
+ && invocationExpression.Arguments.Count == 3)
+ {
+ ConditionalExpression ce = new ConditionalExpression(invocationExpression.Arguments[0],
+ invocationExpression.Arguments[1],
+ invocationExpression.Arguments[2]);
+ ReplaceCurrentNode(new ParenthesizedExpression(ce));
+ return base.VisitConditionalExpression(ce, data);
+ }
+ if ("IsNothing".Equals(ident.Identifier, StringComparison.InvariantCultureIgnoreCase)
+ && invocationExpression.Arguments.Count == 1)
+ {
+ BinaryOperatorExpression boe = new BinaryOperatorExpression(invocationExpression.Arguments[0],
+ BinaryOperatorType.ReferenceEquality,
+ new PrimitiveExpression(null, "null"));
+ ReplaceCurrentNode(new ParenthesizedExpression(boe));
+ return base.VisitBinaryOperatorExpression(boe, data);
+ }
+ if (methodTable == null) {
+ methodTable = CreateDictionary("Conversion", "FileSystem", "Financial", "Information",
+ "Interaction", "Strings", "VBMath");
+ }
+ Expression expr;
+ if (methodTable.TryGetValue(ident.Identifier, out expr)) {
+ MemberReferenceExpression fre = new MemberReferenceExpression(expr, ident.Identifier);
+ invocationExpression.TargetObject = fre;
+ }
+ }
+ return base.VisitInvocationExpression(invocationExpression, data);
+ }
+
+ public override object VisitUnaryOperatorExpression(UnaryOperatorExpression unaryOperatorExpression, object data)
+ {
+ base.VisitUnaryOperatorExpression(unaryOperatorExpression, data);
+ if (unaryOperatorExpression.Op == UnaryOperatorType.Not) {
+ if (unaryOperatorExpression.Expression is BinaryOperatorExpression) {
+ unaryOperatorExpression.Expression = new ParenthesizedExpression(unaryOperatorExpression.Expression);
+ }
+ ParenthesizedExpression pe = unaryOperatorExpression.Expression as ParenthesizedExpression;
+ if (pe != null) {
+ BinaryOperatorExpression boe = pe.Expression as BinaryOperatorExpression;
+ if (boe != null && boe.Op == BinaryOperatorType.ReferenceEquality) {
+ boe.Op = BinaryOperatorType.ReferenceInequality;
+ ReplaceCurrentNode(pe);
+ }
+ }
+ }
+ return null;
+ }
+
+ public override object VisitUsingStatement(UsingStatement usingStatement, object data)
+ {
+ LocalVariableDeclaration lvd = usingStatement.ResourceAcquisition as LocalVariableDeclaration;
+ if (lvd != null && lvd.Variables.Count > 1) {
+ usingStatement.ResourceAcquisition = new LocalVariableDeclaration(lvd.Variables[0]);
+ for (int i = 1; i < lvd.Variables.Count; i++) {
+ UsingStatement n = new UsingStatement(new LocalVariableDeclaration(lvd.Variables[i]),
+ usingStatement.EmbeddedStatement);
+ usingStatement.EmbeddedStatement = new BlockStatement();
+ usingStatement.EmbeddedStatement.AddChild(n);
+ usingStatement = n;
+ }
+ }
+ return base.VisitUsingStatement(usingStatement, data);
+ }
+
+ public override object VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object data)
+ {
+ for (int i = 0; i < arrayCreateExpression.Arguments.Count; i++) {
+ arrayCreateExpression.Arguments[i] = Expression.AddInteger(arrayCreateExpression.Arguments[i], 1);
+ }
+ if (arrayCreateExpression.ArrayInitializer.CreateExpressions.Count == 0) {
+ arrayCreateExpression.ArrayInitializer = null;
+ }
+ return base.VisitArrayCreateExpression(arrayCreateExpression, data);
+ }
+
+ bool IsEmptyStringLiteral(Expression expression)
+ {
+ PrimitiveExpression pe = expression as PrimitiveExpression;
+ if (pe != null) {
+ return (pe.Value as string) == "";
+ } else {
+ return false;
+ }
+ }
+
+ Expression CallStringIsNullOrEmpty(Expression stringVariable)
+ {
+ List<Expression> arguments = new List<Expression>();
+ arguments.Add(stringVariable);
+ return new InvocationExpression(
+ new MemberReferenceExpression(new TypeReferenceExpression(new TypeReference("System.String", true)), "IsNullOrEmpty"),
+ arguments);
+ }
+
+ public override object VisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data)
+ {
+ base.VisitBinaryOperatorExpression(binaryOperatorExpression, data);
+ if (IsEmptyStringLiteral(binaryOperatorExpression.Right)) {
+ if (binaryOperatorExpression.Op == BinaryOperatorType.Equality) {
+ ReplaceCurrentNode(CallStringIsNullOrEmpty(binaryOperatorExpression.Left));
+ } else if (binaryOperatorExpression.Op == BinaryOperatorType.InEquality) {
+ ReplaceCurrentNode(new UnaryOperatorExpression(CallStringIsNullOrEmpty(binaryOperatorExpression.Left),
+ UnaryOperatorType.Not));
+ }
+ } else if (IsEmptyStringLiteral(binaryOperatorExpression.Left)) {
+ if (binaryOperatorExpression.Op == BinaryOperatorType.Equality) {
+ ReplaceCurrentNode(CallStringIsNullOrEmpty(binaryOperatorExpression.Right));
+ } else if (binaryOperatorExpression.Op == BinaryOperatorType.InEquality) {
+ ReplaceCurrentNode(new UnaryOperatorExpression(CallStringIsNullOrEmpty(binaryOperatorExpression.Right),
+ UnaryOperatorType.Not));
+ }
+ }
+ return null;
+ }
+
+ public override object VisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data)
+ {
+ if (AddDefaultValueInitializerToLocalVariableDeclarations) {
+ for (int i = 0; i < localVariableDeclaration.Variables.Count; i++) {
+ VariableDeclaration decl = localVariableDeclaration.Variables[i];
+ if (decl.FixedArrayInitialization.IsNull && decl.Initializer.IsNull) {
+ TypeReference type = localVariableDeclaration.GetTypeForVariable(i);
+ decl.Initializer = ExpressionBuilder.CreateDefaultValueForType(type);
+ }
+ }
+ }
+ return base.VisitLocalVariableDeclaration(localVariableDeclaration, data);
+ }
+ }
+}