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:
-rw-r--r--.gitignore1
-rw-r--r--main/Main.sln11
-rw-r--r--main/configure.in1
-rw-r--r--main/contrib/Makefile.am2
-rw-r--r--main/contrib/NRefactory/Makefile.am3
-rw-r--r--main/contrib/NRefactory/NRefactory.sln39
-rw-r--r--main/contrib/NRefactory/NRefactoryASTGenerator/AST/Expressions.cs378
-rw-r--r--main/contrib/NRefactory/NRefactoryASTGenerator/AST/GlobalLevel.cs100
-rw-r--r--main/contrib/NRefactory/NRefactoryASTGenerator/AST/Node.cs72
-rw-r--r--main/contrib/NRefactory/NRefactoryASTGenerator/AST/Statements.cs317
-rw-r--r--main/contrib/NRefactory/NRefactoryASTGenerator/AST/TypeLevel.cs261
-rw-r--r--main/contrib/NRefactory/NRefactoryASTGenerator/AssemblyInfo.cs33
-rw-r--r--main/contrib/NRefactory/NRefactoryASTGenerator/Attributes.cs180
-rw-r--r--main/contrib/NRefactory/NRefactoryASTGenerator/Main.cs581
-rw-r--r--main/contrib/NRefactory/NRefactoryASTGenerator/NRefactoryASTGenerator.csproj62
-rw-r--r--main/contrib/NRefactory/Project/ChangeLog560
-rw-r--r--main/contrib/NRefactory/Project/Configuration/AssemblyInfo.cs28
-rw-r--r--main/contrib/NRefactory/Project/NRefactory.csproj153
-rw-r--r--main/contrib/NRefactory/Project/NRefactory.csproj.user13
-rw-r--r--main/contrib/NRefactory/Project/Resources/ICSharpCode.NRefactory.snkbin596 -> 0 bytes
-rw-r--r--main/contrib/NRefactory/Project/Src/Ast/AbstractNode.cs76
-rw-r--r--main/contrib/NRefactory/Project/Src/Ast/Enums.cs396
-rw-r--r--main/contrib/NRefactory/Project/Src/Ast/General/BlockStatement.cs63
-rw-r--r--main/contrib/NRefactory/Project/Src/Ast/General/CompilationUnit.cs60
-rw-r--r--main/contrib/NRefactory/Project/Src/Ast/General/Expression.cs107
-rw-r--r--main/contrib/NRefactory/Project/Src/Ast/General/LocalVariableDeclaration.cs108
-rw-r--r--main/contrib/NRefactory/Project/Src/Ast/General/PrimitiveExpression.cs63
-rw-r--r--main/contrib/NRefactory/Project/Src/Ast/General/Statement.cs66
-rw-r--r--main/contrib/NRefactory/Project/Src/Ast/Generated.cs5443
-rw-r--r--main/contrib/NRefactory/Project/Src/Ast/INode.cs55
-rw-r--r--main/contrib/NRefactory/Project/Src/Ast/INullable.cs16
-rw-r--r--main/contrib/NRefactory/Project/Src/Ast/TypeReference.cs445
-rw-r--r--main/contrib/NRefactory/Project/Src/AstBuilder/ExpressionBuilder.cs98
-rw-r--r--main/contrib/NRefactory/Project/Src/AstBuilder/StatementBuilder.cs59
-rw-r--r--main/contrib/NRefactory/Project/Src/EnvironmentInformationProvider.cs26
-rw-r--r--main/contrib/NRefactory/Project/Src/IAstVisitor.cs262
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/AbstractLexer.cs374
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/BuildKeywords.pl340
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/CSharp/ConditionalCompilation.cs90
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/CSharp/KeywordList.txt215
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/CSharp/Keywords.cs129
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/CSharp/Lexer.cs1288
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/CSharp/Tokens.cs353
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/ILexer.cs105
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/LookupTable.cs120
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/Special/BlankLine.cs23
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/Special/Comment.cs63
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/Special/CommentType.cs18
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/Special/ISpecial.cs56
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/Special/PreProcessingDirective.cs160
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/Special/SpecialTracker.cs80
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/Special/TagComment.cs33
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/Token.cs107
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/VBNet/KeywordList.txt254
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/VBNet/Keywords.cs212
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/VBNet/Lexer.cs761
-rw-r--r--main/contrib/NRefactory/Project/Src/Lexer/VBNet/Tokens.cs485
-rw-r--r--main/contrib/NRefactory/Project/Src/Location.cs125
-rw-r--r--main/contrib/NRefactory/Project/Src/OperatorPrecedence.cs88
-rw-r--r--main/contrib/NRefactory/Project/Src/Parser/AbstractParser.cs110
-rw-r--r--main/contrib/NRefactory/Project/Src/Parser/CSharp/CSharpParser.cs690
-rw-r--r--main/contrib/NRefactory/Project/Src/Parser/CSharp/Parser.cs6201
-rw-r--r--main/contrib/NRefactory/Project/Src/Parser/CSharp/cs.ATG2601
-rw-r--r--main/contrib/NRefactory/Project/Src/Parser/Errors.cs54
-rw-r--r--main/contrib/NRefactory/Project/Src/Parser/Frames/Parser.frame50
-rw-r--r--main/contrib/NRefactory/Project/Src/Parser/Frames/Scanner.frame202
-rwxr-xr-xmain/contrib/NRefactory/Project/Src/Parser/Frames/SharpCoco.exebin81920 -> 0 bytes
-rw-r--r--main/contrib/NRefactory/Project/Src/Parser/IParser.cs42
-rw-r--r--main/contrib/NRefactory/Project/Src/Parser/ModifierList.cs79
-rw-r--r--main/contrib/NRefactory/Project/Src/Parser/VBNet/ParamModifierList.cs53
-rw-r--r--main/contrib/NRefactory/Project/Src/Parser/VBNet/Parser.cs7403
-rw-r--r--main/contrib/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG3406
-rw-r--r--main/contrib/NRefactory/Project/Src/Parser/VBNet/VBNetParser.cs325
-rwxr-xr-xmain/contrib/NRefactory/Project/Src/Parser/gen.bat24
-rwxr-xr-xmain/contrib/NRefactory/Project/Src/Parser/gen.sh8
-rw-r--r--main/contrib/NRefactory/Project/Src/ParserFactory.cs62
-rw-r--r--main/contrib/NRefactory/Project/Src/PrettyPrinter/AbstractOutputFormatter.cs232
-rw-r--r--main/contrib/NRefactory/Project/Src/PrettyPrinter/AbstractPrettyPrintOptions.cs56
-rw-r--r--main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs3185
-rw-r--r--main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/OutputFormatter.cs163
-rw-r--r--main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/PrettyPrintOptions.cs945
-rw-r--r--main/contrib/NRefactory/Project/Src/PrettyPrinter/IOutputAstVisitor.cs59
-rw-r--r--main/contrib/NRefactory/Project/Src/PrettyPrinter/SpecialNodesInserter.cs146
-rw-r--r--main/contrib/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetOutputFormatter.cs77
-rw-r--r--main/contrib/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetOutputVisitor.cs3062
-rw-r--r--main/contrib/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetPrettyPrintOptions.cs22
-rw-r--r--main/contrib/NRefactory/Project/Src/SnippetParser.cs146
-rw-r--r--main/contrib/NRefactory/Project/Src/Visitors/AbstractASTVisitor.cs1264
-rw-r--r--main/contrib/NRefactory/Project/Src/Visitors/AbstractAstTransformer.cs2274
-rw-r--r--main/contrib/NRefactory/Project/Src/Visitors/CSharpConstructsConvertVisitor.cs234
-rw-r--r--main/contrib/NRefactory/Project/Src/Visitors/CodeDOMOutputVisitor.cs1680
-rw-r--r--main/contrib/NRefactory/Project/Src/Visitors/CodeDOMVerboseOutputGenerator.cs360
-rw-r--r--main/contrib/NRefactory/Project/Src/Visitors/ConvertVisitorBase.cs28
-rw-r--r--main/contrib/NRefactory/Project/Src/Visitors/LookupTableVisitor.cs325
-rw-r--r--main/contrib/NRefactory/Project/Src/Visitors/NodeTrackingAstVisitor.cs1376
-rw-r--r--main/contrib/NRefactory/Project/Src/Visitors/NotImplementedAstVisitor.cs509
-rw-r--r--main/contrib/NRefactory/Project/Src/Visitors/PrefixFieldsVisitor.cs147
-rw-r--r--main/contrib/NRefactory/Project/Src/Visitors/RenameIdentifierVisitor.cs65
-rw-r--r--main/contrib/NRefactory/Project/Src/Visitors/SetParentVisitor.cs37
-rw-r--r--main/contrib/NRefactory/Project/Src/Visitors/ToCSharpConvertVisitor.cs278
-rw-r--r--main/contrib/NRefactory/Project/Src/Visitors/ToVBNetConvertVisitor.cs383
-rw-r--r--main/contrib/NRefactory/Project/Src/Visitors/ToVBNetRenameConflictingVariables.cs91
-rw-r--r--main/contrib/NRefactory/Project/Src/Visitors/VBNetConstructsConvertVisitor.cs507
-rw-r--r--main/contrib/NRefactory/Test/AssemblyInfo.cs39
-rw-r--r--main/contrib/NRefactory/Test/General/UnitTest.cs107
-rw-r--r--main/contrib/NRefactory/Test/Lexer/CSharp/CustomLexerTests.cs155
-rw-r--r--main/contrib/NRefactory/Test/Lexer/CSharp/LexerPositionTests.cs237
-rw-r--r--main/contrib/NRefactory/Test/Lexer/CSharp/LexerTests.cs900
-rw-r--r--main/contrib/NRefactory/Test/Lexer/CSharp/NumberLexerTest.cs181
-rw-r--r--main/contrib/NRefactory/Test/Lexer/CSharp/PreprocessingTests.cs169
-rw-r--r--main/contrib/NRefactory/Test/Lexer/VBNet/CustomLexerTests.cs123
-rw-r--r--main/contrib/NRefactory/Test/Lexer/VBNet/LexerPositionTests.cs60
-rw-r--r--main/contrib/NRefactory/Test/Lexer/VBNet/LexerTests.cs1319
-rw-r--r--main/contrib/NRefactory/Test/Lexer/VBNet/LiteralsTests.cs192
-rw-r--r--main/contrib/NRefactory/Test/NRefactoryTests.csproj167
-rw-r--r--main/contrib/NRefactory/Test/NRefactoryTests.csproj.user10
-rw-r--r--main/contrib/NRefactory/Test/Output/CSharp/CSharpOutputTest.cs601
-rw-r--r--main/contrib/NRefactory/Test/Output/CSharp/VBNetToCSharpConverterTest.cs705
-rw-r--r--main/contrib/NRefactory/Test/Output/CodeDOM/CodeDOMParenthesizedExpressionTest.cs27
-rw-r--r--main/contrib/NRefactory/Test/Output/CodeDOM/CodeDOMPrimitiveExpressionTest.cs28
-rw-r--r--main/contrib/NRefactory/Test/Output/CodeDOM/InvocationExpressionTest.cs128
-rw-r--r--main/contrib/NRefactory/Test/Output/SnippetConversion.cs165
-rw-r--r--main/contrib/NRefactory/Test/Output/SpecialOutputVisitorTest.cs265
-rw-r--r--main/contrib/NRefactory/Test/Output/VBNet/CSharpToVBNetConverterTest.cs542
-rw-r--r--main/contrib/NRefactory/Test/Output/VBNet/VBNetOutputTest.cs446
-rw-r--r--main/contrib/NRefactory/Test/Parser/CheckParentVisitor.cs38
-rw-r--r--main/contrib/NRefactory/Test/Parser/Expressions/AddressOfExpressionTests.cs59
-rw-r--r--main/contrib/NRefactory/Test/Parser/Expressions/AnonymousMethodTests.cs63
-rw-r--r--main/contrib/NRefactory/Test/Parser/Expressions/ArrayCreateExpressionTests.cs65
-rw-r--r--main/contrib/NRefactory/Test/Parser/Expressions/AssignmentExpressionTests.cs157
-rw-r--r--main/contrib/NRefactory/Test/Parser/Expressions/BaseReferenceExpressionTests.cs37
-rw-r--r--main/contrib/NRefactory/Test/Parser/Expressions/BinaryOperatorExpressionTests.cs486
-rw-r--r--main/contrib/NRefactory/Test/Parser/Expressions/CastExpressionTests.cs313
-rw-r--r--main/contrib/NRefactory/Test/Parser/Expressions/CheckedExpressionTests.cs32
-rw-r--r--main/contrib/NRefactory/Test/Parser/Expressions/ClassReferenceExpressionTests.cs32
-rw-r--r--main/contrib/NRefactory/Test/Parser/Expressions/ConditionalExpressionTests.cs107
-rw-r--r--main/contrib/NRefactory/Test/Parser/Expressions/DefaultValueExpressionTests.cs59
-rw-r--r--main/contrib/NRefactory/Test/Parser/Expressions/GlobalReferenceExpressionTests.cs53
-rw-r--r--main/contrib/NRefactory/Test/Parser/Expressions/IdentifierExpressionTests.cs76
-rw-r--r--main/contrib/NRefactory/Test/Parser/Expressions/IndexerExpressionTests.cs41
-rw-r--r--main/contrib/NRefactory/Test/Parser/Expressions/InvocationExpressionTests.cs136
-rw-r--r--main/contrib/NRefactory/Test/Parser/Expressions/LambdaExpressionTests.cs116
-rw-r--r--main/contrib/NRefactory/Test/Parser/Expressions/MemberReferenceExpressionTests.cs150
-rw-r--r--main/contrib/NRefactory/Test/Parser/Expressions/ObjectCreateExpressionTests.cs264
-rw-r--r--main/contrib/NRefactory/Test/Parser/Expressions/ParenthesizedExpressionTest.cs42
-rw-r--r--main/contrib/NRefactory/Test/Parser/Expressions/PointerReferenceExpressionTests.cs33
-rw-r--r--main/contrib/NRefactory/Test/Parser/Expressions/PrimitiveExpressionTests.cs104
-rw-r--r--main/contrib/NRefactory/Test/Parser/Expressions/QueryExpressionTests.cs113
-rw-r--r--main/contrib/NRefactory/Test/Parser/Expressions/SizeOfExpressionTests.cs32
-rw-r--r--main/contrib/NRefactory/Test/Parser/Expressions/StackAllocExpressionTests.cs40
-rw-r--r--main/contrib/NRefactory/Test/Parser/Expressions/ThisReferenceExpressionTests.cs35
-rw-r--r--main/contrib/NRefactory/Test/Parser/Expressions/TypeOfExpressionTests.cs170
-rw-r--r--main/contrib/NRefactory/Test/Parser/Expressions/TypeOfIsExpressionTests.cs70
-rw-r--r--main/contrib/NRefactory/Test/Parser/Expressions/TypeReferenceExpressionTests.cs93
-rw-r--r--main/contrib/NRefactory/Test/Parser/Expressions/UnaryOperatorExpressionTests.cs148
-rw-r--r--main/contrib/NRefactory/Test/Parser/Expressions/UncheckedExpressionTests.cs33
-rw-r--r--main/contrib/NRefactory/Test/Parser/GlobalScope/AttributeSectionTests.cs119
-rw-r--r--main/contrib/NRefactory/Test/Parser/GlobalScope/DelegateDeclarationTests.cs79
-rw-r--r--main/contrib/NRefactory/Test/Parser/GlobalScope/NamespaceDeclarationTests.cs77
-rw-r--r--main/contrib/NRefactory/Test/Parser/GlobalScope/OptionDeclarationTests.cs91
-rw-r--r--main/contrib/NRefactory/Test/Parser/GlobalScope/TypeDeclarationTests.cs372
-rw-r--r--main/contrib/NRefactory/Test/Parser/GlobalScope/UsingDeclarationTests.cs163
-rw-r--r--main/contrib/NRefactory/Test/Parser/ParseUtilCSharp.cs92
-rw-r--r--main/contrib/NRefactory/Test/Parser/ParseUtilVBNet.cs92
-rw-r--r--main/contrib/NRefactory/Test/Parser/SkipMethodBodiesTest.cs64
-rw-r--r--main/contrib/NRefactory/Test/Parser/Statements/AddHandlerStatementTests.cs31
-rw-r--r--main/contrib/NRefactory/Test/Parser/Statements/BlockStatementTests.cs51
-rw-r--r--main/contrib/NRefactory/Test/Parser/Statements/BreakStatementTests.cs32
-rw-r--r--main/contrib/NRefactory/Test/Parser/Statements/CheckedStatementTests.cs32
-rw-r--r--main/contrib/NRefactory/Test/Parser/Statements/ContinueStatementTests.cs31
-rw-r--r--main/contrib/NRefactory/Test/Parser/Statements/DoLoopStatementTests.cs45
-rw-r--r--main/contrib/NRefactory/Test/Parser/Statements/EmptyStatementTests.cs32
-rw-r--r--main/contrib/NRefactory/Test/Parser/Statements/EndStatementTests.cs37
-rw-r--r--main/contrib/NRefactory/Test/Parser/Statements/EraseStatementTests.cs31
-rw-r--r--main/contrib/NRefactory/Test/Parser/Statements/ErrorStatementTests.cs31
-rw-r--r--main/contrib/NRefactory/Test/Parser/Statements/ExpressionStatementTests.cs38
-rw-r--r--main/contrib/NRefactory/Test/Parser/Statements/FixedStatementTests.cs32
-rw-r--r--main/contrib/NRefactory/Test/Parser/Statements/ForNextStatementTests.cs37
-rw-r--r--main/contrib/NRefactory/Test/Parser/Statements/ForStatementTests.cs43
-rw-r--r--main/contrib/NRefactory/Test/Parser/Statements/ForeachStatementTests.cs38
-rw-r--r--main/contrib/NRefactory/Test/Parser/Statements/GotoCaseStatementTests.cs40
-rw-r--r--main/contrib/NRefactory/Test/Parser/Statements/GotoStatementTests.cs37
-rw-r--r--main/contrib/NRefactory/Test/Parser/Statements/IfElseStatementTests.cs176
-rw-r--r--main/contrib/NRefactory/Test/Parser/Statements/LabelStatementTests.cs45
-rw-r--r--main/contrib/NRefactory/Test/Parser/Statements/LocalVariableDeclarationTests.cs402
-rw-r--r--main/contrib/NRefactory/Test/Parser/Statements/LockStatementTests.cs32
-rw-r--r--main/contrib/NRefactory/Test/Parser/Statements/OnErrorStatementTest.cs31
-rw-r--r--main/contrib/NRefactory/Test/Parser/Statements/RaiseEventStatementTest.cs31
-rw-r--r--main/contrib/NRefactory/Test/Parser/Statements/ReDimStatementTests.cs81
-rw-r--r--main/contrib/NRefactory/Test/Parser/Statements/RemoveHandlerStatement.cs31
-rw-r--r--main/contrib/NRefactory/Test/Parser/Statements/ResumeStatement.cs31
-rw-r--r--main/contrib/NRefactory/Test/Parser/Statements/ReturnStatementTests.cs60
-rw-r--r--main/contrib/NRefactory/Test/Parser/Statements/StopStatementTests.cs31
-rw-r--r--main/contrib/NRefactory/Test/Parser/Statements/SwitchStatementTests.cs48
-rw-r--r--main/contrib/NRefactory/Test/Parser/Statements/ThrowStatementTests.cs39
-rw-r--r--main/contrib/NRefactory/Test/Parser/Statements/TryCatchStatementTests.cs46
-rw-r--r--main/contrib/NRefactory/Test/Parser/Statements/UncheckedStatementTests.cs32
-rw-r--r--main/contrib/NRefactory/Test/Parser/Statements/UnsafeStatementTests.cs32
-rw-r--r--main/contrib/NRefactory/Test/Parser/Statements/UsingStatementTests.cs62
-rw-r--r--main/contrib/NRefactory/Test/Parser/Statements/WithStatementTests.cs31
-rw-r--r--main/contrib/NRefactory/Test/Parser/Statements/YieldStatementTests.cs49
-rw-r--r--main/contrib/NRefactory/Test/Parser/TypeLevel/ConstructorDeclarationTests.cs79
-rw-r--r--main/contrib/NRefactory/Test/Parser/TypeLevel/CustomEventTests.cs52
-rw-r--r--main/contrib/NRefactory/Test/Parser/TypeLevel/DeclareDeclarationTests.cs36
-rw-r--r--main/contrib/NRefactory/Test/Parser/TypeLevel/DestructorDeclarationTests.cs43
-rw-r--r--main/contrib/NRefactory/Test/Parser/TypeLevel/EventDeclarationTests.cs84
-rw-r--r--main/contrib/NRefactory/Test/Parser/TypeLevel/FieldDeclarationTests.cs91
-rw-r--r--main/contrib/NRefactory/Test/Parser/TypeLevel/IndexerDeclarationTests.cs55
-rw-r--r--main/contrib/NRefactory/Test/Parser/TypeLevel/MethodDeclarationTests.cs446
-rw-r--r--main/contrib/NRefactory/Test/Parser/TypeLevel/OperatorDeclarationTests.cs65
-rw-r--r--main/contrib/NRefactory/Test/Parser/TypeLevel/PropertyDeclarationTests.cs139
-rw-r--r--main/monodevelop.pc.in2
-rw-r--r--setup/WixSetup/Product.wxs1
213 files changed, 2 insertions, 68489 deletions
diff --git a/.gitignore b/.gitignore
index 601e78f575..a2cc89ea77 100644
--- a/.gitignore
+++ b/.gitignore
@@ -68,7 +68,6 @@ test-results/
main/external/Makefile
/main/contrib/Makefile
/main/contrib/Mono.Cecil/Makefile
-/main/contrib/NRefactory/Makefile
/main/contrib/ICSharpCode.NRefactory.CSharp/Makefile
/main/contrib/GitSharp/Makefile
/main/contrib/Mono.Debugger.Soft/Makefile
diff --git a/main/Main.sln b/main/Main.sln
index 3a8f7184ad..1f0ade2da1 100644
--- a/main/Main.sln
+++ b/main/Main.sln
@@ -199,8 +199,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.NRefactory", "e
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.NRefactory.CSharp", "external\nrefactory\ICSharpCode.NRefactory.CSharp\ICSharpCode.NRefactory.CSharp.csproj", "{53DCA265-3C3C-42F9-B647-F72BA678122B}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NRefactory", "contrib\NRefactory\Project\NRefactory.csproj", "{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}"
-EndProject
Project("{9344bdbb-3e7f-41fc-a0dd-8665d75ee146}") = "po", "po\po.mdproj", "{AC7D119C-980B-4712-8811-5368C14412D7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{5D3F7E65-E55B-45CA-A83B-D1E10040281E}"
@@ -388,14 +386,6 @@ Global
{376889B5-6504-46A1-9D18-A9E4B4A50F49}.DebugWin32|x86.ActiveCfg = Debug|Any CPU
{376889B5-6504-46A1-9D18-A9E4B4A50F49}.Release|Any CPU.ActiveCfg = Release|Any CPU
{376889B5-6504-46A1-9D18-A9E4B4A50F49}.Release|Any CPU.Build.0 = Release|Any CPU
- {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.DebugMac|Any CPU.ActiveCfg = Debug|Any CPU
- {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.DebugMac|Any CPU.Build.0 = Debug|Any CPU
- {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.DebugWin32|x86.ActiveCfg = Debug|Any CPU
- {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.DebugWin32|x86.Build.0 = Debug|Any CPU
- {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Release|Any CPU.Build.0 = Release|Any CPU
{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.DebugMac|Any CPU.ActiveCfg = Debug|Any CPU
@@ -977,7 +967,6 @@ Global
{A85C9721-C054-4BD8-A1F3-0227615F0A36} = {B8897B76-1A12-4DFA-8B60-7944CC4C9654}
{3B2A5653-EC97-4001-BB9B-D90F1AF2C371} = {2D711139-8765-4929-BC7A-AA2DEE6F615D}
{53DCA265-3C3C-42F9-B647-F72BA678122B} = {2D711139-8765-4929-BC7A-AA2DEE6F615D}
- {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195} = {2D711139-8765-4929-BC7A-AA2DEE6F615D}
{BFE8691A-D323-4622-9021-7B8B27F81599} = {5D3F7E65-E55B-45CA-A83B-D1E10040281E}
{8A04FF99-5DFE-4E3D-A24F-72A621C8DDC6} = {5D3F7E65-E55B-45CA-A83B-D1E10040281E}
{D0B5AF2B-4BC1-4EB4-81D3-E5B85DDCE925} = {5D3F7E65-E55B-45CA-A83B-D1E10040281E}
diff --git a/main/configure.in b/main/configure.in
index ffc4b93066..89174e3c69 100644
--- a/main/configure.in
+++ b/main/configure.in
@@ -263,7 +263,6 @@ build/Makefile
build/MacOSX/Makefile
contrib/Makefile
contrib/Mono.Debugger.Soft/Makefile
-contrib/NRefactory/Makefile
contrib/ICSharpCode.Decompiler/Makefile
external/Makefile
src/Makefile
diff --git a/main/contrib/Makefile.am b/main/contrib/Makefile.am
index a8bd5efb11..22061437a6 100644
--- a/main/contrib/Makefile.am
+++ b/main/contrib/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = Mono.Debugger.Soft NRefactory ICSharpCode.Decompiler
+SUBDIRS = Mono.Debugger.Soft ICSharpCode.Decompiler
EXTRA_DIST = $(srcdir)/extract_makefile_variable.sh
diff --git a/main/contrib/NRefactory/Makefile.am b/main/contrib/NRefactory/Makefile.am
deleted file mode 100644
index b0ac61e80f..0000000000
--- a/main/contrib/NRefactory/Makefile.am
+++ /dev/null
@@ -1,3 +0,0 @@
-include $(top_srcdir)/xbuild.include
-
-CSPROJ=Project/NRefactory.csproj \ No newline at end of file
diff --git a/main/contrib/NRefactory/NRefactory.sln b/main/contrib/NRefactory/NRefactory.sln
deleted file mode 100644
index 524695be24..0000000000
--- a/main/contrib/NRefactory/NRefactory.sln
+++ /dev/null
@@ -1,39 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
-# SharpDevelop 3.0.0.3337
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NRefactory", "Project\NRefactory.csproj", "{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NRefactoryTests", "Test\NRefactoryTests.csproj", "{870115DD-960A-4406-A6B9-600BCDC36A03}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NRefactoryASTGenerator", "NRefactoryASTGenerator\NRefactoryASTGenerator.csproj", "{B22522AA-B5BF-4A58-AC6D-D4B45805521F}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NRefactoryDemo", "..\..\..\samples\NRefactoryDemo\NRefactoryDemo.csproj", "{63199047-9D5D-474C-B3CC-62ABBB071B67}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Release|Any CPU.Build.0 = Release|Any CPU
- {870115DD-960A-4406-A6B9-600BCDC36A03}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {870115DD-960A-4406-A6B9-600BCDC36A03}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {870115DD-960A-4406-A6B9-600BCDC36A03}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {870115DD-960A-4406-A6B9-600BCDC36A03}.Release|Any CPU.Build.0 = Release|Any CPU
- {B22522AA-B5BF-4A58-AC6D-D4B45805521F}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {B22522AA-B5BF-4A58-AC6D-D4B45805521F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {B22522AA-B5BF-4A58-AC6D-D4B45805521F}.Release|Any CPU.Build.0 = Release|Any CPU
- {B22522AA-B5BF-4A58-AC6D-D4B45805521F}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {63199047-9D5D-474C-B3CC-62ABBB071B67}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {63199047-9D5D-474C-B3CC-62ABBB071B67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {63199047-9D5D-474C-B3CC-62ABBB071B67}.Release|Any CPU.Build.0 = Release|Any CPU
- {63199047-9D5D-474C-B3CC-62ABBB071B67}.Release|Any CPU.ActiveCfg = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/main/contrib/NRefactory/NRefactoryASTGenerator/AST/Expressions.cs b/main/contrib/NRefactory/NRefactoryASTGenerator/AST/Expressions.cs
deleted file mode 100644
index ad8dd879d3..0000000000
--- a/main/contrib/NRefactory/NRefactoryASTGenerator/AST/Expressions.cs
+++ /dev/null
@@ -1,378 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 3662 $</version>
-// </file>
-
-using System;
-using System.Collections.Generic;
-
-namespace NRefactoryASTGenerator.Ast
-{
- [CustomImplementation]
- abstract class Expression : AbstractNode, INullable {}
-
- [CustomImplementation]
- class PrimitiveExpression : Expression {}
-
- enum ParameterModifiers { In }
- enum QueryExpressionPartitionType { }
-
- class ParameterDeclarationExpression : Expression {
- List<AttributeSection> attributes;
- [QuestionMarkDefault]
- string parameterName;
- TypeReference typeReference;
- ParameterModifiers paramModifier;
- Expression defaultValue;
-
- public ParameterDeclarationExpression(TypeReference typeReference, string parameterName) {}
- public ParameterDeclarationExpression(TypeReference typeReference, string parameterName, ParameterModifiers paramModifier) {}
- public ParameterDeclarationExpression(TypeReference typeReference, string parameterName, ParameterModifiers paramModifier, Expression defaultValue) {}
- }
-
- class NamedArgumentExpression : Expression {
- string name;
- Expression expression;
-
- public NamedArgumentExpression() { }
- public NamedArgumentExpression(string name, Expression expression) {}
- }
-
- [IncludeBoolProperty("IsAnonymousType", "return createType.IsNull || string.IsNullOrEmpty(createType.Type);")]
- class ObjectCreateExpression : Expression {
- TypeReference createType;
- List<Expression> parameters;
- CollectionInitializerExpression objectInitializer;
-
- public ObjectCreateExpression(TypeReference createType, List<Expression> parameters) {}
- }
-
- [IncludeBoolProperty("IsImplicitlyTyped", "return createType.IsNull || string.IsNullOrEmpty(createType.Type);")]
- class ArrayCreateExpression : Expression {
- TypeReference createType;
- List<Expression> arguments;
- CollectionInitializerExpression arrayInitializer;
-
- public ArrayCreateExpression(TypeReference createType) {}
- public ArrayCreateExpression(TypeReference createType, List<Expression> arguments) {}
- public ArrayCreateExpression(TypeReference createType, CollectionInitializerExpression arrayInitializer) {}
- }
-
- [ImplementNullable(NullableImplementation.Shadow)]
- class CollectionInitializerExpression : Expression {
- List<Expression> createExpressions;
-
- public CollectionInitializerExpression() {}
- public CollectionInitializerExpression(List<Expression> createExpressions) {}
- }
-
- enum AssignmentOperatorType {}
-
- class AssignmentExpression : Expression {
- Expression left;
- AssignmentOperatorType op;
- Expression right;
-
- public AssignmentExpression(Expression left, AssignmentOperatorType op, Expression right) {}
- }
-
- class BaseReferenceExpression : Expression {}
-
- enum BinaryOperatorType {}
-
- class BinaryOperatorExpression : Expression
- {
- Expression left;
- BinaryOperatorType op;
- Expression right;
-
- public BinaryOperatorExpression() { }
- public BinaryOperatorExpression(Expression left, BinaryOperatorType op, Expression right) {}
- }
-
- enum CastType {}
-
- class CastExpression : Expression
- {
- TypeReference castTo;
- Expression expression;
- CastType castType;
-
- public CastExpression(TypeReference castTo) {}
- public CastExpression(TypeReference castTo, Expression expression, CastType castType) {}
- }
-
- [IncludeMember("[Obsolete] public string FieldName { get { return MemberName; } set { MemberName = value; } }")]
- class MemberReferenceExpression : Expression
- {
- Expression targetObject;
- string memberName;
- List<TypeReference> typeArguments;
-
- public MemberReferenceExpression(Expression targetObject, string memberName) {}
- }
-
- [IncludeMember("[Obsolete] public string Identifier { get { return MemberName; } set { MemberName = value; } }")]
- class PointerReferenceExpression : Expression {
- Expression targetObject;
- string memberName;
- List<TypeReference> typeArguments;
-
- public PointerReferenceExpression(Expression targetObject, string memberName) {}
- }
-
- class IdentifierExpression : Expression {
- string identifier;
- List<TypeReference> typeArguments;
-
- public IdentifierExpression(string identifier) {}
- }
-
- class InvocationExpression : Expression {
- Expression targetObject;
- List<Expression> arguments;
-
- public InvocationExpression(Expression targetObject) {}
- public InvocationExpression(Expression targetObject, List<Expression> arguments) {}
- }
-
- class ParenthesizedExpression : Expression {
- Expression expression;
-
- public ParenthesizedExpression(Expression expression) {}
- }
-
- class ThisReferenceExpression : Expression {}
-
- class TypeOfExpression : Expression {
- TypeReference typeReference;
-
- public TypeOfExpression(TypeReference typeReference) {}
- }
-
- [IncludeMember("[Obsolete] public TypeReferenceExpression(string typeName) : this(new TypeReference(typeName)) {}")]
- class TypeReferenceExpression : Expression {
- TypeReference typeReference;
-
- public TypeReferenceExpression(TypeReference typeReference) {}
- }
-
- enum UnaryOperatorType {}
-
- class UnaryOperatorExpression : Expression {
- UnaryOperatorType op;
- Expression expression;
-
- public UnaryOperatorExpression(UnaryOperatorType op) {}
- public UnaryOperatorExpression(Expression expression, UnaryOperatorType op) {}
- }
-
- class AnonymousMethodExpression : Expression {
- List<ParameterDeclarationExpression> parameters;
- BlockStatement body;
- bool hasParameterList;
- }
-
- [IncludeMember("public Location ExtendedEndLocation { get; set; }")]
- class LambdaExpression : Expression {
- List<ParameterDeclarationExpression> parameters;
- BlockStatement statementBody;
- Expression expressionBody;
- }
-
- class CheckedExpression : Expression {
- Expression expression;
-
- public CheckedExpression(Expression expression) {}
- }
-
- class ConditionalExpression : Expression {
- Expression condition;
- Expression trueExpression;
- Expression falseExpression;
-
- public ConditionalExpression() { }
- public ConditionalExpression(Expression condition, Expression trueExpression, Expression falseExpression) {}
- }
-
- class DefaultValueExpression : Expression {
- TypeReference typeReference;
-
- public DefaultValueExpression(TypeReference typeReference) {}
- }
-
- enum FieldDirection {}
-
- class DirectionExpression : Expression {
- FieldDirection fieldDirection;
- Expression expression;
-
- public DirectionExpression(FieldDirection fieldDirection, Expression expression) {}
- }
-
- class IndexerExpression : Expression {
- Expression targetObject;
- List<Expression> indexes;
-
- public IndexerExpression(Expression targetObject, List<Expression> indexes) {}
- }
-
- class SizeOfExpression : Expression {
- TypeReference typeReference;
-
- public SizeOfExpression(TypeReference typeReference) {}
- }
-
- class StackAllocExpression : Expression {
- TypeReference typeReference;
- Expression expression;
-
- public StackAllocExpression(TypeReference typeReference, Expression expression) {}
- }
-
- class UncheckedExpression : Expression {
- Expression expression;
-
- public UncheckedExpression(Expression expression) {}
- }
-
- class AddressOfExpression : Expression {
- Expression expression;
-
- public AddressOfExpression(Expression expression) {}
- }
-
- class ClassReferenceExpression : Expression {}
-
- class TypeOfIsExpression : Expression {
- Expression expression;
- TypeReference typeReference;
-
- public TypeOfIsExpression(Expression expression, TypeReference typeReference) {}
- }
-
- [ImplementNullable(NullableImplementation.Shadow)]
- class QueryExpression : Expression {
-
- /// <remarks>
- /// Either from or aggregate clause.
- /// </remarks>
- QueryExpressionFromClause fromClause;
-
- bool isQueryContinuation;
-
- List<QueryExpressionClause> middleClauses;
-
- /// <remarks>
- /// C# only.
- /// </remarks>
- QueryExpressionClause selectOrGroupClause;
- }
-
- [ImplementNullable]
- abstract class QueryExpressionClause : AbstractNode, INullable { }
-
- class QueryExpressionWhereClause : QueryExpressionClause {
- Expression condition;
- }
-
- class QueryExpressionLetClause : QueryExpressionClause {
- [QuestionMarkDefault]
- string identifier;
- Expression expression;
- }
-
- abstract class QueryExpressionFromOrJoinClause : QueryExpressionClause {
- TypeReference type;
- [QuestionMarkDefault]
- string identifier;
- Expression inExpression;
- }
-
- [ImplementNullable(NullableImplementation.Shadow)]
- class QueryExpressionFromClause : QueryExpressionFromOrJoinClause { }
-
- class QueryExpressionAggregateClause : QueryExpressionClause {
- QueryExpressionFromClause fromClause;
- List<QueryExpressionClause> middleClauses;
- List<ExpressionRangeVariable> intoVariables;
- }
-
- [ImplementNullable]
- class ExpressionRangeVariable : AbstractNode, INullable {
- string identifier;
- Expression expression;
- TypeReference type;
- }
-
- class QueryExpressionJoinClause : QueryExpressionFromOrJoinClause {
- Expression onExpression;
- Expression equalsExpression;
-
- string intoIdentifier;
- }
-
- [ImplementNullable(NullableImplementation.Shadow)]
- class QueryExpressionJoinVBClause : QueryExpressionClause {
- QueryExpressionFromClause joinVariable;
- QueryExpressionJoinVBClause subJoin;
- List<QueryExpressionJoinConditionVB> conditions;
- }
-
- class QueryExpressionPartitionVBClause : QueryExpressionClause {
- Expression expression;
- QueryExpressionPartitionType partitionType;
- }
-
- class QueryExpressionJoinConditionVB : AbstractNode {
- Expression leftSide;
- Expression rightSide;
- }
-
- class QueryExpressionOrderClause : QueryExpressionClause {
- List<QueryExpressionOrdering> orderings;
- }
-
- class QueryExpressionOrdering : AbstractNode {
- Expression criteria;
- QueryExpressionOrderingDirection direction;
- }
-
- enum QueryExpressionOrderingDirection {
- None, Ascending, Descending
- }
-
- class QueryExpressionSelectClause : QueryExpressionClause {
- Expression projection;
- }
-
- class QueryExpressionSelectVBClause : QueryExpressionClause {
- List<ExpressionRangeVariable> variables;
- }
-
- class QueryExpressionLetVBClause : QueryExpressionClause {
- List<ExpressionRangeVariable> variables;
- }
-
- class QueryExpressionDistinctClause : QueryExpressionClause {
-
- }
-
- class QueryExpressionGroupClause : QueryExpressionClause {
- Expression projection;
- Expression groupBy;
- }
-
- class QueryExpressionGroupVBClause : QueryExpressionClause {
- List<ExpressionRangeVariable> groupVariables;
- List<ExpressionRangeVariable> byVariables;
- List<ExpressionRangeVariable> intoVariables;
- }
-
- class QueryExpressionGroupJoinVBClause : QueryExpressionClause {
- QueryExpressionJoinVBClause joinClause;
- List<ExpressionRangeVariable> intoVariables;
- }
-}
diff --git a/main/contrib/NRefactory/NRefactoryASTGenerator/AST/GlobalLevel.cs b/main/contrib/NRefactory/NRefactoryASTGenerator/AST/GlobalLevel.cs
deleted file mode 100644
index e22095e59f..0000000000
--- a/main/contrib/NRefactory/NRefactoryASTGenerator/AST/GlobalLevel.cs
+++ /dev/null
@@ -1,100 +0,0 @@
-// <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.Generic;
-
-namespace NRefactoryASTGenerator.Ast
-{
- [CustomImplementation, HasChildren]
- class CompilationUnit : AbstractNode {}
-
- [HasChildren]
- class NamespaceDeclaration : AbstractNode
- {
- string name;
-
- public NamespaceDeclaration(string name) {}
- }
-
- class TemplateDefinition : AttributedNode
- {
- [QuestionMarkDefault]
- string name;
- List<TypeReference> bases;
-
- public TemplateDefinition(string name, List<AttributeSection> attributes) : base(attributes) {}
- }
-
- class DelegateDeclaration : AttributedNode
- {
- [QuestionMarkDefault]
- string name;
- TypeReference returnType;
- List<ParameterDeclarationExpression> parameters;
- List<TemplateDefinition> templates;
-
- public DelegateDeclaration(Modifiers modifier, List<AttributeSection> attributes) : base(modifier, attributes) {}
- }
-
- enum ClassType { Class }
-
- [HasChildren]
- class TypeDeclaration : AttributedNode
- {
- // Children of Struct: FieldDeclaration, MethodDeclaration, EventDeclaration, ConstructorDeclaration,
- // OperatorDeclaration, TypeDeclaration, IndexerDeclaration, PropertyDeclaration, in VB: DeclareDeclaration
- // Childrean of class: children of struct, DestructorDeclaration
- // Children of Interface: MethodDeclaration, PropertyDeclaration, IndexerDeclaration, EventDeclaration, in VB: TypeDeclaration(Enum) too
- // Children of Enum: FieldDeclaration
- string name;
- ClassType type;
- List<TypeReference> baseTypes;
- List<TemplateDefinition> templates;
- Location bodyStartLocation;
-
- public TypeDeclaration(Modifiers modifier, List<AttributeSection> attributes) : base(modifier, attributes) {}
- }
-
- [IncludeBoolProperty("IsAlias", "return !alias.IsNull;")]
- class Using : AbstractNode
- {
- [QuestionMarkDefault]
- string name;
- TypeReference alias;
-
- public Using(string name) {}
- public Using(string name, TypeReference alias) {}
- }
-
- [IncludeMember("public UsingDeclaration(string @namespace) : this(@namespace, null) {}")]
- [IncludeMember("public UsingDeclaration(string @namespace, TypeReference alias) {" +
- " usings = new List<Using>(1);" +
- " usings.Add(new Using(@namespace, alias)); " +
- "}")]
- class UsingDeclaration : AbstractNode
- {
- List<Using> usings;
-
- public UsingDeclaration(List<Using> usings) {}
- }
-
- enum OptionType { None }
-
- class OptionDeclaration : AbstractNode
- {
- OptionType optionType;
- bool optionValue;
-
- public OptionDeclaration(OptionType optionType, bool optionValue) {}
- }
-
- class ExternAliasDirective : AbstractNode
- {
- string name;
- }
-}
diff --git a/main/contrib/NRefactory/NRefactoryASTGenerator/AST/Node.cs b/main/contrib/NRefactory/NRefactoryASTGenerator/AST/Node.cs
deleted file mode 100644
index 141683a05b..0000000000
--- a/main/contrib/NRefactory/NRefactoryASTGenerator/AST/Node.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 3717 $</version>
-// </file>
-
-using System;
-using System.Collections.Generic;
-
-namespace NRefactoryASTGenerator.Ast
-{
- interface INode {}
- interface INullable {}
- struct Location {}
-
- enum Modifiers { None }
-
- [CustomImplementation]
- abstract class AbstractNode : INode {}
-
- abstract class AttributedNode : AbstractNode
- {
- List<AttributeSection> attributes;
- Modifiers modifier;
-
- public AttributedNode() {}
- public AttributedNode(List<AttributeSection> attributes) {}
- public AttributedNode(Modifiers modifier, List<AttributeSection> attributes) {}
- }
-
- abstract class ParametrizedNode : AttributedNode
- {
- string name;
- List<ParameterDeclarationExpression> parameters;
-
- public ParametrizedNode() {}
-
- public ParametrizedNode(Modifiers modifier, List<AttributeSection> attributes,
- string name, List<ParameterDeclarationExpression> parameters)
- : base(modifier, attributes)
- {}
- }
-
- [CustomImplementation]
- class TypeReference : AbstractNode, INullable
- {
- List<TypeReference> genericTypes;
- }
-
- [CustomImplementation]
- class InnerClassTypeReference : TypeReference
- {
- TypeReference baseType;
- }
-
- class AttributeSection : AbstractNode, INullable
- {
- string attributeTarget;
- List<Attribute> attributes;
- }
-
- class Attribute : AbstractNode
- {
- string name;
- List<Expression> positionalArguments;
- List<NamedArgumentExpression> namedArguments;
-
- public Attribute() {}
- public Attribute(string name, List<Expression> positionalArguments, List<NamedArgumentExpression> namedArguments) {}
- }
-}
diff --git a/main/contrib/NRefactory/NRefactoryASTGenerator/AST/Statements.cs b/main/contrib/NRefactory/NRefactoryASTGenerator/AST/Statements.cs
deleted file mode 100644
index 1ffa5482e8..0000000000
--- a/main/contrib/NRefactory/NRefactoryASTGenerator/AST/Statements.cs
+++ /dev/null
@@ -1,317 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 3473 $</version>
-// </file>
-
-using System;
-using System.Collections.Generic;
-
-namespace NRefactoryASTGenerator.Ast
-{
- [CustomImplementation]
- abstract class Statement : AbstractNode, INullable {}
-
- [CustomImplementation]
- abstract class StatementWithEmbeddedStatement : Statement {
- Statement embeddedStatement;
- }
-
- [CustomImplementation, HasChildren]
- class BlockStatement : Statement {}
-
- class BreakStatement : Statement {}
-
- enum ContinueType {}
-
- class ContinueStatement : Statement {
- ContinueType continueType;
-
- public ContinueStatement() {}
- public ContinueStatement(ContinueType continueType) {}
- }
-
- enum ConditionType {}
- enum ConditionPosition {}
-
- class DoLoopStatement : StatementWithEmbeddedStatement {
- Expression condition;
- ConditionType conditionType;
- ConditionPosition conditionPosition;
-
- public DoLoopStatement(Expression condition, Statement embeddedStatement, ConditionType conditionType, ConditionPosition conditionPosition) {}
- }
-
- class ForeachStatement : StatementWithEmbeddedStatement {
- TypeReference typeReference;
- string variableName;
- Expression expression;
- Expression nextExpression;
-
- public ForeachStatement(TypeReference typeReference, string variableName, Expression expression, Statement embeddedStatement) {}
- public ForeachStatement(TypeReference typeReference, string variableName, Expression expression, Statement embeddedStatement, Expression nextExpression) {}
- }
-
- class ForStatement : StatementWithEmbeddedStatement {
- List<Statement> initializers;
- Expression condition;
- List<Statement> iterator;
-
- public ForStatement(List<Statement> initializers, Expression condition, List<Statement> iterator, Statement embeddedStatement) {}
- }
-
- class GotoStatement : Statement {
- string label;
-
- public GotoStatement(string label) {}
- }
-
- [IncludeMember(@"
- public IfElseStatement(Expression condition, Statement trueStatement)
- : this(condition) {
- this.trueStatement.Add(Statement.CheckNull(trueStatement));
- if (trueStatement != null) trueStatement.Parent = this;
- }")]
- [IncludeMember(@"
- 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;
- }")]
- [IncludeBoolProperty("HasElseStatements", "return falseStatement.Count > 0;")]
- [IncludeBoolProperty("HasElseIfSections", "return elseIfSections.Count > 0;")]
- class IfElseStatement : Statement {
- Expression condition;
- List<Statement> trueStatement; // List for stmt : stmt : stmt ... in VB.NET
- List<Statement> falseStatement;
- List<ElseIfSection> elseIfSections;
-
- public IfElseStatement(Expression condition) {}
- }
-
- class ElseIfSection : StatementWithEmbeddedStatement {
- Expression condition;
-
- public ElseIfSection(Expression condition, Statement embeddedStatement) {}
- }
-
- class LabelStatement : Statement {
- string label;
-
- public LabelStatement(string label) {}
- }
-
- [CustomImplementation]
- class LocalVariableDeclaration : Statement {
- TypeReference typeReference;
- Modifiers modifier;
- List<VariableDeclaration> variables;
- }
-
- class LockStatement : StatementWithEmbeddedStatement
- {
- Expression lockExpression;
-
- public LockStatement(Expression lockExpression, Statement embeddedStatement) {}
- }
-
- class ReturnStatement : Statement
- {
- Expression expression;
-
- public ReturnStatement(Expression expression) { }
- }
-
- class ExpressionStatement : Statement {
- Expression expression;
-
- public ExpressionStatement(Expression expression) {}
- }
-
- class SwitchStatement : Statement {
- Expression switchExpression;
- List<SwitchSection> switchSections;
-
- public SwitchStatement(Expression switchExpression, List<SwitchSection> switchSections) {}
- }
-
- class SwitchSection : BlockStatement {
- List<CaseLabel> switchLabels;
-
- public SwitchSection() { }
- public SwitchSection(List<CaseLabel> switchLabels) { }
- }
-
- [IncludeBoolProperty("IsDefault", "return label.IsNull;")]
- class CaseLabel : AbstractNode {
- Expression label;
- BinaryOperatorType binaryOperatorType;
- Expression toExpression;
-
- public CaseLabel() {}
- public CaseLabel(Expression label) {}
- public CaseLabel(Expression label, Expression toExpression) {}
- public CaseLabel(BinaryOperatorType binaryOperatorType, Expression label) {}
- }
-
- class ThrowStatement : Statement {
- Expression expression;
-
- public ThrowStatement(Expression expression) {}
- }
-
- class TryCatchStatement : Statement {
- Statement statementBlock;
- List<CatchClause> catchClauses;
- Statement finallyBlock;
-
- public TryCatchStatement(Statement statementBlock, List<CatchClause> catchClauses, Statement finallyBlock) {}
- }
-
- class CatchClause : AbstractNode {
- TypeReference typeReference;
- string variableName;
- Statement statementBlock;
- Expression condition;
-
- public CatchClause(TypeReference typeReference, string variableName, Statement statementBlock) {}
- public CatchClause(TypeReference typeReference, string variableName, Statement statementBlock, Expression condition) {}
- public CatchClause(Statement statementBlock) {}
- }
-
- class CheckedStatement : Statement {
- Statement block;
-
- public CheckedStatement(Statement block) {}
- }
-
- class EmptyStatement : Statement {}
-
- class FixedStatement : StatementWithEmbeddedStatement {
- Statement pointerDeclaration;
-
- public FixedStatement(Statement pointerDeclaration, Statement embeddedStatement) {}
- }
-
- [IncludeBoolProperty("IsDefaultCase", "return expression.IsNull;")]
- class GotoCaseStatement : Statement {
- Expression expression;
-
- public GotoCaseStatement(Expression expression) {}
- }
-
- class UncheckedStatement : Statement {
- Statement block;
-
- public UncheckedStatement(Statement block) {}
- }
-
- class UnsafeStatement : Statement {
- Statement block;
-
- public UnsafeStatement(Statement block) {}
- }
-
- class UsingStatement : StatementWithEmbeddedStatement {
- Statement resourceAcquisition;
-
- public UsingStatement(Statement resourceAcquisition, Statement embeddedStatement) {}
- }
-
- [IncludeBoolProperty("IsYieldReturn", "return statement is ReturnStatement;")]
- [IncludeBoolProperty("IsYieldBreak", "return statement is BreakStatement;")]
- class YieldStatement : Statement {
- Statement statement;
-
- public YieldStatement(Statement statement) {}
- }
-
- class AddHandlerStatement : Statement {
- Expression eventExpression;
- Expression handlerExpression;
-
- public AddHandlerStatement(Expression eventExpression, Expression handlerExpression) {}
- }
-
- class EndStatement : Statement {}
-
- class EraseStatement : Statement {
- List<Expression> expressions;
-
- public EraseStatement() {}
- public EraseStatement(List<Expression> expressions) {}
- }
-
- class ErrorStatement : Statement {
- Expression expression;
-
- public ErrorStatement(Expression expression) {}
- }
-
- enum ExitType {}
-
- class ExitStatement : Statement {
- ExitType exitType;
-
- public ExitStatement(ExitType exitType) {}
- }
-
- class ForNextStatement : StatementWithEmbeddedStatement {
- Expression start;
- Expression end;
- Expression step;
-
- List<Expression> nextExpressions;
- // either use typeReference+variableName
- TypeReference typeReference;
- string variableName;
- // or use loopVariableExpression:
- Expression loopVariableExpression;
- }
-
- class OnErrorStatement : StatementWithEmbeddedStatement {
- public OnErrorStatement(Statement embeddedStatement) {}
- }
-
- class RaiseEventStatement : Statement {
- string eventName;
- List<Expression> arguments;
-
- public RaiseEventStatement(string eventName, List<Expression> arguments) {}
- }
-
- class ReDimStatement : Statement {
- List<InvocationExpression> reDimClauses;
- bool isPreserve;
-
- public ReDimStatement(bool isPreserve) {}
- }
-
- class RemoveHandlerStatement : Statement {
- Expression eventExpression;
- Expression handlerExpression;
-
- public RemoveHandlerStatement(Expression eventExpression, Expression handlerExpression) {}
- }
-
- class ResumeStatement : Statement {
- string labelName;
- bool isResumeNext;
-
- public ResumeStatement(bool isResumeNext) {}
-
- public ResumeStatement(string labelName) {}
- }
-
- class StopStatement : Statement {}
-
- class WithStatement : Statement {
- Expression expression;
- BlockStatement body;
-
- public WithStatement(Expression expression) {}
- }
-}
diff --git a/main/contrib/NRefactory/NRefactoryASTGenerator/AST/TypeLevel.cs b/main/contrib/NRefactory/NRefactoryASTGenerator/AST/TypeLevel.cs
deleted file mode 100644
index e6f29e744f..0000000000
--- a/main/contrib/NRefactory/NRefactoryASTGenerator/AST/TypeLevel.cs
+++ /dev/null
@@ -1,261 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 3682 $</version>
-// </file>
-
-using System;
-using System.Collections.Generic;
-
-namespace NRefactoryASTGenerator.Ast
-{
- class VariableDeclaration : AbstractNode
- {
- string name;
- Expression initializer;
- TypeReference typeReference;
- Expression fixedArrayInitialization;
-
- public VariableDeclaration(string name) {}
- public VariableDeclaration(string name, Expression initializer) {}
- public VariableDeclaration(string name, Expression initializer, TypeReference typeReference) {}
- }
-
- class ConstructorDeclaration : ParametrizedNode
- {
- ConstructorInitializer constructorInitializer;
- BlockStatement body;
-
- public ConstructorDeclaration(string name, Modifiers modifier,
- List<ParameterDeclarationExpression> parameters,
- List<AttributeSection> attributes)
- : base(modifier, attributes, name, parameters)
- {}
-
- public ConstructorDeclaration(string name, Modifiers modifier,
- List<ParameterDeclarationExpression> parameters,
- ConstructorInitializer constructorInitializer,
- List<AttributeSection> attributes)
- : base(modifier, attributes, name, parameters)
- {}
- }
-
- enum ConstructorInitializerType { None }
-
- [ImplementNullable]
- class ConstructorInitializer : AbstractNode, INullable
- {
- ConstructorInitializerType constructorInitializerType;
- List<Expression> arguments;
- }
-
- [ImplementNullable(NullableImplementation.Abstract)]
- abstract class EventAddRemoveRegion : AttributedNode, INullable
- {
- BlockStatement block;
- List<ParameterDeclarationExpression> parameters;
-
- public EventAddRemoveRegion(List<AttributeSection> attributes) : base(attributes) {}
- }
-
- [ImplementNullable(NullableImplementation.CompleteAbstract)]
- class EventAddRegion : EventAddRemoveRegion
- {
- public EventAddRegion(List<AttributeSection> attributes) : base(attributes) {}
- }
-
- [ImplementNullable(NullableImplementation.CompleteAbstract)]
- class EventRemoveRegion : EventAddRemoveRegion
- {
- public EventRemoveRegion(List<AttributeSection> attributes) : base(attributes) {}
- }
-
- [ImplementNullable(NullableImplementation.CompleteAbstract)]
- class EventRaiseRegion : EventAddRemoveRegion
- {
- public EventRaiseRegion(List<AttributeSection> attributes) : base(attributes) {}
- }
-
- class InterfaceImplementation : AbstractNode
- {
- TypeReference interfaceType;
- [QuestionMarkDefault]
- string memberName;
-
- public InterfaceImplementation(TypeReference interfaceType, string memberName) {}
- }
-
- [IncludeBoolProperty("HasAddRegion", "return !addRegion.IsNull;")]
- [IncludeBoolProperty("HasRemoveRegion", "return !removeRegion.IsNull;")]
- [IncludeBoolProperty("HasRaiseRegion", "return !raiseRegion.IsNull;")]
- class EventDeclaration : MemberNode
- {
- EventAddRegion addRegion;
- EventRemoveRegion removeRegion;
- EventRaiseRegion raiseRegion;
- Location bodyStart;
- Location bodyEnd;
- Expression initializer;
- }
-
- [IncludeMember(@"
- public TypeReference GetTypeForField(int fieldIndex)
- {
- if (!typeReference.IsNull) {
- return typeReference;
- }
- return ((VariableDeclaration)Fields[fieldIndex]).TypeReference;
- }")]
- [IncludeMember(@"
- public VariableDeclaration GetVariableDeclaration(string variableName)
- {
- foreach (VariableDeclaration variableDeclaration in Fields) {
- if (variableDeclaration.Name == variableName) {
- return variableDeclaration;
- }
- }
- return null;
- }")]
- class FieldDeclaration : AttributedNode
- {
- TypeReference typeReference;
- List<VariableDeclaration> fields;
-
- // for enum members
- public FieldDeclaration(List<AttributeSection> attributes) : base(attributes) {}
-
- // for all other cases
- public FieldDeclaration(List<AttributeSection> attributes, TypeReference typeReference, Modifiers modifier)
- : base(modifier, attributes)
- {}
- }
-
- abstract class MemberNode : ParametrizedNode
- {
- List<InterfaceImplementation> interfaceImplementations;
- TypeReference typeReference;
-
- public MemberNode() {}
-
- public MemberNode(Modifiers modifier, List<AttributeSection> attributes,
- string name, List<ParameterDeclarationExpression> parameters)
- : base(modifier, attributes, name, parameters)
- {}
- }
-
- class MethodDeclaration : MemberNode
- {
- BlockStatement body;
- List<string> handlesClause;
- List<TemplateDefinition> templates;
- bool isExtensionMethod;
- }
-
- enum ConversionType { None }
- enum OverloadableOperatorType { None }
-
- [IncludeBoolProperty("IsConversionOperator", "return conversionType != ConversionType.None;")]
- class OperatorDeclaration : MethodDeclaration
- {
- ConversionType conversionType;
- List<AttributeSection> returnTypeAttributes;
- OverloadableOperatorType overloadableOperator;
- }
-
- [IncludeBoolProperty("HasGetRegion", "return !getRegion.IsNull;")]
- [IncludeBoolProperty("HasSetRegion", "return !setRegion.IsNull;")]
- [IncludeBoolProperty("IsReadOnly", "return HasGetRegion && !HasSetRegion;")]
- [IncludeBoolProperty("IsWriteOnly", "return !HasGetRegion && HasSetRegion;")]
- [IncludeMember(@"
- 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);
- }
- }")]
- class PropertyDeclaration : MemberNode
- {
- Location bodyStart;
- Location bodyEnd;
- PropertyGetRegion getRegion;
- PropertySetRegion setRegion;
-
- public PropertyDeclaration(Modifiers modifier, List<AttributeSection> attributes,
- string name, List<ParameterDeclarationExpression> parameters)
- : base(modifier, attributes, name, parameters)
- {}
- }
-
- [ImplementNullable(NullableImplementation.Abstract)]
- abstract class PropertyGetSetRegion : AttributedNode, INullable
- {
- // can be null if only the definition is there (interface declaration)
- BlockStatement block;
-
- public PropertyGetSetRegion(BlockStatement block, List<AttributeSection> attributes) : base(attributes) {}
- }
-
- [ImplementNullable(NullableImplementation.CompleteAbstract)]
- class PropertyGetRegion : PropertyGetSetRegion
- {
- public PropertyGetRegion(BlockStatement block, List<AttributeSection> attributes) : base(block, attributes) {}
- }
-
- [ImplementNullable(NullableImplementation.CompleteAbstract)]
- class PropertySetRegion : PropertyGetSetRegion
- {
- List<ParameterDeclarationExpression> parameters;
-
- public PropertySetRegion(BlockStatement block, List<AttributeSection> attributes) : base(block, attributes) {}
- }
-
- class DestructorDeclaration : AttributedNode
- {
- string name;
- BlockStatement body;
-
- public DestructorDeclaration(string name, Modifiers modifier, List<AttributeSection> attributes) : base(modifier, attributes) {}
- }
-
- [IncludeBoolProperty("HasGetRegion", "return !getRegion.IsNull;")]
- [IncludeBoolProperty("HasSetRegion", "return !setRegion.IsNull;")]
- [IncludeBoolProperty("IsReadOnly", "return HasGetRegion && !HasSetRegion;")]
- [IncludeBoolProperty("IsWriteOnly", "return !HasGetRegion && HasSetRegion;")]
- class IndexerDeclaration : AttributedNode
- {
- List<ParameterDeclarationExpression> parameters;
- List<InterfaceImplementation> interfaceImplementations;
- TypeReference typeReference;
- Location bodyStart;
- Location bodyEnd;
- PropertyGetRegion getRegion;
- PropertySetRegion setRegion;
-
- public IndexerDeclaration(Modifiers modifier, List<ParameterDeclarationExpression> parameters, List<AttributeSection> attributes)
- : base(modifier, attributes)
- {}
-
- public IndexerDeclaration(TypeReference typeReference, List<ParameterDeclarationExpression> parameters, Modifiers modifier, List<AttributeSection> attributes)
- : base(modifier, attributes)
- {}
- }
-
- enum CharsetModifier { None }
-
- class DeclareDeclaration : ParametrizedNode
- {
- string alias;
- string library;
- CharsetModifier charset;
- TypeReference typeReference;
-
- public DeclareDeclaration(string name, Modifiers modifier, TypeReference typeReference, List<ParameterDeclarationExpression> parameters, List<AttributeSection> attributes, string library, string alias, CharsetModifier charset)
- : base(modifier, attributes, name, parameters)
- {}
- }
-}
diff --git a/main/contrib/NRefactory/NRefactoryASTGenerator/AssemblyInfo.cs b/main/contrib/NRefactory/NRefactoryASTGenerator/AssemblyInfo.cs
deleted file mode 100644
index 2682782bd7..0000000000
--- a/main/contrib/NRefactory/NRefactoryASTGenerator/AssemblyInfo.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 984 $</version>
-// </file>
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-// Information about this assembly is defined by the following
-// attributes.
-//
-// change them to the information which is associated with the assembly
-// you compile.
-
-[assembly: AssemblyTitle("NRefactory AST Generator")]
-[assembly: AssemblyDescription("Parser and refactoring library for C# and VB.NET")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("ic#code")]
-[assembly: AssemblyProduct("SharpDevelop")]
-[assembly: AssemblyCopyright("2006 AlphaSierraPapa")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// The assembly version has following format :
-//
-// Major.Minor.Build.Revision
-//
-// You can specify all values by your own or you can build default build and revision
-// numbers with the '*' character (the default):
-
-[assembly: AssemblyVersion("2.0.0.1")]
diff --git a/main/contrib/NRefactory/NRefactoryASTGenerator/Attributes.cs b/main/contrib/NRefactory/NRefactoryASTGenerator/Attributes.cs
deleted file mode 100644
index a9973e3037..0000000000
--- a/main/contrib/NRefactory/NRefactoryASTGenerator/Attributes.cs
+++ /dev/null
@@ -1,180 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 3722 $</version>
-// </file>
-
-using System;
-using System.CodeDom;
-using System.Reflection;
-using ICSharpCode.EasyCodeDom;
-
-namespace NRefactoryASTGenerator
-{
- public enum NullableImplementation
- {
- /// <summary>
- /// Implement INullable with a virtual bool IsNull, create Null class and static instance
- /// of it.
- /// </summary>
- Default,
- /// <summary>
- /// Create Null class and a static instance using the "new" modifier.
- /// </summary>
- Shadow,
- /// <summary>
- /// Implement INullable with a virtual bool IsNull.
- /// </summary>
- Abstract,
- /// <summary>
- /// Complete an abstract nullable implementation by creating the Null class
- /// and the static instance.
- /// </summary>
- CompleteAbstract
- }
-
- public abstract class TypeImplementationModifierAttribute : Attribute
- {
- public abstract void ModifyImplementation(CodeNamespace cns, CodeTypeDeclaration ctd, Type type);
- }
-
- [AttributeUsage(AttributeTargets.Class)]
- public class CustomImplementationAttribute : Attribute
- {
- }
-
- [AttributeUsage(AttributeTargets.Class)]
- public class HasChildrenAttribute : Attribute
- {
- }
-
- [AttributeUsage(AttributeTargets.Field)]
- public class QuestionMarkDefaultAttribute : Attribute
- {
- }
-
- [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
- public class IncludeMemberAttribute : TypeImplementationModifierAttribute
- {
- string code;
-
- public IncludeMemberAttribute(string code)
- {
- this.code = code;
- }
-
- public override void ModifyImplementation(CodeNamespace cns, CodeTypeDeclaration ctd, Type type)
- {
- ctd.Members.Add(new CodeSnippetTypeMember(code));
- }
- }
-
- [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
- public class IncludeBoolPropertyAttribute : TypeImplementationModifierAttribute
- {
- string name;
- string code;
-
- public IncludeBoolPropertyAttribute(string name, string code)
- {
- this.name = name;
- this.code = code;
- }
-
- public override void ModifyImplementation(CodeNamespace cns, CodeTypeDeclaration ctd, Type type)
- {
- CodeMemberProperty prop = new CodeMemberProperty();
- prop.Name = name;
- prop.Type = new CodeTypeReference(typeof(bool));
- prop.Attributes = MemberAttributes.Public | MemberAttributes.Final;
- prop.GetStatements.Add(new CodeSnippetStatement("\t\t\t\t" + code));
- ctd.Members.Add(prop);
- }
- }
-
- [AttributeUsage(AttributeTargets.Class)]
- public class ImplementNullableAttribute : TypeImplementationModifierAttribute
- {
- NullableImplementation implementation;
-
- public ImplementNullableAttribute()
- {
- this.implementation = NullableImplementation.Default;
- }
-
- public ImplementNullableAttribute(NullableImplementation implementation)
- {
- this.implementation = implementation;
- }
-
- public override void ModifyImplementation(CodeNamespace cns, CodeTypeDeclaration ctd, Type type)
- {
- if (implementation == NullableImplementation.Default || implementation == NullableImplementation.Abstract) {
- ctd.BaseTypes.Add(new CodeTypeReference("INullable"));
- CodeMemberProperty prop = new CodeMemberProperty();
- prop.Name = "IsNull";
- prop.Type = new CodeTypeReference(typeof(bool));
- prop.Attributes = MemberAttributes.Public;
- prop.GetStatements.Add(new CodeMethodReturnStatement(new CodePrimitiveExpression(false)));
- ctd.Members.Add(prop);
- }
- if (implementation != NullableImplementation.Abstract) {
- CodeTypeDeclaration newType = new CodeTypeDeclaration("Null" + ctd.Name);
- newType.TypeAttributes = TypeAttributes.Class | TypeAttributes.NotPublic | TypeAttributes.Sealed;
- newType.BaseTypes.Add(new CodeTypeReference(ctd.Name));
- cns.Types.Add(newType);
-
- System.Reflection.ConstructorInfo baseCtor = MainClass.GetBaseCtor(type);
- if (baseCtor != null) {
- CodeConstructor ctor = new CodeConstructor();
- ctor.Attributes = MemberAttributes.Private;
- foreach (object o in baseCtor.GetParameters()) {
- ctor.BaseConstructorArgs.Add(new CodePrimitiveExpression(null));
- }
- newType.Members.Add(ctor);
- }
-
- CodeMemberField field = new CodeMemberField(newType.Name, "Instance");
- field.Attributes = MemberAttributes.Static | MemberAttributes.Assembly;
- field.InitExpression = new CodeObjectCreateExpression(new CodeTypeReference(newType.Name));
- newType.Members.Add(field);
-
- CodeMemberProperty prop = new CodeMemberProperty();
- prop.Name = "IsNull";
- prop.Type = new CodeTypeReference(typeof(bool));
- prop.Attributes = MemberAttributes.Public | MemberAttributes.Override;
- prop.GetStatements.Add(new CodeMethodReturnStatement(new CodePrimitiveExpression(true)));
- newType.Members.Add(prop);
-
- CodeMemberMethod method = new CodeMemberMethod();
- method.Name = "AcceptVisitor";
- method.Attributes = MemberAttributes.Public | MemberAttributes.Override;
- method.Parameters.Add(new CodeParameterDeclarationExpression("IAstVisitor", "visitor"));
- method.Parameters.Add(new CodeParameterDeclarationExpression(typeof(object), "data"));
- method.ReturnType = new CodeTypeReference(typeof(object));
- method.Statements.Add(new CodeMethodReturnStatement(new CodePrimitiveExpression(null)));
- newType.Members.Add(method);
-
- method = new CodeMemberMethod();
- method.Name = "ToString";
- method.Attributes = MemberAttributes.Public | MemberAttributes.Override;
- method.ReturnType = new CodeTypeReference(typeof(string));
- method.Statements.Add(new CodeMethodReturnStatement(new CodePrimitiveExpression("[" + newType.Name + "]")));
- newType.Members.Add(method);
-
- prop = new CodeMemberProperty();
- prop.Name = "Null";
- prop.Type = new CodeTypeReference(ctd.Name);
- prop.Attributes = MemberAttributes.Public | MemberAttributes.Static;
- if (implementation == NullableImplementation.Shadow) {
- prop.Attributes |= MemberAttributes.New;
- }
- CodeExpression ex = new CodeTypeReferenceExpression(newType.Name);
- ex = new CodePropertyReferenceExpression(ex, "Instance");
- prop.GetStatements.Add(new CodeMethodReturnStatement(ex));
- ctd.Members.Add(prop);
- }
- }
- }
-}
diff --git a/main/contrib/NRefactory/NRefactoryASTGenerator/Main.cs b/main/contrib/NRefactory/NRefactoryASTGenerator/Main.cs
deleted file mode 100644
index 88d8f3a167..0000000000
--- a/main/contrib/NRefactory/NRefactoryASTGenerator/Main.cs
+++ /dev/null
@@ -1,581 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 3722 $</version>
-// </file>
-
-using System;
-using System.Collections.Generic;
-using System.CodeDom;
-using System.Diagnostics;
-using System.Reflection;
-using System.IO;
-using NRefactoryASTGenerator.Ast;
-using ICSharpCode.EasyCodeDom;
-
-namespace NRefactoryASTGenerator
-{
- class MainClass
- {
- public const string VisitPrefix = "Visit";
-
- public static void Main(string[] args)
- {
- string directory = "../../../Project/Src/Ast/";
- string visitorsDir = "../../../Project/Src/Visitors/";
- Debug.WriteLine("AST Generator running...");
- if (!File.Exists(directory + "INode.cs")) {
- Debug.WriteLine("did not find output directory");
- return;
- }
- if (!File.Exists(visitorsDir + "AbstractAstTransformer.cs")) {
- Debug.WriteLine("did not find visitor output directory");
- return;
- }
-
- List<Type> nodeTypes = new List<Type>();
- foreach (Type type in typeof(MainClass).Assembly.GetTypes()) {
- if (type.IsClass && typeof(INode).IsAssignableFrom(type)) {
- nodeTypes.Add(type);
- }
- }
- nodeTypes.Sort(delegate(Type a, Type b) { return a.Name.CompareTo(b.Name); });
-
- CodeCompileUnit ccu = new CodeCompileUnit();
- CodeNamespace cns = ccu.AddNamespace("ICSharpCode.NRefactory.Ast");
- cns.AddImport("System");
- cns.AddImport("System.Collections.Generic");
- foreach (Type type in nodeTypes) {
- if (type.GetCustomAttributes(typeof(CustomImplementationAttribute), false).Length == 0) {
- CodeTypeDeclaration ctd = cns.AddType(type.Name);
- if (type.IsAbstract) {
- ctd.TypeAttributes |= TypeAttributes.Abstract;
- }
- ctd.BaseTypes.Add(new CodeTypeReference(type.BaseType.Name));
-
- ProcessType(type, ctd);
-
- foreach (object o in type.GetCustomAttributes(false)) {
- if (o is TypeImplementationModifierAttribute) {
- (o as TypeImplementationModifierAttribute).ModifyImplementation(cns, ctd, type);
- }
- }
-
- if (!type.IsAbstract) {
- CodeMemberMethod method = new CodeMemberMethod();
- method.Name = "AcceptVisitor";
- method.Attributes = MemberAttributes.Public | MemberAttributes.Override;
- method.Parameters.Add(new CodeParameterDeclarationExpression("IAstVisitor", "visitor"));
- method.Parameters.Add(new CodeParameterDeclarationExpression(typeof(object), "data"));
- method.ReturnType = new CodeTypeReference(typeof(object));
- CodeExpression ex = new CodeVariableReferenceExpression("visitor");
- ex = new CodeMethodInvokeExpression(ex, VisitPrefix + ctd.Name,
- new CodeThisReferenceExpression(),
- new CodeVariableReferenceExpression("data"));
- method.Statements.Add(new CodeMethodReturnStatement(ex));
- ctd.Members.Add(method);
-
- method = new CodeMemberMethod();
- method.Name = "ToString";
- method.Attributes = MemberAttributes.Public | MemberAttributes.Override;
- method.ReturnType = new CodeTypeReference(typeof(string));
- method.Statements.Add(new CodeMethodReturnStatement(CreateToString(type)));
- ctd.Members.Add(method);
- }
- }
- }
-
- System.CodeDom.Compiler.CodeGeneratorOptions settings = new System.CodeDom.Compiler.CodeGeneratorOptions();
- settings.IndentString = "\t";
- settings.VerbatimOrder = true;
-
- using (StringWriter writer = new StringWriter()) {
- new Microsoft.CSharp.CSharpCodeProvider().GenerateCodeFromCompileUnit(ccu, writer, settings);
- File.WriteAllText(directory + "Generated.cs", writer.ToString());
- }
-
- ccu = new CodeCompileUnit();
- cns = ccu.AddNamespace("ICSharpCode.NRefactory");
- cns.AddImport("System");
- cns.AddImport("ICSharpCode.NRefactory.Ast");
- cns.Types.Add(CreateAstVisitorInterface(nodeTypes));
-
- using (StringWriter writer = new StringWriter()) {
- new Microsoft.CSharp.CSharpCodeProvider().GenerateCodeFromCompileUnit(ccu, writer, settings);
- File.WriteAllText(visitorsDir + "../IAstVisitor.cs", writer.ToString());
- }
-
- ccu = new CodeCompileUnit();
- cns = ccu.AddNamespace("ICSharpCode.NRefactory.Visitors");
- cns.AddImport("System");
- cns.AddImport("System.Collections.Generic");
- cns.AddImport("System.Diagnostics");
- cns.AddImport("ICSharpCode.NRefactory.Ast");
- cns.Types.Add(CreateAstVisitorClass(nodeTypes, false));
-
- using (StringWriter writer = new StringWriter()) {
- new Microsoft.CSharp.CSharpCodeProvider().GenerateCodeFromCompileUnit(ccu, writer, settings);
- File.WriteAllText(visitorsDir + "AbstractAstVisitor.cs", writer.ToString());
- }
-
- ccu = new CodeCompileUnit();
- cns = ccu.AddNamespace("ICSharpCode.NRefactory.Visitors");
- cns.AddImport("System");
- cns.AddImport("System.Collections.Generic");
- cns.AddImport("System.Diagnostics");
- cns.AddImport("ICSharpCode.NRefactory.Ast");
- cns.Types.Add(CreateAstVisitorClass(nodeTypes, true));
-
- using (StringWriter writer = new StringWriter()) {
- new Microsoft.CSharp.CSharpCodeProvider().GenerateCodeFromCompileUnit(ccu, writer, settings);
- File.WriteAllText(visitorsDir + "AbstractAstTransformer.cs", writer.ToString());
- }
-
- ccu = new CodeCompileUnit();
- cns = ccu.AddNamespace("ICSharpCode.NRefactory.Visitors");
- cns.AddImport("System");
- cns.AddImport("ICSharpCode.NRefactory.Ast");
- cns.Types.Add(CreateNodeTrackingAstVisitorClass(nodeTypes));
-
- using (StringWriter writer = new StringWriter()) {
- new Microsoft.CSharp.CSharpCodeProvider().GenerateCodeFromCompileUnit(ccu, writer, settings);
- // CodeDom cannot output "sealed", so we need to use this hack:
- File.WriteAllText(visitorsDir + "NodeTrackingAstVisitor.cs",
- writer.ToString().Replace("public override object", "public sealed override object"));
- }
-
- //NotImplementedAstVisitor
- ccu = new CodeCompileUnit();
- cns = ccu.AddNamespace("ICSharpCode.NRefactory.Visitors");
- cns.AddImport("System");
- cns.AddImport("ICSharpCode.NRefactory.Ast");
- cns.Types.Add(CreateNotImplementedAstVisitorClass(nodeTypes));
-
- using (StringWriter writer = new StringWriter()) {
- new Microsoft.CSharp.CSharpCodeProvider().GenerateCodeFromCompileUnit(ccu, writer, settings);
- File.WriteAllText(visitorsDir + "NotImplementedAstVisitor.cs", writer.ToString());
- }
- Debug.WriteLine("AST Generator done!");
- }
-
- static CodeTypeDeclaration CreateAstVisitorInterface(List<Type> nodeTypes)
- {
- CodeTypeDeclaration td = new CodeTypeDeclaration("IAstVisitor");
- td.IsInterface = true;
-
- foreach (Type t in nodeTypes) {
- if (!t.IsAbstract) {
- EasyMethod m = td.AddMethod(typeof(object), VisitPrefix + t.Name);
- m.AddParameter(ConvertType(t), GetFieldName(t.Name));
- m.AddParameter(typeof(object), "data");
- }
- }
- return td;
- }
-
- static CodeTypeDeclaration CreateAstVisitorClass(List<Type> nodeTypes, bool transformer)
- {
- CodeTypeDeclaration td = new CodeTypeDeclaration(transformer ? "AbstractAstTransformer" : "AbstractAstVisitor");
- td.TypeAttributes = TypeAttributes.Public | TypeAttributes.Abstract;
- td.BaseTypes.Add(new CodeTypeReference("IAstVisitor"));
-
- if (transformer) {
- string comment =
- "The AbstractAstTransformer will iterate through the whole AST,\n " +
- "just like the AbstractAstVisitor. However, the AbstractAstTransformer allows\n " +
- "you to modify the AST at the same time: It does not use 'foreach' internally,\n " +
- "so you can add members to collections of parents of the current node (but\n " +
- "you cannot insert or delete items as that will make the index used invalid).\n " +
- "You can use the methods ReplaceCurrentNode and RemoveCurrentNode to replace\n " +
- "or remove the current node, totally independent from the type of the parent node.";
- Easy.AddSummary(td, comment);
-
- CodeMemberField field = td.AddField(Easy.TypeRef("Stack", "INode"), "nodeStack");
- field.InitExpression = Easy.New(field.Type);
-
- /*
- CodeExpression nodeStack = Easy.Var("nodeStack");
- CodeMemberProperty p = new CodeMemberProperty();
- p.Name = "CurrentNode";
- p.Type = new CodeTypeReference("INode");
- p.Attributes = MemberAttributes.Public | MemberAttributes.Final;
- p.GetStatements.Add(new CodeMethodReturnStatement(new CodeVariableReferenceExpression("currentNode")));
- p.SetStatements.Add(new CodeAssignStatement(new CodeVariableReferenceExpression("currentNode"),
- new CodePropertySetValueReferenceExpression()));
- td.Members.Add(p);
- */
-
- EasyMethod m = td.AddMethod("ReplaceCurrentNode");
- m.AddParameter(Easy.TypeRef("INode"), "newNode");
- m.Statements.Add(Easy.Var("nodeStack").InvokeMethod("Pop"));
- m.Statements.Add(Easy.Var("nodeStack").InvokeMethod("Push", Easy.Var("newNode")));
-
- m = td.AddMethod("RemoveCurrentNode");
- m.Statements.Add(Easy.Var("nodeStack").InvokeMethod("Pop"));
- m.Statements.Add(Easy.Var("nodeStack").InvokeMethod("Push", Easy.Null));
- }
-
- foreach (Type type in nodeTypes) {
- if (!type.IsAbstract) {
- EasyMethod m = td.AddMethod(typeof(object), VisitPrefix + type.Name);
- m.Attributes = MemberAttributes.Public;
- m.AddParameter(ConvertType(type), GetFieldName(type.Name));
- m.AddParameter(typeof(object), "data");
-
- List<CodeStatement> assertions = new List<CodeStatement>();
- string varVariableName = GetFieldName(type.Name);
- CodeExpression var = Easy.Var(varVariableName);
- assertions.Add(AssertIsNotNull(var));
-
- AddFieldVisitCode(m, type, var, assertions, transformer);
-
- if (type.GetCustomAttributes(typeof(HasChildrenAttribute), true).Length > 0) {
- if (transformer) {
- m.Statements.Add(new CodeSnippetStatement(CreateTransformerLoop(varVariableName + ".Children", "INode")));
- m.Body.Return(Easy.Null);
- } else {
- m.Body.Return(var.InvokeMethod("AcceptChildren", Easy.This, Easy.Var("data")));
- }
- } else {
- CodeExpressionStatement lastStatement = null;
- if (m.Statements.Count > 0) {
- lastStatement = m.Statements[m.Statements.Count - 1] as CodeExpressionStatement;
- }
- if (lastStatement != null) {
- m.Statements.RemoveAt(m.Statements.Count - 1);
- m.Body.Return(lastStatement.Expression);
- } else {
- m.Body.Return(Easy.Null);
- }
- }
-
- for (int i = 0; i < assertions.Count; i++) {
- m.Statements.Insert(i, assertions[i]);
- }
- }
- }
- return td;
- }
-
- static void AddFieldVisitCode(EasyMethod m, Type type, CodeExpression var, List<CodeStatement> assertions, bool transformer)
- {
- if (type != null) {
- if (type.BaseType != typeof(StatementWithEmbeddedStatement)) {
- AddFieldVisitCode(m, type.BaseType, var, assertions, transformer);
- }
- foreach (FieldInfo field in type.GetFields(BindingFlags.Instance | BindingFlags.NonPublic)) {
- AddVisitCode(m, field, var, assertions, transformer);
- }
- if (type.BaseType == typeof(StatementWithEmbeddedStatement)) {
- AddFieldVisitCode(m, type.BaseType, var, assertions, transformer);
- }
- }
- }
-
- static CodeStatement AssertIsNotNull(CodeExpression expr)
- {
- return new CodeExpressionStatement(
- Easy.Type("Debug").InvokeMethod("Assert",
- Easy.Binary(expr,
- CodeBinaryOperatorType.IdentityInequality,
- Easy.Null))
- );
- }
-
- static string GetCode(CodeExpression ex)
- {
- using (StringWriter writer = new StringWriter()) {
- new Microsoft.CSharp.CSharpCodeProvider().GenerateCodeFromExpression(ex, writer, null);
- return writer.ToString();
- }
- }
-
- static string CreateTransformerLoop(string collection, string typeName)
- {
- return
- "\t\t\tfor (int i = 0; i < " + collection + ".Count; i++) {\n" +
- "\t\t\t\t" + typeName + " o = " + collection + "[i];\n" +
- "\t\t\t\tDebug.Assert(o != null);\n" +
- "\t\t\t\tnodeStack.Push(o);\n" +
- "\t\t\t\to.AcceptVisitor(this, data);\n" +
- (typeName == "INode"
- ? "\t\t\t\to = nodeStack.Pop();\n"
- : "\t\t\t\to = (" + typeName + ")nodeStack.Pop();\n") +
- "\t\t\t\tif (o == null)\n" +
- "\t\t\t\t\t" + collection + ".RemoveAt(i--);\n" +
- "\t\t\t\telse\n" +
- "\t\t\t\t\t" + collection + "[i] = o;\n" +
- "\t\t\t}";
- }
-
- static bool AddVisitCode(EasyMethod m, FieldInfo field, CodeExpression var, List<CodeStatement> assertions, bool transformer)
- {
- CodeExpression prop = var.Property(GetPropertyName(field.Name));
- CodeExpression nodeStack = Easy.Var("nodeStack");
- if (field.FieldType.FullName.StartsWith("System.Collections.Generic.List")) {
- Type elType = field.FieldType.GetGenericArguments()[0];
- if (!typeof(INode).IsAssignableFrom(elType))
- return false;
- assertions.Add(AssertIsNotNull(prop));
- string code;
- if (transformer) {
- code = CreateTransformerLoop(GetCode(prop), ConvertType(elType).BaseType);
- } else {
- code =
- "\t\t\tforeach (" + ConvertType(elType).BaseType + " o in " + GetCode(prop) + ") {\n" +
- "\t\t\t\tDebug.Assert(o != null);\n" +
- "\t\t\t\to.AcceptVisitor(this, data);\n" +
- "\t\t\t}";
- }
- m.Statements.Add(new CodeSnippetStatement(code));
- return true;
- }
- if (!typeof(INode).IsAssignableFrom(field.FieldType))
- return false;
- assertions.Add(AssertIsNotNull(prop));
- if (transformer) {
- m.Statements.Add(nodeStack.InvokeMethod("Push", prop));
- }
- m.Statements.Add(prop.InvokeMethod("AcceptVisitor",
- Easy.This,
- Easy.Var("data")));
- if (transformer) {
- m.Body.Assign(prop, nodeStack.InvokeMethod("Pop").CastTo(ConvertType(field.FieldType)));
- }
- return true;
- }
-
- static CodeExpression CreateToString(Type type)
- {
- CodeMethodInvokeExpression ie = new CodeMethodInvokeExpression(new CodeTypeReferenceExpression(typeof(string)),
- "Format");
- CodePrimitiveExpression prim = new CodePrimitiveExpression();
- ie.Parameters.Add(prim);
- string text = "[" + type.Name;
- int index = 0;
- do {
- foreach (FieldInfo field in type.GetFields(BindingFlags.Instance | BindingFlags.NonPublic)) {
- text += " " + GetPropertyName(field.Name) + "={" + index.ToString() + "}";
- index++;
- if (typeof(System.Collections.ICollection).IsAssignableFrom(field.FieldType)) {
- ie.Parameters.Add(new CodeSnippetExpression("GetCollectionString(" + GetPropertyName(field.Name) + ")"));
- } else {
- ie.Parameters.Add(new CodeVariableReferenceExpression(GetPropertyName(field.Name)));
- }
- }
- type = type.BaseType;
- } while (type != null);
- prim.Value = text + "]";
- if (ie.Parameters.Count == 1)
- return prim;
- else
- return ie;
- // return String.Format("[AnonymousMethodExpression: Parameters={0} Body={1}]",
- // GetCollectionString(Parameters),
- // Body);
- }
-
- static void ProcessType(Type type, CodeTypeDeclaration ctd)
- {
- foreach (FieldInfo field in type.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.NonPublic)) {
- ctd.AddField(ConvertType(field.FieldType), field.Name).Attributes = 0;
- }
- foreach (FieldInfo field in type.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.NonPublic)) {
- EasyProperty p = ctd.AddProperty(ConvertType(field.FieldType), GetPropertyName(field.Name));
- p.Getter.Return(Easy.Var(field.Name));
- CodeExpression ex;
- if (field.FieldType.IsValueType)
- ex = new CodePropertySetValueReferenceExpression();
- else
- ex = GetDefaultValue("value", field);
- p.Setter.Assign(Easy.Var(field.Name), ex);
- if (typeof(INode).IsAssignableFrom(field.FieldType)) {
- if (typeof(INullable).IsAssignableFrom(field.FieldType)) {
- p.SetStatements.Add(new CodeSnippetStatement("\t\t\t\tif (!" +field.Name+".IsNull) "+field.Name+".Parent = this;"));
- } else {
- p.SetStatements.Add(new CodeSnippetStatement("\t\t\t\t"+field.Name+".Parent = this;"));
- }
- }
- }
- foreach (ConstructorInfo ctor in type.GetConstructors(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)) {
- CodeConstructor c = new CodeConstructor();
- if (type.IsAbstract)
- c.Attributes = MemberAttributes.Family;
- else
- c.Attributes = MemberAttributes.Public;
- ctd.Members.Add(c);
- ConstructorInfo baseCtor = GetBaseCtor(type);
- foreach(ParameterInfo param in ctor.GetParameters()) {
- c.Parameters.Add(new CodeParameterDeclarationExpression(ConvertType(param.ParameterType),
- param.Name));
- if (baseCtor != null && Array.Exists(baseCtor.GetParameters(), delegate(ParameterInfo p) { return param.Name == p.Name; }))
- continue;
- c.Statements.Add(new CodeAssignStatement(new CodeVariableReferenceExpression(GetPropertyName(param.Name)),
- new CodeVariableReferenceExpression(param.Name)));
- }
- if (baseCtor != null) {
- foreach(ParameterInfo param in baseCtor.GetParameters()) {
- c.BaseConstructorArgs.Add(new CodeVariableReferenceExpression(param.Name));
- }
- }
- // initialize fields that were not initialized by parameter
- foreach (FieldInfo field in type.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.NonPublic)) {
- if (field.FieldType.IsValueType && field.FieldType != typeof(Location))
- continue;
- if (Array.Exists(ctor.GetParameters(), delegate(ParameterInfo p) { return field.Name == p.Name; }))
- continue;
- c.Statements.Add(new CodeAssignStatement(new CodeVariableReferenceExpression(field.Name),
- GetDefaultValue(null, field)));
- }
- }
- }
-
- internal static ConstructorInfo GetBaseCtor(Type type)
- {
- ConstructorInfo[] list = type.BaseType.GetConstructors();
- if (list.Length == 0)
- return null;
- else
- return list[0];
- }
-
- internal static CodeExpression GetDefaultValue(string inputVariable, FieldInfo field)
- {
- string code;
- // get default value:
- if (field.FieldType == typeof(string)) {
- code = "\"\"";
- if (field.GetCustomAttributes(typeof(QuestionMarkDefaultAttribute), false).Length > 0) {
- if (inputVariable == null)
- return new CodePrimitiveExpression("?");
- else
- return new CodeSnippetExpression("string.IsNullOrEmpty(" + inputVariable + ") ? \"?\" : " + inputVariable);
- }
- } else if (field.FieldType.FullName.StartsWith("System.Collections.Generic.List")) {
- code = "new List<" + field.FieldType.GetGenericArguments()[0].Name + ">()";
- } else if (field.FieldType == typeof(Location)) {
- code = "Location.Empty";
- } else {
- code = field.FieldType.Name + ".Null";
- }
- if (inputVariable != null) {
- code = inputVariable + " ?? " + code;
- }
- return new CodeSnippetExpression(code);
- }
-
- internal static string GetFieldName(string typeName)
- {
- return char.ToLower(typeName[0]) + typeName.Substring(1);
- }
-
- internal static string GetPropertyName(string fieldName)
- {
- return char.ToUpper(fieldName[0]) + fieldName.Substring(1);
- }
-
- internal static CodeTypeReference ConvertType(Type type)
- {
- if (type.IsGenericType && !type.IsGenericTypeDefinition) {
- CodeTypeReference tr = ConvertType(type.GetGenericTypeDefinition());
- foreach (Type subType in type.GetGenericArguments()) {
- tr.TypeArguments.Add(ConvertType(subType));
- }
- return tr;
- } else if (type.FullName.StartsWith("NRefactory") || type.FullName.StartsWith("System.Collections")) {
- if (type.Name == "Attribute")
- return new CodeTypeReference("ICSharpCode.NRefactory.Ast.Attribute");
- return new CodeTypeReference(type.Name);
- } else {
- return new CodeTypeReference(type);
- }
- }
-
- static CodeTypeDeclaration CreateNodeTrackingAstVisitorClass(List<Type> nodeTypes)
- {
- CodeTypeDeclaration td = new CodeTypeDeclaration("NodeTrackingAstVisitor");
- td.TypeAttributes = TypeAttributes.Public | TypeAttributes.Class | TypeAttributes.Abstract;
- td.BaseTypes.Add(new CodeTypeReference("AbstractAstVisitor"));
-
- string comment = "<summary>\n " +
- "The NodeTrackingAstVisitor will iterate through the whole AST,\n " +
- "just like the AbstractAstVisitor, and calls the virtual methods\n " +
- "BeginVisit and EndVisit for each node being visited.\n " +
- "</summary>";
- td.Comments.Add(new CodeCommentStatement(comment, true));
- comment = "<remarks>\n " +
- "base.Visit(node, data) calls this.TrackedVisit(node, data), so if\n " +
- "you want to visit child nodes using the default visiting behaviour,\n " +
- "use base.TrackedVisit(parentNode, data).\n " +
- "</remarks>";
- td.Comments.Add(new CodeCommentStatement(comment, true));
-
- EasyMethod m = td.AddMethod("BeginVisit");
- m.Attributes = MemberAttributes.Family;
- m.AddParameter(Easy.TypeRef("INode"), "node");
-
- m = td.AddMethod("EndVisit");
- m.Attributes = MemberAttributes.Family;
- m.AddParameter(Easy.TypeRef("INode"), "node");
-
- foreach (Type type in nodeTypes) {
- if (!type.IsAbstract) {
-
- m = td.AddMethod(typeof(object), VisitPrefix + type.Name);
- m.Attributes = MemberAttributes.Public | MemberAttributes.Override;
- m.AddParameter(ConvertType(type), GetFieldName(type.Name));
- m.AddParameter(new CodeTypeReference(typeof(object)), "data");
-
- CodeExpression var = Easy.Var(GetFieldName(type.Name));
-
- m.Body.InvokeMethod(Easy.This, "BeginVisit", var);
- m.Body.DeclareVariable(typeof(object), "result").InitExpression
- = Easy.This.InvokeMethod("TrackedVisit" + type.Name, var, Easy.Var("data"));
- m.Body.InvokeMethod(Easy.This, "EndVisit", var);
- m.Body.Return(Easy.Var("result"));
- }
- }
-
- foreach (Type type in nodeTypes) {
- if (!type.IsAbstract) {
-
- m = td.AddMethod(typeof(object), "TrackedVisit" + type.Name);
- m.Attributes = MemberAttributes.Public;
- m.AddParameter(ConvertType(type), GetFieldName(type.Name));
- m.AddParameter(new CodeTypeReference(typeof(object)), "data");
-
- m.Body.Return(Easy.Base.InvokeMethod(VisitPrefix + type.Name, Easy.Var(GetFieldName(type.Name)), Easy.Var("data")));
- }
- }
-
- return td;
- }
-
- static CodeTypeDeclaration CreateNotImplementedAstVisitorClass(List<Type> nodeTypes)
- {
- CodeTypeDeclaration td = new CodeTypeDeclaration("NotImplementedAstVisitor");
- td.TypeAttributes = TypeAttributes.Public | TypeAttributes.Class;
- td.BaseTypes.Add(new CodeTypeReference("IAstVisitor"));
-
- string comment = "<summary>\n " +
- "IAstVisitor implementation that always throws NotImplementedExceptions.\n " +
- "</summary>";
- td.Comments.Add(new CodeCommentStatement(comment, true));
-
- foreach (Type type in nodeTypes) {
- if (!type.IsAbstract) {
-
- EasyMethod m = td.AddMethod(typeof(object), VisitPrefix + type.Name);
- m.Attributes = MemberAttributes.Public;
- m.AddParameter(ConvertType(type), GetFieldName(type.Name));
- m.AddParameter(new CodeTypeReference(typeof(object)), "data");
-
- m.Body.Throw(Easy.New(typeof(NotImplementedException), Easy.Prim(type.Name)));
- }
- }
-
- return td;
- }
- }
-}
diff --git a/main/contrib/NRefactory/NRefactoryASTGenerator/NRefactoryASTGenerator.csproj b/main/contrib/NRefactory/NRefactoryASTGenerator/NRefactoryASTGenerator.csproj
deleted file mode 100644
index 771c3fe782..0000000000
--- a/main/contrib/NRefactory/NRefactoryASTGenerator/NRefactoryASTGenerator.csproj
+++ /dev/null
@@ -1,62 +0,0 @@
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
- <PropertyGroup>
- <OutputType>Exe</OutputType>
- <RootNamespace>NRefactoryASTGenerator</RootNamespace>
- <AssemblyName>NRefactoryASTGenerator</AssemblyName>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProjectGuid>{B22522AA-B5BF-4A58-AC6D-D4B45805521F}</ProjectGuid>
- <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
- <NoStdLib>False</NoStdLib>
- <RegisterForComInterop>False</RegisterForComInterop>
- <GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
- <BaseAddress>4194304</BaseAddress>
- <PlatformTarget>AnyCPU</PlatformTarget>
- <FileAlignment>4096</FileAlignment>
- <WarningLevel>4</WarningLevel>
- <NoWarn>0169</NoWarn>
- <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
- <OutputPath>bin\Debug\</OutputPath>
- <Optimize>False</Optimize>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
- <OutputPath>bin\Release\</OutputPath>
- <Optimize>True</Optimize>
- <DefineConstants>TRACE</DefineConstants>
- <DebugSymbols>False</DebugSymbols>
- <DebugType>None</DebugType>
- <CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Core">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Main.cs" />
- <Compile Include="AssemblyInfo.cs" />
- <Compile Include="AST\Expressions.cs" />
- <Compile Include="Attributes.cs" />
- <Compile Include="AST\Node.cs" />
- <Compile Include="AST\Statements.cs" />
- <Compile Include="AST\TypeLevel.cs" />
- <Compile Include="AST\GlobalLevel.cs" />
- <Compile Include="..\..\..\Main\ICSharpCode.SharpDevelop.Dom\Project\Src\EasyCodeDom.cs">
- <Link>EasyCodeDom.cs</Link>
- </Compile>
- </ItemGroup>
- <ItemGroup>
- <Folder Include="AST" />
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
-</Project>
diff --git a/main/contrib/NRefactory/Project/ChangeLog b/main/contrib/NRefactory/Project/ChangeLog
deleted file mode 100644
index 2f6b1317e9..0000000000
--- a/main/contrib/NRefactory/Project/ChangeLog
+++ /dev/null
@@ -1,560 +0,0 @@
-2010-07-22 Mike Krüger <mkrueger@novell.com>
-
- * Src/Lexer/CSharp/Lexer.cs: SkipString should be called
- instead of ReadString in the skipblock code.
-
-2010-07-22 Mike Krüger <mkrueger@novell.com>
-
- * Src/Lexer/CSharp/Lexer.cs: In body skip mode skip strings as
- well - brings up to 10-15% speed when the file contains many
- strings.
-
-2010-06-15 Mike Krüger <mkrueger@novell.com>
-
- * Src/Ast/Generated.cs:
- * Src/Visitors/LookupTableVisitor.cs: Fixed 'Bug 613714 -
- Intellisense does not show / know about LINQ variables'.-
-
-2010-06-14 Mike Krüger <mkrueger@novell.com>
-
- * Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs: Fixed 'Bug
- 613698 - Format document option removes space between the
- LINQ keywords'.
-
-2010-06-03 Mike Krüger <mkrueger@novell.com>
-
- * Src/Parser/CSharp/CSharpParser.cs: Fixed 'Bug 611253 -
- "Error in text editor extension chain." when override
- conversion operator'.
-
-2010-05-12 Mike Krüger <mkrueger@novell.com>
-
- * Src/Parser/CSharp/cs.ATG:
- * Src/Parser/CSharp/Parser.cs: Fixed 'Bug 605104 - Highlighter
- fails to find an instance of my method'.
-
-2010-05-10 Mike Krüger <mkrueger@novell.com>
-
- * Src/Parser/CSharp/cs.ATG:
- * Src/Parser/CSharp/Parser.cs: Fixed 'Bug 604098 - Editor
- flags error for a valid C# construct'.
-
-2010-05-07 Mike Krüger <mkrueger@novell.com>
-
- * Src/Lexer/CSharp/Lexer.cs:
- * Src/Lexer/AbstractLexer.cs: Fixed 'Bug 603535 - Class &
- method combo doesn't work'.
-
-2010-04-30 Michael Hutchinson <mhutchinson@novell.com>
-
- * NRefactory.csproj: Emit debug symbols.
-
-2010-04-28 Lluis Sanchez Gual <lluis@novell.com>
-
- * Src\PrettyPrinter\AbstractOutputFormatter.cs:
- * Src\PrettyPrinter\AbstractPrettyPrintOptions.cs: Allow
- specifying the EOL marker.
-
-2010-04-08 Mike Krüger <mkrueger@novell.com>
-
- * Src/Parser/CSharp/cs.ATG:
- * Src/Parser/CSharp/Parser.cs: Added error to detect for 'Bug
- 545634 - Create method goes wrong in situation'.
-
-2010-03-22 Mike Krüger <mkrueger@novell.com>
-
- * Src/Ast/General/PrimitiveExpression.cs:
- * Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs: Fixed
- failing unit test.
-
-2010-03-22 Mike Krüger <mkrueger@novell.com>
-
- * Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs: Fixed 'Bug
- 589980 - Code formatter truncates floating-point literals'.
-
-2010-03-16 Mike Krüger <mkrueger@novell.com>
-
- * Src/Parser/CSharp/CSharpParser.cs: Fixed 'Bug 588310 -
- Parser error: invalid UnaryExpr'.
-
-2010-02-25 lluis <${AuthorEmail}>
-
- * NRefactory.csproj: Remove duplicates.
-
-2010-02-01 Mike Krüger <mkrueger@novell.com>
-
- * Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs: Fixed
- verbatim string output.
-
-2010-01-20 Mike Krüger <mkrueger@novell.com>
-
- * Src/PrettyPrinter/CSharp/PrettyPrintOptions.cs:
- * Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs: Implemented
- 'Bug 550947 - Arrays initailizers should not automatically
- be split on multiple lines'.
-
-2010-01-07 Michael Hutchinson <mhutchinson@novell.com>
-
- * Src/Lexer/CSharp/Lexer.cs: When reading single-line comment
- tags, don't read the whole line with the ch prepended, just
- read the actual content.
-
-2009-12-02 Mike Krüger <mkrueger@novell.com>
-
- * Src/Parser/CSharp/cs.ATG:
- * Src/Parser/CSharp/Parser.cs: Improved C# parser unclosed
- block handling.
-
-2009-11-10 Mike Krüger <mkrueger@novell.com>
-
- * Src/Lexer/CSharp/Lexer.cs: Fixed 'Bug 552276 - MonoDevelop
- sometimes fails to show class member list when pressing "."
- key after class var name.'.
-
-2009-10-26 Mike Krüger <mkrueger@novell.com>
-
- * Src/Visitors/AbstractASTVisitor.cs: Fixed 'Bug 549858 -
- Refactoring does not change properties in lambda
- expressions'.
-
-2009-10-20 Mike Krüger <mkrueger@novell.com>
-
- * Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs: Fixed 'Bug
- 547329 - Missing default policy for switch'.
-
-2009-10-12 Mike Krüger <mkrueger@novell.com>
-
- * Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs: Fixed 'Bug
- 545901 - TextEditor handling of Attributes on method
- parameter'.
-
-2009-10-09 Mike Krüger <mkrueger@novell.com>
-
- * Src/Lexer/CSharp/Lexer.cs:
- * Src/Lexer/AbstractLexer.cs: Fixed comment text, when comment
- contains a tag.
-
-2009-10-08 Mike Krüger <mkrueger@novell.com>
-
- * NRefactory.csproj:
- * Src/Parser/gen.sh:
- * Src/Parser/CSharp/CSharpParser.cs: Fixed 'Bug 545291 - wrong
- inline compilation errors when using nullable'.
-
-2009-10-07 Lluis Sanchez Gual <lluis@novell.com>
-
- * Configuration/AssemblyInfo.cs: Bump MD version.
-
-2009-10-05 Mike Krüger <mkrueger@novell.com>
-
- * Src/Ast/Enums.cs:
- * Src/Parser/ModifierList.cs: Added support for protected AND
- internal modifier.
-
-2009-09-21 Mike Krüger <mkrueger@novell.com>
-
- * Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs: Fixed 'Bug
- 540466 - Code formatter "place else on new line" is broken'.
-
-2009-09-18 Mike Krüger <mkrueger@novell.com>
-
- * Src/Ast/AbstractNode.cs:
- * Src/Parser/CSharp/cs.ATG:
- * Src/Parser/CSharp/Parser.cs:
- * Src/Ast/General/Statement.cs:
- * Src/PrettyPrinter/CSharp/PrettyPrintOptions.cs:
- * Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs: Added
- option to place else if on new line, elseif sections have
- now location set.
-
-2009-09-16 Mike Krüger <mkrueger@novell.com>
-
- * Src/Parser/CSharp/CSharpParser.cs:
- * Src/Visitors/CodeDOMOutputVisitor.cs: Fixed "Bug 539329 -
- System.InvalidOperationException: empty type".
-
-2009-09-15 Mike Krüger <mkrueger@novell.com>
-
- * Src/PrettyPrinter/AbstractOutputFormatter.cs: Indent blank
- lines inside members.
-
-2009-09-15 Mike Krüger <mkrueger@novell.com>
-
- * Src/Ast/Generated.cs:
- * Src/Parser/CSharp/cs.ATG:
- * Src/Parser/VBNet/Parser.cs:
- * Src/Parser/CSharp/Parser.cs:
- * Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs: Added
- support for attributes without braces.
-
-2009-09-10 Mike Krüger <mkrueger@novell.com>
-
- * Src/PrettyPrinter/IOutputAstVisitor.cs: moved property to
- interface.
-
-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
- resets now on parse.
-
-2009-07-24 Mike Krüger <mkrueger@novell.com>
-
- * Src/Parser/CSharp/cs.ATG:
- * Src/Parser/CSharp/Parser.cs: Catch clauses have now set
- their correct positions.
-
-2009-07-23 Mike Krüger <mkrueger@novell.com>
-
- * Src/Visitors/LookupTableVisitor.cs: Catch variable
- declarations are now valid in the whole catch clause, not
- only in the statement block. (Required for the lookup inside
- the variable declaration)
-
-2009-07-20 Mike Krüger <mkrueger@novell.com>
-
- * Src/PrettyPrinter/CSharp/PrettyPrintOptions.cs:
- * Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs: Added brace
- forcement pretty print options.
-
-2009-07-17 Mike Krüger <mkrueger@novell.com>
-
- * Src/PrettyPrinter/CSharp/OutputFormatter.cs:
- * Src/PrettyPrinter/AbstractOutputFormatter.cs: Comments that
- start line are no longer indented when outputting them.
-
-2009-07-17 Mike Krüger <mkrueger@novell.com>
-
- * Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs: Fixed place
- else in new line.
-
-2009-07-13 Mike Krüger <mkrueger@novell.com>
-
- * NRefactory.csproj:
- * Src/Visitors/AbstractAstTransformer.cs: made node stack
- protected.
-
-2009-07-07 Mike Krüger <mkrueger@novell.com>
-
- * Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs: Improved
- collection initializer output.
-
-2009-06-23 Mike Krüger <mkrueger@novell.com>
-
- * Src/PrettyPrinter/CSharp/PrettyPrintOptions.cs:
- * Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs: Added
- anonymous method brace style.
-
-2009-06-22 Mike Krüger <mkrueger@novell.com>
-
- * Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs: removed
- unneccessary spaces in if section.
-
-2009-06-18 Michael Hutchinson <mhutchinson@novell.com>
-
- * Src/Visitors/CodeDOMOutputVisitor.cs: Add support for
- comments.
-
-2009-06-18 Mike Krüger <mkrueger@novell.com>
-
- * Src/PrettyPrinter/CSharp/OutputFormatter.cs:
- * Src/PrettyPrinter/AbstractOutputFormatter.cs: Corrected
- block comment output.
-
-2009-06-18 Mike Krüger <mkrueger@novell.com>
-
- * Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs: Single line
- if statements are now correcty indented.
-
-2009-06-17 Mike Krüger <mkrueger@novell.com>
-
- * Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs: Corrected
- embedded statement.
-
-2009-05-12 Mike Krüger <mkrueger@novell.com>
-
- * Src/Lexer/CSharp/Lexer.cs: Fixed compilation error.
-
-2009-04-24 Mike Krüger <mkrueger@novell.com>
-
- * Src/Lexer/AbstractLexer.cs: Allow whitespaces as symbol
- separator/Fixed 'Bug 497682 - Specific case in which the
- class & method not shown'.
-
-2009-04-17 Mike Kestner <mkestner@novell.com>
-
- * NRefactory.csproj: kill pre task, update outdirs
-
-2009-04-15 Lluis Sanchez Gual <lluis@novell.com>
-
- * Configuration/AssemblyInfo.cs: Bump MD version.
-
-2009-03-31 Mike Krüger <mkrueger@novell.com>
-
- * Src/Parser/CSharp/cs.ATG:
- * Src/Parser/CSharp/Parser.cs:
- * Src/Parser/CSharp/CSharpParser.cs: Added ref/out parameters
- for typed lambda expressions.
-
-2009-03-30 Mike Krüger <mkrueger@novell.com>
-
- * Src/Lexer/CSharp/Lexer.cs:
- * Src/Lexer/AbstractLexer.cs: Preprocessor directives
- #if/#elif now contain their arguments as string
- representation.
-
-2009-03-27 Mike Krüger <mkrueger@novell.com>
-
- * Src/Visitors/LookupTableVisitor.cs: Added
- IsQueryContinuation flag to local lookup variables. This is
- required for resolving the "from ... where ... into VAR"
- constructs correctly.
-
-2009-03-18 Michael Hutchinson <mhutchinson@novell.com>
-
- * NRefactory.csproj: Fix output name.
-
-2009-03-17 Mike Krüger <mkrueger@novell.com>
-
- * Src/Lexer/ILexer.cs:
- * Src/Lexer/CSharp/Lexer.cs:
- * Src/Lexer/AbstractLexer.cs: Renamed method.
-
-2009-03-17 Mike Krüger <mkrueger@novell.com>
-
- * Src/Lexer/ILexer.cs:
- * Src/Lexer/CSharp/Lexer.cs:
- * Src/Lexer/AbstractLexer.cs: Added SetDefinedSymbols method.
-
-2009-03-16 Mike Krüger <mkrueger@novell.com>
-
- * Src/PrettyPrinter/CSharp/OutputFormatter.cs:
- * Src/PrettyPrinter/CSharp/PrettyPrintOptions.cs:
- * Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs: Added place
- on new line options.
-
-2009-03-16 Mike Krüger <mkrueger@novell.com>
-
- * Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs: fixed
- bracket output issues.
-
-2009-03-15 Mike Krüger <mkrueger@novell.com>
-
- * Src/PrettyPrinter/CSharp/OutputFormatter.cs:
- * Src/PrettyPrinter/CSharp/PrettyPrintOptions.cs:
- * Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs: Added some
- formatting options.
-
-2009-03-13 Mike Krüger <mkrueger@novell.com>
-
- * Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs: updated
- nrefactory.
-
-2009-03-13 Mike Krüger <mkrueger@novell.com>
-
- * Src/PrettyPrinter/CSharp/OutputFormatter.cs:
- * Src/PrettyPrinter/CSharp/PrettyPrintOptions.cs:
- * Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs: Updated
- nrefactory.
-
-2009-03-13 Mike Krüger <mkrueger@novell.com>
-
- * Src/PrettyPrinter/CSharp/PrettyPrintOptions.cs:
- * Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs: Updated
- pretty printer.
-
-2009-03-10 Mike Krüger <mkrueger@novell.com>
-
- * Src/Lexer/CSharp/Lexer.cs: handled comment position
- elsewhere.
-
-2009-03-10 Mike Krüger <mkrueger@novell.com>
-
- * Src/Lexer/CSharp/Lexer.cs: fix comment position.
-
-2009-03-10 Mike Krüger <mkrueger@novell.com>
-
- * Src:
- * Src/Ast:
- * Resources:
- * Src/Lexer:
- * Src/Parser:
- * Src/Visitors:
- * Configuration:
- * Src/AstBuilder:
- * Src/Lexer/VBNet:
- * Src/Ast/General:
- * Src/Location.cs:
- * NRefactory.pidb:
- * Src/Lexer/CSharp:
- * Src/Ast/Enums.cs:
- * Src/Ast/INode.cs:
- * Src/Parser/VBNet:
- * Src/PrettyPrinter:
- * Src/Parser/Frames:
- * Src/Lexer/Special:
- * NRefactory.csproj:
- * Src/Parser/CSharp:
- * Src/IAstVisitor.cs:
- * Src/Parser/gen.bat:
- * Src/Lexer/Token.cs:
- * Src/Lexer/ILexer.cs:
- * Src/SnippetParser.cs:
- * Src/ParserFactory.cs:
- * Src/Parser/Errors.cs:
- * Src/Ast/INullable.cs:
- * Src/Ast/Generated.cs:
- * Src/Parser/IParser.cs:
- * NRefactory.csproj.user:
- * Src/Ast/AbstractNode.cs:
- * Src/PrettyPrinter/VBNet:
- * Src/PrettyPrinter/CSharp:
- * Src/Ast/TypeReference.cs:
- * Src/Lexer/VBNet/Lexer.cs:
- * Src/Lexer/LookupTable.cs:
- * Src/Parser/CSharp/cs.ATG:
- * Src/Lexer/VBNet/Tokens.cs:
- * Src/Lexer/CSharp/Lexer.cs:
- * Src/OperatorPrecedence.cs:
- * Src/Lexer/BuildKeywords.pl:
- * Src/Lexer/AbstractLexer.cs:
- * Src/Lexer/CSharp/Tokens.cs:
- * Src/Parser/ModifierList.cs:
- * Src/Parser/VBNet/VBNET.ATG:
- * Src/Parser/VBNet/Parser.cs:
- * Src/Parser/CSharp/Parser.cs:
- * Src/Lexer/VBNet/Keywords.cs:
- * Src/Lexer/Special/Comment.cs:
- * Src/Ast/General/Statement.cs:
- * Src/Parser/AbstractParser.cs:
- * Src/Lexer/CSharp/Keywords.cs:
- * Configuration/AssemblyInfo.cs:
- * Src/Lexer/Special/ISpecial.cs:
- * Src/Ast/General/Expression.cs:
- * Src/Lexer/Special/BlankLine.cs:
- * Src/Parser/Frames/Parser.frame:
- * Src/Parser/VBNet/VBNetParser.cs:
- * Src/Parser/Frames/SharpCoco.exe:
- * Src/Parser/Frames/Scanner.frame:
- * Src/Lexer/VBNet/KeywordList.txt:
- * Src/Lexer/Special/TagComment.cs:
- * Src/Visitors/SetParentVisitor.cs:
- * Src/Lexer/CSharp/KeywordList.txt:
- * Src/Lexer/Special/CommentType.cs:
- * Src/Ast/General/BlockStatement.cs:
- * Src/Parser/CSharp/CSharpParser.cs:
- * Src/Visitors/LookupTableVisitor.cs:
- * Src/Visitors/ConvertVisitorBase.cs:
- * Src/Ast/General/CompilationUnit.cs:
- * Src/AstBuilder/StatementBuilder.cs:
- * Src/Visitors/AbstractASTVisitor.cs:
- * Src/Lexer/Special/SpecialTracker.cs:
- * Src/AstBuilder/ExpressionBuilder.cs:
- * Src/Visitors/PrefixFieldsVisitor.cs:
- * Src/Visitors/CodeDOMOutputVisitor.cs:
- * Resources/ICSharpCode.NRefactory.snk:
- * Src/Parser/VBNet/ParamModifierList.cs:
- * Src/EnvironmentInformationProvider.cs:
- * Src/Visitors/ToVBNetConvertVisitor.cs:
- * Src/Visitors/ToCSharpConvertVisitor.cs:
- * Src/Visitors/AbstractAstTransformer.cs:
- * Src/Visitors/NodeTrackingAstVisitor.cs:
- * Src/PrettyPrinter/IOutputAstVisitor.cs:
- * Src/Ast/General/PrimitiveExpression.cs:
- * Src/Visitors/RenameIdentifierVisitor.cs:
- * Src/Visitors/NotImplementedAstVisitor.cs:
- * Src/PrettyPrinter/SpecialNodesInserter.cs:
- * Src/Lexer/CSharp/ConditionalCompilation.cs:
- * Src/PrettyPrinter/CSharp/OutputFormatter.cs:
- * Src/Ast/General/LocalVariableDeclaration.cs:
- * Src/Lexer/Special/PreProcessingDirective.cs:
- * Src/PrettyPrinter/AbstractOutputFormatter.cs:
- * Src/Visitors/CodeDOMVerboseOutputGenerator.cs:
- * Src/Visitors/VBNetConstructsConvertVisitor.cs:
- * Src/PrettyPrinter/VBNet/VBNetOutputVisitor.cs:
- * Src/PrettyPrinter/CSharp/PrettyPrintOptions.cs:
- * Src/Visitors/CSharpConstructsConvertVisitor.cs:
- * Src/PrettyPrinter/AbstractPrettyPrintOptions.cs:
- * Src/PrettyPrinter/VBNet/VBNetOutputFormatter.cs:
- * Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs:
- * Src/Visitors/ToVBNetRenameConflictingVariables.cs:
- * Src/PrettyPrinter/VBNet/VBNetPrettyPrintOptions.cs: Added
- unified nrefactory.
-
diff --git a/main/contrib/NRefactory/Project/Configuration/AssemblyInfo.cs b/main/contrib/NRefactory/Project/Configuration/AssemblyInfo.cs
deleted file mode 100644
index e74f26f01a..0000000000
--- a/main/contrib/NRefactory/Project/Configuration/AssemblyInfo.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="none" email=""/>
-// <version>$Revision: 1618 $</version>
-// </file>
-
-using System;
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-[assembly: CLSCompliant(true)]
-[assembly: StringFreezing()]
-
-// Information about this assembly is defined by the following
-// attributes.
-//
-// change them to the information which is associated with the assembly
-// you compile.
-
-[assembly: AssemblyTitle("NRefactory")]
-[assembly: AssemblyDescription("Parser and refactoring library for C# and VB.NET")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-[assembly: AssemblyVersion ("2.1.1")]
-[assembly: AssemblyCopyright ("LGPL")]
diff --git a/main/contrib/NRefactory/Project/NRefactory.csproj b/main/contrib/NRefactory/Project/NRefactory.csproj
deleted file mode 100644
index 0d5e82bec2..0000000000
--- a/main/contrib/NRefactory/Project/NRefactory.csproj
+++ /dev/null
@@ -1,153 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>10.0.0</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}</ProjectGuid>
- <RootNamespace>ICSharpCode.NRefactory</RootNamespace>
- <AssemblyName>OldNRefactory</AssemblyName>
- <OutputTarget>Library</OutputTarget>
- <WarningLevel>4</WarningLevel>
- <NoStdLib>False</NoStdLib>
- <NoConfig>False</NoConfig>
- <RunPostBuildEvent>OnSuccessfulBuild</RunPostBuildEvent>
- <OutputType>Library</OutputType>
- <SignAssembly>True</SignAssembly>
- <AssemblyOriginatorKeyFile>Resources\ICSharpCode.NRefactory.snk</AssemblyOriginatorKeyFile>
- <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
- <RegisterForComInterop>False</RegisterForComInterop>
- <GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
- <BaseAddress>94896128</BaseAddress>
- <PlatformTarget>AnyCPU</PlatformTarget>
- <FileAlignment>4096</FileAlignment>
- <RunCodeAnalysis>False</RunCodeAnalysis>
- <CodeAnalysisRules>-Microsoft.Design#CA1002;-Microsoft.Design#CA1020;-Microsoft.Design#CA1051;-Microsoft.Design#CA1062;-Microsoft.Globalization#CA1303;-Microsoft.Globalization#CA1305;-Microsoft.Naming#CA1704;-Microsoft.Performance#CA1800;-Microsoft.Performance#CA1805;-Microsoft.Usage#CA2211;-Microsoft.Usage#CA2227</CodeAnalysisRules>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <Optimize>False</Optimize>
- <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
- <DefineConstants>TEST;DEBUG;NET35</DefineConstants>
- <OutputPath>..\..\..\build\bin\</OutputPath>
- <DebugType>full</DebugType>
- <DebugSymbols>True</DebugSymbols>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <Optimize>True</Optimize>
- <DefineConstants>TEST;NET35</DefineConstants>
- <OutputPath>..\..\..\build\bin\</OutputPath>
- <DebugType>none</DebugType>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
- <DebugType>full</DebugType>
- <DebugSymbols>true</DebugSymbols>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
- <DebugSymbols>false</DebugSymbols>
- <DebugType>None</DebugType>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Core">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- </ItemGroup>
- <ItemGroup>
- <None Include="Resources\ICSharpCode.NRefactory.snk" />
- <None Include="Src\Lexer\BuildKeywords.pl" />
- <Compile Include="Configuration\AssemblyInfo.cs" />
- <Compile Include="Src\AstBuilder\ExpressionBuilder.cs" />
- <Compile Include="Src\AstBuilder\StatementBuilder.cs" />
- <Compile Include="Src\Lexer\AbstractLexer.cs" />
- <Compile Include="Src\Lexer\CSharp\ConditionalCompilation.cs" />
- <Compile Include="Src\Lexer\CSharp\Keywords.cs" />
- <Compile Include="Src\Lexer\CSharp\Lexer.cs" />
- <Compile Include="Src\Lexer\CSharp\Tokens.cs" />
- <Compile Include="Src\Lexer\ILexer.cs" />
- <Compile Include="Src\Lexer\LookupTable.cs" />
- <Compile Include="Src\Lexer\Special\BlankLine.cs" />
- <Compile Include="Src\Lexer\Special\Comment.cs" />
- <Compile Include="Src\Lexer\Special\CommentType.cs" />
- <Compile Include="Src\Lexer\Special\PreProcessingDirective.cs" />
- <Compile Include="Src\Lexer\Special\SpecialTracker.cs" />
- <Compile Include="Src\Lexer\Special\TagComment.cs" />
- <Compile Include="Src\Lexer\Token.cs" />
- <Compile Include="Src\Lexer\VBNet\Keywords.cs" />
- <Compile Include="Src\Lexer\VBNet\Lexer.cs" />
- <Compile Include="Src\Lexer\VBNet\Tokens.cs" />
- <Compile Include="Src\Lexer\Special\ISpecial.cs" />
- <Compile Include="Src\OperatorPrecedence.cs" />
- <Compile Include="Src\Parser\CSharp\CSharpParser.cs" />
- <Compile Include="Src\Parser\CSharp\Parser.cs" />
- <Compile Include="Src\Parser\VBNet\Parser.cs" />
- <Compile Include="Src\Parser\VBNet\VBNetParser.cs" />
- <Compile Include="Src\Parser\AbstractParser.cs" />
- <Compile Include="Src\Parser\Errors.cs" />
- <Compile Include="Src\Parser\IParser.cs" />
- <Compile Include="Src\Parser\ModifierList.cs" />
- <Compile Include="Src\PrettyPrinter\CSharp\CSharpOutputVisitor.cs" />
- <Compile Include="Src\PrettyPrinter\CSharp\OutputFormatter.cs" />
- <Compile Include="Src\PrettyPrinter\CSharp\PrettyPrintOptions.cs" />
- <Compile Include="Src\PrettyPrinter\VBNet\VBNetOutputFormatter.cs" />
- <Compile Include="Src\PrettyPrinter\VBNet\VBNetOutputVisitor.cs" />
- <Compile Include="Src\PrettyPrinter\VBNet\VBNetPrettyPrintOptions.cs" />
- <Compile Include="Src\PrettyPrinter\AbstractOutputFormatter.cs" />
- <Compile Include="Src\PrettyPrinter\AbstractPrettyPrintOptions.cs" />
- <Compile Include="Src\PrettyPrinter\IOutputAstVisitor.cs" />
- <Compile Include="Src\PrettyPrinter\SpecialNodesInserter.cs" />
- <Compile Include="Src\SnippetParser.cs" />
- <Compile Include="Src\Visitors\AbstractAstTransformer.cs" />
- <Compile Include="Src\Visitors\AbstractASTVisitor.cs" />
- <Compile Include="Src\Visitors\CodeDOMOutputVisitor.cs" />
- <Compile Include="Src\Visitors\CodeDOMVerboseOutputGenerator.cs" />
- <Compile Include="Src\Visitors\ConvertVisitorBase.cs" />
- <Compile Include="Src\Visitors\CSharpConstructsConvertVisitor.cs" />
- <Compile Include="Src\Visitors\LookupTableVisitor.cs" />
- <Compile Include="Src\Visitors\NotImplementedAstVisitor.cs" />
- <Compile Include="Src\Visitors\PrefixFieldsVisitor.cs" />
- <Compile Include="Src\Visitors\RenameIdentifierVisitor.cs" />
- <Compile Include="Src\Visitors\SetParentVisitor.cs" />
- <Compile Include="Src\Visitors\ToCSharpConvertVisitor.cs" />
- <Compile Include="Src\Visitors\ToVBNetConvertVisitor.cs" />
- <Compile Include="Src\Visitors\ToVBNetRenameConflictingVariables.cs" />
- <Compile Include="Src\Visitors\VBNetConstructsConvertVisitor.cs" />
- <Compile Include="Src\EnvironmentInformationProvider.cs" />
- <Compile Include="Src\IAstVisitor.cs" />
- <Compile Include="Src\ParserFactory.cs" />
- <Compile Include="Src\Location.cs" />
- <Compile Include="Src\Ast\General\BlockStatement.cs" />
- <Compile Include="Src\Ast\General\CompilationUnit.cs" />
- <Compile Include="Src\Ast\General\Expression.cs" />
- <Compile Include="Src\Ast\General\LocalVariableDeclaration.cs" />
- <Compile Include="Src\Ast\General\PrimitiveExpression.cs" />
- <Compile Include="Src\Ast\General\Statement.cs" />
- <Compile Include="Src\Ast\AbstractNode.cs" />
- <Compile Include="Src\Ast\Enums.cs" />
- <Compile Include="Src\Ast\Generated.cs" />
- <Compile Include="Src\Ast\INode.cs" />
- <Compile Include="Src\Ast\INullable.cs" />
- <Compile Include="Src\Ast\TypeReference.cs" />
- <Compile Include="Src\Parser\VBNet\ParamModifierList.cs" />
- <Compile Include="Src\Visitors\NodeTrackingAstVisitor.cs" />
- <None Include="Src\Parser\gen.sh" />
- </ItemGroup>
- <ItemGroup>
- <Content Include="Src\Lexer\CSharp\KeywordList.txt" />
- <Content Include="Src\Lexer\VBNet\KeywordList.txt" />
- <Folder Include="Src\" />
- <Folder Include="Src\Parser\" />
- <Content Include="Src\Parser\CSharp\cs.ATG" />
- <Content Include="Src\Parser\Frames\Parser.frame" />
- <Content Include="Src\Parser\Frames\Scanner.frame" />
- <Content Include="Src\Parser\Frames\SharpCoco.exe" />
- <Content Include="Src\Parser\Frames\trace.txt" />
- <Content Include="Src\Parser\VBNet\VBNET.ATG" />
- <Content Include="Src\Parser\gen.bat" />
- <Folder Include="Src\PrettyPrinter\" />
- <Folder Include="Src\Ast\" />
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <PropertyGroup>
- </PropertyGroup>
-</Project> \ No newline at end of file
diff --git a/main/contrib/NRefactory/Project/NRefactory.csproj.user b/main/contrib/NRefactory/Project/NRefactory.csproj.user
deleted file mode 100644
index 3b61c2cc02..0000000000
--- a/main/contrib/NRefactory/Project/NRefactory.csproj.user
+++ /dev/null
@@ -1,13 +0,0 @@
-<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <LastOpenVersion>8.0.41115</LastOpenVersion>
- <ProjectView>ShowAllFiles</ProjectView>
- <ProjectTrust>0</ProjectTrust>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <StartProgram>..\..\..\..\bin\SharpDevelop.exe</StartProgram>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <StartProgram>..\..\..\..\bin\SharpDevelop.exe</StartProgram>
- </PropertyGroup>
-</Project> \ No newline at end of file
diff --git a/main/contrib/NRefactory/Project/Resources/ICSharpCode.NRefactory.snk b/main/contrib/NRefactory/Project/Resources/ICSharpCode.NRefactory.snk
deleted file mode 100644
index b273cdc5a1..0000000000
--- a/main/contrib/NRefactory/Project/Resources/ICSharpCode.NRefactory.snk
+++ /dev/null
Binary files differ
diff --git a/main/contrib/NRefactory/Project/Src/Ast/AbstractNode.cs b/main/contrib/NRefactory/Project/Src/Ast/AbstractNode.cs
deleted file mode 100644
index 100bc62a04..0000000000
--- a/main/contrib/NRefactory/Project/Src/Ast/AbstractNode.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-// <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.OldNRefactory.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
deleted file mode 100644
index 62b7b220d1..0000000000
--- a/main/contrib/NRefactory/Project/Src/Ast/Enums.cs
+++ /dev/null
@@ -1,396 +0,0 @@
-// <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.OldNRefactory.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)
-
- ProtectedAndInternal = 0x100000, // C# specific
- /// <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
deleted file mode 100644
index 35583b54de..0000000000
--- a/main/contrib/NRefactory/Project/Src/Ast/General/BlockStatement.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-// <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.OldNRefactory.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
deleted file mode 100644
index e38bc1f225..0000000000
--- a/main/contrib/NRefactory/Project/Src/Ast/General/CompilationUnit.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-// <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.OldNRefactory.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
deleted file mode 100644
index 6e396bcbce..0000000000
--- a/main/contrib/NRefactory/Project/Src/Ast/General/Expression.cs
+++ /dev/null
@@ -1,107 +0,0 @@
-// <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.OldNRefactory.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
deleted file mode 100644
index 5d2873b8b3..0000000000
--- a/main/contrib/NRefactory/Project/Src/Ast/General/LocalVariableDeclaration.cs
+++ /dev/null
@@ -1,108 +0,0 @@
-// <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.OldNRefactory.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 Location SemicolonPosition {
- get;
- set;
- }
-
- 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
deleted file mode 100644
index 4c8c25ae1d..0000000000
--- a/main/contrib/NRefactory/Project/Src/Ast/General/PrimitiveExpression.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="none" email=""/>
-// <version>$Revision: 4482 $</version>
-// </file>
-
-using ICSharpCode.OldNRefactory.PrettyPrinter;
-using System;
-
-namespace ICSharpCode.OldNRefactory.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 bool HasStringValue {
- get {
- return stringValue != null;
- }
- }
-
- 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
deleted file mode 100644
index d254c9c755..0000000000
--- a/main/contrib/NRefactory/Project/Src/Ast/General/Statement.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-// <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.OldNRefactory.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
deleted file mode 100644
index 83410bf954..0000000000
--- a/main/contrib/NRefactory/Project/Src/Ast/Generated.cs
+++ /dev/null
@@ -1,5443 +0,0 @@
-//------------------------------------------------------------------------------
-// <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.OldNRefactory.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 bool IsEmptyCall {
- get;
- set;
- }
- 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;
- IsEmptyCall = positionalArguments == null && namedArguments == null;
- 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.OldNRefactory.Ast.Attribute> attributes;
-
- public string AttributeTarget {
- get {
- return attributeTarget;
- }
- set {
- attributeTarget = value ?? "";
- }
- }
-
- public List<ICSharpCode.OldNRefactory.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
deleted file mode 100644
index 4f64b66274..0000000000
--- a/main/contrib/NRefactory/Project/Src/Ast/INode.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-// <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.OldNRefactory.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
deleted file mode 100644
index e3a9245134..0000000000
--- a/main/contrib/NRefactory/Project/Src/Ast/INullable.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-// <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.OldNRefactory.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
deleted file mode 100644
index 6c474e7ebe..0000000000
--- a/main/contrib/NRefactory/Project/Src/Ast/TypeReference.cs
+++ /dev/null
@@ -1,445 +0,0 @@
-// <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.OldNRefactory.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
deleted file mode 100644
index ca53b725d6..0000000000
--- a/main/contrib/NRefactory/Project/Src/AstBuilder/ExpressionBuilder.cs
+++ /dev/null
@@ -1,98 +0,0 @@
-// <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.OldNRefactory.Ast;
-
-namespace ICSharpCode.OldNRefactory.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
deleted file mode 100644
index 7def64ddd6..0000000000
--- a/main/contrib/NRefactory/Project/Src/AstBuilder/StatementBuilder.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-// <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.OldNRefactory.Ast;
-
-namespace ICSharpCode.OldNRefactory.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
deleted file mode 100644
index bc5f0df5f3..0000000000
--- a/main/contrib/NRefactory/Project/Src/EnvironmentInformationProvider.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-// <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.OldNRefactory
-{
- 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
deleted file mode 100644
index 452cf8d7da..0000000000
--- a/main/contrib/NRefactory/Project/Src/IAstVisitor.cs
+++ /dev/null
@@ -1,262 +0,0 @@
-//------------------------------------------------------------------------------
-// <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.OldNRefactory {
- using System;
- using ICSharpCode.OldNRefactory.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.OldNRefactory.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
deleted file mode 100644
index 838877d2bc..0000000000
--- a/main/contrib/NRefactory/Project/Src/Lexer/AbstractLexer.cs
+++ /dev/null
@@ -1,374 +0,0 @@
-// <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.IO;
-using System.Text;
-
-namespace ICSharpCode.OldNRefactory.Parser
-{
- /// <summary>
- /// This is the base class for the C# and VB.NET lexer
- /// </summary>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1708:IdentifiersShouldDifferByMoreThanCase")]
- public abstract class AbstractLexer : ILexer
- {
- TextReader reader;
- int col = 1;
- int line = 1;
-
- [CLSCompliant(false)]
- protected Errors errors = new Errors();
-
- protected Token lastToken = null;
- protected Token curToken = null;
- protected Token peekToken = null;
-
- string[] specialCommentTags = null;
- protected Hashtable specialCommentHash = null;
- List<TagComment> tagComments = new List<TagComment>();
- protected StringBuilder sb = new StringBuilder();
- [CLSCompliant(false)]
- protected SpecialTracker specialTracker = new SpecialTracker();
-
- // used for the original value of strings (with escape sequences).
- protected StringBuilder originalValue = new StringBuilder();
-
- public bool SkipAllComments { get; set; }
- public bool EvaluateConditionalCompilation { get; set; }
- public virtual IDictionary<string, object> ConditionalCompilationSymbols {
- get { throw new NotSupportedException(); }
- }
-
- protected static IEnumerable<string> GetSymbols (string symbols)
- {
- if (!string.IsNullOrEmpty(symbols)) {
- foreach (string symbol in symbols.Split (';', ' ', '\t')) {
- string s = symbol.Trim ();
- if (s.Length == 0)
- continue;
- yield return s;
- }
- }
- }
-
- public virtual void SetConditionalCompilationSymbols (string symbols)
- {
- throw new NotSupportedException ();
- }
-
- protected int Line {
- get {
- return line;
- }
- }
- protected int Col {
- get {
- return col;
- }
- }
-
- protected bool recordRead = false;
- protected StringBuilder recordedText = new StringBuilder ();
-
- protected int ReaderRead()
- {
- ++col;
- int val = reader.Read();
- if (recordRead)
- recordedText.Append ((char)val);
- if (val == '\r') {
- if (reader.Peek() == '\n') {
- lineBreakPosition = new Location (col + 2, line);
- reader.Read ();
- } else {
- lineBreakPosition = new Location (col + 1, line);
- }
- ++line;
- col = 1;
- LineBreak ();
- return '\n';
- }
- if (val == '\n') {
- lineBreakPosition = new Location (col + 1, line);
- ++line;
- col = 1;
- LineBreak ();
- }
- return val;
- }
- protected int ReaderPeek()
- {
- return reader.Peek();
- }
-
- public Errors Errors {
- get {
- return errors;
- }
- }
-
- /// <summary>
- /// Returns the comments that had been read and containing tag key words.
- /// </summary>
- public List<TagComment> TagComments {
- get {
- return tagComments;
- }
- }
-
- public SpecialTracker SpecialTracker {
- get {
- return specialTracker;
- }
- }
-
- /// <summary>
- /// Special comment tags are tags like TODO, HACK or UNDONE which are read by the lexer and stored in <see cref="TagComments"/>.
- /// </summary>
- public string[] SpecialCommentTags {
- get {
- return specialCommentTags;
- }
- set {
- specialCommentTags = value;
- specialCommentHash = null;
- if (specialCommentTags != null && specialCommentTags.Length > 0) {
- specialCommentHash = new Hashtable();
- foreach (string str in specialCommentTags) {
- specialCommentHash.Add(str, null);
- }
- }
- }
- }
-
- /// <summary>
- /// The current Token. <seealso cref="ICSharpCode.OldNRefactory.Parser.Token"/>
- /// </summary>
- public Token Token {
- get {
-// Console.WriteLine("Call to Token");
- return lastToken;
- }
- }
-
- /// <summary>
- /// The next Token (The <see cref="Token"/> after <see cref="NextToken"/> call) . <seealso cref="ICSharpCode.OldNRefactory.Parser.Token"/>
- /// </summary>
- public Token LookAhead {
- get {
-// Console.WriteLine("Call to LookAhead");
- return curToken;
- }
- }
-
- /// <summary>
- /// Constructor for the abstract lexer class.
- /// </summary>
- protected AbstractLexer(TextReader reader)
- {
- this.reader = reader;
- }
-
- #region System.IDisposable interface implementation
- public virtual void Dispose()
- {
- reader.Close();
- reader = null;
- errors = null;
- lastToken = curToken = peekToken = null;
- specialCommentHash = null;
- tagComments = null;
- sb = originalValue = null;
- }
- #endregion
-
- /// <summary>
- /// Must be called before a peek operation.
- /// </summary>
- public void StartPeek()
- {
- peekToken = curToken;
- }
-
- /// <summary>
- /// Gives back the next token. A second call to Peek() gives the next token after the last call for Peek() and so on.
- /// </summary>
- /// <returns>An <see cref="Token"/> object.</returns>
- public Token Peek()
- {
-// Console.WriteLine("Call to Peek");
- if (peekToken.next == null) {
- peekToken.next = Next();
- specialTracker.InformToken(peekToken.next.kind);
- }
- peekToken = peekToken.next;
- return peekToken;
- }
-
- /// <summary>
- /// Reads the next token and gives it back.
- /// </summary>
- /// <returns>An <see cref="Token"/> object.</returns>
- public virtual Token NextToken()
- {
- if (curToken == null) {
- curToken = Next();
- specialTracker.InformToken(curToken.kind);
- //Console.WriteLine(ICSharpCode.OldNRefactory.Parser.CSharp.Tokens.GetTokenString(curToken.kind) + " -- " + curToken.val + "(" + curToken.kind + ")");
- return curToken;
- }
-
- lastToken = curToken;
-
- if (curToken.next == null) {
- curToken.next = Next();
- if (curToken.next != null) {
- specialTracker.InformToken(curToken.next.kind);
- }
- }
-
- curToken = curToken.next;
- //Console.WriteLine(ICSharpCode.OldNRefactory.Parser.CSharp.Tokens.GetTokenString(curToken.kind) + " -- " + curToken.val + "(" + curToken.kind + ")");
- return curToken;
- }
-
- protected abstract Token Next();
-
- protected static bool IsIdentifierPart(int ch)
- {
- if (ch == 95) return true; // 95 = '_'
- if (ch == -1) return false;
- return char.IsLetterOrDigit((char)ch); // accept unicode letters
- }
-
- protected static bool IsHex(char digit)
- {
- return Char.IsDigit(digit) || ('A' <= digit && digit <= 'F') || ('a' <= digit && digit <= 'f');
- }
-
- protected int GetHexNumber(char digit)
- {
- if (Char.IsDigit(digit)) {
- return digit - '0';
- }
- if ('A' <= digit && digit <= 'F') {
- return digit - 'A' + 0xA;
- }
- if ('a' <= digit && digit <= 'f') {
- return digit - 'a' + 0xA;
- }
- errors.Error(line, col, String.Format("Invalid hex number '" + digit + "'"));
- return 0;
- }
- protected Location lineBreakPosition = new Location (1, 1);
- protected Location lastLineEnd = new Location (1, 1);
- protected Location curLineEnd = new Location (1, 1);
- protected void LineBreak ()
- {
- lastLineEnd = curLineEnd;
- curLineEnd = new Location (col - 1, line);
- }
- protected bool HandleLineEnd(char ch)
- {
- // Handle MS-DOS or MacOS line ends.
- if (ch == '\r') {
- if (reader.Peek() == '\n') { // MS-DOS line end '\r\n'
- ReaderRead(); // LineBreak (); called by ReaderRead ();
- return true;
- } else { // assume MacOS line end which is '\r'
- LineBreak ();
- return true;
- }
- }
- if (ch == '\n') {
- LineBreak ();
- return true;
- }
- return false;
- }
-
- protected void SkipToEndOfLine()
- {
- int nextChar;
- while ((nextChar = reader.Read()) != -1) {
- char ch = (char)nextChar;
-
- if (ch == '\r') {
- if (reader.Peek() == '\n') {
- lineBreakPosition = new Location (col + 2, line);
- reader.Read();
- } else {
- lineBreakPosition = new Location (col + 1, line);
- }
- ++line;
- col = 1;
- return;
- }
-
- // Return read string, if EOL is reached
- if (ch == '\n') {
- lineBreakPosition = new Location (col + 1, line);
- ++line;
- col = 1;
- return;
- }
- }
- }
-
- protected string ReadToEndOfLine()
- {
- return ReadToEndOfLine (true);
- }
- protected string ReadToEndOfLine(bool resetBuilder)
- {
- if (resetBuilder)
- sb.Length = 0;
- int nextChar;
- while ((nextChar = reader.Read()) != -1) {
- char ch = (char)nextChar;
-
- if (nextChar == '\r') {
- if (reader.Peek() == '\n') {
- lineBreakPosition = new Location (col + 2, line);
- reader.Read();
- } else {
- lineBreakPosition = new Location (col + 1, line);
- }
- ++line;
- col = 1;
- return sb.ToString();
- }
-
- // Return read string, if EOL is reached
- if (nextChar == '\n') {
- lineBreakPosition = new Location (col + 1, line);
- ++line;
- col = 1;
- return sb.ToString();
- }
-
- sb.Append(ch);
- }
-
- // Got EOF before EOL
- string retStr = sb.ToString();
- col += retStr.Length;
- return retStr;
- }
-
- /// <summary>
- /// Skips to the end of the current code block.
- /// For this, the lexer must have read the next token AFTER the token opening the
- /// block (so that Lexer.Token is the block-opening token, not Lexer.LookAhead).
- /// After the call, Lexer.LookAhead will be the block-closing token.
- /// </summary>
- public abstract void SkipCurrentBlock(int targetToken);
- }
-}
diff --git a/main/contrib/NRefactory/Project/Src/Lexer/BuildKeywords.pl b/main/contrib/NRefactory/Project/Src/Lexer/BuildKeywords.pl
deleted file mode 100644
index a34bdde9a7..0000000000
--- a/main/contrib/NRefactory/Project/Src/Lexer/BuildKeywords.pl
+++ /dev/null
@@ -1,340 +0,0 @@
-#!/bin/perl
-
-# File names
-$keyword_file = "KeywordList.txt";
-$keywords_outfile = "Keywords.cs";
-$tokens_outfile = "Tokens.cs";
-$unittests_outfile = "LexerTests.cs";
-$ATGTokensSection = "ATGTokensSection.gen";
-
-#read infile
-print "\n";
-print "Reading keyword definition from '$keyword_file'.\n";
-open(DAT, $keyword_file) || die("Could not open file '$keyword_file': $!");
-@raw_data=<DAT>;
-close(DAT);
-print "done.\n";
-
-#analyse infile
-print "starting analysis... this could take a few seconds.\n";
-
-foreach (@raw_data) {
- if ($_=~/^\s*\$(\w+)\s*=\s*(\S+)\s*$/) {
- #properties form: $PROPERTY = "VALUE"
- $properties{$1} = $2;
- } elsif ($_=~/^\s*(\w+)\s*=\s*(\S+)\s*$/) {
- #special characters form: name = "VALUE"
- $specialCharLookup{$2} = $1;
- $special_chars[$#special_chars + 1] = $1;
- $special_values[$#special_values + 1] = $2;
- } elsif ($_=~/^\s*\"(\S+)\s*\"\s*$/) {
- #special keywords form: "VALUE"
- $keywords[$#keywords + 1] = $1;
- } elsif ($_=~/^\s*(\w+)\s*\((.*)\)\s*$/) {
- $sets[$#sets + 1] = $1;
- #Split set values (comma separated list)
- $_ = $2;
- @vals = split/\s*,\s*/;
-
- push @$setValues, [@vals];
- } elsif ($_=~/^\s*(\w+)\s*$/) {
- #special terminal classes form: name
- $terminals[$#terminals + 1] = $1
- } elsif ($_=~/^\s*(#.*)?$/) {
- #ignore empty line
- } else {
- print "unknown line: $_";
- }
-}
-
-
-for ($i=0; $i <= $#keywords; $i++) {
- $upperKeywords[$i] = uc $keywords[$i];
-}
-sort (ascend @upperKeywords);
-
-
-sort (ascend @keywords);
-print "done.\n";
-
-#write output
-print "writing output files.\nIf your computer doesn’t respond, then press \"Ctrl-Alt-Delete\"\n";
-print "\n";
-&write_keywordfile;
-print "\n";
-&write_tokensfile;
-print "\n";
-&write_atgtokensfile;
-print "\n";
-&write_unittests;
-print "finished.\n";
-
-sub write_keywordfile
-{
- print " ->Generating Keywords class to file '$keywords_outfile'\n";
- open(DAT,">$keywords_outfile") || die("Cannot Open File");
- print DAT "// this file was autogenerated by a tool.\n";
- print DAT "using System;\n";
- print DAT "\n";
- print DAT "namespace " . $properties{'Namespace'} . "\n";
- print DAT "{\n";
- print DAT "\tpublic static class Keywords\n";
- print DAT "\t{\n";
- print DAT "\t\tstatic readonly string[] keywordList = {\n";
- if ($properties{'UpperCaseKeywords'} eq "True") {
- for ($i=0; $i <= $#upperKeywords; $i++) {
- print DAT "\t\t\t\"$upperKeywords[$i]\"";
- if ($i + 1 <= $#upperKeywords) {
- print DAT ",";
- }
- print DAT "\n";
- }
- } else {
- for ($i=0; $i <= $#keywords; $i++) {
- print DAT "\t\t\t\"$keywords[$i]\"";
- if ($i + 1 <= $#keywords) {
- print DAT ",";
- }
- print DAT "\n";
- }
- }
-
- print DAT "\t\t};\n";
- print DAT "\t\t\n";
- if ($properties{'UpperCaseKeywords'} eq "True") {
- print DAT "\t\tstatic LookupTable keywords = new LookupTable(false);\n";
- } else {
- print DAT "\t\tstatic LookupTable keywords = new LookupTable(true);\n";
- }
-
- print DAT "\t\t\n";
- print DAT "\t\tstatic Keywords()\n";
- print DAT "\t\t{\n";
- print DAT "\t\t\tfor (int i = 0; i < keywordList.Length; ++i) {\n";
- print DAT "\t\t\t\tkeywords[keywordList[i]] = i + Tokens." . ucfirst $keywords[0] . ";\n";
- print DAT "\t\t\t}\n";
- print DAT "\t\t}\n";
- print DAT "\t\t\n";
- print DAT "\t\tpublic static int GetToken(string keyword)\n";
- print DAT "\t\t{\n";
- print DAT "\t\t\treturn keywords[keyword];\n";
- print DAT "\t\t}\n";
- print DAT "\t\t\n";
- print DAT "\t\tpublic static bool IsNonIdentifierKeyword(string word)\n";
- print DAT "\t\t{\n";
- print DAT "\t\t\tint token = GetToken(word);\n";
- print DAT "\t\t\tif (token < 0)\n";
- print DAT "\t\t\t\treturn false;\n";
- print DAT "\t\t\treturn !Tokens.IdentifierTokens[token];\n";
- print DAT "\t\t}\n";
- print DAT "\t}\n";
- print DAT "}\n";
- close(DAT);
- print " ->done.\n";
-}
-
-sub write_token {
- $formattedString = sprintf("%-20s", ucfirst $tokenName);
- if (($tokenName eq "GetType") or ($tokenName eq "equals") or ($tokenName eq "Equals")) {
- print DAT "\t\tnew public const int $formattedString = $tokenValue;\n";
- } else {
- print DAT "\t\tpublic const int $formattedString = $tokenValue;\n";
- }
- $tokenValue++;
-
-}
-
-sub print_list {
- local ($j, $k, $max, $index);
-
- $index = $_[0];
- $max = $#{$setValues->[$index]};
-
- for ($j=0; $j <= $max; $j++) {
- $_ = $setValues->[$index][$j];
- if (/\"(\w+)\"/) { # Keywords
- print DAT ucfirst $1;
- } elsif (/\"(\W+)\"/) { # special chars
- print DAT $specialCharLookup{$_};
- } elsif (/@(\w+)/) { # @otherList
- for ($k=0; $k <= $#sets; $k++) {
- if ($sets[$k] eq $1) {
- print_list($k);
- }
- }
- } else {
- print DAT $_;
- }
-
- if ($j + 1 <= $max) {
- print DAT ", ";
- }
- }
-}
-
-
-sub write_tokensfile {
- print " ->Generating Tokens class to file '$tokens_outfile'\n";
- open(DAT,">$tokens_outfile") || die("Cannot Open File");
- print DAT "// this file was autogenerated by a tool.\n";
- print DAT "using System;\n";
- print DAT "using System.Collections;\n";
- print DAT "\n";
- print DAT "namespace " . $properties{'Namespace'} . "\n";
- print DAT "{\n";
- print DAT "\tpublic static class Tokens\n";
- print DAT "\t{\n";
- $tokenValue = 0;
-
- print DAT "\t\t// ----- terminal classes -----\n";
- foreach (@terminals) {
- $tokenName = $_;
- write_token();
- }
- print DAT "\n";
- print DAT "\t\t// ----- special character -----\n";
- foreach (@special_chars) {
- $tokenName = $_;
- write_token();
- }
- print DAT "\n";
- print DAT "\t\t// ----- keywords -----\n";
- foreach (@keywords) {
- $tokenName = $_;
- write_token();
- }
- print DAT "\n";
-
- print DAT "\t\tpublic const int MaxToken = " . $tokenValue . ";\n";
-
- #write sets.
- if ($#sets > 0) {
- print DAT "\t\tstatic BitArray NewSet(params int[] values)\n";
- print DAT "\t\t{\n";
- print DAT "\t\t\tBitArray bitArray = new BitArray(MaxToken);\n";
- print DAT "\t\t\tforeach (int val in values) {\n";
- print DAT "\t\t\tbitArray[val] = true;\n";
- print DAT "\t\t\t}\n";
- print DAT "\t\t\treturn bitArray;\n";
- print DAT "\t\t}\n";
- for ($i=0; $i <= $#sets; $i++) {
- print DAT "\t\tpublic static BitArray ". $sets[$i] . " = NewSet(";
- print_list($i);
- print DAT ");\n";
- }
- print DAT "\n";
- }
-
- #write token number --> string function.
- print DAT "\t\tstatic string[] tokenList = new string[] {\n";
- print DAT "\t\t\t// ----- terminal classes -----\n";
- foreach (@terminals) {
- print DAT "\t\t\t\"<$_>\",\n";
- }
- print DAT "\t\t\t// ----- special character -----\n";
- foreach (@special_values) {
- print DAT "\t\t\t$_,\n";
- }
- print DAT "\t\t\t// ----- keywords -----\n";
- foreach (@keywords) {
- print DAT "\t\t\t\"$_\",\n";
- }
- print DAT "\t\t};\n";
-
-
- print DAT "\t\tpublic static string GetTokenString(int token)\n";
- print DAT "\t\t{\n";
- print DAT "\t\t\tif (token >= 0 && token < tokenList.Length) {\n";
- print DAT "\t\t\t\treturn tokenList[token];\n";
- print DAT "\t\t\t}\n";
- print DAT "\t\t\tthrow new System.NotSupportedException(\"Unknown token:\" + token);\n";
- print DAT "\t\t}\n";
- print DAT "\t}\n";
-
-
-
- print DAT "}\n";
- close(DAT);
- print " ->done.\n";
-}
-
-sub write_unittests {
- open(DAT,">$unittests_outfile") || die("Cannot Open File");
- print DAT "using System;\n";
- print DAT "using System.IO;\n";
- print DAT "using NUnit.Framework;\n";
- print DAT "using ICSharpCode.NRefactory.Parser;\n";
- print DAT "using ICSharpCode.NRefactory.PrettyPrinter;\n";
-
- print DAT "\n";
- print DAT "namespace ICSharpCode.NRefactory.Tests.Lexer\n";
- print DAT "{\n";
- print DAT "\t[TestFixture]\n";
- print DAT "\tpublic sealed class LexerTests\n";
- print DAT "\t{\n";
- print DAT "\t\tILexer GenerateLexer(StringReader sr)\n";
- print DAT "\t\t{\n";
- print DAT "\t\t\treturn ParserFactory.CreateLexer(SupportedLanguage.CSharp, sr);\n";
- print DAT "\t\t}\n\n";
-
- for ($i=0; $i <= $#special_values; $i++) {
-
- print DAT "\t\t[Test]\n";
- print DAT "\t\tpublic void Test" . $special_chars[$i] ."()\n";
- print DAT "\t\t{\n";
- print DAT "\t\t\tILexer lexer = GenerateLexer(new StringReader(" . $special_values[$i] . "));\n";
- print DAT "\t\t\tAssert.AreEqual(Tokens." . $special_chars[$i] . ", lexer.NextToken().kind);\n";
- print DAT "\t\t}\n\n";
-
- }
-
- foreach (@keywords) {
- print DAT "\t\t[Test()]\n";
- print DAT "\t\tpublic void Test" . ucfirst $_ ."()\n";
- print DAT "\t\t{\n";
- print DAT "\t\t\tILexer lexer = GenerateLexer(new StringReader(\"" . $_ . "\"));\n";
- print DAT "\t\t\tAssert.AreEqual(Tokens." . ucfirst $_ . ", lexer.NextToken().kind);\n";
- print DAT "\t\t}\n";
- }
-
- print DAT "\t}\n";
- print DAT "}\n";
-
-
- close(DAT);
-}
-
-sub write_atgtokensfile {
- print " ->Generating ATG TOKENS section and writing it to file '$ATGTokensSection'\n";
- open(DAT,">$ATGTokensSection") || die("Cannot Open File");
- print DAT "/* START AUTOGENERATED TOKENS SECTION */\n";
- print DAT "TOKENS\n";
-
- print DAT "\t/* ----- terminal classes ----- */\n";
- print DAT "\t/* EOF is 0 */\n";
- foreach $term (@terminals) {
- if ($term eq "EOF") {
- } elsif ($term eq "Identifier") {
- print DAT "\tident\n";
- } else {
- print DAT "\t$term\n";
- }
-
- }
-
- print DAT "\n";
- print DAT "\t/* ----- special character ----- */\n";
- foreach (@special_values) {
- print DAT "\t$_\n";
- }
- print DAT "\n";
- print DAT "\t/* ----- keywords ----- */\n";
- foreach (@keywords) {
- print DAT "\t\"$_\"\n";
- }
-
- print DAT "/* END AUTOGENERATED TOKENS SECTION */\n";
- close(DAT);
- print " ->done.\n";
-}
-
diff --git a/main/contrib/NRefactory/Project/Src/Lexer/CSharp/ConditionalCompilation.cs b/main/contrib/NRefactory/Project/Src/Lexer/CSharp/ConditionalCompilation.cs
deleted file mode 100644
index 10f2f93a33..0000000000
--- a/main/contrib/NRefactory/Project/Src/Lexer/CSharp/ConditionalCompilation.cs
+++ /dev/null
@@ -1,90 +0,0 @@
-// <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.OldNRefactory.Ast;
-using ICSharpCode.OldNRefactory.Visitors;
-
-namespace ICSharpCode.OldNRefactory.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/KeywordList.txt b/main/contrib/NRefactory/Project/Src/Lexer/CSharp/KeywordList.txt
deleted file mode 100644
index b36369172e..0000000000
--- a/main/contrib/NRefactory/Project/Src/Lexer/CSharp/KeywordList.txt
+++ /dev/null
@@ -1,215 +0,0 @@
-# this list is used for autogeneration of:
-# - Keywords.cs
-# - Tokens.cs
-# - ATGTokensSection.txt - the TOKENS section of the ATG file
-
-# use BuildKeywords to generate the different lists.
-
-$Namespace=ICSharpCode.NRefactory.Parser.CSharp
-$UpperCaseKeywords=False
-
-# TERMINAL_CLASSES
-EOF
-Identifier
-Literal
-
-# SPECIAL_CHARACTERS
-Assign = "="
-Plus = "+"
-Minus = "-"
-Times = "*"
-Div = "/"
-Mod = "%"
-
-Colon = ":"
-DoubleColon = "::"
-Semicolon = ";"
-Question = "?"
-DoubleQuestion = "??"
-Comma = ","
-Dot = "."
-
-OpenCurlyBrace = "{"
-CloseCurlyBrace = "}"
-
-OpenSquareBracket = "["
-CloseSquareBracket = "]"
-
-OpenParenthesis = "("
-CloseParenthesis = ")"
-
-GreaterThan = ">"
-LessThan = "<"
-
-Not = "!"
-LogicalAnd = "&&"
-LogicalOr = "||"
-
-BitwiseComplement = "~"
-BitwiseAnd = "&"
-BitwiseOr = "|"
-Xor = "^"
-
-Increment = "++"
-Decrement = "--"
-Equal = "=="
-NotEqual = "!="
-GreaterEqual = ">="
-LessEqual = "<="
-
-ShiftLeft = "<<"
-#Removed because of generics
-#ShiftRight = ">>"
-
-PlusAssign = "+="
-MinusAssign = "-="
-TimesAssign = "*="
-DivAssign = "/="
-ModAssign = "%="
-BitwiseAndAssign = "&="
-BitwiseOrAssign = "|="
-XorAssign = "^="
-ShiftLeftAssign = "<<="
-#Removed because of generics
-#ShiftRightAssign = ">>="
-Pointer = "->"
-LambdaArrow = "=>"
-
-# Keywordlist
-"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"
-
-# Context dependent keywords.
-"partial"
-"where"
-"get"
-"set"
-"add"
-"remove"
-"yield"
-"select"
-"group"
-"by"
-"into"
-"from"
-"ascending"
-"descending"
-"orderby"
-"let"
-"join"
-"on"
-"equals"
-
-#Sets
-
-# When changing IdentifierTokens, ensure you also change the "Identifier" production in cs.ATG
-IdentifierTokens(Identifier, "partial", "where", "get", "set", "add", "remove", "yield", "select", "group", "by", "into", "from", "ascending", "descending", "orderby", "let", "join", "on", "equals")
-
-OverloadableUnaryOp("-", "!", "~", "++", "--", "true", "false")
-OverloadableBinaryOp("+", "-", "*", "/", "%", "&", "|", "^", "<<", "==", "!=", ">", "<", ">=", "<=")
-
-TypeKW("char", "bool", "object", "string", "sbyte", "byte", "short", "ushort", "int", "uint", "long", "ulong", "float", "double", "decimal")
-UnaryHead("+", "-", "!", "~", "*", "++", "--", "&")
-AssnStartOp("+", "-", "!", "~", "*")
-CastFollower(@SimpleTypeName, Literal, "(", "~", "!", @ExpressionStart)
-AssgnOps("=", "+=", "-=", "*=", "/=", "%=", "&=", "|=", "<<=")
-UnaryOp("+", "-", "!", "~", "*", "++", "--", "&")
-TypeDeclarationKW("class", "interface", "struct", "enum", "delegate")
-# for §7.5.4.2 "Grammar ambiguities" disambiguation for F(G<A,B>(7))
-GenericFollower("(", ")", "]", "}", ":", ";", Comma, ".", "?", "==", "!=")
-
-ValidInsideTypeName(@IdentifierTokens, @TypeKW, "<", ">", ".", "?", "[", Comma, "]", "*", "::")
-
-# Keywords for keyword-code-completion
-KCCClassModifiers("abstract", "sealed", "static", "unsafe", "partial")
-KCCTypeDeclarationStart("public", "internal", @TypeDeclarationKW, @KCCClassModifiers)
-KCCMemberVisibilityModifiers("protected", "private", "public", "internal")
-SimpleTypeName(@TypeKW, @IdentifierTokens, "void")
-GlobalLevel("namespace", "using", "extern", @KCCTypeDeclarationStart)
-ExpressionStart("base", "delegate", "false", "new", "null", "sizeof", "this", "true", "typeof", "checked", "unchecked", "from", "default")
-ExpressionContent("as", "is", "out", "ref", "in")
-# interfaces cannot have inner classes etc., the only keyword (expect for type names) that may appear in them is "event"
-InterfaceLevel("event")
-TypeLevel(@KCCTypeDeclarationStart, @KCCMemberVisibilityModifiers, "const", "event", "explicit", "extern", "fixed", "implicit", "new", "operator", "override", "readonly", "virtual", "volatile")
-StatementStart(@ExpressionStart, @ExpressionContent, "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")
-QueryExpressionClauseStart("from", "let", "where", "join", "orderby", "group", "select")
-InPropertyDeclaration(@KCCMemberVisibilityModifiers, "get", "set")
-InEventDeclaration("add", "remove")
-
-# unused: where
-# "by", "into", "ascending", "descending", "on", "equals"
diff --git a/main/contrib/NRefactory/Project/Src/Lexer/CSharp/Keywords.cs b/main/contrib/NRefactory/Project/Src/Lexer/CSharp/Keywords.cs
deleted file mode 100644
index 1ed7ab4b75..0000000000
--- a/main/contrib/NRefactory/Project/Src/Lexer/CSharp/Keywords.cs
+++ /dev/null
@@ -1,129 +0,0 @@
-// this file was autogenerated by a tool.
-using System;
-
-namespace ICSharpCode.OldNRefactory.Parser.CSharp
-{
- public static class Keywords
- {
- static readonly string[] keywordList = {
- "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"
- };
-
- static LookupTable keywords = new LookupTable(true);
-
- static Keywords()
- {
- for (int i = 0; i < keywordList.Length; ++i) {
- keywords[keywordList[i]] = i + Tokens.Abstract;
- }
- }
-
- public static int GetToken(string keyword)
- {
- return keywords[keyword];
- }
-
- public static bool IsNonIdentifierKeyword(string word)
- {
- int token = GetToken(word);
- if (token < 0)
- return false;
- return !Tokens.IdentifierTokens[token];
- }
- }
-}
diff --git a/main/contrib/NRefactory/Project/Src/Lexer/CSharp/Lexer.cs b/main/contrib/NRefactory/Project/Src/Lexer/CSharp/Lexer.cs
deleted file mode 100644
index f124f28b5b..0000000000
--- a/main/contrib/NRefactory/Project/Src/Lexer/CSharp/Lexer.cs
+++ /dev/null
@@ -1,1288 +0,0 @@
-// <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.Collections.Generic;
-using System.Globalization;
-using System.IO;
-using System.Text;
-
-namespace ICSharpCode.OldNRefactory.Parser.CSharp
-{
- public sealed class Lexer : AbstractLexer
- {
- bool isAtLineBegin = true;
-
- public Lexer(TextReader reader) : base(reader)
- {
- }
-
- protected override Token Next()
- {
- int nextChar;
- char ch;
- bool hadLineEnd = false;
- if (Line == 1 && Col == 1) {
- isAtLineBegin = true;
- hadLineEnd = true; // beginning of document
- }
-
- while ((nextChar = ReaderRead()) != -1) {
- Token token;
-
- switch (nextChar) {
- case ' ':
- case '\t':
- continue;
- case '\r':
- case '\n':
- if (hadLineEnd) {
- // second line end before getting to a token
- // -> here was a blank line
- specialTracker.AddEndOfLine(new Location(Col, Line));
- }
- HandleLineEnd((char)nextChar);
- hadLineEnd = true;
- isAtLineBegin = true;
- continue;
- case '/':
- int peek = ReaderPeek();
- if (peek == '/' || peek == '*') {
- ReadComment();
- continue;
- } else {
- isAtLineBegin = false;
- token = ReadOperator('/');
- }
- break;
- case '#':
- ReadPreProcessingDirective();
- isAtLineBegin = false;
- continue;
- case '"':
- token = ReadString();
- isAtLineBegin = false;
- break;
- case '\'':
- token = ReadChar();
- isAtLineBegin = false;
- break;
- case '@':
- isAtLineBegin = false;
- int next = ReaderRead();
- if (next == -1) {
- errors.Error(Line, Col, String.Format("EOF after @"));
- continue;
- } else {
- int x = Col - 1;
- int y = Line;
- ch = (char)next;
- if (ch == '"') {
- token = ReadVerbatimString();
- } else if (Char.IsLetterOrDigit(ch) || ch == '_') {
- bool canBeKeyword;
- token = new Token(Tokens.Identifier, x - 1, y, ReadIdent(ch, out canBeKeyword));
- } else {
- HandleLineEnd(ch);
- errors.Error(y, x, String.Format("Unexpected char in Lexer.Next() : {0}", ch));
- continue;
- }
- }
- break;
- default:
- isAtLineBegin = false; // non-ws chars are handled here
- ch = (char)nextChar;
- if (Char.IsLetter(ch) || ch == '_' || ch == '\\') {
- int x = Col - 1; // Col was incremented above, but we want the start of the identifier
- int y = Line;
- bool canBeKeyword;
- string s = ReadIdent(ch, out canBeKeyword);
- if (canBeKeyword) {
- int keyWordToken = Keywords.GetToken(s);
- if (keyWordToken >= 0) {
- return new Token(keyWordToken, x, y, s);
- }
- }
- return new Token(Tokens.Identifier, x, y, s);
- } else if (Char.IsDigit(ch)) {
- token = ReadDigit(ch, Col - 1);
- } else {
- token = ReadOperator(ch);
- }
- break;
- }
-
- // try error recovery (token = null -> continue with next char)
- if (token != null) {
- return token;
- }
- }
-
- return new Token(Tokens.EOF, Col, Line, String.Empty);
- }
-
- // The C# compiler has a fixed size length therefore we'll use a fixed size char array for identifiers
- // it's also faster than using a string builder.
- const int MAX_IDENTIFIER_LENGTH = 512;
- char[] identBuffer = new char[MAX_IDENTIFIER_LENGTH];
-
- string ReadIdent(char ch, out bool canBeKeyword)
- {
- int peek;
- int curPos = 0;
- canBeKeyword = true;
- while (true) {
- if (ch == '\\') {
- peek = ReaderPeek();
- if (peek != 'u' && peek != 'U') {
- errors.Error(Line, Col, "Identifiers can only contain unicode escape sequences");
- }
- canBeKeyword = false;
- string surrogatePair;
- ReadEscapeSequence(out ch, out surrogatePair);
- if (surrogatePair != null) {
- if (!char.IsLetterOrDigit(surrogatePair, 0)) {
- errors.Error(Line, Col, "Unicode escape sequences in identifiers cannot be used to represent characters that are invalid in identifiers");
- }
- for (int i = 0; i < surrogatePair.Length - 1; i++) {
- if (curPos < MAX_IDENTIFIER_LENGTH) {
- identBuffer[curPos++] = surrogatePair[i];
- }
- }
- ch = surrogatePair[surrogatePair.Length - 1];
- } else {
- if (!IsIdentifierPart(ch)) {
- errors.Error(Line, Col, "Unicode escape sequences in identifiers cannot be used to represent characters that are invalid in identifiers");
- }
- }
- }
-
- if (curPos < MAX_IDENTIFIER_LENGTH) {
- identBuffer[curPos++] = ch;
- } else {
- errors.Error(Line, Col, String.Format("Identifier too long"));
- while (IsIdentifierPart(ReaderPeek())) {
- ReaderRead();
- }
- break;
- }
- peek = ReaderPeek();
- if (IsIdentifierPart(peek) || peek == '\\') {
- ch = (char)ReaderRead();
- } else {
- break;
- }
- }
- return new String(identBuffer, 0, curPos);
- }
-
- Token ReadDigit(char ch, int x)
- {
- unchecked { // prevent exception when ReaderPeek() = -1 is cast to char
- int y = Line;
- sb.Length = 0;
- sb.Append(ch);
- string prefix = null;
- string suffix = null;
-
- bool ishex = false;
- bool isunsigned = false;
- bool islong = false;
- bool isfloat = false;
- bool isdouble = false;
- bool isdecimal = false;
-
- char peek = (char)ReaderPeek();
-
- if (ch == '.') {
- isdouble = true;
-
- while (Char.IsDigit((char)ReaderPeek())) { // read decimal digits beyond the dot
- sb.Append((char)ReaderRead());
- }
- peek = (char)ReaderPeek();
- } else if (ch == '0' && (peek == 'x' || peek == 'X')) {
- ReaderRead(); // skip 'x'
- sb.Length = 0; // Remove '0' from 0x prefix from the stringvalue
- while (IsHex((char)ReaderPeek())) {
- sb.Append((char)ReaderRead());
- }
- if (sb.Length == 0) {
- sb.Append('0'); // dummy value to prevent exception
- errors.Error(y, x, "Invalid hexadecimal integer literal");
- }
- ishex = true;
- prefix = "0x";
- peek = (char)ReaderPeek();
- } else {
- while (Char.IsDigit((char)ReaderPeek())) {
- sb.Append((char)ReaderRead());
- }
- peek = (char)ReaderPeek();
- }
-
- Token nextToken = null; // if we accidently read a 'dot'
- if (peek == '.') { // read floating point number
- ReaderRead();
- peek = (char)ReaderPeek();
- if (!Char.IsDigit(peek)) {
- nextToken = new Token(Tokens.Dot, Col - 1, Line);
- peek = '.';
- } else {
- isdouble = true; // double is default
- if (ishex) {
- errors.Error(y, x, String.Format("No hexadecimal floating point values allowed"));
- }
- sb.Append('.');
-
- while (Char.IsDigit((char)ReaderPeek())) { // read decimal digits beyond the dot
- sb.Append((char)ReaderRead());
- }
- peek = (char)ReaderPeek();
- }
- }
-
- if (peek == 'e' || peek == 'E') { // read exponent
- isdouble = true;
- sb.Append((char)ReaderRead());
- peek = (char)ReaderPeek();
- if (peek == '-' || peek == '+') {
- sb.Append((char)ReaderRead());
- }
- while (Char.IsDigit((char)ReaderPeek())) { // read exponent value
- sb.Append((char)ReaderRead());
- }
- isunsigned = true;
- peek = (char)ReaderPeek();
- }
-
- if (peek == 'f' || peek == 'F') { // float value
- ReaderRead();
- suffix = "f";
- isfloat = true;
- } else if (peek == 'd' || peek == 'D') { // double type suffix (obsolete, double is default)
- ReaderRead();
- suffix = "d";
- isdouble = true;
- } else if (peek == 'm' || peek == 'M') { // decimal value
- ReaderRead();
- suffix = "m";
- isdecimal = true;
- } else if (!isdouble) {
- if (peek == 'u' || peek == 'U') {
- ReaderRead();
- suffix = "u";
- isunsigned = true;
- peek = (char)ReaderPeek();
- }
-
- if (peek == 'l' || peek == 'L') {
- ReaderRead();
- peek = (char)ReaderPeek();
- islong = true;
- if (!isunsigned && (peek == 'u' || peek == 'U')) {
- ReaderRead();
- suffix = "Lu";
- isunsigned = true;
- } else {
- suffix = isunsigned ? "uL" : "L";
- }
- }
- }
-
- string digit = sb.ToString();
- string stringValue = prefix + digit + suffix;
-
- if (isfloat) {
- float num;
- if (float.TryParse(digit, NumberStyles.Any, CultureInfo.InvariantCulture, out num)) {
- return new Token(Tokens.Literal, x, y, stringValue, num, LiteralFormat.DecimalNumber);
- } else {
- errors.Error(y, x, String.Format("Can't parse float {0}", digit));
- return new Token(Tokens.Literal, x, y, stringValue, 0f, LiteralFormat.DecimalNumber);
- }
- }
- if (isdecimal) {
- decimal num;
- if (decimal.TryParse(digit, NumberStyles.Any, CultureInfo.InvariantCulture, out num)) {
- return new Token(Tokens.Literal, x, y, stringValue, num, LiteralFormat.DecimalNumber);
- } else {
- errors.Error(y, x, String.Format("Can't parse decimal {0}", digit));
- return new Token(Tokens.Literal, x, y, stringValue, 0m, LiteralFormat.DecimalNumber);
- }
- }
- if (isdouble) {
- double num;
- if (double.TryParse(digit, NumberStyles.Any, CultureInfo.InvariantCulture, out num)) {
- return new Token(Tokens.Literal, x, y, stringValue, num, LiteralFormat.DecimalNumber);
- } else {
- errors.Error(y, x, String.Format("Can't parse double {0}", digit));
- return new Token(Tokens.Literal, x, y, stringValue, 0d, LiteralFormat.DecimalNumber);
- }
- }
-
- // Try to determine a parsable value using ranges.
- ulong result;
- if (ishex) {
- if (!ulong.TryParse(digit, NumberStyles.HexNumber, null, out result)) {
- errors.Error(y, x, String.Format("Can't parse hexadecimal constant {0}", digit));
- return new Token(Tokens.Literal, x, y, stringValue.ToString(), 0, LiteralFormat.HexadecimalNumber);
- }
- } else {
- if (!ulong.TryParse(digit, NumberStyles.Integer, null, out result)) {
- errors.Error(y, x, String.Format("Can't parse integral constant {0}", digit));
- return new Token(Tokens.Literal, x, y, stringValue.ToString(), 0, LiteralFormat.DecimalNumber);
- }
- }
-
- if (result > long.MaxValue) {
- islong = true;
- isunsigned = true;
- } else if (result > uint.MaxValue) {
- islong = true;
- } else if (islong == false && result > int.MaxValue) {
- isunsigned = true;
- }
-
- Token token;
-
- LiteralFormat literalFormat = ishex ? LiteralFormat.HexadecimalNumber : LiteralFormat.DecimalNumber;
- if (islong) {
- if (isunsigned) {
- ulong num;
- if (ulong.TryParse(digit, ishex ? NumberStyles.HexNumber : NumberStyles.Number, CultureInfo.InvariantCulture, out num)) {
- token = new Token(Tokens.Literal, x, y, stringValue, num, literalFormat);
- } else {
- errors.Error(y, x, String.Format("Can't parse unsigned long {0}", digit));
- token = new Token(Tokens.Literal, x, y, stringValue, 0UL, literalFormat);
- }
- } else {
- long num;
- if (long.TryParse(digit, ishex ? NumberStyles.HexNumber : NumberStyles.Number, CultureInfo.InvariantCulture, out num)) {
- token = new Token(Tokens.Literal, x, y, stringValue, num, literalFormat);
- } else {
- errors.Error(y, x, String.Format("Can't parse long {0}", digit));
- token = new Token(Tokens.Literal, x, y, stringValue, 0L, literalFormat);
- }
- }
- } else {
- if (isunsigned) {
- uint num;
- if (uint.TryParse(digit, ishex ? NumberStyles.HexNumber : NumberStyles.Number, CultureInfo.InvariantCulture, out num)) {
- token = new Token(Tokens.Literal, x, y, stringValue, num, literalFormat);
- } else {
- errors.Error(y, x, String.Format("Can't parse unsigned int {0}", digit));
- token = new Token(Tokens.Literal, x, y, stringValue, (uint)0, literalFormat);
- }
- } else {
- int num;
- if (int.TryParse(digit, ishex ? NumberStyles.HexNumber : NumberStyles.Number, CultureInfo.InvariantCulture, out num)) {
- token = new Token(Tokens.Literal, x, y, stringValue, num, literalFormat);
- } else {
- errors.Error(y, x, String.Format("Can't parse int {0}", digit));
- token = new Token(Tokens.Literal, x, y, stringValue, 0, literalFormat);
- }
- }
- }
- token.next = nextToken;
- return token;
- }
- }
-
- void SkipString()
- {
- int x = Col - 1;
- int y = Line;
-
- bool doneNormally = false;
- int nextChar;
- while ((nextChar = ReaderRead()) != -1) {
- char ch = (char)nextChar;
-
- if (ch == '"') {
- doneNormally = true;
- break;
- }
-
- if (ch == '\\') {
- SkipEscapeSequence();
- } else if (HandleLineEnd(ch)) {
- // call HandleLineEnd to ensure line numbers are still correct after the error
- errors.Error(y, x, String.Format("No new line is allowed inside a string literal"));
- break;
- }
- }
- if (!doneNormally)
- errors.Error(y, x, String.Format("End of file reached inside string literal"));
- }
-
-
- Token ReadString()
- {
- int x = Col - 1;
- int y = Line;
-
- sb.Length = 0;
- originalValue.Length = 0;
- originalValue.Append('"');
- bool doneNormally = false;
- int nextChar;
- while ((nextChar = ReaderRead()) != -1) {
- char ch = (char)nextChar;
-
- if (ch == '"') {
- doneNormally = true;
- originalValue.Append('"');
- break;
- }
-
- if (ch == '\\') {
- originalValue.Append('\\');
- string surrogatePair;
- originalValue.Append(ReadEscapeSequence(out ch, out surrogatePair));
- if (surrogatePair != null) {
- sb.Append(surrogatePair);
- } else {
- sb.Append(ch);
- }
- } else if (HandleLineEnd(ch)) {
- // call HandleLineEnd to ensure line numbers are still correct after the error
- errors.Error(y, x, String.Format("No new line is allowed inside a string literal"));
- break;
- } else {
- originalValue.Append(ch);
- sb.Append(ch);
- }
- }
-
- if (!doneNormally) {
- errors.Error(y, x, String.Format("End of file reached inside string literal"));
- }
-
- return new Token(Tokens.Literal, x, y, originalValue.ToString(), sb.ToString(), LiteralFormat.StringLiteral);
- }
-
- Token ReadVerbatimString()
- {
- sb.Length = 0;
- originalValue.Length = 0;
- originalValue.Append("@\"");
- Location startLocation = new Location(Col - 2, Line); // @ and " already read
- int nextChar;
- while ((nextChar = ReaderRead()) != -1) {
- char ch = (char)nextChar;
-
- if (ch == '"') {
- if (ReaderPeek() != '"') {
- originalValue.Append('"');
- break;
- }
- originalValue.Append("\"\"");
- sb.Append('"');
- ReaderRead();
- } else if (HandleLineEnd(ch)) {
- sb.Append("\r\n");
- originalValue.Append("\r\n");
- } else {
- sb.Append(ch);
- originalValue.Append(ch);
- }
- }
-
- if (nextChar == -1) {
- errors.Error(startLocation.Line, startLocation.Column, String.Format("End of file reached inside verbatim string literal"));
- }
-
- return new Token(Tokens.Literal, startLocation, new Location(Col, Line), originalValue.ToString(), sb.ToString(), LiteralFormat.VerbatimStringLiteral);
- }
-
- readonly char[] escapeSequenceBuffer = new char[12];
-
- /// <summary>
- /// reads an escape sequence
- /// </summary>
- /// <param name="ch">The character represented by the escape sequence,
- /// or '\0' if there was an error or the escape sequence represents a character that
- /// can be represented only be a suggorate pair</param>
- /// <param name="surrogatePair">Null, except when the character represented
- /// by the escape sequence can only be represented by a surrogate pair (then the string
- /// contains the surrogate pair)</param>
- /// <returns>The escape sequence</returns>
- string ReadEscapeSequence(out char ch, out string surrogatePair)
- {
- surrogatePair = null;
-
- int nextChar = ReaderRead();
- if (nextChar == -1) {
- errors.Error(Line, Col, String.Format("End of file reached inside escape sequence"));
- ch = '\0';
- return String.Empty;
- }
- int number;
- char c = (char)nextChar;
- int curPos = 1;
- escapeSequenceBuffer[0] = c;
- switch (c) {
- case '\'':
- ch = '\'';
- break;
- case '\"':
- ch = '\"';
- break;
- case '\\':
- ch = '\\';
- break;
- case '0':
- ch = '\0';
- break;
- case 'a':
- ch = '\a';
- break;
- case 'b':
- ch = '\b';
- break;
- case 'f':
- ch = '\f';
- break;
- case 'n':
- ch = '\n';
- break;
- case 'r':
- ch = '\r';
- break;
- case 't':
- ch = '\t';
- break;
- case 'v':
- ch = '\v';
- break;
- case 'u':
- case 'x':
- // 16 bit unicode character
- c = (char)ReaderRead();
- number = GetHexNumber(c);
- escapeSequenceBuffer[curPos++] = c;
-
- if (number < 0) {
- errors.Error(Line, Col - 1, String.Format("Invalid char in literal : {0}", c));
- }
- for (int i = 0; i < 3; ++i) {
- if (IsHex((char)ReaderPeek())) {
- c = (char)ReaderRead();
- int idx = GetHexNumber(c);
- escapeSequenceBuffer[curPos++] = c;
- number = 16 * number + idx;
- } else {
- break;
- }
- }
- ch = (char)number;
- break;
- case 'U':
- // 32 bit unicode character
- number = 0;
- for (int i = 0; i < 8; ++i) {
- if (IsHex((char)ReaderPeek())) {
- c = (char)ReaderRead();
- int idx = GetHexNumber(c);
- escapeSequenceBuffer[curPos++] = c;
- number = 16 * number + idx;
- } else {
- errors.Error(Line, Col - 1, String.Format("Invalid char in literal : {0}", (char)ReaderPeek()));
- break;
- }
- }
- if (number > 0xffff) {
- ch = '\0';
- surrogatePair = char.ConvertFromUtf32(number);
- } else {
- ch = (char)number;
- }
- break;
- default:
- errors.Error(Line, Col, String.Format("Unexpected escape sequence : {0}", c));
- ch = '\0';
- break;
- }
- return new String(escapeSequenceBuffer, 0, curPos);
- }
-
- void SkipEscapeSequence()
- {
- int nextChar = ReaderRead();
- if (nextChar == -1) {
- errors.Error(Line, Col, String.Format("End of file reached inside escape sequence"));
- return;
- }
- switch (nextChar) {
- case '\'':
- case '\"':
- case '\\':
- case '0':
- case 'a':
- case 'b':
- case 'f':
- case 'n':
- case 'r':
- case 't':
- case 'v':
- case 'u':
- break;
- case 'x':
- // 16 bit unicode character
- char c = (char)ReaderRead();
- if (GetHexNumber(c) < 0)
- errors.Error(Line, Col - 1, String.Format("Invalid char in literal : {0}", c));
- for (int i = 0; i < 3; ++i) {
- if (IsHex((char)ReaderPeek())) {
- ReaderRead();
- } else {
- break;
- }
- }
- break;
- case 'U':
- for (int i = 0; i < 8; ++i) {
- if (IsHex((char)ReaderPeek())) {
- ReaderRead();
- } else {
- errors.Error(Line, Col - 1, String.Format("Invalid char in literal : {0}", (char)ReaderPeek()));
- break;
- }
- }
- break;
- default:
- errors.Error(Line, Col, String.Format("Unexpected escape sequence : {0}", nextChar));
- break;
- }
- }
-
- Token ReadChar()
- {
- int x = Col - 1;
- int y = Line;
- int nextChar = ReaderRead();
- if (nextChar == -1 || HandleLineEnd((char)nextChar)) {
- errors.Error(y, x, String.Format("End of line reached inside character literal"));
- return null;
- }
- char ch = (char)nextChar;
- char chValue = ch;
- string escapeSequence = String.Empty;
- if (ch == '\\') {
- string surrogatePair;
- escapeSequence = ReadEscapeSequence(out chValue, out surrogatePair);
- if (surrogatePair != null) {
- errors.Error(y, x, String.Format("The unicode character must be represented by a surrogate pair and does not fit into a System.Char"));
- }
- }
-
- unchecked {
- if ((char)ReaderRead() != '\'') {
- errors.Error(y, x, String.Format("Char not terminated"));
- }
- }
- return new Token(Tokens.Literal, x, y, "'" + ch + escapeSequence + "'", chValue, LiteralFormat.CharLiteral);
- }
-
- Token ReadOperator(char ch)
- {
- int x = Col - 1;
- int y = Line;
- switch (ch) {
- case '+':
- switch (ReaderPeek()) {
- case '+':
- ReaderRead();
- return new Token(Tokens.Increment, x, y);
- case '=':
- ReaderRead();
- return new Token(Tokens.PlusAssign, x, y);
- }
- return new Token(Tokens.Plus, x, y);
- case '-':
- switch (ReaderPeek()) {
- case '-':
- ReaderRead();
- return new Token(Tokens.Decrement, x, y);
- case '=':
- ReaderRead();
- return new Token(Tokens.MinusAssign, x, y);
- case '>':
- ReaderRead();
- return new Token(Tokens.Pointer, x, y);
- }
- 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);
- }
- return new Token(Tokens.Div, x, y);
- case '%':
- switch (ReaderPeek()) {
- case '=':
- ReaderRead();
- return new Token(Tokens.ModAssign, x, y);
- }
- return new Token(Tokens.Mod, x, y);
- case '&':
- switch (ReaderPeek()) {
- case '&':
- ReaderRead();
- return new Token(Tokens.LogicalAnd, x, y);
- case '=':
- ReaderRead();
- return new Token(Tokens.BitwiseAndAssign, x, y);
- }
- return new Token(Tokens.BitwiseAnd, x, y);
- case '|':
- switch (ReaderPeek()) {
- case '|':
- ReaderRead();
- return new Token(Tokens.LogicalOr, x, y);
- case '=':
- ReaderRead();
- return new Token(Tokens.BitwiseOrAssign, x, y);
- }
- return new Token(Tokens.BitwiseOr, x, y);
- case '^':
- switch (ReaderPeek()) {
- case '=':
- ReaderRead();
- return new Token(Tokens.XorAssign, x, y);
- default:
- break;
- }
- return new Token(Tokens.Xor, x, y);
- case '!':
- switch (ReaderPeek()) {
- case '=':
- ReaderRead();
- return new Token(Tokens.NotEqual, x, y);
- }
- return new Token(Tokens.Not, x, y);
- case '~':
- return new Token(Tokens.BitwiseComplement, x, y);
- case '=':
- switch (ReaderPeek()) {
- case '=':
- ReaderRead();
- return new Token(Tokens.Equal, x, y);
- case '>':
- ReaderRead();
- return new Token(Tokens.LambdaArrow, x, y);
- }
- return new Token(Tokens.Assign, x, y);
- case '<':
- switch (ReaderPeek()) {
- case '<':
- ReaderRead();
- switch (ReaderPeek()) {
- case '=':
- ReaderRead();
- return new Token(Tokens.ShiftLeftAssign, x, y);
- default:
- break;
- }
- return new Token(Tokens.ShiftLeft, x, y);
- case '=':
- ReaderRead();
- return new Token(Tokens.LessEqual, x, y);
- }
- return new Token(Tokens.LessThan, x, y);
- case '>':
- switch (ReaderPeek()) {
- // Removed because of generics:
-// case '>':
-// ReaderRead();
-// if (ReaderPeek() != -1) {
-// switch ((char)ReaderPeek()) {
-// case '=':
-// ReaderRead();
-// return new Token(Tokens.ShiftRightAssign, x, y);
-// default:
-// break;
-// }
-// }
-// return new Token(Tokens.ShiftRight, x, y);
- case '=':
- ReaderRead();
- return new Token(Tokens.GreaterEqual, x, y);
- }
- return new Token(Tokens.GreaterThan, x, y);
- case '?':
- if (ReaderPeek() == '?') {
- ReaderRead();
- return new Token(Tokens.DoubleQuestion, x, y);
- }
- return new Token(Tokens.Question, x, y);
- case ';':
- return new Token(Tokens.Semicolon, x, y);
- case ':':
- if (ReaderPeek() == ':') {
- ReaderRead();
- return new Token(Tokens.DoubleColon, x, y);
- }
- return new Token(Tokens.Colon, x, y);
- case ',':
- return new Token(Tokens.Comma, x, y);
- case '.':
- // Prevent OverflowException when ReaderPeek returns -1
- int tmp = ReaderPeek();
- if (tmp > 0 && Char.IsDigit((char)tmp)) {
- return ReadDigit('.', Col - 1);
- }
- return new Token(Tokens.Dot, x, y);
- case ')':
- return new Token(Tokens.CloseParenthesis, x, y);
- case '(':
- return new Token(Tokens.OpenParenthesis, x, y);
- case ']':
- return new Token(Tokens.CloseSquareBracket, x, y);
- case '[':
- return new Token(Tokens.OpenSquareBracket, x, y);
- case '}':
- return new Token(Tokens.CloseCurlyBrace, x, y);
- case '{':
- return new Token(Tokens.OpenCurlyBrace, x, y);
- default:
- return null;
- }
- }
-
- void ReadComment()
- {
- switch (ReaderRead()) {
- case '*':
- ReadMultiLineComment();
- isAtLineBegin = false;
- break;
- case '/':
- if (ReaderPeek() == '/') {
- ReaderRead();
- ReadSingleLineComment(CommentType.Documentation);
- } else {
- ReadSingleLineComment(CommentType.SingleLine);
- }
- isAtLineBegin = true;
- break;
- default:
- errors.Error(Line, Col, String.Format("Error while reading comment"));
- break;
- }
- }
-
- string ReadCommentToEOL()
- {
- if (specialCommentHash == null) {
- return ReadToEndOfLine();
- }
- sb.Length = 0;
- StringBuilder curWord = new StringBuilder();
- int nextChar;
- while ((nextChar = ReaderRead()) != -1) {
- char ch = (char)nextChar;
-
- if (HandleLineEnd(ch)) {
- break;
- }
-
- sb.Append(ch);
- if (IsIdentifierPart(nextChar)) {
- curWord.Append(ch);
- } else {
- string tag = curWord.ToString();
- curWord.Length = 0;
- if (specialCommentHash.ContainsKey(tag)) {
- Location p = new Location(Col, Line);
- string comment = ReadToEndOfLine ();
- this.TagComments.Add(new TagComment(tag, comment, isAtLineBegin, p, new Location(Col, Line)));
- break;
- }
- }
- }
- return sb.ToString();
- }
-
- void ReadSingleLineComment(CommentType commentType)
- {
- if (this.SkipAllComments) {
- SkipToEndOfLine();
- } else {
- specialTracker.StartComment(commentType, isAtLineBegin, new Location(Col, Line));
- specialTracker.AddString(ReadCommentToEOL());
- specialTracker.FinishComment(new Location(lineBreakPosition.Column, lineBreakPosition.Line));
- }
- }
-
- void ReadMultiLineComment()
- {
- int nextChar;
- if (this.SkipAllComments) {
- while ((nextChar = ReaderRead()) != -1) {
- char ch = (char)nextChar;
- if (ch == '*' && ReaderPeek() == '/') {
- ReaderRead();
- return;
- } else {
- HandleLineEnd(ch);
- }
- }
- } else {
- specialTracker.StartComment(CommentType.Block, isAtLineBegin, new Location(Col, Line));
-
- // sc* = special comment handling (TO DO markers)
- string scTag = null; // is set to non-null value when we are inside a comment marker
- StringBuilder scCurWord = new StringBuilder(); // current word, (scTag == null) or comment (when scTag != null)
- Location scStartLocation = Location.Empty;
-
- while ((nextChar = ReaderRead()) != -1) {
- char ch = (char)nextChar;
-
- if (HandleLineEnd(ch)) {
- if (scTag != null) {
- this.TagComments.Add(new TagComment(scTag, scCurWord.ToString(), isAtLineBegin, scStartLocation, new Location(Col, Line)));
- scTag = null;
- }
- scCurWord.Length = 0;
- specialTracker.AddString(Environment.NewLine);
- continue;
- }
-
- // End of multiline comment reached ?
- if (ch == '*' && ReaderPeek() == '/') {
- if (scTag != null) {
- this.TagComments.Add(new TagComment(scTag, scCurWord.ToString(), isAtLineBegin, scStartLocation, new Location(Col, Line)));
- }
- ReaderRead();
- specialTracker.FinishComment(new Location(Col, Line));
- return;
- }
- specialTracker.AddChar(ch);
- if (scTag != null || IsIdentifierPart(ch)) {
- scCurWord.Append(ch);
- } else {
- if (specialCommentHash != null && specialCommentHash.ContainsKey(scCurWord.ToString())) {
- scTag = scCurWord.ToString();
- scStartLocation = new Location(Col, Line);
- }
- scCurWord.Length = 0;
- }
- }
- specialTracker.FinishComment(new Location(Col, Line));
- }
- // Reached EOF before end of multiline comment.
- errors.Error(Line, Col, String.Format("Reached EOF before the end of a multiline comment"));
- }
-
- /// <summary>
- /// Skips to the end of the current code block.
- /// For this, the lexer must have read the next token AFTER the token opening the
- /// block (so that Lexer.Token is the block-opening token, not Lexer.LookAhead).
- /// After the call, Lexer.LookAhead will be the block-closing token.
- /// </summary>
- public override void SkipCurrentBlock(int targetToken)
- {
- int braceCount = 0;
- while (curToken != null) {
- if (curToken.kind == Tokens.OpenCurlyBrace) {
- ++braceCount;
- } else if (curToken.kind == Tokens.CloseCurlyBrace) {
- if (--braceCount < 0)
- return;
- }
- lastToken = curToken;
- curToken = curToken.next;
- }
- isAtLineBegin = true;
- int nextChar;
- while ((nextChar = ReaderRead()) != -1) {
- switch (nextChar) {
- case '{':
- isAtLineBegin = false;
- braceCount++;
- break;
- case '}':
- isAtLineBegin = false;
- if (--braceCount < 0) {
- curToken = new Token(Tokens.CloseCurlyBrace, Col - 1, Line);
- return;
- }
- break;
- case '/':
- int peek = ReaderPeek();
- if (peek == '/' || peek == '*') {
- ReadComment();
- }
- isAtLineBegin = false;
- break;
- case '#':
- ReadPreProcessingDirective();
- isAtLineBegin = false;
- break;
- case '"':
- SkipString();
- isAtLineBegin = false;
- break;
- case '\'':
- ReadChar();
- isAtLineBegin = false;
- break;
- case '\r':
- case '\n':
- HandleLineEnd((char)nextChar);
- isAtLineBegin = true;
- break;
- case '@':
- int next = ReaderRead();
- if (next == -1) {
- errors.Error(Line, Col, String.Format("EOF after @"));
- } else if (next == '"') {
- ReadVerbatimString();
- }
- isAtLineBegin = false;
- break;
- }
- }
- curToken = new Token(Tokens.EOF, Col, Line);
- }
-
- public override IDictionary<string, object> ConditionalCompilationSymbols {
- get { return conditionalCompilation.Symbols; }
- }
-
- public override void SetConditionalCompilationSymbols (string symbols)
- {
- foreach (string symbol in GetSymbols (symbols)) {
- conditionalCompilation.Define (symbol);
- }
- }
-
-
- ConditionalCompilation conditionalCompilation = new ConditionalCompilation();
-
- void ReadPreProcessingDirective()
- {
- PreprocessingDirective d = ReadPreProcessingDirectiveInternal(true, true);
- this.specialTracker.AddPreprocessingDirective(d);
-
- if (EvaluateConditionalCompilation) {
- switch (d.Cmd) {
- case "#define":
- conditionalCompilation.Define(d.Arg);
- break;
- case "#undef":
- conditionalCompilation.Undefine(d.Arg);
- break;
- case "#if":
- if (!conditionalCompilation.Evaluate(d.Expression)) {
- // skip to valid #elif or #else or #endif
- int level = 1;
- while (true) {
- d = SkipToPreProcessingDirective(false, level == 1);
- if (d == null)
- break;
- if (d.Cmd == "#if") {
- level++;
- } else if (d.Cmd == "#endif") {
- level--;
- if (level == 0)
- break;
- } else if (level == 1 && (d.Cmd == "#else"
- || d.Cmd == "#elif" && conditionalCompilation.Evaluate(d.Expression)))
- {
- break;
- }
- }
- if (d != null)
- this.specialTracker.AddPreprocessingDirective(d);
- }
- break;
- case "#elif":
- case "#else":
- // we already visited the #if part or a previous #elif part, so skip until #endif
- {
- int level = 1;
- while (true) {
- d = SkipToPreProcessingDirective(false, false);
- if (d == null)
- break;
- if (d.Cmd == "#if") {
- level++;
- } else if (d.Cmd == "#endif") {
- level--;
- if (level == 0)
- break;
- }
- }
- if (d != null)
- this.specialTracker.AddPreprocessingDirective(d);
- }
- break;
- }
- }
- }
-
- PreprocessingDirective SkipToPreProcessingDirective(bool parseIfExpression, bool parseElifExpression)
- {
- int c;
- while (true) {
- PPWhitespace();
- c = ReaderRead();
- if (c == -1) {
- errors.Error(Line, Col, String.Format("Reached EOF but expected #endif"));
- return null;
- } else if (c == '#') {
- break;
- } else {
- if (c != '\n') // only skip non empty lines.
- SkipToEndOfLine();
- }
- }
- return ReadPreProcessingDirectiveInternal(parseIfExpression, parseElifExpression);
- }
-
- PreprocessingDirective ReadPreProcessingDirectiveInternal(bool parseIfExpression, bool parseElifExpression)
- {
- Location start = new Location(Col - 1, Line);
-
- // skip spaces between # and the directive
- PPWhitespace();
-
- bool canBeKeyword;
- string directive = ReadIdent('#', out canBeKeyword);
-
- PPWhitespace();
- if (parseIfExpression && directive == "#if" || parseElifExpression && directive == "#elif") {
- recordedText.Length = 0;
- recordRead = true;
- Ast.Expression expr = PPExpression();
- string arg = recordedText.ToString ();
- recordRead = false;
-
- Location endLocation = new Location(Col, Line);
- int c = ReaderRead();
- if (c >= 0 && !HandleLineEnd((char)c)) {
- if (c == '/' && ReaderRead() == '/') {
- // comment to end of line
- } else {
- errors.Error(Col, Line, "Expected end of line");
- }
- SkipToEndOfLine(); // skip comment
- }
- return new PreprocessingDirective(directive, arg, start, endLocation) { Expression = expr, LastLineEnd = lastLineEnd };
- } else {
- Location endLocation = new Location(Col, Line);
- string arg = ReadToEndOfLine();
- endLocation.Column += arg.Length;
- int pos = arg.IndexOf("//");
- if (pos >= 0)
- arg = arg.Substring(0, pos);
- arg = arg.Trim();
- return new PreprocessingDirective(directive, arg, start, endLocation) { LastLineEnd = lastLineEnd };
- }
- }
-
- void PPWhitespace()
- {
- while (ReaderPeek() == ' ' || ReaderPeek() == '\t')
- ReaderRead();
- }
-
- public Ast.Expression PPExpression()
- {
- Ast.Expression expr = PPAndExpression();
- while (ReaderPeek() == '|') {
- Token token = ReadOperator((char)ReaderRead());
- if (token == null || token.kind != Tokens.LogicalOr) {
- return expr;
- }
- Ast.Expression expr2 = PPAndExpression();
- expr = new Ast.BinaryOperatorExpression(expr, Ast.BinaryOperatorType.LogicalOr, expr2);
- }
- return expr;
- }
-
- Ast.Expression PPAndExpression()
- {
- Ast.Expression expr = PPEqualityExpression();
- while (ReaderPeek() == '&') {
- Token token = ReadOperator((char)ReaderRead());
- if (token == null || token.kind != Tokens.LogicalAnd) {
- break;
- }
- Ast.Expression expr2 = PPEqualityExpression();
- expr = new Ast.BinaryOperatorExpression(expr, Ast.BinaryOperatorType.LogicalAnd, expr2);
- }
- return expr;
- }
-
- Ast.Expression PPEqualityExpression()
- {
- Ast.Expression expr = PPUnaryExpression();
- while (ReaderPeek() == '=' || ReaderPeek() == '!') {
- Token token = ReadOperator((char)ReaderRead());
- if (token == null || token.kind != Tokens.Equal && token.kind != Tokens.NotEqual) {
- break;
- }
- Ast.Expression expr2 = PPUnaryExpression();
- expr = new Ast.BinaryOperatorExpression(expr, token.kind == Tokens.Equal ? Ast.BinaryOperatorType.Equality : Ast.BinaryOperatorType.InEquality, expr2);
- }
- return expr;
- }
-
- Ast.Expression PPUnaryExpression()
- {
- PPWhitespace();
- if (ReaderPeek() == '!') {
- ReaderRead();
- PPWhitespace();
- return new Ast.UnaryOperatorExpression(PPUnaryExpression(), Ast.UnaryOperatorType.Not);
- } else {
- return PPPrimaryExpression();
- }
- }
-
- Ast.Expression PPPrimaryExpression()
- {
- int c = ReaderRead();
- if (c < 0)
- return Ast.Expression.Null;
- if (c == '(') {
- Ast.Expression expr = new Ast.ParenthesizedExpression(PPExpression());
- PPWhitespace();
- if (ReaderRead() != ')')
- errors.Error(Col, Line, "Expected ')'");
- PPWhitespace();
- return expr;
- } else {
- if (c != '_' && !char.IsLetterOrDigit((char)c) && c != '\\')
- errors.Error(Col, Line, "Expected conditional symbol");
- bool canBeKeyword;
- string symbol = ReadIdent((char)c, out canBeKeyword);
- PPWhitespace();
- if (canBeKeyword && symbol == "true")
- return new Ast.PrimitiveExpression(true, "true");
- else if (canBeKeyword && symbol == "false")
- return new Ast.PrimitiveExpression(false, "false");
- else
- return new Ast.IdentifierExpression(symbol);
- }
- }
- }
-}
diff --git a/main/contrib/NRefactory/Project/Src/Lexer/CSharp/Tokens.cs b/main/contrib/NRefactory/Project/Src/Lexer/CSharp/Tokens.cs
deleted file mode 100644
index 69e836a6a4..0000000000
--- a/main/contrib/NRefactory/Project/Src/Lexer/CSharp/Tokens.cs
+++ /dev/null
@@ -1,353 +0,0 @@
-// this file was autogenerated by a tool.
-using System;
-using System.Collections;
-
-namespace ICSharpCode.OldNRefactory.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
deleted file mode 100644
index fdb77928fb..0000000000
--- a/main/contrib/NRefactory/Project/Src/Lexer/ILexer.cs
+++ /dev/null
@@ -1,105 +0,0 @@
-// <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;
-
-namespace ICSharpCode.OldNRefactory.Parser
-{
- /// <summary>
- /// Lexer interface
- /// </summary>
- public interface ILexer : IDisposable
- {
- Errors Errors {
- get;
- }
-
- /// <summary>
- /// The current Token. <seealso cref="ICSharpCode.OldNRefactory.Parser.Token"/>
- /// </summary>
- Token Token {
- get;
- }
-
- /// <summary>
- /// The next Token (The <see cref="Token"/> after <see cref="NextToken"/> call) . <seealso cref="ICSharpCode.OldNRefactory.Parser.Token"/>
- /// </summary>
- Token LookAhead {
- get;
- }
-
- /// <summary>
- /// Special comment tags are tags like TODO, HACK or UNDONE which are read by the lexer and stored in <see cref="TagComments"/>.
- /// </summary>
- string[] SpecialCommentTags {
- get;
- set;
- }
-
- /// <summary>
- /// Gets/Sets if the lexer should skip adding comments to the special tracker. Set this
- /// property to true to improve lexing performance.
- /// </summary>
- bool SkipAllComments {
- get;
- set;
- }
-
- /// <summary>
- /// Gets/Sets if the lexer should evaluate conditional compilation symbols.
- /// </summary>
- bool EvaluateConditionalCompilation { get; set; }
-
- /// <summary>
- /// The dictionary with the conditional compilation symbols.
- /// C# ignores the value (you can use null), it just cares whether a symbol is defined.
- /// </summary>
- IDictionary<string, object> ConditionalCompilationSymbols { get; }
-
- /// <summary>
- /// Sets the conditional compilation symbols.
- /// </summary>
- /// <param name="symbols">
- /// A <see cref="System.String"/> containing the symbols. The symbols are separated by ';'.
- /// </param>
- void SetConditionalCompilationSymbols (string symbols);
-
- /// <summary>
- /// Returns the comments that had been read and containing tag key words.
- /// </summary>
- List<TagComment> TagComments {
- get;
- }
-
- SpecialTracker SpecialTracker {
- get;
- }
-
- void StartPeek();
-
- /// <summary>
- /// Gives back the next token. A second call to Peek() gives the next token after the last call for Peek() and so on.
- /// </summary>
- /// <returns>An <see cref="Token"/> object.</returns>
- Token Peek();
-
- /// <summary>
- /// Reads the next token and gives it back.
- /// </summary>
- /// <returns>An <see cref="Token"/> object.</returns>
- Token NextToken();
-
- /// <summary>
- /// Skips to the end of the current code block.
- /// For this, the lexer must have read the next token AFTER the token opening the
- /// block (so that Lexer.Token is the block-opening token, not Lexer.LookAhead).
- /// After the call, Lexer.LookAhead will be the block-closing token.
- /// </summary>
- void SkipCurrentBlock(int targetToken);
- }
-}
diff --git a/main/contrib/NRefactory/Project/Src/Lexer/LookupTable.cs b/main/contrib/NRefactory/Project/Src/Lexer/LookupTable.cs
deleted file mode 100644
index 23185776ec..0000000000
--- a/main/contrib/NRefactory/Project/Src/Lexer/LookupTable.cs
+++ /dev/null
@@ -1,120 +0,0 @@
-// <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.OldNRefactory.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
deleted file mode 100644
index 241ada50a8..0000000000
--- a/main/contrib/NRefactory/Project/Src/Lexer/Special/BlankLine.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-// <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.OldNRefactory
-{
- 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
deleted file mode 100644
index daa4324424..0000000000
--- a/main/contrib/NRefactory/Project/Src/Lexer/Special/Comment.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-// <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.OldNRefactory
-{
- 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
deleted file mode 100644
index 935f4d4026..0000000000
--- a/main/contrib/NRefactory/Project/Src/Lexer/Special/CommentType.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-// <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.OldNRefactory
-{
- 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
deleted file mode 100644
index a0bdf7c423..0000000000
--- a/main/contrib/NRefactory/Project/Src/Lexer/Special/ISpecial.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-// <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.OldNRefactory
-{
- /// <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
deleted file mode 100644
index 3eec7218f6..0000000000
--- a/main/contrib/NRefactory/Project/Src/Lexer/Special/PreProcessingDirective.cs
+++ /dev/null
@@ -1,160 +0,0 @@
-// <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.OldNRefactory
-{
- 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
deleted file mode 100644
index 5d8ac514d1..0000000000
--- a/main/contrib/NRefactory/Project/Src/Lexer/Special/SpecialTracker.cs
+++ /dev/null
@@ -1,80 +0,0 @@
-// <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.OldNRefactory.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
deleted file mode 100644
index 086946eb9c..0000000000
--- a/main/contrib/NRefactory/Project/Src/Lexer/Special/TagComment.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-// <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.OldNRefactory.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
deleted file mode 100644
index e0a46cdb6c..0000000000
--- a/main/contrib/NRefactory/Project/Src/Lexer/Token.cs
+++ /dev/null
@@ -1,107 +0,0 @@
-// <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.OldNRefactory.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={2} EndLocation={3} val={4}]",
- CSharp.Tokens.GetTokenString(kind),
- VB.Tokens.GetTokenString(kind),
- Location,
- EndLocation,
- val);
-
- }
- }
-}
diff --git a/main/contrib/NRefactory/Project/Src/Lexer/VBNet/KeywordList.txt b/main/contrib/NRefactory/Project/Src/Lexer/VBNet/KeywordList.txt
deleted file mode 100644
index c74f510723..0000000000
--- a/main/contrib/NRefactory/Project/Src/Lexer/VBNet/KeywordList.txt
+++ /dev/null
@@ -1,254 +0,0 @@
-# this list is used for autogeneration of:
-# - Keywords.cs
-# - Tokens.cs
-# - ATGTokensSection.txt - the TOKENS section of the ATG file
-
-# use BuildKeywords to generate the different lists.
-
-$Namespace=ICSharpCode.NRefactory.Parser.VB
-$UpperCaseKeywords=True
-
-# TERMINAL_CLASSES
-EOF
-EOL
-Identifier
-LiteralString
-LiteralCharacter
-LiteralInteger
-LiteralDouble
-LiteralSingle
-LiteralDecimal
-LiteralDate
-
-# SPECIAL_CHARACTERS
-Assign = "="
-Colon =":"
-Comma = ","
-ConcatString = "&"
-Div ="/"
-DivInteger = "\\"
-Dot = "."
-# Exclamation mark = Dictionary access operator (not always a token, sometimes it's a type character)
-ExclamationMark = "!"
-Minus = "-"
-Plus = "+"
-Power = "^"
-QuestionMark = "?"
-Times = "*"
-
-OpenCurlyBrace = "{"
-CloseCurlyBrace = "}"
-
-OpenParenthesis = "("
-CloseParenthesis = ")"
-
-GreaterThan = ">"
-LessThan = "<"
-
-NotEqual = "<>"
-GreaterEqual = ">="
-LessEqual = "<="
-
-ShiftLeft = "<<"
-ShiftRight = ">>"
-
-PlusAssign = "+="
-PowerAssign = "^="
-MinusAssign = "-="
-TimesAssign = "*="
-DivAssign = "/="
-DivIntegerAssign = "\\="
-ShiftLeftAssign = "<<="
-ShiftRightAssign = ">>="
-ConcatStringAssign = "&="
-
-# keywords according to the spec:
-# Keywordlist
-"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"
-# Note: IsTrue and IsFalse are 'NOT' keywords they're only valid in Operator declarations (like get/set/value are no C# 'keywords')
-"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"
-# has to be in the keyword list for the output formatter
-"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"
-
-#Sets
-Null("Nothing")
-BlockSucc("Case", "Catch", "Else", "ElseIf", "End", "Finally", "Loop", "Next")
-
-# List of keywords that are valid identifiers, must be the same as the "Identifier" production in VBNET.ATG
-IdentifierTokens("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")
diff --git a/main/contrib/NRefactory/Project/Src/Lexer/VBNet/Keywords.cs b/main/contrib/NRefactory/Project/Src/Lexer/VBNet/Keywords.cs
deleted file mode 100644
index 843007180a..0000000000
--- a/main/contrib/NRefactory/Project/Src/Lexer/VBNet/Keywords.cs
+++ /dev/null
@@ -1,212 +0,0 @@
-// this file was autogenerated by a tool.
-using System;
-
-namespace ICSharpCode.OldNRefactory.Parser.VB
-{
- public static class Keywords
- {
- static readonly string[] keywordList = {
- "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"
- };
-
- static LookupTable keywords = new LookupTable(false);
-
- static Keywords()
- {
- for (int i = 0; i < keywordList.Length; ++i) {
- keywords[keywordList[i]] = i + Tokens.AddHandler;
- }
- }
-
- public static int GetToken(string keyword)
- {
- return keywords[keyword];
- }
-
- public static bool IsNonIdentifierKeyword(string word)
- {
- int token = GetToken(word);
- if (token < 0)
- return false;
- return !Tokens.IdentifierTokens[token];
- }
- }
-}
diff --git a/main/contrib/NRefactory/Project/Src/Lexer/VBNet/Lexer.cs b/main/contrib/NRefactory/Project/Src/Lexer/VBNet/Lexer.cs
deleted file mode 100644
index 5c32542b33..0000000000
--- a/main/contrib/NRefactory/Project/Src/Lexer/VBNet/Lexer.cs
+++ /dev/null
@@ -1,761 +0,0 @@
-// <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.OldNRefactory.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
deleted file mode 100644
index e7dce461c5..0000000000
--- a/main/contrib/NRefactory/Project/Src/Lexer/VBNet/Tokens.cs
+++ /dev/null
@@ -1,485 +0,0 @@
-// this file was autogenerated by a tool.
-using System;
-using System.Collections;
-
-namespace ICSharpCode.OldNRefactory.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
deleted file mode 100644
index 252ef08f62..0000000000
--- a/main/contrib/NRefactory/Project/Src/Location.cs
+++ /dev/null
@@ -1,125 +0,0 @@
-// <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.OldNRefactory
-{
- /// <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
deleted file mode 100644
index f324de1df4..0000000000
--- a/main/contrib/NRefactory/Project/Src/OperatorPrecedence.cs
+++ /dev/null
@@ -1,88 +0,0 @@
-// <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.OldNRefactory.Ast;
-
-namespace ICSharpCode.OldNRefactory
-{
- /// <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
deleted file mode 100644
index 76f3de03a6..0000000000
--- a/main/contrib/NRefactory/Project/Src/Parser/AbstractParser.cs
+++ /dev/null
@@ -1,110 +0,0 @@
-// <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.OldNRefactory.Ast;
-
-namespace ICSharpCode.OldNRefactory.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
deleted file mode 100644
index 13cacea585..0000000000
--- a/main/contrib/NRefactory/Project/Src/Parser/CSharp/CSharpParser.cs
+++ /dev/null
@@ -1,690 +0,0 @@
-// <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 ICSharpCode.OldNRefactory.Visitors;
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Text;
-using ICSharpCode.OldNRefactory.Ast;
-
-namespace ICSharpCode.OldNRefactory.Parser.CSharp
-{
- internal sealed partial class Parser : AbstractParser
- {
- Lexer lexer;
-
- public Parser(ILexer lexer) : base(lexer)
- {
- this.lexer = (Lexer)lexer;
- // due to anonymous methods, we always need a compilation unit, so
- // create it in the constructor
- compilationUnit = new CompilationUnit();
- }
-
- StringBuilder qualidentBuilder = new StringBuilder();
-
- Token t {
- [System.Diagnostics.DebuggerStepThrough]
- get {
- return lexer.Token;
- }
- }
-
- Token la {
- [System.Diagnostics.DebuggerStepThrough]
- get {
- return lexer.LookAhead;
- }
- }
-
- 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 ()
- {
- lexer.NextToken();
- TypeReference type;
- Type(out type);
- return type;
- }
-
- public override Expression ParseExpression()
- {
- lexer.NextToken();
- Location startLocation = la.Location;
- Expression expr;
- Expr(out expr);
- // SEMICOLON HACK : without a trailing semicolon, parsing expressions does not work correctly
- if (la.kind == Tokens.Semicolon) 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();
-
- BlockStatement blockStmt = new BlockStatement();
- blockStmt.StartLocation = la.Location;
- compilationUnit.BlockStart(blockStmt);
-
- while (la.kind != Tokens.EOF) {
- Token oldLa = la;
- Statement();
- if (la == oldLa) {
- // did not advance lexer position, we cannot parse this as a statement block
- return null;
- }
- }
-
- compilationUnit.BlockEnd();
- blockStmt.EndLocation = t.EndLocation;
- Expect(Tokens.EOF);
- blockStmt.AcceptVisitor(new SetParentVisitor(), null);
- return blockStmt;
- }
-
- public override List<INode> ParseTypeMembers()
- {
- lexer.NextToken();
- compilationUnit = new CompilationUnit();
-
- TypeDeclaration newType = new TypeDeclaration(Modifiers.None, null);
- compilationUnit.BlockStart(newType);
- ClassBody();
- compilationUnit.BlockEnd();
- Expect(Tokens.EOF);
- newType.AcceptVisitor(new SetParentVisitor(), null);
- return newType.Children;
- }
-
- // Begin ISTypeCast
- bool IsTypeCast()
- {
- if (la.kind != Tokens.OpenParenthesis) {
- return false;
- }
- bool isPossibleExpression = true;
-
- lexer.StartPeek();
- Token pt = lexer.Peek();
-
- if (!IsTypeNameOrKWForTypeCast(ref pt, ref isPossibleExpression)) {
- return false;
- }
-
- // ")"
- if (pt.kind != Tokens.CloseParenthesis) {
- return false;
- }
- if (isPossibleExpression) {
- // check successor
- pt = lexer.Peek();
- return Tokens.CastFollower[pt.kind];
- } else {
- // not possibly an expression: don't check cast follower
- return true;
- }
- }
-
- /* !!! Proceeds from current peek position !!! */
- bool IsTypeKWForTypeCast(ref Token pt)
- {
- if (Tokens.TypeKW[pt.kind]) {
- pt = lexer.Peek();
- return IsPointerOrDims(ref pt) && SkipQuestionMark(ref pt);
- } else if (pt.kind == Tokens.Void) {
- pt = lexer.Peek();
- return IsPointerOrDims(ref pt);
- }
- return false;
- }
-
- /* !!! Proceeds from current peek position !!! */
- bool IsTypeNameOrKWForTypeCast(ref Token pt, ref bool isPossibleExpression)
- {
- if (Tokens.TypeKW[pt.kind] || pt.kind == Tokens.Void) {
- isPossibleExpression = false;
- return IsTypeKWForTypeCast(ref pt);
- } else {
- return IsTypeNameForTypeCast(ref pt, ref isPossibleExpression);
- }
- }
-
- bool IsTypeNameOrKWForTypeCast(ref Token pt)
- {
- bool tmp = false;
- return IsTypeNameOrKWForTypeCast(ref pt, ref tmp);
- }
-
- // TypeName = ident [ "::" ident ] { ["<" TypeNameOrKW { "," TypeNameOrKW } ">" ] "." ident } ["?"] PointerOrDims
- /* !!! Proceeds from current peek position !!! */
- bool IsTypeNameForTypeCast(ref Token pt, ref bool isPossibleExpression)
- {
- // ident
- if (!IsIdentifierToken(pt)) {
- return false;
- }
- pt = Peek();
- // "::" ident
- if (pt.kind == Tokens.DoubleColon) {
- pt = Peek();
- if (!IsIdentifierToken(pt)) {
- return false;
- }
- pt = Peek();
- }
- // { ["<" TypeNameOrKW { "," TypeNameOrKW } ">" ] "." ident }
- while (true) {
- if (pt.kind == Tokens.LessThan) {
- do {
- pt = Peek();
- if (!IsTypeNameOrKWForTypeCast(ref pt)) {
- return false;
- }
- } while (pt.kind == Tokens.Comma);
- if (pt.kind != Tokens.GreaterThan) {
- return false;
- }
- pt = Peek();
- }
- if (pt.kind != Tokens.Dot)
- break;
- pt = Peek();
- if (pt.kind != Tokens.Identifier) {
- return false;
- }
- pt = Peek();
- }
- // ["?"]
- if (pt.kind == Tokens.Question) {
- pt = Peek();
- }
- if (pt.kind == Tokens.Times || pt.kind == Tokens.OpenSquareBracket) {
- isPossibleExpression = false;
- return IsPointerOrDims(ref pt);
- }
- return true;
- }
- // END IsTypeCast
-
- // Gets if the token is a possible token for an expression start
- // Is used to determine if "a is Type ? token" a the start of a ternary
- // expression or a type test for Nullable<Type>
- bool IsPossibleExpressionStart(int token)
- {
- return Tokens.CastFollower[token] || Tokens.UnaryOp[token];
- }
-
- // ( { [TypeNameOrKWForTypeCast] ident "," } )
- bool IsLambdaExpression()
- {
- if (la.kind != Tokens.OpenParenthesis) {
- return false;
- }
- StartPeek();
- Token pt = Peek();
- while (pt.kind != Tokens.CloseParenthesis) {
- if (pt.kind == Tokens.Out || pt.kind == Tokens.Ref) {
- pt = Peek();
- }
- if (!IsTypeNameOrKWForTypeCast(ref pt)) {
- return false;
- }
- if (IsIdentifierToken(pt)) {
- // make ident optional: if implicitly typed lambda arguments are used, IsTypeNameForTypeCast
- // has already accepted the identifier
- pt = Peek();
- }
- if (pt.kind == Tokens.CloseParenthesis) {
- break;
- }
- // require comma between parameters:
- if (pt.kind == Tokens.Comma) {
- pt = Peek();
- } else {
- return false;
- }
- }
- pt = Peek();
- return pt.kind == Tokens.LambdaArrow;
- }
-
- /* Checks whether the next sequences of tokens is a qualident *
- * and returns the qualident string */
- /* !!! Proceeds from current peek position !!! */
- bool IsQualident(ref Token pt, out string qualident)
- {
- if (IsIdentifierToken(pt)) {
- qualidentBuilder.Length = 0; qualidentBuilder.Append(pt.val);
- pt = Peek();
- while (pt.kind == Tokens.Dot || pt.kind == Tokens.DoubleColon) {
- pt = Peek();
- if (!IsIdentifierToken(pt)) {
- qualident = String.Empty;
- return false;
- }
- qualidentBuilder.Append('.');
- qualidentBuilder.Append(pt.val);
- pt = Peek();
- }
- qualident = qualidentBuilder.ToString();
- return true;
- }
- qualident = String.Empty;
- return false;
- }
-
- /* Skips generic type extensions */
- /* !!! Proceeds from current peek position !!! */
-
- /* skip: { "*" | "[" { "," } "]" } */
- /* !!! Proceeds from current peek position !!! */
- bool IsPointerOrDims (ref Token pt)
- {
- for (;;) {
- if (pt.kind == Tokens.OpenSquareBracket) {
- do pt = Peek();
- while (pt.kind == Tokens.Comma);
- if (pt.kind != Tokens.CloseSquareBracket) return false;
- } else if (pt.kind != Tokens.Times) break;
- pt = Peek();
- }
- return true;
- }
-
- /* Return the n-th token after the current lookahead token */
- void StartPeek()
- {
- lexer.StartPeek();
- }
-
- Token Peek()
- {
- return lexer.Peek();
- }
-
- Token Peek (int n)
- {
- lexer.StartPeek();
- Token x = la;
- while (n > 0) {
- x = lexer.Peek();
- n--;
- }
- return x;
- }
-
- /*-----------------------------------------------------------------*
- * Resolver routines to resolve LL(1) conflicts: * *
- * These resolution routine return a boolean value that indicates *
- * whether the alternative at hand shall be choosen or not. *
- * They are used in IF ( ... ) expressions. *
- *-----------------------------------------------------------------*/
-
- /* True, if ident is followed by "=" */
- bool IdentAndAsgn ()
- {
- return IsIdentifierToken(la) && Peek(1).kind == Tokens.Assign;
- }
-
- bool IdentAndDoubleColon ()
- {
- return IsIdentifierToken(la) && Peek(1).kind == Tokens.DoubleColon;
- }
-
- bool IsAssignment () { return IdentAndAsgn(); }
-
- /* True, if ident is followed by ",", "=", "[" or ";" */
- bool IsVarDecl () {
- int peek = Peek(1).kind;
- return IsIdentifierToken(la) &&
- (peek == Tokens.Comma || peek == Tokens.Assign || peek == Tokens.Semicolon || peek == Tokens.OpenSquareBracket);
- }
-
- /* 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 && peek != Tokens.CloseSquareBracket;
- }
-
- /* True, if "void" is followed by "*" */
- bool NotVoidPointer () {
- return la.kind == Tokens.Void && Peek(1).kind != Tokens.Times;
- }
-
- /* True, if "checked" or "unchecked" are followed by "{" */
- bool UnCheckedAndLBrace () {
- return la.kind == Tokens.Checked || la.kind == Tokens.Unchecked &&
- Peek(1).kind == Tokens.OpenCurlyBrace;
- }
-
- /* True, if "." is followed by an ident */
- bool DotAndIdent () {
- return la.kind == Tokens.Dot && IsIdentifierToken(Peek(1));
- }
-
- /* True, if ident is followed by ":" */
- bool IdentAndColon () {
- return IsIdentifierToken(la) && Peek(1).kind == Tokens.Colon;
- }
-
- bool IsLabel () { return IdentAndColon(); }
-
- /* True, if ident is followed by "(" */
- bool IdentAndLPar () {
- return IsIdentifierToken(la) && Peek(1).kind == Tokens.OpenParenthesis;
- }
-
- /* True, if "catch" is followed by "(" */
- bool CatchAndLPar () {
- return la.kind == Tokens.Catch && Peek(1).kind == Tokens.OpenParenthesis;
- }
- bool IsTypedCatch () { return CatchAndLPar(); }
-
- /* True, if "[" is followed by the ident "assembly" */
- bool IsGlobalAttrTarget () {
- Token pt = Peek(1);
- return la.kind == Tokens.OpenSquareBracket &&
- IsIdentifierToken(pt) && (pt.val == "assembly" || pt.val == "module");
- }
-
- /* True, if "[" is followed by "," or "]" */
- bool LBrackAndCommaOrRBrack () {
- int peek = Peek(1).kind;
- return la.kind == Tokens.OpenSquareBracket &&
- (peek == Tokens.Comma || peek == Tokens.CloseSquareBracket);
- }
-
- /* True, if "[" is followed by "," or "]" */
- /* or if the current token is "*" */
- bool TimesOrLBrackAndCommaOrRBrack () {
- return la.kind == Tokens.Times || LBrackAndCommaOrRBrack();
- }
- bool IsPointerOrDims () { return TimesOrLBrackAndCommaOrRBrack(); }
- bool IsPointer () { return la.kind == Tokens.Times; }
-
-
- bool SkipGeneric(ref Token pt)
- {
- if (pt.kind == Tokens.LessThan) {
- do {
- pt = Peek();
- if (!IsTypeNameOrKWForTypeCast(ref pt)) return false;
- } while (pt.kind == Tokens.Comma);
- if (pt.kind != Tokens.GreaterThan) return false;
- pt = Peek();
- }
- return true;
- }
- bool SkipQuestionMark(ref Token pt)
- {
- if (pt.kind == Tokens.Question) {
- pt = Peek();
- }
- return true;
- }
-
- /* True, if lookahead is a primitive type keyword, or */
- /* if it is a type declaration followed by an ident */
- bool IsLocalVarDecl ()
- {
- if (IsYieldStatement ()) {
- return false;
- }
-
- if ((Tokens.TypeKW[la.kind] && Peek (1).kind != Tokens.Dot) || la.kind == Tokens.Void) {
- return true;
- }
-
- StartPeek ();
- Token pt = la;
- bool result = IsTypeNameOrKWForTypeCast (ref pt) && IsIdentifierToken (pt);
- if (Peek (1).kind == Tokens.Question) {
- if (Peek (2).kind == Tokens.OpenSquareBracket) // array case: T?[,]
- return true;
- result &= Peek (2).kind == Tokens.Identifier;
- result &= Peek (3).kind == Tokens.Semicolon || Peek (3).kind == Tokens.Comma || Peek (3).kind == Tokens.Assign;
- }
- return result;
- }
-
- /* True if lookahead is a type argument list (<...>) followed by
- * one of "( ) ] } : ; , . ? == !=" */
- bool IsGenericInSimpleNameOrMemberAccess()
- {
- Token t = la;
- if (t.kind != Tokens.LessThan) return false;
- StartPeek();
- return SkipGeneric(ref t) && Tokens.GenericFollower[t.kind];
- }
-
- bool IsExplicitInterfaceImplementation()
- {
- StartPeek();
- Token pt = la;
- pt = Peek();
- if (pt.kind == Tokens.Dot || pt.kind == Tokens.DoubleColon)
- return true;
- if (pt.kind == Tokens.LessThan) {
- if (SkipGeneric(ref pt))
- return pt.kind == Tokens.Dot;
- }
- return false;
- }
-
- /* True, if lookahead ident is "yield" and than follows a break or return */
- bool IsYieldStatement () {
- return la.kind == Tokens.Yield && (Peek(1).kind == Tokens.Return || Peek(1).kind == Tokens.Break);
- }
-
- /* True, if lookahead is a local attribute target specifier, *
- * i.e. one of "event", "return", "field", "method", *
- * "module", "param", "property", or "type" */
- bool IsLocalAttrTarget () {
- int cur = la.kind;
- string val = la.val;
-
- return (cur == Tokens.Event || cur == Tokens.Return ||
- (Tokens.IdentifierTokens[cur] &&
- (val == "field" || val == "method" || val == "module" ||
- val == "param" || val == "property" || val == "type"))) &&
- Peek(1).kind == Tokens.Colon;
- }
-
- bool IsShiftRight()
- {
- Token next = Peek(1);
- // TODO : Add col test (seems not to work, lexer bug...) : && la.col == next.col - 1
- return (la.kind == Tokens.GreaterThan && next.kind == Tokens.GreaterThan);
- }
-
- bool IsGenericExpression(Expression expr)
- {
- if (expr is IdentifierExpression)
- return ((IdentifierExpression)expr).TypeArguments.Count > 0;
- else if (expr is MemberReferenceExpression)
- return ((MemberReferenceExpression)expr).TypeArguments.Count > 0;
- else
- return false;
- }
-
- bool ShouldConvertTargetExpressionToTypeReference(Expression targetExpr)
- {
- if (targetExpr is IdentifierExpression)
- return ((IdentifierExpression)targetExpr).TypeArguments.Count > 0;
- else if (targetExpr is MemberReferenceExpression)
- return ((MemberReferenceExpression)targetExpr).TypeArguments.Count > 0;
- else
- return false;
- }
-
- TypeReference GetTypeReferenceFromExpression(Expression expr)
- {
- if (expr is TypeReferenceExpression)
- return (expr as TypeReferenceExpression).TypeReference;
-
- IdentifierExpression ident = expr as IdentifierExpression;
- if (ident != null) {
- return new TypeReference(ident.Identifier, ident.TypeArguments);
- }
-
- MemberReferenceExpression member = expr as MemberReferenceExpression;
- if (member != null) {
- TypeReference targetType = GetTypeReferenceFromExpression(member.TargetObject);
- if (targetType != null) {
- if (targetType.GenericTypes.Count == 0 && targetType.IsArrayType == false) {
- TypeReference tr = new TypeReference(targetType.Type + "." + member.MemberName, member.TypeArguments);
- tr.IsGlobal = targetType.IsGlobal;
- return tr;
- } else {
- return new InnerClassTypeReference(targetType, member.MemberName, member.TypeArguments);
- }
- }
- }
- return null;
- }
-
- bool IsMostNegativeIntegerWithoutTypeSuffix()
- {
- Token token = la;
- if (token.kind == Tokens.Literal) {
- return token.val == "2147483648" || token.val == "9223372036854775808";
- } else {
- return false;
- }
- }
-
- bool LastExpressionIsUnaryMinus(System.Collections.ArrayList expressions)
- {
- if (expressions.Count == 0) return false;
- UnaryOperatorExpression uoe = expressions[expressions.Count - 1] as UnaryOperatorExpression;
- if (uoe != null) {
- return uoe.Op == UnaryOperatorType.Minus;
- } else {
- return false;
- }
- }
-
- bool StartOfQueryExpression()
- {
- if (la.kind == Tokens.From) {
- Token p = Peek(1);
- if (IsIdentifierToken(p) || Tokens.TypeKW[p.kind])
- return true;
- }
- return false;
- }
-
- static bool IsIdentifierToken(Token tk)
- {
- return Tokens.IdentifierTokens[tk.kind];
- }
-
- /// <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;
- }
- }
-
- internal static string GetReflectionNameForOperator(OverloadableOperatorType op)
- {
- switch (op) {
- case OverloadableOperatorType.None:
- return "op_unknown";
- 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("opeartor type:" + op);
- }
- }
- }
-}
diff --git a/main/contrib/NRefactory/Project/Src/Parser/CSharp/Parser.cs b/main/contrib/NRefactory/Project/Src/Parser/CSharp/Parser.cs
deleted file mode 100644
index b007bc7f1e..0000000000
--- a/main/contrib/NRefactory/Project/Src/Parser/CSharp/Parser.cs
+++ /dev/null
@@ -1,6201 +0,0 @@
-
-#line 1 "Frames/cs.ATG"
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.Specialized;
-using System.Text;
-using ICSharpCode.OldNRefactory.Parser;
-using ICSharpCode.OldNRefactory.Ast;
-using ASTAttribute = ICSharpCode.OldNRefactory.Ast.Attribute;
-using Types = ICSharpCode.OldNRefactory.Ast.ClassType;
-/*
- Parser.frame file for NRefactory.
- */
-using System;
-using System.Reflection;
-
-namespace ICSharpCode.OldNRefactory.Parser.CSharp {
-
-
-
-partial class Parser : AbstractParser
-{
- const int maxT = 145;
-
- const bool T = true;
- const bool x = false;
-
-
-#line 18 "Frames/cs.ATG"
-
-
-/*
-
-*/
-
- void CS() {
-
-#line 179 "Frames/cs.ATG"
- lexer.NextToken(); /* get the first token */
- while (la.kind == 71) {
- ExternAliasDirective();
- }
- while (la.kind == 121) {
- UsingDirective();
- }
- while (
-#line 183 "Frames/cs.ATG"
-IsGlobalAttrTarget()) {
- GlobalAttributeSection();
- }
- while (StartOf(1)) {
- NamespaceMemberDecl();
- }
- Expect(0);
- }
-
- void ExternAliasDirective() {
-
-#line 353 "Frames/cs.ATG"
- ExternAliasDirective ead = new ExternAliasDirective { StartLocation = la.Location };
- Expect(71);
- Identifier();
-
-#line 356 "Frames/cs.ATG"
- if (t.val != "alias") Error("Expected 'extern alias'.");
- Identifier();
-
-#line 357 "Frames/cs.ATG"
- ead.Name = t.val;
- Expect(11);
-
-#line 358 "Frames/cs.ATG"
- ead.EndLocation = t.EndLocation;
-
-#line 359 "Frames/cs.ATG"
- compilationUnit.AddChild(ead);
- }
-
- void UsingDirective() {
-
-#line 190 "Frames/cs.ATG"
- string qualident = null; TypeReference aliasedType = null;
-
- Expect(121);
-
-#line 193 "Frames/cs.ATG"
- Location startPos = t.Location;
- Qualident(
-#line 194 "Frames/cs.ATG"
-out qualident);
- if (la.kind == 3) {
- lexer.NextToken();
- NonArrayType(
-#line 195 "Frames/cs.ATG"
-out aliasedType);
- }
- Expect(11);
-
-#line 197 "Frames/cs.ATG"
- if (qualident != null && qualident.Length > 0) {
- INode node;
- if (aliasedType != null) {
- node = new UsingDeclaration(qualident, aliasedType);
- } else {
- node = new UsingDeclaration(qualident);
- }
- node.StartLocation = startPos;
- node.EndLocation = t.EndLocation;
- compilationUnit.AddChild(node);
- }
-
- }
-
- void GlobalAttributeSection() {
- Expect(18);
-
-#line 213 "Frames/cs.ATG"
- Location startPos = t.Location;
- Identifier();
-
-#line 214 "Frames/cs.ATG"
- if (t.val != "assembly" && t.val != "module") Error("global attribute target specifier (assembly or module) expected");
- string attributeTarget = t.val;
- List<ASTAttribute> attributes = new List<ASTAttribute>();
- ASTAttribute attribute;
-
- Expect(9);
- Attribute(
-#line 219 "Frames/cs.ATG"
-out attribute);
-
-#line 219 "Frames/cs.ATG"
- attributes.Add(attribute);
- while (
-#line 220 "Frames/cs.ATG"
-NotFinalComma()) {
- Expect(14);
- Attribute(
-#line 220 "Frames/cs.ATG"
-out attribute);
-
-#line 220 "Frames/cs.ATG"
- attributes.Add(attribute);
- }
- if (la.kind == 14) {
- lexer.NextToken();
- }
- Expect(19);
-
-#line 222 "Frames/cs.ATG"
- AttributeSection section = new AttributeSection {
- AttributeTarget = attributeTarget,
- Attributes = attributes,
- StartLocation = startPos,
- EndLocation = t.EndLocation
- };
- compilationUnit.AddChild(section);
-
- }
-
- void NamespaceMemberDecl() {
-
-#line 326 "Frames/cs.ATG"
- AttributeSection section;
- List<AttributeSection> attributes = new List<AttributeSection>();
- ModifierList m = new ModifierList();
- string qualident;
-
- if (la.kind == 88) {
- lexer.NextToken();
-
-#line 332 "Frames/cs.ATG"
- Location startPos = t.Location;
- Qualident(
-#line 333 "Frames/cs.ATG"
-out qualident);
-
-#line 333 "Frames/cs.ATG"
- INode node = new NamespaceDeclaration(qualident);
- node.StartLocation = startPos;
- compilationUnit.AddChild(node);
- compilationUnit.BlockStart(node);
-
- Expect(16);
- while (la.kind == 71) {
- ExternAliasDirective();
- }
- while (la.kind == 121) {
- UsingDirective();
- }
- while (StartOf(1)) {
- NamespaceMemberDecl();
- }
- Expect(17);
- if (la.kind == 11) {
- lexer.NextToken();
- }
-
-#line 343 "Frames/cs.ATG"
- node.EndLocation = t.EndLocation;
- compilationUnit.BlockEnd();
-
- } else if (StartOf(2)) {
- while (la.kind == 18) {
- AttributeSection(
-#line 347 "Frames/cs.ATG"
-out section);
-
-#line 347 "Frames/cs.ATG"
- attributes.Add(section);
- }
- while (StartOf(3)) {
- TypeModifier(
-#line 348 "Frames/cs.ATG"
-m);
- }
- TypeDecl(
-#line 349 "Frames/cs.ATG"
-m, attributes);
- } else SynErr(146);
- }
-
- void Qualident(
-#line 483 "Frames/cs.ATG"
-out string qualident) {
- Identifier();
-
-#line 485 "Frames/cs.ATG"
- qualidentBuilder.Length = 0; qualidentBuilder.Append(t.val);
- while (
-#line 486 "Frames/cs.ATG"
-DotAndIdent()) {
- Expect(15);
- Identifier();
-
-#line 486 "Frames/cs.ATG"
- qualidentBuilder.Append('.');
- qualidentBuilder.Append(t.val);
-
- }
-
-#line 489 "Frames/cs.ATG"
- qualident = qualidentBuilder.ToString();
- }
-
- void NonArrayType(
-#line 601 "Frames/cs.ATG"
-out TypeReference type) {
-
-#line 603 "Frames/cs.ATG"
- Location startPos = la.Location;
- string name;
- int pointer = 0;
- type = null;
-
- if (StartOf(4)) {
- ClassType(
-#line 609 "Frames/cs.ATG"
-out type, false);
- } else if (StartOf(5)) {
- SimpleType(
-#line 610 "Frames/cs.ATG"
-out name);
-
-#line 610 "Frames/cs.ATG"
- type = new TypeReference(name, true);
- } else if (la.kind == 123) {
- lexer.NextToken();
- Expect(6);
-
-#line 611 "Frames/cs.ATG"
- pointer = 1; type = new TypeReference("System.Void", true);
- } else SynErr(147);
- if (la.kind == 12) {
- NullableQuestionMark(
-#line 614 "Frames/cs.ATG"
-ref type);
- }
- while (
-#line 616 "Frames/cs.ATG"
-IsPointer()) {
- Expect(6);
-
-#line 617 "Frames/cs.ATG"
- ++pointer;
- }
-
-#line 619 "Frames/cs.ATG"
- if (type != null) {
- type.PointerNestingLevel = pointer;
- type.EndLocation = t.EndLocation;
- type.StartLocation = startPos;
- }
-
- }
-
- void Identifier() {
- switch (la.kind) {
- case 1: {
- lexer.NextToken();
- break;
- }
- case 126: {
- lexer.NextToken();
- break;
- }
- case 127: {
- lexer.NextToken();
- break;
- }
- case 128: {
- lexer.NextToken();
- break;
- }
- case 129: {
- lexer.NextToken();
- break;
- }
- case 130: {
- lexer.NextToken();
- break;
- }
- case 131: {
- lexer.NextToken();
- break;
- }
- case 132: {
- lexer.NextToken();
- break;
- }
- case 133: {
- lexer.NextToken();
- break;
- }
- case 134: {
- lexer.NextToken();
- break;
- }
- case 135: {
- lexer.NextToken();
- break;
- }
- case 136: {
- lexer.NextToken();
- break;
- }
- case 137: {
- lexer.NextToken();
- break;
- }
- case 138: {
- lexer.NextToken();
- break;
- }
- case 139: {
- lexer.NextToken();
- break;
- }
- case 140: {
- lexer.NextToken();
- break;
- }
- case 141: {
- lexer.NextToken();
- break;
- }
- case 142: {
- lexer.NextToken();
- break;
- }
- case 143: {
- lexer.NextToken();
- break;
- }
- case 144: {
- lexer.NextToken();
- break;
- }
- default: SynErr(148); break;
- }
- }
-
- void Attribute(
-#line 232 "Frames/cs.ATG"
-out ASTAttribute attribute) {
-
-#line 233 "Frames/cs.ATG"
- string qualident;
- string alias = null;
-
-
-#line 237 "Frames/cs.ATG"
- Location startPos = la.Location;
- if (
-#line 238 "Frames/cs.ATG"
-IdentAndDoubleColon()) {
- Identifier();
-
-#line 239 "Frames/cs.ATG"
- alias = t.val;
- Expect(10);
- }
- Qualident(
-#line 242 "Frames/cs.ATG"
-out qualident);
-
-#line 243 "Frames/cs.ATG"
- List<Expression> positional = null;
- List<NamedArgumentExpression> named = null;
- string name = (alias != null && alias != "global") ? alias + "." + qualident : qualident;
-
- if (la.kind == 20) {
- AttributeArguments(
-#line 247 "Frames/cs.ATG"
-out positional, out named);
- }
-
-#line 248 "Frames/cs.ATG"
- attribute = new ASTAttribute(name, positional, named);
- attribute.StartLocation = startPos;
- attribute.EndLocation = t.EndLocation;
-
- }
-
- void AttributeArguments(
-#line 254 "Frames/cs.ATG"
-out List<Expression> positional, out List<NamedArgumentExpression> named) {
-
-#line 256 "Frames/cs.ATG"
- bool nameFound = false;
- string name = "";
- Expression expr;
- positional = new List<Expression>();
- named = new List<NamedArgumentExpression> ();
-
- Expect(20);
- if (StartOf(6)) {
- if (
-#line 266 "Frames/cs.ATG"
-IsAssignment()) {
-
-#line 266 "Frames/cs.ATG"
- nameFound = true;
- Identifier();
-
-#line 267 "Frames/cs.ATG"
- name = t.val;
- Expect(3);
- }
- Expr(
-#line 269 "Frames/cs.ATG"
-out expr);
-
-#line 269 "Frames/cs.ATG"
- if (expr != null) {
- if(name == "") positional.Add(expr);
- else { named.Add(new NamedArgumentExpression(name, expr)); name = ""; }
- }
-
- while (la.kind == 14) {
- lexer.NextToken();
- if (
-#line 278 "Frames/cs.ATG"
-IsAssignment()) {
-
-#line 278 "Frames/cs.ATG"
- nameFound = true;
- Identifier();
-
-#line 279 "Frames/cs.ATG"
- name = t.val;
- Expect(3);
- } else if (StartOf(6)) {
-
-#line 281 "Frames/cs.ATG"
- if (nameFound) Error("no positional argument after named argument");
- } else SynErr(149);
- Expr(
-#line 282 "Frames/cs.ATG"
-out expr);
-
-#line 282 "Frames/cs.ATG"
- if (expr != null) { if(name == "") positional.Add(expr);
- else { named.Add(new NamedArgumentExpression(name, expr)); name = ""; }
- }
-
- }
- }
- Expect(21);
- }
-
- void Expr(
-#line 1804 "Frames/cs.ATG"
-out Expression expr) {
-
-#line 1805 "Frames/cs.ATG"
- expr = null; Expression expr1 = null, expr2 = null; AssignmentOperatorType op;
-
-#line 1807 "Frames/cs.ATG"
- Location startLocation = la.Location;
- UnaryExpr(
-#line 1808 "Frames/cs.ATG"
-out expr);
- if (StartOf(7)) {
- AssignmentOperator(
-#line 1811 "Frames/cs.ATG"
-out op);
- Expr(
-#line 1811 "Frames/cs.ATG"
-out expr1);
-
-#line 1811 "Frames/cs.ATG"
- expr = new AssignmentExpression(expr, op, expr1);
- } else if (
-#line 1812 "Frames/cs.ATG"
-la.kind == Tokens.GreaterThan && Peek(1).kind == Tokens.GreaterEqual) {
- AssignmentOperator(
-#line 1813 "Frames/cs.ATG"
-out op);
- Expr(
-#line 1813 "Frames/cs.ATG"
-out expr1);
-
-#line 1813 "Frames/cs.ATG"
- expr = new AssignmentExpression(expr, op, expr1);
- } else if (StartOf(8)) {
- ConditionalOrExpr(
-#line 1815 "Frames/cs.ATG"
-ref expr);
- if (la.kind == 13) {
- lexer.NextToken();
- Expr(
-#line 1816 "Frames/cs.ATG"
-out expr1);
-
-#line 1816 "Frames/cs.ATG"
- expr = new BinaryOperatorExpression(expr, BinaryOperatorType.NullCoalescing, expr1);
- }
- if (la.kind == 12) {
- lexer.NextToken();
- Expr(
-#line 1817 "Frames/cs.ATG"
-out expr1);
- Expect(9);
- Expr(
-#line 1817 "Frames/cs.ATG"
-out expr2);
-
-#line 1817 "Frames/cs.ATG"
- expr = new ConditionalExpression(expr, expr1, expr2);
- }
- } else SynErr(150);
-
-#line 1820 "Frames/cs.ATG"
- if (expr != null) {
- expr.StartLocation = startLocation;
- expr.EndLocation = t.EndLocation;
- }
-
- }
-
- void AttributeSection(
-#line 291 "Frames/cs.ATG"
-out AttributeSection section) {
-
-#line 293 "Frames/cs.ATG"
- string attributeTarget = "";
- List<ASTAttribute> attributes = new List<ASTAttribute>();
- ASTAttribute attribute;
-
-
- Expect(18);
-
-#line 299 "Frames/cs.ATG"
- Location startPos = t.Location;
- if (
-#line 300 "Frames/cs.ATG"
-IsLocalAttrTarget()) {
- if (la.kind == 69) {
- lexer.NextToken();
-
-#line 301 "Frames/cs.ATG"
- attributeTarget = "event";
- } else if (la.kind == 101) {
- lexer.NextToken();
-
-#line 302 "Frames/cs.ATG"
- attributeTarget = "return";
- } else {
- Identifier();
-
-#line 303 "Frames/cs.ATG"
- if (t.val != "field" && t.val != "method" &&
- t.val != "param" &&
- t.val != "property" && t.val != "type")
- Error("attribute target specifier (field, event, method, param, property, return or type) expected");
- attributeTarget = t.val;
-
- }
- Expect(9);
- }
- Attribute(
-#line 312 "Frames/cs.ATG"
-out attribute);
-
-#line 312 "Frames/cs.ATG"
- attributes.Add(attribute);
- while (
-#line 313 "Frames/cs.ATG"
-NotFinalComma()) {
- Expect(14);
- Attribute(
-#line 313 "Frames/cs.ATG"
-out attribute);
-
-#line 313 "Frames/cs.ATG"
- attributes.Add(attribute);
- }
- if (la.kind == 14) {
- lexer.NextToken();
- }
- Expect(19);
-
-#line 315 "Frames/cs.ATG"
- section = new AttributeSection {
- AttributeTarget = attributeTarget,
- Attributes = attributes,
- StartLocation = startPos,
- EndLocation = t.EndLocation
- };
-
- }
-
- void TypeModifier(
-#line 696 "Frames/cs.ATG"
-ModifierList m) {
- switch (la.kind) {
- case 89: {
- lexer.NextToken();
-
-#line 698 "Frames/cs.ATG"
- m.Add(Modifiers.New, t.Location);
- break;
- }
- case 98: {
- lexer.NextToken();
-
-#line 699 "Frames/cs.ATG"
- m.Add(Modifiers.Public, t.Location);
- break;
- }
- case 97: {
- lexer.NextToken();
-
-#line 700 "Frames/cs.ATG"
- m.Add(Modifiers.Protected, t.Location);
- break;
- }
- case 84: {
- lexer.NextToken();
-
-#line 701 "Frames/cs.ATG"
- m.Add(Modifiers.Internal, t.Location);
- break;
- }
- case 96: {
- lexer.NextToken();
-
-#line 702 "Frames/cs.ATG"
- m.Add(Modifiers.Private, t.Location);
- break;
- }
- case 119: {
- lexer.NextToken();
-
-#line 703 "Frames/cs.ATG"
- m.Add(Modifiers.Unsafe, t.Location);
- break;
- }
- case 49: {
- lexer.NextToken();
-
-#line 704 "Frames/cs.ATG"
- m.Add(Modifiers.Abstract, t.Location);
- break;
- }
- case 103: {
- lexer.NextToken();
-
-#line 705 "Frames/cs.ATG"
- m.Add(Modifiers.Sealed, t.Location);
- break;
- }
- case 107: {
- lexer.NextToken();
-
-#line 706 "Frames/cs.ATG"
- m.Add(Modifiers.Static, t.Location);
- break;
- }
- case 126: {
- lexer.NextToken();
-
-#line 707 "Frames/cs.ATG"
- m.Add(Modifiers.Partial, t.Location);
- break;
- }
- default: SynErr(151); break;
- }
- }
-
- void TypeDecl(
-#line 362 "Frames/cs.ATG"
-ModifierList m, List<AttributeSection> attributes) {
-
-#line 364 "Frames/cs.ATG"
- TypeReference type;
- List<TypeReference> names;
- List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
- string name;
- List<TemplateDefinition> templates;
-
- if (la.kind == 59) {
-
-#line 370 "Frames/cs.ATG"
- m.Check(Modifiers.Classes);
- lexer.NextToken();
-
-#line 371 "Frames/cs.ATG"
- TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
- templates = newType.Templates;
- compilationUnit.AddChild(newType);
- compilationUnit.BlockStart(newType);
- newType.StartLocation = m.GetDeclarationLocation(t.Location);
-
- newType.Type = Types.Class;
-
- Identifier();
-
-#line 379 "Frames/cs.ATG"
- newType.Name = t.val;
- if (la.kind == 23) {
- TypeParameterList(
-#line 382 "Frames/cs.ATG"
-templates);
- }
- if (la.kind == 9) {
- ClassBase(
-#line 384 "Frames/cs.ATG"
-out names);
-
-#line 384 "Frames/cs.ATG"
- newType.BaseTypes = names;
- }
- while (la.kind == 127) {
- TypeParameterConstraintsClause(
-#line 387 "Frames/cs.ATG"
-templates);
- }
-
-#line 389 "Frames/cs.ATG"
- newType.BodyStartLocation = t.EndLocation;
- Expect(16);
- ClassBody();
- Expect(17);
- if (la.kind == 11) {
- lexer.NextToken();
- }
-
-#line 393 "Frames/cs.ATG"
- newType.EndLocation = t.EndLocation;
- compilationUnit.BlockEnd();
-
- } else if (StartOf(9)) {
-
-#line 396 "Frames/cs.ATG"
- m.Check(Modifiers.StructsInterfacesEnumsDelegates);
- if (la.kind == 109) {
- lexer.NextToken();
-
-#line 397 "Frames/cs.ATG"
- TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
- templates = newType.Templates;
- newType.StartLocation = m.GetDeclarationLocation(t.Location);
- compilationUnit.AddChild(newType);
- compilationUnit.BlockStart(newType);
- newType.Type = Types.Struct;
-
- Identifier();
-
-#line 404 "Frames/cs.ATG"
- newType.Name = t.val;
- if (la.kind == 23) {
- TypeParameterList(
-#line 407 "Frames/cs.ATG"
-templates);
- }
- if (la.kind == 9) {
- StructInterfaces(
-#line 409 "Frames/cs.ATG"
-out names);
-
-#line 409 "Frames/cs.ATG"
- newType.BaseTypes = names;
- }
- while (la.kind == 127) {
- TypeParameterConstraintsClause(
-#line 412 "Frames/cs.ATG"
-templates);
- }
-
-#line 415 "Frames/cs.ATG"
- newType.BodyStartLocation = t.EndLocation;
- StructBody();
- if (la.kind == 11) {
- lexer.NextToken();
- }
-
-#line 417 "Frames/cs.ATG"
- newType.EndLocation = t.EndLocation;
- compilationUnit.BlockEnd();
-
- } else if (la.kind == 83) {
- lexer.NextToken();
-
-#line 421 "Frames/cs.ATG"
- TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
- templates = newType.Templates;
- compilationUnit.AddChild(newType);
- compilationUnit.BlockStart(newType);
- newType.StartLocation = m.GetDeclarationLocation(t.Location);
- newType.Type = Types.Interface;
-
- Identifier();
-
-#line 428 "Frames/cs.ATG"
- newType.Name = t.val;
- if (la.kind == 23) {
- TypeParameterList(
-#line 431 "Frames/cs.ATG"
-templates);
- }
- if (la.kind == 9) {
- InterfaceBase(
-#line 433 "Frames/cs.ATG"
-out names);
-
-#line 433 "Frames/cs.ATG"
- newType.BaseTypes = names;
- }
- while (la.kind == 127) {
- TypeParameterConstraintsClause(
-#line 436 "Frames/cs.ATG"
-templates);
- }
-
-#line 438 "Frames/cs.ATG"
- newType.BodyStartLocation = t.EndLocation;
- InterfaceBody();
- if (la.kind == 11) {
- lexer.NextToken();
- }
-
-#line 440 "Frames/cs.ATG"
- newType.EndLocation = t.EndLocation;
- compilationUnit.BlockEnd();
-
- } else if (la.kind == 68) {
- lexer.NextToken();
-
-#line 444 "Frames/cs.ATG"
- TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
- compilationUnit.AddChild(newType);
- compilationUnit.BlockStart(newType);
- newType.StartLocation = m.GetDeclarationLocation(t.Location);
- newType.Type = Types.Enum;
-
- Identifier();
-
-#line 450 "Frames/cs.ATG"
- newType.Name = t.val;
- if (la.kind == 9) {
- lexer.NextToken();
- IntegralType(
-#line 451 "Frames/cs.ATG"
-out name);
-
-#line 451 "Frames/cs.ATG"
- newType.BaseTypes.Add(new TypeReference(name, true));
- }
-
-#line 453 "Frames/cs.ATG"
- newType.BodyStartLocation = t.EndLocation;
- EnumBody();
- if (la.kind == 11) {
- lexer.NextToken();
- }
-
-#line 455 "Frames/cs.ATG"
- newType.EndLocation = t.EndLocation;
- compilationUnit.BlockEnd();
-
- } else {
- lexer.NextToken();
-
-#line 459 "Frames/cs.ATG"
- DelegateDeclaration delegateDeclr = new DelegateDeclaration(m.Modifier, attributes);
- templates = delegateDeclr.Templates;
- delegateDeclr.StartLocation = m.GetDeclarationLocation(t.Location);
-
- if (
-#line 463 "Frames/cs.ATG"
-NotVoidPointer()) {
- Expect(123);
-
-#line 463 "Frames/cs.ATG"
- delegateDeclr.ReturnType = new TypeReference("System.Void", true);
- } else if (StartOf(10)) {
- Type(
-#line 464 "Frames/cs.ATG"
-out type);
-
-#line 464 "Frames/cs.ATG"
- delegateDeclr.ReturnType = type;
- } else SynErr(152);
- Identifier();
-
-#line 466 "Frames/cs.ATG"
- delegateDeclr.Name = t.val;
- if (la.kind == 23) {
- TypeParameterList(
-#line 469 "Frames/cs.ATG"
-templates);
- }
- Expect(20);
- if (StartOf(11)) {
- FormalParameterList(
-#line 471 "Frames/cs.ATG"
-p);
-
-#line 471 "Frames/cs.ATG"
- delegateDeclr.Parameters = p;
- }
- Expect(21);
- while (la.kind == 127) {
- TypeParameterConstraintsClause(
-#line 475 "Frames/cs.ATG"
-templates);
- }
- Expect(11);
-
-#line 477 "Frames/cs.ATG"
- delegateDeclr.EndLocation = t.EndLocation;
- compilationUnit.AddChild(delegateDeclr);
-
- }
- } else SynErr(153);
- }
-
- void TypeParameterList(
-#line 2381 "Frames/cs.ATG"
-List<TemplateDefinition> templates) {
-
-#line 2383 "Frames/cs.ATG"
- AttributeSection section;
- List<AttributeSection> attributes = new List<AttributeSection>();
-
- Expect(23);
- while (la.kind == 18) {
- AttributeSection(
-#line 2387 "Frames/cs.ATG"
-out section);
-
-#line 2387 "Frames/cs.ATG"
- attributes.Add(section);
- }
- Identifier();
-
-#line 2388 "Frames/cs.ATG"
- templates.Add(new TemplateDefinition(t.val, attributes));
- while (la.kind == 14) {
- lexer.NextToken();
- while (la.kind == 18) {
- AttributeSection(
-#line 2389 "Frames/cs.ATG"
-out section);
-
-#line 2389 "Frames/cs.ATG"
- attributes.Add(section);
- }
- Identifier();
-
-#line 2390 "Frames/cs.ATG"
- templates.Add(new TemplateDefinition(t.val, attributes));
- }
- Expect(22);
- }
-
- void ClassBase(
-#line 492 "Frames/cs.ATG"
-out List<TypeReference> names) {
-
-#line 494 "Frames/cs.ATG"
- TypeReference typeRef;
- names = new List<TypeReference>();
-
- Expect(9);
- ClassType(
-#line 498 "Frames/cs.ATG"
-out typeRef, false);
-
-#line 498 "Frames/cs.ATG"
- if (typeRef != null) { names.Add(typeRef); }
- while (la.kind == 14) {
- lexer.NextToken();
- TypeName(
-#line 499 "Frames/cs.ATG"
-out typeRef, false);
-
-#line 499 "Frames/cs.ATG"
- if (typeRef != null) { names.Add(typeRef); }
- }
- }
-
- void TypeParameterConstraintsClause(
-#line 2394 "Frames/cs.ATG"
-List<TemplateDefinition> templates) {
-
-#line 2395 "Frames/cs.ATG"
- string name = ""; TypeReference type;
- Expect(127);
- Identifier();
-
-#line 2398 "Frames/cs.ATG"
- name = t.val;
- Expect(9);
- TypeParameterConstraintsClauseBase(
-#line 2400 "Frames/cs.ATG"
-out type);
-
-#line 2401 "Frames/cs.ATG"
- TemplateDefinition td = null;
- foreach (TemplateDefinition d in templates) {
- if (d.Name == name) {
- td = d;
- break;
- }
- }
- if ( td != null && type != null) { td.Bases.Add(type); }
-
- while (la.kind == 14) {
- lexer.NextToken();
- TypeParameterConstraintsClauseBase(
-#line 2410 "Frames/cs.ATG"
-out type);
-
-#line 2411 "Frames/cs.ATG"
- td = null;
- foreach (TemplateDefinition d in templates) {
- if (d.Name == name) {
- td = d;
- break;
- }
- }
- if ( td != null && type != null) { td.Bases.Add(type); }
-
- }
- }
-
- void ClassBody() {
-
-#line 503 "Frames/cs.ATG"
- AttributeSection section;
- while (StartOf(12)) {
-
-#line 505 "Frames/cs.ATG"
- List<AttributeSection> attributes = new List<AttributeSection>();
- ModifierList m = new ModifierList();
-
- while (!(StartOf(13))) {SynErr(154); lexer.NextToken(); }
- while (la.kind == 18) {
- AttributeSection(
-#line 509 "Frames/cs.ATG"
-out section);
-
-#line 509 "Frames/cs.ATG"
- attributes.Add(section);
- }
- MemberModifiers(
-#line 510 "Frames/cs.ATG"
-m);
- ClassMemberDecl(
-#line 511 "Frames/cs.ATG"
-m, attributes);
- }
- }
-
- void StructInterfaces(
-#line 515 "Frames/cs.ATG"
-out List<TypeReference> names) {
-
-#line 517 "Frames/cs.ATG"
- TypeReference typeRef;
- names = new List<TypeReference>();
-
- Expect(9);
- TypeName(
-#line 521 "Frames/cs.ATG"
-out typeRef, false);
-
-#line 521 "Frames/cs.ATG"
- if (typeRef != null) { names.Add(typeRef); }
- while (la.kind == 14) {
- lexer.NextToken();
- TypeName(
-#line 522 "Frames/cs.ATG"
-out typeRef, false);
-
-#line 522 "Frames/cs.ATG"
- if (typeRef != null) { names.Add(typeRef); }
- }
- }
-
- void StructBody() {
-
-#line 526 "Frames/cs.ATG"
- AttributeSection section;
- Expect(16);
- while (StartOf(14)) {
-
-#line 529 "Frames/cs.ATG"
- List<AttributeSection> attributes = new List<AttributeSection>();
- ModifierList m = new ModifierList();
-
- while (la.kind == 18) {
- AttributeSection(
-#line 532 "Frames/cs.ATG"
-out section);
-
-#line 532 "Frames/cs.ATG"
- attributes.Add(section);
- }
- MemberModifiers(
-#line 533 "Frames/cs.ATG"
-m);
- StructMemberDecl(
-#line 534 "Frames/cs.ATG"
-m, attributes);
- }
- Expect(17);
- }
-
- void InterfaceBase(
-#line 539 "Frames/cs.ATG"
-out List<TypeReference> names) {
-
-#line 541 "Frames/cs.ATG"
- TypeReference typeRef;
- names = new List<TypeReference>();
-
- Expect(9);
- TypeName(
-#line 545 "Frames/cs.ATG"
-out typeRef, false);
-
-#line 545 "Frames/cs.ATG"
- if (typeRef != null) { names.Add(typeRef); }
- while (la.kind == 14) {
- lexer.NextToken();
- TypeName(
-#line 546 "Frames/cs.ATG"
-out typeRef, false);
-
-#line 546 "Frames/cs.ATG"
- if (typeRef != null) { names.Add(typeRef); }
- }
- }
-
- void InterfaceBody() {
- Expect(16);
- while (StartOf(15)) {
- while (!(StartOf(16))) {SynErr(155); lexer.NextToken(); }
- InterfaceMemberDecl();
- }
- Expect(17);
- }
-
- void IntegralType(
-#line 718 "Frames/cs.ATG"
-out string name) {
-
-#line 718 "Frames/cs.ATG"
- name = "";
- switch (la.kind) {
- case 102: {
- lexer.NextToken();
-
-#line 720 "Frames/cs.ATG"
- name = "System.SByte";
- break;
- }
- case 54: {
- lexer.NextToken();
-
-#line 721 "Frames/cs.ATG"
- name = "System.Byte";
- break;
- }
- case 104: {
- lexer.NextToken();
-
-#line 722 "Frames/cs.ATG"
- name = "System.Int16";
- break;
- }
- case 120: {
- lexer.NextToken();
-
-#line 723 "Frames/cs.ATG"
- name = "System.UInt16";
- break;
- }
- case 82: {
- lexer.NextToken();
-
-#line 724 "Frames/cs.ATG"
- name = "System.Int32";
- break;
- }
- case 116: {
- lexer.NextToken();
-
-#line 725 "Frames/cs.ATG"
- name = "System.UInt32";
- break;
- }
- case 87: {
- lexer.NextToken();
-
-#line 726 "Frames/cs.ATG"
- name = "System.Int64";
- break;
- }
- case 117: {
- lexer.NextToken();
-
-#line 727 "Frames/cs.ATG"
- name = "System.UInt64";
- break;
- }
- case 57: {
- lexer.NextToken();
-
-#line 728 "Frames/cs.ATG"
- name = "System.Char";
- break;
- }
- default: SynErr(156); break;
- }
- }
-
- void EnumBody() {
-
-#line 555 "Frames/cs.ATG"
- FieldDeclaration f;
- Expect(16);
- if (StartOf(17)) {
- EnumMemberDecl(
-#line 558 "Frames/cs.ATG"
-out f);
-
-#line 558 "Frames/cs.ATG"
- compilationUnit.AddChild(f);
- while (
-#line 559 "Frames/cs.ATG"
-NotFinalComma()) {
- Expect(14);
- EnumMemberDecl(
-#line 560 "Frames/cs.ATG"
-out f);
-
-#line 560 "Frames/cs.ATG"
- compilationUnit.AddChild(f);
- }
- if (la.kind == 14) {
- lexer.NextToken();
- }
- }
- Expect(17);
- }
-
- void Type(
-#line 566 "Frames/cs.ATG"
-out TypeReference type) {
- TypeWithRestriction(
-#line 568 "Frames/cs.ATG"
-out type, true, false);
- }
-
- void FormalParameterList(
-#line 638 "Frames/cs.ATG"
-List<ParameterDeclarationExpression> parameter) {
-
-#line 641 "Frames/cs.ATG"
- ParameterDeclarationExpression p;
- AttributeSection section;
- List<AttributeSection> attributes = new List<AttributeSection>();
-
- while (la.kind == 18) {
- AttributeSection(
-#line 646 "Frames/cs.ATG"
-out section);
-
-#line 646 "Frames/cs.ATG"
- attributes.Add(section);
- }
- if (StartOf(18)) {
- FixedParameter(
-#line 648 "Frames/cs.ATG"
-out p);
-
-#line 648 "Frames/cs.ATG"
- bool paramsFound = false;
- p.Attributes = attributes;
- parameter.Add(p);
-
- while (la.kind == 14) {
- lexer.NextToken();
-
-#line 653 "Frames/cs.ATG"
- attributes = new List<AttributeSection>(); if (paramsFound) Error("params array must be at end of parameter list");
- while (la.kind == 18) {
- AttributeSection(
-#line 654 "Frames/cs.ATG"
-out section);
-
-#line 654 "Frames/cs.ATG"
- attributes.Add(section);
- }
- if (StartOf(18)) {
- FixedParameter(
-#line 656 "Frames/cs.ATG"
-out p);
-
-#line 656 "Frames/cs.ATG"
- p.Attributes = attributes; parameter.Add(p);
- } else if (la.kind == 95) {
- ParameterArray(
-#line 657 "Frames/cs.ATG"
-out p);
-
-#line 657 "Frames/cs.ATG"
- paramsFound = true; p.Attributes = attributes; parameter.Add(p);
- } else SynErr(157);
- }
- } else if (la.kind == 95) {
- ParameterArray(
-#line 660 "Frames/cs.ATG"
-out p);
-
-#line 660 "Frames/cs.ATG"
- p.Attributes = attributes; parameter.Add(p);
- } else SynErr(158);
- }
-
- void ClassType(
-#line 710 "Frames/cs.ATG"
-out TypeReference typeRef, bool canBeUnbound) {
-
-#line 711 "Frames/cs.ATG"
- TypeReference r; typeRef = null;
- if (StartOf(19)) {
- TypeName(
-#line 713 "Frames/cs.ATG"
-out r, canBeUnbound);
-
-#line 713 "Frames/cs.ATG"
- typeRef = r;
- } else if (la.kind == 91) {
- lexer.NextToken();
-
-#line 714 "Frames/cs.ATG"
- typeRef = new TypeReference("System.Object", true); typeRef.StartLocation = t.Location;
- } else if (la.kind == 108) {
- lexer.NextToken();
-
-#line 715 "Frames/cs.ATG"
- typeRef = new TypeReference("System.String", true); typeRef.StartLocation = t.Location;
- } else SynErr(159);
- }
-
- void TypeName(
-#line 2322 "Frames/cs.ATG"
-out TypeReference typeRef, bool canBeUnbound) {
-
-#line 2323 "Frames/cs.ATG"
- List<TypeReference> typeArguments = null;
- string alias = null;
- string qualident;
- Location startLocation = la.Location;
-
- if (
-#line 2329 "Frames/cs.ATG"
-IdentAndDoubleColon()) {
- Identifier();
-
-#line 2330 "Frames/cs.ATG"
- alias = t.val;
- Expect(10);
- }
- Qualident(
-#line 2333 "Frames/cs.ATG"
-out qualident);
- if (la.kind == 23) {
- TypeArgumentList(
-#line 2334 "Frames/cs.ATG"
-out typeArguments, canBeUnbound);
- }
-
-#line 2336 "Frames/cs.ATG"
- if (alias == null) {
- typeRef = new TypeReference(qualident, typeArguments);
- } else if (alias == "global") {
- typeRef = new TypeReference(qualident, typeArguments);
- typeRef.IsGlobal = true;
- } else {
- typeRef = new TypeReference(alias + "." + qualident, typeArguments);
- }
-
- while (
-#line 2345 "Frames/cs.ATG"
-DotAndIdent()) {
- Expect(15);
-
-#line 2346 "Frames/cs.ATG"
- typeArguments = null;
- Qualident(
-#line 2347 "Frames/cs.ATG"
-out qualident);
- if (la.kind == 23) {
- TypeArgumentList(
-#line 2348 "Frames/cs.ATG"
-out typeArguments, canBeUnbound);
- }
-
-#line 2349 "Frames/cs.ATG"
- typeRef = new InnerClassTypeReference(typeRef, qualident, typeArguments);
- }
-
-#line 2351 "Frames/cs.ATG"
- typeRef.StartLocation = startLocation;
- }
-
- void MemberModifiers(
-#line 731 "Frames/cs.ATG"
-ModifierList m) {
- while (StartOf(20)) {
- switch (la.kind) {
- case 49: {
- lexer.NextToken();
-
-#line 734 "Frames/cs.ATG"
- m.Add(Modifiers.Abstract, t.Location);
- break;
- }
- case 71: {
- lexer.NextToken();
-
-#line 735 "Frames/cs.ATG"
- m.Add(Modifiers.Extern, t.Location);
- break;
- }
- case 84: {
- lexer.NextToken();
-
-#line 736 "Frames/cs.ATG"
- m.Add(Modifiers.Internal, t.Location);
- break;
- }
- case 89: {
- lexer.NextToken();
-
-#line 737 "Frames/cs.ATG"
- m.Add(Modifiers.New, t.Location);
- break;
- }
- case 94: {
- lexer.NextToken();
-
-#line 738 "Frames/cs.ATG"
- m.Add(Modifiers.Override, t.Location);
- break;
- }
- case 96: {
- lexer.NextToken();
-
-#line 739 "Frames/cs.ATG"
- m.Add(Modifiers.Private, t.Location);
- break;
- }
- case 97: {
- lexer.NextToken();
-
-#line 740 "Frames/cs.ATG"
- m.Add(Modifiers.Protected, t.Location);
- break;
- }
- case 98: {
- lexer.NextToken();
-
-#line 741 "Frames/cs.ATG"
- m.Add(Modifiers.Public, t.Location);
- break;
- }
- case 99: {
- lexer.NextToken();
-
-#line 742 "Frames/cs.ATG"
- m.Add(Modifiers.ReadOnly, t.Location);
- break;
- }
- case 103: {
- lexer.NextToken();
-
-#line 743 "Frames/cs.ATG"
- m.Add(Modifiers.Sealed, t.Location);
- break;
- }
- case 107: {
- lexer.NextToken();
-
-#line 744 "Frames/cs.ATG"
- m.Add(Modifiers.Static, t.Location);
- break;
- }
- case 74: {
- lexer.NextToken();
-
-#line 745 "Frames/cs.ATG"
- m.Add(Modifiers.Fixed, t.Location);
- break;
- }
- case 119: {
- lexer.NextToken();
-
-#line 746 "Frames/cs.ATG"
- m.Add(Modifiers.Unsafe, t.Location);
- break;
- }
- case 122: {
- lexer.NextToken();
-
-#line 747 "Frames/cs.ATG"
- m.Add(Modifiers.Virtual, t.Location);
- break;
- }
- case 124: {
- lexer.NextToken();
-
-#line 748 "Frames/cs.ATG"
- m.Add(Modifiers.Volatile, t.Location);
- break;
- }
- case 126: {
- lexer.NextToken();
-
-#line 749 "Frames/cs.ATG"
- m.Add(Modifiers.Partial, t.Location);
- break;
- }
- }
- }
- }
-
- void ClassMemberDecl(
-#line 1076 "Frames/cs.ATG"
-ModifierList m, List<AttributeSection> attributes) {
-
-#line 1077 "Frames/cs.ATG"
- Statement stmt = null;
- if (StartOf(21)) {
- StructMemberDecl(
-#line 1079 "Frames/cs.ATG"
-m, attributes);
- } else if (la.kind == 27) {
-
-#line 1080 "Frames/cs.ATG"
- m.Check(Modifiers.Destructors); Location startPos = la.Location;
- lexer.NextToken();
- Identifier();
-
-#line 1081 "Frames/cs.ATG"
- DestructorDeclaration d = new DestructorDeclaration(t.val, m.Modifier, attributes);
- d.Modifier = m.Modifier;
- d.StartLocation = m.GetDeclarationLocation(startPos);
-
- Expect(20);
- Expect(21);
-
-#line 1085 "Frames/cs.ATG"
- d.EndLocation = t.EndLocation;
- if (la.kind == 16) {
- Block(
-#line 1085 "Frames/cs.ATG"
-out stmt);
- } else if (la.kind == 11) {
- lexer.NextToken();
- } else SynErr(160);
-
-#line 1086 "Frames/cs.ATG"
- d.Body = (BlockStatement)stmt;
- compilationUnit.AddChild(d);
-
- } else SynErr(161);
- }
-
- void StructMemberDecl(
-#line 753 "Frames/cs.ATG"
-ModifierList m, List<AttributeSection> attributes) {
-
-#line 755 "Frames/cs.ATG"
- string qualident = null;
- TypeReference type;
- Expression expr;
- List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
- Statement stmt = null;
- List<TemplateDefinition> templates = new List<TemplateDefinition>();
- TypeReference explicitInterface = null;
- bool isExtensionMethod = false;
-
- if (la.kind == 60) {
-
-#line 765 "Frames/cs.ATG"
- m.Check(Modifiers.Constants);
- lexer.NextToken();
-
-#line 766 "Frames/cs.ATG"
- Location startPos = t.Location;
- Type(
-#line 767 "Frames/cs.ATG"
-out type);
- Identifier();
-
-#line 767 "Frames/cs.ATG"
- FieldDeclaration fd = new FieldDeclaration(attributes, type, m.Modifier | Modifiers.Const);
- fd.StartLocation = m.GetDeclarationLocation(startPos);
- VariableDeclaration f = new VariableDeclaration(t.val);
- f.StartLocation = t.Location;
- f.TypeReference = type;
- SafeAdd(fd, fd.Fields, f);
-
- Expect(3);
- Expr(
-#line 774 "Frames/cs.ATG"
-out expr);
-
-#line 774 "Frames/cs.ATG"
- f.Initializer = expr;
- while (la.kind == 14) {
- lexer.NextToken();
- Identifier();
-
-#line 775 "Frames/cs.ATG"
- f = new VariableDeclaration(t.val);
- f.StartLocation = t.Location;
- f.TypeReference = type;
- SafeAdd(fd, fd.Fields, f);
-
- Expect(3);
- Expr(
-#line 780 "Frames/cs.ATG"
-out expr);
-
-#line 780 "Frames/cs.ATG"
- f.EndLocation = t.EndLocation; f.Initializer = expr;
- }
- Expect(11);
-
-#line 781 "Frames/cs.ATG"
- fd.EndLocation = t.EndLocation; compilationUnit.AddChild(fd);
- } else if (
-#line 785 "Frames/cs.ATG"
-NotVoidPointer()) {
-
-#line 785 "Frames/cs.ATG"
- m.Check(Modifiers.PropertysEventsMethods);
- Expect(123);
-
-#line 786 "Frames/cs.ATG"
- Location startPos = t.Location;
- if (
-#line 787 "Frames/cs.ATG"
-IsExplicitInterfaceImplementation()) {
- TypeName(
-#line 788 "Frames/cs.ATG"
-out explicitInterface, false);
-
-#line 789 "Frames/cs.ATG"
- if (la.kind != Tokens.Dot || Peek(1).kind != Tokens.This) {
- qualident = TypeReference.StripLastIdentifierFromType(ref explicitInterface);
- }
- } else if (StartOf(19)) {
- Identifier();
-
-#line 792 "Frames/cs.ATG"
- qualident = t.val;
- } else SynErr(162);
- if (la.kind == 23) {
- TypeParameterList(
-#line 795 "Frames/cs.ATG"
-templates);
- }
- Expect(20);
- if (la.kind == 111) {
- lexer.NextToken();
-
-#line 798 "Frames/cs.ATG"
- isExtensionMethod = true; /* C# 3.0 */
- }
- if (StartOf(11)) {
- FormalParameterList(
-#line 799 "Frames/cs.ATG"
-p);
- }
- Expect(21);
-
-#line 800 "Frames/cs.ATG"
- MethodDeclaration methodDeclaration = new MethodDeclaration {
- Name = qualident,
- Modifier = m.Modifier,
- TypeReference = new TypeReference("System.Void", true),
- Parameters = p,
- Attributes = attributes,
- StartLocation = m.GetDeclarationLocation(startPos),
- EndLocation = t.EndLocation,
- Templates = templates,
- IsExtensionMethod = isExtensionMethod
- };
- if (explicitInterface != null)
- SafeAdd(methodDeclaration, methodDeclaration.InterfaceImplementations, new InterfaceImplementation(explicitInterface, qualident));
- compilationUnit.AddChild(methodDeclaration);
- compilationUnit.BlockStart(methodDeclaration);
-
- while (la.kind == 127) {
- TypeParameterConstraintsClause(
-#line 818 "Frames/cs.ATG"
-templates);
- }
- if (la.kind == 16) {
- Block(
-#line 820 "Frames/cs.ATG"
-out stmt);
- } else if (la.kind == 11) {
- lexer.NextToken();
- } else SynErr(163);
-
-#line 820 "Frames/cs.ATG"
- compilationUnit.BlockEnd();
- methodDeclaration.Body = (BlockStatement)stmt;
-
- } else if (la.kind == 69) {
-
-#line 824 "Frames/cs.ATG"
- m.Check(Modifiers.PropertysEventsMethods);
- lexer.NextToken();
-
-#line 826 "Frames/cs.ATG"
- EventDeclaration eventDecl = new EventDeclaration {
- Modifier = m.Modifier,
- Attributes = attributes,
- StartLocation = t.Location
- };
- compilationUnit.AddChild(eventDecl);
- compilationUnit.BlockStart(eventDecl);
- EventAddRegion addBlock = null;
- EventRemoveRegion removeBlock = null;
-
- Type(
-#line 836 "Frames/cs.ATG"
-out type);
-
-#line 836 "Frames/cs.ATG"
- eventDecl.TypeReference = type;
- if (
-#line 837 "Frames/cs.ATG"
-IsExplicitInterfaceImplementation()) {
- TypeName(
-#line 838 "Frames/cs.ATG"
-out explicitInterface, false);
-
-#line 839 "Frames/cs.ATG"
- qualident = TypeReference.StripLastIdentifierFromType(ref explicitInterface);
-
-#line 840 "Frames/cs.ATG"
- eventDecl.InterfaceImplementations.Add(new InterfaceImplementation(explicitInterface, qualident));
- } else if (StartOf(19)) {
- Identifier();
-
-#line 842 "Frames/cs.ATG"
- qualident = t.val;
- } else SynErr(164);
-
-#line 844 "Frames/cs.ATG"
- eventDecl.Name = qualident; eventDecl.EndLocation = t.EndLocation;
- if (la.kind == 3) {
- lexer.NextToken();
- Expr(
-#line 845 "Frames/cs.ATG"
-out expr);
-
-#line 845 "Frames/cs.ATG"
- eventDecl.Initializer = expr;
- }
- if (la.kind == 16) {
- lexer.NextToken();
-
-#line 846 "Frames/cs.ATG"
- eventDecl.BodyStart = t.Location;
- EventAccessorDecls(
-#line 847 "Frames/cs.ATG"
-out addBlock, out removeBlock);
- Expect(17);
-
-#line 848 "Frames/cs.ATG"
- eventDecl.BodyEnd = t.EndLocation;
- }
-
-#line 850 "Frames/cs.ATG"
- compilationUnit.BlockEnd();
- eventDecl.AddRegion = addBlock;
- eventDecl.RemoveRegion = removeBlock;
-
- while (la.kind == 14) {
- lexer.NextToken();
- Identifier();
-
-#line 854 "Frames/cs.ATG"
- EventDeclaration additionalEventDeclaration = new EventDeclaration {
- Modifier = eventDecl.Modifier,
- Attributes = eventDecl.Attributes,
- StartLocation = eventDecl.StartLocation,
- TypeReference = eventDecl.TypeReference,
- Name = t.val
- };
- compilationUnit.AddChild (additionalEventDeclaration);
-
- }
- if (la.kind == 11) {
- lexer.NextToken();
- }
- } else if (
-#line 868 "Frames/cs.ATG"
-IdentAndLPar()) {
-
-#line 868 "Frames/cs.ATG"
- m.Check(Modifiers.Constructors | Modifiers.StaticConstructors);
- Identifier();
-
-#line 869 "Frames/cs.ATG"
- string name = t.val; Location startPos = t.Location;
- Expect(20);
- if (StartOf(11)) {
-
-#line 869 "Frames/cs.ATG"
- m.Check(Modifiers.Constructors);
- FormalParameterList(
-#line 870 "Frames/cs.ATG"
-p);
- }
- Expect(21);
-
-#line 872 "Frames/cs.ATG"
- ConstructorInitializer init = null;
- if (la.kind == 9) {
-
-#line 873 "Frames/cs.ATG"
- m.Check(Modifiers.Constructors);
- ConstructorInitializer(
-#line 874 "Frames/cs.ATG"
-out init);
- }
-
-#line 876 "Frames/cs.ATG"
- ConstructorDeclaration cd = new ConstructorDeclaration(name, m.Modifier, p, init, attributes);
- cd.StartLocation = startPos;
- cd.EndLocation = t.EndLocation;
-
- if (la.kind == 16) {
- Block(
-#line 881 "Frames/cs.ATG"
-out stmt);
- } else if (la.kind == 11) {
- lexer.NextToken();
- } else SynErr(165);
-
-#line 881 "Frames/cs.ATG"
- cd.Body = (BlockStatement)stmt; compilationUnit.AddChild(cd);
- } else if (la.kind == 70 || la.kind == 80) {
-
-#line 884 "Frames/cs.ATG"
- m.Check(Modifiers.Operators);
- if (m.isNone) Error("at least one modifier must be set");
- bool isImplicit = true;
- Location startPos = Location.Empty;
-
- if (la.kind == 80) {
- lexer.NextToken();
-
-#line 889 "Frames/cs.ATG"
- startPos = t.Location;
- } else {
- lexer.NextToken();
-
-#line 889 "Frames/cs.ATG"
- isImplicit = false; startPos = t.Location;
- }
- Expect(92);
- Type(
-#line 890 "Frames/cs.ATG"
-out type);
-
-#line 890 "Frames/cs.ATG"
- TypeReference operatorType = type;
- Expect(20);
- Type(
-#line 891 "Frames/cs.ATG"
-out type);
- Identifier();
-
-#line 891 "Frames/cs.ATG"
- string varName = t.val;
- Expect(21);
-
-#line 892 "Frames/cs.ATG"
- Location endPos = t.Location;
- if (la.kind == 16) {
- Block(
-#line 893 "Frames/cs.ATG"
-out stmt);
- } else if (la.kind == 11) {
- lexer.NextToken();
-
-#line 893 "Frames/cs.ATG"
- stmt = null;
- } else SynErr(166);
-
-#line 896 "Frames/cs.ATG"
- 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,
- TypeReference = operatorType,
- ConversionType = isImplicit ? ConversionType.Implicit : ConversionType.Explicit,
- Body = (BlockStatement)stmt,
- StartLocation = m.GetDeclarationLocation(startPos),
- EndLocation = endPos
- };
- compilationUnit.AddChild(operatorDeclaration);
-
- } else if (StartOf(22)) {
- TypeDecl(
-#line 914 "Frames/cs.ATG"
-m, attributes);
- } else if (StartOf(10)) {
- Type(
-#line 916 "Frames/cs.ATG"
-out type);
-
-#line 916 "Frames/cs.ATG"
- Location startPos = t.Location;
- if (la.kind == 92) {
-
-#line 918 "Frames/cs.ATG"
- OverloadableOperatorType op;
- m.Check(Modifiers.Operators);
- if (m.isNone) Error("at least one modifier must be set");
-
- lexer.NextToken();
- OverloadableOperator(
-#line 922 "Frames/cs.ATG"
-out op);
-
-#line 922 "Frames/cs.ATG"
- TypeReference firstType, secondType = null; string secondName = null;
- Expect(20);
- Type(
-#line 923 "Frames/cs.ATG"
-out firstType);
- Identifier();
-
-#line 923 "Frames/cs.ATG"
- string firstName = t.val;
- if (la.kind == 14) {
- lexer.NextToken();
- Type(
-#line 924 "Frames/cs.ATG"
-out secondType);
- Identifier();
-
-#line 924 "Frames/cs.ATG"
- secondName = t.val;
- } else if (la.kind == 21) {
- } else SynErr(167);
-
-#line 932 "Frames/cs.ATG"
- Location endPos = t.Location;
- Expect(21);
- if (la.kind == 16) {
- Block(
-#line 933 "Frames/cs.ATG"
-out stmt);
- } else if (la.kind == 11) {
- lexer.NextToken();
- } else SynErr(168);
-
-#line 935 "Frames/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,
- Name = GetReflectionNameForOperator(op),
- Body = (BlockStatement)stmt,
- StartLocation = m.GetDeclarationLocation(startPos),
- EndLocation = endPos
- };
- SafeAdd(operatorDeclaration, operatorDeclaration.Parameters, new ParameterDeclarationExpression(firstType, firstName));
- if (secondType != null) {
- SafeAdd(operatorDeclaration, operatorDeclaration.Parameters, new ParameterDeclarationExpression(secondType, secondName));
- }
- compilationUnit.AddChild(operatorDeclaration);
-
- } else if (
-#line 957 "Frames/cs.ATG"
-IsVarDecl()) {
-
-#line 958 "Frames/cs.ATG"
- m.Check(Modifiers.Fields);
- FieldDeclaration fd = new FieldDeclaration(attributes, type, m.Modifier);
- fd.StartLocation = m.GetDeclarationLocation(startPos);
-
- if (
-#line 962 "Frames/cs.ATG"
-m.Contains(Modifiers.Fixed)) {
- VariableDeclarator(
-#line 963 "Frames/cs.ATG"
-fd);
- Expect(18);
- Expr(
-#line 965 "Frames/cs.ATG"
-out expr);
-
-#line 965 "Frames/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 969 "Frames/cs.ATG"
-fd);
- Expect(18);
- Expr(
-#line 971 "Frames/cs.ATG"
-out expr);
-
-#line 971 "Frames/cs.ATG"
- if (fd.Fields.Count > 0)
- fd.Fields[fd.Fields.Count-1].FixedArrayInitialization = expr;
- Expect(19);
- }
- } else if (StartOf(19)) {
- VariableDeclarator(
-#line 976 "Frames/cs.ATG"
-fd);
- while (la.kind == 14) {
- lexer.NextToken();
- VariableDeclarator(
-#line 977 "Frames/cs.ATG"
-fd);
- }
- } else SynErr(169);
- Expect(11);
-
-#line 979 "Frames/cs.ATG"
- fd.EndLocation = t.EndLocation; compilationUnit.AddChild(fd);
- } else if (la.kind == 111) {
-
-#line 982 "Frames/cs.ATG"
- m.Check(Modifiers.Indexers);
- lexer.NextToken();
- Expect(18);
- FormalParameterList(
-#line 983 "Frames/cs.ATG"
-p);
- Expect(19);
-
-#line 983 "Frames/cs.ATG"
- Location endLocation = t.EndLocation;
- Expect(16);
-
-#line 984 "Frames/cs.ATG"
- IndexerDeclaration indexer = new IndexerDeclaration(type, p, m.Modifier, attributes);
- indexer.StartLocation = startPos;
- indexer.EndLocation = endLocation;
- indexer.BodyStart = t.Location;
- PropertyGetRegion getRegion;
- PropertySetRegion setRegion;
-
- AccessorDecls(
-#line 991 "Frames/cs.ATG"
-out getRegion, out setRegion);
- Expect(17);
-
-#line 992 "Frames/cs.ATG"
- indexer.BodyEnd = t.EndLocation;
- indexer.GetRegion = getRegion;
- indexer.SetRegion = setRegion;
- compilationUnit.AddChild(indexer);
-
- } else if (
-#line 997 "Frames/cs.ATG"
-IsIdentifierToken(la)) {
- if (
-#line 998 "Frames/cs.ATG"
-IsExplicitInterfaceImplementation()) {
- TypeName(
-#line 999 "Frames/cs.ATG"
-out explicitInterface, false);
-
-#line 1000 "Frames/cs.ATG"
- if (la.kind != Tokens.Dot || Peek(1).kind != Tokens.This) {
- qualident = TypeReference.StripLastIdentifierFromType(ref explicitInterface);
- }
- } else if (StartOf(19)) {
- Identifier();
-
-#line 1003 "Frames/cs.ATG"
- qualident = t.val;
- } else SynErr(170);
-
-#line 1005 "Frames/cs.ATG"
- Location qualIdentEndLocation = t.EndLocation;
- if (la.kind == 16 || la.kind == 20 || la.kind == 23) {
- if (la.kind == 20 || la.kind == 23) {
-
-#line 1009 "Frames/cs.ATG"
- m.Check(Modifiers.PropertysEventsMethods);
- if (la.kind == 23) {
- TypeParameterList(
-#line 1011 "Frames/cs.ATG"
-templates);
- }
- Expect(20);
- if (la.kind == 111) {
- lexer.NextToken();
-
-#line 1013 "Frames/cs.ATG"
- isExtensionMethod = true;
- }
- if (StartOf(11)) {
- FormalParameterList(
-#line 1014 "Frames/cs.ATG"
-p);
- }
- Expect(21);
-
-#line 1016 "Frames/cs.ATG"
- MethodDeclaration methodDeclaration = new MethodDeclaration {
- Name = qualident,
- Modifier = m.Modifier,
- TypeReference = type,
- Parameters = p,
- Attributes = attributes
- };
- if (explicitInterface != null)
- methodDeclaration.InterfaceImplementations.Add(new InterfaceImplementation(explicitInterface, qualident));
- methodDeclaration.StartLocation = m.GetDeclarationLocation(startPos);
- methodDeclaration.EndLocation = t.EndLocation;
- methodDeclaration.IsExtensionMethod = isExtensionMethod;
- methodDeclaration.Templates = templates;
- compilationUnit.AddChild(methodDeclaration);
-
- while (la.kind == 127) {
- TypeParameterConstraintsClause(
-#line 1031 "Frames/cs.ATG"
-templates);
- }
- if (la.kind == 16) {
- Block(
-#line 1032 "Frames/cs.ATG"
-out stmt);
- } else if (la.kind == 11) {
- lexer.NextToken();
- } else SynErr(171);
-
-#line 1032 "Frames/cs.ATG"
- methodDeclaration.Body = (BlockStatement)stmt;
- } else {
- lexer.NextToken();
-
-#line 1035 "Frames/cs.ATG"
- PropertyDeclaration pDecl = new PropertyDeclaration(qualident, type, m.Modifier, attributes);
- if (explicitInterface != null)
- pDecl.InterfaceImplementations.Add(new InterfaceImplementation(explicitInterface, qualident));
- pDecl.StartLocation = m.GetDeclarationLocation(startPos);
- pDecl.EndLocation = qualIdentEndLocation;
- pDecl.BodyStart = t.Location;
- PropertyGetRegion getRegion;
- PropertySetRegion setRegion;
-
- AccessorDecls(
-#line 1044 "Frames/cs.ATG"
-out getRegion, out setRegion);
- Expect(17);
-
-#line 1046 "Frames/cs.ATG"
- pDecl.GetRegion = getRegion;
- pDecl.SetRegion = setRegion;
- pDecl.BodyEnd = t.EndLocation;
- compilationUnit.AddChild(pDecl);
-
- }
- } else if (la.kind == 15) {
-
-#line 1054 "Frames/cs.ATG"
- m.Check(Modifiers.Indexers);
- lexer.NextToken();
- Expect(111);
- Expect(18);
- FormalParameterList(
-#line 1055 "Frames/cs.ATG"
-p);
- Expect(19);
-
-#line 1056 "Frames/cs.ATG"
- IndexerDeclaration indexer = new IndexerDeclaration(type, p, m.Modifier, attributes);
- indexer.StartLocation = m.GetDeclarationLocation(startPos);
- indexer.EndLocation = t.EndLocation;
- if (explicitInterface != null)
- SafeAdd(indexer, indexer.InterfaceImplementations, new InterfaceImplementation(explicitInterface, "this"));
- PropertyGetRegion getRegion;
- PropertySetRegion setRegion;
-
- Expect(16);
-
-#line 1064 "Frames/cs.ATG"
- Location bodyStart = t.Location;
- AccessorDecls(
-#line 1065 "Frames/cs.ATG"
-out getRegion, out setRegion);
- Expect(17);
-
-#line 1066 "Frames/cs.ATG"
- indexer.BodyStart = bodyStart;
- indexer.BodyEnd = t.EndLocation;
- indexer.GetRegion = getRegion;
- indexer.SetRegion = setRegion;
- compilationUnit.AddChild(indexer);
-
- } else SynErr(172);
- } else SynErr(173);
- } else SynErr(174);
- }
-
- void InterfaceMemberDecl() {
-
-#line 1093 "Frames/cs.ATG"
- TypeReference type;
- AttributeSection section;
- Modifiers mod = Modifiers.None;
- List<AttributeSection> attributes = new List<AttributeSection>();
- List<ParameterDeclarationExpression> parameters = new List<ParameterDeclarationExpression>();
- string name;
- PropertyGetRegion getBlock;
- PropertySetRegion setBlock;
- Location startLocation = new Location(-1, -1);
- List<TemplateDefinition> templates = new List<TemplateDefinition>();
-
- while (la.kind == 18) {
- AttributeSection(
-#line 1106 "Frames/cs.ATG"
-out section);
-
-#line 1106 "Frames/cs.ATG"
- attributes.Add(section);
- }
- if (la.kind == 89) {
- lexer.NextToken();
-
-#line 1107 "Frames/cs.ATG"
- mod = Modifiers.New; startLocation = t.Location;
- }
- if (
-#line 1110 "Frames/cs.ATG"
-NotVoidPointer()) {
- Expect(123);
-
-#line 1110 "Frames/cs.ATG"
- if (startLocation.IsEmpty) startLocation = t.Location;
- Identifier();
-
-#line 1111 "Frames/cs.ATG"
- name = t.val;
- if (la.kind == 23) {
- TypeParameterList(
-#line 1112 "Frames/cs.ATG"
-templates);
- }
- Expect(20);
- if (StartOf(11)) {
- FormalParameterList(
-#line 1113 "Frames/cs.ATG"
-parameters);
- }
- Expect(21);
- while (la.kind == 127) {
- TypeParameterConstraintsClause(
-#line 1114 "Frames/cs.ATG"
-templates);
- }
- Expect(11);
-
-#line 1116 "Frames/cs.ATG"
- MethodDeclaration md = new MethodDeclaration {
- Name = name, Modifier = mod, TypeReference = new TypeReference("System.Void", true),
- Parameters = parameters, Attributes = attributes, Templates = templates,
- StartLocation = startLocation, EndLocation = t.EndLocation
- };
- compilationUnit.AddChild(md);
-
- } else if (StartOf(23)) {
- if (StartOf(10)) {
- Type(
-#line 1124 "Frames/cs.ATG"
-out type);
-
-#line 1124 "Frames/cs.ATG"
- if (startLocation.IsEmpty) startLocation = t.Location;
- if (StartOf(19)) {
- Identifier();
-
-#line 1126 "Frames/cs.ATG"
- name = t.val; Location qualIdentEndLocation = t.EndLocation;
- if (la.kind == 20 || la.kind == 23) {
- if (la.kind == 23) {
- TypeParameterList(
-#line 1130 "Frames/cs.ATG"
-templates);
- }
- Expect(20);
- if (StartOf(11)) {
- FormalParameterList(
-#line 1131 "Frames/cs.ATG"
-parameters);
- }
- Expect(21);
- while (la.kind == 127) {
- TypeParameterConstraintsClause(
-#line 1133 "Frames/cs.ATG"
-templates);
- }
- Expect(11);
-
-#line 1134 "Frames/cs.ATG"
- MethodDeclaration md = new MethodDeclaration {
- Name = name, Modifier = mod, TypeReference = type,
- Parameters = parameters, Attributes = attributes, Templates = templates,
- StartLocation = startLocation, EndLocation = t.EndLocation
- };
- compilationUnit.AddChild(md);
-
- } else if (la.kind == 16) {
-
-#line 1143 "Frames/cs.ATG"
- PropertyDeclaration pd = new PropertyDeclaration(name, type, mod, attributes);
- compilationUnit.AddChild(pd);
- lexer.NextToken();
-
-#line 1146 "Frames/cs.ATG"
- Location bodyStart = t.Location;
- InterfaceAccessors(
-#line 1147 "Frames/cs.ATG"
-out getBlock, out setBlock);
- Expect(17);
-
-#line 1148 "Frames/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 1151 "Frames/cs.ATG"
-parameters);
- Expect(19);
-
-#line 1152 "Frames/cs.ATG"
- Location bracketEndLocation = t.EndLocation;
-
-#line 1153 "Frames/cs.ATG"
- IndexerDeclaration id = new IndexerDeclaration(type, parameters, mod, attributes);
- compilationUnit.AddChild(id);
- Expect(16);
-
-#line 1155 "Frames/cs.ATG"
- Location bodyStart = t.Location;
- InterfaceAccessors(
-#line 1156 "Frames/cs.ATG"
-out getBlock, out setBlock);
- Expect(17);
-
-#line 1158 "Frames/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 1161 "Frames/cs.ATG"
- if (startLocation.IsEmpty) startLocation = t.Location;
- Type(
-#line 1162 "Frames/cs.ATG"
-out type);
- Identifier();
-
-#line 1163 "Frames/cs.ATG"
- EventDeclaration ed = new EventDeclaration {
- TypeReference = type, Name = t.val, Modifier = mod, Attributes = attributes
- };
- compilationUnit.AddChild(ed);
-
- Expect(11);
-
-#line 1169 "Frames/cs.ATG"
- ed.StartLocation = startLocation; ed.EndLocation = t.EndLocation;
- }
- } else SynErr(177);
- }
-
- void EnumMemberDecl(
-#line 1174 "Frames/cs.ATG"
-out FieldDeclaration f) {
-
-#line 1176 "Frames/cs.ATG"
- Expression expr = null;
- List<AttributeSection> attributes = new List<AttributeSection>();
- AttributeSection section = null;
- VariableDeclaration varDecl = null;
-
- while (la.kind == 18) {
- AttributeSection(
-#line 1182 "Frames/cs.ATG"
-out section);
-
-#line 1182 "Frames/cs.ATG"
- attributes.Add(section);
- }
- Identifier();
-
-#line 1183 "Frames/cs.ATG"
- f = new FieldDeclaration(attributes);
- varDecl = new VariableDeclaration(t.val);
- f.Fields.Add(varDecl);
- f.StartLocation = t.Location;
- f.EndLocation = t.EndLocation;
-
- if (la.kind == 3) {
- lexer.NextToken();
- Expr(
-#line 1189 "Frames/cs.ATG"
-out expr);
-
-#line 1189 "Frames/cs.ATG"
- varDecl.Initializer = expr;
- }
- }
-
- void TypeWithRestriction(
-#line 571 "Frames/cs.ATG"
-out TypeReference type, bool allowNullable, bool canBeUnbound) {
-
-#line 573 "Frames/cs.ATG"
- Location startPos = la.Location;
- string name;
- int pointer = 0;
- type = null;
-
- if (StartOf(4)) {
- ClassType(
-#line 579 "Frames/cs.ATG"
-out type, canBeUnbound);
- } else if (StartOf(5)) {
- SimpleType(
-#line 580 "Frames/cs.ATG"
-out name);
-
-#line 580 "Frames/cs.ATG"
- type = new TypeReference(name, true);
- } else if (la.kind == 123) {
- lexer.NextToken();
- Expect(6);
-
-#line 581 "Frames/cs.ATG"
- pointer = 1; type = new TypeReference("System.Void", true);
- } else SynErr(178);
-
-#line 582 "Frames/cs.ATG"
- List<int> r = new List<int>();
- if (
-#line 584 "Frames/cs.ATG"
-allowNullable && la.kind == Tokens.Question) {
- NullableQuestionMark(
-#line 584 "Frames/cs.ATG"
-ref type);
- }
- while (
-#line 586 "Frames/cs.ATG"
-IsPointerOrDims()) {
-
-#line 586 "Frames/cs.ATG"
- int i = 0;
- if (la.kind == 6) {
- lexer.NextToken();
-
-#line 587 "Frames/cs.ATG"
- ++pointer;
- } else if (la.kind == 18) {
- lexer.NextToken();
- while (la.kind == 14) {
- lexer.NextToken();
-
-#line 588 "Frames/cs.ATG"
- ++i;
- }
- Expect(19);
-
-#line 588 "Frames/cs.ATG"
- r.Add(i);
- } else SynErr(179);
- }
-
-#line 591 "Frames/cs.ATG"
- if (type != null) {
- type.RankSpecifier = r.ToArray();
- type.PointerNestingLevel = pointer;
- type.EndLocation = t.EndLocation;
- type.StartLocation = startPos;
- }
-
- }
-
- void SimpleType(
-#line 627 "Frames/cs.ATG"
-out string name) {
-
-#line 628 "Frames/cs.ATG"
- name = String.Empty;
- if (StartOf(24)) {
- IntegralType(
-#line 630 "Frames/cs.ATG"
-out name);
- } else if (la.kind == 75) {
- lexer.NextToken();
-
-#line 631 "Frames/cs.ATG"
- name = "System.Single";
- } else if (la.kind == 66) {
- lexer.NextToken();
-
-#line 632 "Frames/cs.ATG"
- name = "System.Double";
- } else if (la.kind == 62) {
- lexer.NextToken();
-
-#line 633 "Frames/cs.ATG"
- name = "System.Decimal";
- } else if (la.kind == 52) {
- lexer.NextToken();
-
-#line 634 "Frames/cs.ATG"
- name = "System.Boolean";
- } else SynErr(180);
- }
-
- void NullableQuestionMark(
-#line 2355 "Frames/cs.ATG"
-ref TypeReference typeRef) {
-
-#line 2356 "Frames/cs.ATG"
- List<TypeReference> typeArguments = new List<TypeReference>(1);
- Expect(12);
-
-#line 2360 "Frames/cs.ATG"
- if (typeRef != null) typeArguments.Add(typeRef);
- typeRef = new TypeReference("System.Nullable", typeArguments) { IsKeyword = true };
-
- }
-
- void FixedParameter(
-#line 664 "Frames/cs.ATG"
-out ParameterDeclarationExpression p) {
-
-#line 666 "Frames/cs.ATG"
- TypeReference type;
- ParameterModifiers mod = ParameterModifiers.In;
- Location start = la.Location;
- Expression defaultParameterExpr = null;
-
- if (la.kind == 93 || la.kind == 100) {
- if (la.kind == 100) {
- lexer.NextToken();
-
-#line 673 "Frames/cs.ATG"
- mod = ParameterModifiers.Ref;
- } else {
- lexer.NextToken();
-
-#line 674 "Frames/cs.ATG"
- mod = ParameterModifiers.Out;
- }
- }
- Type(
-#line 676 "Frames/cs.ATG"
-out type);
- Identifier();
-
-#line 676 "Frames/cs.ATG"
- p = new ParameterDeclarationExpression(type, t.val, mod); p.StartLocation = start; p.EndLocation = t.Location;
- if (la.kind == 3) {
- lexer.NextToken();
- Expr(
-#line 677 "Frames/cs.ATG"
-out defaultParameterExpr);
- }
- }
-
- void ParameterArray(
-#line 680 "Frames/cs.ATG"
-out ParameterDeclarationExpression p) {
-
-#line 681 "Frames/cs.ATG"
- TypeReference type;
- Expect(95);
- Type(
-#line 683 "Frames/cs.ATG"
-out type);
- Identifier();
-
-#line 683 "Frames/cs.ATG"
- p = new ParameterDeclarationExpression(type, t.val, ParameterModifiers.Params);
- }
-
- void AccessorModifiers(
-#line 686 "Frames/cs.ATG"
-out ModifierList m) {
-
-#line 687 "Frames/cs.ATG"
- m = new ModifierList();
- if (la.kind == 96) {
- lexer.NextToken();
-
-#line 689 "Frames/cs.ATG"
- m.Add(Modifiers.Private, t.Location);
- } else if (la.kind == 97) {
- lexer.NextToken();
-
-#line 690 "Frames/cs.ATG"
- m.Add(Modifiers.Protected, t.Location);
- if (la.kind == 84) {
- lexer.NextToken();
-
-#line 691 "Frames/cs.ATG"
- m.Add(Modifiers.Internal, t.Location);
- }
- } else if (la.kind == 84) {
- lexer.NextToken();
-
-#line 692 "Frames/cs.ATG"
- m.Add(Modifiers.Internal, t.Location);
- if (la.kind == 97) {
- lexer.NextToken();
-
-#line 693 "Frames/cs.ATG"
- m.Add(Modifiers.Protected, t.Location);
- }
- } else SynErr(181);
- }
-
- void Block(
-#line 1309 "Frames/cs.ATG"
-out Statement stmt) {
- Expect(16);
-
-#line 1311 "Frames/cs.ATG"
- BlockStatement blockStmt = new BlockStatement();
- blockStmt.StartLocation = t.Location;
- compilationUnit.BlockStart(blockStmt);
- if (!ParseMethodBodies) lexer.SkipCurrentBlock(0);
-
- while (StartOf(25)) {
- Statement();
- }
- while (!(la.kind == 0 || la.kind == 17)) {SynErr(182); lexer.NextToken(); }
- Expect(17);
-
-#line 1319 "Frames/cs.ATG"
- stmt = blockStmt;
- blockStmt.EndLocation = t.Kind != Tokens.CloseCurlyBrace ? Location.Empty : t.EndLocation;
- compilationUnit.BlockEnd();
-
- }
-
- void EventAccessorDecls(
-#line 1246 "Frames/cs.ATG"
-out EventAddRegion addBlock, out EventRemoveRegion removeBlock) {
-
-#line 1247 "Frames/cs.ATG"
- AttributeSection section;
- List<AttributeSection> attributes = new List<AttributeSection>();
- Statement stmt;
- addBlock = null;
- removeBlock = null;
-
- while (la.kind == 18) {
- AttributeSection(
-#line 1254 "Frames/cs.ATG"
-out section);
-
-#line 1254 "Frames/cs.ATG"
- attributes.Add(section);
- }
- if (la.kind == 130) {
-
-#line 1256 "Frames/cs.ATG"
- addBlock = new EventAddRegion(attributes);
- AddAccessorDecl(
-#line 1257 "Frames/cs.ATG"
-out stmt);
-
-#line 1257 "Frames/cs.ATG"
- attributes = new List<AttributeSection>(); addBlock.Block = (BlockStatement)stmt;
- while (la.kind == 18) {
- AttributeSection(
-#line 1258 "Frames/cs.ATG"
-out section);
-
-#line 1258 "Frames/cs.ATG"
- attributes.Add(section);
- }
- RemoveAccessorDecl(
-#line 1259 "Frames/cs.ATG"
-out stmt);
-
-#line 1259 "Frames/cs.ATG"
- removeBlock = new EventRemoveRegion(attributes); removeBlock.Block = (BlockStatement)stmt;
- } else if (la.kind == 131) {
- RemoveAccessorDecl(
-#line 1261 "Frames/cs.ATG"
-out stmt);
-
-#line 1261 "Frames/cs.ATG"
- removeBlock = new EventRemoveRegion(attributes); removeBlock.Block = (BlockStatement)stmt; attributes = new List<AttributeSection>();
- while (la.kind == 18) {
- AttributeSection(
-#line 1262 "Frames/cs.ATG"
-out section);
-
-#line 1262 "Frames/cs.ATG"
- attributes.Add(section);
- }
- AddAccessorDecl(
-#line 1263 "Frames/cs.ATG"
-out stmt);
-
-#line 1263 "Frames/cs.ATG"
- addBlock = new EventAddRegion(attributes); addBlock.Block = (BlockStatement)stmt;
- } else SynErr(183);
- }
-
- void ConstructorInitializer(
-#line 1339 "Frames/cs.ATG"
-out ConstructorInitializer ci) {
-
-#line 1340 "Frames/cs.ATG"
- Expression expr; ci = new ConstructorInitializer();
- Expect(9);
- if (la.kind == 51) {
- lexer.NextToken();
-
-#line 1344 "Frames/cs.ATG"
- ci.ConstructorInitializerType = ConstructorInitializerType.Base;
- } else if (la.kind == 111) {
- lexer.NextToken();
-
-#line 1345 "Frames/cs.ATG"
- ci.ConstructorInitializerType = ConstructorInitializerType.This;
- } else SynErr(184);
- Expect(20);
- if (StartOf(26)) {
- Argument(
-#line 1348 "Frames/cs.ATG"
-out expr);
-
-#line 1348 "Frames/cs.ATG"
- SafeAdd(ci, ci.Arguments, expr);
- while (la.kind == 14) {
- lexer.NextToken();
- Argument(
-#line 1349 "Frames/cs.ATG"
-out expr);
-
-#line 1349 "Frames/cs.ATG"
- SafeAdd(ci, ci.Arguments, expr);
- }
- }
- Expect(21);
- }
-
- void OverloadableOperator(
-#line 1362 "Frames/cs.ATG"
-out OverloadableOperatorType op) {
-
-#line 1363 "Frames/cs.ATG"
- op = OverloadableOperatorType.None;
- switch (la.kind) {
- case 4: {
- lexer.NextToken();
-
-#line 1365 "Frames/cs.ATG"
- op = OverloadableOperatorType.Add;
- break;
- }
- case 5: {
- lexer.NextToken();
-
-#line 1366 "Frames/cs.ATG"
- op = OverloadableOperatorType.Subtract;
- break;
- }
- case 24: {
- lexer.NextToken();
-
-#line 1368 "Frames/cs.ATG"
- op = OverloadableOperatorType.Not;
- break;
- }
- case 27: {
- lexer.NextToken();
-
-#line 1369 "Frames/cs.ATG"
- op = OverloadableOperatorType.BitNot;
- break;
- }
- case 31: {
- lexer.NextToken();
-
-#line 1371 "Frames/cs.ATG"
- op = OverloadableOperatorType.Increment;
- break;
- }
- case 32: {
- lexer.NextToken();
-
-#line 1372 "Frames/cs.ATG"
- op = OverloadableOperatorType.Decrement;
- break;
- }
- case 113: {
- lexer.NextToken();
-
-#line 1374 "Frames/cs.ATG"
- op = OverloadableOperatorType.IsTrue;
- break;
- }
- case 72: {
- lexer.NextToken();
-
-#line 1375 "Frames/cs.ATG"
- op = OverloadableOperatorType.IsFalse;
- break;
- }
- case 6: {
- lexer.NextToken();
-
-#line 1377 "Frames/cs.ATG"
- op = OverloadableOperatorType.Multiply;
- break;
- }
- case 7: {
- lexer.NextToken();
-
-#line 1378 "Frames/cs.ATG"
- op = OverloadableOperatorType.Divide;
- break;
- }
- case 8: {
- lexer.NextToken();
-
-#line 1379 "Frames/cs.ATG"
- op = OverloadableOperatorType.Modulus;
- break;
- }
- case 28: {
- lexer.NextToken();
-
-#line 1381 "Frames/cs.ATG"
- op = OverloadableOperatorType.BitwiseAnd;
- break;
- }
- case 29: {
- lexer.NextToken();
-
-#line 1382 "Frames/cs.ATG"
- op = OverloadableOperatorType.BitwiseOr;
- break;
- }
- case 30: {
- lexer.NextToken();
-
-#line 1383 "Frames/cs.ATG"
- op = OverloadableOperatorType.ExclusiveOr;
- break;
- }
- case 37: {
- lexer.NextToken();
-
-#line 1385 "Frames/cs.ATG"
- op = OverloadableOperatorType.ShiftLeft;
- break;
- }
- case 33: {
- lexer.NextToken();
-
-#line 1386 "Frames/cs.ATG"
- op = OverloadableOperatorType.Equality;
- break;
- }
- case 34: {
- lexer.NextToken();
-
-#line 1387 "Frames/cs.ATG"
- op = OverloadableOperatorType.InEquality;
- break;
- }
- case 23: {
- lexer.NextToken();
-
-#line 1388 "Frames/cs.ATG"
- op = OverloadableOperatorType.LessThan;
- break;
- }
- case 35: {
- lexer.NextToken();
-
-#line 1389 "Frames/cs.ATG"
- op = OverloadableOperatorType.GreaterThanOrEqual;
- break;
- }
- case 36: {
- lexer.NextToken();
-
-#line 1390 "Frames/cs.ATG"
- op = OverloadableOperatorType.LessThanOrEqual;
- break;
- }
- case 22: {
- lexer.NextToken();
-
-#line 1391 "Frames/cs.ATG"
- op = OverloadableOperatorType.GreaterThan;
- if (la.kind == 22) {
- lexer.NextToken();
-
-#line 1391 "Frames/cs.ATG"
- op = OverloadableOperatorType.ShiftRight;
- }
- break;
- }
- default: SynErr(185); break;
- }
- }
-
- void VariableDeclarator(
-#line 1301 "Frames/cs.ATG"
-FieldDeclaration parentFieldDeclaration) {
-
-#line 1302 "Frames/cs.ATG"
- Expression expr = null;
- Identifier();
-
-#line 1304 "Frames/cs.ATG"
- VariableDeclaration f = new VariableDeclaration(t.val); f.StartLocation = t.Location;
- if (la.kind == 3) {
- lexer.NextToken();
- VariableInitializer(
-#line 1305 "Frames/cs.ATG"
-out expr);
-
-#line 1305 "Frames/cs.ATG"
- f.Initializer = expr;
- }
-
-#line 1306 "Frames/cs.ATG"
- f.EndLocation = t.EndLocation; SafeAdd(parentFieldDeclaration, parentFieldDeclaration.Fields, f);
- }
-
- void AccessorDecls(
-#line 1193 "Frames/cs.ATG"
-out PropertyGetRegion getBlock, out PropertySetRegion setBlock) {
-
-#line 1195 "Frames/cs.ATG"
- List<AttributeSection> attributes = new List<AttributeSection>();
- AttributeSection section;
- getBlock = null;
- setBlock = null;
- ModifierList modifiers = null;
-
- while (la.kind == 18) {
- AttributeSection(
-#line 1202 "Frames/cs.ATG"
-out section);
-
-#line 1202 "Frames/cs.ATG"
- attributes.Add(section);
- }
- if (la.kind == 84 || la.kind == 96 || la.kind == 97) {
- AccessorModifiers(
-#line 1203 "Frames/cs.ATG"
-out modifiers);
- }
- if (la.kind == 128) {
- GetAccessorDecl(
-#line 1205 "Frames/cs.ATG"
-out getBlock, attributes);
-
-#line 1206 "Frames/cs.ATG"
- if (modifiers != null) {getBlock.Modifier = modifiers.Modifier; }
- if (StartOf(27)) {
-
-#line 1207 "Frames/cs.ATG"
- attributes = new List<AttributeSection>(); modifiers = null;
- while (la.kind == 18) {
- AttributeSection(
-#line 1208 "Frames/cs.ATG"
-out section);
-
-#line 1208 "Frames/cs.ATG"
- attributes.Add(section);
- }
- if (la.kind == 84 || la.kind == 96 || la.kind == 97) {
- AccessorModifiers(
-#line 1209 "Frames/cs.ATG"
-out modifiers);
- }
- SetAccessorDecl(
-#line 1210 "Frames/cs.ATG"
-out setBlock, attributes);
-
-#line 1211 "Frames/cs.ATG"
- if (modifiers != null) {setBlock.Modifier = modifiers.Modifier; }
- }
- } else if (la.kind == 129) {
- SetAccessorDecl(
-#line 1214 "Frames/cs.ATG"
-out setBlock, attributes);
-
-#line 1215 "Frames/cs.ATG"
- if (modifiers != null) {setBlock.Modifier = modifiers.Modifier; }
- if (StartOf(28)) {
-
-#line 1216 "Frames/cs.ATG"
- attributes = new List<AttributeSection>(); modifiers = null;
- while (la.kind == 18) {
- AttributeSection(
-#line 1217 "Frames/cs.ATG"
-out section);
-
-#line 1217 "Frames/cs.ATG"
- attributes.Add(section);
- }
- if (la.kind == 84 || la.kind == 96 || la.kind == 97) {
- AccessorModifiers(
-#line 1218 "Frames/cs.ATG"
-out modifiers);
- }
- GetAccessorDecl(
-#line 1219 "Frames/cs.ATG"
-out getBlock, attributes);
-
-#line 1220 "Frames/cs.ATG"
- if (modifiers != null) {getBlock.Modifier = modifiers.Modifier; }
- }
- } else if (StartOf(19)) {
- Identifier();
-
-#line 1222 "Frames/cs.ATG"
- Error("get or set accessor declaration expected");
- } else SynErr(186);
- }
-
- void InterfaceAccessors(
-#line 1267 "Frames/cs.ATG"
-out PropertyGetRegion getBlock, out PropertySetRegion setBlock) {
-
-#line 1269 "Frames/cs.ATG"
- AttributeSection section;
- List<AttributeSection> attributes = new List<AttributeSection>();
- getBlock = null; setBlock = null;
- PropertyGetSetRegion lastBlock = null;
-
- while (la.kind == 18) {
- AttributeSection(
-#line 1275 "Frames/cs.ATG"
-out section);
-
-#line 1275 "Frames/cs.ATG"
- attributes.Add(section);
- }
-
-#line 1276 "Frames/cs.ATG"
- Location startLocation = la.Location;
- if (la.kind == 128) {
- lexer.NextToken();
-
-#line 1278 "Frames/cs.ATG"
- getBlock = new PropertyGetRegion(null, attributes);
- } else if (la.kind == 129) {
- lexer.NextToken();
-
-#line 1279 "Frames/cs.ATG"
- setBlock = new PropertySetRegion(null, attributes);
- } else SynErr(187);
- Expect(11);
-
-#line 1282 "Frames/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 1286 "Frames/cs.ATG"
-out section);
-
-#line 1286 "Frames/cs.ATG"
- attributes.Add(section);
- }
-
-#line 1287 "Frames/cs.ATG"
- startLocation = la.Location;
- if (la.kind == 128) {
- lexer.NextToken();
-
-#line 1289 "Frames/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 1292 "Frames/cs.ATG"
- if (setBlock != null) Error("set already declared");
- else { setBlock = new PropertySetRegion(null, attributes); lastBlock = setBlock; }
-
- } else SynErr(188);
- Expect(11);
-
-#line 1297 "Frames/cs.ATG"
- if (lastBlock != null) { lastBlock.StartLocation = startLocation; lastBlock.EndLocation = t.EndLocation; }
- }
- }
-
- void GetAccessorDecl(
-#line 1226 "Frames/cs.ATG"
-out PropertyGetRegion getBlock, List<AttributeSection> attributes) {
-
-#line 1227 "Frames/cs.ATG"
- Statement stmt = null;
- Expect(128);
-
-#line 1230 "Frames/cs.ATG"
- Location startLocation = t.Location;
- if (la.kind == 16) {
- Block(
-#line 1231 "Frames/cs.ATG"
-out stmt);
- } else if (la.kind == 11) {
- lexer.NextToken();
- } else SynErr(189);
-
-#line 1232 "Frames/cs.ATG"
- getBlock = new PropertyGetRegion((BlockStatement)stmt, attributes);
-
-#line 1233 "Frames/cs.ATG"
- getBlock.StartLocation = startLocation; getBlock.EndLocation = t.EndLocation;
- }
-
- void SetAccessorDecl(
-#line 1236 "Frames/cs.ATG"
-out PropertySetRegion setBlock, List<AttributeSection> attributes) {
-
-#line 1237 "Frames/cs.ATG"
- Statement stmt = null;
- Expect(129);
-
-#line 1240 "Frames/cs.ATG"
- Location startLocation = t.Location;
- if (la.kind == 16) {
- Block(
-#line 1241 "Frames/cs.ATG"
-out stmt);
- } else if (la.kind == 11) {
- lexer.NextToken();
- } else SynErr(190);
-
-#line 1242 "Frames/cs.ATG"
- setBlock = new PropertySetRegion((BlockStatement)stmt, attributes);
-
-#line 1243 "Frames/cs.ATG"
- setBlock.StartLocation = startLocation; setBlock.EndLocation = t.EndLocation;
- }
-
- void AddAccessorDecl(
-#line 1325 "Frames/cs.ATG"
-out Statement stmt) {
-
-#line 1326 "Frames/cs.ATG"
- stmt = null;
- Expect(130);
- Block(
-#line 1329 "Frames/cs.ATG"
-out stmt);
- }
-
- void RemoveAccessorDecl(
-#line 1332 "Frames/cs.ATG"
-out Statement stmt) {
-
-#line 1333 "Frames/cs.ATG"
- stmt = null;
- Expect(131);
- Block(
-#line 1336 "Frames/cs.ATG"
-out stmt);
- }
-
- void VariableInitializer(
-#line 1354 "Frames/cs.ATG"
-out Expression initializerExpression) {
-
-#line 1355 "Frames/cs.ATG"
- TypeReference type = null; Expression expr = null; initializerExpression = null;
- if (StartOf(6)) {
- Expr(
-#line 1357 "Frames/cs.ATG"
-out initializerExpression);
- } else if (la.kind == 16) {
- CollectionInitializer(
-#line 1358 "Frames/cs.ATG"
-out initializerExpression);
- } else if (la.kind == 106) {
- lexer.NextToken();
- Type(
-#line 1359 "Frames/cs.ATG"
-out type);
- Expect(18);
- Expr(
-#line 1359 "Frames/cs.ATG"
-out expr);
- Expect(19);
-
-#line 1359 "Frames/cs.ATG"
- initializerExpression = new StackAllocExpression(type, expr);
- } else SynErr(191);
- }
-
- void Statement() {
-
-#line 1502 "Frames/cs.ATG"
- TypeReference type;
- Expression expr;
- Statement stmt = null;
- Location startPos = la.Location;
-
- while (!(StartOf(29))) {SynErr(192); lexer.NextToken(); }
- if (
-#line 1511 "Frames/cs.ATG"
-IsLabel()) {
- Identifier();
-
-#line 1511 "Frames/cs.ATG"
- compilationUnit.AddChild(new LabelStatement(t.val));
- Expect(9);
- Statement();
- } else if (la.kind == 60) {
- lexer.NextToken();
- Type(
-#line 1514 "Frames/cs.ATG"
-out type);
-
-#line 1514 "Frames/cs.ATG"
- LocalVariableDeclaration var = new LocalVariableDeclaration(type, Modifiers.Const); string ident = null; var.StartLocation = t.Location;
- Identifier();
-
-#line 1515 "Frames/cs.ATG"
- ident = t.val; Location varStart = t.Location;
- Expect(3);
- Expr(
-#line 1516 "Frames/cs.ATG"
-out expr);
-
-#line 1518 "Frames/cs.ATG"
- SafeAdd(var, var.Variables, new VariableDeclaration(ident, expr) {
- StartLocation = varStart,
- EndLocation = t.EndLocation,
- TypeReference = type
- });
-
- while (la.kind == 14) {
- lexer.NextToken();
- Identifier();
-
-#line 1524 "Frames/cs.ATG"
- ident = t.val;
- Expect(3);
- Expr(
-#line 1524 "Frames/cs.ATG"
-out expr);
-
-#line 1526 "Frames/cs.ATG"
- SafeAdd(var, var.Variables, new VariableDeclaration(ident, expr) {
- StartLocation = varStart,
- EndLocation = t.EndLocation,
- TypeReference = type
- });
-
- }
- Expect(11);
-
-#line 1532 "Frames/cs.ATG"
- var.EndLocation = t.EndLocation; if (t.Kind == Tokens.Semicolon) var.SemicolonPosition = t.EndLocation; compilationUnit.AddChild(var);
- } else if (
-#line 1535 "Frames/cs.ATG"
-IsLocalVarDecl()) {
- LocalVariableDecl(
-#line 1535 "Frames/cs.ATG"
-out stmt);
- Expect(11);
-
-#line 1535 "Frames/cs.ATG"
- if (t.Kind == Tokens.Semicolon) ((LocalVariableDeclaration)stmt).SemicolonPosition = t.EndLocation; compilationUnit.AddChild(stmt);
- } else if (StartOf(30)) {
- EmbeddedStatement(
-#line 1537 "Frames/cs.ATG"
-out stmt);
-
-#line 1537 "Frames/cs.ATG"
- compilationUnit.AddChild(stmt);
- } else SynErr(193);
-
-#line 1543 "Frames/cs.ATG"
- if (stmt != null) {
- stmt.StartLocation = startPos;
- stmt.EndLocation = t.EndLocation;
- }
-
- }
-
- void Argument(
-#line 1394 "Frames/cs.ATG"
-out Expression argumentexpr) {
-
-#line 1396 "Frames/cs.ATG"
- Expression expr;
- FieldDirection fd = FieldDirection.None;
-
- if (la.kind == 93 || la.kind == 100) {
- if (la.kind == 100) {
- lexer.NextToken();
-
-#line 1401 "Frames/cs.ATG"
- fd = FieldDirection.Ref;
- } else {
- lexer.NextToken();
-
-#line 1402 "Frames/cs.ATG"
- fd = FieldDirection.Out;
- }
- }
- Expr(
-#line 1404 "Frames/cs.ATG"
-out expr);
-
-#line 1405 "Frames/cs.ATG"
- argumentexpr = fd != FieldDirection.None ? argumentexpr = new DirectionExpression(fd, expr) : expr;
- }
-
- void CollectionInitializer(
-#line 1425 "Frames/cs.ATG"
-out Expression outExpr) {
-
-#line 1427 "Frames/cs.ATG"
- Expression expr = null;
- CollectionInitializerExpression initializer = new CollectionInitializerExpression();
-
- Expect(16);
-
-#line 1431 "Frames/cs.ATG"
- initializer.StartLocation = t.Location;
- if (StartOf(31)) {
- VariableInitializer(
-#line 1432 "Frames/cs.ATG"
-out expr);
-
-#line 1433 "Frames/cs.ATG"
- SafeAdd(initializer, initializer.CreateExpressions, expr);
- while (
-#line 1434 "Frames/cs.ATG"
-NotFinalComma()) {
- Expect(14);
- VariableInitializer(
-#line 1435 "Frames/cs.ATG"
-out expr);
-
-#line 1436 "Frames/cs.ATG"
- SafeAdd(initializer, initializer.CreateExpressions, expr);
- }
- if (la.kind == 14) {
- lexer.NextToken();
- }
- }
- Expect(17);
-
-#line 1440 "Frames/cs.ATG"
- initializer.EndLocation = t.Location; outExpr = initializer;
- }
-
- void AssignmentOperator(
-#line 1408 "Frames/cs.ATG"
-out AssignmentOperatorType op) {
-
-#line 1409 "Frames/cs.ATG"
- op = AssignmentOperatorType.None;
- if (la.kind == 3) {
- lexer.NextToken();
-
-#line 1411 "Frames/cs.ATG"
- op = AssignmentOperatorType.Assign;
- } else if (la.kind == 38) {
- lexer.NextToken();
-
-#line 1412 "Frames/cs.ATG"
- op = AssignmentOperatorType.Add;
- } else if (la.kind == 39) {
- lexer.NextToken();
-
-#line 1413 "Frames/cs.ATG"
- op = AssignmentOperatorType.Subtract;
- } else if (la.kind == 40) {
- lexer.NextToken();
-
-#line 1414 "Frames/cs.ATG"
- op = AssignmentOperatorType.Multiply;
- } else if (la.kind == 41) {
- lexer.NextToken();
-
-#line 1415 "Frames/cs.ATG"
- op = AssignmentOperatorType.Divide;
- } else if (la.kind == 42) {
- lexer.NextToken();
-
-#line 1416 "Frames/cs.ATG"
- op = AssignmentOperatorType.Modulus;
- } else if (la.kind == 43) {
- lexer.NextToken();
-
-#line 1417 "Frames/cs.ATG"
- op = AssignmentOperatorType.BitwiseAnd;
- } else if (la.kind == 44) {
- lexer.NextToken();
-
-#line 1418 "Frames/cs.ATG"
- op = AssignmentOperatorType.BitwiseOr;
- } else if (la.kind == 45) {
- lexer.NextToken();
-
-#line 1419 "Frames/cs.ATG"
- op = AssignmentOperatorType.ExclusiveOr;
- } else if (la.kind == 46) {
- lexer.NextToken();
-
-#line 1420 "Frames/cs.ATG"
- op = AssignmentOperatorType.ShiftLeft;
- } else if (
-#line 1421 "Frames/cs.ATG"
-la.kind == Tokens.GreaterThan && Peek(1).kind == Tokens.GreaterEqual) {
- Expect(22);
- Expect(35);
-
-#line 1422 "Frames/cs.ATG"
- op = AssignmentOperatorType.ShiftRight;
- } else SynErr(194);
- }
-
- void CollectionOrObjectInitializer(
-#line 1443 "Frames/cs.ATG"
-out Expression outExpr) {
-
-#line 1445 "Frames/cs.ATG"
- Expression expr = null;
- CollectionInitializerExpression initializer = new CollectionInitializerExpression();
-
- Expect(16);
-
-#line 1449 "Frames/cs.ATG"
- initializer.StartLocation = t.Location;
- if (StartOf(31)) {
- ObjectPropertyInitializerOrVariableInitializer(
-#line 1450 "Frames/cs.ATG"
-out expr);
-
-#line 1451 "Frames/cs.ATG"
- SafeAdd(initializer, initializer.CreateExpressions, expr);
- while (
-#line 1452 "Frames/cs.ATG"
-NotFinalComma()) {
- Expect(14);
- ObjectPropertyInitializerOrVariableInitializer(
-#line 1453 "Frames/cs.ATG"
-out expr);
-
-#line 1454 "Frames/cs.ATG"
- SafeAdd(initializer, initializer.CreateExpressions, expr);
- }
- if (la.kind == 14) {
- lexer.NextToken();
- }
- }
- Expect(17);
-
-#line 1458 "Frames/cs.ATG"
- initializer.EndLocation = t.Location; outExpr = initializer;
- }
-
- void ObjectPropertyInitializerOrVariableInitializer(
-#line 1461 "Frames/cs.ATG"
-out Expression expr) {
-
-#line 1462 "Frames/cs.ATG"
- expr = null;
- if (
-#line 1464 "Frames/cs.ATG"
-IdentAndAsgn()) {
- Identifier();
-
-#line 1466 "Frames/cs.ATG"
- NamedArgumentExpression nae = new NamedArgumentExpression(t.val, null);
- nae.StartLocation = t.Location;
- Expression r = null;
- Expect(3);
- if (la.kind == 16) {
- CollectionOrObjectInitializer(
-#line 1470 "Frames/cs.ATG"
-out r);
- } else if (StartOf(31)) {
- VariableInitializer(
-#line 1471 "Frames/cs.ATG"
-out r);
- } else SynErr(195);
-
-#line 1472 "Frames/cs.ATG"
- nae.Expression = r; nae.EndLocation = t.EndLocation; expr = nae;
- } else if (StartOf(31)) {
- VariableInitializer(
-#line 1474 "Frames/cs.ATG"
-out expr);
- } else SynErr(196);
- }
-
- void LocalVariableDecl(
-#line 1478 "Frames/cs.ATG"
-out Statement stmt) {
-
-#line 1480 "Frames/cs.ATG"
- TypeReference type;
- VariableDeclaration var = null;
- LocalVariableDeclaration localVariableDeclaration;
- Location startPos = la.Location;
-
- Type(
-#line 1486 "Frames/cs.ATG"
-out type);
-
-#line 1486 "Frames/cs.ATG"
- localVariableDeclaration = new LocalVariableDeclaration(type); localVariableDeclaration.StartLocation = startPos;
- LocalVariableDeclarator(
-#line 1487 "Frames/cs.ATG"
-out var);
-
-#line 1487 "Frames/cs.ATG"
- SafeAdd(localVariableDeclaration, localVariableDeclaration.Variables, var);
- while (la.kind == 14) {
- lexer.NextToken();
- LocalVariableDeclarator(
-#line 1488 "Frames/cs.ATG"
-out var);
-
-#line 1488 "Frames/cs.ATG"
- SafeAdd(localVariableDeclaration, localVariableDeclaration.Variables, var);
- }
-
-#line 1489 "Frames/cs.ATG"
- stmt = localVariableDeclaration; stmt.EndLocation = t.EndLocation;
- }
-
- void LocalVariableDeclarator(
-#line 1492 "Frames/cs.ATG"
-out VariableDeclaration var) {
-
-#line 1493 "Frames/cs.ATG"
- Expression expr = null;
- Identifier();
-
-#line 1495 "Frames/cs.ATG"
- var = new VariableDeclaration(t.val); var.StartLocation = t.Location;
- if (la.kind == 3) {
- lexer.NextToken();
- VariableInitializer(
-#line 1496 "Frames/cs.ATG"
-out expr);
-
-#line 1496 "Frames/cs.ATG"
- var.Initializer = expr;
- }
-
-#line 1497 "Frames/cs.ATG"
- var.EndLocation = t.EndLocation;
- }
-
- void EmbeddedStatement(
-#line 1550 "Frames/cs.ATG"
-out Statement statement) {
-
-#line 1552 "Frames/cs.ATG"
- TypeReference type = null;
- Expression expr = null;
- Statement embeddedStatement = null;
- statement = null;
-
-
-#line 1558 "Frames/cs.ATG"
- Location startLocation = la.Location;
- if (la.kind == 16) {
- Block(
-#line 1560 "Frames/cs.ATG"
-out statement);
- } else if (la.kind == 11) {
- lexer.NextToken();
-
-#line 1563 "Frames/cs.ATG"
- statement = new EmptyStatement();
- } else if (
-#line 1566 "Frames/cs.ATG"
-UnCheckedAndLBrace()) {
-
-#line 1566 "Frames/cs.ATG"
- Statement block; bool isChecked = true;
- if (la.kind == 58) {
- lexer.NextToken();
- } else if (la.kind == 118) {
- lexer.NextToken();
-
-#line 1567 "Frames/cs.ATG"
- isChecked = false;
- } else SynErr(197);
- Block(
-#line 1568 "Frames/cs.ATG"
-out block);
-
-#line 1568 "Frames/cs.ATG"
- statement = isChecked ? (Statement)new CheckedStatement(block) : (Statement)new UncheckedStatement(block);
- } else if (la.kind == 79) {
- IfStatement(
-#line 1571 "Frames/cs.ATG"
-out statement);
- } else if (la.kind == 110) {
- lexer.NextToken();
-
-#line 1573 "Frames/cs.ATG"
- List<SwitchSection> switchSections = new List<SwitchSection>();
- Expect(20);
- Expr(
-#line 1574 "Frames/cs.ATG"
-out expr);
- Expect(21);
- Expect(16);
- SwitchSections(
-#line 1575 "Frames/cs.ATG"
-switchSections);
- Expect(17);
-
-#line 1577 "Frames/cs.ATG"
- statement = new SwitchStatement(expr, switchSections);
- } else if (la.kind == 125) {
- lexer.NextToken();
- Expect(20);
- Expr(
-#line 1580 "Frames/cs.ATG"
-out expr);
- Expect(21);
- EmbeddedStatement(
-#line 1581 "Frames/cs.ATG"
-out embeddedStatement);
-
-#line 1582 "Frames/cs.ATG"
- statement = new DoLoopStatement(expr, embeddedStatement, ConditionType.While, ConditionPosition.Start);
- } else if (la.kind == 65) {
- lexer.NextToken();
- EmbeddedStatement(
-#line 1584 "Frames/cs.ATG"
-out embeddedStatement);
- Expect(125);
- Expect(20);
- Expr(
-#line 1585 "Frames/cs.ATG"
-out expr);
- Expect(21);
- Expect(11);
-
-#line 1586 "Frames/cs.ATG"
- statement = new DoLoopStatement(expr, embeddedStatement, ConditionType.While, ConditionPosition.End);
- } else if (la.kind == 76) {
- lexer.NextToken();
-
-#line 1588 "Frames/cs.ATG"
- List<Statement> initializer = null; List<Statement> iterator = null;
- Expect(20);
- if (StartOf(6)) {
- ForInitializer(
-#line 1589 "Frames/cs.ATG"
-out initializer);
- }
- Expect(11);
- if (StartOf(6)) {
- Expr(
-#line 1590 "Frames/cs.ATG"
-out expr);
- }
- Expect(11);
- if (StartOf(6)) {
- ForIterator(
-#line 1591 "Frames/cs.ATG"
-out iterator);
- }
- Expect(21);
- EmbeddedStatement(
-#line 1592 "Frames/cs.ATG"
-out embeddedStatement);
-
-#line 1593 "Frames/cs.ATG"
- statement = new ForStatement(initializer, expr, iterator, embeddedStatement);
- } else if (la.kind == 77) {
- lexer.NextToken();
- Expect(20);
- Type(
-#line 1595 "Frames/cs.ATG"
-out type);
- Identifier();
-
-#line 1595 "Frames/cs.ATG"
- string varName = t.val;
- Expect(81);
- Expr(
-#line 1596 "Frames/cs.ATG"
-out expr);
- Expect(21);
- EmbeddedStatement(
-#line 1597 "Frames/cs.ATG"
-out embeddedStatement);
-
-#line 1598 "Frames/cs.ATG"
- statement = new ForeachStatement(type, varName , expr, embeddedStatement);
- } else if (la.kind == 53) {
- lexer.NextToken();
- Expect(11);
-
-#line 1601 "Frames/cs.ATG"
- statement = new BreakStatement();
- } else if (la.kind == 61) {
- lexer.NextToken();
- Expect(11);
-
-#line 1602 "Frames/cs.ATG"
- statement = new ContinueStatement();
- } else if (la.kind == 78) {
- GotoStatement(
-#line 1603 "Frames/cs.ATG"
-out statement);
- } else if (
-#line 1605 "Frames/cs.ATG"
-IsYieldStatement()) {
- Expect(132);
- if (la.kind == 101) {
- lexer.NextToken();
- Expr(
-#line 1606 "Frames/cs.ATG"
-out expr);
-
-#line 1606 "Frames/cs.ATG"
- statement = new YieldStatement(new ReturnStatement(expr));
- } else if (la.kind == 53) {
- lexer.NextToken();
-
-#line 1607 "Frames/cs.ATG"
- statement = new YieldStatement(new BreakStatement());
- } else SynErr(198);
- Expect(11);
- } else if (la.kind == 101) {
- lexer.NextToken();
- if (StartOf(6)) {
- Expr(
-#line 1610 "Frames/cs.ATG"
-out expr);
- }
- Expect(11);
-
-#line 1610 "Frames/cs.ATG"
- statement = new ReturnStatement(expr);
- } else if (la.kind == 112) {
- lexer.NextToken();
- if (StartOf(6)) {
- Expr(
-#line 1611 "Frames/cs.ATG"
-out expr);
- }
- Expect(11);
-
-#line 1611 "Frames/cs.ATG"
- statement = new ThrowStatement(expr);
- } else if (StartOf(6)) {
- StatementExpr(
-#line 1614 "Frames/cs.ATG"
-out statement);
- while (!(la.kind == 0 || la.kind == 11)) {SynErr(199); lexer.NextToken(); }
- Expect(11);
- } else if (la.kind == 114) {
- TryStatement(
-#line 1617 "Frames/cs.ATG"
-out statement);
- } else if (la.kind == 86) {
- lexer.NextToken();
- Expect(20);
- Expr(
-#line 1620 "Frames/cs.ATG"
-out expr);
- Expect(21);
- EmbeddedStatement(
-#line 1621 "Frames/cs.ATG"
-out embeddedStatement);
-
-#line 1621 "Frames/cs.ATG"
- statement = new LockStatement(expr, embeddedStatement);
- } else if (la.kind == 121) {
-
-#line 1624 "Frames/cs.ATG"
- Statement resourceAcquisitionStmt = null;
- lexer.NextToken();
- Expect(20);
- ResourceAcquisition(
-#line 1626 "Frames/cs.ATG"
-out resourceAcquisitionStmt);
- Expect(21);
- EmbeddedStatement(
-#line 1627 "Frames/cs.ATG"
-out embeddedStatement);
-
-#line 1627 "Frames/cs.ATG"
- statement = new UsingStatement(resourceAcquisitionStmt, embeddedStatement);
- } else if (la.kind == 119) {
- lexer.NextToken();
- Block(
-#line 1630 "Frames/cs.ATG"
-out embeddedStatement);
-
-#line 1630 "Frames/cs.ATG"
- statement = new UnsafeStatement(embeddedStatement);
- } else if (la.kind == 74) {
-
-#line 1632 "Frames/cs.ATG"
- Statement pointerDeclarationStmt = null;
- lexer.NextToken();
- Expect(20);
- ResourceAcquisition(
-#line 1634 "Frames/cs.ATG"
-out pointerDeclarationStmt);
- Expect(21);
- EmbeddedStatement(
-#line 1635 "Frames/cs.ATG"
-out embeddedStatement);
-
-#line 1635 "Frames/cs.ATG"
- statement = new FixedStatement(pointerDeclarationStmt, embeddedStatement);
- } else SynErr(200);
-
-#line 1637 "Frames/cs.ATG"
- if (statement != null) {
- statement.StartLocation = startLocation;
- statement.EndLocation = t.EndLocation;
- }
-
- }
-
- void IfStatement(
-#line 1644 "Frames/cs.ATG"
-out Statement statement) {
-
-#line 1646 "Frames/cs.ATG"
- Expression expr = null;
- Statement embeddedStatement = null;
- statement = null;
- Location elseStart = Location.Empty;
-
- Expect(79);
- Expect(20);
- Expr(
-#line 1653 "Frames/cs.ATG"
-out expr);
- Expect(21);
- EmbeddedStatement(
-#line 1654 "Frames/cs.ATG"
-out embeddedStatement);
-
-#line 1655 "Frames/cs.ATG"
- Statement elseStatement = null;
- if (la.kind == 67) {
- lexer.NextToken();
-
-#line 1656 "Frames/cs.ATG"
- elseStart = t.Location;
- EmbeddedStatement(
-#line 1656 "Frames/cs.ATG"
-out elseStatement);
- }
-
-#line 1657 "Frames/cs.ATG"
- statement = elseStatement != null ? new IfElseStatement(expr, embeddedStatement, elseStatement) : new IfElseStatement(expr, embeddedStatement);
-
-#line 1658 "Frames/cs.ATG"
- if (elseStatement is IfElseStatement && (elseStatement as IfElseStatement).TrueStatement.Count == 1) {
- /* else if-section (otherwise we would have a BlockStatment) */
- ElseIfSection elseIfSection = new ElseIfSection((elseStatement as IfElseStatement).Condition, (elseStatement as IfElseStatement).TrueStatement[0]);
- elseIfSection.StartLocation = elseStart;
- elseIfSection.EndLocation = (elseStatement as IfElseStatement).TrueStatement[0].EndLocation;
- (statement as IfElseStatement).ElseIfSections.Add(elseIfSection);
- (statement as IfElseStatement).ElseIfSections.AddRange((elseStatement as IfElseStatement).ElseIfSections);
- (statement as IfElseStatement).FalseStatement = (elseStatement as IfElseStatement).FalseStatement;
- }
-
- }
-
- void SwitchSections(
-#line 1689 "Frames/cs.ATG"
-List<SwitchSection> switchSections) {
-
-#line 1691 "Frames/cs.ATG"
- SwitchSection switchSection = new SwitchSection();
- CaseLabel label;
-
- SwitchLabel(
-#line 1695 "Frames/cs.ATG"
-out label);
-
-#line 1695 "Frames/cs.ATG"
- SafeAdd(switchSection, switchSection.SwitchLabels, label);
-
-#line 1696 "Frames/cs.ATG"
- compilationUnit.BlockStart(switchSection);
- while (StartOf(32)) {
- if (la.kind == 55 || la.kind == 63) {
- SwitchLabel(
-#line 1698 "Frames/cs.ATG"
-out label);
-
-#line 1699 "Frames/cs.ATG"
- if (label != null) {
- if (switchSection.Children.Count > 0) {
- // open new section
- compilationUnit.BlockEnd(); switchSections.Add(switchSection);
- switchSection = new SwitchSection();
- compilationUnit.BlockStart(switchSection);
- }
- SafeAdd(switchSection, switchSection.SwitchLabels, label);
- }
-
- } else {
- Statement();
- }
- }
-
-#line 1711 "Frames/cs.ATG"
- compilationUnit.BlockEnd(); switchSections.Add(switchSection);
- }
-
- void ForInitializer(
-#line 1670 "Frames/cs.ATG"
-out List<Statement> initializer) {
-
-#line 1672 "Frames/cs.ATG"
- Statement stmt;
- initializer = new List<Statement>();
-
- if (
-#line 1676 "Frames/cs.ATG"
-IsLocalVarDecl()) {
- LocalVariableDecl(
-#line 1676 "Frames/cs.ATG"
-out stmt);
-
-#line 1676 "Frames/cs.ATG"
- ((LocalVariableDeclaration)stmt).SemicolonPosition = t.EndLocation; initializer.Add(stmt);
- } else if (StartOf(6)) {
- StatementExpr(
-#line 1677 "Frames/cs.ATG"
-out stmt);
-
-#line 1677 "Frames/cs.ATG"
- initializer.Add(stmt);
- while (la.kind == 14) {
- lexer.NextToken();
- StatementExpr(
-#line 1677 "Frames/cs.ATG"
-out stmt);
-
-#line 1677 "Frames/cs.ATG"
- initializer.Add(stmt);
- }
- } else SynErr(201);
- }
-
- void ForIterator(
-#line 1680 "Frames/cs.ATG"
-out List<Statement> iterator) {
-
-#line 1682 "Frames/cs.ATG"
- Statement stmt;
- iterator = new List<Statement>();
-
- StatementExpr(
-#line 1686 "Frames/cs.ATG"
-out stmt);
-
-#line 1686 "Frames/cs.ATG"
- iterator.Add(stmt);
- while (la.kind == 14) {
- lexer.NextToken();
- StatementExpr(
-#line 1686 "Frames/cs.ATG"
-out stmt);
-
-#line 1686 "Frames/cs.ATG"
- iterator.Add(stmt);
- }
- }
-
- void GotoStatement(
-#line 1768 "Frames/cs.ATG"
-out Statement stmt) {
-
-#line 1769 "Frames/cs.ATG"
- Expression expr; stmt = null;
- Expect(78);
- if (StartOf(19)) {
- Identifier();
-
-#line 1773 "Frames/cs.ATG"
- stmt = new GotoStatement(t.val);
- Expect(11);
- } else if (la.kind == 55) {
- lexer.NextToken();
- Expr(
-#line 1774 "Frames/cs.ATG"
-out expr);
- Expect(11);
-
-#line 1774 "Frames/cs.ATG"
- stmt = new GotoCaseStatement(expr);
- } else if (la.kind == 63) {
- lexer.NextToken();
- Expect(11);
-
-#line 1775 "Frames/cs.ATG"
- stmt = new GotoCaseStatement(null);
- } else SynErr(202);
- }
-
- void StatementExpr(
-#line 1795 "Frames/cs.ATG"
-out Statement stmt) {
-
-#line 1796 "Frames/cs.ATG"
- Expression expr;
- Expr(
-#line 1798 "Frames/cs.ATG"
-out expr);
-
-#line 1801 "Frames/cs.ATG"
- stmt = new ExpressionStatement(expr); if (expr is PrimitiveExpression) Error("Primitive expressions are not allowed as statements.");
- }
-
- void TryStatement(
-#line 1721 "Frames/cs.ATG"
-out Statement tryStatement) {
-
-#line 1723 "Frames/cs.ATG"
- Statement blockStmt = null, finallyStmt = null;
- CatchClause catchClause = null;
- List<CatchClause> catchClauses = new List<CatchClause>();
-
- Expect(114);
- Block(
-#line 1728 "Frames/cs.ATG"
-out blockStmt);
- while (la.kind == 56) {
- CatchClause(
-#line 1730 "Frames/cs.ATG"
-out catchClause);
-
-#line 1731 "Frames/cs.ATG"
- if (catchClause != null) catchClauses.Add(catchClause);
- }
- if (la.kind == 73) {
- lexer.NextToken();
- Block(
-#line 1733 "Frames/cs.ATG"
-out finallyStmt);
- }
-
-#line 1735 "Frames/cs.ATG"
- tryStatement = new TryCatchStatement(blockStmt, catchClauses, finallyStmt);
- if (catchClauses != null) {
- foreach (CatchClause cc in catchClauses) cc.Parent = tryStatement;
- }
-
- }
-
- void ResourceAcquisition(
-#line 1779 "Frames/cs.ATG"
-out Statement stmt) {
-
-#line 1781 "Frames/cs.ATG"
- stmt = null;
- Expression expr;
-
- if (
-#line 1786 "Frames/cs.ATG"
-IsLocalVarDecl()) {
- LocalVariableDecl(
-#line 1786 "Frames/cs.ATG"
-out stmt);
-
-#line 1786 "Frames/cs.ATG"
- ((LocalVariableDeclaration)stmt).SemicolonPosition = t.EndLocation;
- } else if (StartOf(6)) {
- Expr(
-#line 1787 "Frames/cs.ATG"
-out expr);
-
-#line 1791 "Frames/cs.ATG"
- stmt = new ExpressionStatement(expr);
- } else SynErr(203);
- }
-
- void SwitchLabel(
-#line 1714 "Frames/cs.ATG"
-out CaseLabel label) {
-
-#line 1715 "Frames/cs.ATG"
- Expression expr = null; label = null;
- if (la.kind == 55) {
- lexer.NextToken();
- Expr(
-#line 1717 "Frames/cs.ATG"
-out expr);
- Expect(9);
-
-#line 1717 "Frames/cs.ATG"
- label = new CaseLabel(expr);
- } else if (la.kind == 63) {
- lexer.NextToken();
- Expect(9);
-
-#line 1718 "Frames/cs.ATG"
- label = new CaseLabel();
- } else SynErr(204);
- }
-
- void CatchClause(
-#line 1742 "Frames/cs.ATG"
-out CatchClause catchClause) {
- Expect(56);
-
-#line 1744 "Frames/cs.ATG"
- string identifier;
- Statement stmt;
- TypeReference typeRef;
- Location startPos = t.Location;
- catchClause = null;
-
- if (la.kind == 16) {
- Block(
-#line 1752 "Frames/cs.ATG"
-out stmt);
-
-#line 1752 "Frames/cs.ATG"
- catchClause = new CatchClause(stmt);
- } else if (la.kind == 20) {
- lexer.NextToken();
- ClassType(
-#line 1755 "Frames/cs.ATG"
-out typeRef, false);
-
-#line 1755 "Frames/cs.ATG"
- identifier = null;
- if (StartOf(19)) {
- Identifier();
-
-#line 1756 "Frames/cs.ATG"
- identifier = t.val;
- }
- Expect(21);
- Block(
-#line 1757 "Frames/cs.ATG"
-out stmt);
-
-#line 1758 "Frames/cs.ATG"
- catchClause = new CatchClause(typeRef, identifier, stmt);
- } else SynErr(205);
-
-#line 1761 "Frames/cs.ATG"
- if (catchClause != null) {
- catchClause.StartLocation = startPos;
- catchClause.EndLocation = t.Location;
- }
-
- }
-
- void UnaryExpr(
-#line 1828 "Frames/cs.ATG"
-out Expression uExpr) {
-
-#line 1830 "Frames/cs.ATG"
- TypeReference type = null;
- Expression expr = null;
- ArrayList expressions = new ArrayList();
- uExpr = null;
-
- while (StartOf(33) ||
-#line 1852 "Frames/cs.ATG"
-IsTypeCast()) {
- if (la.kind == 4) {
- lexer.NextToken();
-
-#line 1839 "Frames/cs.ATG"
- expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Plus));
- } else if (la.kind == 5) {
- lexer.NextToken();
-
-#line 1840 "Frames/cs.ATG"
- expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Minus));
- } else if (la.kind == 24) {
- lexer.NextToken();
-
-#line 1841 "Frames/cs.ATG"
- expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Not));
- } else if (la.kind == 27) {
- lexer.NextToken();
-
-#line 1842 "Frames/cs.ATG"
- expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.BitNot));
- } else if (la.kind == 6) {
- lexer.NextToken();
-
-#line 1843 "Frames/cs.ATG"
- expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Dereference));
- } else if (la.kind == 31) {
- lexer.NextToken();
-
-#line 1844 "Frames/cs.ATG"
- expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Increment));
- } else if (la.kind == 32) {
- lexer.NextToken();
-
-#line 1845 "Frames/cs.ATG"
- expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Decrement));
- } else if (la.kind == 28) {
- lexer.NextToken();
-
-#line 1846 "Frames/cs.ATG"
- expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.AddressOf));
- } else {
- Expect(20);
- Type(
-#line 1852 "Frames/cs.ATG"
-out type);
- Expect(21);
-
-#line 1852 "Frames/cs.ATG"
- expressions.Add(new CastExpression(type));
- }
- }
- if (
-#line 1857 "Frames/cs.ATG"
-LastExpressionIsUnaryMinus(expressions) && IsMostNegativeIntegerWithoutTypeSuffix()) {
- Expect(2);
-
-#line 1860 "Frames/cs.ATG"
- expressions.RemoveAt(expressions.Count - 1);
- if (t.literalValue is uint) {
- expr = new PrimitiveExpression(int.MinValue, int.MinValue.ToString());
- } else if (t.literalValue is ulong) {
- expr = new PrimitiveExpression(long.MinValue, long.MinValue.ToString());
- } else {
- throw new Exception("t.literalValue must be uint or ulong");
- }
-
- } else if (StartOf(34)) {
- PrimaryExpr(
-#line 1869 "Frames/cs.ATG"
-out expr);
- } else SynErr(206);
-
-#line 1871 "Frames/cs.ATG"
- for (int i = 0; i < expressions.Count; ++i) {
- Expression nextExpression = i + 1 < expressions.Count ? (Expression)expressions[i + 1] : expr;
- if (expressions[i] is CastExpression) {
- ((CastExpression)expressions[i]).Expression = nextExpression;
- } else {
- ((UnaryOperatorExpression)expressions[i]).Expression = nextExpression;
- }
- }
- if (expressions.Count > 0) {
- uExpr = (Expression)expressions[0];
- } else {
- uExpr = expr;
- }
-
- }
-
- void ConditionalOrExpr(
-#line 2193 "Frames/cs.ATG"
-ref Expression outExpr) {
-
-#line 2194 "Frames/cs.ATG"
- Expression expr;
- ConditionalAndExpr(
-#line 2196 "Frames/cs.ATG"
-ref outExpr);
- while (la.kind == 26) {
- lexer.NextToken();
- UnaryExpr(
-#line 2196 "Frames/cs.ATG"
-out expr);
- ConditionalAndExpr(
-#line 2196 "Frames/cs.ATG"
-ref expr);
-
-#line 2196 "Frames/cs.ATG"
- outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.LogicalOr, expr);
- }
- }
-
- void PrimaryExpr(
-#line 1888 "Frames/cs.ATG"
-out Expression pexpr) {
-
-#line 1890 "Frames/cs.ATG"
- TypeReference type = null;
- Expression expr;
- pexpr = null;
-
-
-#line 1895 "Frames/cs.ATG"
- Location startLocation = la.Location;
- if (la.kind == 113) {
- lexer.NextToken();
-
-#line 1897 "Frames/cs.ATG"
- pexpr = new PrimitiveExpression(true, "true");
- } else if (la.kind == 72) {
- lexer.NextToken();
-
-#line 1898 "Frames/cs.ATG"
- pexpr = new PrimitiveExpression(false, "false");
- } else if (la.kind == 90) {
- lexer.NextToken();
-
-#line 1899 "Frames/cs.ATG"
- pexpr = new PrimitiveExpression(null, "null");
- } else if (la.kind == 2) {
- lexer.NextToken();
-
-#line 1900 "Frames/cs.ATG"
- pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat };
- } else if (
-#line 1901 "Frames/cs.ATG"
-StartOfQueryExpression()) {
- QueryExpression(
-#line 1902 "Frames/cs.ATG"
-out pexpr);
- } else if (
-#line 1903 "Frames/cs.ATG"
-IdentAndDoubleColon()) {
- Identifier();
-
-#line 1904 "Frames/cs.ATG"
- type = new TypeReference(t.val);
- Expect(10);
-
-#line 1905 "Frames/cs.ATG"
- pexpr = new TypeReferenceExpression(type);
- Identifier();
-
-#line 1906 "Frames/cs.ATG"
- if (type.Type == "global") { type.IsGlobal = true; type.Type = t.val ?? "?"; } else type.Type += "." + (t.val ?? "?");
- } else if (StartOf(19)) {
- Identifier();
-
-#line 1910 "Frames/cs.ATG"
- pexpr = new IdentifierExpression(t.val);
- if (la.kind == 48 ||
-#line 1913 "Frames/cs.ATG"
-IsGenericInSimpleNameOrMemberAccess()) {
- if (la.kind == 48) {
- ShortedLambdaExpression(
-#line 1912 "Frames/cs.ATG"
-(IdentifierExpression)pexpr, out pexpr);
- } else {
-
-#line 1914 "Frames/cs.ATG"
- List<TypeReference> typeList;
- TypeArgumentList(
-#line 1915 "Frames/cs.ATG"
-out typeList, false);
-
-#line 1916 "Frames/cs.ATG"
- ((IdentifierExpression)pexpr).TypeArguments = typeList;
- }
- }
- } else if (
-#line 1918 "Frames/cs.ATG"
-IsLambdaExpression()) {
- LambdaExpression(
-#line 1919 "Frames/cs.ATG"
-out pexpr);
- } else if (la.kind == 20) {
- lexer.NextToken();
- Expr(
-#line 1922 "Frames/cs.ATG"
-out expr);
- Expect(21);
-
-#line 1922 "Frames/cs.ATG"
- pexpr = new ParenthesizedExpression(expr);
- } else if (StartOf(35)) {
-
-#line 1925 "Frames/cs.ATG"
- string val = null;
- switch (la.kind) {
- case 52: {
- lexer.NextToken();
-
-#line 1926 "Frames/cs.ATG"
- val = "System.Boolean";
- break;
- }
- case 54: {
- lexer.NextToken();
-
-#line 1927 "Frames/cs.ATG"
- val = "System.Byte";
- break;
- }
- case 57: {
- lexer.NextToken();
-
-#line 1928 "Frames/cs.ATG"
- val = "System.Char";
- break;
- }
- case 62: {
- lexer.NextToken();
-
-#line 1929 "Frames/cs.ATG"
- val = "System.Decimal";
- break;
- }
- case 66: {
- lexer.NextToken();
-
-#line 1930 "Frames/cs.ATG"
- val = "System.Double";
- break;
- }
- case 75: {
- lexer.NextToken();
-
-#line 1931 "Frames/cs.ATG"
- val = "System.Single";
- break;
- }
- case 82: {
- lexer.NextToken();
-
-#line 1932 "Frames/cs.ATG"
- val = "System.Int32";
- break;
- }
- case 87: {
- lexer.NextToken();
-
-#line 1933 "Frames/cs.ATG"
- val = "System.Int64";
- break;
- }
- case 91: {
- lexer.NextToken();
-
-#line 1934 "Frames/cs.ATG"
- val = "System.Object";
- break;
- }
- case 102: {
- lexer.NextToken();
-
-#line 1935 "Frames/cs.ATG"
- val = "System.SByte";
- break;
- }
- case 104: {
- lexer.NextToken();
-
-#line 1936 "Frames/cs.ATG"
- val = "System.Int16";
- break;
- }
- case 108: {
- lexer.NextToken();
-
-#line 1937 "Frames/cs.ATG"
- val = "System.String";
- break;
- }
- case 116: {
- lexer.NextToken();
-
-#line 1938 "Frames/cs.ATG"
- val = "System.UInt32";
- break;
- }
- case 117: {
- lexer.NextToken();
-
-#line 1939 "Frames/cs.ATG"
- val = "System.UInt64";
- break;
- }
- case 120: {
- lexer.NextToken();
-
-#line 1940 "Frames/cs.ATG"
- val = "System.UInt16";
- break;
- }
- case 123: {
- lexer.NextToken();
-
-#line 1941 "Frames/cs.ATG"
- val = "System.Void";
- break;
- }
- }
-
-#line 1943 "Frames/cs.ATG"
- pexpr = new TypeReferenceExpression(new TypeReference(val, true)) { StartLocation = t.Location, EndLocation = t.EndLocation };
- } else if (la.kind == 111) {
- lexer.NextToken();
-
-#line 1946 "Frames/cs.ATG"
- pexpr = new ThisReferenceExpression(); pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation;
- } else if (la.kind == 51) {
- lexer.NextToken();
-
-#line 1948 "Frames/cs.ATG"
- pexpr = new BaseReferenceExpression(); pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation;
- } else if (la.kind == 89) {
- NewExpression(
-#line 1951 "Frames/cs.ATG"
-out pexpr);
- } else if (la.kind == 115) {
- lexer.NextToken();
- Expect(20);
- if (
-#line 1955 "Frames/cs.ATG"
-NotVoidPointer()) {
- Expect(123);
-
-#line 1955 "Frames/cs.ATG"
- type = new TypeReference("System.Void", true);
- } else if (StartOf(10)) {
- TypeWithRestriction(
-#line 1956 "Frames/cs.ATG"
-out type, true, true);
- } else SynErr(207);
- Expect(21);
-
-#line 1958 "Frames/cs.ATG"
- pexpr = new TypeOfExpression(type);
- } else if (la.kind == 63) {
- lexer.NextToken();
- Expect(20);
- Type(
-#line 1960 "Frames/cs.ATG"
-out type);
- Expect(21);
-
-#line 1960 "Frames/cs.ATG"
- pexpr = new DefaultValueExpression(type);
- } else if (la.kind == 105) {
- lexer.NextToken();
- Expect(20);
- Type(
-#line 1961 "Frames/cs.ATG"
-out type);
- Expect(21);
-
-#line 1961 "Frames/cs.ATG"
- pexpr = new SizeOfExpression(type);
- } else if (la.kind == 58) {
- lexer.NextToken();
- Expect(20);
- Expr(
-#line 1962 "Frames/cs.ATG"
-out expr);
- Expect(21);
-
-#line 1962 "Frames/cs.ATG"
- pexpr = new CheckedExpression(expr);
- } else if (la.kind == 118) {
- lexer.NextToken();
- Expect(20);
- Expr(
-#line 1963 "Frames/cs.ATG"
-out expr);
- Expect(21);
-
-#line 1963 "Frames/cs.ATG"
- pexpr = new UncheckedExpression(expr);
- } else if (la.kind == 64) {
- lexer.NextToken();
- AnonymousMethodExpr(
-#line 1964 "Frames/cs.ATG"
-out expr);
-
-#line 1964 "Frames/cs.ATG"
- pexpr = expr;
- } else SynErr(208);
-
-#line 1966 "Frames/cs.ATG"
- if (pexpr != null) {
- if (pexpr.StartLocation.IsEmpty)
- pexpr.StartLocation = startLocation;
- if (pexpr.EndLocation.IsEmpty)
- pexpr.EndLocation = t.EndLocation;
- }
-
- while (StartOf(36)) {
- if (la.kind == 31 || la.kind == 32) {
-
-#line 1974 "Frames/cs.ATG"
- startLocation = la.Location;
- if (la.kind == 31) {
- lexer.NextToken();
-
-#line 1976 "Frames/cs.ATG"
- pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostIncrement);
- } else if (la.kind == 32) {
- lexer.NextToken();
-
-#line 1977 "Frames/cs.ATG"
- pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostDecrement);
- } else SynErr(209);
- } else if (la.kind == 47) {
- PointerMemberAccess(
-#line 1980 "Frames/cs.ATG"
-out pexpr, pexpr);
- } else if (la.kind == 15) {
- MemberAccess(
-#line 1981 "Frames/cs.ATG"
-out pexpr, pexpr);
- } else if (la.kind == 20) {
- lexer.NextToken();
-
-#line 1985 "Frames/cs.ATG"
- List<Expression> parameters = new List<Expression>();
-
-#line 1986 "Frames/cs.ATG"
- pexpr = new InvocationExpression(pexpr, parameters); pexpr.StartLocation = startLocation;
- if (StartOf(26)) {
- Argument(
-#line 1987 "Frames/cs.ATG"
-out expr);
-
-#line 1987 "Frames/cs.ATG"
- SafeAdd(pexpr, parameters, expr);
- while (la.kind == 14) {
- lexer.NextToken();
- Argument(
-#line 1988 "Frames/cs.ATG"
-out expr);
-
-#line 1988 "Frames/cs.ATG"
- SafeAdd(pexpr, parameters, expr);
- }
- }
- Expect(21);
- } else {
-
-#line 1994 "Frames/cs.ATG"
- List<Expression> indices = new List<Expression>();
- pexpr = new IndexerExpression(pexpr, indices);
-
- lexer.NextToken();
- Expr(
-#line 1997 "Frames/cs.ATG"
-out expr);
-
-#line 1997 "Frames/cs.ATG"
- SafeAdd(pexpr, indices, expr);
- while (la.kind == 14) {
- lexer.NextToken();
- Expr(
-#line 1998 "Frames/cs.ATG"
-out expr);
-
-#line 1998 "Frames/cs.ATG"
- SafeAdd(pexpr, indices, expr);
- }
- Expect(19);
-
-#line 2001 "Frames/cs.ATG"
- if (pexpr != null) {
- pexpr.StartLocation = startLocation;
- pexpr.EndLocation = t.EndLocation;
- }
-
- }
- }
- }
-
- void QueryExpression(
-#line 2431 "Frames/cs.ATG"
-out Expression outExpr) {
-
-#line 2432 "Frames/cs.ATG"
- QueryExpression q = new QueryExpression(); outExpr = q; q.StartLocation = la.Location;
- QueryExpressionFromClause fromClause;
-
- QueryExpressionFromClause(
-#line 2436 "Frames/cs.ATG"
-out fromClause);
-
-#line 2436 "Frames/cs.ATG"
- q.FromClause = fromClause;
- QueryExpressionBody(
-#line 2437 "Frames/cs.ATG"
-ref q);
-
-#line 2438 "Frames/cs.ATG"
- q.EndLocation = t.EndLocation;
- outExpr = q; /* set outExpr to q again if QueryExpressionBody changed it (can happen with 'into' clauses) */
-
- }
-
- void ShortedLambdaExpression(
-#line 2113 "Frames/cs.ATG"
-IdentifierExpression ident, out Expression pexpr) {
-
-#line 2114 "Frames/cs.ATG"
- LambdaExpression lambda = new LambdaExpression(); pexpr = lambda;
- Expect(48);
-
-#line 2119 "Frames/cs.ATG"
- lambda.StartLocation = ident.StartLocation;
- SafeAdd(lambda, lambda.Parameters, new ParameterDeclarationExpression(null, ident.Identifier));
- lambda.Parameters[0].StartLocation = ident.StartLocation;
- lambda.Parameters[0].EndLocation = ident.EndLocation;
-
- LambdaExpressionBody(
-#line 2124 "Frames/cs.ATG"
-lambda);
- }
-
- void TypeArgumentList(
-#line 2365 "Frames/cs.ATG"
-out List<TypeReference> types, bool canBeUnbound) {
-
-#line 2367 "Frames/cs.ATG"
- types = new List<TypeReference>();
- TypeReference type = null;
-
- Expect(23);
- if (
-#line 2372 "Frames/cs.ATG"
-canBeUnbound && (la.kind == Tokens.GreaterThan || la.kind == Tokens.Comma)) {
-
-#line 2373 "Frames/cs.ATG"
- types.Add(TypeReference.Null);
- while (la.kind == 14) {
- lexer.NextToken();
-
-#line 2374 "Frames/cs.ATG"
- types.Add(TypeReference.Null);
- }
- } else if (StartOf(10)) {
- Type(
-#line 2375 "Frames/cs.ATG"
-out type);
-
-#line 2375 "Frames/cs.ATG"
- if (type != null) { types.Add(type); }
- while (la.kind == 14) {
- lexer.NextToken();
- Type(
-#line 2376 "Frames/cs.ATG"
-out type);
-
-#line 2376 "Frames/cs.ATG"
- if (type != null) { types.Add(type); }
- }
- } else SynErr(210);
- Expect(22);
- }
-
- void LambdaExpression(
-#line 2093 "Frames/cs.ATG"
-out Expression outExpr) {
-
-#line 2095 "Frames/cs.ATG"
- LambdaExpression lambda = new LambdaExpression();
- lambda.StartLocation = la.Location;
- ParameterDeclarationExpression p;
- outExpr = lambda;
-
- Expect(20);
- if (StartOf(18)) {
- LambdaExpressionParameter(
-#line 2103 "Frames/cs.ATG"
-out p);
-
-#line 2103 "Frames/cs.ATG"
- SafeAdd(lambda, lambda.Parameters, p);
- while (la.kind == 14) {
- lexer.NextToken();
- LambdaExpressionParameter(
-#line 2105 "Frames/cs.ATG"
-out p);
-
-#line 2105 "Frames/cs.ATG"
- SafeAdd(lambda, lambda.Parameters, p);
- }
- }
- Expect(21);
- Expect(48);
- LambdaExpressionBody(
-#line 2110 "Frames/cs.ATG"
-lambda);
- }
-
- void NewExpression(
-#line 2040 "Frames/cs.ATG"
-out Expression pexpr) {
-
-#line 2041 "Frames/cs.ATG"
- pexpr = null;
- List<Expression> parameters = new List<Expression>();
- TypeReference type = null;
- Expression expr;
-
- Expect(89);
- if (StartOf(10)) {
- NonArrayType(
-#line 2048 "Frames/cs.ATG"
-out type);
- }
- if (la.kind == 16 || la.kind == 20) {
- if (la.kind == 20) {
-
-#line 2054 "Frames/cs.ATG"
- ObjectCreateExpression oce = new ObjectCreateExpression(type, parameters);
- lexer.NextToken();
-
-#line 2055 "Frames/cs.ATG"
- if (type == null) Error("Cannot use an anonymous type with arguments for the constructor");
- if (StartOf(26)) {
- Argument(
-#line 2056 "Frames/cs.ATG"
-out expr);
-
-#line 2056 "Frames/cs.ATG"
- SafeAdd(oce, parameters, expr);
- while (la.kind == 14) {
- lexer.NextToken();
- Argument(
-#line 2057 "Frames/cs.ATG"
-out expr);
-
-#line 2057 "Frames/cs.ATG"
- SafeAdd(oce, parameters, expr);
- }
- }
- Expect(21);
-
-#line 2059 "Frames/cs.ATG"
- pexpr = oce;
- if (la.kind == 16) {
- CollectionOrObjectInitializer(
-#line 2060 "Frames/cs.ATG"
-out expr);
-
-#line 2060 "Frames/cs.ATG"
- oce.ObjectInitializer = (CollectionInitializerExpression)expr;
- }
- } else {
-
-#line 2061 "Frames/cs.ATG"
- ObjectCreateExpression oce = new ObjectCreateExpression(type, parameters);
- CollectionOrObjectInitializer(
-#line 2062 "Frames/cs.ATG"
-out expr);
-
-#line 2062 "Frames/cs.ATG"
- oce.ObjectInitializer = (CollectionInitializerExpression)expr;
-
-#line 2063 "Frames/cs.ATG"
- pexpr = oce;
- }
- } else if (la.kind == 18) {
- lexer.NextToken();
-
-#line 2068 "Frames/cs.ATG"
- ArrayCreateExpression ace = new ArrayCreateExpression(type);
- /* we must not change RankSpecifier on the null type reference*/
- if (ace.CreateType.IsNull) { ace.CreateType = new TypeReference(""); }
- pexpr = ace;
- int dims = 0; List<int> ranks = new List<int>();
-
- if (la.kind == 14 || la.kind == 19) {
- while (la.kind == 14) {
- lexer.NextToken();
-
-#line 2075 "Frames/cs.ATG"
- dims += 1;
- }
- Expect(19);
-
-#line 2076 "Frames/cs.ATG"
- ranks.Add(dims); dims = 0;
- while (la.kind == 18) {
- lexer.NextToken();
- while (la.kind == 14) {
- lexer.NextToken();
-
-#line 2077 "Frames/cs.ATG"
- ++dims;
- }
- Expect(19);
-
-#line 2077 "Frames/cs.ATG"
- ranks.Add(dims); dims = 0;
- }
-
-#line 2078 "Frames/cs.ATG"
- ace.CreateType.RankSpecifier = ranks.ToArray();
- CollectionInitializer(
-#line 2079 "Frames/cs.ATG"
-out expr);
-
-#line 2079 "Frames/cs.ATG"
- ace.ArrayInitializer = (CollectionInitializerExpression)expr;
- } else if (StartOf(6)) {
- Expr(
-#line 2080 "Frames/cs.ATG"
-out expr);
-
-#line 2080 "Frames/cs.ATG"
- if (expr != null) parameters.Add(expr);
- while (la.kind == 14) {
- lexer.NextToken();
-
-#line 2081 "Frames/cs.ATG"
- dims += 1;
- Expr(
-#line 2082 "Frames/cs.ATG"
-out expr);
-
-#line 2082 "Frames/cs.ATG"
- if (expr != null) parameters.Add(expr);
- }
- Expect(19);
-
-#line 2084 "Frames/cs.ATG"
- ranks.Add(dims); ace.Arguments = parameters; dims = 0;
- while (la.kind == 18) {
- lexer.NextToken();
- while (la.kind == 14) {
- lexer.NextToken();
-
-#line 2085 "Frames/cs.ATG"
- ++dims;
- }
- Expect(19);
-
-#line 2085 "Frames/cs.ATG"
- ranks.Add(dims); dims = 0;
- }
-
-#line 2086 "Frames/cs.ATG"
- ace.CreateType.RankSpecifier = ranks.ToArray();
- if (la.kind == 16) {
- CollectionInitializer(
-#line 2087 "Frames/cs.ATG"
-out expr);
-
-#line 2087 "Frames/cs.ATG"
- ace.ArrayInitializer = (CollectionInitializerExpression)expr;
- }
- } else SynErr(211);
- } else SynErr(212);
- }
-
- void AnonymousMethodExpr(
-#line 2160 "Frames/cs.ATG"
-out Expression outExpr) {
-
-#line 2162 "Frames/cs.ATG"
- AnonymousMethodExpression expr = new AnonymousMethodExpression();
- expr.StartLocation = t.Location;
- BlockStatement stmt;
- List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
- outExpr = expr;
-
- if (la.kind == 20) {
- lexer.NextToken();
- if (StartOf(11)) {
- FormalParameterList(
-#line 2171 "Frames/cs.ATG"
-p);
-
-#line 2171 "Frames/cs.ATG"
- expr.Parameters = p;
- }
- Expect(21);
-
-#line 2173 "Frames/cs.ATG"
- expr.HasParameterList = true;
- }
- BlockInsideExpression(
-#line 2175 "Frames/cs.ATG"
-out stmt);
-
-#line 2175 "Frames/cs.ATG"
- expr.Body = stmt;
-
-#line 2176 "Frames/cs.ATG"
- expr.EndLocation = t.Location;
- }
-
- void PointerMemberAccess(
-#line 2028 "Frames/cs.ATG"
-out Expression expr, Expression target) {
-
-#line 2029 "Frames/cs.ATG"
- List<TypeReference> typeList;
- Expect(47);
- Identifier();
-
-#line 2033 "Frames/cs.ATG"
- expr = new PointerReferenceExpression(target, t.val); expr.StartLocation = t.Location; expr.EndLocation = t.EndLocation;
- if (
-#line 2034 "Frames/cs.ATG"
-IsGenericInSimpleNameOrMemberAccess()) {
- TypeArgumentList(
-#line 2035 "Frames/cs.ATG"
-out typeList, false);
-
-#line 2036 "Frames/cs.ATG"
- ((MemberReferenceExpression)expr).TypeArguments = typeList;
- }
- }
-
- void MemberAccess(
-#line 2009 "Frames/cs.ATG"
-out Expression expr, Expression target) {
-
-#line 2010 "Frames/cs.ATG"
- List<TypeReference> typeList;
-
-#line 2012 "Frames/cs.ATG"
- if (ShouldConvertTargetExpressionToTypeReference(target)) {
- TypeReference type = GetTypeReferenceFromExpression(target);
- if (type != null) {
- target = new TypeReferenceExpression(type) { StartLocation = t.Location, EndLocation = t.EndLocation };
- }
- }
-
- Expect(15);
- Identifier();
-
-#line 2021 "Frames/cs.ATG"
- expr = new MemberReferenceExpression(target, t.val); expr.StartLocation = t.Location; expr.EndLocation = t.EndLocation;
- if (
-#line 2022 "Frames/cs.ATG"
-IsGenericInSimpleNameOrMemberAccess()) {
- TypeArgumentList(
-#line 2023 "Frames/cs.ATG"
-out typeList, false);
-
-#line 2024 "Frames/cs.ATG"
- ((MemberReferenceExpression)expr).TypeArguments = typeList;
- }
- }
-
- void LambdaExpressionParameter(
-#line 2127 "Frames/cs.ATG"
-out ParameterDeclarationExpression p) {
-
-#line 2128 "Frames/cs.ATG"
- Location start = la.Location; p = null;
- TypeReference type;
- ParameterModifiers mod = ParameterModifiers.In;
-
- if (
-#line 2133 "Frames/cs.ATG"
-Peek(1).kind == Tokens.Comma || Peek(1).kind == Tokens.CloseParenthesis) {
- Identifier();
-
-#line 2135 "Frames/cs.ATG"
- p = new ParameterDeclarationExpression(null, t.val);
- p.StartLocation = start; p.EndLocation = t.EndLocation;
-
- } else if (StartOf(18)) {
- if (la.kind == 93 || la.kind == 100) {
- if (la.kind == 100) {
- lexer.NextToken();
-
-#line 2138 "Frames/cs.ATG"
- mod = ParameterModifiers.Ref;
- } else {
- lexer.NextToken();
-
-#line 2139 "Frames/cs.ATG"
- mod = ParameterModifiers.Out;
- }
- }
- Type(
-#line 2141 "Frames/cs.ATG"
-out type);
- Identifier();
-
-#line 2143 "Frames/cs.ATG"
- p = new ParameterDeclarationExpression(type, t.val, mod);
- p.StartLocation = start; p.EndLocation = t.EndLocation;
-
- } else SynErr(213);
- }
-
- void LambdaExpressionBody(
-#line 2149 "Frames/cs.ATG"
-LambdaExpression lambda) {
-
-#line 2150 "Frames/cs.ATG"
- Expression expr; BlockStatement stmt;
- if (la.kind == 16) {
- BlockInsideExpression(
-#line 2153 "Frames/cs.ATG"
-out stmt);
-
-#line 2153 "Frames/cs.ATG"
- lambda.StatementBody = stmt;
- } else if (StartOf(6)) {
- Expr(
-#line 2154 "Frames/cs.ATG"
-out expr);
-
-#line 2154 "Frames/cs.ATG"
- lambda.ExpressionBody = expr;
- } else SynErr(214);
-
-#line 2156 "Frames/cs.ATG"
- lambda.EndLocation = t.EndLocation;
-
-#line 2157 "Frames/cs.ATG"
- lambda.ExtendedEndLocation = la.Location;
- }
-
- void BlockInsideExpression(
-#line 2179 "Frames/cs.ATG"
-out BlockStatement outStmt) {
-
-#line 2180 "Frames/cs.ATG"
- Statement stmt = null; outStmt = null;
-
-#line 2184 "Frames/cs.ATG"
- if (compilationUnit != null) {
- Block(
-#line 2185 "Frames/cs.ATG"
-out stmt);
-
-#line 2185 "Frames/cs.ATG"
- outStmt = (BlockStatement)stmt;
-
-#line 2186 "Frames/cs.ATG"
- } else {
- Expect(16);
-
-#line 2188 "Frames/cs.ATG"
- lexer.SkipCurrentBlock(0);
- Expect(17);
-
-#line 2190 "Frames/cs.ATG"
- }
- }
-
- void ConditionalAndExpr(
-#line 2199 "Frames/cs.ATG"
-ref Expression outExpr) {
-
-#line 2200 "Frames/cs.ATG"
- Expression expr;
- InclusiveOrExpr(
-#line 2202 "Frames/cs.ATG"
-ref outExpr);
- while (la.kind == 25) {
- lexer.NextToken();
- UnaryExpr(
-#line 2202 "Frames/cs.ATG"
-out expr);
- InclusiveOrExpr(
-#line 2202 "Frames/cs.ATG"
-ref expr);
-
-#line 2202 "Frames/cs.ATG"
- outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.LogicalAnd, expr);
- }
- }
-
- void InclusiveOrExpr(
-#line 2205 "Frames/cs.ATG"
-ref Expression outExpr) {
-
-#line 2206 "Frames/cs.ATG"
- Expression expr;
- ExclusiveOrExpr(
-#line 2208 "Frames/cs.ATG"
-ref outExpr);
- while (la.kind == 29) {
- lexer.NextToken();
- UnaryExpr(
-#line 2208 "Frames/cs.ATG"
-out expr);
- ExclusiveOrExpr(
-#line 2208 "Frames/cs.ATG"
-ref expr);
-
-#line 2208 "Frames/cs.ATG"
- outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.BitwiseOr, expr);
- }
- }
-
- void ExclusiveOrExpr(
-#line 2211 "Frames/cs.ATG"
-ref Expression outExpr) {
-
-#line 2212 "Frames/cs.ATG"
- Expression expr;
- AndExpr(
-#line 2214 "Frames/cs.ATG"
-ref outExpr);
- while (la.kind == 30) {
- lexer.NextToken();
- UnaryExpr(
-#line 2214 "Frames/cs.ATG"
-out expr);
- AndExpr(
-#line 2214 "Frames/cs.ATG"
-ref expr);
-
-#line 2214 "Frames/cs.ATG"
- outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.ExclusiveOr, expr);
- }
- }
-
- void AndExpr(
-#line 2217 "Frames/cs.ATG"
-ref Expression outExpr) {
-
-#line 2218 "Frames/cs.ATG"
- Expression expr;
- EqualityExpr(
-#line 2220 "Frames/cs.ATG"
-ref outExpr);
- while (la.kind == 28) {
- lexer.NextToken();
- UnaryExpr(
-#line 2220 "Frames/cs.ATG"
-out expr);
- EqualityExpr(
-#line 2220 "Frames/cs.ATG"
-ref expr);
-
-#line 2220 "Frames/cs.ATG"
- outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.BitwiseAnd, expr);
- }
- }
-
- void EqualityExpr(
-#line 2223 "Frames/cs.ATG"
-ref Expression outExpr) {
-
-#line 2225 "Frames/cs.ATG"
- Expression expr;
- BinaryOperatorType op = BinaryOperatorType.None;
-
- RelationalExpr(
-#line 2229 "Frames/cs.ATG"
-ref outExpr);
- while (la.kind == 33 || la.kind == 34) {
- if (la.kind == 34) {
- lexer.NextToken();
-
-#line 2232 "Frames/cs.ATG"
- op = BinaryOperatorType.InEquality;
- } else {
- lexer.NextToken();
-
-#line 2233 "Frames/cs.ATG"
- op = BinaryOperatorType.Equality;
- }
- UnaryExpr(
-#line 2235 "Frames/cs.ATG"
-out expr);
- RelationalExpr(
-#line 2235 "Frames/cs.ATG"
-ref expr);
-
-#line 2235 "Frames/cs.ATG"
- outExpr = new BinaryOperatorExpression(outExpr, op, expr);
- }
- }
-
- void RelationalExpr(
-#line 2239 "Frames/cs.ATG"
-ref Expression outExpr) {
-
-#line 2241 "Frames/cs.ATG"
- TypeReference type;
- Expression expr;
- BinaryOperatorType op = BinaryOperatorType.None;
-
- ShiftExpr(
-#line 2246 "Frames/cs.ATG"
-ref outExpr);
- while (StartOf(37)) {
- if (StartOf(38)) {
- if (la.kind == 23) {
- lexer.NextToken();
-
-#line 2248 "Frames/cs.ATG"
- op = BinaryOperatorType.LessThan;
- } else if (la.kind == 22) {
- lexer.NextToken();
-
-#line 2249 "Frames/cs.ATG"
- op = BinaryOperatorType.GreaterThan;
- } else if (la.kind == 36) {
- lexer.NextToken();
-
-#line 2250 "Frames/cs.ATG"
- op = BinaryOperatorType.LessThanOrEqual;
- } else if (la.kind == 35) {
- lexer.NextToken();
-
-#line 2251 "Frames/cs.ATG"
- op = BinaryOperatorType.GreaterThanOrEqual;
- } else SynErr(215);
- UnaryExpr(
-#line 2253 "Frames/cs.ATG"
-out expr);
- ShiftExpr(
-#line 2254 "Frames/cs.ATG"
-ref expr);
-
-#line 2255 "Frames/cs.ATG"
- outExpr = new BinaryOperatorExpression(outExpr, op, expr);
- } else {
- if (la.kind == 85) {
- lexer.NextToken();
- TypeWithRestriction(
-#line 2258 "Frames/cs.ATG"
-out type, false, false);
- if (
-#line 2259 "Frames/cs.ATG"
-la.kind == Tokens.Question && !IsPossibleExpressionStart(Peek(1).kind)) {
- NullableQuestionMark(
-#line 2260 "Frames/cs.ATG"
-ref type);
- }
-
-#line 2261 "Frames/cs.ATG"
- outExpr = new TypeOfIsExpression(outExpr, type);
- } else if (la.kind == 50) {
- lexer.NextToken();
- TypeWithRestriction(
-#line 2263 "Frames/cs.ATG"
-out type, false, false);
- if (
-#line 2264 "Frames/cs.ATG"
-la.kind == Tokens.Question && !IsPossibleExpressionStart(Peek(1).kind)) {
- NullableQuestionMark(
-#line 2265 "Frames/cs.ATG"
-ref type);
- }
-
-#line 2266 "Frames/cs.ATG"
- outExpr = new CastExpression(type, outExpr, CastType.TryCast);
- } else SynErr(216);
- }
- }
- }
-
- void ShiftExpr(
-#line 2271 "Frames/cs.ATG"
-ref Expression outExpr) {
-
-#line 2273 "Frames/cs.ATG"
- Expression expr;
- BinaryOperatorType op = BinaryOperatorType.None;
-
- AdditiveExpr(
-#line 2277 "Frames/cs.ATG"
-ref outExpr);
- while (la.kind == 37 ||
-#line 2280 "Frames/cs.ATG"
-IsShiftRight()) {
- if (la.kind == 37) {
- lexer.NextToken();
-
-#line 2279 "Frames/cs.ATG"
- op = BinaryOperatorType.ShiftLeft;
- } else {
- Expect(22);
- Expect(22);
-
-#line 2281 "Frames/cs.ATG"
- op = BinaryOperatorType.ShiftRight;
- }
- UnaryExpr(
-#line 2284 "Frames/cs.ATG"
-out expr);
- AdditiveExpr(
-#line 2284 "Frames/cs.ATG"
-ref expr);
-
-#line 2284 "Frames/cs.ATG"
- outExpr = new BinaryOperatorExpression(outExpr, op, expr);
- }
- }
-
- void AdditiveExpr(
-#line 2288 "Frames/cs.ATG"
-ref Expression outExpr) {
-
-#line 2290 "Frames/cs.ATG"
- Expression expr;
- BinaryOperatorType op = BinaryOperatorType.None;
-
- MultiplicativeExpr(
-#line 2294 "Frames/cs.ATG"
-ref outExpr);
- while (la.kind == 4 || la.kind == 5) {
- if (la.kind == 4) {
- lexer.NextToken();
-
-#line 2297 "Frames/cs.ATG"
- op = BinaryOperatorType.Add;
- } else {
- lexer.NextToken();
-
-#line 2298 "Frames/cs.ATG"
- op = BinaryOperatorType.Subtract;
- }
- UnaryExpr(
-#line 2300 "Frames/cs.ATG"
-out expr);
- MultiplicativeExpr(
-#line 2300 "Frames/cs.ATG"
-ref expr);
-
-#line 2300 "Frames/cs.ATG"
- outExpr = new BinaryOperatorExpression(outExpr, op, expr);
- }
- }
-
- void MultiplicativeExpr(
-#line 2304 "Frames/cs.ATG"
-ref Expression outExpr) {
-
-#line 2306 "Frames/cs.ATG"
- Expression expr;
- BinaryOperatorType op = BinaryOperatorType.None;
-
- while (la.kind == 6 || la.kind == 7 || la.kind == 8) {
- if (la.kind == 6) {
- lexer.NextToken();
-
-#line 2312 "Frames/cs.ATG"
- op = BinaryOperatorType.Multiply;
- } else if (la.kind == 7) {
- lexer.NextToken();
-
-#line 2313 "Frames/cs.ATG"
- op = BinaryOperatorType.Divide;
- } else {
- lexer.NextToken();
-
-#line 2314 "Frames/cs.ATG"
- op = BinaryOperatorType.Modulus;
- }
- UnaryExpr(
-#line 2316 "Frames/cs.ATG"
-out expr);
-
-#line 2316 "Frames/cs.ATG"
- outExpr = new BinaryOperatorExpression(outExpr, op, expr);
- }
- }
-
- void TypeParameterConstraintsClauseBase(
-#line 2422 "Frames/cs.ATG"
-out TypeReference type) {
-
-#line 2423 "Frames/cs.ATG"
- TypeReference t; type = null;
- if (la.kind == 109) {
- lexer.NextToken();
-
-#line 2425 "Frames/cs.ATG"
- type = TypeReference.StructConstraint;
- } else if (la.kind == 59) {
- lexer.NextToken();
-
-#line 2426 "Frames/cs.ATG"
- type = TypeReference.ClassConstraint;
- } else if (la.kind == 89) {
- lexer.NextToken();
- Expect(20);
- Expect(21);
-
-#line 2427 "Frames/cs.ATG"
- type = TypeReference.NewConstraint;
- } else if (StartOf(10)) {
- Type(
-#line 2428 "Frames/cs.ATG"
-out t);
-
-#line 2428 "Frames/cs.ATG"
- type = t;
- } else SynErr(217);
- }
-
- void QueryExpressionFromClause(
-#line 2443 "Frames/cs.ATG"
-out QueryExpressionFromClause fc) {
-
-#line 2444 "Frames/cs.ATG"
- fc = new QueryExpressionFromClause(); fc.StartLocation = la.Location;
-
- Expect(137);
- QueryExpressionFromOrJoinClause(
-#line 2448 "Frames/cs.ATG"
-fc);
-
-#line 2449 "Frames/cs.ATG"
- fc.EndLocation = t.EndLocation;
- }
-
- void QueryExpressionBody(
-#line 2479 "Frames/cs.ATG"
-ref QueryExpression q) {
-
-#line 2480 "Frames/cs.ATG"
- QueryExpressionFromClause fromClause; QueryExpressionWhereClause whereClause;
- QueryExpressionLetClause letClause; QueryExpressionJoinClause joinClause;
- QueryExpressionOrderClause orderClause;
- QueryExpressionSelectClause selectClause; QueryExpressionGroupClause groupClause;
-
- while (StartOf(39)) {
- if (la.kind == 137) {
- QueryExpressionFromClause(
-#line 2486 "Frames/cs.ATG"
-out fromClause);
-
-#line 2486 "Frames/cs.ATG"
- SafeAdd<QueryExpressionClause>(q, q.MiddleClauses, fromClause);
- } else if (la.kind == 127) {
- QueryExpressionWhereClause(
-#line 2487 "Frames/cs.ATG"
-out whereClause);
-
-#line 2487 "Frames/cs.ATG"
- SafeAdd<QueryExpressionClause>(q, q.MiddleClauses, whereClause);
- } else if (la.kind == 141) {
- QueryExpressionLetClause(
-#line 2488 "Frames/cs.ATG"
-out letClause);
-
-#line 2488 "Frames/cs.ATG"
- SafeAdd<QueryExpressionClause>(q, q.MiddleClauses, letClause);
- } else if (la.kind == 142) {
- QueryExpressionJoinClause(
-#line 2489 "Frames/cs.ATG"
-out joinClause);
-
-#line 2489 "Frames/cs.ATG"
- SafeAdd<QueryExpressionClause>(q, q.MiddleClauses, joinClause);
- } else {
- QueryExpressionOrderByClause(
-#line 2490 "Frames/cs.ATG"
-out orderClause);
-
-#line 2490 "Frames/cs.ATG"
- SafeAdd<QueryExpressionClause>(q, q.MiddleClauses, orderClause);
- }
- }
- if (la.kind == 133) {
- QueryExpressionSelectClause(
-#line 2492 "Frames/cs.ATG"
-out selectClause);
-
-#line 2492 "Frames/cs.ATG"
- q.SelectOrGroupClause = selectClause;
- } else if (la.kind == 134) {
- QueryExpressionGroupClause(
-#line 2493 "Frames/cs.ATG"
-out groupClause);
-
-#line 2493 "Frames/cs.ATG"
- q.SelectOrGroupClause = groupClause;
- } else SynErr(218);
- if (la.kind == 136) {
- QueryExpressionIntoClause(
-#line 2495 "Frames/cs.ATG"
-ref q);
- }
- }
-
- void QueryExpressionFromOrJoinClause(
-#line 2469 "Frames/cs.ATG"
-QueryExpressionFromOrJoinClause fjc) {
-
-#line 2470 "Frames/cs.ATG"
- TypeReference type; Expression expr;
-
-#line 2472 "Frames/cs.ATG"
- fjc.Type = null;
- if (
-#line 2473 "Frames/cs.ATG"
-IsLocalVarDecl()) {
- Type(
-#line 2473 "Frames/cs.ATG"
-out type);
-
-#line 2473 "Frames/cs.ATG"
- fjc.Type = type;
- }
- Identifier();
-
-#line 2474 "Frames/cs.ATG"
- fjc.Identifier = t.val;
- Expect(81);
- Expr(
-#line 2476 "Frames/cs.ATG"
-out expr);
-
-#line 2476 "Frames/cs.ATG"
- fjc.InExpression = expr;
- }
-
- void QueryExpressionJoinClause(
-#line 2452 "Frames/cs.ATG"
-out QueryExpressionJoinClause jc) {
-
-#line 2453 "Frames/cs.ATG"
- jc = new QueryExpressionJoinClause(); jc.StartLocation = la.Location;
- Expression expr;
-
- Expect(142);
- QueryExpressionFromOrJoinClause(
-#line 2458 "Frames/cs.ATG"
-jc);
- Expect(143);
- Expr(
-#line 2460 "Frames/cs.ATG"
-out expr);
-
-#line 2460 "Frames/cs.ATG"
- jc.OnExpression = expr;
- Expect(144);
- Expr(
-#line 2462 "Frames/cs.ATG"
-out expr);
-
-#line 2462 "Frames/cs.ATG"
- jc.EqualsExpression = expr;
- if (la.kind == 136) {
- lexer.NextToken();
- Identifier();
-
-#line 2464 "Frames/cs.ATG"
- jc.IntoIdentifier = t.val;
- }
-
-#line 2466 "Frames/cs.ATG"
- jc.EndLocation = t.EndLocation;
- }
-
- void QueryExpressionWhereClause(
-#line 2498 "Frames/cs.ATG"
-out QueryExpressionWhereClause wc) {
-
-#line 2499 "Frames/cs.ATG"
- Expression expr; wc = new QueryExpressionWhereClause(); wc.StartLocation = la.Location;
- Expect(127);
- Expr(
-#line 2502 "Frames/cs.ATG"
-out expr);
-
-#line 2502 "Frames/cs.ATG"
- wc.Condition = expr;
-
-#line 2503 "Frames/cs.ATG"
- wc.EndLocation = t.EndLocation;
- }
-
- void QueryExpressionLetClause(
-#line 2506 "Frames/cs.ATG"
-out QueryExpressionLetClause wc) {
-
-#line 2507 "Frames/cs.ATG"
- Expression expr; wc = new QueryExpressionLetClause(); wc.StartLocation = la.Location;
- Expect(141);
- Identifier();
-
-#line 2510 "Frames/cs.ATG"
- wc.Identifier = t.val;
- Expect(3);
- Expr(
-#line 2512 "Frames/cs.ATG"
-out expr);
-
-#line 2512 "Frames/cs.ATG"
- wc.Expression = expr;
-
-#line 2513 "Frames/cs.ATG"
- wc.EndLocation = t.EndLocation;
- }
-
- void QueryExpressionOrderByClause(
-#line 2516 "Frames/cs.ATG"
-out QueryExpressionOrderClause oc) {
-
-#line 2517 "Frames/cs.ATG"
- QueryExpressionOrdering ordering; oc = new QueryExpressionOrderClause(); oc.StartLocation = la.Location;
- Expect(140);
- QueryExpressionOrdering(
-#line 2520 "Frames/cs.ATG"
-out ordering);
-
-#line 2520 "Frames/cs.ATG"
- SafeAdd(oc, oc.Orderings, ordering);
- while (la.kind == 14) {
- lexer.NextToken();
- QueryExpressionOrdering(
-#line 2522 "Frames/cs.ATG"
-out ordering);
-
-#line 2522 "Frames/cs.ATG"
- SafeAdd(oc, oc.Orderings, ordering);
- }
-
-#line 2524 "Frames/cs.ATG"
- oc.EndLocation = t.EndLocation;
- }
-
- void QueryExpressionSelectClause(
-#line 2537 "Frames/cs.ATG"
-out QueryExpressionSelectClause sc) {
-
-#line 2538 "Frames/cs.ATG"
- Expression expr; sc = new QueryExpressionSelectClause(); sc.StartLocation = la.Location;
- Expect(133);
- Expr(
-#line 2541 "Frames/cs.ATG"
-out expr);
-
-#line 2541 "Frames/cs.ATG"
- sc.Projection = expr;
-
-#line 2542 "Frames/cs.ATG"
- sc.EndLocation = t.EndLocation;
- }
-
- void QueryExpressionGroupClause(
-#line 2545 "Frames/cs.ATG"
-out QueryExpressionGroupClause gc) {
-
-#line 2546 "Frames/cs.ATG"
- Expression expr; gc = new QueryExpressionGroupClause(); gc.StartLocation = la.Location;
- Expect(134);
- Expr(
-#line 2549 "Frames/cs.ATG"
-out expr);
-
-#line 2549 "Frames/cs.ATG"
- gc.Projection = expr;
- Expect(135);
- Expr(
-#line 2551 "Frames/cs.ATG"
-out expr);
-
-#line 2551 "Frames/cs.ATG"
- gc.GroupBy = expr;
-
-#line 2552 "Frames/cs.ATG"
- gc.EndLocation = t.EndLocation;
- }
-
- void QueryExpressionIntoClause(
-#line 2555 "Frames/cs.ATG"
-ref QueryExpression q) {
-
-#line 2556 "Frames/cs.ATG"
- QueryExpression firstQuery = q;
- QueryExpression continuedQuery = new QueryExpression();
- continuedQuery.StartLocation = q.StartLocation;
- firstQuery.EndLocation = la.Location;
- continuedQuery.FromClause = new QueryExpressionFromClause();
- continuedQuery.FromClause.StartLocation = la.Location;
- // nest firstQuery inside continuedQuery.
- continuedQuery.FromClause.InExpression = firstQuery;
- continuedQuery.IsQueryContinuation = true;
- q = continuedQuery;
-
- Expect(136);
- Identifier();
-
-#line 2569 "Frames/cs.ATG"
- continuedQuery.FromClause.Identifier = t.val;
-
-#line 2570 "Frames/cs.ATG"
- continuedQuery.FromClause.EndLocation = t.EndLocation;
- QueryExpressionBody(
-#line 2571 "Frames/cs.ATG"
-ref q);
- }
-
- void QueryExpressionOrdering(
-#line 2527 "Frames/cs.ATG"
-out QueryExpressionOrdering ordering) {
-
-#line 2528 "Frames/cs.ATG"
- Expression expr; ordering = new QueryExpressionOrdering(); ordering.StartLocation = la.Location;
- Expr(
-#line 2530 "Frames/cs.ATG"
-out expr);
-
-#line 2530 "Frames/cs.ATG"
- ordering.Criteria = expr;
- if (la.kind == 138 || la.kind == 139) {
- if (la.kind == 138) {
- lexer.NextToken();
-
-#line 2531 "Frames/cs.ATG"
- ordering.Direction = QueryExpressionOrderingDirection.Ascending;
- } else {
- lexer.NextToken();
-
-#line 2532 "Frames/cs.ATG"
- ordering.Direction = QueryExpressionOrderingDirection.Descending;
- }
- }
-
-#line 2534 "Frames/cs.ATG"
- ordering.EndLocation = t.EndLocation;
- }
-
-
-
- void ParseRoot()
- {
- CS();
-
- }
-
- protected override void SynErr(int line, int col, int errorNumber)
- {
- string s;
- switch (errorNumber) {
- case 0: s = "EOF expected"; break;
- case 1: s = "ident expected"; break;
- case 2: s = "Literal expected"; break;
- case 3: s = "\"=\" expected"; break;
- case 4: s = "\"+\" expected"; break;
- case 5: s = "\"-\" expected"; break;
- case 6: s = "\"*\" expected"; break;
- case 7: s = "\"/\" expected"; break;
- case 8: s = "\"%\" expected"; break;
- case 9: s = "\":\" 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 = "\"&=\" expected"; break;
- case 44: s = "\"|=\" expected"; break;
- case 45: s = "\"^=\" expected"; break;
- case 46: s = "\"<<=\" expected"; break;
- case 47: s = "\"->\" expected"; break;
- case 48: s = "\"=>\" expected"; break;
- case 49: s = "\"abstract\" expected"; break;
- case 50: s = "\"as\" expected"; break;
- case 51: s = "\"base\" expected"; break;
- case 52: s = "\"bool\" expected"; break;
- case 53: s = "\"break\" expected"; break;
- case 54: s = "\"byte\" expected"; break;
- case 55: s = "\"case\" expected"; break;
- case 56: s = "\"catch\" expected"; break;
- case 57: s = "\"char\" expected"; break;
- case 58: s = "\"checked\" expected"; break;
- case 59: s = "\"class\" expected"; break;
- case 60: s = "\"const\" expected"; break;
- case 61: s = "\"continue\" expected"; break;
- case 62: s = "\"decimal\" expected"; break;
- case 63: s = "\"default\" expected"; break;
- case 64: s = "\"delegate\" expected"; break;
- case 65: s = "\"do\" expected"; break;
- case 66: s = "\"double\" expected"; break;
- case 67: s = "\"else\" expected"; break;
- case 68: s = "\"enum\" expected"; break;
- case 69: s = "\"event\" expected"; break;
- case 70: s = "\"explicit\" expected"; break;
- case 71: s = "\"extern\" expected"; break;
- case 72: s = "\"false\" expected"; break;
- case 73: s = "\"finally\" expected"; break;
- case 74: s = "\"fixed\" expected"; break;
- case 75: s = "\"float\" expected"; break;
- case 76: s = "\"for\" expected"; break;
- case 77: s = "\"foreach\" expected"; break;
- case 78: s = "\"goto\" expected"; break;
- case 79: s = "\"if\" expected"; break;
- case 80: s = "\"implicit\" expected"; break;
- case 81: s = "\"in\" expected"; break;
- case 82: s = "\"int\" expected"; break;
- case 83: s = "\"interface\" expected"; break;
- case 84: s = "\"internal\" expected"; break;
- case 85: s = "\"is\" expected"; break;
- case 86: s = "\"lock\" expected"; break;
- case 87: s = "\"long\" expected"; break;
- case 88: s = "\"namespace\" expected"; break;
- case 89: s = "\"new\" expected"; break;
- case 90: s = "\"null\" expected"; break;
- case 91: s = "\"object\" expected"; break;
- case 92: s = "\"operator\" expected"; break;
- case 93: s = "\"out\" expected"; break;
- case 94: s = "\"override\" expected"; break;
- case 95: s = "\"params\" expected"; break;
- case 96: s = "\"private\" expected"; break;
- case 97: s = "\"protected\" expected"; break;
- case 98: s = "\"public\" expected"; break;
- case 99: s = "\"readonly\" expected"; break;
- case 100: s = "\"ref\" expected"; break;
- case 101: s = "\"return\" expected"; break;
- case 102: s = "\"sbyte\" expected"; break;
- case 103: s = "\"sealed\" expected"; break;
- case 104: s = "\"short\" expected"; break;
- case 105: s = "\"sizeof\" expected"; break;
- case 106: s = "\"stackalloc\" expected"; break;
- case 107: s = "\"static\" expected"; break;
- case 108: s = "\"string\" expected"; break;
- case 109: s = "\"struct\" expected"; break;
- case 110: s = "\"switch\" expected"; break;
- case 111: s = "\"this\" expected"; break;
- case 112: s = "\"throw\" expected"; break;
- case 113: s = "\"true\" expected"; break;
- case 114: s = "\"try\" expected"; break;
- case 115: s = "\"typeof\" expected"; break;
- case 116: s = "\"uint\" expected"; break;
- case 117: s = "\"ulong\" expected"; break;
- case 118: s = "\"unchecked\" expected"; break;
- case 119: s = "\"unsafe\" expected"; break;
- case 120: s = "\"ushort\" expected"; break;
- case 121: s = "\"using\" expected"; break;
- case 122: s = "\"virtual\" expected"; break;
- case 123: s = "\"void\" expected"; break;
- case 124: s = "\"volatile\" expected"; break;
- case 125: s = "\"while\" expected"; break;
- case 126: s = "\"partial\" expected"; break;
- case 127: s = "\"where\" expected"; break;
- case 128: s = "\"get\" expected"; break;
- case 129: s = "\"set\" expected"; break;
- case 130: s = "\"add\" expected"; break;
- case 131: s = "\"remove\" expected"; break;
- case 132: s = "\"yield\" expected"; break;
- case 133: s = "\"select\" expected"; break;
- case 134: s = "\"group\" expected"; break;
- case 135: s = "\"by\" expected"; break;
- case 136: s = "\"into\" expected"; break;
- case 137: s = "\"from\" expected"; break;
- case 138: s = "\"ascending\" expected"; break;
- case 139: s = "\"descending\" expected"; break;
- case 140: s = "\"orderby\" expected"; break;
- case 141: s = "\"let\" expected"; break;
- case 142: s = "\"join\" expected"; break;
- case 143: s = "\"on\" expected"; break;
- case 144: s = "\"equals\" expected"; break;
- case 145: s = "??? expected"; break;
- case 146: s = "invalid NamespaceMemberDecl"; break;
- case 147: s = "invalid NonArrayType"; break;
- case 148: s = "invalid Identifier"; break;
- case 149: s = "invalid AttributeArguments"; break;
- case 150: s = "invalid Expr"; break;
- case 151: s = "invalid TypeModifier"; break;
- case 152: s = "invalid TypeDecl"; break;
- case 153: s = "invalid TypeDecl"; break;
- case 154: s = "this symbol not expected in ClassBody"; break;
- case 155: s = "this symbol not expected in InterfaceBody"; break;
- case 156: s = "invalid IntegralType"; break;
- case 157: s = "invalid FormalParameterList"; break;
- case 158: s = "invalid FormalParameterList"; break;
- case 159: s = "invalid ClassType"; break;
- case 160: s = "invalid ClassMemberDecl"; break;
- case 161: s = "invalid ClassMemberDecl"; break;
- case 162: s = "invalid StructMemberDecl"; break;
- case 163: s = "invalid StructMemberDecl"; break;
- case 164: s = "invalid StructMemberDecl"; break;
- case 165: s = "invalid StructMemberDecl"; break;
- case 166: s = "invalid StructMemberDecl"; break;
- case 167: s = "invalid StructMemberDecl"; break;
- case 168: s = "invalid StructMemberDecl"; break;
- case 169: s = "invalid StructMemberDecl"; break;
- case 170: s = "invalid StructMemberDecl"; break;
- case 171: s = "invalid StructMemberDecl"; break;
- case 172: s = "invalid StructMemberDecl"; break;
- case 173: s = "invalid StructMemberDecl"; break;
- case 174: s = "invalid StructMemberDecl"; break;
- case 175: s = "invalid InterfaceMemberDecl"; break;
- case 176: s = "invalid InterfaceMemberDecl"; break;
- case 177: s = "invalid InterfaceMemberDecl"; break;
- case 178: s = "invalid TypeWithRestriction"; break;
- case 179: s = "invalid TypeWithRestriction"; break;
- case 180: s = "invalid SimpleType"; break;
- case 181: s = "invalid AccessorModifiers"; break;
- case 182: s = "this symbol not expected in Block"; break;
- case 183: s = "invalid EventAccessorDecls"; break;
- case 184: s = "invalid ConstructorInitializer"; break;
- case 185: s = "invalid OverloadableOperator"; break;
- case 186: s = "invalid AccessorDecls"; break;
- case 187: s = "invalid InterfaceAccessors"; break;
- case 188: s = "invalid InterfaceAccessors"; break;
- case 189: s = "invalid GetAccessorDecl"; break;
- case 190: s = "invalid SetAccessorDecl"; break;
- case 191: s = "invalid VariableInitializer"; break;
- case 192: s = "this symbol not expected in Statement"; break;
- case 193: s = "invalid Statement"; break;
- case 194: s = "invalid AssignmentOperator"; break;
- case 195: s = "invalid ObjectPropertyInitializerOrVariableInitializer"; break;
- case 196: s = "invalid ObjectPropertyInitializerOrVariableInitializer"; break;
- case 197: s = "invalid EmbeddedStatement"; break;
- case 198: s = "invalid EmbeddedStatement"; break;
- case 199: s = "this symbol not expected in EmbeddedStatement"; break;
- case 200: s = "invalid EmbeddedStatement"; break;
- case 201: s = "invalid ForInitializer"; break;
- case 202: s = "invalid GotoStatement"; 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 TypeArgumentList"; break;
- case 211: s = "invalid NewExpression"; break;
- case 212: s = "invalid NewExpression"; break;
- case 213: s = "invalid LambdaExpressionParameter"; break;
- case 214: s = "invalid LambdaExpressionBody"; break;
- case 215: s = "invalid RelationalExpr"; break;
- case 216: s = "invalid RelationalExpr"; break;
- case 217: s = "invalid TypeParameterConstraintsClauseBase"; break;
- case 218: s = "invalid QueryExpressionBody"; break;
-
- default: s = "error " + errorNumber; break;
- }
- this.Errors.Error(line, col, s);
- }
-
- private bool StartOf(int s)
- {
- return set[s, lexer.LookAhead.kind];
- }
-
- static bool[,] set = {
- {T,T,T,x, T,T,T,x, x,x,x,T, x,x,x,x, T,T,T,x, T,x,x,x, T,x,x,T, T,x,x,T, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,T, T,T,T,x, x,T,T,T, T,T,T,T, T,T,T,x, T,T,T,T, T,x,T,T, T,T,T,T, T,x,T,T, T,x,T,T, x,T,T,T, x,x,T,x, T,T,T,T, x,T,T,T, T,T,x,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,T, x,x,x,x, T,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,x,x,x, T,T,x,x, x,x,x,x, T,T,T,x, x,x,x,T, x,x,x,T, x,T,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,T, x,x,x,x, T,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,x,x,x, x,T,x,x, x,x,x,x, T,T,T,x, x,x,x,T, x,x,x,T, x,T,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,T,x,x, x,x,x,x, T,T,T,x, x,x,x,T, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
- {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, 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, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,T,x, x,T,x,x, x,x,T,x, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,T,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, T,x,x,x, x,x,x,x, x,x,x,x, T,T,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
- {x,T,T,x, T,T,T,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, T,x,x,T, T,x,x,T, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,x,T,x, x,T,T,x, x,x,T,T, T,x,T,x, x,x,x,x, T,x,x,T, x,x,x,x, x,x,T,x, x,x,x,T, x,T,T,T, x,x,x,x, x,x,x,x, x,x,T,x, T,T,x,x, T,x,x,T, x,T,x,T, T,T,T,x, T,x,x,T, x,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x},
- {x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,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,T,x,T, T,T,T,T, T,T,x,T, T,T,T,T, T,T,T,T, T,T,T,T, x,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, x,T,T,x, T,x,T,x, x,T,x,T, T,x,T,x, T,x,T,x, T,T,T,T, x,x,T,T, x,x,x,x, T,x,T,T, T,T,x,T, x,T,x,T, x,x,T,x, T,T,T,T, x,x,T,T, T,x,x,T, T,T,x,x, x,x,x,x, T,T,x,T, T,x,T,T, T,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, 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,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,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, T,x,T,x, x,T,x,x, x,x,T,x, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,T,x, x,x,x,T, x,x,x,T, x,x,x,x, x,x,x,x, x,x,T,x, T,x,x,x, T,x,x,x, x,x,x,x, T,T,x,x, T,x,x,T, x,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x},
- {x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,T,x, x,T,x,x, x,x,T,x, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,T,x, x,x,x,T, x,x,x,T, x,T,x,T, x,x,x,x, T,x,T,x, T,x,x,x, T,x,x,x, x,x,x,x, T,T,x,x, T,x,x,T, x,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x},
- {x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, T,x,T,x, x,T,x,T, T,x,T,x, T,x,T,x, T,T,T,T, x,x,T,T, x,x,x,x, T,x,T,T, T,x,x,T, x,T,x,T, x,x,T,x, T,T,T,T, x,x,T,T, T,x,x,T, T,T,x,x, x,x,x,x, T,T,x,T, T,x,T,T, T,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x},
- {T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, T,x,T,x, x,T,x,T, T,x,T,x, T,x,T,x, T,T,T,T, x,x,T,T, x,x,x,x, T,x,T,T, T,x,x,T, x,T,x,T, x,x,T,x, T,T,T,T, x,x,T,T, T,x,x,T, T,T,x,x, x,x,x,x, T,T,x,T, T,x,T,T, T,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x},
- {x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, T,x,T,x, x,T,x,T, T,x,T,x, T,x,T,x, T,T,T,T, x,x,T,T, x,x,x,x, T,x,T,T, T,x,x,T, x,T,x,T, x,x,T,x, T,T,T,T, x,x,T,T, T,x,x,T, T,T,x,x, x,x,x,x, T,T,x,T, T,x,T,T, T,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x},
- {x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,T,x, x,T,x,x, x,x,T,x, x,x,T,x, x,T,x,x, x,x,x,T, x,x,x,x, x,x,T,x, x,x,x,T, x,T,x,T, x,x,x,x, x,x,x,x, x,x,T,x, T,x,x,x, T,x,x,x, x,x,x,x, T,T,x,x, T,x,x,T, x,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x},
- {T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,T,x, x,T,x,x, x,x,T,x, x,x,T,x, x,T,x,x, x,x,x,T, x,x,x,x, x,x,T,x, x,x,x,T, x,T,x,T, x,x,x,x, x,x,x,x, x,x,T,x, T,x,x,x, T,x,x,x, x,x,x,x, T,T,x,x, T,x,x,T, x,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x},
- {x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x},
- {x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,T,x, x,T,x,x, x,x,T,x, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,T,x, x,x,x,T, x,x,x,T, x,T,x,x, x,x,x,x, T,x,T,x, T,x,x,x, T,x,x,x, x,x,x,x, T,T,x,x, T,x,x,T, x,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x},
- {x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,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,T, x,x,T,x, x,x,x,x, x,x,x,x, T,x,x,x, x,T,x,x, x,x,T,x, T,T,T,T, x,x,x,T, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,T, x,x,T,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,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,T,x, x,T,x,T, T,x,T,x, T,x,T,x, T,T,T,x, x,x,x,T, x,x,x,x, T,x,T,T, x,x,x,T, x,x,x,T, x,x,x,x, x,x,x,x, x,x,T,x, T,x,x,x, T,T,x,x, x,x,x,x, T,T,x,x, T,x,x,T, x,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,x,x, T,x,x,x, 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,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
- {x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,T,x, x,T,x,x, x,x,T,x, x,x,T,x, x,T,x,x, x,x,x,T, x,x,x,x, x,x,T,x, x,x,x,T, x,x,x,T, x,x,x,x, x,x,x,x, x,x,T,x, T,x,x,x, T,x,x,x, x,x,x,x, T,T,x,x, T,x,x,T, x,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,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,T,x, x,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, T,x,x,x, x,x,x,x, x,x,x,x, T,T,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
- {x,T,T,x, T,T,T,x, x,x,x,T, x,x,x,x, T,x,x,x, T,x,x,x, T,x,x,T, T,x,x,T, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,T,T,x, x,T,T,x, T,T,T,T, T,T,T,x, x,x,x,x, T,x,T,T, T,T,T,T, x,x,T,x, x,x,T,T, x,T,T,T, x,x,x,x, x,x,x,x, x,T,T,x, T,T,x,x, T,x,T,T, T,T,T,T, T,T,T,T, T,T,x,T, x,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x},
- {x,T,T,x, T,T,T,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, T,x,x,T, T,x,x,T, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,x,T,x, x,T,T,x, x,x,T,T, T,x,T,x, x,x,x,x, T,x,x,T, x,x,x,x, x,x,T,x, x,x,x,T, x,T,T,T, x,T,x,x, x,x,x,x, T,x,T,x, T,T,x,x, T,x,x,T, x,T,x,T, T,T,T,x, T,x,x,T, x,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, T,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
- {T,T,T,x, T,T,T,x, x,x,x,T, x,x,x,x, T,x,x,x, T,x,x,x, T,x,x,T, T,x,x,T, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,T,T,x, x,T,T,x, T,T,T,T, T,T,T,x, x,x,x,x, T,x,T,T, T,T,T,T, x,x,T,x, x,x,T,T, x,T,T,T, x,x,x,x, x,x,x,x, x,T,T,x, T,T,x,x, T,x,T,T, T,T,T,T, T,T,T,T, T,T,x,T, x,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x},
- {x,T,T,x, T,T,T,x, x,x,x,T, x,x,x,x, T,x,x,x, T,x,x,x, T,x,x,T, T,x,x,T, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,T,T,x, x,T,T,x, x,T,T,T, T,T,T,x, x,x,x,x, T,x,T,T, T,T,T,T, x,x,T,x, x,x,T,T, x,T,T,T, x,x,x,x, x,x,x,x, x,T,T,x, T,T,x,x, T,x,T,T, T,T,T,T, T,T,T,T, T,T,x,T, x,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x},
- {x,T,T,x, T,T,T,x, x,x,x,x, x,x,x,x, T,x,x,x, T,x,x,x, T,x,x,T, T,x,x,T, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,x,T,x, x,T,T,x, x,x,T,T, T,x,T,x, x,x,x,x, T,x,x,T, x,x,x,x, x,x,T,x, x,x,x,T, x,T,T,T, x,x,x,x, x,x,x,x, x,x,T,x, T,T,T,x, T,x,x,T, x,T,x,T, T,T,T,x, T,x,x,T, x,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x},
- {x,T,T,x, T,T,T,x, x,x,x,T, x,x,x,x, T,x,x,x, T,x,x,x, T,x,x,T, T,x,x,T, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,T,T,T, x,T,T,x, T,T,T,T, T,T,T,x, x,x,x,x, T,x,T,T, T,T,T,T, x,x,T,x, x,x,T,T, x,T,T,T, x,x,x,x, x,x,x,x, x,T,T,x, T,T,x,x, T,x,T,T, T,T,T,T, T,T,T,T, T,T,x,T, x,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x},
- {x,x,x,x, T,T,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,T, T,x,x,T, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
- {x,T,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, T,x,T,x, x,T,T,x, x,x,T,T, T,x,T,x, x,x,x,x, T,x,x,T, x,x,x,x, x,x,T,x, x,x,x,T, x,T,T,T, x,x,x,x, x,x,x,x, x,x,T,x, T,T,x,x, T,x,x,T, x,T,x,T, T,T,T,x, T,x,x,T, x,x,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,T,T,T, T,x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, T,x,T,x, x,T,x,x, x,x,T,x, x,x,T,x, x,x,x,x, x,x,x,T, x,x,x,x, x,x,T,x, x,x,x,T, x,x,x,T, x,x,x,x, x,x,x,x, x,x,T,x, T,x,x,x, T,x,x,x, x,x,x,x, T,T,x,x, T,x,x,T, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,T, x,x,T,x, T,x,x,x, x,x,x,x, x,x,x,T, 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,T,T, x,x,x,x, x,x,x,x, x,x,x,T, T,x,x,x, x,x,x,x, x,x,x,x, x,x,T,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,T,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x},
- {x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,T,T, x,x,x,x, x,x,x,x, x,x,x,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,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,x, x,x,x,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, T,T,T,x, x,x,x}
-
- };
-} // end Parser
-
-} \ No newline at end of file
diff --git a/main/contrib/NRefactory/Project/Src/Parser/CSharp/cs.ATG b/main/contrib/NRefactory/Project/Src/Parser/CSharp/cs.ATG
deleted file mode 100644
index fcdfe7ee79..0000000000
--- a/main/contrib/NRefactory/Project/Src/Parser/CSharp/cs.ATG
+++ /dev/null
@@ -1,2601 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.Specialized;
-using System.Text;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-using ASTAttribute = ICSharpCode.NRefactory.Ast.Attribute;
-using Types = ICSharpCode.NRefactory.Ast.ClassType;
-
-COMPILER CS /* AW 2002-12-30 renamed from CompilationUnit to CS */
-
-
-/*------------------------------------------------------------------------*
- *----- LEXER TOKEN LIST ------------------------------------------------*
- *------------------------------------------------------------------------*/
-
-/* START AUTOGENERATED TOKENS SECTION */
-TOKENS
- /* ----- terminal classes ----- */
- /* EOF is 0 */
- ident
- 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"
-/* END AUTOGENERATED TOKENS SECTION */
-
-/*------------------------------------------------------------------------*
- *----- PARSER -----------------------------------------------------------*
- *------------------------------------------------------------------------*/
-
-PRODUCTIONS
-
-/*--- compilation unit: */
-CS
-(. lexer.NextToken(); /* get the first token */ .)
-=
- { ExternAliasDirective }
- { UsingDirective }
- { IF (IsGlobalAttrTarget()) GlobalAttributeSection }
- { NamespaceMemberDecl }
- EOF
-.
-
-UsingDirective
-(.
- string qualident = null; TypeReference aliasedType = null;
-.)
-=
- "using" (. Location startPos = t.Location; .)
- Qualident<out qualident>
- [ "=" NonArrayType<out aliasedType> ]
- ";" (.
- if (qualident != null && qualident.Length > 0) {
- INode node;
- if (aliasedType != null) {
- node = new UsingDeclaration(qualident, aliasedType);
- } else {
- node = new UsingDeclaration(qualident);
- }
- node.StartLocation = startPos;
- node.EndLocation = t.EndLocation;
- compilationUnit.AddChild(node);
- }
- .)
-.
-
-GlobalAttributeSection
-=
- "[" (. Location startPos = t.Location; .) Identifier
- (. if (t.val != "assembly" && t.val != "module") Error("global attribute target specifier (assembly or module) expected");
- string attributeTarget = t.val;
- List<ASTAttribute> attributes = new List<ASTAttribute>();
- ASTAttribute attribute;
- .)
- ":" Attribute<out attribute> (. attributes.Add(attribute); .)
- { IF (NotFinalComma()) "," Attribute<out attribute> (. attributes.Add(attribute); .)}
- [ "," ]
- "]" (. AttributeSection section = new AttributeSection {
- AttributeTarget = attributeTarget,
- Attributes = attributes,
- StartLocation = startPos,
- EndLocation = t.EndLocation
- };
- compilationUnit.AddChild(section);
- .)
-.
-
-Attribute<out ASTAttribute attribute>
-(. string qualident;
- string alias = null;
-.)
-=
- (. Location startPos = la.Location; .)
- [ IF (IdentAndDoubleColon())
- Identifier (. alias = t.val; .)
- "::"
- ]
- Qualident<out qualident>
- (. List<Expression> positional = null;
- List<NamedArgumentExpression> named = null;
- string name = (alias != null && alias != "global") ? alias + "." + qualident : qualident;
- .)
- [ AttributeArguments<out positional, out named> ]
- (. attribute = new ASTAttribute(name, positional, named);
- attribute.StartLocation = startPos;
- attribute.EndLocation = t.EndLocation;
- .)
-.
-
-AttributeArguments<out List<Expression> positional, out List<NamedArgumentExpression> named>
-(.
- bool nameFound = false;
- string name = "";
- Expression expr;
- positional = new List<Expression>();
- named = new List<NamedArgumentExpression> ();
-.)
-=
- "("
- [
- [
- IF (IsAssignment()) (. nameFound = true; .)
- Identifier (. name = t.val; .)
- "="
- ] Expr<out expr> (. if (expr != null) {
- if(name == "") positional.Add(expr);
- else { named.Add(new NamedArgumentExpression(name, expr)); name = ""; }
- }
- .)
-
- {
- ","
- (
- IF (IsAssignment()) (. nameFound = true; .)
- Identifier (. name = t.val; .)
- "="
- | /*Empty*/ (. 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 = ""; }
- }
- .)
- }
- ]
- ")"
-.
-
-AttributeSection<out AttributeSection section>
-(.
- string attributeTarget = "";
- List<ASTAttribute> attributes = new List<ASTAttribute>();
- ASTAttribute attribute;
-
-.)
-=
- "[" (. Location startPos = t.Location; .) /*--- attribute target specifier: */
- [ IF (IsLocalAttrTarget())
- ( "event" (. attributeTarget = "event";.)
- | "return" (. attributeTarget = "return";.)
- | Identifier (. if (t.val != "field" && t.val != "method" &&
- t.val != "param" &&
- t.val != "property" && t.val != "type")
- Error("attribute target specifier (field, event, method, param, property, return or type) expected");
- attributeTarget = t.val;
- .)
- ) ":"
- ]
- /*--- attribute list: */
- 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
- };
- .)
-.
-
-NamespaceMemberDecl
-(.
- AttributeSection section;
- List<AttributeSection> attributes = new List<AttributeSection>();
- ModifierList m = new ModifierList();
- string qualident;
-.)
-= /*--- namespace declaration: */
- "namespace" (. Location startPos = t.Location; .)
- Qualident<out qualident> (. INode node = new NamespaceDeclaration(qualident);
- node.StartLocation = startPos;
- compilationUnit.AddChild(node);
- compilationUnit.BlockStart(node);
- .)
- "{"
- { ExternAliasDirective }
- { UsingDirective }
- { NamespaceMemberDecl }
- "}"
- [ ";" ] (. node.EndLocation = t.EndLocation;
- compilationUnit.BlockEnd();
- .)
- /*--- type declaration: */
-| { AttributeSection<out section> (. attributes.Add(section); .) }
- { TypeModifier<m> }
- TypeDecl<m, attributes>
-.
-
-ExternAliasDirective
-(. ExternAliasDirective ead = new ExternAliasDirective { StartLocation = la.Location }; .)
-=
- "extern"
- Identifier (. if (t.val != "alias") Error("Expected 'extern alias'."); .)
- Identifier (. ead.Name = t.val; .)
- ";" (. ead.EndLocation = t.EndLocation; .)
- (. compilationUnit.AddChild(ead); .)
-.
-
-TypeDecl<ModifierList m, List<AttributeSection> attributes>
-(.
- TypeReference type;
- List<TypeReference> names;
- List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
- string name;
- List<TemplateDefinition> templates;
-.)
-= /*--- class declaration: */ (. m.Check(Modifiers.Classes); .)
- "class" (. TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
- templates = newType.Templates;
- compilationUnit.AddChild(newType);
- compilationUnit.BlockStart(newType);
- newType.StartLocation = m.GetDeclarationLocation(t.Location);
-
- newType.Type = Types.Class;
- .)
- Identifier (. newType.Name = t.val; .)
-
- /* .NET 2.0 */
- [ TypeParameterList<templates> ]
-
- [ ClassBase<out names> (. newType.BaseTypes = names; .) ]
-
- /* .NET 2.0 */
- { TypeParameterConstraintsClause<templates> }
-
- (. newType.BodyStartLocation = t.EndLocation; .)
- "{"
- ClassBody
- "}"
- [ ";" ] (. newType.EndLocation = t.EndLocation;
- compilationUnit.BlockEnd();
- .)
-| /*--- struct declaration: */ (. m.Check(Modifiers.StructsInterfacesEnumsDelegates); .)
- ( "struct" (. TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
- templates = newType.Templates;
- newType.StartLocation = m.GetDeclarationLocation(t.Location);
- compilationUnit.AddChild(newType);
- compilationUnit.BlockStart(newType);
- newType.Type = Types.Struct;
- .)
- Identifier (. newType.Name = t.val; .)
-
- /* .NET 2.0 */
- [ TypeParameterList<templates> ]
-
- [ StructInterfaces<out names> (. newType.BaseTypes = names; .) ]
-
- /* .NET 2.0 */
- { TypeParameterConstraintsClause<templates> }
-
-
- (. newType.BodyStartLocation = t.EndLocation; .)
- StructBody
- [ ";" ] (. newType.EndLocation = t.EndLocation;
- compilationUnit.BlockEnd();
- .)
-| /*--- interface declaration: */
- "interface" (. TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
- templates = newType.Templates;
- compilationUnit.AddChild(newType);
- compilationUnit.BlockStart(newType);
- newType.StartLocation = m.GetDeclarationLocation(t.Location);
- newType.Type = Types.Interface;
- .)
- Identifier (. newType.Name = t.val; .)
-
- /* .NET 2.0 */
- [ TypeParameterList<templates> ]
-
- [ InterfaceBase<out names> (. newType.BaseTypes = names; .) ]
-
- /* .NET 2.0 */
- { TypeParameterConstraintsClause<templates> }
-
- (. newType.BodyStartLocation = t.EndLocation; .)
- InterfaceBody
- [ ";" ] (. newType.EndLocation = t.EndLocation;
- compilationUnit.BlockEnd();
- .)
-| /*--- enumeration declaration: */
- "enum" (. TypeDeclaration newType = new TypeDeclaration(m.Modifier, attributes);
- compilationUnit.AddChild(newType);
- compilationUnit.BlockStart(newType);
- newType.StartLocation = m.GetDeclarationLocation(t.Location);
- newType.Type = Types.Enum;
- .)
- Identifier (. newType.Name = t.val; .)
- [ ":" IntegralType<out name> (. newType.BaseTypes.Add(new TypeReference(name, true)); .)
- ]
- (. newType.BodyStartLocation = t.EndLocation; .)
- EnumBody
- [ ";" ] (. newType.EndLocation = t.EndLocation;
- compilationUnit.BlockEnd();
- .)
-| /*--- delegate declaration: */
- "delegate" (. DelegateDeclaration delegateDeclr = new DelegateDeclaration(m.Modifier, attributes);
- templates = delegateDeclr.Templates;
- delegateDeclr.StartLocation = m.GetDeclarationLocation(t.Location);
- .)
- ( IF (NotVoidPointer()) "void" (. delegateDeclr.ReturnType = new TypeReference("System.Void", true); .)
- | Type<out type> (. delegateDeclr.ReturnType = type; .)
- )
- Identifier (. delegateDeclr.Name = t.val; .)
-
- /* .NET 2.0 */
- [ TypeParameterList<templates> ]
-
- "(" [ FormalParameterList<p> (. delegateDeclr.Parameters = p; .)
- ] ")"
-
- /* .NET 2.0 */
- { TypeParameterConstraintsClause<templates> }
-
- ";" (. delegateDeclr.EndLocation = t.EndLocation;
- compilationUnit.AddChild(delegateDeclr);
- .)
- )
-.
-
-Qualident<out string qualident>
-=
- Identifier (. qualidentBuilder.Length = 0; qualidentBuilder.Append(t.val); .)
- { IF (DotAndIdent()) "." Identifier (. qualidentBuilder.Append('.');
- qualidentBuilder.Append(t.val);
- .)
- } (. qualident = qualidentBuilder.ToString(); .)
-.
-
-ClassBase<out List<TypeReference> names>
-(.
- TypeReference typeRef;
- names = new List<TypeReference>();
-.)
-=
- ":" ClassType<out typeRef, false> (. if (typeRef != null) { names.Add(typeRef); } .)
- { "," TypeName<out typeRef, false> (. if (typeRef != null) { names.Add(typeRef); } .) }
-.
-
-ClassBody
-(. AttributeSection section; .)
-=
- { (.List<AttributeSection> attributes = new List<AttributeSection>();
- ModifierList m = new ModifierList();
- .)
- SYNC
- { AttributeSection<out section> (. attributes.Add(section); .) }
- MemberModifiers<m>
- ClassMemberDecl<m, attributes>
- }
-.
-
-StructInterfaces<out List<TypeReference> names>
-(.
- TypeReference typeRef;
- names = new List<TypeReference>();
-.)
-=
- ":" TypeName<out typeRef, false> (. if (typeRef != null) { names.Add(typeRef); } .)
- { "," TypeName<out typeRef, false> (. if (typeRef != null) { names.Add(typeRef); } .) }
-.
-
-StructBody
-(. AttributeSection section; .)
-=
- "{"
- { (.List<AttributeSection> attributes = new List<AttributeSection>();
- ModifierList m = new ModifierList();
- .)
- { AttributeSection<out section> (. attributes.Add(section); .) }
- MemberModifiers<m>
- StructMemberDecl<m, attributes>
- }
- "}"
-.
-
-InterfaceBase<out List<TypeReference> names>
-(.
- TypeReference typeRef;
- names = new List<TypeReference>();
-.)
-=
- ":" TypeName<out typeRef, false> (. if (typeRef != null) { names.Add(typeRef); } .)
- { "," TypeName<out typeRef, false> (. if (typeRef != null) { names.Add(typeRef); } .) }
-.
-
-InterfaceBody
-= "{"
- { SYNC InterfaceMemberDecl }
- "}"
-.
-
-EnumBody (. FieldDeclaration f; .)
-=
- "{"
- [ EnumMemberDecl<out f> (. compilationUnit.AddChild(f); .)
- { IF (NotFinalComma()) ","
- EnumMemberDecl<out f> (. compilationUnit.AddChild(f); .)
- }
- [","] ]
- "}"
-.
-
-Type<out TypeReference type>
-=
- TypeWithRestriction<out type, true, false>
-.
-
-TypeWithRestriction<out TypeReference type, bool allowNullable, bool canBeUnbound>
-(.
- Location startPos = la.Location;
- string name;
- int pointer = 0;
- type = null;
-.)
-=
- ( ClassType<out type, canBeUnbound>
- | SimpleType<out name> (. type = new TypeReference(name, true); .)
- | "void" "*" (. pointer = 1; type = new TypeReference("System.Void", true); .)
- ) (. List<int> r = new List<int>(); .)
-
- [ IF (allowNullable && la.kind == Tokens.Question) NullableQuestionMark<ref type> ]
-
- { IF (IsPointerOrDims()) (. int i = 0; .)
- ( "*" (. ++pointer; .)
- | "[" { "," (. ++i; .) } "]" (. r.Add(i); .)
- )
- }
- (. if (type != null) {
- type.RankSpecifier = r.ToArray();
- type.PointerNestingLevel = pointer;
- type.EndLocation = t.EndLocation;
- type.StartLocation = startPos;
- }
- .)
-.
-
-
-NonArrayType<out TypeReference type>
-(.
- Location startPos = la.Location;
- string name;
- int pointer = 0;
- type = null;
-.)
-=
- ( ClassType<out type, false>
- | SimpleType<out name> (. type = new TypeReference(name, true); .)
- | "void" "*" (. pointer = 1; type = new TypeReference("System.Void", true); .)
- )
-
- [ NullableQuestionMark<ref type> ]
-
- { IF (IsPointer())
- "*" (. ++pointer; .)
- }
- (.if (type != null) {
- type.PointerNestingLevel = pointer;
- type.EndLocation = t.EndLocation;
- type.StartLocation = startPos;
- }
- .)
-.
-
-SimpleType<out string name>
-(. name = String.Empty; .)
-=
- IntegralType<out name>
- | "float" (. name = "System.Single"; .)
- | "double" (. name = "System.Double"; .)
- | "decimal" (. name = "System.Decimal"; .)
- | "bool" (. name = "System.Boolean"; .)
-.
-
-
-FormalParameterList<List<ParameterDeclarationExpression> parameter>
-(.
-
- ParameterDeclarationExpression p;
- AttributeSection section;
- List<AttributeSection> attributes = new List<AttributeSection>();
-.)
-=
- { AttributeSection<out section> (.attributes.Add(section); .) }
- (
- FixedParameter<out p> (. bool paramsFound = false;
- p.Attributes = attributes;
- parameter.Add(p);
- .)
- {
- "," (. attributes = new List<AttributeSection>(); if (paramsFound) Error("params array must be at end of parameter list"); .)
- { AttributeSection<out section> (.attributes.Add(section); .) }
- (
- FixedParameter<out p> (. p.Attributes = attributes; parameter.Add(p); .)
- | ParameterArray<out p> (. paramsFound = true; p.Attributes = attributes; parameter.Add(p); .)
- )
- }
- | ParameterArray<out p> (. p.Attributes = attributes; parameter.Add(p); .)
- )
-.
-
-FixedParameter<out ParameterDeclarationExpression p>
-(.
- TypeReference type;
- ParameterModifiers mod = ParameterModifiers.In;
- Location start = la.Location;
- Expression defaultParameterExpr = null;
-.)
-=
- [
- "ref" (. mod = ParameterModifiers.Ref; .)
- | "out" (. mod = ParameterModifiers.Out; .)
- ]
- Type<out type> Identifier (. p = new ParameterDeclarationExpression(type, t.val, mod); p.StartLocation = start; p.EndLocation = t.Location; .)
- [ "=" Expr<out defaultParameterExpr> ]
-.
-
-ParameterArray<out ParameterDeclarationExpression p>
-(. TypeReference type; .)
-=
- "params" Type<out type> Identifier (. p = new ParameterDeclarationExpression(type, t.val, ParameterModifiers.Params); .)
-.
-
-AccessorModifiers<out ModifierList m>
-(. m = new ModifierList(); .)
-=
- "private" (. m.Add(Modifiers.Private, t.Location); .)
- | "protected" (. m.Add(Modifiers.Protected, t.Location); .)
- ["internal" (. m.Add(Modifiers.Internal, t.Location); .)]
- | "internal" (. m.Add(Modifiers.Internal, t.Location); .)
- ["protected" (. m.Add(Modifiers.Protected, t.Location); .)]
-.
-
-TypeModifier<ModifierList m>
-=
- "new" (. m.Add(Modifiers.New, t.Location); .)
- | "public" (. m.Add(Modifiers.Public, t.Location); .)
- | "protected" (. m.Add(Modifiers.Protected, t.Location); .)
- | "internal" (. m.Add(Modifiers.Internal, t.Location); .)
- | "private" (. m.Add(Modifiers.Private, t.Location); .)
- | "unsafe" (. m.Add(Modifiers.Unsafe, t.Location); .)
- | "abstract" (. m.Add(Modifiers.Abstract, t.Location); .)
- | "sealed" (. m.Add(Modifiers.Sealed, t.Location); .)
- | "static" (. m.Add(Modifiers.Static, t.Location); .)
- | "partial" (. m.Add(Modifiers.Partial, t.Location); .)
-.
-
-ClassType<out TypeReference typeRef, bool canBeUnbound>
-(. TypeReference r; typeRef = null; .)
-=
- TypeName<out r, canBeUnbound> (. typeRef = r; .)
- | "object" (. typeRef = new TypeReference("System.Object", true); typeRef.StartLocation = t.Location; .)
- | "string" (. typeRef = new TypeReference("System.String", true); typeRef.StartLocation = t.Location; .)
-.
-
-IntegralType<out string name> (. name = ""; .)
-=
- "sbyte" (. name = "System.SByte"; .)
- | "byte" (. name = "System.Byte"; .)
- | "short" (. name = "System.Int16"; .)
- | "ushort" (. name = "System.UInt16"; .)
- | "int" (. name = "System.Int32"; .)
- | "uint" (. name = "System.UInt32"; .)
- | "long" (. name = "System.Int64"; .)
- | "ulong" (. name = "System.UInt64"; .)
- | "char" (. name = "System.Char"; .)
-.
-
-MemberModifiers<ModifierList m>
-=
- {
- "abstract" (. m.Add(Modifiers.Abstract, t.Location); .)
- | "extern" (. m.Add(Modifiers.Extern, t.Location); .)
- | "internal" (. m.Add(Modifiers.Internal, t.Location); .)
- | "new" (. m.Add(Modifiers.New, t.Location); .)
- | "override" (. m.Add(Modifiers.Override, t.Location); .)
- | "private" (. m.Add(Modifiers.Private, t.Location); .)
- | "protected" (. m.Add(Modifiers.Protected, t.Location); .)
- | "public" (. m.Add(Modifiers.Public, t.Location); .)
- | "readonly" (. m.Add(Modifiers.ReadOnly, t.Location); .)
- | "sealed" (. m.Add(Modifiers.Sealed, t.Location); .)
- | "static" (. m.Add(Modifiers.Static, t.Location); .)
- | "fixed" (. m.Add(Modifiers.Fixed, t.Location); .)
- | "unsafe" (. m.Add(Modifiers.Unsafe, t.Location); .)
- | "virtual" (. m.Add(Modifiers.Virtual, t.Location); .)
- | "volatile" (. m.Add(Modifiers.Volatile, t.Location); .)
- | "partial" (. m.Add(Modifiers.Partial, t.Location); .)
- }
-.
-
-StructMemberDecl<ModifierList m, List<AttributeSection> attributes>
-(.
- string qualident = null;
- TypeReference type;
- Expression expr;
- List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
- Statement stmt = null;
- List<TemplateDefinition> templates = new List<TemplateDefinition>();
- TypeReference explicitInterface = null;
- bool isExtensionMethod = false;
-.)
-=
- /*--- constant declaration: */ (. m.Check(Modifiers.Constants); .)
- "const" (.Location startPos = t.Location; .)
- Type<out type> Identifier (. FieldDeclaration fd = new FieldDeclaration(attributes, type, m.Modifier | Modifiers.Const);
- fd.StartLocation = m.GetDeclarationLocation(startPos);
- VariableDeclaration f = new VariableDeclaration(t.val);
- f.StartLocation = t.Location;
- f.TypeReference = type;
- SafeAdd(fd, fd.Fields, f);
- .)
- "=" Expr<out expr> (. f.Initializer = expr; .)
- { "," Identifier (. f = new VariableDeclaration(t.val);
- f.StartLocation = t.Location;
- f.TypeReference = type;
- SafeAdd(fd, fd.Fields, f);
- .)
- "=" Expr<out expr> (. f.EndLocation = t.EndLocation; f.Initializer = expr; .)
- } ";" (. fd.EndLocation = t.EndLocation; compilationUnit.AddChild(fd); .)
-
-
-| /*--- void method (procedure) declaration: */
- IF (NotVoidPointer()) (. m.Check(Modifiers.PropertysEventsMethods); .)
- "void" (. Location startPos = t.Location; .)
- ( IF (IsExplicitInterfaceImplementation())
- TypeName<out explicitInterface, false>
- (.if (la.kind != Tokens.Dot || Peek(1).kind != Tokens.This) {
- qualident = TypeReference.StripLastIdentifierFromType(ref explicitInterface);
- } .)
- | Identifier (. qualident = t.val; .)
- )
- /* .NET 2.0 */
- [ TypeParameterList<templates> ]
-
- "("
- [ "this" (. isExtensionMethod = true; /* C# 3.0 */ .) ]
- [ FormalParameterList<p> ] ")"
- (. MethodDeclaration methodDeclaration = new MethodDeclaration {
- Name = qualident,
- Modifier = m.Modifier,
- TypeReference = new TypeReference("System.Void", true),
- Parameters = p,
- Attributes = attributes,
- StartLocation = m.GetDeclarationLocation(startPos),
- EndLocation = t.EndLocation,
- Templates = templates,
- IsExtensionMethod = isExtensionMethod
- };
- if (explicitInterface != null)
- SafeAdd(methodDeclaration, methodDeclaration.InterfaceImplementations, new InterfaceImplementation(explicitInterface, qualident));
- compilationUnit.AddChild(methodDeclaration);
- compilationUnit.BlockStart(methodDeclaration);
- .)
-
- /* .NET 2.0 */
- { TypeParameterConstraintsClause<templates> }
-
- ( Block<out stmt> | ";" ) (. compilationUnit.BlockEnd();
- methodDeclaration.Body = (BlockStatement)stmt;
- .)
-
-| /*--- event declaration: */ (. m.Check(Modifiers.PropertysEventsMethods); .)
- "event"
- (. EventDeclaration eventDecl = new EventDeclaration {
- Modifier = m.Modifier,
- Attributes = attributes,
- StartLocation = t.Location
- };
- compilationUnit.AddChild(eventDecl);
- compilationUnit.BlockStart(eventDecl);
- EventAddRegion addBlock = null;
- EventRemoveRegion removeBlock = null;
- .)
- Type<out type> (. eventDecl.TypeReference = type; .)
- ( IF (IsExplicitInterfaceImplementation())
- TypeName<out explicitInterface, false>
- (. qualident = TypeReference.StripLastIdentifierFromType(ref explicitInterface); .)
- (. eventDecl.InterfaceImplementations.Add(new InterfaceImplementation(explicitInterface, qualident)); .)
-
- | Identifier (. qualident = t.val; .)
- )
- (. eventDecl.Name = qualident; eventDecl.EndLocation = t.EndLocation; .)
- [ "=" Expr<out expr> (. eventDecl.Initializer = expr; .) ]
- [ "{" (. eventDecl.BodyStart = t.Location; .)
- EventAccessorDecls<out addBlock, out removeBlock>
- "}" (. eventDecl.BodyEnd = t.EndLocation; .)
- ]
- (. compilationUnit.BlockEnd();
- eventDecl.AddRegion = addBlock;
- eventDecl.RemoveRegion = removeBlock;
- .)
- { "," Identifier (. EventDeclaration additionalEventDeclaration = new EventDeclaration {
- Modifier = eventDecl.Modifier,
- Attributes = eventDecl.Attributes,
- StartLocation = eventDecl.StartLocation,
- TypeReference = eventDecl.TypeReference,
- Name = t.val
- };
- compilationUnit.AddChild (additionalEventDeclaration);
- .)
- }
- [ ";" ]
-
-
-| /*--- constructor or static contructor declaration: */
- IF (IdentAndLPar()) (. m.Check(Modifiers.Constructors | Modifiers.StaticConstructors); .)
- Identifier (. string name = t.val; Location startPos = t.Location; .) "(" [ (. m.Check(Modifiers.Constructors); .)
- FormalParameterList<p>
- ]
- ")" (.ConstructorInitializer init = null; .)
- [ (. m.Check(Modifiers.Constructors); .)
- ConstructorInitializer<out init>
- ] (.
- ConstructorDeclaration cd = new ConstructorDeclaration(name, m.Modifier, p, init, attributes);
- cd.StartLocation = startPos;
- cd.EndLocation = t.EndLocation;
- .)
-
- ( Block<out stmt> | ";" ) (. cd.Body = (BlockStatement)stmt; compilationUnit.AddChild(cd); .)
-
-
-| /*--- conversion operator declaration: */ (. m.Check(Modifiers.Operators);
- if (m.isNone) Error("at least one modifier must be set");
- bool isImplicit = true;
- Location startPos = Location.Empty;
- .)
- ( "implicit" (. startPos = t.Location; .) | "explicit" (. isImplicit = false; startPos = t.Location; .) )
- "operator" Type<out type> (. TypeReference operatorType = type; .)
- "(" Type<out type> Identifier (. string varName = t.val; .) ")"
- (. Location endPos = t.Location; .)
- ( Block<out stmt> | ";" (. stmt = null; .) )
- (.
-
- 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,
- TypeReference = operatorType,
- ConversionType = isImplicit ? ConversionType.Implicit : ConversionType.Explicit,
- Body = (BlockStatement)stmt,
- StartLocation = m.GetDeclarationLocation(startPos),
- EndLocation = endPos
- };
- compilationUnit.AddChild(operatorDeclaration);
- .)
-
-
-| /*--- inner type declaration: */
- TypeDecl<m, attributes>
-
-| Type<out type> (. Location startPos = t.Location; .)
- (
- /*--- operator declaration: */ (. OverloadableOperatorType op;
- m.Check(Modifiers.Operators);
- if (m.isNone) Error("at least one modifier must be set");
- .)
- "operator" OverloadableOperator<out op> (. TypeReference firstType, secondType = null; string secondName = null; .)
- "(" Type<out firstType> Identifier (. string firstName = t.val; .)
- ( "," Type<out secondType> Identifier (. secondName = t.val; .) /* (. if (Tokens.OverloadableUnaryOp[op.kind] && !Tokens.OverloadableBinaryOp[op.kind])
- Error("too many operands for unary operator");
- .)*/
- | /* empty */ /*(. if (Tokens.OverloadableBinaryOp[op.kind]){
- Error("too few operands for binary operator");
- }
- .)*/
- )
- (. 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
- };
- SafeAdd(operatorDeclaration, operatorDeclaration.Parameters, new ParameterDeclarationExpression(firstType, firstName));
- if (secondType != null) {
- SafeAdd(operatorDeclaration, operatorDeclaration.Parameters, new ParameterDeclarationExpression(secondType, secondName));
- }
- compilationUnit.AddChild(operatorDeclaration);
- .)
-
- /*--- field declaration: */
- | IF (IsVarDecl())
- (. m.Check(Modifiers.Fields);
- FieldDeclaration fd = new FieldDeclaration(attributes, type, m.Modifier);
- fd.StartLocation = m.GetDeclarationLocation(startPos);
- .)
- ( IF (m.Contains(Modifiers.Fixed))
- VariableDeclarator<fd>
- "["
- Expr<out expr> (. if (fd.Fields.Count > 0)
- fd.Fields[fd.Fields.Count-1].FixedArrayInitialization = expr; .)
- "]"
- { ","
- VariableDeclarator<fd>
- "["
- Expr<out expr> (. if (fd.Fields.Count > 0)
- fd.Fields[fd.Fields.Count-1].FixedArrayInitialization = expr; .)
- "]"
- }
- | /* non-fixed field */
- VariableDeclarator<fd>
- { "," VariableDeclarator<fd> }
- )
- ";" (. fd.EndLocation = t.EndLocation; compilationUnit.AddChild(fd); .)
-
- /*--- unqualified indexer declaration (without interface name): */
- | (. m.Check(Modifiers.Indexers); .)
- "this" "[" FormalParameterList<p> "]" (. Location endLocation = t.EndLocation; .) "{" (.
- IndexerDeclaration indexer = new IndexerDeclaration(type, p, m.Modifier, attributes);
- indexer.StartLocation = startPos;
- indexer.EndLocation = endLocation;
- indexer.BodyStart = t.Location;
- PropertyGetRegion getRegion;
- PropertySetRegion setRegion;
- .)
- AccessorDecls<out getRegion, out setRegion> "}" (.
- indexer.BodyEnd = t.EndLocation;
- indexer.GetRegion = getRegion;
- indexer.SetRegion = setRegion;
- compilationUnit.AddChild(indexer);
- .)
- | IF (IsIdentifierToken(la))
- ( IF (IsExplicitInterfaceImplementation())
- TypeName<out explicitInterface, false>
- (.if (la.kind != Tokens.Dot || Peek(1).kind != Tokens.This) {
- qualident = TypeReference.StripLastIdentifierFromType(ref explicitInterface);
- } .)
- | Identifier (. qualident = t.val; .)
- )
- (. Location qualIdentEndLocation = t.EndLocation; .)
-
- (
- /*--- "not void" method (function) declaration: */
- ( (. m.Check(Modifiers.PropertysEventsMethods); .)
- /* .NET 2.0 */
- [ TypeParameterList<templates> ]
- "("
- [ "this" (. isExtensionMethod = true; .) ]
- [ FormalParameterList<p> ] ")"
- (.
- MethodDeclaration methodDeclaration = new MethodDeclaration {
- Name = qualident,
- Modifier = m.Modifier,
- TypeReference = type,
- Parameters = p,
- Attributes = attributes
- };
- if (explicitInterface != null)
- methodDeclaration.InterfaceImplementations.Add(new InterfaceImplementation(explicitInterface, qualident));
- methodDeclaration.StartLocation = m.GetDeclarationLocation(startPos);
- methodDeclaration.EndLocation = t.EndLocation;
- methodDeclaration.IsExtensionMethod = isExtensionMethod;
- methodDeclaration.Templates = templates;
- compilationUnit.AddChild(methodDeclaration);
- .)
- { TypeParameterConstraintsClause<templates> }
- ( Block<out stmt> | ";" ) (. methodDeclaration.Body = (BlockStatement)stmt; .)
-
- /*--- property declaration: */
- | "{" (. PropertyDeclaration pDecl = new PropertyDeclaration(qualident, type, m.Modifier, attributes);
- if (explicitInterface != null)
- pDecl.InterfaceImplementations.Add(new InterfaceImplementation(explicitInterface, qualident));
- pDecl.StartLocation = m.GetDeclarationLocation(startPos);
- pDecl.EndLocation = qualIdentEndLocation;
- pDecl.BodyStart = t.Location;
- PropertyGetRegion getRegion;
- PropertySetRegion setRegion;
- .)
- AccessorDecls<out getRegion, out setRegion>
- "}" (.
- pDecl.GetRegion = getRegion;
- pDecl.SetRegion = setRegion;
- pDecl.BodyEnd = t.EndLocation;
- compilationUnit.AddChild(pDecl);
- .)
- )
-
- /*--- qualified indexer declaration (with interface name): */
- | (. m.Check(Modifiers.Indexers); .)
- "." "this" "[" FormalParameterList<p> "]" (.
- IndexerDeclaration indexer = new IndexerDeclaration(type, p, m.Modifier, attributes);
- indexer.StartLocation = m.GetDeclarationLocation(startPos);
- indexer.EndLocation = t.EndLocation;
- if (explicitInterface != null)
- SafeAdd(indexer, indexer.InterfaceImplementations, new InterfaceImplementation(explicitInterface, "this"));
- PropertyGetRegion getRegion;
- PropertySetRegion setRegion;
- .)
- "{" (. Location bodyStart = t.Location; .)
- AccessorDecls<out getRegion, out setRegion>
- "}" (. indexer.BodyStart = bodyStart;
- indexer.BodyEnd = t.EndLocation;
- indexer.GetRegion = getRegion;
- indexer.SetRegion = setRegion;
- compilationUnit.AddChild(indexer);
- .)
- )
- )
-.
-
-ClassMemberDecl<ModifierList m, List<AttributeSection> attributes>
-(. Statement stmt = null; .)
-=
- StructMemberDecl<m, attributes>
- | /*--- destructor declaration: */ (. m.Check(Modifiers.Destructors); Location startPos = la.Location; .)
- "~" Identifier (. DestructorDeclaration d = new DestructorDeclaration(t.val, m.Modifier, attributes);
- d.Modifier = m.Modifier;
- d.StartLocation = m.GetDeclarationLocation(startPos);
- .)
- "(" ")" (. d.EndLocation = t.EndLocation; .) ( Block<out stmt> | ";" ) (.
- d.Body = (BlockStatement)stmt;
- compilationUnit.AddChild(d);
- .)
-.
-
-InterfaceMemberDecl
-(.
- TypeReference type;
-
- AttributeSection section;
- Modifiers mod = Modifiers.None;
- List<AttributeSection> attributes = new List<AttributeSection>();
- List<ParameterDeclarationExpression> parameters = new List<ParameterDeclarationExpression>();
- string name;
- PropertyGetRegion getBlock;
- PropertySetRegion setBlock;
- Location startLocation = new Location(-1, -1);
- List<TemplateDefinition> templates = new List<TemplateDefinition>();
-.)
-=
- { AttributeSection<out section> (. attributes.Add(section); .)}
- [ "new" (. mod = Modifiers.New; startLocation = t.Location; .) ]
- (
- /*--- interface void method (procedure) declaration: */
- IF (NotVoidPointer()) "void" (. if (startLocation.IsEmpty) startLocation = t.Location; .)
- Identifier (. name = t.val; .)
- [ TypeParameterList<templates> ]
- "(" [ FormalParameterList<parameters> ] ")"
- { TypeParameterConstraintsClause<templates> }
- ";"
- (. MethodDeclaration md = new MethodDeclaration {
- Name = name, Modifier = mod, TypeReference = new TypeReference("System.Void", true),
- Parameters = parameters, Attributes = attributes, Templates = templates,
- StartLocation = startLocation, EndLocation = t.EndLocation
- };
- compilationUnit.AddChild(md);
- .)
- | (
- Type<out type> (. if (startLocation.IsEmpty) startLocation = t.Location; .)
- (
- Identifier (. name = t.val; Location qualIdentEndLocation = t.EndLocation; .)
- (
- /*--- interface "not void" method (function) declaration: */
- /* .NET 2.0 */
- [ TypeParameterList<templates> ]
- "(" [ FormalParameterList<parameters> ] ")"
- /* .NET 2.0 */
- { TypeParameterConstraintsClause<templates> }
- ";" (. MethodDeclaration md = new MethodDeclaration {
- Name = name, Modifier = mod, TypeReference = type,
- Parameters = parameters, Attributes = attributes, Templates = templates,
- StartLocation = startLocation, EndLocation = t.EndLocation
- };
- compilationUnit.AddChild(md);
- .)
- /*--- interface property declaration: */
- |
- (. PropertyDeclaration pd = new PropertyDeclaration(name, type, mod, attributes);
- compilationUnit.AddChild(pd); .)
- "{"
- (. Location bodyStart = t.Location;.)
- InterfaceAccessors<out getBlock, out setBlock>
- "}" (. pd.GetRegion = getBlock; pd.SetRegion = setBlock; pd.StartLocation = startLocation; pd.EndLocation = qualIdentEndLocation; pd.BodyStart = bodyStart; pd.BodyEnd = t.EndLocation; .)
- )
- /*--- interface indexer declaration: */
- | "this" "[" FormalParameterList<parameters> "]"
- (. Location bracketEndLocation = t.EndLocation; .)
- (. IndexerDeclaration id = new IndexerDeclaration(type, parameters, mod, attributes);
- compilationUnit.AddChild(id); .)
- "{" (. Location bodyStart = t.Location;.)
- InterfaceAccessors<out getBlock, out setBlock>
- "}"
- (. id.GetRegion = getBlock; id.SetRegion = setBlock; id.StartLocation = startLocation; id.EndLocation = bracketEndLocation; id.BodyStart = bodyStart; id.BodyEnd = t.EndLocation;.)
- )
- /*--- interface event declaration: */
- | "event" (. if (startLocation.IsEmpty) startLocation = t.Location; .)
- Type<out type> Identifier
- (. EventDeclaration ed = new EventDeclaration {
- TypeReference = type, Name = t.val, Modifier = mod, Attributes = attributes
- };
- compilationUnit.AddChild(ed);
- .)
- ";"
- (. ed.StartLocation = startLocation; ed.EndLocation = t.EndLocation; .)
- )
- )
-.
-
-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 = t.Location;
- f.EndLocation = t.EndLocation;
- .)
- [ "=" Expr<out expr> (. varDecl.Initializer = expr; .) ]
-.
-
-
-AccessorDecls<out PropertyGetRegion getBlock, out PropertySetRegion setBlock>
-(.
- List<AttributeSection> attributes = new List<AttributeSection>();
- AttributeSection section;
- getBlock = null;
- setBlock = null;
- ModifierList modifiers = null;
-.)
-=
- { AttributeSection<out section> (. attributes.Add(section); .) }
- [ AccessorModifiers<out modifiers> ]
- (
- GetAccessorDecl<out getBlock, attributes>
- (. if (modifiers != null) {getBlock.Modifier = modifiers.Modifier; } .)
- [ (. attributes = new List<AttributeSection>(); modifiers = null; .)
- { AttributeSection<out section> (. attributes.Add(section); .) }
- [ AccessorModifiers<out modifiers> ]
- SetAccessorDecl<out setBlock, attributes>
- (. if (modifiers != null) {setBlock.Modifier = modifiers.Modifier; } .)
- ]
- |
- SetAccessorDecl<out setBlock, attributes>
- (. if (modifiers != null) {setBlock.Modifier = modifiers.Modifier; } .)
- [ (. attributes = new List<AttributeSection>(); modifiers = null; .)
- { AttributeSection<out section> (. attributes.Add(section); .) }
- [ AccessorModifiers<out modifiers> ]
- GetAccessorDecl<out getBlock, attributes>
- (. if (modifiers != null) {getBlock.Modifier = modifiers.Modifier; } .)
- ]
- | Identifier (. Error("get or set accessor declaration expected"); .)
- )
-.
-
-GetAccessorDecl<out PropertyGetRegion getBlock, List<AttributeSection> attributes>
-(. Statement stmt = null; .)
-=
- "get"
- (. Location startLocation = t.Location; .)
- ( Block<out stmt> | ";" )
- (. getBlock = new PropertyGetRegion((BlockStatement)stmt, attributes); .)
- (. getBlock.StartLocation = startLocation; getBlock.EndLocation = t.EndLocation; .)
-.
-
-SetAccessorDecl<out PropertySetRegion setBlock, List<AttributeSection> attributes>
-(. Statement stmt = null; .)
-=
- "set"
- (. Location startLocation = t.Location; .)
- ( Block<out stmt> | ";" )
- (. setBlock = new PropertySetRegion((BlockStatement)stmt, attributes); .)
- (. setBlock.StartLocation = startLocation; setBlock.EndLocation = t.EndLocation; .)
-.
-
-EventAccessorDecls<out EventAddRegion addBlock, out EventRemoveRegion removeBlock>
-(. AttributeSection section;
- List<AttributeSection> attributes = new List<AttributeSection>();
- Statement stmt;
- addBlock = null;
- removeBlock = null;
-.)
-=
- { AttributeSection<out section> (. attributes.Add(section); .) }
- (
- (. addBlock = new EventAddRegion(attributes); .)
- AddAccessorDecl<out stmt> (. attributes = new List<AttributeSection>(); addBlock.Block = (BlockStatement)stmt; .)
- { AttributeSection<out section> (. attributes.Add(section); .)}
- RemoveAccessorDecl<out stmt> (. removeBlock = new EventRemoveRegion(attributes); removeBlock.Block = (BlockStatement)stmt; .)
- |
- RemoveAccessorDecl <out stmt> (. removeBlock = new EventRemoveRegion(attributes); removeBlock.Block = (BlockStatement)stmt; attributes = new List<AttributeSection>(); .)
- { AttributeSection<out section> (. attributes.Add(section); .) }
- AddAccessorDecl<out stmt> (. addBlock = new EventAddRegion(attributes); addBlock.Block = (BlockStatement)stmt; .)
- )
-.
-
-InterfaceAccessors<out PropertyGetRegion getBlock, out PropertySetRegion setBlock>
-(.
- AttributeSection section;
- List<AttributeSection> attributes = new List<AttributeSection>();
- getBlock = null; setBlock = null;
- PropertyGetSetRegion lastBlock = null;
-.)
-=
- { AttributeSection<out section> (. attributes.Add(section); .) }
- (. Location startLocation = la.Location; .)
- (
- "get" (. getBlock = new PropertyGetRegion(null, attributes); .)
- | "set" (. setBlock = new PropertySetRegion(null, attributes); .)
- )
- ";"
- (. if (getBlock != null) { getBlock.StartLocation = startLocation; getBlock.EndLocation = t.EndLocation; }
- if (setBlock != null) { setBlock.StartLocation = startLocation; setBlock.EndLocation = t.EndLocation; }
- attributes = new List<AttributeSection>(); .)
- [
- { AttributeSection<out section> (. attributes.Add(section); .) }
- (. startLocation = la.Location; .)
- (
- "get" (. if (getBlock != null) Error("get already declared");
- else { getBlock = new PropertyGetRegion(null, attributes); lastBlock = getBlock; }
- .)
- | "set" (. if (setBlock != null) Error("set already declared");
- else { setBlock = new PropertySetRegion(null, attributes); lastBlock = setBlock; }
- .)
- )
- ";"
- (. if (lastBlock != null) { lastBlock.StartLocation = startLocation; lastBlock.EndLocation = t.EndLocation; } .)
- ]
-.
-
-VariableDeclarator<FieldDeclaration parentFieldDeclaration>
-(. Expression expr = null; .)
-=
- Identifier (. VariableDeclaration f = new VariableDeclaration(t.val); f.StartLocation = t.Location; .)
- [ "=" VariableInitializer<out expr> (. f.Initializer = expr; .) ]
- (. f.EndLocation = t.EndLocation; SafeAdd(parentFieldDeclaration, parentFieldDeclaration.Fields, f); .)
-.
-
-Block<out Statement stmt> /* not BlockStatement because of EmbeddedStatement */
-=
- "{" (. BlockStatement blockStmt = new BlockStatement();
- blockStmt.StartLocation = t.Location;
- compilationUnit.BlockStart(blockStmt);
- if (!ParseMethodBodies) lexer.SkipCurrentBlock(0);
- .)
- { Statement }
- SYNC "}"
- (.
- stmt = blockStmt;
- blockStmt.EndLocation = t.Kind != Tokens.CloseCurlyBrace ? Location.Empty : t.EndLocation;
- compilationUnit.BlockEnd();
- .)
-.
-
-AddAccessorDecl<out Statement stmt>
-(.stmt = null;.)
-=
- "add"
- Block<out stmt>
-.
-
-RemoveAccessorDecl<out Statement stmt>
-(.stmt = null;.)
-=
- "remove"
- Block<out stmt>
-.
-
-ConstructorInitializer<out ConstructorInitializer ci>
-(. Expression expr; ci = new ConstructorInitializer(); .)
-=
- ":"
- (
- "base" (. ci.ConstructorInitializerType = ConstructorInitializerType.Base; .)
- | "this" (. ci.ConstructorInitializerType = ConstructorInitializerType.This; .)
- )
- "("
- [ Argument<out expr> (. SafeAdd(ci, ci.Arguments, expr); .)
- { "," Argument<out expr> (. SafeAdd(ci, ci.Arguments, expr); .) }
- ]
- ")"
-.
-
-VariableInitializer<out Expression initializerExpression>
-(. TypeReference type = null; Expression expr = null; initializerExpression = null; .)
-=
- Expr<out initializerExpression>
- | CollectionInitializer<out initializerExpression>
- | "stackalloc" Type<out type> "[" Expr<out expr> "]" (. initializerExpression = new StackAllocExpression(type, expr); .)
-.
-
-OverloadableOperator<out OverloadableOperatorType op>
-(. op = OverloadableOperatorType.None; .)
-=
- "+" (. op = OverloadableOperatorType.Add; .)
- | "-" (. op = OverloadableOperatorType.Subtract; .)
-
- | "!" (. op = OverloadableOperatorType.Not; .)
- | "~" (. op = OverloadableOperatorType.BitNot; .)
-
- | "++" (. op = OverloadableOperatorType.Increment; .)
- | "--" (. op = OverloadableOperatorType.Decrement; .)
-
- | "true" (. op = OverloadableOperatorType.IsTrue; .)
- | "false" (. op = OverloadableOperatorType.IsFalse; .)
-
- | "*" (. op = OverloadableOperatorType.Multiply; .)
- | "/" (. op = OverloadableOperatorType.Divide; .)
- | "%" (. op = OverloadableOperatorType.Modulus; .)
-
- | "&" (. op = OverloadableOperatorType.BitwiseAnd; .)
- | "|" (. op = OverloadableOperatorType.BitwiseOr; .)
- | "^" (. op = OverloadableOperatorType.ExclusiveOr; .)
-
- | "<<" (. op = OverloadableOperatorType.ShiftLeft; .)
- | "==" (. op = OverloadableOperatorType.Equality; .)
- | "!=" (. op = OverloadableOperatorType.InEquality; .)
- | "<" (. op = OverloadableOperatorType.LessThan; .)
- | ">=" (. op = OverloadableOperatorType.GreaterThanOrEqual; .)
- | "<=" (. op = OverloadableOperatorType.LessThanOrEqual; .)
- | ">" (. op = OverloadableOperatorType.GreaterThan; .) [ ">" (. op = OverloadableOperatorType.ShiftRight; .) ]
-.
-
-Argument<out Expression argumentexpr>
-(.
- Expression expr;
- FieldDirection fd = FieldDirection.None;
-.)
-=
- [
- "ref" (. fd = FieldDirection.Ref; .)
- | "out" (. fd = FieldDirection.Out; .)
- ]
- Expr<out expr>
- (. argumentexpr = fd != FieldDirection.None ? argumentexpr = new DirectionExpression(fd, expr) : expr; .)
-.
-
-AssignmentOperator<out AssignmentOperatorType op>
-(. op = AssignmentOperatorType.None; .)
-=
- "=" (. op = AssignmentOperatorType.Assign; .)
- | "+=" (. op = AssignmentOperatorType.Add; .)
- | "-=" (. op = AssignmentOperatorType.Subtract; .)
- | "*=" (. op = AssignmentOperatorType.Multiply; .)
- | "/=" (. op = AssignmentOperatorType.Divide; .)
- | "%=" (. op = AssignmentOperatorType.Modulus; .)
- | "&=" (. op = AssignmentOperatorType.BitwiseAnd; .)
- | "|=" (. op = AssignmentOperatorType.BitwiseOr; .)
- | "^=" (. op = AssignmentOperatorType.ExclusiveOr; .)
- | "<<=" (. op = AssignmentOperatorType.ShiftLeft; .)
- | IF (la.kind == Tokens.GreaterThan && Peek(1).kind == Tokens.GreaterEqual)
- ">" ">=" (. op = AssignmentOperatorType.ShiftRight; .)
-.
-
-CollectionInitializer<out Expression outExpr>
-(.
- Expression expr = null;
- CollectionInitializerExpression initializer = new CollectionInitializerExpression();
-.)
-=
- "{" (. initializer.StartLocation = t.Location; .)
- [ VariableInitializer<out expr>
- (. SafeAdd(initializer, initializer.CreateExpressions, expr); .)
- { IF (NotFinalComma())
- "," VariableInitializer<out expr>
- (. SafeAdd(initializer, initializer.CreateExpressions, expr); .)
- }
- [ "," ]
- ]
- "}" (. initializer.EndLocation = t.Location; outExpr = initializer; .)
-.
-
-CollectionOrObjectInitializer<out Expression outExpr>
-(.
- Expression expr = null;
- CollectionInitializerExpression initializer = new CollectionInitializerExpression();
-.)
-=
- "{" (. initializer.StartLocation = t.Location; .)
- [ ObjectPropertyInitializerOrVariableInitializer<out expr>
- (. SafeAdd(initializer, initializer.CreateExpressions, expr); .)
- { IF (NotFinalComma())
- "," ObjectPropertyInitializerOrVariableInitializer<out expr>
- (. SafeAdd(initializer, initializer.CreateExpressions, expr); .)
- }
- [ "," ]
- ]
- "}" (. initializer.EndLocation = t.Location; outExpr = initializer; .)
-.
-
-ObjectPropertyInitializerOrVariableInitializer<out Expression expr>
-(. expr = null; .)
-=
-( IF (IdentAndAsgn())
- Identifier
- (. NamedArgumentExpression nae = new NamedArgumentExpression(t.val, null);
- nae.StartLocation = t.Location;
- Expression r = null; .)
- "="
- ( CollectionOrObjectInitializer<out r>
- | VariableInitializer <out r> )
- (. nae.Expression = r; nae.EndLocation = t.EndLocation; expr = nae; .)
-
-| VariableInitializer <out expr>
-)
-.
-
-LocalVariableDecl<out Statement stmt>
-(.
- TypeReference type;
- VariableDeclaration var = null;
- LocalVariableDeclaration localVariableDeclaration;
- Location startPos = la.Location;
-.)
-=
- Type<out type> (. localVariableDeclaration = new LocalVariableDeclaration(type); localVariableDeclaration.StartLocation = startPos; .)
- LocalVariableDeclarator<out var> (. SafeAdd(localVariableDeclaration, localVariableDeclaration.Variables, var); .)
- { "," LocalVariableDeclarator<out var> (. SafeAdd(localVariableDeclaration, localVariableDeclaration.Variables, var); .) }
- (. stmt = localVariableDeclaration; stmt.EndLocation = t.EndLocation; .)
-.
-
-LocalVariableDeclarator<out VariableDeclaration var>
-(. Expression expr = null; .)
-=
- Identifier (. var = new VariableDeclaration(t.val); var.StartLocation = t.Location; .)
- [ "=" VariableInitializer<out expr> (. var.Initializer = expr; .) ]
- (. var.EndLocation = t.EndLocation; .)
-.
-
-Statement
-(.
- TypeReference type;
- Expression expr;
- Statement stmt = null;
- Location startPos = la.Location;
-.)
-=
- SYNC
- (
- /*--- labeled statement: */
- IF (IsLabel()) Identifier (. compilationUnit.AddChild(new LabelStatement(t.val)); .)
- ":" Statement
- /*--- local constant declaration: */
- | "const" Type<out type> (. LocalVariableDeclaration var = new LocalVariableDeclaration(type, Modifiers.Const); string ident = null; var.StartLocation = t.Location; .)
- Identifier (. ident = t.val; Location varStart = t.Location; .)
- "=" Expr<out expr>
- (.
- SafeAdd(var, var.Variables, new VariableDeclaration(ident, expr) {
- StartLocation = varStart,
- EndLocation = t.EndLocation,
- TypeReference = type
- });
- .)
- { "," Identifier (. ident = t.val; .) "=" Expr<out expr>
- (.
- SafeAdd(var, var.Variables, new VariableDeclaration(ident, expr) {
- StartLocation = varStart,
- EndLocation = t.EndLocation,
- TypeReference = type
- });
- .) }
- ";" (. var.EndLocation = t.EndLocation; if (t.Kind == Tokens.Semicolon) var.SemicolonPosition = t.EndLocation; compilationUnit.AddChild(var); .)
-
- /*--- local variable declaration: */
- | IF (IsLocalVarDecl()) LocalVariableDecl<out stmt> ";" (. if (t.Kind == Tokens.Semicolon) ((LocalVariableDeclaration)stmt).SemicolonPosition = t.EndLocation; compilationUnit.AddChild(stmt); .)
-
- | EmbeddedStatement<out stmt> (. compilationUnit.AddChild(stmt); .)
- /* LL(1) confict: LocalVariableDecl *
- * <-> StatementExpr *
- * ident {"." ident} { "[" Expr ... */
- )
- (.
- if (stmt != null) {
- stmt.StartLocation = startPos;
- stmt.EndLocation = t.EndLocation;
- }
- .)
-.
-
-EmbeddedStatement<out Statement statement>
-(.
- TypeReference type = null;
- Expression expr = null;
- Statement embeddedStatement = null;
- statement = null;
-.)
-=
- (. Location startLocation = la.Location; .)
- (
- Block<out statement>
-
- /*--- empty statement: */
- | ";" (. statement = new EmptyStatement(); .)
-
- /*--- checked / unchecked statement: */
- | IF (UnCheckedAndLBrace()) (. Statement block; bool isChecked = true; .)
- ("checked" | "unchecked" (. isChecked = false;.) )
- Block<out block> (. statement = isChecked ? (Statement)new CheckedStatement(block) : (Statement)new UncheckedStatement(block); .)
-
- /*--- selection statements (if, switch): */
- | IfStatement<out statement>
-
- | "switch" (. List<SwitchSection> switchSections = new List<SwitchSection>(); .)
- "(" Expr<out expr> ")"
- "{" SwitchSections<switchSections>
- "}"
- (. statement = new SwitchStatement(expr, switchSections); .)
-
- /*--- iteration statements (while, do, for, foreach): */
- | "while" "(" Expr<out expr> ")"
- EmbeddedStatement<out embeddedStatement>
- (. statement = new DoLoopStatement(expr, embeddedStatement, ConditionType.While, ConditionPosition.Start);.)
-
- | "do" EmbeddedStatement<out embeddedStatement> "while"
- "(" Expr<out expr> ")" ";"
- (. statement = new DoLoopStatement(expr, embeddedStatement, ConditionType.While, ConditionPosition.End); .)
-
- | "for" (. List<Statement> initializer = null; List<Statement> iterator = null; .)
- "(" [ ForInitializer<out initializer> ] ";"
- [ Expr<out expr> ] ";"
- [ ForIterator<out iterator> ] ")"
- EmbeddedStatement<out embeddedStatement>
- (. statement = new ForStatement(initializer, expr, iterator, embeddedStatement); .)
-
- | "foreach" "(" Type<out type> Identifier (. string varName = t.val; .)
- "in" Expr<out expr> ")"
- EmbeddedStatement<out embeddedStatement>
- (. statement = new ForeachStatement(type, varName , expr, embeddedStatement); .)
-
- /*--- jump statements (break, contine, goto, return, throw): */
- | "break" ";" (. statement = new BreakStatement(); .)
- | "continue" ";" (. statement = new ContinueStatement(); .)
- | GotoStatement<out statement>
-
- | IF (IsYieldStatement()) "yield"
- ( "return" Expr<out expr> (. statement = new YieldStatement(new ReturnStatement(expr)); .)
- | "break" (. statement = new YieldStatement(new BreakStatement()); .) )
- ";"
-
- | "return" [ Expr<out expr> ] ";" (. statement = new ReturnStatement(expr); .)
- | "throw" [ Expr<out expr> ] ";" (. statement = new ThrowStatement(expr); .)
-
- /*--- expression statement: */
- | StatementExpr<out statement> SYNC ";"
-
- /*--- try statement: */
- | TryStatement<out statement>
-
- /*--- lock satement: */
- | "lock" "(" Expr<out expr> ")"
- EmbeddedStatement<out embeddedStatement> (. statement = new LockStatement(expr, embeddedStatement); .)
-
- /*--- using statement: */
- | (.Statement resourceAcquisitionStmt = null; .)
- "using" "("
- ResourceAcquisition<out resourceAcquisitionStmt> ")"
- EmbeddedStatement<out embeddedStatement> (. statement = new UsingStatement(resourceAcquisitionStmt, embeddedStatement); .)
-
- /*--- unsafe statement: */
- | "unsafe" Block<out embeddedStatement> (. statement = new UnsafeStatement(embeddedStatement); .)
- /*--- fixed statement: */
- | (. Statement pointerDeclarationStmt = null; .)
- "fixed" "("
- ResourceAcquisition<out pointerDeclarationStmt> ")"
- EmbeddedStatement<out embeddedStatement> (. statement = new FixedStatement(pointerDeclarationStmt, embeddedStatement); .)
- )
- (. if (statement != null) {
- statement.StartLocation = startLocation;
- statement.EndLocation = t.EndLocation;
- }
- .)
-.
-
-IfStatement<out Statement statement>
-(.
- Expression expr = null;
- Statement embeddedStatement = null;
- statement = null;
- Location elseStart = Location.Empty;
-.)
-=
- "if"
- "(" Expr<out expr> ")"
- EmbeddedStatement<out embeddedStatement>
- (. Statement elseStatement = null; .)
- [ "else" (. elseStart = t.Location; .) EmbeddedStatement<out elseStatement> ]
- (. statement = elseStatement != null ? new IfElseStatement(expr, embeddedStatement, elseStatement) : new IfElseStatement(expr, embeddedStatement); .)
- (. if (elseStatement is IfElseStatement && (elseStatement as IfElseStatement).TrueStatement.Count == 1) {
- /* else if-section (otherwise we would have a BlockStatment) */
- ElseIfSection elseIfSection = new ElseIfSection((elseStatement as IfElseStatement).Condition, (elseStatement as IfElseStatement).TrueStatement[0]);
- elseIfSection.StartLocation = elseStart;
- elseIfSection.EndLocation = (elseStatement as IfElseStatement).TrueStatement[0].EndLocation;
- (statement as IfElseStatement).ElseIfSections.Add(elseIfSection);
- (statement as IfElseStatement).ElseIfSections.AddRange((elseStatement as IfElseStatement).ElseIfSections);
- (statement as IfElseStatement).FalseStatement = (elseStatement as IfElseStatement).FalseStatement;
- }
- .)
-.
-
-ForInitializer<out List<Statement> initializer>
-(.
- Statement stmt;
- initializer = new List<Statement>();
-.)
-=
- IF (IsLocalVarDecl()) LocalVariableDecl<out stmt> (. ((LocalVariableDeclaration)stmt).SemicolonPosition = t.EndLocation; initializer.Add(stmt); .)
- | StatementExpr<out stmt> (.initializer.Add(stmt);.) { "," StatementExpr<out stmt> (. initializer.Add(stmt);.) }
-.
-
-ForIterator<out List<Statement> iterator>
-(.
- Statement stmt;
- iterator = new List<Statement>();
-.)
-=
- StatementExpr<out stmt> (. iterator.Add(stmt);.) { "," StatementExpr<out stmt> (. iterator.Add(stmt); .) }
-.
-
-SwitchSections<List<SwitchSection> switchSections>
-(.
- SwitchSection switchSection = new SwitchSection();
- CaseLabel label;
-.)
-=
- SwitchLabel<out label> (. SafeAdd(switchSection, switchSection.SwitchLabels, label); .)
- (. compilationUnit.BlockStart(switchSection); .)
- {
- ( SwitchLabel<out label>
- (. if (label != null) {
- if (switchSection.Children.Count > 0) {
- // open new section
- compilationUnit.BlockEnd(); switchSections.Add(switchSection);
- switchSection = new SwitchSection();
- compilationUnit.BlockStart(switchSection);
- }
- SafeAdd(switchSection, switchSection.SwitchLabels, label);
- }
- .)
- | Statement)
- }
- (. compilationUnit.BlockEnd(); switchSections.Add(switchSection); .)
-.
-
-SwitchLabel<out CaseLabel label>
- (. Expression expr = null; label = null; .)
-=
- "case" Expr<out expr> ":" (. label = new CaseLabel(expr); .)
- | "default" ":" (. label = new CaseLabel(); .)
-.
-
-TryStatement<out Statement tryStatement>
-(.
- Statement blockStmt = null, finallyStmt = null;
- CatchClause catchClause = null;
- List<CatchClause> catchClauses = new List<CatchClause>();
-.)
-=
- "try" Block<out blockStmt>
- {
- CatchClause<out catchClause>
- (. if (catchClause != null) catchClauses.Add(catchClause); .)
- }
- [ "finally" Block<out finallyStmt> ]
- (.
- tryStatement = new TryCatchStatement(blockStmt, catchClauses, finallyStmt);
- if (catchClauses != null) {
- foreach (CatchClause cc in catchClauses) cc.Parent = tryStatement;
- }
- .)
-.
-
-CatchClause<out CatchClause catchClause>
-=
- "catch" (. string identifier;
- Statement stmt;
- TypeReference typeRef;
- Location startPos = t.Location;
- catchClause = null;
- .)
- (
- /*--- 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 (catchClause != null) {
- catchClause.StartLocation = startPos;
- catchClause.EndLocation = t.Location;
- }
- .)
-.
-
-GotoStatement<out Statement stmt>
-(. Expression expr; stmt = null; .)
-=
- "goto"
- (
- Identifier (. stmt = new GotoStatement(t.val); .) ";"
- | "case" Expr<out expr> ";" (. stmt = new GotoCaseStatement(expr); .)
- | "default" ";" (. stmt = new GotoCaseStatement(null); .)
- )
-.
-
-ResourceAcquisition<out Statement stmt>
-(.
- stmt = null;
- Expression expr;
-.)
-=
- (
- IF (IsLocalVarDecl()) LocalVariableDecl<out stmt> (. ((LocalVariableDeclaration)stmt).SemicolonPosition = t.EndLocation; .)
- | Expr<out expr> /* LL(1) conflict resoltion: *
- * check if next is Qualident followed by ident *
- * ==> LocalVariableDecl *
- * new problem: first set of ResourceAcquisition changes */
- (. stmt = new ExpressionStatement(expr); .)
- )
-.
-
-StatementExpr<out Statement stmt>
-(. Expression expr; .)
-=
- Expr<out expr>
- /* The grammar allows only assignments or method invocations here, */
- /* but we don't enforce that here */
- (. stmt = new ExpressionStatement(expr); if (expr is PrimitiveExpression) Error("Primitive expressions are not allowed as statements."); .)
-.
-
-Expr<out Expression expr>
-(. expr = null; Expression expr1 = null, expr2 = null; AssignmentOperatorType op; .)
-=
- (. Location startLocation = la.Location; .)
- UnaryExpr<out expr>
- /*--- conditional expression: */
- (
- ( AssignmentOperator<out op> Expr<out expr1> (. expr = new AssignmentExpression(expr, op, expr1); .) )
- | IF (la.kind == Tokens.GreaterThan && Peek(1).kind == Tokens.GreaterEqual)
- ( AssignmentOperator<out op> Expr<out expr1> (. expr = new AssignmentExpression(expr, op, expr1); .) )
- | (
- ConditionalOrExpr<ref expr>
- [ "??" Expr<out expr1> (. expr = new BinaryOperatorExpression(expr, BinaryOperatorType.NullCoalescing, expr1); .) ]
- [ "?" Expr<out expr1> ":" Expr<out expr2> (. expr = new ConditionalExpression(expr, expr1, expr2); .) ]
- )
- )
- (. if (expr != null) {
- expr.StartLocation = startLocation;
- expr.EndLocation = t.EndLocation;
- }
- .)
-.
-
-
-UnaryExpr<out Expression uExpr>
-(.
- TypeReference type = null;
- Expression expr = null;
- ArrayList expressions = new ArrayList();
- uExpr = null;
-.)
-=
- {
- /* IF (Tokens.UnaryOp[la.kind] || IsTypeCast()) */
- (
- "+" (. expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Plus)); .)
- | "-" (. expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Minus)); .)
- | "!" (. expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Not)); .)
- | "~" (. expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.BitNot)); .)
- | "*" (. expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Dereference)); .)
- | "++" (. expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Increment)); .)
- | "--" (. expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.Decrement)); .)
- | "&" (. expressions.Add(new UnaryOperatorExpression(UnaryOperatorType.AddressOf)); .)
-
- /*--- cast expression: */
- /* Problem: "(" Type ")" from here and *
- * "(" Expr ")" from PrimaryExpr *
- * Solution: (in IsTypeCast()) */
- | IF (IsTypeCast()) "(" Type<out type> ")" (. expressions.Add(new CastExpression(type)); .)
- )
- }
-
- /* special rule (2.4.4.2) to allow writing int.MinValue and long.MinValue */
- ( IF (LastExpressionIsUnaryMinus(expressions) && IsMostNegativeIntegerWithoutTypeSuffix())
- Literal
- (.
- expressions.RemoveAt(expressions.Count - 1);
- if (t.literalValue is uint) {
- expr = new PrimitiveExpression(int.MinValue, int.MinValue.ToString());
- } else if (t.literalValue is ulong) {
- expr = new PrimitiveExpression(long.MinValue, long.MinValue.ToString());
- } else {
- throw new Exception("t.literalValue must be uint or ulong");
- }
- .)
- | PrimaryExpr<out expr>
- )
- (. for (int i = 0; i < expressions.Count; ++i) {
- Expression nextExpression = i + 1 < expressions.Count ? (Expression)expressions[i + 1] : expr;
- if (expressions[i] is CastExpression) {
- ((CastExpression)expressions[i]).Expression = nextExpression;
- } else {
- ((UnaryOperatorExpression)expressions[i]).Expression = nextExpression;
- }
- }
- if (expressions.Count > 0) {
- uExpr = (Expression)expressions[0];
- } else {
- uExpr = expr;
- }
- .)
-.
-
-
-PrimaryExpr<out Expression pexpr>
-(.
- TypeReference type = null;
- Expression expr;
- pexpr = null;
-.)
-=
- (. Location startLocation = la.Location; .)
- (
- "true" (.pexpr = new PrimitiveExpression(true, "true"); .)
- | "false" (.pexpr = new PrimitiveExpression(false, "false"); .)
- | "null" (.pexpr = new PrimitiveExpression(null, "null"); .) /* from literal token */
- | Literal (.pexpr = new PrimitiveExpression(t.literalValue, t.val) { LiteralFormat = t.literalFormat }; .)
- | IF (StartOfQueryExpression())
- QueryExpression<out pexpr>
- | IF (IdentAndDoubleColon())
- Identifier (. type = new TypeReference(t.val); .)
- "::" (. pexpr = new TypeReferenceExpression(type); .)
- Identifier (. if (type.Type == "global") { type.IsGlobal = true; type.Type = t.val ?? "?"; } else type.Type += "." + (t.val ?? "?"); .)
-
- /*--- simple name (IdentifierExpression): */
- | Identifier
- (. pexpr = new IdentifierExpression(t.val); .)
-
- [ ShortedLambdaExpression<(IdentifierExpression)pexpr, out pexpr>
- | IF (IsGenericInSimpleNameOrMemberAccess())
- (. List<TypeReference> typeList; .)
- TypeArgumentList<out typeList, false>
- (. ((IdentifierExpression)pexpr).TypeArguments = typeList; .)
- ]
- | IF (IsLambdaExpression()) /* Lambda expression */
- LambdaExpression<out pexpr>
-
- /*--- parenthesized expression: */
- | "(" Expr<out expr> ")" (. pexpr = new ParenthesizedExpression(expr); .)
-
- | /*--- predefined type member access: */
- (. string val = null; .)
- ( "bool" (. val = "System.Boolean"; .)
- | "byte" (. val = "System.Byte"; .)
- | "char" (. val = "System.Char"; .)
- | "decimal" (. val = "System.Decimal"; .)
- | "double" (. val = "System.Double"; .)
- | "float" (. val = "System.Single"; .)
- | "int" (. val = "System.Int32"; .)
- | "long" (. val = "System.Int64"; .)
- | "object" (. val = "System.Object"; .)
- | "sbyte" (. val = "System.SByte"; .)
- | "short" (. val = "System.Int16"; .)
- | "string" (. val = "System.String"; .)
- | "uint" (. val = "System.UInt32"; .)
- | "ulong" (. val = "System.UInt64"; .)
- | "ushort" (. val = "System.UInt16"; .)
- | "void" (. val = "System.Void"; .)
- )
- (. pexpr = new TypeReferenceExpression(new TypeReference(val, true)) { StartLocation = t.Location, EndLocation = t.EndLocation }; .)
-
- /*--- this access: */
- | "this" (. pexpr = new ThisReferenceExpression(); pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation; .)
- /*--- base access: */
- | "base" (. pexpr = new BaseReferenceExpression(); pexpr.StartLocation = t.Location; pexpr.EndLocation = t.EndLocation; .)
-
- /* new ... - ObjectCreationExpression or ArrayCreateExpression */
- | NewExpression<out pexpr>
-
- | "typeof" "("
- (
- IF (NotVoidPointer()) "void" (. type = new TypeReference("System.Void", true); .)
- | TypeWithRestriction<out type, true, true>
- )
- ")" (. pexpr = new TypeOfExpression(type); .)
-
- | "default" "(" Type<out type> ")" (. pexpr = new DefaultValueExpression(type); .)
- | "sizeof" "(" Type<out type> ")" (. pexpr = new SizeOfExpression(type); .)
- | "checked" "(" Expr<out expr> ")" (. pexpr = new CheckedExpression(expr); .)
- | "unchecked" "(" Expr<out expr> ")" (. pexpr = new UncheckedExpression(expr); .)
- | "delegate" AnonymousMethodExpr<out expr> (. pexpr = expr; .)
- )
- (. if (pexpr != null) {
- if (pexpr.StartLocation.IsEmpty)
- pexpr.StartLocation = startLocation;
- if (pexpr.EndLocation.IsEmpty)
- pexpr.EndLocation = t.EndLocation;
- }
- .)
- {
- (. startLocation = la.Location; .)
- (
- "++" (. pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostIncrement); .)
- | "--" (. pexpr = new UnaryOperatorExpression(pexpr, UnaryOperatorType.PostDecrement); .)
- )
- /*--- member access */
- | PointerMemberAccess<out pexpr, pexpr>
- | MemberAccess<out pexpr, pexpr>
-
- /*--- invocation expression: */
- | "("
- (. List<Expression> parameters = new List<Expression>(); .)
- (. pexpr = new InvocationExpression(pexpr, parameters); pexpr.StartLocation = startLocation; .)
- [ Argument<out expr> (. SafeAdd(pexpr, parameters, expr); .)
- { "," Argument<out expr> (. SafeAdd(pexpr, parameters, expr); .)
- }
- ]
- ")"
- /*--- element access */
- | (. /*if (isArrayCreation) Error("element access not allow on array creation");*/
- List<Expression> indices = new List<Expression>();
- pexpr = new IndexerExpression(pexpr, indices);
- .)
- "[" Expr<out expr> (. SafeAdd(pexpr, indices, expr); .)
- { "," Expr<out expr> (. SafeAdd(pexpr, indices, expr); .)
- } "]"
-
- (. if (pexpr != null) {
- pexpr.StartLocation = startLocation;
- pexpr.EndLocation = t.EndLocation;
- }
- .)
- }
-.
-
-MemberAccess<out Expression expr, Expression target>
-(. List<TypeReference> typeList; .)
-=
- (. if (ShouldConvertTargetExpressionToTypeReference(target)) {
- TypeReference type = GetTypeReferenceFromExpression(target);
- if (type != null) {
- target = new TypeReferenceExpression(type) { StartLocation = t.Location, EndLocation = t.EndLocation };
- }
- }
- .)
- "."
- Identifier
- (. expr = new MemberReferenceExpression(target, t.val); expr.StartLocation = t.Location; expr.EndLocation = t.EndLocation; .)
- [ IF (IsGenericInSimpleNameOrMemberAccess())
- TypeArgumentList<out typeList, false>
- (. ((MemberReferenceExpression)expr).TypeArguments = typeList; .)
- ]
-.
-
-PointerMemberAccess<out Expression expr, Expression target>
-(. List<TypeReference> typeList; .)
-=
- "->"
- Identifier
- (. expr = new PointerReferenceExpression(target, t.val); expr.StartLocation = t.Location; expr.EndLocation = t.EndLocation; .)
- [ IF (IsGenericInSimpleNameOrMemberAccess())
- TypeArgumentList<out typeList, false>
- (. ((MemberReferenceExpression)expr).TypeArguments = typeList; .)
- ]
-.
-
-NewExpression<out Expression pexpr>
-(. pexpr = null;
- List<Expression> parameters = new List<Expression>();
- TypeReference type = null;
- Expression expr;
-.)
-=
- "new"
- [ NonArrayType<out type> ] /* optional since .NET 3.0 */
-
- /*--- delegate / object creation expression: */
- /* Note: a delegate creation expression allow only a single Expr */
- /* not an argument list, but this is not distinguished here */
- (
- ( (. ObjectCreateExpression oce = new ObjectCreateExpression(type, parameters); .)
- "(" (. if (type == null) Error("Cannot use an anonymous type with arguments for the constructor"); .)
- [ Argument<out expr> (. SafeAdd(oce, parameters, expr); .)
- { "," Argument<out expr> (. SafeAdd(oce, parameters, expr); .) }
- ]
- ")" (. pexpr = oce; .)
- [ CollectionOrObjectInitializer<out expr> (. oce.ObjectInitializer = (CollectionInitializerExpression)expr; .) ]
- | (. ObjectCreateExpression oce = new ObjectCreateExpression(type, parameters); .)
- CollectionOrObjectInitializer<out expr> (. oce.ObjectInitializer = (CollectionInitializerExpression)expr; .)
- (. pexpr = oce; .)
- )
-
- /*--- array creation expression: */
- | "["
- (. ArrayCreateExpression ace = new ArrayCreateExpression(type);
- /* we must not change RankSpecifier on the null type reference*/
- if (ace.CreateType.IsNull) { ace.CreateType = new TypeReference(""); }
- pexpr = ace;
- int dims = 0; List<int> ranks = new List<int>();
- .)
- (
- { "," (. dims += 1; .) }
- "]" (. ranks.Add(dims); dims = 0; .)
- { "[" { "," (. ++dims; .) } "]" (. ranks.Add(dims); dims = 0; .) }
- (. ace.CreateType.RankSpecifier = ranks.ToArray(); .)
- CollectionInitializer<out expr> (. ace.ArrayInitializer = (CollectionInitializerExpression)expr; .)
- | Expr<out expr> (. if (expr != null) parameters.Add(expr); .)
- { "," (. dims += 1; .)
- Expr<out expr> (. if (expr != null) parameters.Add(expr); .)
- }
- "]" (. ranks.Add(dims); ace.Arguments = parameters; dims = 0; .)
- { "[" { "," (. ++dims; .) } "]" (. ranks.Add(dims); dims = 0; .) }
- (. ace.CreateType.RankSpecifier = ranks.ToArray(); .)
- [ CollectionInitializer<out expr> (. ace.ArrayInitializer = (CollectionInitializerExpression)expr; .) ]
- )
- )
-.
-
-/* Lambda expression with parameter list */
-LambdaExpression<out Expression outExpr>
-(.
- LambdaExpression lambda = new LambdaExpression();
- lambda.StartLocation = la.Location;
- ParameterDeclarationExpression p;
- outExpr = lambda;
-.)
-=
- "("
- [
- LambdaExpressionParameter<out p> (. SafeAdd(lambda, lambda.Parameters, p); .)
- { ","
- LambdaExpressionParameter<out p> (. SafeAdd(lambda, lambda.Parameters, p); .)
- }
- ]
- ")"
- "=>"
- LambdaExpressionBody<lambda>
-.
-
-ShortedLambdaExpression<IdentifierExpression ident, out Expression pexpr>
-(. LambdaExpression lambda = new LambdaExpression(); pexpr = lambda; .)
-=
- "=>"
- /* not an IdentifierExpression, but a short lambda expression*/
- (.
- lambda.StartLocation = ident.StartLocation;
- SafeAdd(lambda, lambda.Parameters, new ParameterDeclarationExpression(null, ident.Identifier));
- lambda.Parameters[0].StartLocation = ident.StartLocation;
- lambda.Parameters[0].EndLocation = ident.EndLocation;
- .)
- LambdaExpressionBody<lambda>
-.
-
-LambdaExpressionParameter<out ParameterDeclarationExpression p>
-(. Location start = la.Location; p = null;
- TypeReference type;
- ParameterModifiers mod = ParameterModifiers.In;
-.)
-=
- ( IF (Peek(1).kind == Tokens.Comma || Peek(1).kind == Tokens.CloseParenthesis)
- Identifier
- (. p = new ParameterDeclarationExpression(null, t.val);
- p.StartLocation = start; p.EndLocation = t.EndLocation;
- .)
- | [ "ref" (. mod = ParameterModifiers.Ref; .)
- | "out" (. mod = ParameterModifiers.Out; .)
- ]
- Type<out type>
- Identifier
- (. p = new ParameterDeclarationExpression(type, t.val, mod);
- p.StartLocation = start; p.EndLocation = t.EndLocation;
- .)
- )
-.
-
-LambdaExpressionBody<LambdaExpression lambda>
-(. Expression expr; BlockStatement stmt; .)
-=
- (
- BlockInsideExpression<out stmt> (. lambda.StatementBody = stmt; .)
- | Expr<out expr> (. lambda.ExpressionBody = expr; .)
- )
- (. lambda.EndLocation = t.EndLocation; .)
- (. lambda.ExtendedEndLocation = la.Location; .)
-.
-
-AnonymousMethodExpr<out Expression outExpr>
-(.
- AnonymousMethodExpression expr = new AnonymousMethodExpression();
- expr.StartLocation = t.Location;
- BlockStatement stmt;
- List<ParameterDeclarationExpression> p = new List<ParameterDeclarationExpression>();
- outExpr = expr;
-.)
-=
- [
- "("
- [ FormalParameterList<p> (. expr.Parameters = p; .) ]
- ")"
- (. expr.HasParameterList = true; .)
- ]
- BlockInsideExpression<out stmt> (. expr.Body = stmt; .)
- (. expr.EndLocation = t.Location; .)
-.
-
-BlockInsideExpression<out BlockStatement outStmt>
-(. Statement stmt = null; outStmt = null; .)
-=
- /*--- ParseExpression doesn't set a compilation unit, */
- /*--- so we can't use block then -> skip body of anonymous method */
- (. if (compilationUnit != null) { .)
- Block<out stmt> (. outStmt = (BlockStatement)stmt; .)
- (. } else { .)
- "{"
- (. lexer.SkipCurrentBlock(0); .)
- "}"
- (. } .)
-.
-
-ConditionalOrExpr<ref Expression outExpr>
-(. Expression expr; .)
-=
- ConditionalAndExpr<ref outExpr> { "||" UnaryExpr<out expr> ConditionalAndExpr<ref expr> (. outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.LogicalOr, expr); .) }
-.
-
-ConditionalAndExpr<ref Expression outExpr>
-(. Expression expr; .)
-=
- InclusiveOrExpr<ref outExpr> { "&&" UnaryExpr<out expr> InclusiveOrExpr<ref expr> (. outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.LogicalAnd, expr); .) }
-.
-
-InclusiveOrExpr<ref Expression outExpr>
-(. Expression expr; .)
-=
- ExclusiveOrExpr<ref outExpr> { "|" UnaryExpr<out expr> ExclusiveOrExpr<ref expr> (. outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.BitwiseOr, expr); .) }
-.
-
-ExclusiveOrExpr<ref Expression outExpr>
-(. Expression expr; .)
-=
- AndExpr<ref outExpr> { "^" UnaryExpr<out expr> AndExpr<ref expr> (. outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.ExclusiveOr, expr); .) }
-.
-
-AndExpr<ref Expression outExpr>
-(. Expression expr; .)
-=
- EqualityExpr<ref outExpr> { "&" UnaryExpr<out expr> EqualityExpr<ref expr> (. outExpr = new BinaryOperatorExpression(outExpr, BinaryOperatorType.BitwiseAnd, expr); .) }
-.
-
-EqualityExpr<ref Expression outExpr>
-(.
- Expression expr;
- BinaryOperatorType op = BinaryOperatorType.None;
-.)
-=
- RelationalExpr<ref outExpr>
- {
- (
- "!=" (. op = BinaryOperatorType.InEquality; .)
- | "==" (. op = BinaryOperatorType.Equality; .)
- )
- UnaryExpr<out expr> RelationalExpr<ref expr> (. outExpr = new BinaryOperatorExpression(outExpr, op, expr); .)
- }
-.
-
-RelationalExpr<ref Expression outExpr>
-(.
- TypeReference type;
- Expression expr;
- BinaryOperatorType op = BinaryOperatorType.None;
-.)
-=
- ShiftExpr<ref outExpr>
- {
- ( "<" (. op = BinaryOperatorType.LessThan; .)
- | ">" (. op = BinaryOperatorType.GreaterThan; .)
- | "<=" (. op = BinaryOperatorType.LessThanOrEqual; .)
- | ">=" (. op = BinaryOperatorType.GreaterThanOrEqual; .)
- )
- UnaryExpr<out expr>
- ShiftExpr<ref expr>
- (. outExpr = new BinaryOperatorExpression(outExpr, op, expr); .)
- |
- ( "is"
- TypeWithRestriction<out type, false, false>
- [ IF (la.kind == Tokens.Question && !IsPossibleExpressionStart(Peek(1).kind))
- NullableQuestionMark<ref type> ]
- (. outExpr = new TypeOfIsExpression(outExpr, type); .)
- | "as"
- TypeWithRestriction<out type, false, false>
- [ IF (la.kind == Tokens.Question && !IsPossibleExpressionStart(Peek(1).kind))
- NullableQuestionMark<ref type> ]
- (. outExpr = new CastExpression(type, outExpr, CastType.TryCast); .)
- )
- }
-.
-
-ShiftExpr<ref Expression outExpr>
-(.
- Expression expr;
- BinaryOperatorType op = BinaryOperatorType.None;
-.)
-=
- AdditiveExpr<ref outExpr>
- {
- ( "<<" (. op = BinaryOperatorType.ShiftLeft; .)
- | IF (IsShiftRight()) (
- ">" ">" (. op = BinaryOperatorType.ShiftRight; .)
- )
- )
- UnaryExpr<out expr> AdditiveExpr<ref expr> (. outExpr = new BinaryOperatorExpression(outExpr, op, expr); .)
- }
-.
-
-AdditiveExpr<ref Expression outExpr>
-(.
- Expression expr;
- BinaryOperatorType op = BinaryOperatorType.None;
-.)
-=
- MultiplicativeExpr<ref outExpr>
- {
- (
- "+" (. op = BinaryOperatorType.Add; .)
- | "-" (. op = BinaryOperatorType.Subtract; .)
- )
- UnaryExpr<out expr> MultiplicativeExpr<ref expr> (. outExpr = new BinaryOperatorExpression(outExpr, op, expr); .)
- }
-.
-
-MultiplicativeExpr<ref Expression outExpr>
-(.
- Expression expr;
- BinaryOperatorType op = BinaryOperatorType.None;
-.)
-=
- {
- (
- "*" (. op = BinaryOperatorType.Multiply; .)
- | "/" (. op = BinaryOperatorType.Divide; .)
- | "%" (. op = BinaryOperatorType.Modulus; .)
- )
- UnaryExpr<out expr> (. outExpr = new BinaryOperatorExpression(outExpr, op, expr); .)
- }
-.
-
-/* .NET 2.0 rules */
-
-TypeName<out TypeReference typeRef, bool canBeUnbound>
-(. List<TypeReference> typeArguments = null;
- string alias = null;
- string qualident;
- Location startLocation = la.Location;
-.)
-=
- [ IF (IdentAndDoubleColon())
- Identifier (. alias = t.val; .)
- "::"
- ]
- Qualident<out qualident>
- [TypeArgumentList<out typeArguments, canBeUnbound>]
- (.
- if (alias == null) {
- typeRef = new TypeReference(qualident, typeArguments);
- } else if (alias == "global") {
- typeRef = new TypeReference(qualident, typeArguments);
- typeRef.IsGlobal = true;
- } else {
- typeRef = new TypeReference(alias + "." + qualident, typeArguments);
- }
- .)
- { IF (DotAndIdent())
- "." (. typeArguments = null; .)
- Qualident<out qualident>
- [TypeArgumentList<out typeArguments, canBeUnbound>]
- (. typeRef = new InnerClassTypeReference(typeRef, qualident, typeArguments); .)
- }
- (. typeRef.StartLocation = startLocation; .)
-.
-
-
-NullableQuestionMark<ref TypeReference typeRef>
-(. List<TypeReference> typeArguments = new List<TypeReference>(1); .)
-=
- "?"
- (.
- if (typeRef != null) typeArguments.Add(typeRef);
- typeRef = new TypeReference("System.Nullable", typeArguments) { IsKeyword = true };
- .)
-.
-
-TypeArgumentList<out List<TypeReference> types, bool canBeUnbound>
-(.
- types = new List<TypeReference>();
- TypeReference type = null;
-.)
-=
- "<"
- ( IF (canBeUnbound && (la.kind == Tokens.GreaterThan || la.kind == Tokens.Comma))
- (. types.Add(TypeReference.Null); .)
- { "," (. types.Add(TypeReference.Null); .) }
- | Type<out type> (. if (type != null) { types.Add(type); } .)
- { "," Type<out type> (. if (type != null) { types.Add(type); } .) }
- )
- ">"
-.
-
-TypeParameterList<List<TemplateDefinition> templates>
-(.
- AttributeSection section;
- List<AttributeSection> attributes = new List<AttributeSection>();
-.)
-=
- "<" { AttributeSection<out section> (. attributes.Add(section); .) }
- Identifier (. templates.Add(new TemplateDefinition(t.val, attributes)); .)
- { "," { AttributeSection<out section> (. attributes.Add(section); .) }
- Identifier (. templates.Add(new TemplateDefinition(t.val, attributes)); .)}
- ">"
-.
-
-TypeParameterConstraintsClause<List<TemplateDefinition> templates>
-(. string name = ""; TypeReference type; .)
-=
- "where"
- Identifier (. name = t.val; .)
- ":"
- TypeParameterConstraintsClauseBase<out type> (.
- TemplateDefinition td = null;
- foreach (TemplateDefinition d in templates) {
- if (d.Name == name) {
- td = d;
- break;
- }
- }
- if ( td != null && type != null) { td.Bases.Add(type); }
- .)
- { "," TypeParameterConstraintsClauseBase<out type> (.
- td = null;
- foreach (TemplateDefinition d in templates) {
- if (d.Name == name) {
- td = d;
- break;
- }
- }
- if ( td != null && type != null) { td.Bases.Add(type); }
- .) }
-.
-
-TypeParameterConstraintsClauseBase<out TypeReference type>
-(. TypeReference t; type = null; .)
-=
- "struct" (. type = TypeReference.StructConstraint; .)
- | "class" (. type = TypeReference.ClassConstraint; .)
- | "new" "(" ")" (. type = TypeReference.NewConstraint; .)
- | Type<out t> (. type = t; .)
-.
-
-QueryExpression<out Expression outExpr>
-(. QueryExpression q = new QueryExpression(); outExpr = q; q.StartLocation = la.Location;
- QueryExpressionFromClause fromClause;
-.)
-=
- QueryExpressionFromClause<out fromClause> (. q.FromClause = fromClause; .)
- QueryExpressionBody<ref q>
- (. q.EndLocation = t.EndLocation;
- outExpr = q; /* set outExpr to q again if QueryExpressionBody changed it (can happen with 'into' clauses) */
- .)
-.
-
-QueryExpressionFromClause<out QueryExpressionFromClause fc>
-(. fc = new QueryExpressionFromClause(); fc.StartLocation = la.Location;
-.)
-=
- "from"
- QueryExpressionFromOrJoinClause<fc>
- (. fc.EndLocation = t.EndLocation; .)
-.
-
-QueryExpressionJoinClause<out QueryExpressionJoinClause jc>
-(. jc = new QueryExpressionJoinClause(); jc.StartLocation = la.Location;
- Expression expr;
-.)
-=
- "join"
- QueryExpressionFromOrJoinClause<jc>
- "on"
- Expr<out expr> (. jc.OnExpression = expr; .)
- "equals"
- Expr<out expr> (. jc.EqualsExpression = expr; .)
- [ "into"
- Identifier (. jc.IntoIdentifier = t.val; .)
- ]
- (. jc.EndLocation = t.EndLocation; .)
-.
-
-QueryExpressionFromOrJoinClause<QueryExpressionFromOrJoinClause fjc>
-(. TypeReference type; Expression expr; .)
-=
- (. fjc.Type = null; .)
- [ IF (IsLocalVarDecl()) Type<out type> (. fjc.Type = type; .) ]
- Identifier (. fjc.Identifier = t.val; .)
- "in"
- Expr<out expr> (. fjc.InExpression = expr; .)
-.
-
-QueryExpressionBody<ref QueryExpression q>
-(. QueryExpressionFromClause fromClause; QueryExpressionWhereClause whereClause;
- QueryExpressionLetClause letClause; QueryExpressionJoinClause joinClause;
- QueryExpressionOrderClause orderClause;
- QueryExpressionSelectClause selectClause; QueryExpressionGroupClause groupClause;
-.)
-=
- { ( QueryExpressionFromClause<out fromClause> (. SafeAdd<QueryExpressionClause>(q, q.MiddleClauses, fromClause); .)
- | QueryExpressionWhereClause<out whereClause> (. SafeAdd<QueryExpressionClause>(q, q.MiddleClauses, whereClause); .)
- | QueryExpressionLetClause<out letClause> (. SafeAdd<QueryExpressionClause>(q, q.MiddleClauses, letClause); .)
- | QueryExpressionJoinClause<out joinClause> (. SafeAdd<QueryExpressionClause>(q, q.MiddleClauses, joinClause); .)
- | QueryExpressionOrderByClause<out orderClause> (. SafeAdd<QueryExpressionClause>(q, q.MiddleClauses, orderClause); .)
- ) }
- ( QueryExpressionSelectClause<out selectClause> (. q.SelectOrGroupClause = selectClause; .)
- | QueryExpressionGroupClause<out groupClause> (. q.SelectOrGroupClause = groupClause; .)
- )
- [ QueryExpressionIntoClause<ref q> ]
-.
-
-QueryExpressionWhereClause<out QueryExpressionWhereClause wc>
-(. Expression expr; wc = new QueryExpressionWhereClause(); wc.StartLocation = la.Location; .)
-=
- "where"
- Expr<out expr> (. wc.Condition = expr; .)
- (. wc.EndLocation = t.EndLocation; .)
-.
-
-QueryExpressionLetClause<out QueryExpressionLetClause wc>
-(. Expression expr; wc = new QueryExpressionLetClause(); wc.StartLocation = la.Location; .)
-=
- "let"
- Identifier (. wc.Identifier = t.val; .)
- "="
- Expr<out expr> (. wc.Expression = expr; .)
- (. wc.EndLocation = t.EndLocation; .)
-.
-
-QueryExpressionOrderByClause<out QueryExpressionOrderClause oc>
-(. QueryExpressionOrdering ordering; oc = new QueryExpressionOrderClause(); oc.StartLocation = la.Location; .)
-=
- "orderby"
- QueryExpressionOrdering<out ordering> (. SafeAdd(oc, oc.Orderings, ordering); .)
- { ","
- QueryExpressionOrdering<out ordering> (. SafeAdd(oc, oc.Orderings, ordering); .)
- }
- (. oc.EndLocation = t.EndLocation; .)
-.
-
-QueryExpressionOrdering<out QueryExpressionOrdering ordering>
-(. Expression expr; ordering = new QueryExpressionOrdering(); ordering.StartLocation = la.Location; .)
-=
- Expr<out expr> (. ordering.Criteria = expr; .)
- [ "ascending" (. ordering.Direction = QueryExpressionOrderingDirection.Ascending; .)
- | "descending" (. ordering.Direction = QueryExpressionOrderingDirection.Descending; .)
- ]
- (. ordering.EndLocation = t.EndLocation; .)
-.
-
-QueryExpressionSelectClause<out QueryExpressionSelectClause sc>
-(. Expression expr; sc = new QueryExpressionSelectClause(); sc.StartLocation = la.Location; .)
-=
- "select"
- Expr<out expr> (. sc.Projection = expr; .)
- (. sc.EndLocation = t.EndLocation; .)
-.
-
-QueryExpressionGroupClause<out QueryExpressionGroupClause gc>
-(. Expression expr; gc = new QueryExpressionGroupClause(); gc.StartLocation = la.Location; .)
-=
- "group"
- Expr<out expr> (. gc.Projection = expr; .)
- "by"
- Expr<out expr> (. gc.GroupBy = expr; .)
- (. gc.EndLocation = t.EndLocation; .)
-.
-
-QueryExpressionIntoClause<ref QueryExpression q>
-(. QueryExpression firstQuery = q;
- QueryExpression continuedQuery = new QueryExpression();
- continuedQuery.StartLocation = q.StartLocation;
- firstQuery.EndLocation = la.Location;
- continuedQuery.FromClause = new QueryExpressionFromClause();
- continuedQuery.FromClause.StartLocation = la.Location;
- // nest firstQuery inside continuedQuery.
- continuedQuery.FromClause.InExpression = firstQuery;
- continuedQuery.IsQueryContinuation = true;
- q = continuedQuery;
-.)
-=
- "into"
- Identifier (. continuedQuery.FromClause.Identifier = t.val; .)
- (. continuedQuery.FromClause.EndLocation = t.EndLocation; .)
- QueryExpressionBody<ref q>
-.
-
-/* allow usage of context sensitive keywords as identifiers */
-Identifier
-=
-/* when updating this list, ensure you also change KeywordList.IdentifierTokens*/
- ident
-| "partial"
-| "where"
-| "get"
-| "set"
-| "add"
-| "remove"
-| "yield"
-| "select"
-| "group"
-| "by"
-| "into"
-| "from"
-| "ascending"
-| "descending"
-| "orderby"
-| "let"
-| "join"
-| "on"
-| "equals"
-.
-
-
-END CS.
diff --git a/main/contrib/NRefactory/Project/Src/Parser/Errors.cs b/main/contrib/NRefactory/Project/Src/Parser/Errors.cs
deleted file mode 100644
index 54bd3fa40d..0000000000
--- a/main/contrib/NRefactory/Project/Src/Parser/Errors.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-// <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.OldNRefactory.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/Frames/Parser.frame b/main/contrib/NRefactory/Project/Src/Parser/Frames/Parser.frame
deleted file mode 100644
index 619ba8221f..0000000000
--- a/main/contrib/NRefactory/Project/Src/Parser/Frames/Parser.frame
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- Parser.frame file for NRefactory.
- */
-using System;
-using System.Reflection;
-
--->namespace
-
--->tokens
-
-partial class Parser : AbstractParser
-{
--->constants
- const bool T = true;
- const bool x = false;
-
--->declarations
-
-/*
--->pragmas
-*/
-
--->productions
-
- void ParseRoot()
- {
--->parseRoot
- }
-
- protected override void SynErr(int line, int col, int errorNumber)
- {
- string s;
- switch (errorNumber) {
--->errors
- 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 = {
--->initialization
- };
-} // end Parser
-
-$$$
diff --git a/main/contrib/NRefactory/Project/Src/Parser/Frames/Scanner.frame b/main/contrib/NRefactory/Project/Src/Parser/Frames/Scanner.frame
deleted file mode 100644
index b159248236..0000000000
--- a/main/contrib/NRefactory/Project/Src/Parser/Frames/Scanner.frame
+++ /dev/null
@@ -1,202 +0,0 @@
-/*----------------------------------------------------------------------
-Compiler Generator Coco/R,
-Copyright (c) 1990, 2004 Hanspeter Moessenboeck, University of Linz
-extended by M. Loeberbauer & A. Woess, Univ. of Linz
-with improvements by Pat Terry, Rhodes University
-
-This program is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 2, or (at your option) any
-later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-for more details.
-
-You should have received a copy of the GNU General Public License along
-with this program; if not, write to the Free Software Foundation, Inc.,
-59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-As an exception, it is allowed to write an extension of Coco/R that is
-used as a plugin in non-free software.
-
-If not otherwise stated, any source code generated by Coco/R (other than
-Coco/R itself) does not fall under the GNU General Public License.
------------------------------------------------------------------------*/
--->begin
-using System;
-using System.IO;
-using System.Collections;
-using System.Text;
-
--->namespace
-
-public class Token {
- public int kind; // token kind
- public int pos; // token position in the source text (starting at 0)
- public int col; // token column (starting at 0)
- public int line; // token line (starting at 1)
- public string val; // token value
- public Token next; // AW 2003-03-07 Tokens are kept in linked list
-}
-
-public class Buffer {
- public const char EOF = (char)256;
- static byte[] buf;
- static int bufLen;
- static int pos;
- // CHANGES by M.KRUEGER
- public static int CountLines(int offset)
- {
- int line = 0;
- for (int i = 0; i <= offset; ++i) {
- if (buf[i] == '\n') {
- ++line;
- }
- }
- return line;
- }
- //EOC
- public static void Fill (Stream s) {
- bufLen = (int) s.Length;
- buf = new byte[bufLen];
- s.Read(buf, 0, bufLen);
- pos = 0;
- }
-
- public static int Read () {
- if (pos < bufLen) return buf[pos++];
- else return EOF; /* pdt */
- }
-
- public static int Peek () {
- if (pos < bufLen) return buf[pos];
- else return EOF; /* pdt */
- }
-
- /* AW 2003-03-10 moved this from ParserGen.cs */
- public static string GetString (int beg, int end) {
- StringBuilder s = new StringBuilder(64);
- int oldPos = Buffer.Pos;
- Buffer.Pos = beg;
- while (beg < end) { s.Append((char)Buffer.Read()); beg++; }
- Buffer.Pos = oldPos;
- return s.ToString();
- }
-
- public static int Pos {
- get { return pos; }
- set {
- if (value < 0) pos = 0;
- else if (value >= bufLen) pos = bufLen;
- else pos = value;
- }
- }
-}
-
-public class Scanner {
- const char EOL = '\n';
- const int eofSym = 0; /* pdt */
--->declarations
-
- static Token t; // current token
- static char ch; // current input character
- static int pos; // column number of current character
- static int line; // line number of current character
- static int lineStart; // start position of current line
- static int oldEols; // EOLs that appeared in a comment;
- static BitArray ignore; // set of characters to be ignored by the scanner
-
- static Token tokens; // the complete input token stream
- static Token pt; // current peek token
-
- public static void Init (string fileName) {
- FileStream s = null;
- try {
- s = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read);
- Init(s);
- } catch (IOException) {
- Console.WriteLine("--- Cannot open file {0}", fileName);
- System.Environment.Exit(1);
- } finally {
- if (s != null) s.Close();
- }
- }
-
- public static void Init (Stream s) {
- Buffer.Fill(s);
- pos = -1; line = 1; lineStart = 0;
- oldEols = 0;
- NextCh();
--->initialization
- //--- AW: fill token list
- tokens = new Token(); // first token is a dummy
- Token node = tokens;
- do {
- node.next = NextToken();
- node = node.next;
- } while (node.kind != eofSym);
- node.next = node;
- node.val = "EOF";
- t = pt = tokens;
- }
-
- static void NextCh() {
- if (oldEols > 0) { ch = EOL; oldEols--; }
- else {
- ch = (char)Buffer.Read(); pos++;
- // replace isolated '\r' by '\n' in order to make
- // eol handling uniform across Windows, Unix and Mac
- if (ch == '\r' && Buffer.Peek() != '\n') ch = EOL;
- if (ch == EOL) { line++; lineStart = pos + 1; }
- }
--->casing
- }
-
--->comments
-
- static void CheckLiteral() {
--->literals
- }
-
- /* AW Scan() renamed to NextToken() */
- static Token NextToken() {
- while (ignore[ch]) NextCh();
--->scan1
- t = new Token();
- t.pos = pos; t.col = pos - lineStart + 1; t.line = line;
- int state = start[ch];
- StringBuilder buf = new StringBuilder(16);
--->scan2
-
- switch (state) {
- case -1: { t.kind = eofSym; goto done; } // NextCh already done /* pdt */
- case 0: { t.kind = noSym; goto done; } // NextCh already done
--->scan3
- }
- done:
- t.val = buf.ToString();
- return t;
- }
-
- /* AW 2003-03-07 get the next token, move on and synch peek token with current */
- public static Token Scan () {
- t = pt = t.next;
- return t;
- }
-
- /* AW 2003-03-07 get the next token, ignore pragmas */
- public static Token Peek () {
- do { // skip pragmas while peeking
- pt = pt.next;
- } while (pt.kind > maxT);
- return pt;
- }
-
- /* AW 2003-03-11 to make sure peek start at current scan position */
- public static void ResetPeek () { pt = t; }
-
-} // end Scanner
-
-$$$ \ No newline at end of file
diff --git a/main/contrib/NRefactory/Project/Src/Parser/Frames/SharpCoco.exe b/main/contrib/NRefactory/Project/Src/Parser/Frames/SharpCoco.exe
deleted file mode 100755
index da33326feb..0000000000
--- a/main/contrib/NRefactory/Project/Src/Parser/Frames/SharpCoco.exe
+++ /dev/null
Binary files differ
diff --git a/main/contrib/NRefactory/Project/Src/Parser/IParser.cs b/main/contrib/NRefactory/Project/Src/Parser/IParser.cs
deleted file mode 100644
index 98aee86c34..0000000000
--- a/main/contrib/NRefactory/Project/Src/Parser/IParser.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-// <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.OldNRefactory.Ast;
-
-namespace ICSharpCode.OldNRefactory
-{
- /// <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
deleted file mode 100644
index 4e748b3236..0000000000
--- a/main/contrib/NRefactory/Project/Src/Parser/ModifierList.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="none" email=""/>
-// <version>$Revision: 4482 $</version>
-// </file>
-
-using ICSharpCode.OldNRefactory.Ast;
-
-namespace ICSharpCode.OldNRefactory.Parser
-{
- internal class ModifierList
- {
- Modifiers cur;
- Location location = new Location(-1, -1);
-
- public Modifiers Modifier {
- get {
- return cur;
- }
- set {
- cur = value;
- }
- }
-
- 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 (m == Modifiers.Internal && (cur & Modifiers.Protected) != 0) {
- cur = Modifiers.ProtectedAndInternal;
- return;
- }
- 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
deleted file mode 100644
index 4a25c9a300..0000000000
--- a/main/contrib/NRefactory/Project/Src/Parser/VBNet/ParamModifierList.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="none" email=""/>
-// <version>$Revision: 4482 $</version>
-// </file>
-
-using ICSharpCode.OldNRefactory.Ast;
-
-namespace ICSharpCode.OldNRefactory.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
deleted file mode 100644
index b621cf70b7..0000000000
--- a/main/contrib/NRefactory/Project/Src/Parser/VBNet/Parser.cs
+++ /dev/null
@@ -1,7403 +0,0 @@
-
-#line 1 "VBNET.ATG"
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.Specialized;
-using System.Text;
-using ICSharpCode.OldNRefactory.Ast;
-using ICSharpCode.OldNRefactory.Parser.VB;
-using ASTAttribute = ICSharpCode.OldNRefactory.Ast.Attribute;
-/*
- Parser.frame file for NRefactory.
- */
-using System;
-using System.Reflection;
-
-namespace ICSharpCode.OldNRefactory.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
deleted file mode 100644
index 1392e53695..0000000000
--- a/main/contrib/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG
+++ /dev/null
@@ -1,3406 +0,0 @@
-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
deleted file mode 100644
index df7abc32a4..0000000000
--- a/main/contrib/NRefactory/Project/Src/Parser/VBNet/VBNetParser.cs
+++ /dev/null
@@ -1,325 +0,0 @@
-// <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.OldNRefactory.Visitors;
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Text;
-using ICSharpCode.OldNRefactory.Ast;
-
-namespace ICSharpCode.OldNRefactory.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/Parser/gen.bat b/main/contrib/NRefactory/Project/Src/Parser/gen.bat
deleted file mode 100755
index 423f542def..0000000000
--- a/main/contrib/NRefactory/Project/Src/Parser/gen.bat
+++ /dev/null
@@ -1,24 +0,0 @@
-@echo off
-
-goto old
-
-
-:old
-echo Generating with #Coco
-
-cd Frames
-
-copy ..\CSharp\cs.ATG
-SharpCoco -namespace ICSharpCode.NRefactory.Parser.CSharp cs.ATG
-move Parser.cs ..\CSharp
-
-copy ..\VBNet\VBNET.ATG
-SharpCoco -trace GIPXA -namespace ICSharpCode.NRefactory.Parser.VB VBNET.ATG
-move Parser.cs ..\VBNet
-
-del cs.ATG
-del VBNET.ATG
-
-:exit
-pause
-cd ..
diff --git a/main/contrib/NRefactory/Project/Src/Parser/gen.sh b/main/contrib/NRefactory/Project/Src/Parser/gen.sh
deleted file mode 100755
index 2925baa421..0000000000
--- a/main/contrib/NRefactory/Project/Src/Parser/gen.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-echo Generating with coco
-set CRFRAMES = "Frames"
-cp CSharp/cs.ATG Frames/cs.ATG
-mono Frames/SharpCoco.exe -namespace ICSharpCode.NRefactory.Parser.CSharp Frames/cs.ATG
-mv Frames/Parser.cs CSharp/Parser.cs
-
-#mono Frames/SharpCoco.exe -trace GIPXA -namespace ICSharpCode.NRefactory.Parser.VB VBNet/VBNET.ATG
diff --git a/main/contrib/NRefactory/Project/Src/ParserFactory.cs b/main/contrib/NRefactory/Project/Src/ParserFactory.cs
deleted file mode 100644
index 3545a4f009..0000000000
--- a/main/contrib/NRefactory/Project/Src/ParserFactory.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-// <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.OldNRefactory
-{
- 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.OldNRefactory.Parser.CSharp.Lexer(textReader);
- case SupportedLanguage.VBNet:
- return new ICSharpCode.OldNRefactory.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.OldNRefactory.Parser.CSharp.Parser(lexer);
- case SupportedLanguage.VBNet:
- return new ICSharpCode.OldNRefactory.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
deleted file mode 100644
index fdd00c482c..0000000000
--- a/main/contrib/NRefactory/Project/Src/PrettyPrinter/AbstractOutputFormatter.cs
+++ /dev/null
@@ -1,232 +0,0 @@
-// <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.Text;
-
-namespace ICSharpCode.OldNRefactory.PrettyPrinter
-{
- /// <summary>
- /// Base class of output formatters.
- /// </summary>
- public abstract class AbstractOutputFormatter : IOutputFormatter
- {
- StringBuilder text = new StringBuilder();
-
- int indentationLevel = 0;
- bool indent = true;
- bool doNewLine = true;
- AbstractPrettyPrintOptions prettyPrintOptions;
-
- public bool IsInMemberBody { get; set; }
-
- public int IndentationLevel {
- get {
- return indentationLevel;
- }
- set {
- indentationLevel = value;
- }
- }
-
- public string Text {
- get {
- return text.ToString();
- }
- }
-
- public int TextLength {
- get {
- return text.Length;
- }
- }
-
-
- public bool DoIndent {
- get {
- return indent;
- }
- set {
- indent = value;
- }
- }
-
- public bool DoNewLine {
- get {
- return doNewLine;
- }
- set {
- doNewLine = value;
- }
- }
-
- protected AbstractOutputFormatter(AbstractPrettyPrintOptions prettyPrintOptions)
- {
- this.prettyPrintOptions = prettyPrintOptions;
- }
-
- internal bool isIndented = false;
- public void Indent()
- {
- if (DoIndent) {
- int indent = 0;
- while (indent < prettyPrintOptions.IndentSize * indentationLevel) {
- char ch = prettyPrintOptions.IndentationChar;
- if (ch == '\t' && indent + prettyPrintOptions.TabSize > prettyPrintOptions.IndentSize * indentationLevel) {
- ch = ' ';
- }
- text.Append(ch);
- if (ch == '\t') {
- indent += prettyPrintOptions.TabSize;
- } else {
- ++indent;
- }
- }
- isIndented = true;
- }
- }
-
- public void Reset ()
- {
- text.Length = 0;
- isIndented = false;
- }
-
- public void Space()
- {
- text.Append(' ');
- isIndented = false;
- }
-
- internal int lastLineStart = 0;
- internal int lineBeforeLastStart = 0;
-
- public bool LastCharacterIsNewLine {
- get {
- return text.Length == lastLineStart;
- }
- }
-
- public bool LastCharacterIsWhiteSpace {
- get {
- return text.Length == 0 || char.IsWhiteSpace(text[text.Length - 1]);
- }
- }
-
- public virtual void NewLine()
- {
- if (DoNewLine) {
- if (!LastCharacterIsNewLine) {
- lineBeforeLastStart = lastLineStart;
- }
- text.Append(prettyPrintOptions.EolMarker);
- lastLineStart = text.Length;
- isIndented = false;
- }
- }
-
- public virtual void EndFile()
- {
- }
-
- protected void WriteLineInPreviousLine(string txt, bool forceWriteInPreviousBlock)
- {
- WriteInPreviousLine(txt + prettyPrintOptions.EolMarker, forceWriteInPreviousBlock);
- }
- protected void WriteLineInPreviousLine(string txt, bool forceWriteInPreviousBlock, bool indent)
- {
- WriteInPreviousLine(txt + prettyPrintOptions.EolMarker, forceWriteInPreviousBlock, indent);
- }
-
- protected void WriteInPreviousLine(string txt, bool forceWriteInPreviousBlock)
- {
- WriteInPreviousLine(txt, forceWriteInPreviousBlock, true);
- }
- protected void WriteInPreviousLine(string txt, bool forceWriteInPreviousBlock, bool indent)
- {
- if (txt.Length == 0) return;
-
- bool lastCharacterWasNewLine = LastCharacterIsNewLine;
- if (lastCharacterWasNewLine) {
- if (forceWriteInPreviousBlock == false) {
- if (indent && txt != prettyPrintOptions.EolMarker) Indent();
- text.Append(txt);
- lineBeforeLastStart = lastLineStart;
- lastLineStart = text.Length;
- return;
- }
- lastLineStart = lineBeforeLastStart;
- }
- string lastLine = text.ToString(lastLineStart, text.Length - lastLineStart);
- text.Remove(lastLineStart, text.Length - lastLineStart);
- if (indent) {
- if (forceWriteInPreviousBlock) ++indentationLevel;
- Indent();
- if (forceWriteInPreviousBlock) --indentationLevel;
- }
- text.Append(txt);
- lineBeforeLastStart = lastLineStart;
- lastLineStart = text.Length;
- text.Append(lastLine);
- if (lastCharacterWasNewLine) {
- lineBeforeLastStart = lastLineStart;
- lastLineStart = text.Length;
- }
- isIndented = false;
- }
-
- /// <summary>
- /// Prints a text that cannot be inserted before using WriteInPreviousLine
- /// into the current line
- /// </summary>
- protected void PrintSpecialText(string specialText)
- {
- lineBeforeLastStart = text.Length;
- text.Append(specialText);
- lastLineStart = text.Length;
- isIndented = false;
- }
-
- public void PrintTokenList(ArrayList tokenList)
- {
- foreach (int token in tokenList) {
- PrintToken(token);
- Space();
- }
- }
-
- public abstract void PrintComment(Comment comment, bool forceWriteInPreviousBlock);
-
- public virtual void PrintPreprocessingDirective(PreprocessingDirective directive, bool forceWriteInPreviousBlock)
- {
- if (!directive.Expression.IsNull) {
- CSharpOutputVisitor visitor = new CSharpOutputVisitor();
- directive.Expression.AcceptVisitor(visitor, null);
- WriteLineInPreviousLine(directive.Cmd + " " + visitor.Text, forceWriteInPreviousBlock);
- } else if (string.IsNullOrEmpty(directive.Arg))
- WriteLineInPreviousLine(directive.Cmd, forceWriteInPreviousBlock);
- else
- WriteLineInPreviousLine(directive.Cmd + " " + directive.Arg, forceWriteInPreviousBlock);
- }
-
- public void PrintBlankLine(bool forceWriteInPreviousBlock)
- {
- WriteInPreviousLine(prettyPrintOptions.EolMarker, forceWriteInPreviousBlock);
- }
-
- public abstract void PrintToken(int token);
-
- public void PrintText(string text)
- {
- this.text.Append(text);
- isIndented = false;
- }
-
- public abstract void PrintIdentifier(string identifier);
- }
-}
diff --git a/main/contrib/NRefactory/Project/Src/PrettyPrinter/AbstractPrettyPrintOptions.cs b/main/contrib/NRefactory/Project/Src/PrettyPrinter/AbstractPrettyPrintOptions.cs
deleted file mode 100644
index d779830587..0000000000
--- a/main/contrib/NRefactory/Project/Src/PrettyPrinter/AbstractPrettyPrintOptions.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-// <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.OldNRefactory.PrettyPrinter
-{
- /// <summary>
- /// Description of PrettyPrintOptions.
- /// </summary>
- public class AbstractPrettyPrintOptions
- {
- char indentationChar = '\t';
- int tabSize = 4;
- int indentSize = 4;
- string eolMarker = System.Environment.NewLine;
-
- 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;
- }
- }
-
- public string EolMarker {
- get {
- return eolMarker;
- }
- set {
- eolMarker = value;
- }
- }
- }
-}
diff --git a/main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs b/main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs
deleted file mode 100644
index 3c38ca981e..0000000000
--- a/main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs
+++ /dev/null
@@ -1,3185 +0,0 @@
-// <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.Linq;
-using System.Collections;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Globalization;
-using System.Text;
-
-using ICSharpCode.OldNRefactory.Ast;
-using ICSharpCode.OldNRefactory.Parser;
-using ICSharpCode.OldNRefactory.Parser.CSharp;
-using ICSharpCode.OldNRefactory.Visitors;
-
-namespace ICSharpCode.OldNRefactory.PrettyPrinter
-{
- public sealed class CSharpOutputVisitor : NodeTrackingAstVisitor, IOutputAstVisitor
- {
- Errors errors = new Errors();
- CSharpOutputFormatter outputFormatter;
- PrettyPrintOptions prettyPrintOptions = new PrettyPrintOptions();
-
- public string Text {
- get {
- return outputFormatter.Text;
- }
- }
-
- public Errors Errors {
- get {
- return errors;
- }
- }
-
- AbstractPrettyPrintOptions IOutputAstVisitor.Options {
- get { return prettyPrintOptions; }
- }
-
- public PrettyPrintOptions Options {
- get { return prettyPrintOptions; }
- set {
- if (value == null)
- throw new ArgumentNullException();
- prettyPrintOptions = value;
- }
- }
-
- public IOutputFormatter OutputFormatter {
- get {
- return outputFormatter;
- }
- }
-
- public CSharpOutputVisitor()
- {
- outputFormatter = new CSharpOutputFormatter(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);
- }
- }
-
- void Error(INode node, string message)
- {
- outputFormatter.PrintText(" // ERROR: " + message + Environment.NewLine);
- errors.Error(node.StartLocation.Line, node.StartLocation.Column, message);
- }
-
- void NotSupported(INode node)
- {
- Error(node, "Not supported in C#: " + node.GetType().Name);
- }
-
- #region ICSharpCode.OldNRefactory.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.PrimitiveTypesCSharpReverse.TryGetValue(typeString, out primitiveType))
- return primitiveType;
- else
- return typeString;
- }
-
- void PrintTemplates(List<TemplateDefinition> templates)
- {
- if (templates.Count == 0) return;
- outputFormatter.PrintToken(Tokens.LessThan);
- for (int i = 0; i < templates.Count; i++) {
- if (i > 0) PrintFormattedComma();
- outputFormatter.PrintIdentifier(templates[i].Name);
- }
- outputFormatter.PrintToken(Tokens.GreaterThan);
- }
-
- public override object TrackedVisitTypeReference(TypeReference typeReference, object data)
- {
- if (typeReference == TypeReference.ClassConstraint) {
- outputFormatter.PrintToken(Tokens.Class);
- } else if (typeReference == TypeReference.StructConstraint) {
- outputFormatter.PrintToken(Tokens.Struct);
- } else if (typeReference == TypeReference.NewConstraint) {
- outputFormatter.PrintToken(Tokens.New);
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- } else {
- PrintTypeReferenceWithoutArray(typeReference);
- if (typeReference.IsArrayType) {
- PrintArrayRank(typeReference.RankSpecifier, 0);
- }
- }
- return null;
- }
-
- void PrintArrayRank(int[] rankSpecifier, int startRankIndex)
- {
- for (int i = startRankIndex; i < rankSpecifier.Length; ++i) {
- outputFormatter.PrintToken(Tokens.OpenSquareBracket);
- bool outputSpace = this.prettyPrintOptions.SpacesWithinBrackets && rankSpecifier[i] > 0;
- if (outputSpace) {
- outputFormatter.Space();
- }
- for (int j = 0; j < rankSpecifier[i]; ++j) {
- outputFormatter.PrintToken(Tokens.Comma);
- }
- if (outputSpace) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.CloseSquareBracket);
- }
- }
-
- void PrintTypeReferenceWithoutArray(TypeReference typeReference)
- {
- if (typeReference.IsGlobal) {
- outputFormatter.PrintText("global::");
- }
- bool printGenerics = true;
- if (typeReference.IsKeyword) {
- if (typeReference.Type == "System.Nullable"
- && typeReference.GenericTypes != null
- && typeReference.GenericTypes.Count == 1)
- {
- TrackVisit(typeReference.GenericTypes[0], null);
- outputFormatter.PrintText("?");
- printGenerics = false;
- } else {
- outputFormatter.PrintText(ConvertTypeString(typeReference.Type));
- }
- } else {
- outputFormatter.PrintIdentifier(typeReference.Type);
- }
- if (printGenerics && typeReference.GenericTypes != null && typeReference.GenericTypes.Count > 0) {
- outputFormatter.PrintToken(Tokens.LessThan);
- AppendCommaSeparatedList(typeReference.GenericTypes);
- outputFormatter.PrintToken(Tokens.GreaterThan);
- }
- for (int i = 0; i < typeReference.PointerNestingLevel; ++i) {
- outputFormatter.PrintToken(Tokens.Times);
- }
- }
-
- public override object TrackedVisitInnerClassTypeReference(InnerClassTypeReference innerClassTypeReference, object data)
- {
- TrackVisit(innerClassTypeReference.BaseType, data);
- outputFormatter.PrintToken(Tokens.Dot);
- return VisitTypeReference((TypeReference)innerClassTypeReference, data);
- }
-
- #region Global scope
- void VisitAttributes(ICollection attributes, object data)
- {
- if (attributes == null || attributes.Count <= 0) {
- return;
- }
- foreach (AttributeSection section in attributes) {
- TrackVisit(section, data);
- }
- bool formatSection = true;
- if (data is bool)
- formatSection = (bool)data;
- if (!formatSection)
- outputFormatter.Space ();
- }
-
- void PrintFormattedComma()
- {
- if (this.prettyPrintOptions.SpacesBeforeComma) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.Comma);
- if (this.prettyPrintOptions.SpacesAfterComma) {
- outputFormatter.Space();
- }
- }
- void PrintFormattedCommaAndNewLine()
- {
- if (this.prettyPrintOptions.SpacesBeforeComma) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.Comma);
- outputFormatter.NewLine();
- outputFormatter.Indent();
- }
-
- public override object TrackedVisitAttributeSection(AttributeSection attributeSection, object data)
- {
- bool formatSection = true;
- if (data is bool)
- formatSection = (bool)data;
- if (formatSection)
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.OpenSquareBracket);
- if (this.prettyPrintOptions.SpacesWithinBrackets) {
- outputFormatter.Space();
- }
- if (!string.IsNullOrEmpty(attributeSection.AttributeTarget)) {
- outputFormatter.PrintText(attributeSection.AttributeTarget);
- outputFormatter.PrintToken(Tokens.Colon);
- outputFormatter.Space();
- }
- Debug.Assert(attributeSection.Attributes != null);
- for (int j = 0; j < attributeSection.Attributes.Count; ++j) {
- TrackVisit((INode)attributeSection.Attributes[j], data);
- if (j + 1 < attributeSection.Attributes.Count) {
- PrintFormattedComma();
- }
- }
- if (this.prettyPrintOptions.SpacesWithinBrackets) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.CloseSquareBracket);
- if (formatSection) {
- outputFormatter.NewLine();
- }
- return null;
- }
-
- public override object TrackedVisitAttribute (ICSharpCode.OldNRefactory.Ast.Attribute attribute, object data)
- {
- outputFormatter.PrintIdentifier (attribute.Name);
- if (attribute.IsEmptyCall)
- return null;
- outputFormatter.PrintToken (Tokens.OpenParenthesis);
- if (this.prettyPrintOptions.WithinMethodCallParentheses) {
- outputFormatter.Space ();
- }
- this.AppendCommaSeparatedList (attribute.PositionalArguments);
-
- if (attribute.NamedArguments != null && attribute.NamedArguments.Count > 0) {
- if (attribute.PositionalArguments.Count > 0) {
- PrintFormattedComma ();
- }
- for (int i = 0; i < attribute.NamedArguments.Count; ++i) {
- TrackVisit ((INode)attribute.NamedArguments[i], data);
- if (i + 1 < attribute.NamedArguments.Count) {
- PrintFormattedComma ();
- }
- }
- }
- if (this.prettyPrintOptions.WithinMethodCallParentheses) {
- outputFormatter.Space ();
- }
- outputFormatter.PrintToken (Tokens.CloseParenthesis);
- return null;
- }
-
- public override object TrackedVisitNamedArgumentExpression(NamedArgumentExpression namedArgumentExpression, object data)
- {
- outputFormatter.PrintIdentifier(namedArgumentExpression.Name);
- if (this.prettyPrintOptions.AroundAssignmentParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.Assign);
- if (this.prettyPrintOptions.AroundAssignmentParentheses) {
- outputFormatter.Space();
- }
- TrackVisit(namedArgumentExpression.Expression, data);
- return null;
- }
-
- public override object TrackedVisitUsing(Using @using, object data)
- {
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.Using);
- outputFormatter.Space();
-
- outputFormatter.PrintIdentifier(@using.Name);
-
- if (@using.IsAlias) {
- if (this.prettyPrintOptions.AroundAssignmentParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.Assign);
- if (this.prettyPrintOptions.AroundAssignmentParentheses) {
- outputFormatter.Space();
- }
- TrackVisit(@using.Alias, data);
- }
-
- outputFormatter.PrintToken(Tokens.Semicolon);
- outputFormatter.NewLine();
- return null;
- }
-
- public override object TrackedVisitUsingDeclaration(UsingDeclaration usingDeclaration, object data)
- {
- foreach (Using u in usingDeclaration.Usings) {
- TrackVisit(u, data);
- }
- return null;
- }
-
- public override object TrackedVisitExternAliasDirective(ExternAliasDirective externAliasDirective, object data)
- {
- outputFormatter.Indent();
- outputFormatter.PrintText("extern alias ");
- outputFormatter.PrintIdentifier(externAliasDirective.Name);
- outputFormatter.PrintToken(Tokens.Semicolon);
- 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.BeginBrace (this.prettyPrintOptions.NamespaceBraceStyle, this.prettyPrintOptions.IndentNamespaceBody);
-
- namespaceDeclaration.AcceptChildren(this, data);
-
- outputFormatter.EndBrace(this.prettyPrintOptions.IndentNamespaceBody);
-
- return null;
- }
-
-
- void OutputEnumMembers(TypeDeclaration typeDeclaration, object data)
- {
- for (int i = 0; i < typeDeclaration.Children.Count; i++) {
- FieldDeclaration fieldDeclaration = (FieldDeclaration)typeDeclaration.Children[i];
- 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) {
- if (this.prettyPrintOptions.AroundAssignmentParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.Assign);
- if (this.prettyPrintOptions.AroundAssignmentParentheses) {
- outputFormatter.Space();
- }
- TrackVisit(f.Initializer, data);
- }
- if (i < typeDeclaration.Children.Count - 1) {
- outputFormatter.PrintToken(Tokens.Comma);
- }
- outputFormatter.NewLine();
- EndVisit(fieldDeclaration);
- }
- }
-
- TypeDeclaration currentType = null;
-
- public override object TrackedVisitTypeDeclaration(TypeDeclaration typeDeclaration, object data)
- {
- VisitAttributes(typeDeclaration.Attributes, data);
- outputFormatter.Indent();
- OutputModifier(typeDeclaration.Modifier);
- switch (typeDeclaration.Type) {
- case ClassType.Enum:
- outputFormatter.PrintToken(Tokens.Enum);
- break;
- case ClassType.Interface:
- outputFormatter.PrintToken(Tokens.Interface);
- break;
- case ClassType.Struct:
- outputFormatter.PrintToken(Tokens.Struct);
- break;
- default:
- outputFormatter.PrintToken(Tokens.Class);
- break;
- }
- outputFormatter.Space();
- outputFormatter.PrintIdentifier(typeDeclaration.Name);
-
- PrintTemplates(typeDeclaration.Templates);
-
- if (typeDeclaration.BaseTypes != null && typeDeclaration.BaseTypes.Count > 0) {
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Colon);
- outputFormatter.Space();
- for (int i = 0; i < typeDeclaration.BaseTypes.Count; ++i) {
- if (i > 0) {
- PrintFormattedComma();
- }
- TrackVisit(typeDeclaration.BaseTypes[i], data);
- }
- }
-
- foreach (TemplateDefinition templateDefinition in typeDeclaration.Templates) {
- TrackVisit(templateDefinition, data);
- }
-
- switch (typeDeclaration.Type) {
- case ClassType.Enum:
- outputFormatter.BeginBrace(this.prettyPrintOptions.EnumBraceStyle, this.prettyPrintOptions.IndentEnumBody);
- break;
- case ClassType.Interface:
- outputFormatter.BeginBrace(this.prettyPrintOptions.InterfaceBraceStyle, this.prettyPrintOptions.IndentInterfaceBody);
- break;
- case ClassType.Struct:
- outputFormatter.BeginBrace(this.prettyPrintOptions.StructBraceStyle, this.prettyPrintOptions.IndentStructBody);
- break;
- default:
- outputFormatter.BeginBrace(this.prettyPrintOptions.ClassBraceStyle, this.prettyPrintOptions.IndentClassBody);
- break;
- }
-
- TypeDeclaration oldType = currentType;
- currentType = typeDeclaration;
- if (typeDeclaration.Type == ClassType.Enum) {
- OutputEnumMembers(typeDeclaration, data);
- } else {
- typeDeclaration.AcceptChildren(this, data);
- }
- currentType = oldType;
- switch (typeDeclaration.Type) {
- case ClassType.Enum:
- outputFormatter.EndBrace(this.prettyPrintOptions.IndentEnumBody);
- break;
- case ClassType.Interface:
- outputFormatter.EndBrace(this.prettyPrintOptions.IndentInterfaceBody);
- break;
- case ClassType.Struct:
- outputFormatter.EndBrace(this.prettyPrintOptions.IndentStructBody);
- break;
- default:
- outputFormatter.EndBrace(this.prettyPrintOptions.IndentCaseBody);
- break;
- }
-
- return null;
- }
-
- public override object TrackedVisitTemplateDefinition(TemplateDefinition templateDefinition, object data)
- {
- if (templateDefinition.Bases.Count == 0)
- return null;
-
- outputFormatter.Space();
- outputFormatter.PrintText("where");
- outputFormatter.Space();
- outputFormatter.PrintIdentifier(templateDefinition.Name);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Colon);
- outputFormatter.Space();
-
- for (int i = 0; i < templateDefinition.Bases.Count; ++i) {
- TrackVisit(templateDefinition.Bases[i], data);
- if (i + 1 < templateDefinition.Bases.Count) {
- PrintFormattedComma();
- }
- }
- return null;
- }
-
- public override object TrackedVisitDelegateDeclaration(DelegateDeclaration delegateDeclaration, object data)
- {
- VisitAttributes(delegateDeclaration.Attributes, data);
- outputFormatter.Indent();
- OutputModifier(delegateDeclaration.Modifier);
- outputFormatter.PrintToken(Tokens.Delegate);
- outputFormatter.Space();
- TrackVisit(delegateDeclaration.ReturnType, data);
- outputFormatter.Space();
- outputFormatter.PrintIdentifier(delegateDeclaration.Name);
- PrintTemplates(delegateDeclaration.Templates);
- if (prettyPrintOptions.BeforeDelegateDeclarationParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- bool withinParentheses = this.prettyPrintOptions.WithinMethodDeclarationParentheses && delegateDeclaration.Parameters.Any ();
- if (withinParentheses) {
- outputFormatter.Space();
- }
- AppendCommaSeparatedList(delegateDeclaration.Parameters);
- if (withinParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- foreach (TemplateDefinition templateDefinition in delegateDeclaration.Templates) {
- TrackVisit(templateDefinition, data);
- }
- outputFormatter.PrintToken(Tokens.Semicolon);
- outputFormatter.NewLine();
- return null;
- }
-
- public override object TrackedVisitOptionDeclaration(OptionDeclaration optionDeclaration, object data)
- {
- if ((optionDeclaration.OptionType == OptionType.Explicit || optionDeclaration.OptionType == OptionType.Strict)
- && optionDeclaration.OptionValue == true)
- {
- // Explicit On/Strict On is what C# does, do not report an error
- } else {
- NotSupported(optionDeclaration);
- }
- return null;
- }
- #endregion
-
- #region Type level
- public override object TrackedVisitFieldDeclaration(FieldDeclaration fieldDeclaration, object data)
- {
- if (!fieldDeclaration.TypeReference.IsNull) {
- VisitAttributes(fieldDeclaration.Attributes, data);
- outputFormatter.Indent();
- OutputModifier(fieldDeclaration.Modifier);
- TrackVisit(fieldDeclaration.TypeReference, data);
- outputFormatter.Space();
- AppendCommaSeparatedList(fieldDeclaration.Fields);
- outputFormatter.PrintToken(Tokens.Semicolon);
- outputFormatter.NewLine();
- } else {
- for (int i = 0; i < fieldDeclaration.Fields.Count; i++) {
- VisitAttributes(fieldDeclaration.Attributes, data);
- outputFormatter.Indent();
- OutputModifier(fieldDeclaration.Modifier);
- TrackVisit(fieldDeclaration.GetTypeForField(i), data);
- outputFormatter.Space();
- TrackVisit(fieldDeclaration.Fields[i], data);
- outputFormatter.PrintToken(Tokens.Semicolon);
- outputFormatter.NewLine();
- }
- }
- return null;
- }
-
- public override object TrackedVisitVariableDeclaration(VariableDeclaration variableDeclaration, object data)
- {
- outputFormatter.PrintIdentifier(variableDeclaration.Name);
- if (!variableDeclaration.FixedArrayInitialization.IsNull) {
- outputFormatter.PrintToken(Tokens.OpenSquareBracket);
- TrackVisit(variableDeclaration.FixedArrayInitialization, data);
- outputFormatter.PrintToken(Tokens.CloseSquareBracket);
- }
- if (!variableDeclaration.Initializer.IsNull) {
- if (this.prettyPrintOptions.AroundAssignmentParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.Assign);
- if (this.prettyPrintOptions.AroundAssignmentParentheses) {
- outputFormatter.Space();
- }
- TrackVisit(variableDeclaration.Initializer, data);
- }
- return null;
- }
-
- public override object TrackedVisitPropertyDeclaration(PropertyDeclaration propertyDeclaration, object data)
- {
- VisitAttributes(propertyDeclaration.Attributes, data);
- outputFormatter.Indent();
- propertyDeclaration.Modifier &= ~Modifiers.ReadOnly;
- OutputModifier(propertyDeclaration.Modifier);
- TrackVisit(propertyDeclaration.TypeReference, data);
- outputFormatter.Space();
- if (propertyDeclaration.InterfaceImplementations.Count > 0) {
- TrackVisit(propertyDeclaration.InterfaceImplementations[0].InterfaceType, data);
- outputFormatter.PrintToken(Tokens.Dot);
- }
- outputFormatter.PrintIdentifier(propertyDeclaration.Name);
-
- OutputGetAndSetRegion(propertyDeclaration.GetRegion, propertyDeclaration.SetRegion);
-
- 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);
- outputFormatter.Indent();
- OutputModifier(propertyGetRegion.Modifier);
- outputFormatter.PrintText("get");
- if (prettyPrintOptions.AllowPropertyGetBlockInline) {
- OutputBlockAllowInline(propertyGetRegion.Block, prettyPrintOptions.PropertyGetBraceStyle);
- } else {
- OutputBlock(propertyGetRegion.Block, prettyPrintOptions.PropertyGetBraceStyle);
- }
- return null;
- }
-
- public override object TrackedVisitPropertySetRegion(PropertySetRegion propertySetRegion, object data)
- {
- this.VisitAttributes(propertySetRegion.Attributes, data);
- outputFormatter.Indent();
- OutputModifier(propertySetRegion.Modifier);
- outputFormatter.PrintText("set");
- if (prettyPrintOptions.AllowPropertySetBlockInline) {
- OutputBlockAllowInline(propertySetRegion.Block, prettyPrintOptions.PropertySetBraceStyle);
- } else {
- OutputBlock(propertySetRegion.Block, prettyPrintOptions.PropertySetBraceStyle);
- }
- return null;
- }
-
- public override object TrackedVisitEventDeclaration(EventDeclaration eventDeclaration, object data)
- {
- VisitAttributes(eventDeclaration.Attributes, data);
- outputFormatter.Indent();
- OutputModifier(eventDeclaration.Modifier);
- outputFormatter.PrintToken(Tokens.Event);
- outputFormatter.Space();
- TrackVisit(eventDeclaration.TypeReference, data);
- outputFormatter.Space();
-
- if (eventDeclaration.InterfaceImplementations.Count > 0) {
- TrackVisit(eventDeclaration.InterfaceImplementations[0].InterfaceType, data);
- outputFormatter.PrintToken(Tokens.Dot);
- }
-
- outputFormatter.PrintIdentifier(eventDeclaration.Name);
-
- if (!eventDeclaration.Initializer.IsNull) {
- if (this.prettyPrintOptions.AroundAssignmentParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.Assign);
- if (this.prettyPrintOptions.AroundAssignmentParentheses) {
- outputFormatter.Space();
- }
- TrackVisit(eventDeclaration.Initializer, data);
- }
-
- if (eventDeclaration.AddRegion.IsNull && eventDeclaration.RemoveRegion.IsNull) {
- outputFormatter.PrintToken(Tokens.Semicolon);
- outputFormatter.NewLine();
- } else {
- outputFormatter.BeginBrace(this.prettyPrintOptions.EventBraceStyle, this.prettyPrintOptions.IndentEventBody);
- TrackVisit(eventDeclaration.AddRegion, data);
- TrackVisit(eventDeclaration.RemoveRegion, data);
- outputFormatter.EndBrace(this.prettyPrintOptions.IndentEventBody);
- }
- return null;
- }
-
- public override object TrackedVisitEventAddRegion(EventAddRegion eventAddRegion, object data)
- {
- VisitAttributes(eventAddRegion.Attributes, data);
- outputFormatter.Indent();
- outputFormatter.PrintText("add");
- if (prettyPrintOptions.AllowEventAddBlockInline) {
- OutputBlockAllowInline(eventAddRegion.Block, prettyPrintOptions.EventAddBraceStyle);
- } else {
- OutputBlock(eventAddRegion.Block, prettyPrintOptions.EventAddBraceStyle);
- }
- return null;
- }
-
- public override object TrackedVisitEventRemoveRegion(EventRemoveRegion eventRemoveRegion, object data)
- {
- VisitAttributes(eventRemoveRegion.Attributes, data);
- outputFormatter.Indent();
- outputFormatter.PrintText("remove");
- if (prettyPrintOptions.AllowEventRemoveBlockInline) {
- OutputBlockAllowInline(eventRemoveRegion.Block, prettyPrintOptions.EventRemoveBraceStyle);
- } else {
- OutputBlock(eventRemoveRegion.Block, prettyPrintOptions.EventRemoveBraceStyle);
- }
- return null;
- }
-
- public override object TrackedVisitEventRaiseRegion(EventRaiseRegion eventRaiseRegion, object data)
- {
- // VB.NET only
- NotSupported(eventRaiseRegion);
- return null;
- }
-
- public override object TrackedVisitParameterDeclarationExpression(ParameterDeclarationExpression parameterDeclarationExpression, object data)
- {
- VisitAttributes(parameterDeclarationExpression.Attributes, false);
- if (!parameterDeclarationExpression.DefaultValue.IsNull) {
- outputFormatter.PrintText("[System.Runtime.InteropServices.OptionalAttribute, System.Runtime.InteropServices.DefaultParameterValueAttribute(");
- TrackVisit(parameterDeclarationExpression.DefaultValue, data);
- outputFormatter.PrintText(")] ");
- }
- OutputModifier(parameterDeclarationExpression.ParamModifier, parameterDeclarationExpression);
- if (!parameterDeclarationExpression.TypeReference.IsNull) {
- TrackVisit(parameterDeclarationExpression.TypeReference, data);
- outputFormatter.Space();
- }
- outputFormatter.PrintIdentifier(parameterDeclarationExpression.ParameterName);
- return null;
- }
-
- public override object TrackedVisitMethodDeclaration(MethodDeclaration methodDeclaration, object data)
- {
- VisitAttributes(methodDeclaration.Attributes, data);
- outputFormatter.Indent();
- OutputModifier(methodDeclaration.Modifier);
- TrackVisit(methodDeclaration.TypeReference, data);
- outputFormatter.Space();
- if (methodDeclaration.InterfaceImplementations.Count > 0) {
- TrackVisit(methodDeclaration.InterfaceImplementations[0].InterfaceType, data);
- outputFormatter.PrintToken(Tokens.Dot);
- }
- if (methodDeclaration.HandlesClause.Count > 0) {
- Error(methodDeclaration, "Handles clauses are not supported in C#");
- }
- outputFormatter.PrintIdentifier(methodDeclaration.Name);
-
- PrintMethodDeclaration(methodDeclaration);
- return null;
- }
-
- void PrintMethodDeclaration(MethodDeclaration methodDeclaration)
- {
- PrintTemplates(methodDeclaration.Templates);
- if (prettyPrintOptions.BeforeMethodDeclarationParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- bool withinParentheses = this.prettyPrintOptions.WithinMethodDeclarationParentheses && methodDeclaration.Parameters.Any ();
- if (withinParentheses) {
- outputFormatter.Space();
- }
- if (methodDeclaration.IsExtensionMethod) {
- outputFormatter.PrintToken(Tokens.This);
- outputFormatter.Space();
- }
- AppendCommaSeparatedList(methodDeclaration.Parameters);
- if (withinParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- foreach (TemplateDefinition templateDefinition in methodDeclaration.Templates) {
- TrackVisit(templateDefinition, null);
- }
- OutputBlock(methodDeclaration.Body, this.prettyPrintOptions.MethodBraceStyle);
- }
-
- 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.Implicit);
- } else {
- outputFormatter.PrintToken(Tokens.Explicit);
- }
- } else {
- TrackVisit(operatorDeclaration.TypeReference, data);
- }
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Operator);
- outputFormatter.Space();
-
- if (operatorDeclaration.IsConversionOperator) {
- TrackVisit(operatorDeclaration.TypeReference, data);
- } else {
- switch (operatorDeclaration.OverloadableOperator) {
- case OverloadableOperatorType.Add:
- case OverloadableOperatorType.UnaryPlus:
- outputFormatter.PrintToken(Tokens.Plus);
- break;
- case OverloadableOperatorType.BitNot:
- outputFormatter.PrintToken(Tokens.BitwiseComplement);
- break;
- case OverloadableOperatorType.BitwiseAnd:
- outputFormatter.PrintToken(Tokens.BitwiseAnd);
- break;
- case OverloadableOperatorType.BitwiseOr:
- outputFormatter.PrintToken(Tokens.BitwiseOr);
- break;
- case OverloadableOperatorType.Concat:
- outputFormatter.PrintToken(Tokens.Plus);
- break;
- case OverloadableOperatorType.Decrement:
- outputFormatter.PrintToken(Tokens.Decrement);
- break;
- case OverloadableOperatorType.Divide:
- case OverloadableOperatorType.DivideInteger:
- outputFormatter.PrintToken(Tokens.Div);
- break;
- case OverloadableOperatorType.Equality:
- outputFormatter.PrintToken(Tokens.Equal);
- break;
- case OverloadableOperatorType.ExclusiveOr:
- outputFormatter.PrintToken(Tokens.Xor);
- break;
- case OverloadableOperatorType.GreaterThan:
- outputFormatter.PrintToken(Tokens.GreaterThan);
- break;
- case OverloadableOperatorType.GreaterThanOrEqual:
- outputFormatter.PrintToken(Tokens.GreaterEqual);
- break;
- case OverloadableOperatorType.Increment:
- outputFormatter.PrintToken(Tokens.Increment);
- break;
- case OverloadableOperatorType.InEquality:
- outputFormatter.PrintToken(Tokens.NotEqual);
- break;
- case OverloadableOperatorType.IsTrue:
- outputFormatter.PrintToken(Tokens.True);
- break;
- case OverloadableOperatorType.IsFalse:
- outputFormatter.PrintToken(Tokens.False);
- break;
- case OverloadableOperatorType.LessThan:
- outputFormatter.PrintToken(Tokens.LessThan);
- break;
- case OverloadableOperatorType.LessThanOrEqual:
- outputFormatter.PrintToken(Tokens.LessEqual);
- break;
- case OverloadableOperatorType.Like:
- outputFormatter.PrintText("Like");
- break;
- case OverloadableOperatorType.Modulus:
- outputFormatter.PrintToken(Tokens.Mod);
- break;
- case OverloadableOperatorType.Multiply:
- outputFormatter.PrintToken(Tokens.Times);
- break;
- case OverloadableOperatorType.Not:
- outputFormatter.PrintToken(Tokens.Not);
- break;
- case OverloadableOperatorType.Power:
- outputFormatter.PrintText("Power");
- break;
- case OverloadableOperatorType.ShiftLeft:
- outputFormatter.PrintToken(Tokens.ShiftLeft);
- break;
- case OverloadableOperatorType.ShiftRight:
- outputFormatter.PrintToken(Tokens.GreaterThan);
- outputFormatter.PrintToken(Tokens.GreaterThan);
- break;
- case OverloadableOperatorType.UnaryMinus:
- case OverloadableOperatorType.Subtract:
- outputFormatter.PrintToken(Tokens.Minus);
- break;
- default:
- Error(operatorDeclaration, operatorDeclaration.OverloadableOperator.ToString() + " is not supported as overloadable operator");
- break;
- }
- }
-
- PrintMethodDeclaration(operatorDeclaration);
- return null;
- }
-
- public override object TrackedVisitInterfaceImplementation(InterfaceImplementation interfaceImplementation, object data)
- {
- throw new InvalidOperationException();
- }
-
- public override object TrackedVisitConstructorDeclaration(ConstructorDeclaration constructorDeclaration, object data)
- {
- VisitAttributes(constructorDeclaration.Attributes, data);
- outputFormatter.Indent();
- OutputModifier(constructorDeclaration.Modifier);
- if (currentType != null) {
- outputFormatter.PrintIdentifier(currentType.Name);
- } else {
- outputFormatter.PrintIdentifier(constructorDeclaration.Name);
- }
- if (prettyPrintOptions.BeforeConstructorDeclarationParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- bool withinParentheses = this.prettyPrintOptions.WithinMethodDeclarationParentheses && constructorDeclaration.Parameters.Any ();
- if (withinParentheses) {
- outputFormatter.Space();
- }
- AppendCommaSeparatedList(constructorDeclaration.Parameters);
- if (withinParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- TrackVisit(constructorDeclaration.ConstructorInitializer, data);
- OutputBlock(constructorDeclaration.Body, this.prettyPrintOptions.ConstructorBraceStyle);
- return null;
- }
-
- public override object TrackedVisitConstructorInitializer(ConstructorInitializer constructorInitializer, object data)
- {
- if (constructorInitializer.IsNull) {
- return null;
- }
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Colon);
- outputFormatter.Space();
- if (constructorInitializer.ConstructorInitializerType == ConstructorInitializerType.Base) {
- outputFormatter.PrintToken(Tokens.Base);
- } else {
- outputFormatter.PrintToken(Tokens.This);
- }
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- if (this.prettyPrintOptions.WithinMethodCallParentheses) {
- outputFormatter.Space();
- }
- AppendCommaSeparatedList(constructorInitializer.Arguments);
- if (this.prettyPrintOptions.WithinMethodCallParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- return null;
- }
-
- public override object TrackedVisitIndexerDeclaration(IndexerDeclaration indexerDeclaration, object data)
- {
- VisitAttributes(indexerDeclaration.Attributes, data);
- outputFormatter.Indent();
- OutputModifier(indexerDeclaration.Modifier);
- TrackVisit(indexerDeclaration.TypeReference, data);
- outputFormatter.Space();
- if (indexerDeclaration.InterfaceImplementations.Count > 0) {
- TrackVisit(indexerDeclaration.InterfaceImplementations[0].InterfaceType, data);
- outputFormatter.PrintToken(Tokens.Dot);
- }
- outputFormatter.PrintToken(Tokens.This);
- outputFormatter.PrintToken(Tokens.OpenSquareBracket);
- if (this.prettyPrintOptions.SpacesWithinBrackets) {
- outputFormatter.Space();
- }
- AppendCommaSeparatedList(indexerDeclaration.Parameters);
- if (this.prettyPrintOptions.SpacesWithinBrackets) {
- outputFormatter.Space();
- }
-
- outputFormatter.PrintToken(Tokens.CloseSquareBracket);
-
- outputFormatter.BeginBrace(this.prettyPrintOptions.PropertyBraceStyle, this.prettyPrintOptions.IndentPropertyBody);
-
- TrackVisit(indexerDeclaration.GetRegion, data);
- TrackVisit(indexerDeclaration.SetRegion, data);
-
- outputFormatter.EndBrace(this.prettyPrintOptions.IndentPropertyBody);
- return null;
- }
-
- public override object TrackedVisitDestructorDeclaration(DestructorDeclaration destructorDeclaration, object data)
- {
- VisitAttributes(destructorDeclaration.Attributes, data);
- outputFormatter.Indent();
- OutputModifier(destructorDeclaration.Modifier);
- outputFormatter.PrintToken(Tokens.BitwiseComplement);
- if (currentType != null)
- outputFormatter.PrintIdentifier(currentType.Name);
- else
- outputFormatter.PrintIdentifier(destructorDeclaration.Name);
- if (prettyPrintOptions.BeforeConstructorDeclarationParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
-
- OutputBlock(destructorDeclaration.Body, this.prettyPrintOptions.DestructorBraceStyle);
- return null;
- }
-
- public override object TrackedVisitDeclareDeclaration(DeclareDeclaration declareDeclaration, object data)
- {
- NotSupported(declareDeclaration);
- return null;
- }
- #endregion
-
- #region Statements
-
- void OutputBlock(BlockStatement blockStatement, BraceStyle braceStyle)
- {
- OutputBlock(blockStatement, braceStyle, true);
- }
- void OutputBlock(BlockStatement blockStatement, BraceStyle braceStyle, bool emitEndingNewLine)
- {
- BeginVisit(blockStatement);
- if (blockStatement.IsNull) {
- outputFormatter.PrintToken(Tokens.Semicolon);
- outputFormatter.NewLine();
- } else {
- outputFormatter.BeginBrace(braceStyle, this.prettyPrintOptions.IndentBlocks);
- foreach (Statement stmt in blockStatement.Children) {
- outputFormatter.Indent();
- if (stmt is BlockStatement) {
- TrackVisit(stmt, BraceStyle.EndOfLine);
- } else {
- TrackVisit(stmt, null);
- }
- if (!outputFormatter.LastCharacterIsNewLine)
- outputFormatter.NewLine();
- }
- outputFormatter.EndBrace (this.prettyPrintOptions.IndentBlocks, emitEndingNewLine);
- }
- EndVisit(blockStatement);
- }
-
- void OutputBlockAllowInline(BlockStatement blockStatement, BraceStyle braceStyle)
- {
- OutputBlockAllowInline(blockStatement, braceStyle, true);
- }
-
- void OutputBlockAllowInline(BlockStatement blockStatement, BraceStyle braceStyle, bool useNewLine)
- {
- if (!blockStatement.IsNull
- && (
- blockStatement.Children.Count == 0
- || blockStatement.Children.Count == 1
- && (blockStatement.Children[0] is ExpressionStatement
- || blockStatement.Children[0] is ReturnStatement
- )))
- {
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.OpenCurlyBrace);
- outputFormatter.Space();
- if (blockStatement.Children.Count != 0) {
- bool doIndent = outputFormatter.DoIndent;
- bool doNewLine = outputFormatter.DoNewLine;
- outputFormatter.DoIndent = false;
- outputFormatter.DoNewLine = false;
-
- TrackVisit(blockStatement.Children[0], null);
-
- outputFormatter.DoIndent = doIndent;
- outputFormatter.DoNewLine = doNewLine;
-
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.CloseCurlyBrace);
- if (useNewLine) {
- outputFormatter.NewLine();
- }
- } else {
- OutputBlock(blockStatement, braceStyle, useNewLine);
- }
- }
-
- public override object TrackedVisitBlockStatement(BlockStatement blockStatement, object data)
- {
- if (outputFormatter.TextLength == 0) {
- // we are outputting only a code block:
- // do not output braces, just the block's contents
- foreach (Statement stmt in blockStatement.Children) {
- outputFormatter.Indent();
- TrackVisit(stmt, null);
- if (!outputFormatter.LastCharacterIsNewLine)
- outputFormatter.NewLine();
- }
- return null;
- }
-
- if (data is BraceStyle)
- OutputBlock(blockStatement, (BraceStyle)data);
- else
- OutputBlock(blockStatement, BraceStyle.NextLine);
- return null;
- }
-
- public override object TrackedVisitAddHandlerStatement(AddHandlerStatement addHandlerStatement, object data)
- {
- TrackVisit(addHandlerStatement.EventExpression, data);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.PlusAssign);
- outputFormatter.Space();
- TrackVisit(addHandlerStatement.HandlerExpression, data);
- outputFormatter.PrintToken(Tokens.Semicolon);
- return null;
- }
-
- public override object TrackedVisitRemoveHandlerStatement(RemoveHandlerStatement removeHandlerStatement, object data)
- {
- TrackVisit(removeHandlerStatement.EventExpression, data);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.MinusAssign);
- outputFormatter.Space();
- TrackVisit(removeHandlerStatement.HandlerExpression, data);
- outputFormatter.PrintToken(Tokens.Semicolon);
- return null;
- }
-
- public override object TrackedVisitRaiseEventStatement(RaiseEventStatement raiseEventStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.If);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- outputFormatter.PrintIdentifier(raiseEventStatement.EventName);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.NotEqual);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Null);
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
-
- outputFormatter.BeginBrace(BraceStyle.EndOfLine, this.prettyPrintOptions.IndentBlocks);
-
- outputFormatter.Indent();
- outputFormatter.PrintIdentifier(raiseEventStatement.EventName);
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- this.AppendCommaSeparatedList(raiseEventStatement.Arguments);
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- outputFormatter.PrintToken(Tokens.Semicolon);
-
- outputFormatter.NewLine();
- outputFormatter.EndBrace(this.prettyPrintOptions.IndentBlocks);
-
- return null;
- }
-
- public override object TrackedVisitEraseStatement(EraseStatement eraseStatement, object data)
- {
- for (int i = 0; i < eraseStatement.Expressions.Count; i++) {
- if (i > 0) {
- outputFormatter.NewLine();
- outputFormatter.Indent();
- }
- TrackVisit(eraseStatement.Expressions[i], data);
- if (this.prettyPrintOptions.AroundAssignmentParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.Assign);
- if (this.prettyPrintOptions.AroundAssignmentParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.Null);
- outputFormatter.PrintToken(Tokens.Semicolon);
- }
- return null;
- }
-
- public override object TrackedVisitErrorStatement(ErrorStatement errorStatement, object data)
- {
- NotSupported(errorStatement);
- return null;
- }
-
- public override object TrackedVisitOnErrorStatement(OnErrorStatement onErrorStatement, object data)
- {
- NotSupported(onErrorStatement);
- return null;
- }
-
- public override object TrackedVisitReDimStatement(ReDimStatement reDimStatement, object data)
- {
- if (!reDimStatement.IsPreserve) {
- NotSupported(reDimStatement);
- return null;
- }
- foreach (InvocationExpression ie in reDimStatement.ReDimClauses) {
- outputFormatter.PrintText("Array.Resize(ref ");
- ie.TargetObject.AcceptVisitor(this, data);
- outputFormatter.PrintText(", ");
- for (int i = 0; i < ie.Arguments.Count; i++) {
- if (i > 0) outputFormatter.PrintText(", ");
- Expression.AddInteger(ie.Arguments[i], 1).AcceptVisitor(this, data);
- }
- outputFormatter.PrintText(")");
- outputFormatter.PrintToken(Tokens.Semicolon);
- }
- return null;
- }
-
- public override object TrackedVisitExpressionStatement(ExpressionStatement expressionStatement, object data)
- {
- TrackVisit(expressionStatement.Expression, data);
- outputFormatter.PrintToken(Tokens.Semicolon);
- return null;
- }
-
- public override object TrackedVisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data)
- {
- TypeReference type = localVariableDeclaration.GetTypeForVariable(0);
- for (int i = 1; i < localVariableDeclaration.Variables.Count; ++i) {
- if (localVariableDeclaration.GetTypeForVariable(i) != type)
- return TrackedVisitLocalVariableDeclarationSeparateTypes(localVariableDeclaration, data);
- }
- // all variables have the same type
- OutputModifier(localVariableDeclaration.Modifier);
- TrackVisit(type ?? new TypeReference("System.Object", true), data);
- outputFormatter.Space();
- AppendCommaSeparatedList(localVariableDeclaration.Variables);
- outputFormatter.PrintToken(Tokens.Semicolon);
- return null;
- }
-
- object TrackedVisitLocalVariableDeclarationSeparateTypes(LocalVariableDeclaration localVariableDeclaration, object data)
- {
- for (int i = 0; i < localVariableDeclaration.Variables.Count; ++i) {
- VariableDeclaration v = (VariableDeclaration)localVariableDeclaration.Variables[i];
- if (i > 0) {
- outputFormatter.NewLine();
- outputFormatter.Indent();
- }
- OutputModifier(localVariableDeclaration.Modifier);
- TrackVisit(localVariableDeclaration.GetTypeForVariable(i) ?? new TypeReference("System.Object", true), data);
- outputFormatter.Space();
- TrackVisit(v, data);
- outputFormatter.PrintToken(Tokens.Semicolon);
- }
- return null;
- }
-
- public override object TrackedVisitEmptyStatement(EmptyStatement emptyStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.Semicolon);
- return null;
- }
-
- public override object TrackedVisitYieldStatement(YieldStatement yieldStatement, object data)
- {
- Debug.Assert(yieldStatement != null);
- Debug.Assert(yieldStatement.Statement != null);
- outputFormatter.PrintText("yield");
- outputFormatter.Space();
- TrackVisit(yieldStatement.Statement, data);
- return null;
- }
-
- public override object TrackedVisitReturnStatement(ReturnStatement returnStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.Return);
- if (!returnStatement.Expression.IsNull) {
- outputFormatter.Space();
- TrackVisit(returnStatement.Expression, data);
- }
- outputFormatter.PrintToken(Tokens.Semicolon);
- return null;
- }
-
- public override object TrackedVisitIfElseStatement(IfElseStatement ifElseStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.If);
- if (this.prettyPrintOptions.IfParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- if (this.prettyPrintOptions.WithinIfParentheses) {
- outputFormatter.Space();
- }
- TrackVisit(ifElseStatement.Condition, data);
- if (this.prettyPrintOptions.WithinIfParentheses) {
- outputFormatter.Space();
- }
- 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 || (prettyPrintOptions.PlaceNonBlockElseOnNewLine && !wasBlock)) {
- outputFormatter.NewLine();
- outputFormatter.Indent();
- } else {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.Else);
- PrintIfSection(ifElseStatement.FalseStatement);
- }
-
- return null;
- }
-
- void PrintIfSection(List<Statement> statements)
- {
- if (statements.Count == 1 && (statements[0] is BlockStatement)) {
- OutputBlock((BlockStatement)statements[0],
- prettyPrintOptions.StatementBraceStyle,
- prettyPrintOptions.PlaceElseOnNewLine && prettyPrintOptions.PlaceElseIfOnNewLine);
- 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);
- }
-
- if (statements.Count == 1) {
- outputFormatter.IndentationLevel--;
- } else {
- outputFormatter.PrintToken(Tokens.CloseCurlyBrace);
- }
- /* if (statements.Count != 1 || !(statements[0] is BlockStatement)) {
- outputFormatter.Space();
- }*/
- }
-
- public override object TrackedVisitElseIfSection(ElseIfSection elseIfSection, object data)
- {
- if (prettyPrintOptions.PlaceElseIfOnNewLine) {
- outputFormatter.NewLine();
- outputFormatter.Indent();
- } else {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.Else);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.If);
- if (prettyPrintOptions.IfParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- if (this.prettyPrintOptions.WithinIfParentheses) {
- outputFormatter.Space();
- }
- TrackVisit(elseIfSection.Condition, data);
- if (this.prettyPrintOptions.WithinIfParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
-
- WriteEmbeddedStatement(elseIfSection.EmbeddedStatement, prettyPrintOptions.IfElseBraceForcement, prettyPrintOptions.StatementBraceStyle, false);
-
- return null;
- }
-
- public override object TrackedVisitForStatement(ForStatement forStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.For);
- if (this.prettyPrintOptions.ForParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- if (this.prettyPrintOptions.WithinForParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.DoIndent = false;
- outputFormatter.DoNewLine = false;
- outputFormatter.EmitSemicolon = false;
- for (int i = 0; i < forStatement.Initializers.Count; ++i) {
- INode node = (INode)forStatement.Initializers[i];
- TrackVisit(node, data);
- if (i + 1 < forStatement.Initializers.Count) {
- outputFormatter.PrintToken(Tokens.Comma);
- }
- }
- outputFormatter.EmitSemicolon = true;
- outputFormatter.PrintToken(Tokens.Semicolon);
- outputFormatter.EmitSemicolon = false;
- if (!forStatement.Condition.IsNull) {
- if (this.prettyPrintOptions.SpacesAfterSemicolon) {
- outputFormatter.Space();
- }
- TrackVisit(forStatement.Condition, data);
- }
- outputFormatter.EmitSemicolon = true;
- outputFormatter.PrintToken(Tokens.Semicolon);
- outputFormatter.EmitSemicolon = false;
- if (forStatement.Iterator != null && forStatement.Iterator.Count > 0) {
- if (this.prettyPrintOptions.SpacesAfterSemicolon) {
- outputFormatter.Space();
- }
-
- for (int i = 0; i < forStatement.Iterator.Count; ++i) {
- INode node = (INode)forStatement.Iterator[i];
- TrackVisit(node, data);
- if (i + 1 < forStatement.Iterator.Count) {
- outputFormatter.PrintToken(Tokens.Comma);
- }
- }
- }
- if (this.prettyPrintOptions.WithinForParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- outputFormatter.EmitSemicolon = true;
- outputFormatter.DoNewLine = true;
- outputFormatter.DoIndent = true;
-
- WriteEmbeddedStatement(forStatement.EmbeddedStatement, prettyPrintOptions.ForBraceForcement, prettyPrintOptions.StatementBraceStyle, true);
-
- return null;
- }
-
- void WriteEmbeddedStatement (Statement statement)
- {
- WriteEmbeddedStatement (statement, true);
- }
-
- void WriteEmbeddedStatement (Statement statement, bool emitEndingNewLine)
- {
- if (statement is BlockStatement) {
- OutputBlock((BlockStatement)statement, prettyPrintOptions.StatementBraceStyle, emitEndingNewLine);
- } else {
- ++outputFormatter.IndentationLevel;
- outputFormatter.NewLine();
- outputFormatter.Indent ();
- TrackVisit(statement, null);
- --outputFormatter.IndentationLevel;
- }
- }
-
- void WriteEmbeddedStatement (Statement statement, BraceForcement forcement, BraceStyle braceStyle, bool emitEndingNewLine)
- {
- if (statement is BlockStatement) {
- BlockStatement block = (BlockStatement)statement;
- switch (forcement) {
- case BraceForcement.RemoveBraces:
- if (block.Children.Count == 1) {
- ++outputFormatter.IndentationLevel;
- outputFormatter.NewLine();
- outputFormatter.Indent ();
- TrackVisit(block.Children[0], null);
- --outputFormatter.IndentationLevel;
- } else {
- goto default;
- }
- break;
- case BraceForcement.RemoveBracesForSingleLine:
- goto case BraceForcement.RemoveBraces;
- default:
- OutputBlock((BlockStatement)statement, prettyPrintOptions.StatementBraceStyle, emitEndingNewLine);
- break;
- }
- } else {
- switch (forcement) {
- case BraceForcement.AddBraces:
- BlockStatement blockStatement = new BlockStatement ();
- blockStatement.AddChild (statement);
- OutputBlock(blockStatement, braceStyle, true);
- break;
- default:
- WriteEmbeddedStatement (statement, emitEndingNewLine);
- break;
- }
- }
- }
-
- 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);
- outputFormatter.PrintToken(Tokens.Semicolon);
- return null;
- }
-
- public override object TrackedVisitSwitchStatement(SwitchStatement switchStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.Switch);
- if (this.prettyPrintOptions.SwitchParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- if (this.prettyPrintOptions.WithinSwitchParentheses) {
- outputFormatter.Space();
- }
- TrackVisit(switchStatement.SwitchExpression, data);
- if (this.prettyPrintOptions.WithinSwitchParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
-
- outputFormatter.BeginBrace(prettyPrintOptions.StatementBraceStyle, prettyPrintOptions.IndentSwitchBody);
- foreach (SwitchSection section in switchStatement.SwitchSections) {
- TrackVisit(section, data);
- }
- outputFormatter.EndBrace (prettyPrintOptions.IndentSwitchBody);
- return null;
- }
-
- public override object TrackedVisitSwitchSection(SwitchSection switchSection, object data)
- {
- foreach (CaseLabel label in switchSection.SwitchLabels) {
- TrackVisit(label, data);
- }
- int standardIndentLevel = outputFormatter.IndentationLevel;
- if (prettyPrintOptions.IndentCaseBody)
- ++outputFormatter.IndentationLevel;
- for (int i = 0; i < switchSection.Children.Count; i++) {
- Statement stmt = switchSection.Children[i] as Statement;
- int oldIndent = outputFormatter.IndentationLevel;
- if (i == switchSection.Children.Count - 1) {
- if (prettyPrintOptions.IndentBreakStatements)
- outputFormatter.IndentationLevel = standardIndentLevel + 1;
- else
- outputFormatter.IndentationLevel = standardIndentLevel;
- }
- outputFormatter.Indent();
- TrackVisit(stmt, data);
- outputFormatter.NewLine();
- outputFormatter.IndentationLevel = oldIndent;
- }
-
- if (prettyPrintOptions.IndentCaseBody)
- --outputFormatter.IndentationLevel;
- return null;
- }
-
- public override object TrackedVisitCaseLabel(CaseLabel caseLabel, object data)
- {
- outputFormatter.Indent();
- if (caseLabel.IsDefault) {
- outputFormatter.PrintToken(Tokens.Default);
- } else {
- outputFormatter.PrintToken(Tokens.Case);
- outputFormatter.Space();
- if (caseLabel.BinaryOperatorType != BinaryOperatorType.None) {
- Error(caseLabel, String.Format("Case labels with binary operators are unsupported : {0}", caseLabel.BinaryOperatorType));
- }
- TrackVisit(caseLabel.Label, data);
- }
- outputFormatter.PrintToken(Tokens.Colon);
- if (!caseLabel.ToExpression.IsNull) {
- PrimitiveExpression pl = caseLabel.Label as PrimitiveExpression;
- PrimitiveExpression pt = caseLabel.ToExpression as PrimitiveExpression;
- if (pl != null && pt != null && pl.Value is int && pt.Value is int) {
- int plv = (int)pl.Value;
- int prv = (int)pt.Value;
- if (plv < prv && plv + 12 > prv) {
- for (int i = plv + 1; i <= prv; i++) {
- outputFormatter.NewLine();
- outputFormatter.Indent();
- outputFormatter.PrintToken(Tokens.Case);
- outputFormatter.Space();
- outputFormatter.PrintText(i.ToString(NumberFormatInfo.InvariantInfo));
- outputFormatter.PrintToken(Tokens.Colon);
- }
- } else {
- outputFormatter.PrintText(" // TODO: to ");
- TrackVisit(caseLabel.ToExpression, data);
- }
- } else {
- outputFormatter.PrintText(" // TODO: to ");
- TrackVisit(caseLabel.ToExpression, data);
- }
- }
- outputFormatter.NewLine();
- return null;
- }
-
- public override object TrackedVisitBreakStatement(BreakStatement breakStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.Break);
- outputFormatter.PrintToken(Tokens.Semicolon);
- return null;
- }
-
- public override object TrackedVisitStopStatement(StopStatement stopStatement, object data)
- {
- outputFormatter.PrintText("System.Diagnostics.Debugger.Break()");
- outputFormatter.PrintToken(Tokens.Semicolon);
- return null;
- }
-
- public override object TrackedVisitResumeStatement(ResumeStatement resumeStatement, object data)
- {
- NotSupported(resumeStatement);
- return null;
- }
-
- public override object TrackedVisitEndStatement(EndStatement endStatement, object data)
- {
- outputFormatter.PrintText("System.Environment.Exit(0)");
- outputFormatter.PrintToken(Tokens.Semicolon);
- return null;
- }
-
- public override object TrackedVisitContinueStatement(ContinueStatement continueStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.Continue);
- outputFormatter.PrintToken(Tokens.Semicolon);
- return null;
- }
-
- public override object TrackedVisitGotoCaseStatement(GotoCaseStatement gotoCaseStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.Goto);
- outputFormatter.Space();
- if (gotoCaseStatement.IsDefaultCase) {
- outputFormatter.PrintToken(Tokens.Default);
- } else {
- outputFormatter.PrintToken(Tokens.Case);
- outputFormatter.Space();
- TrackVisit(gotoCaseStatement.Expression, data);
- }
- outputFormatter.PrintToken(Tokens.Semicolon);
- return null;
- }
-
- void PrintLoopCheck(DoLoopStatement doLoopStatement)
- {
- outputFormatter.PrintToken(Tokens.While);
- if (this.prettyPrintOptions.WhileParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- if (this.prettyPrintOptions.WithinWhileParentheses) {
- outputFormatter.Space();
- }
-
- if (doLoopStatement.ConditionType == ConditionType.Until) {
- outputFormatter.PrintToken(Tokens.Not);
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- }
-
- if (doLoopStatement.Condition.IsNull) {
- outputFormatter.PrintToken(Tokens.True);
- } else {
- TrackVisit(doLoopStatement.Condition, null);
- }
-
- if (doLoopStatement.ConditionType == ConditionType.Until) {
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- }
- if (this.prettyPrintOptions.WithinWhileParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- }
-
- public override object TrackedVisitDoLoopStatement(DoLoopStatement doLoopStatement, object data)
- {
- if (doLoopStatement.ConditionPosition == ConditionPosition.None) {
- Error(doLoopStatement, String.Format("Unknown condition position for loop : {0}.", doLoopStatement));
- }
-
- if (doLoopStatement.ConditionPosition == ConditionPosition.Start) {
- PrintLoopCheck(doLoopStatement);
- } else {
- outputFormatter.PrintToken(Tokens.Do);
- }
-
- WriteEmbeddedStatement(doLoopStatement.EmbeddedStatement, prettyPrintOptions.WhileBraceForcement, prettyPrintOptions.StatementBraceStyle, prettyPrintOptions.PlaceWhileOnNewLine);
-
- if (doLoopStatement.ConditionPosition == ConditionPosition.End) {
- if (prettyPrintOptions.PlaceWhileOnNewLine) {
- outputFormatter.Indent();
- } else {
- outputFormatter.Space();
- }
- PrintLoopCheck(doLoopStatement);
- outputFormatter.PrintToken(Tokens.Semicolon);
- outputFormatter.NewLine();
- }
-
- return null;
- }
-
- public override object TrackedVisitForeachStatement(ForeachStatement foreachStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.Foreach);
- if (this.prettyPrintOptions.ForeachParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- if (this.prettyPrintOptions.WithinForEachParentheses) {
- outputFormatter.Space();
- }
- TrackVisit(foreachStatement.TypeReference, data);
- outputFormatter.Space();
- outputFormatter.PrintIdentifier(foreachStatement.VariableName);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.In);
- outputFormatter.Space();
- TrackVisit(foreachStatement.Expression, data);
- if (this.prettyPrintOptions.WithinForEachParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
-
- WriteEmbeddedStatement(foreachStatement.EmbeddedStatement, prettyPrintOptions.ForEachBraceForcement, prettyPrintOptions.StatementBraceStyle, true);
-
- return null;
- }
-
- public override object TrackedVisitLockStatement(LockStatement lockStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.Lock);
- if (this.prettyPrintOptions.LockParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- if (this.prettyPrintOptions.WithinLockParentheses) {
- outputFormatter.Space();
- }
- TrackVisit(lockStatement.LockExpression, data);
- if (this.prettyPrintOptions.WithinLockParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
-
- WriteEmbeddedStatement(lockStatement.EmbeddedStatement);
-
- return null;
- }
-
- public override object TrackedVisitUsingStatement(UsingStatement usingStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.Using);
- if (this.prettyPrintOptions.UsingParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- if (prettyPrintOptions.WithinUsingParentheses) {
- outputFormatter.Space();
- }
- PrintStatementInline(usingStatement.ResourceAcquisition, data);
- if (prettyPrintOptions.WithinUsingParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
-
- WriteEmbeddedStatement(usingStatement.EmbeddedStatement, prettyPrintOptions.UsingBraceForcement, prettyPrintOptions.StatementBraceStyle, true);
-
- return null;
- }
-
- void PrintStatementInline(Statement statement, object data)
- {
- outputFormatter.DoIndent = false;
- outputFormatter.DoNewLine = false;
- outputFormatter.EmitSemicolon = false;
- TrackVisit(statement, data);
- outputFormatter.DoIndent = true;
- outputFormatter.DoNewLine = true;
- outputFormatter.EmitSemicolon = true;
- }
-
- public override object TrackedVisitWithStatement(WithStatement withStatement, object data)
- {
- NotSupported(withStatement);
- return null;
- }
-
- public override object TrackedVisitTryCatchStatement(TryCatchStatement tryCatchStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.Try);
-
- WriteEmbeddedStatement (tryCatchStatement.StatementBlock, prettyPrintOptions.PlaceCatchOnNewLine);
- for (int i = 0 ; i < tryCatchStatement.CatchClauses.Count; i++) {
- TrackVisit(tryCatchStatement.CatchClauses[i], i == tryCatchStatement.CatchClauses.Count - 1);
- }
-
- if (!tryCatchStatement.FinallyBlock.IsNull) {
- if (prettyPrintOptions.PlaceFinallyOnNewLine) {
- // if (!prettyPrintOptions.PlaceCatchOnNewLine)
- // outputFormatter.NewLine ();
- outputFormatter.Indent();
- } else {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.Finally);
- WriteEmbeddedStatement(tryCatchStatement.FinallyBlock);
- }
-
- return null;
- }
-
- public override object TrackedVisitCatchClause(CatchClause catchClause, object data)
- {
- if (prettyPrintOptions.PlaceCatchOnNewLine) {
- outputFormatter.Indent();
- } else {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.Catch);
-
- if (!catchClause.TypeReference.IsNull) {
- if (this.prettyPrintOptions.CatchParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- if (this.prettyPrintOptions.WithinCatchParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintIdentifier(catchClause.TypeReference.Type);
- if (catchClause.VariableName.Length > 0) {
- outputFormatter.Space();
- outputFormatter.PrintIdentifier(catchClause.VariableName);
- }
- if (this.prettyPrintOptions.WithinCatchParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- }
- WriteEmbeddedStatement(catchClause.StatementBlock, ((bool)data) ? prettyPrintOptions.PlaceFinallyOnNewLine : prettyPrintOptions.PlaceCatchOnNewLine);
- return null;
- }
-
- public override object TrackedVisitThrowStatement(ThrowStatement throwStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.Throw);
- if (!throwStatement.Expression.IsNull) {
- outputFormatter.Space();
- TrackVisit(throwStatement.Expression, data);
- }
- outputFormatter.PrintToken(Tokens.Semicolon);
- return null;
- }
-
- public override object TrackedVisitFixedStatement(FixedStatement fixedStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.Fixed);
- if (this.prettyPrintOptions.FixedParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- if (this.prettyPrintOptions.WithinCheckedExpressionParantheses) {
- outputFormatter.Space();
- }
- PrintStatementInline(fixedStatement.PointerDeclaration, data);
- if (this.prettyPrintOptions.WithinCheckedExpressionParantheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
-
- WriteEmbeddedStatement(fixedStatement.EmbeddedStatement, prettyPrintOptions.FixedBraceForcement, prettyPrintOptions.StatementBraceStyle, true);
- return null;
- }
-
- public override object TrackedVisitUnsafeStatement(UnsafeStatement unsafeStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.Unsafe);
- WriteEmbeddedStatement(unsafeStatement.Block);
- return null;
- }
-
- public override object TrackedVisitCheckedStatement(CheckedStatement checkedStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.Checked);
- WriteEmbeddedStatement(checkedStatement.Block);
- return null;
- }
-
- public override object TrackedVisitUncheckedStatement(UncheckedStatement uncheckedStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.Unchecked);
- WriteEmbeddedStatement(uncheckedStatement.Block);
- return null;
- }
-
- public override object TrackedVisitExitStatement(ExitStatement exitStatement, object data)
- {
- if (exitStatement.ExitType == ExitType.Function || exitStatement.ExitType == ExitType.Sub || exitStatement.ExitType == ExitType.Property) {
- outputFormatter.PrintToken(Tokens.Return);
- outputFormatter.PrintToken(Tokens.Semicolon);
- } else {
- outputFormatter.PrintToken(Tokens.Break);
- outputFormatter.PrintToken(Tokens.Semicolon);
- outputFormatter.PrintText(" // TODO: might not be correct. Was : Exit " + exitStatement.ExitType);
- }
- outputFormatter.NewLine();
- return null;
- }
-
- public override object TrackedVisitForNextStatement(ForNextStatement forNextStatement, object data)
- {
- outputFormatter.PrintToken(Tokens.For);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- if (this.prettyPrintOptions.WithinForParentheses) {
- outputFormatter.Space();
- }
- if (forNextStatement.LoopVariableExpression.IsNull) {
- if (!forNextStatement.TypeReference.IsNull) {
- TrackVisit(forNextStatement.TypeReference, data);
- outputFormatter.Space();
- }
- outputFormatter.PrintIdentifier(forNextStatement.VariableName);
- } else {
- TrackVisit(forNextStatement.LoopVariableExpression, data);
- }
- if (this.prettyPrintOptions.AroundAssignmentParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.Assign);
- if (this.prettyPrintOptions.AroundAssignmentParentheses) {
- outputFormatter.Space();
- }
- TrackVisit(forNextStatement.Start, data);
- outputFormatter.PrintToken(Tokens.Semicolon);
- outputFormatter.Space();
- if (forNextStatement.LoopVariableExpression.IsNull)
- outputFormatter.PrintIdentifier(forNextStatement.VariableName);
- else
- TrackVisit(forNextStatement.LoopVariableExpression, data);
- outputFormatter.Space();
- PrimitiveExpression pe = forNextStatement.Step as PrimitiveExpression;
- if ((pe == null || !(pe.Value is int) || ((int)pe.Value) >= 0)
- && !(forNextStatement.Step is UnaryOperatorExpression))
- outputFormatter.PrintToken(Tokens.LessEqual);
- else
- outputFormatter.PrintToken(Tokens.GreaterEqual);
- outputFormatter.Space();
- TrackVisit(forNextStatement.End, data);
- outputFormatter.PrintToken(Tokens.Semicolon);
- outputFormatter.Space();
- if (forNextStatement.LoopVariableExpression.IsNull)
- outputFormatter.PrintIdentifier(forNextStatement.VariableName);
- else
- TrackVisit(forNextStatement.LoopVariableExpression, data);
- if (forNextStatement.Step.IsNull) {
- outputFormatter.PrintToken(Tokens.Increment);
- } else {
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.PlusAssign);
- outputFormatter.Space();
- TrackVisit(forNextStatement.Step, data);
- }
- if (this.prettyPrintOptions.WithinForParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
-
- WriteEmbeddedStatement(forNextStatement.EmbeddedStatement, prettyPrintOptions.ForBraceForcement, prettyPrintOptions.StatementBraceStyle, true);
- return null;
- }
- #endregion
-
- #region Expressions
- public override object TrackedVisitClassReferenceExpression(ClassReferenceExpression classReferenceExpression, object data)
- {
- NotSupported(classReferenceExpression);
- return null;
- }
-
- static string ConvertCharLiteral(char ch)
- {
- if (ch == '\'') return "\\'";
- return ConvertChar(ch);
- }
-
- static string ConvertChar(char ch)
- {
- switch (ch) {
- case '\\':
- return "\\\\";
- case '\0':
- return "\\0";
- case '\a':
- return "\\a";
- case '\b':
- return "\\b";
- case '\f':
- return "\\f";
- case '\n':
- return "\\n";
- case '\r':
- return "\\r";
- case '\t':
- return "\\t";
- case '\v':
- return "\\v";
- default:
- if (char.IsControl(ch)) {
- return "\\u" + ((int)ch).ToString("x4");
- } else {
- return ch.ToString();
- }
- }
- }
-
- static string ConvertString(string str)
- {
- StringBuilder sb = new StringBuilder();
- foreach (char ch in str) {
- if (ch == '"')
- sb.Append("\\\"");
- else
- sb.Append(ConvertChar(ch));
- }
- return sb.ToString();
- }
-
- public override object TrackedVisitPrimitiveExpression(PrimitiveExpression primitiveExpression, object data)
- {
- outputFormatter.PrintText(ToCSharpString(primitiveExpression));
- return null;
- }
-
- internal static string ToCSharpString(PrimitiveExpression primitiveExpression)
- {
- if (primitiveExpression.Value == null)
- return "null";
- if (primitiveExpression.HasStringValue)
- return primitiveExpression.StringValue;
- object val = primitiveExpression.Value;
-
- if (val is bool) {
- if ((bool)val) {
- return "true";
- } else {
- return "false";
- }
- }
-
- if (val is string) {
- if (primitiveExpression.LiteralFormat == LiteralFormat.VerbatimStringLiteral)
- return "@\"" + val.ToString() + "\"";
- return "\"" + ConvertString(val.ToString()) + "\"";
- }
-
- if (val is char) {
- return "'" + ConvertCharLiteral((char)val) + "'";
- }
-
- if (val is decimal) {
- return ((decimal)val).ToString(NumberFormatInfo.InvariantInfo) + "m";
- }
-
- if (val is float) {
- return ((float)val).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("0x");
- b.Append(((IFormattable)val).ToString("x", NumberFormatInfo.InvariantInfo));
- } else {
- b.Append(((IFormattable)val).ToString(null, NumberFormatInfo.InvariantInfo));
- }
- if (val is uint || val is ulong) {
- b.Append("u");
- }
- if (val is long || val is ulong) {
- b.Append("L");
- }
- return b.ToString();
- } else {
- return val.ToString();
- }
- }
-
- static bool IsNullLiteralExpression(Expression expr)
- {
- PrimitiveExpression pe = expr as PrimitiveExpression;
- if (pe == null) return false;
- return pe.Value == null;
- }
-
- public override object TrackedVisitBinaryOperatorExpression(BinaryOperatorExpression binaryOperatorExpression, object data)
- {
- // VB-operators that require special representation:
- switch (binaryOperatorExpression.Op) {
- case BinaryOperatorType.ReferenceEquality:
- case BinaryOperatorType.ReferenceInequality:
- if (IsNullLiteralExpression(binaryOperatorExpression.Left) || IsNullLiteralExpression(binaryOperatorExpression.Right)) {
- // prefer a == null to object.ReferenceEquals(a, null)
- break;
- }
-
- if (binaryOperatorExpression.Op == BinaryOperatorType.ReferenceInequality)
- outputFormatter.PrintToken(Tokens.Not);
- outputFormatter.PrintText("object.ReferenceEquals");
- if (prettyPrintOptions.BeforeMethodCallParentheses) {
- outputFormatter.Space();
- }
-
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- TrackVisit(binaryOperatorExpression.Left, data);
- PrintFormattedComma();
- TrackVisit(binaryOperatorExpression.Right, data);
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- return null;
- case BinaryOperatorType.Power:
- outputFormatter.PrintText("Math.Pow");
- if (prettyPrintOptions.BeforeMethodCallParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- if (this.prettyPrintOptions.WithinMethodCallParentheses) {
- outputFormatter.Space();
- }
- TrackVisit(binaryOperatorExpression.Left, data);
- PrintFormattedComma();
- TrackVisit(binaryOperatorExpression.Right, data);
- if (this.prettyPrintOptions.WithinMethodCallParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- return null;
- case BinaryOperatorType.DictionaryAccess:
- TrackVisit(binaryOperatorExpression.Left, data);
- outputFormatter.PrintToken(Tokens.OpenSquareBracket);
- TrackVisit(binaryOperatorExpression.Right, data);
- outputFormatter.PrintToken(Tokens.CloseSquareBracket);
- return null;
- }
- TrackVisit(binaryOperatorExpression.Left, data);
- switch (binaryOperatorExpression.Op) {
- case BinaryOperatorType.Add:
- case BinaryOperatorType.Concat: // translate Concatenation to +
- if (prettyPrintOptions.AroundAdditiveOperatorParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.Plus);
- if (prettyPrintOptions.AroundAdditiveOperatorParentheses) {
- outputFormatter.Space();
- }
- break;
-
- case BinaryOperatorType.Subtract:
- if (prettyPrintOptions.AroundAdditiveOperatorParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.Minus);
- if (prettyPrintOptions.AroundAdditiveOperatorParentheses) {
- outputFormatter.Space();
- }
- break;
-
- case BinaryOperatorType.Multiply:
- if (prettyPrintOptions.AroundMultiplicativeOperatorParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.Times);
- if (prettyPrintOptions.AroundMultiplicativeOperatorParentheses) {
- outputFormatter.Space();
- }
- break;
-
- case BinaryOperatorType.Divide:
- case BinaryOperatorType.DivideInteger:
- if (prettyPrintOptions.AroundMultiplicativeOperatorParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.Div);
- if (prettyPrintOptions.AroundMultiplicativeOperatorParentheses) {
- outputFormatter.Space();
- }
- break;
-
- case BinaryOperatorType.Modulus:
- if (prettyPrintOptions.AroundMultiplicativeOperatorParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.Mod);
- if (prettyPrintOptions.AroundMultiplicativeOperatorParentheses) {
- outputFormatter.Space();
- }
- break;
-
- case BinaryOperatorType.ShiftLeft:
- if (prettyPrintOptions.AroundShiftOperatorParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.ShiftLeft);
- if (prettyPrintOptions.AroundShiftOperatorParentheses) {
- outputFormatter.Space();
- }
- break;
-
- case BinaryOperatorType.ShiftRight:
- if (prettyPrintOptions.AroundShiftOperatorParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.GreaterThan);
- outputFormatter.PrintToken(Tokens.GreaterThan);
- if (prettyPrintOptions.AroundShiftOperatorParentheses) {
- outputFormatter.Space();
- }
- break;
-
- case BinaryOperatorType.BitwiseAnd:
- if (prettyPrintOptions.AroundBitwiseOperatorParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.BitwiseAnd);
- if (prettyPrintOptions.AroundBitwiseOperatorParentheses) {
- outputFormatter.Space();
- }
- break;
- case BinaryOperatorType.BitwiseOr:
- if (prettyPrintOptions.AroundBitwiseOperatorParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.BitwiseOr);
- if (prettyPrintOptions.AroundBitwiseOperatorParentheses) {
- outputFormatter.Space();
- }
- break;
- case BinaryOperatorType.ExclusiveOr:
- if (prettyPrintOptions.AroundBitwiseOperatorParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.Xor);
- if (prettyPrintOptions.AroundBitwiseOperatorParentheses) {
- outputFormatter.Space();
- }
- break;
-
- case BinaryOperatorType.LogicalAnd:
- if (prettyPrintOptions.AroundLogicalOperatorParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.LogicalAnd);
- if (prettyPrintOptions.AroundLogicalOperatorParentheses) {
- outputFormatter.Space();
- }
- break;
- case BinaryOperatorType.LogicalOr:
- if (prettyPrintOptions.AroundLogicalOperatorParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.LogicalOr);
- if (prettyPrintOptions.AroundLogicalOperatorParentheses) {
- outputFormatter.Space();
- }
- break;
-
- case BinaryOperatorType.Equality:
- case BinaryOperatorType.ReferenceEquality:
- if (prettyPrintOptions.AroundEqualityOperatorParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.Equal);
- if (prettyPrintOptions.AroundEqualityOperatorParentheses) {
- outputFormatter.Space();
- }
- break;
- case BinaryOperatorType.GreaterThan:
- if (prettyPrintOptions.AroundRelationalOperatorParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.GreaterThan);
- if (prettyPrintOptions.AroundRelationalOperatorParentheses) {
- outputFormatter.Space();
- }
- break;
- case BinaryOperatorType.GreaterThanOrEqual:
- if (prettyPrintOptions.AroundRelationalOperatorParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.GreaterEqual);
- if (prettyPrintOptions.AroundRelationalOperatorParentheses) {
- outputFormatter.Space();
- }
- break;
- case BinaryOperatorType.InEquality:
- case BinaryOperatorType.ReferenceInequality:
- if (prettyPrintOptions.AroundEqualityOperatorParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.NotEqual);
- if (prettyPrintOptions.AroundEqualityOperatorParentheses) {
- outputFormatter.Space();
- }
- break;
- case BinaryOperatorType.LessThan:
- if (prettyPrintOptions.AroundRelationalOperatorParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.LessThan);
- if (prettyPrintOptions.AroundRelationalOperatorParentheses) {
- outputFormatter.Space();
- }
- break;
- case BinaryOperatorType.LessThanOrEqual:
- if (prettyPrintOptions.AroundRelationalOperatorParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.LessEqual);
- if (prettyPrintOptions.AroundRelationalOperatorParentheses) {
- outputFormatter.Space();
- }
- break;
- case BinaryOperatorType.NullCoalescing:
- if (prettyPrintOptions.AroundRelationalOperatorParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.DoubleQuestion);
- if (prettyPrintOptions.AroundRelationalOperatorParentheses) {
- outputFormatter.Space();
- }
- break;
-
- default:
- Error(binaryOperatorExpression, String.Format("Unknown binary operator {0}", binaryOperatorExpression.Op));
- return null;
- }
- TrackVisit(binaryOperatorExpression.Right, data);
- return null;
- }
-
- public override object TrackedVisitParenthesizedExpression(ParenthesizedExpression parenthesizedExpression, object data)
- {
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- if (this.prettyPrintOptions.WithinParentheses) {
- outputFormatter.Space();
- }
- TrackVisit(parenthesizedExpression.Expression, data);
- if (this.prettyPrintOptions.WithinParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- return null;
- }
-
- public override object TrackedVisitInvocationExpression(InvocationExpression invocationExpression, object data)
- {
- TrackVisit(invocationExpression.TargetObject, data);
-
- if (prettyPrintOptions.BeforeMethodCallParentheses) {
- outputFormatter.Space();
- }
-
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- if (this.prettyPrintOptions.WithinMethodCallParentheses) {
- outputFormatter.Space();
- }
- AppendCommaSeparatedList(invocationExpression.Arguments);
- if (this.prettyPrintOptions.WithinMethodCallParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- return null;
- }
-
- public override object TrackedVisitIdentifierExpression(IdentifierExpression identifierExpression, object data)
- {
- outputFormatter.PrintIdentifier(identifierExpression.Identifier);
- PrintTypeArgumentList(identifierExpression.TypeArguments);
- return null;
- }
-
- void PrintTypeArgumentList(List<TypeReference> typeArguments)
- {
- if (typeArguments != null && typeArguments.Count > 0) {
- outputFormatter.PrintToken(Tokens.LessThan);
- AppendCommaSeparatedList(typeArguments);
- outputFormatter.PrintToken(Tokens.GreaterThan);
- }
- }
-
- public override object TrackedVisitTypeReferenceExpression(TypeReferenceExpression typeReferenceExpression, object data)
- {
- TrackVisit(typeReferenceExpression.TypeReference, data);
- return null;
- }
-
- public override object TrackedVisitUnaryOperatorExpression(UnaryOperatorExpression unaryOperatorExpression, object data)
- {
- switch (unaryOperatorExpression.Op) {
- case UnaryOperatorType.BitNot:
- outputFormatter.PrintToken(Tokens.BitwiseComplement);
- break;
- case UnaryOperatorType.Decrement:
- outputFormatter.PrintToken(Tokens.Decrement);
- break;
- case UnaryOperatorType.Increment:
- outputFormatter.PrintToken(Tokens.Increment);
- break;
- case UnaryOperatorType.Minus:
- outputFormatter.PrintToken(Tokens.Minus);
- break;
- case UnaryOperatorType.Not:
- outputFormatter.PrintToken(Tokens.Not);
- break;
- case UnaryOperatorType.Plus:
- outputFormatter.PrintToken(Tokens.Plus);
- break;
- case UnaryOperatorType.PostDecrement:
- TrackVisit(unaryOperatorExpression.Expression, data);
- outputFormatter.PrintToken(Tokens.Decrement);
- return null;
- case UnaryOperatorType.PostIncrement:
- TrackVisit(unaryOperatorExpression.Expression, data);
- outputFormatter.PrintToken(Tokens.Increment);
- return null;
- case UnaryOperatorType.Dereference:
- outputFormatter.PrintToken(Tokens.Times);
- break;
- case UnaryOperatorType.AddressOf:
- outputFormatter.PrintToken(Tokens.BitwiseAnd);
- break;
- default:
- Error(unaryOperatorExpression, String.Format("Unknown unary operator {0}", unaryOperatorExpression.Op));
- return null;
- }
- TrackVisit(unaryOperatorExpression.Expression, data);
- return null;
- }
-
- public override object TrackedVisitAssignmentExpression(AssignmentExpression assignmentExpression, object data)
- {
- TrackVisit(assignmentExpression.Left, data);
- if (this.prettyPrintOptions.AroundAssignmentParentheses) {
- outputFormatter.Space();
- }
- switch (assignmentExpression.Op) {
- case AssignmentOperatorType.Assign:
- outputFormatter.PrintToken(Tokens.Assign);
- break;
- case AssignmentOperatorType.Add:
- case AssignmentOperatorType.ConcatString:
- outputFormatter.PrintToken(Tokens.PlusAssign);
- break;
- case AssignmentOperatorType.Subtract:
- outputFormatter.PrintToken(Tokens.MinusAssign);
- break;
- case AssignmentOperatorType.Multiply:
- outputFormatter.PrintToken(Tokens.TimesAssign);
- break;
- case AssignmentOperatorType.Divide:
- case AssignmentOperatorType.DivideInteger:
- outputFormatter.PrintToken(Tokens.DivAssign);
- break;
- case AssignmentOperatorType.ShiftLeft:
- outputFormatter.PrintToken(Tokens.ShiftLeftAssign);
- break;
- case AssignmentOperatorType.ShiftRight:
- outputFormatter.PrintToken(Tokens.GreaterThan);
- outputFormatter.PrintToken(Tokens.GreaterEqual);
- break;
- case AssignmentOperatorType.ExclusiveOr:
- outputFormatter.PrintToken(Tokens.XorAssign);
- break;
- case AssignmentOperatorType.Modulus:
- outputFormatter.PrintToken(Tokens.ModAssign);
- break;
- case AssignmentOperatorType.BitwiseAnd:
- outputFormatter.PrintToken(Tokens.BitwiseAndAssign);
- break;
- case AssignmentOperatorType.BitwiseOr:
- outputFormatter.PrintToken(Tokens.BitwiseOrAssign);
- break;
- case AssignmentOperatorType.Power:
- outputFormatter.PrintToken(Tokens.Assign);
- if (this.prettyPrintOptions.AroundAssignmentParentheses) {
- outputFormatter.Space();
- }
- VisitBinaryOperatorExpression(new BinaryOperatorExpression(assignmentExpression.Left,
- BinaryOperatorType.Power,
- assignmentExpression.Right), data);
- return null;
- default:
- Error(assignmentExpression, String.Format("Unknown assignment operator {0}", assignmentExpression.Op));
- return null;
- }
- if (this.prettyPrintOptions.AroundAssignmentParentheses) {
- outputFormatter.Space();
- }
- TrackVisit(assignmentExpression.Right, data);
- return null;
- }
-
- public override object TrackedVisitSizeOfExpression(SizeOfExpression sizeOfExpression, object data)
- {
- outputFormatter.PrintToken(Tokens.Sizeof);
- if (prettyPrintOptions.SizeOfParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- if (this.prettyPrintOptions.WithinSizeOfParentheses) {
- outputFormatter.Space();
- }
- TrackVisit(sizeOfExpression.TypeReference, data);
- if (this.prettyPrintOptions.WithinSizeOfParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- return null;
- }
-
- public override object TrackedVisitTypeOfExpression(TypeOfExpression typeOfExpression, object data)
- {
- outputFormatter.PrintToken(Tokens.Typeof);
- if (prettyPrintOptions.TypeOfParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- if (this.prettyPrintOptions.WithinTypeOfParentheses) {
- outputFormatter.Space();
- }
- TrackVisit(typeOfExpression.TypeReference, data);
- if (this.prettyPrintOptions.WithinTypeOfParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- return null;
- }
-
- public override object TrackedVisitDefaultValueExpression(DefaultValueExpression defaultValueExpression, object data)
- {
- outputFormatter.PrintToken(Tokens.Default);
- if (prettyPrintOptions.TypeOfParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- if (this.prettyPrintOptions.WithinTypeOfParentheses) {
- outputFormatter.Space();
- }
- TrackVisit(defaultValueExpression.TypeReference, data);
- if (this.prettyPrintOptions.WithinTypeOfParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- return null;
- }
-
- public override object TrackedVisitTypeOfIsExpression(TypeOfIsExpression typeOfIsExpression, object data)
- {
- TrackVisit(typeOfIsExpression.Expression, data);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Is);
- outputFormatter.Space();
- TrackVisit(typeOfIsExpression.TypeReference, data);
- return null;
- }
-
- public override object TrackedVisitAddressOfExpression(AddressOfExpression addressOfExpression, object data)
- {
- // C# 2.0 can reference methods directly
- return TrackVisit(addressOfExpression.Expression, data);
- }
-
- public override object TrackedVisitAnonymousMethodExpression(AnonymousMethodExpression anonymousMethodExpression, object data)
- {
- outputFormatter.PrintToken(Tokens.Delegate);
-
- if (anonymousMethodExpression.Parameters.Count > 0 || anonymousMethodExpression.HasParameterList) {
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- bool withinParentheses = this.prettyPrintOptions.WithinMethodDeclarationParentheses && anonymousMethodExpression.Parameters.Any ();
- if (withinParentheses) {
- outputFormatter.Space();
- }
- AppendCommaSeparatedList(anonymousMethodExpression.Parameters);
- if (withinParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- }
- OutputBlockAllowInline(anonymousMethodExpression.Body, this.prettyPrintOptions.AnonymousMethodBraceStyle, false);
- return null;
- }
-
- public override object TrackedVisitLambdaExpression(LambdaExpression lambdaExpression, object data)
- {
- if (lambdaExpression.Parameters.Count == 1 && lambdaExpression.Parameters[0].TypeReference.IsNull) {
- // short syntax
- outputFormatter.PrintIdentifier(lambdaExpression.Parameters[0].ParameterName);
- } else {
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- if (this.prettyPrintOptions.WithinParentheses) {
- outputFormatter.Space();
- }
- AppendCommaSeparatedList(lambdaExpression.Parameters);
- if (this.prettyPrintOptions.WithinParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- }
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.LambdaArrow);
- if (!lambdaExpression.ExpressionBody.IsNull) {
- outputFormatter.Space();
- TrackVisit(lambdaExpression.ExpressionBody, null);
- }
- if (!lambdaExpression.StatementBody.IsNull) {
- OutputBlockAllowInline(lambdaExpression.StatementBody, this.prettyPrintOptions.MethodBraceStyle, false);
- }
- return null;
- }
-
- public override object TrackedVisitCheckedExpression(CheckedExpression checkedExpression, object data)
- {
- outputFormatter.PrintToken(Tokens.Checked);
- if (prettyPrintOptions.CheckedParentheses) {
- outputFormatter.Space();
- }
-
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- if (this.prettyPrintOptions.WithinCheckedExpressionParantheses) {
- outputFormatter.Space();
- }
- TrackVisit(checkedExpression.Expression, data);
- if (this.prettyPrintOptions.WithinCheckedExpressionParantheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- return null;
- }
-
- public override object TrackedVisitUncheckedExpression(UncheckedExpression uncheckedExpression, object data)
- {
- outputFormatter.PrintToken(Tokens.Unchecked);
- if (prettyPrintOptions.UncheckedParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- if (this.prettyPrintOptions.WithinCheckedExpressionParantheses) {
- outputFormatter.Space();
- }
- TrackVisit(uncheckedExpression.Expression, data);
- if (this.prettyPrintOptions.WithinCheckedExpressionParantheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- return null;
- }
-
- public override object TrackedVisitPointerReferenceExpression(PointerReferenceExpression pointerReferenceExpression, object data)
- {
- Expression target = pointerReferenceExpression.TargetObject;
-
- if (target is BinaryOperatorExpression || target is CastExpression) {
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- }
- TrackVisit(target, data);
- if (target is BinaryOperatorExpression || target is CastExpression) {
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- }
- outputFormatter.PrintToken(Tokens.Pointer);
- outputFormatter.PrintIdentifier(pointerReferenceExpression.MemberName);
- PrintTypeArgumentList(pointerReferenceExpression.TypeArguments);
-
- return null;
- }
-
- public override object TrackedVisitCastExpression(CastExpression castExpression, object data)
- {
- if (castExpression.CastType == CastType.TryCast) {
- TrackVisit(castExpression.Expression, data);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.As);
- outputFormatter.Space();
- TrackVisit(castExpression.CastTo, data);
- } else {
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- if (prettyPrintOptions.WithinCastParentheses) {
- outputFormatter.Space();
- }
- TrackVisit(castExpression.CastTo, data);
- if (prettyPrintOptions.WithinCastParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- if (this.prettyPrintOptions.SpacesAfterTypecast) {
- outputFormatter.Space();
- }
- TrackVisit(castExpression.Expression, data);
- }
- return null;
- }
-
- public override object TrackedVisitStackAllocExpression(StackAllocExpression stackAllocExpression, object data)
- {
- outputFormatter.PrintToken(Tokens.Stackalloc);
- outputFormatter.Space();
- TrackVisit(stackAllocExpression.TypeReference, data);
- outputFormatter.PrintToken(Tokens.OpenSquareBracket);
- if (this.prettyPrintOptions.SpacesWithinBrackets) {
- outputFormatter.Space();
- }
- TrackVisit(stackAllocExpression.Expression, data);
- if (this.prettyPrintOptions.SpacesWithinBrackets) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.CloseSquareBracket);
- return null;
- }
-
- public override object TrackedVisitIndexerExpression(IndexerExpression indexerExpression, object data)
- {
- TrackVisit(indexerExpression.TargetObject, data);
- outputFormatter.PrintToken(Tokens.OpenSquareBracket);
- if (this.prettyPrintOptions.SpacesWithinBrackets) {
- outputFormatter.Space();
- }
- AppendCommaSeparatedList(indexerExpression.Indexes);
- if (this.prettyPrintOptions.SpacesWithinBrackets) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.CloseSquareBracket);
- return null;
- }
-
- public override object TrackedVisitThisReferenceExpression(ThisReferenceExpression thisReferenceExpression, object data)
- {
- outputFormatter.PrintToken(Tokens.This);
- return null;
- }
-
- public override object TrackedVisitBaseReferenceExpression(BaseReferenceExpression baseReferenceExpression, object data) {
- outputFormatter.PrintToken(Tokens.Base);
- return null;
- }
-
- public override object TrackedVisitObjectCreateExpression(ObjectCreateExpression objectCreateExpression, object data)
- {
- outputFormatter.PrintToken(Tokens.New);
- if (!objectCreateExpression.CreateType.IsNull) {
- outputFormatter.Space();
- TrackVisit(objectCreateExpression.CreateType, data);
- }
- if (objectCreateExpression.Parameters.Count > 0 || objectCreateExpression.ObjectInitializer.IsNull) {
- if (prettyPrintOptions.NewParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- if (this.prettyPrintOptions.WithinMethodCallParentheses) {
- outputFormatter.Space();
- }
- AppendCommaSeparatedList(objectCreateExpression.Parameters);
- if (this.prettyPrintOptions.WithinMethodCallParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- }
- if (!objectCreateExpression.ObjectInitializer.IsNull) {
- outputFormatter.Space();
- TrackVisit(objectCreateExpression.ObjectInitializer, data);
- }
- return null;
- }
-
- public override object TrackedVisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object data)
- {
- outputFormatter.PrintToken(Tokens.New);
- if (arrayCreateExpression.IsImplicitlyTyped) {
- outputFormatter.PrintToken(Tokens.OpenSquareBracket);
- outputFormatter.PrintToken(Tokens.CloseSquareBracket);
- } else {
- outputFormatter.Space();
- PrintTypeReferenceWithoutArray(arrayCreateExpression.CreateType);
-
- if (arrayCreateExpression.Arguments.Count > 0) {
- outputFormatter.PrintToken(Tokens.OpenSquareBracket);
- bool outputSpace = this.prettyPrintOptions.SpacesWithinBrackets && arrayCreateExpression.Arguments.Count > 0;
- if (outputSpace) {
- outputFormatter.Space();
- }
- for (int i = 0; i < arrayCreateExpression.Arguments.Count; ++i) {
- if (i > 0) PrintFormattedComma();
- TrackVisit(arrayCreateExpression.Arguments[i], data);
- }
- if (outputSpace) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.CloseSquareBracket);
- PrintArrayRank(arrayCreateExpression.CreateType.RankSpecifier, 1);
- } else {
- PrintArrayRank(arrayCreateExpression.CreateType.RankSpecifier, 0);
- }
- }
-
- if (!arrayCreateExpression.ArrayInitializer.IsNull) {
- outputFormatter.Space();
- TrackVisit(arrayCreateExpression.ArrayInitializer, data);
- }
- return null;
- }
-
- public override object TrackedVisitMemberReferenceExpression(MemberReferenceExpression memberReferenceExpression, object data)
- {
- Expression target = memberReferenceExpression.TargetObject;
-
- if (target is BinaryOperatorExpression || target is CastExpression) {
- outputFormatter.PrintToken(Tokens.OpenParenthesis);
- if (this.prettyPrintOptions.WithinMethodCallParentheses) {
- outputFormatter.Space();
- }
- }
- TrackVisit(target, data);
- if (target is BinaryOperatorExpression || target is CastExpression) {
- if (this.prettyPrintOptions.WithinMethodCallParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.CloseParenthesis);
- }
- outputFormatter.PrintToken(Tokens.Dot);
- outputFormatter.PrintIdentifier(memberReferenceExpression.MemberName);
- PrintTypeArgumentList(memberReferenceExpression.TypeArguments);
- return null;
- }
-
- public override object TrackedVisitDirectionExpression(DirectionExpression directionExpression, object data)
- {
- switch (directionExpression.FieldDirection) {
- case FieldDirection.Out:
- outputFormatter.PrintToken(Tokens.Out);
- outputFormatter.Space();
- break;
- case FieldDirection.Ref:
- outputFormatter.PrintToken(Tokens.Ref);
- outputFormatter.Space();
- break;
- }
- TrackVisit(directionExpression.Expression, data);
- return null;
- }
-
- public override object TrackedVisitCollectionInitializerExpression(CollectionInitializerExpression arrayInitializerExpression, object data)
- {
- outputFormatter.PrintToken (Tokens.OpenCurlyBrace);
- if (arrayInitializerExpression.CreateExpressions.Count == 1) {
- outputFormatter.Space ();
- } else {
- if (this.prettyPrintOptions.PlaceArrayInitializersOnNewLine == ArrayInitializerPlacement.AlwaysNewLine) {
- outputFormatter.IndentationLevel++;
- outputFormatter.NewLine ();
- outputFormatter.Indent ();
- } else {
- outputFormatter.Space ();
- }
- }
- this.AppendCommaSeparatedList (arrayInitializerExpression.CreateExpressions, this.prettyPrintOptions.PlaceArrayInitializersOnNewLine == ArrayInitializerPlacement.AlwaysNewLine);
- if (arrayInitializerExpression.CreateExpressions.Count == 1) {
- outputFormatter.Space ();
- } else {
- if (this.prettyPrintOptions.PlaceArrayInitializersOnNewLine == ArrayInitializerPlacement.AlwaysNewLine) {
- outputFormatter.IndentationLevel--;
- outputFormatter.NewLine();
- outputFormatter.Indent();
- } else {
- outputFormatter.Space();
- }
- }
- outputFormatter.PrintToken(Tokens.CloseCurlyBrace);
- return null;
- }
-
- public override object TrackedVisitConditionalExpression(ConditionalExpression conditionalExpression, object data)
- {
- TrackVisit(conditionalExpression.Condition, data);
- if (this.prettyPrintOptions.ConditionalOperatorBeforeConditionSpace) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.Question);
- if (this.prettyPrintOptions.ConditionalOperatorAfterConditionSpace) {
- outputFormatter.Space();
- }
- TrackVisit(conditionalExpression.TrueExpression, data);
- if (this.prettyPrintOptions.ConditionalOperatorBeforeSeparatorSpace) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.Colon);
- if (this.prettyPrintOptions.ConditionalOperatorAfterSeparatorSpace) {
- outputFormatter.Space();
- }
- TrackVisit(conditionalExpression.FalseExpression, data);
- return null;
- }
-
- #endregion
- #endregion
-
- void OutputModifier(ParameterModifiers modifier, INode node)
- {
- if ((modifier & ParameterModifiers.Ref) == ParameterModifiers.Ref) {
- outputFormatter.PrintToken(Tokens.Ref);
- outputFormatter.Space();
- } else if ((modifier & ParameterModifiers.Out) == ParameterModifiers.Out) {
- outputFormatter.PrintToken(Tokens.Out);
- outputFormatter.Space();
- }
- if ((modifier & ParameterModifiers.Params) == ParameterModifiers.Params) {
- outputFormatter.PrintToken(Tokens.Params);
- outputFormatter.Space();
- }
- if ((modifier & ParameterModifiers.Optional) == ParameterModifiers.Optional) {
- Error(node, String.Format("Optional parameters aren't supported in C#"));
- }
- }
-
- void OutputModifier(Modifiers modifier)
- {
- ArrayList tokenList = new ArrayList();
- if ((modifier & Modifiers.Unsafe) != 0) {
- tokenList.Add(Tokens.Unsafe);
- }
- if ((modifier & Modifiers.Public) != 0) {
- tokenList.Add(Tokens.Public);
- }
- if ((modifier & Modifiers.Private) != 0) {
- tokenList.Add(Tokens.Private);
- }
- if ((modifier & Modifiers.Protected) != 0) {
- tokenList.Add(Tokens.Protected);
- }
- if ((modifier & Modifiers.Static) != 0) {
- tokenList.Add(Tokens.Static);
- }
- if ((modifier & Modifiers.Internal) != 0) {
- tokenList.Add(Tokens.Internal);
- }
- if ((modifier & Modifiers.Override) != 0) {
- tokenList.Add(Tokens.Override);
- }
- if ((modifier & Modifiers.Abstract) != 0) {
- tokenList.Add(Tokens.Abstract);
- }
- if ((modifier & Modifiers.Virtual) != 0) {
- tokenList.Add(Tokens.Virtual);
- }
- if ((modifier & Modifiers.New) != 0) {
- tokenList.Add(Tokens.New);
- }
- if ((modifier & Modifiers.Sealed) != 0) {
- tokenList.Add(Tokens.Sealed);
- }
- if ((modifier & Modifiers.Extern) != 0) {
- tokenList.Add(Tokens.Extern);
- }
- if ((modifier & Modifiers.Const) != 0) {
- tokenList.Add(Tokens.Const);
- }
- if ((modifier & Modifiers.ReadOnly) != 0) {
- tokenList.Add(Tokens.Readonly);
- }
- if ((modifier & Modifiers.Volatile) != 0) {
- tokenList.Add(Tokens.Volatile);
- }
- if ((modifier & Modifiers.Fixed) != 0) {
- tokenList.Add(Tokens.Fixed);
- }
- outputFormatter.PrintTokenList(tokenList);
-
- if ((modifier & Modifiers.Partial) != 0) {
- outputFormatter.PrintText("partial ");
- }
- }
-
- object TrackVisit(INode node, object data)
- {
- return node.AcceptVisitor(this, data);
- }
-
- /// <summary>
- /// Resets the output formatter, sets Text to string.Empty.
- /// </summary>
- public void Reset ()
- {
- outputFormatter.Reset ();
- }
-
- public void AppendCommaSeparatedList<T>(ICollection<T> list) where T : class, INode
- {
- AppendCommaSeparatedList(list, false);
- }
-
- public void AppendCommaSeparatedList<T>(ICollection<T> list, bool alwaysBreakLine) where T : class, INode
- {
- if (list != null) {
- int i = 0;
- foreach (T node in list) {
- node.AcceptVisitor(this, null);
- if (i + 1 < list.Count) {
- if (alwaysBreakLine || (i + 1) % 10 == 0) {
- PrintFormattedCommaAndNewLine();
- } else {
- PrintFormattedComma();
- }
- }
- i++;
- }
- }
- }
-
- public override object TrackedVisitQueryExpression(QueryExpression queryExpression, object data)
- {
- if (queryExpression.IsQueryContinuation) {
- queryExpression.FromClause.InExpression.AcceptVisitor(this, data);
- }
- outputFormatter.IndentationLevel++;
- if (queryExpression.IsQueryContinuation) {
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Into);
- outputFormatter.Space();
- 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.NewLine();
- outputFormatter.Indent();
- clause.AcceptVisitor(this, null);
- }
- }
-
- public override object TrackedVisitQueryExpressionFromClause(QueryExpressionFromClause fromClause, object data)
- {
- outputFormatter.PrintToken(Tokens.From);
- outputFormatter.Space();
- VisitQueryExpressionFromOrJoinClause(fromClause, data);
- return null;
- }
-
- public override object TrackedVisitQueryExpressionJoinClause(QueryExpressionJoinClause joinClause, object data)
- {
- outputFormatter.PrintToken(Tokens.Join);
- outputFormatter.Space();
- VisitQueryExpressionFromOrJoinClause(joinClause, data);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.On);
- outputFormatter.Space();
- joinClause.OnExpression.AcceptVisitor(this, data);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.Equals);
- outputFormatter.Space();
- joinClause.EqualsExpression.AcceptVisitor(this, data);
- if (!string.IsNullOrEmpty(joinClause.IntoIdentifier)) {
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.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);
- if (this.prettyPrintOptions.AroundAssignmentParentheses) {
- outputFormatter.Space();
- }
- outputFormatter.PrintToken(Tokens.Assign);
- if (this.prettyPrintOptions.AroundAssignmentParentheses) {
- outputFormatter.Space();
- }
- var result = letClause.Expression.AcceptVisitor(this, data);
- outputFormatter.Space();
- return result;
- }
-
- public override object TrackedVisitQueryExpressionGroupClause(QueryExpressionGroupClause groupClause, object data)
- {
- outputFormatter.PrintToken(Tokens.Group);
- outputFormatter.Space();
- groupClause.Projection.AcceptVisitor(this, data);
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.By);
- outputFormatter.Space();
- return groupClause.GroupBy.AcceptVisitor(this, data);
- }
-
- public override object TrackedVisitQueryExpressionOrderClause(QueryExpressionOrderClause queryExpressionOrderClause, object data)
- {
- outputFormatter.PrintToken(Tokens.Orderby);
- 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.PrintToken(Tokens.Ascending);
- } else if (ordering.Direction == QueryExpressionOrderingDirection.Descending) {
- outputFormatter.Space();
- outputFormatter.PrintToken(Tokens.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.PrintToken(Tokens.Where);
- outputFormatter.Space();
- return whereClause.Condition.AcceptVisitor(this, data);
- }
- }
-}
diff --git a/main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/OutputFormatter.cs b/main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/OutputFormatter.cs
deleted file mode 100644
index f57546dbab..0000000000
--- a/main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/OutputFormatter.cs
+++ /dev/null
@@ -1,163 +0,0 @@
-// <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.Collections;
-using ICSharpCode.OldNRefactory.Parser.CSharp;
-
-namespace ICSharpCode.OldNRefactory.PrettyPrinter
-{
- public sealed class CSharpOutputFormatter : AbstractOutputFormatter
- {
- PrettyPrintOptions prettyPrintOptions;
-
- bool emitSemicolon = true;
-
- public bool EmitSemicolon {
- get {
- return emitSemicolon;
- }
- set {
- emitSemicolon = value;
- }
- }
-
- public CSharpOutputFormatter(PrettyPrintOptions prettyPrintOptions) : base(prettyPrintOptions)
- {
- this.prettyPrintOptions = prettyPrintOptions;
- }
-
- public override void PrintToken(int token)
- {
- if (token == Tokens.Semicolon && !EmitSemicolon) {
- return;
- }
- PrintText(Tokens.GetTokenString(token));
- }
-
- Stack braceStack = new Stack();
-
- public void BeginBrace(BraceStyle style, bool indent)
- {
- switch (style) {
- case BraceStyle.EndOfLine:
- if (!LastCharacterIsWhiteSpace) {
- Space();
- }
- PrintToken(Tokens.OpenCurlyBrace);
- NewLine();
- if (indent)
- ++IndentationLevel;
- break;
- case BraceStyle.EndOfLineWithoutSpace:
- PrintToken(Tokens.OpenCurlyBrace);
- NewLine();
- if (indent)
- ++IndentationLevel;
- break;
- case BraceStyle.NextLine:
- NewLine();
- Indent();
- PrintToken(Tokens.OpenCurlyBrace);
- NewLine();
- if (indent)
- ++IndentationLevel;
- break;
- case BraceStyle.NextLineShifted:
- NewLine();
- if (indent)
- ++IndentationLevel;
- Indent();
- PrintToken(Tokens.OpenCurlyBrace);
- NewLine();
- break;
- case BraceStyle.NextLineShifted2:
- NewLine();
- if (indent)
- ++IndentationLevel;
- Indent();
- PrintToken(Tokens.OpenCurlyBrace);
- NewLine();
- ++IndentationLevel;
- break;
- }
- braceStack.Push(style);
- }
-
- public void EndBrace (bool indent)
- {
- EndBrace (indent, true);
- }
-
- public void EndBrace (bool indent, bool emitNewLine)
- {
- BraceStyle style = (BraceStyle)braceStack.Pop();
- switch (style) {
- case BraceStyle.EndOfLine:
- case BraceStyle.EndOfLineWithoutSpace:
- case BraceStyle.NextLine:
- if (indent)
- --IndentationLevel;
- Indent();
- PrintToken(Tokens.CloseCurlyBrace);
- if (emitNewLine)
- NewLine();
- break;
- case BraceStyle.NextLineShifted:
- Indent();
- PrintToken(Tokens.CloseCurlyBrace);
- if (emitNewLine)
- NewLine();
- if (indent)
- --IndentationLevel;
- break;
- case BraceStyle.NextLineShifted2:
- if (indent)
- --IndentationLevel;
- Indent();
- PrintToken(Tokens.CloseCurlyBrace);
- if (emitNewLine)
- NewLine();
- --IndentationLevel;
- break;
- }
- }
-
- public override void PrintIdentifier(string identifier)
- {
- if (Keywords.GetToken(identifier) >= 0)
- PrintText("@");
- PrintText(identifier);
- }
-
- public override void PrintComment(Comment comment, bool forceWriteInPreviousBlock)
- {
- switch (comment.CommentType) {
- case CommentType.Block:
- bool wasIndented = isIndented;
- if (!wasIndented) {
- Indent ();
- }
- if (forceWriteInPreviousBlock) {
- WriteInPreviousLine("/*" + comment.CommentText + "*/", forceWriteInPreviousBlock);
- } else {
- PrintSpecialText("/*" + comment.CommentText + "*/");
- }
- if (wasIndented) {
- Indent ();
- }
- break;
- case CommentType.Documentation:
- WriteLineInPreviousLine("///" + comment.CommentText, forceWriteInPreviousBlock);
- break;
- default:
- // 3 because startposition is start of the text (after the tag)
- WriteLineInPreviousLine("//" + comment.CommentText, forceWriteInPreviousBlock, comment.StartPosition.Column != 3);
- break;
- }
- }
- }
-}
diff --git a/main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/PrettyPrintOptions.cs b/main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/PrettyPrintOptions.cs
deleted file mode 100644
index 32256812a3..0000000000
--- a/main/contrib/NRefactory/Project/Src/PrettyPrinter/CSharp/PrettyPrintOptions.cs
+++ /dev/null
@@ -1,945 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 4481 $</version>
-// </file>
-
-namespace ICSharpCode.OldNRefactory.PrettyPrinter
-{
- public enum BraceStyle {
- DoNotChange,
- EndOfLine,
- EndOfLineWithoutSpace,
- NextLine,
- NextLineShifted,
- NextLineShifted2,
- BannerStyle
- }
-
- public enum BraceForcement {
- DoNotChange,
- RemoveBraces,
- AddBraces,
- RemoveBracesForSingleLine
- }
-
- public enum ArrayInitializerPlacement {
- AlwaysNewLine,
- AlwaysSameLine,
- }
-
- /// <summary>
- /// Description of PrettyPrintOptions.
- /// </summary>
- public class PrettyPrintOptions : AbstractPrettyPrintOptions
- {
- #region BraceStyle
- BraceStyle namespaceBraceStyle = BraceStyle.NextLine;
- BraceStyle classBraceStyle = BraceStyle.NextLine;
- BraceStyle interfaceBraceStyle = BraceStyle.NextLine;
- BraceStyle structBraceStyle = BraceStyle.NextLine;
- BraceStyle enumBraceStyle = BraceStyle.NextLine;
-
- BraceStyle constructorBraceStyle = BraceStyle.NextLine;
- BraceStyle destructorBraceStyle = BraceStyle.NextLine;
- BraceStyle methodBraceStyle = BraceStyle.NextLine;
- BraceStyle anonymousMethodBraceStyle = BraceStyle.EndOfLine;
-
- BraceStyle propertyBraceStyle = BraceStyle.EndOfLine;
- bool allowPropertyGetBlockInline = true;
- BraceStyle propertyGetBraceStyle = BraceStyle.EndOfLine;
- bool allowPropertySetBlockInline = true;
- BraceStyle propertySetBraceStyle = BraceStyle.EndOfLine;
-
- BraceStyle eventBraceStyle = BraceStyle.EndOfLine;
- bool allowEventAddBlockInline = true;
- BraceStyle eventAddBraceStyle = BraceStyle.EndOfLine;
- bool allowEventRemoveBlockInline = true;
- BraceStyle eventRemoveBraceStyle = BraceStyle.EndOfLine;
-
- BraceStyle statementBraceStyle = BraceStyle.EndOfLine;
-
- public BraceStyle StatementBraceStyle {
- get {
- return statementBraceStyle;
- }
- set {
- statementBraceStyle = value;
- }
- }
-
- public BraceStyle NamespaceBraceStyle {
- get {
- return namespaceBraceStyle;
- }
- set {
- namespaceBraceStyle = value;
- }
- }
-
- public BraceStyle ClassBraceStyle {
- get {
- return classBraceStyle;
- }
- set {
- classBraceStyle = value;
- }
- }
-
- public BraceStyle InterfaceBraceStyle {
- get {
- return interfaceBraceStyle;
- }
- set {
- interfaceBraceStyle = value;
- }
- }
-
- public BraceStyle StructBraceStyle {
- get {
- return structBraceStyle;
- }
- set {
- structBraceStyle = value;
- }
- }
-
- public BraceStyle EnumBraceStyle {
- get {
- return enumBraceStyle;
- }
- set {
- enumBraceStyle = value;
- }
- }
-
-
- public BraceStyle ConstructorBraceStyle {
- get {
- return constructorBraceStyle;
- }
- set {
- constructorBraceStyle = value;
- }
- }
-
- public BraceStyle DestructorBraceStyle {
- get {
- return destructorBraceStyle;
- }
- set {
- destructorBraceStyle = value;
- }
- }
-
- public BraceStyle MethodBraceStyle {
- get {
- return methodBraceStyle;
- }
- set {
- methodBraceStyle = value;
- }
- }
-
- public BraceStyle AnonymousMethodBraceStyle {
- get {
- return anonymousMethodBraceStyle;
- }
- set {
- anonymousMethodBraceStyle = value;
- }
- }
-
- public BraceStyle PropertyBraceStyle {
- get {
- return propertyBraceStyle;
- }
- set {
- propertyBraceStyle = value;
- }
- }
- public BraceStyle PropertyGetBraceStyle {
- get {
- return propertyGetBraceStyle;
- }
- set {
- propertyGetBraceStyle = value;
- }
- }
-
- public bool AllowPropertyGetBlockInline {
- get {
- return allowPropertyGetBlockInline;
- }
- set {
- allowPropertyGetBlockInline = value;
- }
- }
-
- public BraceStyle PropertySetBraceStyle {
- get {
- return propertySetBraceStyle;
- }
- set {
- propertySetBraceStyle = value;
- }
- }
- public bool AllowPropertySetBlockInline {
- get {
- return allowPropertySetBlockInline;
- }
- set {
- allowPropertySetBlockInline = value;
- }
- }
-
- public BraceStyle EventBraceStyle {
- get {
- return eventBraceStyle;
- }
- set {
- eventBraceStyle = value;
- }
- }
-
- public BraceStyle EventAddBraceStyle {
- get {
- return eventAddBraceStyle;
- }
- set {
- eventAddBraceStyle = value;
- }
- }
- public bool AllowEventAddBlockInline {
- get {
- return allowEventAddBlockInline;
- }
- set {
- allowEventAddBlockInline = value;
- }
- }
-
- public BraceStyle EventRemoveBraceStyle {
- get {
- return eventRemoveBraceStyle;
- }
- set {
- eventRemoveBraceStyle = value;
- }
- }
- public bool AllowEventRemoveBlockInline {
- get {
- return allowEventRemoveBlockInline;
- }
- set {
- allowEventRemoveBlockInline = value;
- }
- }
- #endregion
-
- #region Force Braces
- BraceForcement ifElseBraceForcement = BraceForcement.DoNotChange;
- public BraceForcement IfElseBraceForcement {
- get {
- return ifElseBraceForcement;
- }
- set {
- ifElseBraceForcement = value;
- }
- }
-
- BraceForcement forBraceForcement = BraceForcement.DoNotChange;
- public BraceForcement ForBraceForcement {
- get {
- return forBraceForcement;
- }
- set {
- forBraceForcement = value;
- }
- }
-
- BraceForcement foreachBraceForcement = BraceForcement.DoNotChange;
- public BraceForcement ForEachBraceForcement {
- get {
- return foreachBraceForcement;
- }
- set {
- foreachBraceForcement = value;
- }
- }
-
- BraceForcement whileBraceForcement = BraceForcement.DoNotChange;
- public BraceForcement WhileBraceForcement {
- get {
- return whileBraceForcement;
- }
- set {
- whileBraceForcement = value;
- }
- }
-
- BraceForcement usingBraceForcement = BraceForcement.DoNotChange;
- public BraceForcement UsingBraceForcement {
- get {
- return usingBraceForcement;
- }
- set {
- usingBraceForcement = value;
- }
- }
-
- BraceForcement fixedBraceForcement = BraceForcement.DoNotChange;
- public BraceForcement FixedBraceForcement {
- get {
- return fixedBraceForcement;
- }
- set {
- fixedBraceForcement = value;
- }
- }
- #endregion
-
- #region Indentation
- bool indentNamespaceBody = true;
- bool indentClassBody = true;
- bool indentInterfaceBody = true;
- bool indentStructBody = true;
- bool indentEnumBody = true;
-
- bool indentMethodBody = true;
- bool indentPropertyBody = true;
- bool indentEventBody = true;
- bool indentBlocks = true;
-
- bool indentSwitchBody = true;
- bool indentCaseBody = true;
- bool indentBreakStatements = true;
-
- public bool IndentBlocks {
- get {
- return indentBlocks;
- }
- set {
- indentBlocks = value;
- }
- }
-
- public bool IndentClassBody {
- get {
- return indentClassBody;
- }
- set {
- indentClassBody = value;
- }
- }
-
- public bool IndentStructBody {
- get {
- return indentStructBody;
- }
- set {
- indentStructBody = value;
- }
- }
-
- public bool IndentPropertyBody {
- get {
- return indentPropertyBody;
- }
- set {
- indentPropertyBody = value;
- }
- }
-
- public bool IndentNamespaceBody {
- get {
- return indentNamespaceBody;
- }
- set {
- indentNamespaceBody = value;
- }
- }
-
- public bool IndentMethodBody {
- get {
- return indentMethodBody;
- }
- set {
- indentMethodBody = value;
- }
- }
-
- public bool IndentInterfaceBody {
- get {
- return indentInterfaceBody;
- }
- set {
- indentInterfaceBody = value;
- }
- }
-
- public bool IndentEventBody {
- get {
- return indentEventBody;
- }
- set {
- indentEventBody = value;
- }
- }
-
- public bool IndentEnumBody {
- get {
- return indentEnumBody;
- }
- set {
- indentEnumBody = value;
- }
- }
-
- public bool IndentBreakStatements {
- get {
- return indentBreakStatements;
- }
- set {
- indentBreakStatements = value;
- }
- }
-
- public bool IndentSwitchBody {
- get {
- return indentSwitchBody;
- }
- set {
- indentSwitchBody = value;
- }
- }
-
- public bool IndentCaseBody {
- get {
- return indentCaseBody;
- }
- set {
- indentCaseBody = value;
- }
- }
-
- #endregion
-
- #region NewLines
- public bool PlaceCatchOnNewLine { get; set; }
- public bool PlaceFinallyOnNewLine { get; set; }
- public bool PlaceElseOnNewLine { get; set; }
- public bool PlaceElseIfOnNewLine { get; set; }
- public bool PlaceNonBlockElseOnNewLine { get; set; }
- public bool PlaceWhileOnNewLine { get; set; }
- public ArrayInitializerPlacement PlaceArrayInitializersOnNewLine { get; set; }
- #endregion
-
- #region Spaces
-
- #region Before Parentheses
- bool beforeMethodCallParentheses = false;
- bool beforeDelegateDeclarationParentheses = false;
- bool beforeMethodDeclarationParentheses = false;
- bool beforeConstructorDeclarationParentheses = false;
-
- bool ifParentheses = true;
- bool whileParentheses = true;
- bool forParentheses = true;
- bool foreachParentheses = true;
- bool catchParentheses = true;
- bool switchParentheses = true;
- bool lockParentheses = true;
- bool usingParentheses = true;
- bool fixedParentheses = true;
- bool sizeOfParentheses = false;
- bool typeOfParentheses = false;
- bool checkedParentheses = false;
- bool uncheckedParentheses = false;
- bool newParentheses = false;
-
- public bool CheckedParentheses {
- get {
- return checkedParentheses;
- }
- set {
- checkedParentheses = value;
- }
- }
- public bool NewParentheses {
- get {
- return newParentheses;
- }
- set {
- newParentheses = value;
- }
- }
- public bool SizeOfParentheses {
- get {
- return sizeOfParentheses;
- }
- set {
- sizeOfParentheses = value;
- }
- }
- public bool TypeOfParentheses {
- get {
- return typeOfParentheses;
- }
- set {
- typeOfParentheses = value;
- }
- }
- public bool UncheckedParentheses {
- get {
- return uncheckedParentheses;
- }
- set {
- uncheckedParentheses = value;
- }
- }
-
- public bool BeforeConstructorDeclarationParentheses {
- get {
- return beforeConstructorDeclarationParentheses;
- }
- set {
- beforeConstructorDeclarationParentheses = value;
- }
- }
-
- public bool BeforeDelegateDeclarationParentheses {
- get {
- return beforeDelegateDeclarationParentheses;
- }
- set {
- beforeDelegateDeclarationParentheses = value;
- }
- }
-
- public bool BeforeMethodCallParentheses {
- get {
- return beforeMethodCallParentheses;
- }
- set {
- beforeMethodCallParentheses = value;
- }
- }
-
- public bool BeforeMethodDeclarationParentheses {
- get {
- return beforeMethodDeclarationParentheses;
- }
- set {
- beforeMethodDeclarationParentheses = value;
- }
- }
-
- public bool IfParentheses {
- get {
- return ifParentheses;
- }
- set {
- ifParentheses = value;
- }
- }
-
- public bool WhileParentheses {
- get {
- return whileParentheses;
- }
- set {
- whileParentheses = value;
- }
- }
- public bool ForeachParentheses {
- get {
- return foreachParentheses;
- }
- set {
- foreachParentheses = value;
- }
- }
- public bool LockParentheses {
- get {
- return lockParentheses;
- }
- set {
- lockParentheses = value;
- }
- }
- public bool UsingParentheses {
- get {
- return usingParentheses;
- }
- set {
- usingParentheses = value;
- }
- }
-
- public bool CatchParentheses {
- get {
- return catchParentheses;
- }
- set {
- catchParentheses = value;
- }
- }
- public bool FixedParentheses {
- get {
- return fixedParentheses;
- }
- set {
- fixedParentheses = value;
- }
- }
- public bool SwitchParentheses {
- get {
- return switchParentheses;
- }
- set {
- switchParentheses = value;
- }
- }
- public bool ForParentheses {
- get {
- return forParentheses;
- }
- set {
- forParentheses = value;
- }
- }
-
- #endregion
-
- #region AroundOperators
- bool aroundAssignmentParentheses = true;
- bool aroundLogicalOperatorParentheses = true;
- bool aroundEqualityOperatorParentheses = true;
- bool aroundRelationalOperatorParentheses = true;
- bool aroundBitwiseOperatorParentheses = true;
- bool aroundAdditiveOperatorParentheses = true;
- bool aroundMultiplicativeOperatorParentheses = true;
- bool aroundShiftOperatorParentheses = true;
-
- public bool AroundAdditiveOperatorParentheses {
- get {
- return aroundAdditiveOperatorParentheses;
- }
- set {
- aroundAdditiveOperatorParentheses = value;
- }
- }
- public bool AroundAssignmentParentheses {
- get {
- return aroundAssignmentParentheses;
- }
- set {
- aroundAssignmentParentheses = value;
- }
- }
- public bool AroundBitwiseOperatorParentheses {
- get {
- return aroundBitwiseOperatorParentheses;
- }
- set {
- aroundBitwiseOperatorParentheses = value;
- }
- }
- public bool AroundEqualityOperatorParentheses {
- get {
- return aroundEqualityOperatorParentheses;
- }
- set {
- aroundEqualityOperatorParentheses = value;
- }
- }
- public bool AroundLogicalOperatorParentheses {
- get {
- return aroundLogicalOperatorParentheses;
- }
- set {
- aroundLogicalOperatorParentheses = value;
- }
- }
- public bool AroundMultiplicativeOperatorParentheses {
- get {
- return aroundMultiplicativeOperatorParentheses;
- }
- set {
- aroundMultiplicativeOperatorParentheses = value;
- }
- }
- public bool AroundRelationalOperatorParentheses {
- get {
- return aroundRelationalOperatorParentheses;
- }
- set {
- aroundRelationalOperatorParentheses = value;
- }
- }
- public bool AroundShiftOperatorParentheses {
- get {
- return aroundShiftOperatorParentheses;
- }
- set {
- aroundShiftOperatorParentheses = value;
- }
- }
- #endregion
-
- #region WithinParentheses
- bool withinCheckedExpressionParantheses = false;
- public bool WithinCheckedExpressionParantheses {
- get {
- return withinCheckedExpressionParantheses;
- }
- set {
- withinCheckedExpressionParantheses = value;
- }
- }
-
- bool withinTypeOfParentheses = false;
- public bool WithinTypeOfParentheses {
- get {
- return withinTypeOfParentheses;
- }
- set {
- withinTypeOfParentheses = value;
- }
- }
-
- bool withinSizeOfParentheses = false;
- public bool WithinSizeOfParentheses {
- get {
- return withinSizeOfParentheses;
- }
- set {
- withinSizeOfParentheses = value;
- }
- }
-
- bool withinCastParentheses = false;
- public bool WithinCastParentheses {
- get {
- return withinCastParentheses;
- }
- set {
- withinCastParentheses = value;
- }
- }
-
- bool withinUsingParentheses = false;
- public bool WithinUsingParentheses {
- get {
- return withinUsingParentheses;
- }
- set {
- withinUsingParentheses = value;
- }
- }
-
- bool withinLockParentheses = false;
- public bool WithinLockParentheses {
- get {
- return withinLockParentheses;
- }
- set {
- withinLockParentheses = value;
- }
- }
-
- bool withinSwitchParentheses = false;
- public bool WithinSwitchParentheses {
- get {
- return withinSwitchParentheses;
- }
- set {
- withinSwitchParentheses = value;
- }
- }
-
- bool withinCatchParentheses = false;
- public bool WithinCatchParentheses {
- get {
- return withinCatchParentheses;
- }
- set {
- withinCatchParentheses = value;
- }
- }
-
- bool withinForEachParentheses = false;
- public bool WithinForEachParentheses {
- get {
- return withinForEachParentheses;
- }
- set {
- withinForEachParentheses = value;
- }
- }
-
- bool withinForParentheses = false;
- public bool WithinForParentheses {
- get {
- return withinForParentheses;
- }
- set {
- withinForParentheses = value;
- }
- }
-
- bool withinWhileParentheses = false;
- public bool WithinWhileParentheses {
- get {
- return withinWhileParentheses;
- }
- set {
- withinWhileParentheses = value;
- }
- }
-
- bool withinIfParentheses = false;
- public bool WithinIfParentheses {
- get {
- return withinIfParentheses;
- }
- set {
- withinIfParentheses = value;
- }
- }
-
- bool withinMethodDeclarationParentheses = false;
- public bool WithinMethodDeclarationParentheses {
- get {
- return withinMethodDeclarationParentheses;
- }
- set {
- withinMethodDeclarationParentheses = value;
- }
- }
-
- bool withinMethodCallParentheses = false;
- public bool WithinMethodCallParentheses {
- get {
- return withinMethodCallParentheses;
- }
- set {
- withinMethodCallParentheses = value;
- }
- }
-
- bool withinParentheses = false;
- public bool WithinParentheses {
- get {
- return withinParentheses;
- }
- set {
- withinParentheses = value;
- }
- }
-
- #endregion
-
- #region SpacesInConditionalOperator
- bool conditionalOperatorBeforeConditionSpace = true;
- bool conditionalOperatorAfterConditionSpace = true;
-
- bool conditionalOperatorBeforeSeparatorSpace = true;
- bool conditionalOperatorAfterSeparatorSpace = true;
-
- public bool ConditionalOperatorAfterConditionSpace {
- get {
- return conditionalOperatorAfterConditionSpace;
- }
- set {
- conditionalOperatorAfterConditionSpace = value;
- }
- }
- public bool ConditionalOperatorAfterSeparatorSpace {
- get {
- return conditionalOperatorAfterSeparatorSpace;
- }
- set {
- conditionalOperatorAfterSeparatorSpace = value;
- }
- }
- public bool ConditionalOperatorBeforeConditionSpace {
- get {
- return conditionalOperatorBeforeConditionSpace;
- }
- set {
- conditionalOperatorBeforeConditionSpace = value;
- }
- }
- public bool ConditionalOperatorBeforeSeparatorSpace {
- get {
- return conditionalOperatorBeforeSeparatorSpace;
- }
- set {
- conditionalOperatorBeforeSeparatorSpace = value;
- }
- }
- #endregion
-
- #region OtherSpaces
- bool spacesAfterComma = true;
- public bool SpacesAfterComma {
- get {
- return spacesAfterComma;
- }
- set {
- spacesAfterComma = value;
- }
- }
-
- bool spacesAfterSemicolon = true;
- public bool SpacesAfterSemicolon {
- get {
- return spacesAfterSemicolon;
- }
- set {
- spacesAfterSemicolon = value;
- }
- }
-
- bool spacesAfterTypecast = false;
- public bool SpacesAfterTypecast {
- get {
- return spacesAfterTypecast;
- }
- set {
- spacesAfterTypecast = value;
- }
- }
-
- bool spacesBeforeComma = false;
- public bool SpacesBeforeComma {
- get {
- return spacesBeforeComma;
- }
- set {
- spacesBeforeComma = value;
- }
- }
-
- bool spacesWithinBrackets = false;
- public bool SpacesWithinBrackets {
- get {
- return spacesWithinBrackets;
- }
- set {
- spacesWithinBrackets = value;
- }
- }
- #endregion
- #endregion
-
- public PrettyPrintOptions ()
- {
- PlaceNonBlockElseOnNewLine = true;
- PlaceElseIfOnNewLine = 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
deleted file mode 100644
index 842c185af1..0000000000
--- a/main/contrib/NRefactory/Project/Src/PrettyPrinter/IOutputAstVisitor.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-// <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.OldNRefactory.Parser;
-using ICSharpCode.OldNRefactory.Ast;
-
-namespace ICSharpCode.OldNRefactory.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;
- }
- bool LastCharacterIsNewLine {
- get;
- }
- 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
deleted file mode 100644
index 9bd23698da..0000000000
--- a/main/contrib/NRefactory/Project/Src/PrettyPrinter/SpecialNodesInserter.cs
+++ /dev/null
@@ -1,146 +0,0 @@
-// <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.OldNRefactory.Ast;
-
-namespace ICSharpCode.OldNRefactory.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
deleted file mode 100644
index 975f55b492..0000000000
--- a/main/contrib/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetOutputFormatter.cs
+++ /dev/null
@@ -1,77 +0,0 @@
-// <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.OldNRefactory.Parser.VB;
-
-namespace ICSharpCode.OldNRefactory.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
deleted file mode 100644
index 813f9572f1..0000000000
--- a/main/contrib/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetOutputVisitor.cs
+++ /dev/null
@@ -1,3062 +0,0 @@
-// <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.OldNRefactory.Ast;
-using ICSharpCode.OldNRefactory.Parser;
-using ICSharpCode.OldNRefactory.Parser.VB;
-using ICSharpCode.OldNRefactory.Visitors;
-
-namespace ICSharpCode.OldNRefactory.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.OldNRefactory.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.OldNRefactory.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
deleted file mode 100644
index a6dd07660c..0000000000
--- a/main/contrib/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetPrettyPrintOptions.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-// <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.OldNRefactory.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
deleted file mode 100644
index 78fcdb22cc..0000000000
--- a/main/contrib/NRefactory/Project/Src/SnippetParser.cs
+++ /dev/null
@@ -1,146 +0,0 @@
-// <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.OldNRefactory.Ast;
-using ICSharpCode.OldNRefactory.Parser;
-
-namespace ICSharpCode.OldNRefactory
-{
- 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
deleted file mode 100644
index aba0fcd7e7..0000000000
--- a/main/contrib/NRefactory/Project/Src/Visitors/AbstractASTVisitor.cs
+++ /dev/null
@@ -1,1264 +0,0 @@
-//------------------------------------------------------------------------------
-// <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.OldNRefactory.Visitors {
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using ICSharpCode.OldNRefactory.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);
- 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.OldNRefactory.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));
- foreach (ICSharpCode.OldNRefactory.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));
- 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));
- 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));
- 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));
- 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));
- foreach (AttributeSection o in delegateDeclaration.Attributes) {
- Debug.Assert(o != null);
- o.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));
- 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));
- 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));
- foreach (AttributeSection o in eventAddRegion.Attributes) {
- Debug.Assert(o != null);
- o.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));
- 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));
- foreach (AttributeSection o in eventRaiseRegion.Attributes) {
- Debug.Assert(o != null);
- o.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));
- foreach (AttributeSection o in eventRemoveRegion.Attributes) {
- Debug.Assert(o != null);
- o.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));
- foreach (AttributeSection o in fieldDeclaration.Attributes) {
- Debug.Assert(o != null);
- o.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);
- 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));
- foreach (Statement o in forStatement.Initializers) {
- Debug.Assert(o != null);
- o.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));
- 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);
- 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));
- 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);
- 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));
- 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);
- 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));
- foreach (ParameterDeclarationExpression o in lambdaExpression.Parameters) {
- Debug.Assert (o != null);
- o.AcceptVisitor (this, data);
- }
- lambdaExpression.ExpressionBody.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);
- 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));
- 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);
- 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);
- 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));
- 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);
- 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));
- 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);
- 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));
- 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));
- 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));
- foreach (AttributeSection o in propertySetRegion.Attributes) {
- Debug.Assert(o != null);
- o.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);
- 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);
- 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);
- 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));
- 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);
- 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));
- 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));
- 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));
- 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));
- 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));
- 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));
- 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);
- 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));
- 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);
- 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));
- 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));
- 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));
- 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);
- }
- }
-}
diff --git a/main/contrib/NRefactory/Project/Src/Visitors/AbstractAstTransformer.cs b/main/contrib/NRefactory/Project/Src/Visitors/AbstractAstTransformer.cs
deleted file mode 100644
index 09bd60f7ff..0000000000
--- a/main/contrib/NRefactory/Project/Src/Visitors/AbstractAstTransformer.cs
+++ /dev/null
@@ -1,2274 +0,0 @@
-//------------------------------------------------------------------------------
-// <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.OldNRefactory.Visitors {
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using ICSharpCode.OldNRefactory.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));
- for (int i = 0; i < anonymousMethodExpression.Parameters.Count; i++) {
- ParameterDeclarationExpression o = anonymousMethodExpression.Parameters[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (ParameterDeclarationExpression)nodeStack.Pop();
- if (o == null)
- 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()));
- for (int i = 0; i < arrayCreateExpression.Arguments.Count; i++) {
- Expression o = arrayCreateExpression.Arguments[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (Expression)nodeStack.Pop();
- if (o == null)
- 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.OldNRefactory.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);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (Expression)nodeStack.Pop();
- if (o == null)
- 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);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (NamedArgumentExpression)nodeStack.Pop();
- if (o == null)
- 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));
- for (int i = 0; i < attributeSection.Attributes.Count; i++) {
- ICSharpCode.OldNRefactory.Ast.Attribute o = attributeSection.Attributes[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (ICSharpCode.OldNRefactory.Ast.Attribute)nodeStack.Pop();
- if (o == null)
- 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));
- for (int i = 0; i < blockStatement.Children.Count; i++) {
- INode o = blockStatement.Children[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = nodeStack.Pop();
- if (o == null)
- 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));
- for (int i = 0; i < collectionInitializerExpression.CreateExpressions.Count; i++) {
- Expression o = collectionInitializerExpression.CreateExpressions[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (Expression)nodeStack.Pop();
- if (o == null)
- collectionInitializerExpression.CreateExpressions.RemoveAt(i--);
- else
- collectionInitializerExpression.CreateExpressions[i] = o;
- }
- 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);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = nodeStack.Pop();
- if (o == null)
- 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));
- for (int i = 0; i < constructorDeclaration.Attributes.Count; i++) {
- AttributeSection o = constructorDeclaration.Attributes[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (AttributeSection)nodeStack.Pop();
- if (o == null)
- 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);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (ParameterDeclarationExpression)nodeStack.Pop();
- if (o == null)
- 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));
- for (int i = 0; i < constructorInitializer.Arguments.Count; i++) {
- Expression o = constructorInitializer.Arguments[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (Expression)nodeStack.Pop();
- if (o == null)
- 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));
- for (int i = 0; i < declareDeclaration.Attributes.Count; i++) {
- AttributeSection o = declareDeclaration.Attributes[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (AttributeSection)nodeStack.Pop();
- if (o == null)
- 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);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (ParameterDeclarationExpression)nodeStack.Pop();
- if (o == null)
- 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));
- for (int i = 0; i < delegateDeclaration.Attributes.Count; i++) {
- AttributeSection o = delegateDeclaration.Attributes[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (AttributeSection)nodeStack.Pop();
- if (o == null)
- delegateDeclaration.Attributes.RemoveAt(i--);
- else
- delegateDeclaration.Attributes[i] = o;
- }
- 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);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (ParameterDeclarationExpression)nodeStack.Pop();
- if (o == null)
- 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);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (TemplateDefinition)nodeStack.Pop();
- if (o == null)
- 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));
- for (int i = 0; i < destructorDeclaration.Attributes.Count; i++) {
- AttributeSection o = destructorDeclaration.Attributes[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (AttributeSection)nodeStack.Pop();
- if (o == null)
- 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));
- for (int i = 0; i < eraseStatement.Expressions.Count; i++) {
- Expression o = eraseStatement.Expressions[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (Expression)nodeStack.Pop();
- if (o == null)
- 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));
- for (int i = 0; i < eventAddRegion.Attributes.Count; i++) {
- AttributeSection o = eventAddRegion.Attributes[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (AttributeSection)nodeStack.Pop();
- if (o == null)
- eventAddRegion.Attributes.RemoveAt(i--);
- else
- eventAddRegion.Attributes[i] = o;
- }
- 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);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (ParameterDeclarationExpression)nodeStack.Pop();
- if (o == null)
- 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));
- for (int i = 0; i < eventDeclaration.Attributes.Count; i++) {
- AttributeSection o = eventDeclaration.Attributes[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (AttributeSection)nodeStack.Pop();
- if (o == null)
- 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);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (ParameterDeclarationExpression)nodeStack.Pop();
- if (o == null)
- 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);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (InterfaceImplementation)nodeStack.Pop();
- if (o == null)
- 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));
- for (int i = 0; i < eventRaiseRegion.Attributes.Count; i++) {
- AttributeSection o = eventRaiseRegion.Attributes[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (AttributeSection)nodeStack.Pop();
- if (o == null)
- eventRaiseRegion.Attributes.RemoveAt(i--);
- else
- eventRaiseRegion.Attributes[i] = o;
- }
- 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);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (ParameterDeclarationExpression)nodeStack.Pop();
- if (o == null)
- 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));
- for (int i = 0; i < eventRemoveRegion.Attributes.Count; i++) {
- AttributeSection o = eventRemoveRegion.Attributes[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (AttributeSection)nodeStack.Pop();
- if (o == null)
- eventRemoveRegion.Attributes.RemoveAt(i--);
- else
- eventRemoveRegion.Attributes[i] = o;
- }
- 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);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (ParameterDeclarationExpression)nodeStack.Pop();
- if (o == null)
- 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));
- for (int i = 0; i < fieldDeclaration.Attributes.Count; i++) {
- AttributeSection o = fieldDeclaration.Attributes[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (AttributeSection)nodeStack.Pop();
- if (o == null)
- fieldDeclaration.Attributes.RemoveAt(i--);
- else
- fieldDeclaration.Attributes[i] = o;
- }
- 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);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (VariableDeclaration)nodeStack.Pop();
- if (o == null)
- 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()));
- for (int i = 0; i < forNextStatement.NextExpressions.Count; i++) {
- Expression o = forNextStatement.NextExpressions[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (Expression)nodeStack.Pop();
- if (o == null)
- 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));
- for (int i = 0; i < forStatement.Initializers.Count; i++) {
- Statement o = forStatement.Initializers[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (Statement)nodeStack.Pop();
- if (o == null)
- forStatement.Initializers.RemoveAt(i--);
- else
- forStatement.Initializers[i] = o;
- }
- 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);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (Statement)nodeStack.Pop();
- if (o == null)
- 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));
- for (int i = 0; i < identifierExpression.TypeArguments.Count; i++) {
- TypeReference o = identifierExpression.TypeArguments[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (TypeReference)nodeStack.Pop();
- if (o == null)
- 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()));
- for (int i = 0; i < ifElseStatement.TrueStatement.Count; i++) {
- Statement o = ifElseStatement.TrueStatement[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (Statement)nodeStack.Pop();
- if (o == null)
- 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);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (Statement)nodeStack.Pop();
- if (o == null)
- 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);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (ElseIfSection)nodeStack.Pop();
- if (o == null)
- 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));
- for (int i = 0; i < indexerDeclaration.Attributes.Count; i++) {
- AttributeSection o = indexerDeclaration.Attributes[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (AttributeSection)nodeStack.Pop();
- if (o == null)
- 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);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (ParameterDeclarationExpression)nodeStack.Pop();
- if (o == null)
- 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);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (InterfaceImplementation)nodeStack.Pop();
- if (o == null)
- 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()));
- for (int i = 0; i < indexerExpression.Indexes.Count; i++) {
- Expression o = indexerExpression.Indexes[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (Expression)nodeStack.Pop();
- if (o == null)
- 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));
- for (int i = 0; i < innerClassTypeReference.GenericTypes.Count; i++) {
- TypeReference o = innerClassTypeReference.GenericTypes[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (TypeReference)nodeStack.Pop();
- if (o == null)
- 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()));
- for (int i = 0; i < invocationExpression.Arguments.Count; i++) {
- Expression o = invocationExpression.Arguments[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (Expression)nodeStack.Pop();
- if (o == null)
- 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));
- for (int i = 0; i < lambdaExpression.Parameters.Count; i++) {
- ParameterDeclarationExpression o = lambdaExpression.Parameters[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (ParameterDeclarationExpression)nodeStack.Pop();
- if (o == null)
- 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()));
- for (int i = 0; i < localVariableDeclaration.Variables.Count; i++) {
- VariableDeclaration o = localVariableDeclaration.Variables[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (VariableDeclaration)nodeStack.Pop();
- if (o == null)
- 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()));
- for (int i = 0; i < memberReferenceExpression.TypeArguments.Count; i++) {
- TypeReference o = memberReferenceExpression.TypeArguments[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (TypeReference)nodeStack.Pop();
- if (o == null)
- 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));
- for (int i = 0; i < methodDeclaration.Attributes.Count; i++) {
- AttributeSection o = methodDeclaration.Attributes[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (AttributeSection)nodeStack.Pop();
- if (o == null)
- 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);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (ParameterDeclarationExpression)nodeStack.Pop();
- if (o == null)
- 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);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (InterfaceImplementation)nodeStack.Pop();
- if (o == null)
- 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()));
- for (int i = 0; i < methodDeclaration.Templates.Count; i++) {
- TemplateDefinition o = methodDeclaration.Templates[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (TemplateDefinition)nodeStack.Pop();
- if (o == null)
- 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));
- for (int i = 0; i < namespaceDeclaration.Children.Count; i++) {
- INode o = namespaceDeclaration.Children[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = nodeStack.Pop();
- if (o == null)
- 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()));
- for (int i = 0; i < objectCreateExpression.Parameters.Count; i++) {
- Expression o = objectCreateExpression.Parameters[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (Expression)nodeStack.Pop();
- if (o == null)
- 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));
- for (int i = 0; i < operatorDeclaration.Attributes.Count; i++) {
- AttributeSection o = operatorDeclaration.Attributes[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (AttributeSection)nodeStack.Pop();
- if (o == null)
- 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);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (ParameterDeclarationExpression)nodeStack.Pop();
- if (o == null)
- 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);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (InterfaceImplementation)nodeStack.Pop();
- if (o == null)
- 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()));
- for (int i = 0; i < operatorDeclaration.Templates.Count; i++) {
- TemplateDefinition o = operatorDeclaration.Templates[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (TemplateDefinition)nodeStack.Pop();
- if (o == null)
- 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);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (AttributeSection)nodeStack.Pop();
- if (o == null)
- operatorDeclaration.ReturnTypeAttributes.RemoveAt(i--);
- else
- operatorDeclaration.ReturnTypeAttributes[i] = o;
- }
- return null;
- }
-
- 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);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (AttributeSection)nodeStack.Pop();
- if (o == null)
- 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()));
- for (int i = 0; i < pointerReferenceExpression.TypeArguments.Count; i++) {
- TypeReference o = pointerReferenceExpression.TypeArguments[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (TypeReference)nodeStack.Pop();
- if (o == null)
- 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));
- for (int i = 0; i < propertyDeclaration.Attributes.Count; i++) {
- AttributeSection o = propertyDeclaration.Attributes[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (AttributeSection)nodeStack.Pop();
- if (o == null)
- 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);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (ParameterDeclarationExpression)nodeStack.Pop();
- if (o == null)
- 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);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (InterfaceImplementation)nodeStack.Pop();
- if (o == null)
- 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));
- for (int i = 0; i < propertyGetRegion.Attributes.Count; i++) {
- AttributeSection o = propertyGetRegion.Attributes[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (AttributeSection)nodeStack.Pop();
- if (o == null)
- 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));
- for (int i = 0; i < propertySetRegion.Attributes.Count; i++) {
- AttributeSection o = propertySetRegion.Attributes[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (AttributeSection)nodeStack.Pop();
- if (o == null)
- propertySetRegion.Attributes.RemoveAt(i--);
- else
- propertySetRegion.Attributes[i] = o;
- }
- 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);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (ParameterDeclarationExpression)nodeStack.Pop();
- if (o == null)
- 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()));
- for (int i = 0; i < queryExpression.MiddleClauses.Count; i++) {
- QueryExpressionClause o = queryExpression.MiddleClauses[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (QueryExpressionClause)nodeStack.Pop();
- if (o == null)
- 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()));
- for (int i = 0; i < queryExpressionAggregateClause.MiddleClauses.Count; i++) {
- QueryExpressionClause o = queryExpressionAggregateClause.MiddleClauses[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (QueryExpressionClause)nodeStack.Pop();
- if (o == null)
- 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);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (ExpressionRangeVariable)nodeStack.Pop();
- if (o == null)
- 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()));
- for (int i = 0; i < queryExpressionGroupJoinVBClause.IntoVariables.Count; i++) {
- ExpressionRangeVariable o = queryExpressionGroupJoinVBClause.IntoVariables[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (ExpressionRangeVariable)nodeStack.Pop();
- if (o == null)
- 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));
- for (int i = 0; i < queryExpressionGroupVBClause.GroupVariables.Count; i++) {
- ExpressionRangeVariable o = queryExpressionGroupVBClause.GroupVariables[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (ExpressionRangeVariable)nodeStack.Pop();
- if (o == null)
- 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);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (ExpressionRangeVariable)nodeStack.Pop();
- if (o == null)
- 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);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (ExpressionRangeVariable)nodeStack.Pop();
- if (o == null)
- 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()));
- for (int i = 0; i < queryExpressionJoinVBClause.Conditions.Count; i++) {
- QueryExpressionJoinConditionVB o = queryExpressionJoinVBClause.Conditions[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (QueryExpressionJoinConditionVB)nodeStack.Pop();
- if (o == null)
- 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));
- for (int i = 0; i < queryExpressionLetVBClause.Variables.Count; i++) {
- ExpressionRangeVariable o = queryExpressionLetVBClause.Variables[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (ExpressionRangeVariable)nodeStack.Pop();
- if (o == null)
- 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));
- for (int i = 0; i < queryExpressionOrderClause.Orderings.Count; i++) {
- QueryExpressionOrdering o = queryExpressionOrderClause.Orderings[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (QueryExpressionOrdering)nodeStack.Pop();
- if (o == null)
- 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));
- for (int i = 0; i < queryExpressionSelectVBClause.Variables.Count; i++) {
- ExpressionRangeVariable o = queryExpressionSelectVBClause.Variables[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (ExpressionRangeVariable)nodeStack.Pop();
- if (o == null)
- 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));
- for (int i = 0; i < raiseEventStatement.Arguments.Count; i++) {
- Expression o = raiseEventStatement.Arguments[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (Expression)nodeStack.Pop();
- if (o == null)
- 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));
- for (int i = 0; i < reDimStatement.ReDimClauses.Count; i++) {
- InvocationExpression o = reDimStatement.ReDimClauses[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (InvocationExpression)nodeStack.Pop();
- if (o == null)
- 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));
- for (int i = 0; i < switchSection.SwitchLabels.Count; i++) {
- CaseLabel o = switchSection.SwitchLabels[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (CaseLabel)nodeStack.Pop();
- if (o == null)
- 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);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = nodeStack.Pop();
- if (o == null)
- 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()));
- for (int i = 0; i < switchStatement.SwitchSections.Count; i++) {
- SwitchSection o = switchStatement.SwitchSections[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (SwitchSection)nodeStack.Pop();
- if (o == null)
- 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));
- for (int i = 0; i < templateDefinition.Attributes.Count; i++) {
- AttributeSection o = templateDefinition.Attributes[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (AttributeSection)nodeStack.Pop();
- if (o == null)
- 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);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (TypeReference)nodeStack.Pop();
- if (o == null)
- 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()));
- for (int i = 0; i < tryCatchStatement.CatchClauses.Count; i++) {
- CatchClause o = tryCatchStatement.CatchClauses[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (CatchClause)nodeStack.Pop();
- if (o == null)
- 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));
- for (int i = 0; i < typeDeclaration.Attributes.Count; i++) {
- AttributeSection o = typeDeclaration.Attributes[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (AttributeSection)nodeStack.Pop();
- if (o == null)
- 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);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (TypeReference)nodeStack.Pop();
- if (o == null)
- 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);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (TemplateDefinition)nodeStack.Pop();
- if (o == null)
- 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);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = nodeStack.Pop();
- if (o == null)
- 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));
- for (int i = 0; i < typeReference.GenericTypes.Count; i++) {
- TypeReference o = typeReference.GenericTypes[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (TypeReference)nodeStack.Pop();
- if (o == null)
- 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));
- for (int i = 0; i < usingDeclaration.Usings.Count; i++) {
- Using o = usingDeclaration.Usings[i];
- Debug.Assert(o != null);
- nodeStack.Push(o);
- o.AcceptVisitor(this, data);
- o = (Using)nodeStack.Pop();
- if (o == null)
- 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;
- }
- }
-}
diff --git a/main/contrib/NRefactory/Project/Src/Visitors/CSharpConstructsConvertVisitor.cs b/main/contrib/NRefactory/Project/Src/Visitors/CSharpConstructsConvertVisitor.cs
deleted file mode 100644
index 4baa52b3c8..0000000000
--- a/main/contrib/NRefactory/Project/Src/Visitors/CSharpConstructsConvertVisitor.cs
+++ /dev/null
@@ -1,234 +0,0 @@
-// <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.OldNRefactory.Ast;
-
-namespace ICSharpCode.OldNRefactory.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
deleted file mode 100644
index 400a0a25eb..0000000000
--- a/main/contrib/NRefactory/Project/Src/Visitors/CodeDOMOutputVisitor.cs
+++ /dev/null
@@ -1,1680 +0,0 @@
-// <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.OldNRefactory.Ast;
-
-namespace ICSharpCode.OldNRefactory.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 || string.IsNullOrEmpty (type.Type))
- return new CodeTypeReference ("");
-
- 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
deleted file mode 100644
index ff706e7694..0000000000
--- a/main/contrib/NRefactory/Project/Src/Visitors/CodeDOMVerboseOutputGenerator.cs
+++ /dev/null
@@ -1,360 +0,0 @@
-// <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.OldNRefactory.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
deleted file mode 100644
index 36f07244ec..0000000000
--- a/main/contrib/NRefactory/Project/Src/Visitors/ConvertVisitorBase.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-// <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.OldNRefactory.Ast;
-
-namespace ICSharpCode.OldNRefactory.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
deleted file mode 100644
index 6226881f47..0000000000
--- a/main/contrib/NRefactory/Project/Src/Visitors/LookupTableVisitor.cs
+++ /dev/null
@@ -1,325 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="none" email=""/>
-// <version>$Revision: 4527 $</version>
-// </file>
-
-using System;
-using System.Collections.Generic;
-
-using ICSharpCode.OldNRefactory.Ast;
-
-namespace ICSharpCode.OldNRefactory.Visitors
-{
- public sealed class LocalLookupVariable
- {
- public readonly string Name;
- public readonly TypeReference TypeRef;
- public readonly Location StartPos;
- public readonly Location EndPos;
- public readonly bool IsConst;
- public readonly bool IsLoopVariable;
- public readonly Expression Initializer;
- public readonly LambdaExpression ParentLambdaExpression;
- public readonly bool IsQueryContinuation;
- public readonly Location InListPosition;
-
- public LocalLookupVariable(string name, TypeReference typeRef, Location startPos, Location endPos, bool isConst, bool isLoopVariable, Expression initializer, LambdaExpression parentLambdaExpression, bool isQueryContinuation, Location inListPosition)
- {
- this.Name = name;
- this.TypeRef = typeRef;
- this.StartPos = startPos;
- this.EndPos = endPos;
- this.IsConst = isConst;
- this.IsLoopVariable = isLoopVariable;
- this.Initializer = initializer;
- this.ParentLambdaExpression = parentLambdaExpression;
- this.IsQueryContinuation = isQueryContinuation;
- this.InListPosition = inListPosition;
- }
-
- }
-
- public sealed class LookupTableVisitor : AbstractAstVisitor
- {
- Dictionary<string, List<LocalLookupVariable>> variables;
- SupportedLanguage language;
-
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
- public Dictionary<string, List<LocalLookupVariable>> Variables {
- get {
- return variables;
- }
- }
-
- List<WithStatement> withStatements = new List<WithStatement>();
-
- public List<WithStatement> WithStatements {
- get {
- return withStatements;
- }
- }
-
- public LookupTableVisitor(SupportedLanguage language)
- {
- this.language = language;
- if (language == SupportedLanguage.VBNet) {
- variables = new Dictionary<string, List<LocalLookupVariable>>(StringComparer.InvariantCultureIgnoreCase);
- } else {
- variables = new Dictionary<string, List<LocalLookupVariable>>(StringComparer.InvariantCulture);
- }
- }
-
- public void AddVariable(TypeReference typeRef, string name,
- Location startPos, Location endPos, bool isConst,
- bool isLoopVariable, Expression initializer,
- LambdaExpression parentLambdaExpression,
- bool isQueryContinuation, Location inListPosition)
- {
- if (name == null || name.Length == 0) {
- return;
- }
- List<LocalLookupVariable> list;
- if (!variables.ContainsKey(name)) {
- variables[name] = list = new List<LocalLookupVariable>();
- } else {
- list = (List<LocalLookupVariable>)variables[name];
- }
- list.Add(new LocalLookupVariable (name, typeRef, startPos, endPos, isConst, isLoopVariable, initializer, parentLambdaExpression, isQueryContinuation, inListPosition));
- }
-
- public override object VisitWithStatement(WithStatement withStatement, object data)
- {
- withStatements.Add(withStatement);
- return base.VisitWithStatement(withStatement, data);
- }
-
- Stack<Location> endLocationStack = new Stack<Location>();
-
- Location CurrentEndLocation {
- get {
- return (endLocationStack.Count == 0) ? Location.Empty : endLocationStack.Peek();
- }
- }
-
- public override object VisitCompilationUnit (ICSharpCode.OldNRefactory.Ast.CompilationUnit compilationUnit, object data)
- {
- variables.Clear ();
- return base.VisitCompilationUnit (compilationUnit, data);
- }
-
- public override object VisitBlockStatement(BlockStatement blockStatement, object data)
- {
- endLocationStack.Push(blockStatement.EndLocation);
- base.VisitBlockStatement(blockStatement, data);
- endLocationStack.Pop();
- return null;
- }
-
- public override object VisitLocalVariableDeclaration(LocalVariableDeclaration localVariableDeclaration, object data)
- {
- for (int i = 0; i < localVariableDeclaration.Variables.Count; ++i) {
- VariableDeclaration varDecl = (VariableDeclaration)localVariableDeclaration.Variables[i];
-
- AddVariable(localVariableDeclaration.GetTypeForVariable(i),
- varDecl.Name,
- localVariableDeclaration.StartLocation,
- CurrentEndLocation,
- (localVariableDeclaration.Modifier & Modifiers.Const) == Modifiers.Const,
- false, varDecl.Initializer, null, false, localVariableDeclaration.SemicolonPosition);
- }
- return base.VisitLocalVariableDeclaration(localVariableDeclaration, data);
- }
-
- public override object VisitAnonymousMethodExpression(AnonymousMethodExpression anonymousMethodExpression, object data)
- {
- foreach (ParameterDeclarationExpression p in anonymousMethodExpression.Parameters) {
- AddVariable(p.TypeReference, p.ParameterName,
- anonymousMethodExpression.StartLocation, anonymousMethodExpression.EndLocation,
- false, false, null, null, false, anonymousMethodExpression.EndLocation);
- }
- return base.VisitAnonymousMethodExpression(anonymousMethodExpression, data);
- }
-
- public override object VisitLambdaExpression(LambdaExpression lambdaExpression, object data)
- {
- foreach (ParameterDeclarationExpression p in lambdaExpression.Parameters) {
- AddVariable(p.TypeReference, p.ParameterName,
- lambdaExpression.StartLocation, lambdaExpression.ExtendedEndLocation,
- false, false, null, lambdaExpression, false, lambdaExpression.StartLocation);
- }
- return base.VisitLambdaExpression(lambdaExpression, data);
- }
-
- public override object VisitQueryExpression(QueryExpression queryExpression, object data)
- {
- endLocationStack.Push(GetQueryVariableEndScope(queryExpression));
- base.VisitQueryExpression(queryExpression, data);
- endLocationStack.Pop();
- return null;
- }
-
- Location GetQueryVariableEndScope(QueryExpression queryExpression)
- {
- return queryExpression.EndLocation;
- }
-
- public override object VisitQueryExpressionFromClause(QueryExpressionFromClause fromClause, object data)
- {
- QueryExpression parent = fromClause.Parent as QueryExpression;
- AddVariable(fromClause.Type, fromClause.Identifier,
- fromClause.StartLocation, new Location (CurrentEndLocation.Column + 1, CurrentEndLocation.Line),
- false, true, fromClause.InExpression, null, parent != null && parent.IsQueryContinuation, fromClause.StartLocation);
- return base.VisitQueryExpressionFromClause(fromClause, data);
- }
-
- public override object VisitQueryExpressionJoinClause(QueryExpressionJoinClause joinClause, object data)
- {
- if (string.IsNullOrEmpty(joinClause.IntoIdentifier)) {
- AddVariable(joinClause.Type, joinClause.Identifier,
- joinClause.StartLocation, CurrentEndLocation,
- false, true, joinClause.InExpression, null, false, joinClause.StartLocation);
- } else {
- AddVariable(joinClause.Type, joinClause.Identifier,
- joinClause.StartLocation, joinClause.EndLocation,
- false, true, joinClause.InExpression, null, false, joinClause.StartLocation);
-
- AddVariable(joinClause.Type, joinClause.IntoIdentifier,
- joinClause.StartLocation, CurrentEndLocation,
- false, false, joinClause.InExpression, null, false, joinClause.StartLocation);
- }
- return base.VisitQueryExpressionJoinClause(joinClause, data);
- }
-
- public override object VisitQueryExpressionLetClause(QueryExpressionLetClause letClause, object data)
- {
- AddVariable(null, letClause.Identifier,
- letClause.StartLocation, CurrentEndLocation,
- false, false, letClause.Expression, null, false, letClause.StartLocation);
- return base.VisitQueryExpressionLetClause(letClause, data);
- }
-
- public override object VisitForNextStatement(ForNextStatement forNextStatement, object data)
- {
- if (forNextStatement.EmbeddedStatement.EndLocation.IsEmpty) {
- return base.VisitForNextStatement(forNextStatement, data);
- } else {
- endLocationStack.Push(forNextStatement.EmbeddedStatement.EndLocation);
- AddVariable(forNextStatement.TypeReference,
- forNextStatement.VariableName,
- forNextStatement.StartLocation,
- forNextStatement.EndLocation,
- false, false,
- forNextStatement.Start,
- null,
- false,
- forNextStatement.StartLocation);
-
- base.VisitForNextStatement(forNextStatement, data);
-
- endLocationStack.Pop();
- return null;
- }
- }
-
- public override object VisitFixedStatement(FixedStatement fixedStatement, object data)
- {
- // uses LocalVariableDeclaration, we just have to put the end location on the stack
- if (fixedStatement.EmbeddedStatement.EndLocation.IsEmpty) {
- return base.VisitFixedStatement(fixedStatement, data);
- } else {
- endLocationStack.Push(fixedStatement.EmbeddedStatement.EndLocation);
- base.VisitFixedStatement(fixedStatement, data);
- endLocationStack.Pop();
- return null;
- }
- }
-
- public override object VisitForStatement(ForStatement forStatement, object data)
- {
- // uses LocalVariableDeclaration, we just have to put the end location on the stack
- if (forStatement.EmbeddedStatement.EndLocation.IsEmpty) {
- return base.VisitForStatement(forStatement, data);
- } else {
- endLocationStack.Push(forStatement.EmbeddedStatement.EndLocation);
- base.VisitForStatement(forStatement, data);
- endLocationStack.Pop();
- return null;
- }
- }
-
- public override object VisitUsingStatement(UsingStatement usingStatement, object data)
- {
- // uses LocalVariableDeclaration, we just have to put the end location on the stack
- if (usingStatement.EmbeddedStatement.EndLocation.IsEmpty) {
- return base.VisitUsingStatement(usingStatement, data);
- } else {
- endLocationStack.Push(usingStatement.EmbeddedStatement.EndLocation);
- base.VisitUsingStatement(usingStatement, data);
- endLocationStack.Pop();
- return null;
- }
- }
-
- public override object VisitSwitchSection(SwitchSection switchSection, object data)
- {
- if (language == SupportedLanguage.VBNet) {
- return VisitBlockStatement(switchSection, data);
- } else {
- return base.VisitSwitchSection(switchSection, data);
- }
- }
-
- public override object VisitForeachStatement(ForeachStatement foreachStatement, object data)
- {
- if (!foreachStatement.EmbeddedStatement.IsNull) {
- AddVariable(foreachStatement.TypeReference,
- foreachStatement.VariableName,
- foreachStatement.EmbeddedStatement.StartLocation,
- foreachStatement.EndLocation,
- false, true,
- foreachStatement.Expression,
- null,
- false,
- foreachStatement.EmbeddedStatement.StartLocation);
- }
-
- if (foreachStatement.Expression != null) {
- foreachStatement.Expression.AcceptVisitor(this, data);
- }
- if (foreachStatement.EmbeddedStatement == null) {
- return data;
- }
- return foreachStatement.EmbeddedStatement.AcceptVisitor(this, data);
- }
-
- public override object VisitTryCatchStatement(TryCatchStatement tryCatchStatement, object data)
- {
- if (tryCatchStatement == null) {
- return data;
- }
- if (tryCatchStatement.StatementBlock != null) {
- tryCatchStatement.StatementBlock.AcceptVisitor(this, data);
- }
- if (tryCatchStatement.CatchClauses != null) {
- foreach (CatchClause catchClause in tryCatchStatement.CatchClauses) {
- if (catchClause != null) {
- if (catchClause.TypeReference != null && catchClause.VariableName != null) {
- AddVariable(catchClause.TypeReference,
- catchClause.VariableName,
- catchClause.StartLocation,
- catchClause.StatementBlock.EndLocation,
- false, false, null, null, false, catchClause.StartLocation);
- }
- catchClause.StatementBlock.AcceptVisitor(this, data);
- }
- }
- }
- if (tryCatchStatement.FinallyBlock != null) {
- return tryCatchStatement.FinallyBlock.AcceptVisitor(this, data);
- }
- return data;
- }
- }
-}
diff --git a/main/contrib/NRefactory/Project/Src/Visitors/NodeTrackingAstVisitor.cs b/main/contrib/NRefactory/Project/Src/Visitors/NodeTrackingAstVisitor.cs
deleted file mode 100644
index 780047a9b3..0000000000
--- a/main/contrib/NRefactory/Project/Src/Visitors/NodeTrackingAstVisitor.cs
+++ /dev/null
@@ -1,1376 +0,0 @@
-//------------------------------------------------------------------------------
-// <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.OldNRefactory.Visitors {
- using System;
- using ICSharpCode.OldNRefactory.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>
- /// <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.OldNRefactory.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.OldNRefactory.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
deleted file mode 100644
index c33e54e7e9..0000000000
--- a/main/contrib/NRefactory/Project/Src/Visitors/NotImplementedAstVisitor.cs
+++ /dev/null
@@ -1,509 +0,0 @@
-//------------------------------------------------------------------------------
-// <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.OldNRefactory.Visitors {
- using System;
- using ICSharpCode.OldNRefactory.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.OldNRefactory.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
deleted file mode 100644
index fb2977394f..0000000000
--- a/main/contrib/NRefactory/Project/Src/Visitors/PrefixFieldsVisitor.cs
+++ /dev/null
@@ -1,147 +0,0 @@
-// <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.OldNRefactory.Ast;
-
-namespace ICSharpCode.OldNRefactory.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
deleted file mode 100644
index 9093e43338..0000000000
--- a/main/contrib/NRefactory/Project/Src/Visitors/RenameIdentifierVisitor.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-// <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.OldNRefactory.Ast;
-
-namespace ICSharpCode.OldNRefactory.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
deleted file mode 100644
index 15afc959b0..0000000000
--- a/main/contrib/NRefactory/Project/Src/Visitors/SetParentVisitor.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-// <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.OldNRefactory.Ast;
-using System.Collections.Generic;
-
-namespace ICSharpCode.OldNRefactory.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
deleted file mode 100644
index a86c8b8b5c..0000000000
--- a/main/contrib/NRefactory/Project/Src/Visitors/ToCSharpConvertVisitor.cs
+++ /dev/null
@@ -1,278 +0,0 @@
-// <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.OldNRefactory.AstBuilder;
-using System;
-using ICSharpCode.OldNRefactory.Ast;
-
-namespace ICSharpCode.OldNRefactory.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
deleted file mode 100644
index 0d07a1c97a..0000000000
--- a/main/contrib/NRefactory/Project/Src/Visitors/ToVBNetConvertVisitor.cs
+++ /dev/null
@@ -1,383 +0,0 @@
-// <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.OldNRefactory.Ast;
-using ICSharpCode.OldNRefactory.AstBuilder;
-using Attribute = ICSharpCode.OldNRefactory.Ast.Attribute;
-
-namespace ICSharpCode.OldNRefactory.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.OldNRefactory.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
deleted file mode 100644
index 42b9f1cefa..0000000000
--- a/main/contrib/NRefactory/Project/Src/Visitors/ToVBNetRenameConflictingVariables.cs
+++ /dev/null
@@ -1,91 +0,0 @@
-// <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.OldNRefactory.Ast;
-
-namespace ICSharpCode.OldNRefactory.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
deleted file mode 100644
index 617b902363..0000000000
--- a/main/contrib/NRefactory/Project/Src/Visitors/VBNetConstructsConvertVisitor.cs
+++ /dev/null
@@ -1,507 +0,0 @@
-// <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.OldNRefactory.AstBuilder;
-using System;
-using System.Collections.Generic;
-using System.Reflection;
-using ICSharpCode.OldNRefactory.Ast;
-using Attribute = ICSharpCode.OldNRefactory.Ast.Attribute;
-
-namespace ICSharpCode.OldNRefactory.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);
- }
- }
-}
diff --git a/main/contrib/NRefactory/Test/AssemblyInfo.cs b/main/contrib/NRefactory/Test/AssemblyInfo.cs
deleted file mode 100644
index 29c0221bfb..0000000000
--- a/main/contrib/NRefactory/Test/AssemblyInfo.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="none" email=""/>
-// <version>$Revision: 984 $</version>
-// </file>
-
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-// Information about this assembly is defined by the following
-// attributes.
-//
-// change them to the information which is associated with the assembly
-// you compile.
-
-[assembly: AssemblyTitle("NRefactory Test")]
-[assembly: AssemblyDescription("Unit tests for the parser and refactoring library for C# and VB.NET")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("ic#code")]
-[assembly: AssemblyProduct("SharpDevelop")]
-[assembly: AssemblyCopyright("2004-2006 AlphaSierraPapa")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// The assembly version has following format :
-//
-// Major.Minor.Build.Revision
-//
-// You can specify all values by your own or you can build default build and revision
-// numbers with the '*' character (the default):
-
-[assembly: AssemblyVersion("2.0.0.1")]
-
-// The following attributes specify the key for the sign of your assembly. See the
-// .NET Framework documentation for more information about signing.
-// This is not required, if you don't want signing let these attributes like they're.
-[assembly: AssemblyDelaySign(false)]
-[assembly: AssemblyKeyFile("")]
diff --git a/main/contrib/NRefactory/Test/General/UnitTest.cs b/main/contrib/NRefactory/Test/General/UnitTest.cs
deleted file mode 100644
index fb3f59be1d..0000000000
--- a/main/contrib/NRefactory/Test/General/UnitTest.cs
+++ /dev/null
@@ -1,107 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Andrea Paatz" email="andrea@icsharpcode.net"/>
-// <version>$Revision: 2533 $</version>
-// </file>
-
-using System;
-using System.Reflection;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Ast;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Visitors;
-
-namespace ICSharpCode.NRefactory.Tests
-{
- [TestFixture]
- public class StructuralTest
- {
- [Test]
- public void TestToStringMethods()
- {
- Type[] allTypes = typeof(INode).Assembly.GetTypes();
-
- foreach (Type type in allTypes) {
- if (type.IsClass && !type.IsAbstract && !type.IsNested && type.GetInterface(typeof(INode).FullName) != null) {
- MethodInfo methodInfo = type.GetMethod("ToString", BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public);
- Assert.IsNotNull(methodInfo, "ToString() not found in " + type.FullName);
- }
- }
- }
-
- [Test]
- public void TestUnitTests()
- {
- Type[] allTypes = typeof(StructuralTest).Assembly.GetTypes();
-
- foreach (Type type in allTypes) {
- if (type.GetCustomAttributes(typeof(TestFixtureAttribute), true).Length > 0) {
- foreach (MethodInfo m in type.GetMethods()) {
- if (m.IsPublic && m.ReturnType == typeof(void) && m.GetParameters().Length == 0) {
- if (m.GetCustomAttributes(typeof(TestAttribute), true).Length == 0) {
- Assert.Fail(type.Name + "." + m.Name + " should have the [Test] attribute!");
- }
- }
- }
- }
- }
- }
-
-// [Test]
-// public void TestAcceptVisitorMethods()
-// {
-// Type[] allTypes = typeof(AbstractNode).Assembly.GetTypes();
-//
-// foreach (Type type in allTypes) {
-// if (type.IsClass && !type.IsAbstract && type.GetInterface(typeof(INode).FullName) != null) {
-// MethodInfo methodInfo = type.GetMethod("AcceptVisitor", BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public);
-// Assertion.AssertNotNull("AcceptVisitor() not found in " + type.FullName, methodInfo);
-// }
-// }
-// }
-
- [Test]
- public void TestIAstVisitor()
- {
- Type[] allTypes = typeof(AbstractNode).Assembly.GetTypes();
- Type visitor = typeof(IAstVisitor);
-
- foreach (Type type in allTypes) {
- if (type.IsClass && !type.IsAbstract && !type.IsNested && type.GetInterface(typeof(INode).FullName) != null && !type.Name.StartsWith("Null")) {
- MethodInfo methodInfo = visitor.GetMethod("Visit" + type.Name, BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.ExactBinding, null, new Type[] {type, typeof(object)}, null);
- Assert.IsNotNull(methodInfo, "Visit with parameter " + type.FullName + " not found");
- Assert.AreEqual(2, methodInfo.GetParameters().Length);
- ParameterInfo first = methodInfo.GetParameters()[0];
- Assert.AreEqual(Char.ToLower(first.ParameterType.Name[0]) + first.ParameterType.Name.Substring(1), first.Name);
-
- ParameterInfo second = methodInfo.GetParameters()[1];
- Assert.AreEqual(typeof(System.Object), second.ParameterType);
- Assert.AreEqual("data", second.Name);
- }
- }
- }
-
- [Test]
- public void TestAbstractASTVisitorVisitor()
- {
- Type[] allTypes = typeof(AbstractNode).Assembly.GetTypes();
- Type visitor = typeof(AbstractAstVisitor);
-
- foreach (Type type in allTypes) {
- if (type.IsClass && !type.IsAbstract && !type.IsNested && type.GetInterface(typeof(INode).FullName) != null && !type.Name.StartsWith("Null")) {
- MethodInfo methodInfo = visitor.GetMethod("Visit" + type.Name, BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.ExactBinding, null, new Type[] {type, typeof(object)}, null);
- Assert.IsNotNull(methodInfo, "Visit with parameter " + type.FullName + " not found");
-
- Assert.AreEqual(2, methodInfo.GetParameters().Length);
- ParameterInfo first = methodInfo.GetParameters()[0];
- Assert.AreEqual(Char.ToLower(first.ParameterType.Name[0]) + first.ParameterType.Name.Substring(1), first.Name);
-
- ParameterInfo second = methodInfo.GetParameters()[1];
- Assert.AreEqual(typeof(System.Object), second.ParameterType);
- Assert.AreEqual("data", second.Name);
- }
- }
- }
- }
-}
diff --git a/main/contrib/NRefactory/Test/Lexer/CSharp/CustomLexerTests.cs b/main/contrib/NRefactory/Test/Lexer/CSharp/CustomLexerTests.cs
deleted file mode 100644
index 12d9cf5fea..0000000000
--- a/main/contrib/NRefactory/Test/Lexer/CSharp/CustomLexerTests.cs
+++ /dev/null
@@ -1,155 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 3715 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Parser.CSharp;
-using ICSharpCode.NRefactory.PrettyPrinter;
-
-namespace ICSharpCode.NRefactory.Tests.Lexer.CSharp
-{
- [TestFixture]
- public sealed class CustomLexerTests
- {
- ILexer GenerateLexer(StringReader sr)
- {
- return ParserFactory.CreateLexer(SupportedLanguage.CSharp, sr);
- }
-
- [Test]
- public void TestEmptyBlock()
- {
- ILexer lexer = GenerateLexer(new StringReader("{}+"));
- Assert.AreEqual(Tokens.OpenCurlyBrace, lexer.NextToken().Kind);
- Assert.AreEqual(Tokens.CloseCurlyBrace, lexer.NextToken().Kind);
- Assert.AreEqual(Tokens.Plus, lexer.NextToken().Kind);
- Assert.AreEqual(Tokens.EOF, lexer.NextToken().Kind);
- }
-
- void CheckIdentifier(string text, string actualIdentifier)
- {
- ILexer lexer = GenerateLexer(new StringReader(text));
- Token t = lexer.NextToken();
- Assert.AreEqual(Tokens.Identifier, t.Kind);
- Assert.AreEqual(actualIdentifier, t.Value);
- t = lexer.NextToken();
- Assert.AreEqual(Tokens.EOF, t.Kind);
- Assert.AreEqual("", lexer.Errors.ErrorOutput);
- }
-
- [Test]
- public void TestYieldAsIdentifier()
- {
- ILexer lexer = GenerateLexer(new StringReader("yield"));
- Token t = lexer.NextToken();
- Assert.AreEqual(Tokens.Yield, t.Kind);
- Assert.IsTrue(Tokens.IdentifierTokens[t.Kind]);
- Assert.AreEqual("yield", t.Value);
- }
-
- [Test]
- public void TestIdentifier()
- {
- CheckIdentifier("a_Bc05", "a_Bc05");
- }
-
- [Test]
- public void TestIdentifierStartingWithUnderscore()
- {
- CheckIdentifier("_Bc05", "_Bc05");
- }
-
- [Test]
- public void TestIdentifierStartingWithEscapeSequence()
- {
- CheckIdentifier(@"\u006cexer", "lexer");
- }
-
- [Test]
- public void TestIdentifierContainingEscapeSequence()
- {
- CheckIdentifier(@"l\U00000065xer", "lexer");
- }
-
- [Test]
- public void TestKeyWordAsIdentifier()
- {
- CheckIdentifier("@int", "int");
- }
-
- [Test]
- public void TestKeywordWithEscapeSequenceIsIdentifier()
- {
- CheckIdentifier(@"i\u006et", "int");
- }
-
- [Test]
- public void TestKeyWordAsIdentifierStartingWithUnderscore()
- {
- CheckIdentifier("@_int", "_int");
- }
-
- [Test]
- public void TestSkippedEmptyBlock()
- {
- ILexer lexer = GenerateLexer(new StringReader("{}+"));
- Assert.AreEqual(Tokens.OpenCurlyBrace, lexer.NextToken().Kind);
- lexer.NextToken();
- lexer.SkipCurrentBlock(Tokens.CloseCurlyBrace);
- Assert.AreEqual(Tokens.CloseCurlyBrace, lexer.LookAhead.Kind);
- Assert.AreEqual(Tokens.Plus, lexer.NextToken().Kind);
- Assert.AreEqual(Tokens.EOF, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestSkippedNonEmptyBlock()
- {
- ILexer lexer = GenerateLexer(new StringReader("{ TestMethod('}'); /* }}} */ while(1) {break;} }+"));
- Assert.AreEqual(Tokens.OpenCurlyBrace, lexer.NextToken().Kind);
- lexer.NextToken();
- lexer.SkipCurrentBlock(Tokens.CloseCurlyBrace);
- Assert.AreEqual(Tokens.CloseCurlyBrace, lexer.LookAhead.Kind);
- Assert.AreEqual(Tokens.Plus, lexer.NextToken().Kind);
- Assert.AreEqual(Tokens.EOF, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestSkippedNonEmptyBlockWithPeek()
- {
- ILexer lexer = GenerateLexer(new StringReader("{ TestMethod(\"}\"); // }}}\n" +
- "while(1) {break;} }+"));
- Assert.AreEqual(Tokens.OpenCurlyBrace, lexer.NextToken().Kind);
- lexer.NextToken();
- lexer.StartPeek();
- lexer.Peek();
- lexer.Peek();
- lexer.Peek();
- lexer.SkipCurrentBlock(Tokens.CloseCurlyBrace);
- Assert.AreEqual(Tokens.CloseCurlyBrace, lexer.LookAhead.Kind);
- Assert.AreEqual(Tokens.Plus, lexer.NextToken().Kind);
- Assert.AreEqual(Tokens.EOF, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestSkippedEmptyBlockWithPeek()
- {
- ILexer lexer = GenerateLexer(new StringReader("{}+"));
- Assert.AreEqual(Tokens.OpenCurlyBrace, lexer.NextToken().Kind);
- lexer.NextToken();
- lexer.StartPeek();
- lexer.Peek();
- lexer.Peek();
- lexer.Peek();
- lexer.SkipCurrentBlock(Tokens.CloseCurlyBrace);
- Assert.AreEqual(Tokens.CloseCurlyBrace, lexer.LookAhead.Kind);
- Assert.AreEqual(Tokens.Plus, lexer.NextToken().Kind);
- Assert.AreEqual(Tokens.EOF, lexer.NextToken().Kind);
- }
- }
-}
diff --git a/main/contrib/NRefactory/Test/Lexer/CSharp/LexerPositionTests.cs b/main/contrib/NRefactory/Test/Lexer/CSharp/LexerPositionTests.cs
deleted file mode 100644
index 209c54b0d4..0000000000
--- a/main/contrib/NRefactory/Test/Lexer/CSharp/LexerPositionTests.cs
+++ /dev/null
@@ -1,237 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="none" email=""/>
-// <version>$Revision: 3715 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Parser.CSharp;
-using ICSharpCode.NRefactory.PrettyPrinter;
-
-namespace ICSharpCode.NRefactory.Tests.Lexer.CSharp
-{
- [TestFixture]
- public class LexerPositionTests
- {
- ILexer GenerateLexer(string s)
- {
- return ParserFactory.CreateLexer(SupportedLanguage.CSharp, new StringReader(s));
- }
-
- [Test]
- public void Test1()
- {
- ILexer l = GenerateLexer("public");
- Token t = l.NextToken();
- Assert.AreEqual(new Location(1, 1), t.Location);
- }
-
- [Test]
- public void Test2()
- {
- ILexer l = GenerateLexer("public static");
- Token t = l.NextToken();
- t = l.NextToken();
- Assert.AreEqual(new Location(8, 1), t.Location);
- }
-
- [Test]
- public void TestNewLine()
- {
- ILexer l = GenerateLexer("public\nstatic");
- Token t = l.NextToken();
- Assert.AreEqual(Tokens.Public, t.Kind);
- Assert.AreEqual(new Location(1, 1), t.Location);
- Assert.AreEqual(new Location(7, 1), t.EndLocation);
- t = l.NextToken();
- Assert.AreEqual(Tokens.Static, t.Kind);
- Assert.AreEqual(new Location(1, 2), t.Location);
- Assert.AreEqual(new Location(7, 2), t.EndLocation);
- }
-
- [Test]
- public void TestCarriageReturnNewLine()
- {
- ILexer l = GenerateLexer("public\r\nstatic");
- Token t = l.NextToken();
- Assert.AreEqual(Tokens.Public, t.Kind);
- Assert.AreEqual(new Location(1, 1), t.Location);
- Assert.AreEqual(new Location(7, 1), t.EndLocation);
- t = l.NextToken();
- Assert.AreEqual(Tokens.Static, t.Kind);
- Assert.AreEqual(new Location(1, 2), t.Location);
- Assert.AreEqual(new Location(7, 2), t.EndLocation);
- }
-
- [Test]
- public void TestSpace()
- {
- ILexer l = GenerateLexer(" public");
- Token t = l.NextToken();
- Assert.AreEqual(new Location(3, 1), t.Location);
- }
-
- [Test]
- public void TestOctNumber()
- {
- ILexer l = GenerateLexer("0142");
- Token t = l.NextToken();
- Assert.AreEqual(new Location(1, 1), t.Location);
- }
-
- [Test]
- public void TestHexNumber()
- {
- ILexer l = GenerateLexer("0x142 public");
- Token t = l.NextToken();
- Assert.AreEqual(new Location(1, 1), t.Location);
- t = l.NextToken();
- Assert.AreEqual(new Location(7, 1), t.Location);
- }
-
- [Test]
- public void TestHexNumberChar()
- {
- ILexer l = GenerateLexer("\'\\x224\' public");
- Token t = l.NextToken();
- Assert.AreEqual(new Location(1, 1), t.Location);
- t = l.NextToken();
- Assert.AreEqual(new Location(9, 1), t.Location);
- }
-
- [Test]
- public void TestFloationPointNumber()
- {
- ILexer l = GenerateLexer("0.142 public");
- Token t = l.NextToken();
- Assert.AreEqual(new Location(1, 1), t.Location);
- t = l.NextToken();
- Assert.AreEqual(new Location(7, 1), t.Location);
- }
-
- [Test]
- public void TestVerbatimString()
- {
- ILexer l = GenerateLexer("@\"a\"\"a\" public");
- Token t = l.NextToken();
- Assert.AreEqual(new Location(1, 1), t.Location);
- t = l.NextToken();
- Assert.AreEqual(new Location(9, 1), t.Location);
- }
-
- [Test]
- public void TestAtIdent()
- {
- ILexer l = GenerateLexer("@public =");
- Token t = l.NextToken();
- Assert.AreEqual(new Location(1, 1), t.Location);
- t = l.NextToken();
- Assert.AreEqual(new Location(9, 1), t.Location);
- }
-
- [Test]
- public void TestNoFloationPointNumber()
- {
- ILexer l = GenerateLexer("5.a");
- Token t = l.NextToken();
- Assert.AreEqual(new Location(1, 1), t.Location);
- t = l.NextToken();
- Assert.AreEqual(new Location(2, 1), t.Location);
- t = l.NextToken();
- Assert.AreEqual(new Location(3, 1), t.Location);
- }
-
- [Test]
- public void TestNumber()
- {
- ILexer l = GenerateLexer("142\nstatic");
- Token t = l.NextToken();
- t = l.NextToken();
- Assert.AreEqual(new Location(1, 2), t.Location);
- }
-
- [Test]
- public void TestNumber2()
- {
- ILexer l = GenerateLexer("14 static");
- Token t = l.NextToken();
- t = l.NextToken();
- Assert.AreEqual(new Location(4, 1), t.Location);
- }
-
- [Test]
- public void TestOperator()
- {
- ILexer l = GenerateLexer("<<=");
- Token t = l.NextToken();
- Assert.AreEqual(new Location(1, 1), t.Location);
- Assert.AreEqual(Tokens.EOF, l.NextToken().Kind);
- }
-
- [Test]
- public void TestPositionLineBreakAfterApostrophe()
- {
- // see SD2-1469
- // the expression finder requires correct positions even when there are syntax errors
- ILexer l = GenerateLexer("'\r\nvoid");
- Token t = l.NextToken();
- // the incomplete char literal should not generate a token
- Assert.AreEqual(Tokens.Void, t.Kind);
- Assert.AreEqual(new Location(1, 2), t.Location);
- Assert.AreEqual(Tokens.EOF, l.NextToken().Kind);
- }
-
- [Test]
- public void TestPositionMissingEndApostrophe()
- {
- // see SD2-1469
- // the expression finder requires correct positions even when there are syntax errors
- ILexer l = GenerateLexer("'a\nvoid");
- Token t = l.NextToken();
- Assert.AreEqual(Tokens.Literal, t.Kind);
- Assert.AreEqual(new Location(1, 1), t.Location);
- t = l.NextToken();
- Assert.AreEqual(Tokens.Void, t.Kind);
- Assert.AreEqual(new Location(1, 2), t.Location);
- Assert.AreEqual(Tokens.EOF, l.NextToken().Kind);
- }
-
- [Test]
- public void TestPositionLineBreakAfterAt()
- {
- // the expression finder requires correct positions even when there are syntax errors
- ILexer l = GenerateLexer("@\nvoid");
- Token t = l.NextToken();
- Assert.AreEqual(Tokens.Void, t.Kind);
- Assert.AreEqual(new Location(1, 2), t.Location);
- Assert.AreEqual(Tokens.EOF, l.NextToken().Kind);
- }
-
- [Test]
- public void TestPositionLineBreakInsideString()
- {
- // the expression finder requires correct positions even when there are syntax errors
- ILexer l = GenerateLexer("\"\nvoid");
- Token t = l.NextToken();
- Assert.AreEqual(Tokens.Literal, t.Kind);
- Assert.AreEqual(new Location(1, 1), t.Location);
- t = l.NextToken();
- Assert.AreEqual(Tokens.Void, t.Kind);
- Assert.AreEqual(new Location(1, 2), t.Location);
- Assert.AreEqual(Tokens.EOF, l.NextToken().Kind);
- }
-
- [Test]
- public void MultilineString()
- {
- ILexer l = GenerateLexer("@\"\r\n\"");
- Token t = l.NextToken();
- Assert.AreEqual(new Location(1, 1), t.Location);
- Assert.AreEqual(new Location(2, 2), t.EndLocation);
- }
- }
-}
diff --git a/main/contrib/NRefactory/Test/Lexer/CSharp/LexerTests.cs b/main/contrib/NRefactory/Test/Lexer/CSharp/LexerTests.cs
deleted file mode 100644
index ac1d39361e..0000000000
--- a/main/contrib/NRefactory/Test/Lexer/CSharp/LexerTests.cs
+++ /dev/null
@@ -1,900 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="none" email=""/>
-// <version>$Revision: 3715 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Parser.CSharp;
-using ICSharpCode.NRefactory.PrettyPrinter;
-
-namespace ICSharpCode.NRefactory.Tests.Lexer.CSharp
-{
- [TestFixture]
- public sealed class LexerTests
- {
- ILexer GenerateLexer(StringReader sr)
- {
- return ParserFactory.CreateLexer(SupportedLanguage.CSharp, sr);
- }
-
- [Test]
- public void TestAssign()
- {
- ILexer lexer = GenerateLexer(new StringReader("="));
- Assert.AreEqual(Tokens.Assign, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestPlus()
- {
- ILexer lexer = GenerateLexer(new StringReader("+"));
- Assert.AreEqual(Tokens.Plus, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestMinus()
- {
- ILexer lexer = GenerateLexer(new StringReader("-"));
- Assert.AreEqual(Tokens.Minus, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestTimes()
- {
- ILexer lexer = GenerateLexer(new StringReader("*"));
- Assert.AreEqual(Tokens.Times, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestDiv()
- {
- ILexer lexer = GenerateLexer(new StringReader("/"));
- Assert.AreEqual(Tokens.Div, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestMod()
- {
- ILexer lexer = GenerateLexer(new StringReader("%"));
- Assert.AreEqual(Tokens.Mod, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestColon()
- {
- ILexer lexer = GenerateLexer(new StringReader(":"));
- Assert.AreEqual(Tokens.Colon, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestDoubleColon()
- {
- ILexer lexer = GenerateLexer(new StringReader("::"));
- Assert.AreEqual(Tokens.DoubleColon, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestSemicolon()
- {
- ILexer lexer = GenerateLexer(new StringReader(";"));
- Assert.AreEqual(Tokens.Semicolon, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestQuestion()
- {
- ILexer lexer = GenerateLexer(new StringReader("?"));
- Assert.AreEqual(Tokens.Question, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestDoubleQuestion()
- {
- ILexer lexer = GenerateLexer(new StringReader("??"));
- Assert.AreEqual(Tokens.DoubleQuestion, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestComma()
- {
- ILexer lexer = GenerateLexer(new StringReader(","));
- Assert.AreEqual(Tokens.Comma, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestDot()
- {
- ILexer lexer = GenerateLexer(new StringReader("."));
- Assert.AreEqual(Tokens.Dot, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestOpenCurlyBrace()
- {
- ILexer lexer = GenerateLexer(new StringReader("{"));
- Assert.AreEqual(Tokens.OpenCurlyBrace, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestCloseCurlyBrace()
- {
- ILexer lexer = GenerateLexer(new StringReader("}"));
- Assert.AreEqual(Tokens.CloseCurlyBrace, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestOpenSquareBracket()
- {
- ILexer lexer = GenerateLexer(new StringReader("["));
- Assert.AreEqual(Tokens.OpenSquareBracket, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestCloseSquareBracket()
- {
- ILexer lexer = GenerateLexer(new StringReader("]"));
- Assert.AreEqual(Tokens.CloseSquareBracket, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestOpenParenthesis()
- {
- ILexer lexer = GenerateLexer(new StringReader("("));
- Assert.AreEqual(Tokens.OpenParenthesis, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestCloseParenthesis()
- {
- ILexer lexer = GenerateLexer(new StringReader(")"));
- Assert.AreEqual(Tokens.CloseParenthesis, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestGreaterThan()
- {
- ILexer lexer = GenerateLexer(new StringReader(">"));
- Assert.AreEqual(Tokens.GreaterThan, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestLessThan()
- {
- ILexer lexer = GenerateLexer(new StringReader("<"));
- Assert.AreEqual(Tokens.LessThan, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestNot()
- {
- ILexer lexer = GenerateLexer(new StringReader("!"));
- Assert.AreEqual(Tokens.Not, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestLogicalAnd()
- {
- ILexer lexer = GenerateLexer(new StringReader("&&"));
- Assert.AreEqual(Tokens.LogicalAnd, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestLogicalOr()
- {
- ILexer lexer = GenerateLexer(new StringReader("||"));
- Assert.AreEqual(Tokens.LogicalOr, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestBitwiseComplement()
- {
- ILexer lexer = GenerateLexer(new StringReader("~"));
- Assert.AreEqual(Tokens.BitwiseComplement, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestBitwiseAnd()
- {
- ILexer lexer = GenerateLexer(new StringReader("&"));
- Assert.AreEqual(Tokens.BitwiseAnd, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestBitwiseOr()
- {
- ILexer lexer = GenerateLexer(new StringReader("|"));
- Assert.AreEqual(Tokens.BitwiseOr, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestXor()
- {
- ILexer lexer = GenerateLexer(new StringReader("^"));
- Assert.AreEqual(Tokens.Xor, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestIncrement()
- {
- ILexer lexer = GenerateLexer(new StringReader("++"));
- Assert.AreEqual(Tokens.Increment, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestDecrement()
- {
- ILexer lexer = GenerateLexer(new StringReader("--"));
- Assert.AreEqual(Tokens.Decrement, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestEqual()
- {
- ILexer lexer = GenerateLexer(new StringReader("=="));
- Assert.AreEqual(Tokens.Equal, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestNotEqual()
- {
- ILexer lexer = GenerateLexer(new StringReader("!="));
- Assert.AreEqual(Tokens.NotEqual, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestGreaterEqual()
- {
- ILexer lexer = GenerateLexer(new StringReader(">="));
- Assert.AreEqual(Tokens.GreaterEqual, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestLessEqual()
- {
- ILexer lexer = GenerateLexer(new StringReader("<="));
- Assert.AreEqual(Tokens.LessEqual, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestShiftLeft()
- {
- ILexer lexer = GenerateLexer(new StringReader("<<"));
- Assert.AreEqual(Tokens.ShiftLeft, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestPlusAssign()
- {
- ILexer lexer = GenerateLexer(new StringReader("+="));
- Assert.AreEqual(Tokens.PlusAssign, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestMinusAssign()
- {
- ILexer lexer = GenerateLexer(new StringReader("-="));
- Assert.AreEqual(Tokens.MinusAssign, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestTimesAssign()
- {
- ILexer lexer = GenerateLexer(new StringReader("*="));
- Assert.AreEqual(Tokens.TimesAssign, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestDivAssign()
- {
- ILexer lexer = GenerateLexer(new StringReader("/="));
- Assert.AreEqual(Tokens.DivAssign, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestModAssign()
- {
- ILexer lexer = GenerateLexer(new StringReader("%="));
- Assert.AreEqual(Tokens.ModAssign, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestBitwiseAndAssign()
- {
- ILexer lexer = GenerateLexer(new StringReader("&="));
- Assert.AreEqual(Tokens.BitwiseAndAssign, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestBitwiseOrAssign()
- {
- ILexer lexer = GenerateLexer(new StringReader("|="));
- Assert.AreEqual(Tokens.BitwiseOrAssign, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestXorAssign()
- {
- ILexer lexer = GenerateLexer(new StringReader("^="));
- Assert.AreEqual(Tokens.XorAssign, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestShiftLeftAssign()
- {
- ILexer lexer = GenerateLexer(new StringReader("<<="));
- Assert.AreEqual(Tokens.ShiftLeftAssign, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestPointer()
- {
- ILexer lexer = GenerateLexer(new StringReader("->"));
- Assert.AreEqual(Tokens.Pointer, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestLambdaArrow()
- {
- ILexer lexer = GenerateLexer(new StringReader("=>"));
- Assert.AreEqual(Tokens.LambdaArrow, lexer.NextToken().Kind);
- }
-
- [Test()]
- public void TestAbstract()
- {
- ILexer lexer = GenerateLexer(new StringReader("abstract"));
- Assert.AreEqual(Tokens.Abstract, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestAs()
- {
- ILexer lexer = GenerateLexer(new StringReader("as"));
- Assert.AreEqual(Tokens.As, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestBase()
- {
- ILexer lexer = GenerateLexer(new StringReader("base"));
- Assert.AreEqual(Tokens.Base, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestBool()
- {
- ILexer lexer = GenerateLexer(new StringReader("bool"));
- Assert.AreEqual(Tokens.Bool, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestBreak()
- {
- ILexer lexer = GenerateLexer(new StringReader("break"));
- Assert.AreEqual(Tokens.Break, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestByte()
- {
- ILexer lexer = GenerateLexer(new StringReader("byte"));
- Assert.AreEqual(Tokens.Byte, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestCase()
- {
- ILexer lexer = GenerateLexer(new StringReader("case"));
- Assert.AreEqual(Tokens.Case, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestCatch()
- {
- ILexer lexer = GenerateLexer(new StringReader("catch"));
- Assert.AreEqual(Tokens.Catch, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestChar()
- {
- ILexer lexer = GenerateLexer(new StringReader("char"));
- Assert.AreEqual(Tokens.Char, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestChecked()
- {
- ILexer lexer = GenerateLexer(new StringReader("checked"));
- Assert.AreEqual(Tokens.Checked, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestClass()
- {
- ILexer lexer = GenerateLexer(new StringReader("class"));
- Assert.AreEqual(Tokens.Class, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestConst()
- {
- ILexer lexer = GenerateLexer(new StringReader("const"));
- Assert.AreEqual(Tokens.Const, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestContinue()
- {
- ILexer lexer = GenerateLexer(new StringReader("continue"));
- Assert.AreEqual(Tokens.Continue, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestDecimal()
- {
- ILexer lexer = GenerateLexer(new StringReader("decimal"));
- Assert.AreEqual(Tokens.Decimal, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestDefault()
- {
- ILexer lexer = GenerateLexer(new StringReader("default"));
- Assert.AreEqual(Tokens.Default, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestDelegate()
- {
- ILexer lexer = GenerateLexer(new StringReader("delegate"));
- Assert.AreEqual(Tokens.Delegate, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestDo()
- {
- ILexer lexer = GenerateLexer(new StringReader("do"));
- Assert.AreEqual(Tokens.Do, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestDouble()
- {
- ILexer lexer = GenerateLexer(new StringReader("double"));
- Assert.AreEqual(Tokens.Double, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestElse()
- {
- ILexer lexer = GenerateLexer(new StringReader("else"));
- Assert.AreEqual(Tokens.Else, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestEnum()
- {
- ILexer lexer = GenerateLexer(new StringReader("enum"));
- Assert.AreEqual(Tokens.Enum, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestEvent()
- {
- ILexer lexer = GenerateLexer(new StringReader("event"));
- Assert.AreEqual(Tokens.Event, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestExplicit()
- {
- ILexer lexer = GenerateLexer(new StringReader("explicit"));
- Assert.AreEqual(Tokens.Explicit, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestExtern()
- {
- ILexer lexer = GenerateLexer(new StringReader("extern"));
- Assert.AreEqual(Tokens.Extern, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestFalse()
- {
- ILexer lexer = GenerateLexer(new StringReader("false"));
- Assert.AreEqual(Tokens.False, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestFinally()
- {
- ILexer lexer = GenerateLexer(new StringReader("finally"));
- Assert.AreEqual(Tokens.Finally, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestFixed()
- {
- ILexer lexer = GenerateLexer(new StringReader("fixed"));
- Assert.AreEqual(Tokens.Fixed, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestFloat()
- {
- ILexer lexer = GenerateLexer(new StringReader("float"));
- Assert.AreEqual(Tokens.Float, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestFor()
- {
- ILexer lexer = GenerateLexer(new StringReader("for"));
- Assert.AreEqual(Tokens.For, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestForeach()
- {
- ILexer lexer = GenerateLexer(new StringReader("foreach"));
- Assert.AreEqual(Tokens.Foreach, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestGoto()
- {
- ILexer lexer = GenerateLexer(new StringReader("goto"));
- Assert.AreEqual(Tokens.Goto, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestIf()
- {
- ILexer lexer = GenerateLexer(new StringReader("if"));
- Assert.AreEqual(Tokens.If, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestImplicit()
- {
- ILexer lexer = GenerateLexer(new StringReader("implicit"));
- Assert.AreEqual(Tokens.Implicit, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestIn()
- {
- ILexer lexer = GenerateLexer(new StringReader("in"));
- Assert.AreEqual(Tokens.In, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestInt()
- {
- ILexer lexer = GenerateLexer(new StringReader("int"));
- Assert.AreEqual(Tokens.Int, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestInterface()
- {
- ILexer lexer = GenerateLexer(new StringReader("interface"));
- Assert.AreEqual(Tokens.Interface, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestInternal()
- {
- ILexer lexer = GenerateLexer(new StringReader("internal"));
- Assert.AreEqual(Tokens.Internal, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestIs()
- {
- ILexer lexer = GenerateLexer(new StringReader("is"));
- Assert.AreEqual(Tokens.Is, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestLock()
- {
- ILexer lexer = GenerateLexer(new StringReader("lock"));
- Assert.AreEqual(Tokens.Lock, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestLong()
- {
- ILexer lexer = GenerateLexer(new StringReader("long"));
- Assert.AreEqual(Tokens.Long, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestNamespace()
- {
- ILexer lexer = GenerateLexer(new StringReader("namespace"));
- Assert.AreEqual(Tokens.Namespace, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestNew()
- {
- ILexer lexer = GenerateLexer(new StringReader("new"));
- Assert.AreEqual(Tokens.New, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestNull()
- {
- ILexer lexer = GenerateLexer(new StringReader("null"));
- Assert.AreEqual(Tokens.Null, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestObject()
- {
- ILexer lexer = GenerateLexer(new StringReader("object"));
- Assert.AreEqual(Tokens.Object, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestOperator()
- {
- ILexer lexer = GenerateLexer(new StringReader("operator"));
- Assert.AreEqual(Tokens.Operator, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestOut()
- {
- ILexer lexer = GenerateLexer(new StringReader("out"));
- Assert.AreEqual(Tokens.Out, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestOverride()
- {
- ILexer lexer = GenerateLexer(new StringReader("override"));
- Assert.AreEqual(Tokens.Override, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestParams()
- {
- ILexer lexer = GenerateLexer(new StringReader("params"));
- Assert.AreEqual(Tokens.Params, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestPrivate()
- {
- ILexer lexer = GenerateLexer(new StringReader("private"));
- Assert.AreEqual(Tokens.Private, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestProtected()
- {
- ILexer lexer = GenerateLexer(new StringReader("protected"));
- Assert.AreEqual(Tokens.Protected, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestPublic()
- {
- ILexer lexer = GenerateLexer(new StringReader("public"));
- Assert.AreEqual(Tokens.Public, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestReadonly()
- {
- ILexer lexer = GenerateLexer(new StringReader("readonly"));
- Assert.AreEqual(Tokens.Readonly, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestRef()
- {
- ILexer lexer = GenerateLexer(new StringReader("ref"));
- Assert.AreEqual(Tokens.Ref, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestReturn()
- {
- ILexer lexer = GenerateLexer(new StringReader("return"));
- Assert.AreEqual(Tokens.Return, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestSbyte()
- {
- ILexer lexer = GenerateLexer(new StringReader("sbyte"));
- Assert.AreEqual(Tokens.Sbyte, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestSealed()
- {
- ILexer lexer = GenerateLexer(new StringReader("sealed"));
- Assert.AreEqual(Tokens.Sealed, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestShort()
- {
- ILexer lexer = GenerateLexer(new StringReader("short"));
- Assert.AreEqual(Tokens.Short, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestSizeof()
- {
- ILexer lexer = GenerateLexer(new StringReader("sizeof"));
- Assert.AreEqual(Tokens.Sizeof, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestStackalloc()
- {
- ILexer lexer = GenerateLexer(new StringReader("stackalloc"));
- Assert.AreEqual(Tokens.Stackalloc, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestStatic()
- {
- ILexer lexer = GenerateLexer(new StringReader("static"));
- Assert.AreEqual(Tokens.Static, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestString()
- {
- ILexer lexer = GenerateLexer(new StringReader("string"));
- Assert.AreEqual(Tokens.String, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestStruct()
- {
- ILexer lexer = GenerateLexer(new StringReader("struct"));
- Assert.AreEqual(Tokens.Struct, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestSwitch()
- {
- ILexer lexer = GenerateLexer(new StringReader("switch"));
- Assert.AreEqual(Tokens.Switch, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestThis()
- {
- ILexer lexer = GenerateLexer(new StringReader("this"));
- Assert.AreEqual(Tokens.This, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestThrow()
- {
- ILexer lexer = GenerateLexer(new StringReader("throw"));
- Assert.AreEqual(Tokens.Throw, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestTrue()
- {
- ILexer lexer = GenerateLexer(new StringReader("true"));
- Assert.AreEqual(Tokens.True, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestTry()
- {
- ILexer lexer = GenerateLexer(new StringReader("try"));
- Assert.AreEqual(Tokens.Try, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestTypeof()
- {
- ILexer lexer = GenerateLexer(new StringReader("typeof"));
- Assert.AreEqual(Tokens.Typeof, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestUint()
- {
- ILexer lexer = GenerateLexer(new StringReader("uint"));
- Assert.AreEqual(Tokens.Uint, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestUlong()
- {
- ILexer lexer = GenerateLexer(new StringReader("ulong"));
- Assert.AreEqual(Tokens.Ulong, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestUnchecked()
- {
- ILexer lexer = GenerateLexer(new StringReader("unchecked"));
- Assert.AreEqual(Tokens.Unchecked, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestUnsafe()
- {
- ILexer lexer = GenerateLexer(new StringReader("unsafe"));
- Assert.AreEqual(Tokens.Unsafe, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestUshort()
- {
- ILexer lexer = GenerateLexer(new StringReader("ushort"));
- Assert.AreEqual(Tokens.Ushort, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestUsing()
- {
- ILexer lexer = GenerateLexer(new StringReader("using"));
- Assert.AreEqual(Tokens.Using, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestVirtual()
- {
- ILexer lexer = GenerateLexer(new StringReader("virtual"));
- Assert.AreEqual(Tokens.Virtual, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestVoid()
- {
- ILexer lexer = GenerateLexer(new StringReader("void"));
- Assert.AreEqual(Tokens.Void, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestVolatile()
- {
- ILexer lexer = GenerateLexer(new StringReader("volatile"));
- Assert.AreEqual(Tokens.Volatile, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestWhile()
- {
- ILexer lexer = GenerateLexer(new StringReader("while"));
- Assert.AreEqual(Tokens.While, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestPartial()
- {
- ILexer lexer = GenerateLexer(new StringReader("partial"));
- Assert.AreEqual(Tokens.Partial, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestWhere()
- {
- ILexer lexer = GenerateLexer(new StringReader("where"));
- Assert.AreEqual(Tokens.Where, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestGet()
- {
- ILexer lexer = GenerateLexer(new StringReader("get"));
- Assert.AreEqual(Tokens.Get, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestSet()
- {
- ILexer lexer = GenerateLexer(new StringReader("set"));
- Assert.AreEqual(Tokens.Set, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestAdd()
- {
- ILexer lexer = GenerateLexer(new StringReader("add"));
- Assert.AreEqual(Tokens.Add, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestRemove()
- {
- ILexer lexer = GenerateLexer(new StringReader("remove"));
- Assert.AreEqual(Tokens.Remove, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestYield()
- {
- ILexer lexer = GenerateLexer(new StringReader("yield"));
- Assert.AreEqual(Tokens.Yield, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestSelect()
- {
- ILexer lexer = GenerateLexer(new StringReader("select"));
- Assert.AreEqual(Tokens.Select, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestGroup()
- {
- ILexer lexer = GenerateLexer(new StringReader("group"));
- Assert.AreEqual(Tokens.Group, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestBy()
- {
- ILexer lexer = GenerateLexer(new StringReader("by"));
- Assert.AreEqual(Tokens.By, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestInto()
- {
- ILexer lexer = GenerateLexer(new StringReader("into"));
- Assert.AreEqual(Tokens.Into, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestFrom()
- {
- ILexer lexer = GenerateLexer(new StringReader("from"));
- Assert.AreEqual(Tokens.From, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestAscending()
- {
- ILexer lexer = GenerateLexer(new StringReader("ascending"));
- Assert.AreEqual(Tokens.Ascending, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestDescending()
- {
- ILexer lexer = GenerateLexer(new StringReader("descending"));
- Assert.AreEqual(Tokens.Descending, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestOrderby()
- {
- ILexer lexer = GenerateLexer(new StringReader("orderby"));
- Assert.AreEqual(Tokens.Orderby, lexer.NextToken().Kind);
- }
- }
-}
diff --git a/main/contrib/NRefactory/Test/Lexer/CSharp/NumberLexerTest.cs b/main/contrib/NRefactory/Test/Lexer/CSharp/NumberLexerTest.cs
deleted file mode 100644
index 0c485201f8..0000000000
--- a/main/contrib/NRefactory/Test/Lexer/CSharp/NumberLexerTest.cs
+++ /dev/null
@@ -1,181 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="none" email=""/>
-// <version>$Revision: 3715 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Parser.CSharp;
-using ICSharpCode.NRefactory.PrettyPrinter;
-
-namespace ICSharpCode.NRefactory.Tests.Lexer.CSharp
-{
- [TestFixture]
- public sealed class NumberLexerTests
- {
- ILexer GenerateLexer(StringReader sr)
- {
- return ParserFactory.CreateLexer(SupportedLanguage.CSharp, sr);
- }
-
- Token GetSingleToken(string text)
- {
- ILexer lexer = GenerateLexer(new StringReader(text));
- Token t = lexer.NextToken();
- Assert.AreEqual(Tokens.EOF, lexer.NextToken().Kind, "Tokens.EOF");
- Assert.AreEqual("", lexer.Errors.ErrorOutput);
- return t;
- }
-
- void CheckToken(string text, object val)
- {
- Token t = GetSingleToken(text);
- Assert.AreEqual(Tokens.Literal, t.Kind, "Tokens.Literal");
- Assert.AreEqual(text, t.Value, "value");
- Assert.IsNotNull(t.LiteralValue, "literalValue is null");
- Assert.AreEqual(val.GetType(), t.LiteralValue.GetType(), "literalValue.GetType()");
- Assert.AreEqual(val, t.LiteralValue, "literalValue");
- }
-
- [Test]
- public void TestSingleDigit()
- {
- CheckToken("5", 5);
- }
-
- [Test]
- public void TestZero()
- {
- CheckToken("0", 0);
- }
-
- [Test]
- public void TestInteger()
- {
- CheckToken("66", 66);
- }
-
- [Test]
- public void TestNonOctalInteger()
- {
- // C# does not have octal integers, so 077 should parse to 77
- Assert.IsTrue(077 == 77);
-
- CheckToken("077", 077);
- CheckToken("056", 056);
- }
-
- [Test]
- public void TestHexadecimalInteger()
- {
- CheckToken("0x99F", 0x99F);
- CheckToken("0xAB1f", 0xAB1f);
- CheckToken("0xffffffff", 0xffffffff);
- CheckToken("0xffffffffL", 0xffffffffL);
- CheckToken("0xffffffffuL", 0xffffffffuL);
- }
-
- [Test]
- public void InvalidHexadecimalInteger()
- {
- // don't check result, just make sure there is no exception
- GenerateLexer(new StringReader("0x2GF")).NextToken();
- GenerateLexer(new StringReader("0xG2F")).NextToken();
- // SD2-457
- GenerateLexer(new StringReader("0x")).NextToken();
- // hexadecimal integer >ulong.MaxValue
- GenerateLexer(new StringReader("0xfedcba98765432100")).NextToken();
- }
-
- [Test]
- public void TestLongHexadecimalInteger()
- {
- CheckToken("0x4244636f446c6d58", 0x4244636f446c6d58);
- CheckToken("0xf244636f446c6d58", 0xf244636f446c6d58);
- }
-
- [Test]
- public void TestLongInteger()
- {
- CheckToken("9223372036854775807", 9223372036854775807); // long.MaxValue
- CheckToken("9223372036854775808", 9223372036854775808); // long.MaxValue+1
- CheckToken("18446744073709551615", 18446744073709551615); // ulong.MaxValue
- CheckToken("18446744073709551616f", 18446744073709551616f); // ulong.MaxValue+1 as float
- CheckToken("18446744073709551616d", 18446744073709551616d); // ulong.MaxValue+1 as double
- CheckToken("18446744073709551616m", 18446744073709551616m); // ulong.MaxValue+1 as decimal
- }
-
- [Test]
- public void TestDouble()
- {
- CheckToken("1.0", 1.0);
- CheckToken("1.1", 1.1);
- CheckToken("1.1e-2", 1.1e-2);
- }
-
- [Test]
- public void TestFloat()
- {
- CheckToken("1f", 1f);
- CheckToken("1.0f", 1.0f);
- CheckToken("1.1f", 1.1f);
- CheckToken("1.1e-2f", 1.1e-2f);
- }
-
- [Test]
- public void TestDecimal()
- {
- CheckToken("1m", 1m);
- CheckToken("1.0m", 1.0m);
- CheckToken("1.1m", 1.1m);
- CheckToken("1.1e-2m", 1.1e-2m);
- CheckToken("2.0e-5m", 2.0e-5m);
- }
-
- [Test]
- public void TestString()
- {
- CheckToken(@"@""-->""""<--""", @"-->""<--");
- CheckToken(@"""-->\""<--""", "-->\"<--");
-
- CheckToken(@"""\U00000041""", "\U00000041");
- CheckToken(@"""\U00010041""", "\U00010041");
- }
-
- [Test]
- public void TestInvalidString()
- {
- // ensure that line numbers are correct after newline in string
- ILexer l = GenerateLexer(new StringReader("\"\n\"\n;"));
- Token t = l.NextToken();
- Assert.AreEqual(Tokens.Literal, t.Kind);
- Assert.AreEqual(new Location(1, 1), t.Location);
-
- t = l.NextToken();
- Assert.AreEqual(Tokens.Literal, t.Kind);
- Assert.AreEqual(new Location(1, 2), t.Location);
-
- t = l.NextToken();
- Assert.AreEqual(Tokens.Semicolon, t.Kind);
- Assert.AreEqual(new Location(1, 3), t.Location);
-
- t = l.NextToken();
- Assert.AreEqual(Tokens.EOF, t.Kind);
- }
-
- [Test]
- public void TestCharLiteral()
- {
- CheckToken(@"'a'", 'a');
- CheckToken(@"'\u0041'", '\u0041');
- CheckToken(@"'\x41'", '\x41');
- CheckToken(@"'\x041'", '\x041');
- CheckToken(@"'\x0041'", '\x0041');
- CheckToken(@"'\U00000041'", '\U00000041');
- }
- }
-}
diff --git a/main/contrib/NRefactory/Test/Lexer/CSharp/PreprocessingTests.cs b/main/contrib/NRefactory/Test/Lexer/CSharp/PreprocessingTests.cs
deleted file mode 100644
index 3e693592b5..0000000000
--- a/main/contrib/NRefactory/Test/Lexer/CSharp/PreprocessingTests.cs
+++ /dev/null
@@ -1,169 +0,0 @@
-// <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 System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Parser.CSharp;
-using ICSharpCode.NRefactory.PrettyPrinter;
-using NUnit.Framework.SyntaxHelpers;
-
-namespace ICSharpCode.NRefactory.Tests.Lexer.CSharp
-{
- [TestFixture]
- public class PreprocessingTests
- {
- ILexer GenerateLexer(string text)
- {
- ILexer lexer = ParserFactory.CreateLexer(SupportedLanguage.CSharp, new StringReader(text));
- lexer.EvaluateConditionalCompilation = true;
- lexer.ConditionalCompilationSymbols["TEST"] = null;
- return lexer;
- }
-
- int[] GetTokenKinds(string text)
- {
- List<int> list = new List<int>();
- ILexer lexer = GenerateLexer(text);
- Token token;
- while ((token = lexer.NextToken()) != null) {
- list.Add(token.Kind);
- if (token.Kind == Tokens.EOF)
- break;
- }
- Assert.AreEqual("", lexer.Errors.ErrorOutput);
- return list.ToArray();
- }
-
- [Test]
- public void TestEmptyIfdef()
- {
- Assert.AreEqual(new int[] { Tokens.Int, Tokens.EOF }, GetTokenKinds("#if true\n#endif\nint"));
- Assert.AreEqual(new int[] { Tokens.Int, Tokens.EOF }, GetTokenKinds("#if false\n#endif\nint"));
- }
-
- [Test]
- public void TestBooleanPrimitives()
- {
- Assert.AreEqual(new int[] { Tokens.True, Tokens.EOF }, GetTokenKinds("#if true \n true \n #else \n false \n #endif"));
- Assert.AreEqual(new int[] { Tokens.False, Tokens.EOF }, GetTokenKinds("#if false \n true \n #else \n false \n #endif"));
- }
-
- [Test]
- public void TestDefinedSymbols()
- {
- Assert.AreEqual(new int[] { Tokens.True, Tokens.EOF }, GetTokenKinds("#if TEST \n true \n #else \n false \n #endif"));
- Assert.AreEqual(new int[] { Tokens.False, Tokens.EOF }, GetTokenKinds("#if DEBUG \n true \n #else \n false \n #endif"));
- }
-
- [Test]
- public void TestDefineUndefineSymbol()
- {
- Assert.AreEqual(new int[] { Tokens.False, Tokens.EOF }, GetTokenKinds("#undef TEST \n #if TEST \n true \n #else \n false \n #endif"));
- Assert.AreEqual(new int[] { Tokens.True, Tokens.EOF }, GetTokenKinds("#define DEBUG \n #if DEBUG \n true \n #else \n false \n #endif"));
- Assert.AreEqual(new int[] { Tokens.True, Tokens.EOF }, GetTokenKinds("#define DEBUG // comment \n #if DEBUG \n true \n #else \n false \n #endif"));
- }
-
- [Test]
- public void TestNestedIfDef()
- {
- string program = @"
- #if A
- public
- #if B
- abstract
- #elif C
- virtual
- #endif
- void
- #elif B
- protected
- #if C // this is a comment
- sealed
- #endif
- string
- #else
- class
- #endif
- ";
- Assert.AreEqual(new int[] { Tokens.Class, Tokens.EOF }, GetTokenKinds(program));
- Assert.AreEqual(new int[] { Tokens.Public, Tokens.Void, Tokens.EOF }, GetTokenKinds("#define A\n" + program));
- Assert.AreEqual(new int[] { Tokens.Public, Tokens.Abstract, Tokens.Void, Tokens.EOF },
- GetTokenKinds("#define A\n#define B\n" + program));
- Assert.AreEqual(new int[] { Tokens.Public, Tokens.Virtual, Tokens.Void, Tokens.EOF },
- GetTokenKinds("#define A\n#define C\n" + program));
- Assert.AreEqual(new int[] { Tokens.Public, Tokens.Abstract, Tokens.Void, Tokens.EOF },
- GetTokenKinds("#define A\n#define B\n#define C\n" + program));
- Assert.AreEqual(new int[] { Tokens.Protected, Tokens.String, Tokens.EOF },
- GetTokenKinds("#define B\n" + program));
- Assert.AreEqual(new int[] { Tokens.Protected, Tokens.Sealed, Tokens.String, Tokens.EOF },
- GetTokenKinds("#define B\n#define C\n" + program));
- }
-
- [Test]
- public void TestDefineInIfDef()
- {
- string program = @"
- #if !A
- #define B
- class
- #else
- int
- #endif
- #if B
- struct
- #endif
- ";
- Assert.AreEqual(new int[] { Tokens.Class, Tokens.Struct, Tokens.EOF }, GetTokenKinds(program));
- Assert.AreEqual(new int[] { Tokens.Int, Tokens.EOF }, GetTokenKinds("#define A\n" + program));
- }
-
- [Test]
- public void TestMultilineCommentStartInIfDef()
- {
- string program = @"
- #if X
- struct
- /*
- #else
- /* */ class
- #endif
- ";
- Assert.AreEqual(new int[] { Tokens.Class, Tokens.EOF }, GetTokenKinds(program));
- Assert.AreEqual(new int[] { Tokens.Struct, Tokens.Class, Tokens.EOF }, GetTokenKinds("#define X\n" + program));
- }
-
- [Test]
- public void Region()
- {
- string program = @"
- #region Region Title
- ;
- #endregion
- ,";
- Assert.AreEqual(new int[] { Tokens.Semicolon, Tokens.Comma, Tokens.EOF }, GetTokenKinds(program));
- ILexer lexer = GenerateLexer(program);
- while (lexer.NextToken().Kind != Tokens.EOF);
- List<ISpecial> specials = lexer.SpecialTracker.RetrieveSpecials();
-
- Assert.IsTrue(specials[0] is BlankLine);
- Assert.AreEqual(new Location(2, 1), specials[0].StartPosition);
- Assert.AreEqual(new Location(2, 1), specials[0].EndPosition);
-
- Assert.AreEqual("#region", (specials[1] as PreprocessingDirective).Cmd);
- Assert.AreEqual("Region Title", (specials[1] as PreprocessingDirective).Arg);
- Assert.AreEqual(new Location(2, 2), specials[1].StartPosition);
- Assert.AreEqual(new Location(22, 2), specials[1].EndPosition);
-
- Assert.AreEqual("#endregion", (specials[2] as PreprocessingDirective).Cmd);
- Assert.AreEqual(new Location(2, 4), specials[2].StartPosition);
- Assert.AreEqual(new Location(12, 4), specials[2].EndPosition);
- }
- }
-}
diff --git a/main/contrib/NRefactory/Test/Lexer/VBNet/CustomLexerTests.cs b/main/contrib/NRefactory/Test/Lexer/VBNet/CustomLexerTests.cs
deleted file mode 100644
index 524771bfaf..0000000000
--- a/main/contrib/NRefactory/Test/Lexer/VBNet/CustomLexerTests.cs
+++ /dev/null
@@ -1,123 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 2658$</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using NUnit.Framework.SyntaxHelpers;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Parser.VB;
-namespace ICSharpCode.NRefactory.Tests.Lexer.VB
-{
- [TestFixture]
- public class CustomLexerTests
- {
- ILexer GenerateLexer(StringReader sr)
- {
- return ParserFactory.CreateLexer(SupportedLanguage.VBNet, sr);
- }
-
- [Test]
- public void TestSingleEOLForMulitpleLines()
- {
- ILexer lexer = GenerateLexer(new StringReader("Stop\n\n\nEnd"));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.Stop));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.EOL));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.End));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.EOL));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.EOF));
- }
-
- [Test]
- public void TestSingleEOLForMulitpleLinesWithContinuation()
- {
- ILexer lexer = GenerateLexer(new StringReader("Stop\n _\n\nEnd"));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.Stop));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.EOL));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.End));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.EOL));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.EOF));
- }
-
- [Test]
- public void EscapedIdentifier()
- {
- ILexer lexer = GenerateLexer(new StringReader("[Stop]"));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.Identifier));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.EOL));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.EOF));
- }
-
- [Test]
- public void IdentifierWithTypeCharacter()
- {
- ILexer lexer = GenerateLexer(new StringReader("Stop$"));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.Identifier));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.EOL));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.EOF));
- }
-
- [Test]
- public void ExclamationMarkIsTypeCharacter()
- {
- ILexer lexer = GenerateLexer(new StringReader("a!=b"));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.Identifier));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.Assign));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.Identifier));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.EOL));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.EOF));
- }
-
- [Test]
- public void ExclamationMarkIsTypeCharacter2()
- {
- ILexer lexer = GenerateLexer(new StringReader("a! b"));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.Identifier));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.Identifier));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.EOL));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.EOF));
- }
-
- [Test]
- public void ExclamationMarkIsIdentifier()
- {
- ILexer lexer = GenerateLexer(new StringReader("a!b"));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.Identifier));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.ExclamationMark));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.Identifier));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.EOL));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.EOF));
- }
-
- [Test]
- public void ExclamationMarkIsIdentifier2()
- {
- ILexer lexer = GenerateLexer(new StringReader("a![b]"));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.Identifier));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.ExclamationMark));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.Identifier));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.EOL));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.EOF));
- }
-
- [Test]
- public void RemCommentTest()
- {
- ILexer lexer = GenerateLexer(new StringReader("a rem b"));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.Identifier));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.EOL));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.EOF));
- }
-
- [Test]
- public void RemCommentTest2()
- {
- ILexer lexer = GenerateLexer(new StringReader("REM c"));
- Assert.That(lexer.NextToken().Kind, Is.EqualTo(Tokens.EOF));
- }
- }
-}
diff --git a/main/contrib/NRefactory/Test/Lexer/VBNet/LexerPositionTests.cs b/main/contrib/NRefactory/Test/Lexer/VBNet/LexerPositionTests.cs
deleted file mode 100644
index ad3ce290f6..0000000000
--- a/main/contrib/NRefactory/Test/Lexer/VBNet/LexerPositionTests.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="none" email=""/>
-// <version>$Revision: 3715 $</version>
-// </file>
-
-using ICSharpCode.NRefactory.Parser.VB;
-using System;
-using System.IO;
-using ICSharpCode.NRefactory.Parser;
-using NUnit.Framework;
-
-namespace ICSharpCode.NRefactory.Tests.Lexer.VB
-{
- [TestFixture]
- public class LexerPositionTests
- {
- ILexer GenerateLexer(string s)
- {
- return ParserFactory.CreateLexer(SupportedLanguage.VBNet, new StringReader(s));
- }
-
- [Test]
- public void TestNewLine()
- {
- ILexer l = GenerateLexer("public\nstatic");
- Token t = l.NextToken();
- Assert.AreEqual(Tokens.Public, t.Kind);
- Assert.AreEqual(new Location(1, 1), t.Location);
- Assert.AreEqual(new Location(7, 1), t.EndLocation);
- t = l.NextToken();
- Assert.AreEqual(Tokens.EOL, t.Kind);
- Assert.AreEqual(new Location(7, 1), t.Location);
- Assert.AreEqual(new Location(1, 2), t.EndLocation);
- t = l.NextToken();
- Assert.AreEqual(Tokens.Static, t.Kind);
- Assert.AreEqual(new Location(1, 2), t.Location);
- Assert.AreEqual(new Location(7, 2), t.EndLocation);
- }
-
- [Test]
- public void TestCarriageReturnNewLine()
- {
- ILexer l = GenerateLexer("public\r\nstatic");
- Token t = l.NextToken();
- Assert.AreEqual(Tokens.Public, t.Kind);
- Assert.AreEqual(new Location(1, 1), t.Location);
- Assert.AreEqual(new Location(7, 1), t.EndLocation);
- t = l.NextToken();
- Assert.AreEqual(Tokens.EOL, t.Kind);
- Assert.AreEqual(new Location(7, 1), t.Location);
- Assert.AreEqual(new Location(1, 2), t.EndLocation);
- t = l.NextToken();
- Assert.AreEqual(Tokens.Static, t.Kind);
- Assert.AreEqual(new Location(1, 2), t.Location);
- Assert.AreEqual(new Location(7, 2), t.EndLocation);
- }
- }
-}
diff --git a/main/contrib/NRefactory/Test/Lexer/VBNet/LexerTests.cs b/main/contrib/NRefactory/Test/Lexer/VBNet/LexerTests.cs
deleted file mode 100644
index 3e42284937..0000000000
--- a/main/contrib/NRefactory/Test/Lexer/VBNet/LexerTests.cs
+++ /dev/null
@@ -1,1319 +0,0 @@
-using System;
-using System.IO;
-using NUnit.Framework;
-
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Parser.VB;
-using ICSharpCode.NRefactory.PrettyPrinter;
-
-namespace ICSharpCode.NRefactory.Tests.Lexer.VB
-{
- [TestFixture]
- public sealed class LexerTests
- {
- ILexer GenerateLexer(StringReader sr)
- {
- return ParserFactory.CreateLexer(SupportedLanguage.VBNet, sr);
- }
-
- [Test]
- public void TestAssign()
- {
- ILexer lexer = GenerateLexer(new StringReader("="));
- Assert.AreEqual(Tokens.Assign, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestColon()
- {
- ILexer lexer = GenerateLexer(new StringReader(":"));
- Assert.AreEqual(Tokens.Colon, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestComma()
- {
- ILexer lexer = GenerateLexer(new StringReader(","));
- Assert.AreEqual(Tokens.Comma, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestConcatString()
- {
- ILexer lexer = GenerateLexer(new StringReader("&"));
- Assert.AreEqual(Tokens.ConcatString, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestDiv()
- {
- ILexer lexer = GenerateLexer(new StringReader("/"));
- Assert.AreEqual(Tokens.Div, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestDivInteger()
- {
- ILexer lexer = GenerateLexer(new StringReader("\\"));
- Assert.AreEqual(Tokens.DivInteger, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestDot()
- {
- ILexer lexer = GenerateLexer(new StringReader("."));
- Assert.AreEqual(Tokens.Dot, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestExclamationMark()
- {
- ILexer lexer = GenerateLexer(new StringReader("!"));
- Assert.AreEqual(Tokens.ExclamationMark, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestMinus()
- {
- ILexer lexer = GenerateLexer(new StringReader("-"));
- Assert.AreEqual(Tokens.Minus, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestPlus()
- {
- ILexer lexer = GenerateLexer(new StringReader("+"));
- Assert.AreEqual(Tokens.Plus, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestPower()
- {
- ILexer lexer = GenerateLexer(new StringReader("^"));
- Assert.AreEqual(Tokens.Power, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestQuestionMark()
- {
- ILexer lexer = GenerateLexer(new StringReader("?"));
- Assert.AreEqual(Tokens.QuestionMark, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestTimes()
- {
- ILexer lexer = GenerateLexer(new StringReader("*"));
- Assert.AreEqual(Tokens.Times, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestOpenCurlyBrace()
- {
- ILexer lexer = GenerateLexer(new StringReader("{"));
- Assert.AreEqual(Tokens.OpenCurlyBrace, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestCloseCurlyBrace()
- {
- ILexer lexer = GenerateLexer(new StringReader("}"));
- Assert.AreEqual(Tokens.CloseCurlyBrace, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestOpenParenthesis()
- {
- ILexer lexer = GenerateLexer(new StringReader("("));
- Assert.AreEqual(Tokens.OpenParenthesis, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestCloseParenthesis()
- {
- ILexer lexer = GenerateLexer(new StringReader(")"));
- Assert.AreEqual(Tokens.CloseParenthesis, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestGreaterThan()
- {
- ILexer lexer = GenerateLexer(new StringReader(">"));
- Assert.AreEqual(Tokens.GreaterThan, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestLessThan()
- {
- ILexer lexer = GenerateLexer(new StringReader("<"));
- Assert.AreEqual(Tokens.LessThan, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestNotEqual()
- {
- ILexer lexer = GenerateLexer(new StringReader("<>"));
- Assert.AreEqual(Tokens.NotEqual, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestGreaterEqual()
- {
- ILexer lexer = GenerateLexer(new StringReader(">="));
- Assert.AreEqual(Tokens.GreaterEqual, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestLessEqual()
- {
- ILexer lexer = GenerateLexer(new StringReader("<="));
- Assert.AreEqual(Tokens.LessEqual, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestShiftLeft()
- {
- ILexer lexer = GenerateLexer(new StringReader("<<"));
- Assert.AreEqual(Tokens.ShiftLeft, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestShiftRight()
- {
- ILexer lexer = GenerateLexer(new StringReader(">>"));
- Assert.AreEqual(Tokens.ShiftRight, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestPlusAssign()
- {
- ILexer lexer = GenerateLexer(new StringReader("+="));
- Assert.AreEqual(Tokens.PlusAssign, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestPowerAssign()
- {
- ILexer lexer = GenerateLexer(new StringReader("^="));
- Assert.AreEqual(Tokens.PowerAssign, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestMinusAssign()
- {
- ILexer lexer = GenerateLexer(new StringReader("-="));
- Assert.AreEqual(Tokens.MinusAssign, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestTimesAssign()
- {
- ILexer lexer = GenerateLexer(new StringReader("*="));
- Assert.AreEqual(Tokens.TimesAssign, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestDivAssign()
- {
- ILexer lexer = GenerateLexer(new StringReader("/="));
- Assert.AreEqual(Tokens.DivAssign, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestDivIntegerAssign()
- {
- ILexer lexer = GenerateLexer(new StringReader("\\="));
- Assert.AreEqual(Tokens.DivIntegerAssign, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestShiftLeftAssign()
- {
- ILexer lexer = GenerateLexer(new StringReader("<<="));
- Assert.AreEqual(Tokens.ShiftLeftAssign, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestShiftRightAssign()
- {
- ILexer lexer = GenerateLexer(new StringReader(">>="));
- Assert.AreEqual(Tokens.ShiftRightAssign, lexer.NextToken().Kind);
- }
-
- [Test]
- public void TestConcatStringAssign()
- {
- ILexer lexer = GenerateLexer(new StringReader("&="));
- Assert.AreEqual(Tokens.ConcatStringAssign, lexer.NextToken().Kind);
- }
-
- [Test()]
- public void TestAddHandler()
- {
- ILexer lexer = GenerateLexer(new StringReader("AddHandler"));
- Assert.AreEqual(Tokens.AddHandler, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestAddressOf()
- {
- ILexer lexer = GenerateLexer(new StringReader("AddressOf"));
- Assert.AreEqual(Tokens.AddressOf, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestAggregate()
- {
- ILexer lexer = GenerateLexer(new StringReader("Aggregate"));
- Assert.AreEqual(Tokens.Aggregate, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestAlias()
- {
- ILexer lexer = GenerateLexer(new StringReader("Alias"));
- Assert.AreEqual(Tokens.Alias, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestAnd()
- {
- ILexer lexer = GenerateLexer(new StringReader("And"));
- Assert.AreEqual(Tokens.And, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestAndAlso()
- {
- ILexer lexer = GenerateLexer(new StringReader("AndAlso"));
- Assert.AreEqual(Tokens.AndAlso, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestAnsi()
- {
- ILexer lexer = GenerateLexer(new StringReader("Ansi"));
- Assert.AreEqual(Tokens.Ansi, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestAs()
- {
- ILexer lexer = GenerateLexer(new StringReader("As"));
- Assert.AreEqual(Tokens.As, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestAscending()
- {
- ILexer lexer = GenerateLexer(new StringReader("Ascending"));
- Assert.AreEqual(Tokens.Ascending, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestAssembly()
- {
- ILexer lexer = GenerateLexer(new StringReader("Assembly"));
- Assert.AreEqual(Tokens.Assembly, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestAuto()
- {
- ILexer lexer = GenerateLexer(new StringReader("Auto"));
- Assert.AreEqual(Tokens.Auto, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestBinary()
- {
- ILexer lexer = GenerateLexer(new StringReader("Binary"));
- Assert.AreEqual(Tokens.Binary, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestBoolean()
- {
- ILexer lexer = GenerateLexer(new StringReader("Boolean"));
- Assert.AreEqual(Tokens.Boolean, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestByRef()
- {
- ILexer lexer = GenerateLexer(new StringReader("ByRef"));
- Assert.AreEqual(Tokens.ByRef, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestBy()
- {
- ILexer lexer = GenerateLexer(new StringReader("By"));
- Assert.AreEqual(Tokens.By, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestByte()
- {
- ILexer lexer = GenerateLexer(new StringReader("Byte"));
- Assert.AreEqual(Tokens.Byte, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestByVal()
- {
- ILexer lexer = GenerateLexer(new StringReader("ByVal"));
- Assert.AreEqual(Tokens.ByVal, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestCall()
- {
- ILexer lexer = GenerateLexer(new StringReader("Call"));
- Assert.AreEqual(Tokens.Call, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestCase()
- {
- ILexer lexer = GenerateLexer(new StringReader("Case"));
- Assert.AreEqual(Tokens.Case, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestCatch()
- {
- ILexer lexer = GenerateLexer(new StringReader("Catch"));
- Assert.AreEqual(Tokens.Catch, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestCBool()
- {
- ILexer lexer = GenerateLexer(new StringReader("CBool"));
- Assert.AreEqual(Tokens.CBool, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestCByte()
- {
- ILexer lexer = GenerateLexer(new StringReader("CByte"));
- Assert.AreEqual(Tokens.CByte, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestCChar()
- {
- ILexer lexer = GenerateLexer(new StringReader("CChar"));
- Assert.AreEqual(Tokens.CChar, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestCDate()
- {
- ILexer lexer = GenerateLexer(new StringReader("CDate"));
- Assert.AreEqual(Tokens.CDate, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestCDbl()
- {
- ILexer lexer = GenerateLexer(new StringReader("CDbl"));
- Assert.AreEqual(Tokens.CDbl, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestCDec()
- {
- ILexer lexer = GenerateLexer(new StringReader("CDec"));
- Assert.AreEqual(Tokens.CDec, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestChar()
- {
- ILexer lexer = GenerateLexer(new StringReader("Char"));
- Assert.AreEqual(Tokens.Char, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestCInt()
- {
- ILexer lexer = GenerateLexer(new StringReader("CInt"));
- Assert.AreEqual(Tokens.CInt, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestClass()
- {
- ILexer lexer = GenerateLexer(new StringReader("Class"));
- Assert.AreEqual(Tokens.Class, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestCLng()
- {
- ILexer lexer = GenerateLexer(new StringReader("CLng"));
- Assert.AreEqual(Tokens.CLng, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestCObj()
- {
- ILexer lexer = GenerateLexer(new StringReader("CObj"));
- Assert.AreEqual(Tokens.CObj, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestCompare()
- {
- ILexer lexer = GenerateLexer(new StringReader("Compare"));
- Assert.AreEqual(Tokens.Compare, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestConst()
- {
- ILexer lexer = GenerateLexer(new StringReader("Const"));
- Assert.AreEqual(Tokens.Const, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestContinue()
- {
- ILexer lexer = GenerateLexer(new StringReader("Continue"));
- Assert.AreEqual(Tokens.Continue, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestCSByte()
- {
- ILexer lexer = GenerateLexer(new StringReader("CSByte"));
- Assert.AreEqual(Tokens.CSByte, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestCShort()
- {
- ILexer lexer = GenerateLexer(new StringReader("CShort"));
- Assert.AreEqual(Tokens.CShort, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestCSng()
- {
- ILexer lexer = GenerateLexer(new StringReader("CSng"));
- Assert.AreEqual(Tokens.CSng, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestCStr()
- {
- ILexer lexer = GenerateLexer(new StringReader("CStr"));
- Assert.AreEqual(Tokens.CStr, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestCType()
- {
- ILexer lexer = GenerateLexer(new StringReader("CType"));
- Assert.AreEqual(Tokens.CType, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestCUInt()
- {
- ILexer lexer = GenerateLexer(new StringReader("CUInt"));
- Assert.AreEqual(Tokens.CUInt, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestCULng()
- {
- ILexer lexer = GenerateLexer(new StringReader("CULng"));
- Assert.AreEqual(Tokens.CULng, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestCUShort()
- {
- ILexer lexer = GenerateLexer(new StringReader("CUShort"));
- Assert.AreEqual(Tokens.CUShort, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestCustom()
- {
- ILexer lexer = GenerateLexer(new StringReader("Custom"));
- Assert.AreEqual(Tokens.Custom, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestDate()
- {
- ILexer lexer = GenerateLexer(new StringReader("Date"));
- Assert.AreEqual(Tokens.Date, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestDecimal()
- {
- ILexer lexer = GenerateLexer(new StringReader("Decimal"));
- Assert.AreEqual(Tokens.Decimal, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestDeclare()
- {
- ILexer lexer = GenerateLexer(new StringReader("Declare"));
- Assert.AreEqual(Tokens.Declare, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestDefault()
- {
- ILexer lexer = GenerateLexer(new StringReader("Default"));
- Assert.AreEqual(Tokens.Default, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestDelegate()
- {
- ILexer lexer = GenerateLexer(new StringReader("Delegate"));
- Assert.AreEqual(Tokens.Delegate, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestDescending()
- {
- ILexer lexer = GenerateLexer(new StringReader("Descending"));
- Assert.AreEqual(Tokens.Descending, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestDim()
- {
- ILexer lexer = GenerateLexer(new StringReader("Dim"));
- Assert.AreEqual(Tokens.Dim, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestDirectCast()
- {
- ILexer lexer = GenerateLexer(new StringReader("DirectCast"));
- Assert.AreEqual(Tokens.DirectCast, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestDistinct()
- {
- ILexer lexer = GenerateLexer(new StringReader("Distinct"));
- Assert.AreEqual(Tokens.Distinct, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestDo()
- {
- ILexer lexer = GenerateLexer(new StringReader("Do"));
- Assert.AreEqual(Tokens.Do, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestDouble()
- {
- ILexer lexer = GenerateLexer(new StringReader("Double"));
- Assert.AreEqual(Tokens.Double, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestEach()
- {
- ILexer lexer = GenerateLexer(new StringReader("Each"));
- Assert.AreEqual(Tokens.Each, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestElse()
- {
- ILexer lexer = GenerateLexer(new StringReader("Else"));
- Assert.AreEqual(Tokens.Else, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestElseIf()
- {
- ILexer lexer = GenerateLexer(new StringReader("ElseIf"));
- Assert.AreEqual(Tokens.ElseIf, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestEnd()
- {
- ILexer lexer = GenerateLexer(new StringReader("End"));
- Assert.AreEqual(Tokens.End, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestEndIf()
- {
- ILexer lexer = GenerateLexer(new StringReader("EndIf"));
- Assert.AreEqual(Tokens.EndIf, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestEnum()
- {
- ILexer lexer = GenerateLexer(new StringReader("Enum"));
- Assert.AreEqual(Tokens.Enum, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestEquals()
- {
- ILexer lexer = GenerateLexer(new StringReader("Equals"));
- Assert.AreEqual(Tokens.Equals, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestErase()
- {
- ILexer lexer = GenerateLexer(new StringReader("Erase"));
- Assert.AreEqual(Tokens.Erase, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestError()
- {
- ILexer lexer = GenerateLexer(new StringReader("Error"));
- Assert.AreEqual(Tokens.Error, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestEvent()
- {
- ILexer lexer = GenerateLexer(new StringReader("Event"));
- Assert.AreEqual(Tokens.Event, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestExit()
- {
- ILexer lexer = GenerateLexer(new StringReader("Exit"));
- Assert.AreEqual(Tokens.Exit, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestExplicit()
- {
- ILexer lexer = GenerateLexer(new StringReader("Explicit"));
- Assert.AreEqual(Tokens.Explicit, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestFalse()
- {
- ILexer lexer = GenerateLexer(new StringReader("False"));
- Assert.AreEqual(Tokens.False, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestFinally()
- {
- ILexer lexer = GenerateLexer(new StringReader("Finally"));
- Assert.AreEqual(Tokens.Finally, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestFor()
- {
- ILexer lexer = GenerateLexer(new StringReader("For"));
- Assert.AreEqual(Tokens.For, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestFriend()
- {
- ILexer lexer = GenerateLexer(new StringReader("Friend"));
- Assert.AreEqual(Tokens.Friend, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestFrom()
- {
- ILexer lexer = GenerateLexer(new StringReader("From"));
- Assert.AreEqual(Tokens.From, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestFunction()
- {
- ILexer lexer = GenerateLexer(new StringReader("Function"));
- Assert.AreEqual(Tokens.Function, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestGet()
- {
- ILexer lexer = GenerateLexer(new StringReader("Get"));
- Assert.AreEqual(Tokens.Get, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestGetType()
- {
- ILexer lexer = GenerateLexer(new StringReader("GetType"));
- Assert.AreEqual(Tokens.GetType, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestGlobal()
- {
- ILexer lexer = GenerateLexer(new StringReader("Global"));
- Assert.AreEqual(Tokens.Global, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestGoSub()
- {
- ILexer lexer = GenerateLexer(new StringReader("GoSub"));
- Assert.AreEqual(Tokens.GoSub, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestGoTo()
- {
- ILexer lexer = GenerateLexer(new StringReader("GoTo"));
- Assert.AreEqual(Tokens.GoTo, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestGroup()
- {
- ILexer lexer = GenerateLexer(new StringReader("Group"));
- Assert.AreEqual(Tokens.Group, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestHandles()
- {
- ILexer lexer = GenerateLexer(new StringReader("Handles"));
- Assert.AreEqual(Tokens.Handles, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestIf()
- {
- ILexer lexer = GenerateLexer(new StringReader("If"));
- Assert.AreEqual(Tokens.If, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestImplements()
- {
- ILexer lexer = GenerateLexer(new StringReader("Implements"));
- Assert.AreEqual(Tokens.Implements, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestImports()
- {
- ILexer lexer = GenerateLexer(new StringReader("Imports"));
- Assert.AreEqual(Tokens.Imports, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestIn()
- {
- ILexer lexer = GenerateLexer(new StringReader("In"));
- Assert.AreEqual(Tokens.In, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestInfer()
- {
- ILexer lexer = GenerateLexer(new StringReader("Infer"));
- Assert.AreEqual(Tokens.Infer, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestInherits()
- {
- ILexer lexer = GenerateLexer(new StringReader("Inherits"));
- Assert.AreEqual(Tokens.Inherits, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestInteger()
- {
- ILexer lexer = GenerateLexer(new StringReader("Integer"));
- Assert.AreEqual(Tokens.Integer, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestInterface()
- {
- ILexer lexer = GenerateLexer(new StringReader("Interface"));
- Assert.AreEqual(Tokens.Interface, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestInto()
- {
- ILexer lexer = GenerateLexer(new StringReader("Into"));
- Assert.AreEqual(Tokens.Into, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestIs()
- {
- ILexer lexer = GenerateLexer(new StringReader("Is"));
- Assert.AreEqual(Tokens.Is, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestIsNot()
- {
- ILexer lexer = GenerateLexer(new StringReader("IsNot"));
- Assert.AreEqual(Tokens.IsNot, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestJoin()
- {
- ILexer lexer = GenerateLexer(new StringReader("Join"));
- Assert.AreEqual(Tokens.Join, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestLet()
- {
- ILexer lexer = GenerateLexer(new StringReader("Let"));
- Assert.AreEqual(Tokens.Let, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestLib()
- {
- ILexer lexer = GenerateLexer(new StringReader("Lib"));
- Assert.AreEqual(Tokens.Lib, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestLike()
- {
- ILexer lexer = GenerateLexer(new StringReader("Like"));
- Assert.AreEqual(Tokens.Like, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestLong()
- {
- ILexer lexer = GenerateLexer(new StringReader("Long"));
- Assert.AreEqual(Tokens.Long, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestLoop()
- {
- ILexer lexer = GenerateLexer(new StringReader("Loop"));
- Assert.AreEqual(Tokens.Loop, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestMe()
- {
- ILexer lexer = GenerateLexer(new StringReader("Me"));
- Assert.AreEqual(Tokens.Me, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestMod()
- {
- ILexer lexer = GenerateLexer(new StringReader("Mod"));
- Assert.AreEqual(Tokens.Mod, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestModule()
- {
- ILexer lexer = GenerateLexer(new StringReader("Module"));
- Assert.AreEqual(Tokens.Module, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestMustInherit()
- {
- ILexer lexer = GenerateLexer(new StringReader("MustInherit"));
- Assert.AreEqual(Tokens.MustInherit, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestMustOverride()
- {
- ILexer lexer = GenerateLexer(new StringReader("MustOverride"));
- Assert.AreEqual(Tokens.MustOverride, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestMyBase()
- {
- ILexer lexer = GenerateLexer(new StringReader("MyBase"));
- Assert.AreEqual(Tokens.MyBase, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestMyClass()
- {
- ILexer lexer = GenerateLexer(new StringReader("MyClass"));
- Assert.AreEqual(Tokens.MyClass, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestNamespace()
- {
- ILexer lexer = GenerateLexer(new StringReader("Namespace"));
- Assert.AreEqual(Tokens.Namespace, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestNarrowing()
- {
- ILexer lexer = GenerateLexer(new StringReader("Narrowing"));
- Assert.AreEqual(Tokens.Narrowing, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestNew()
- {
- ILexer lexer = GenerateLexer(new StringReader("New"));
- Assert.AreEqual(Tokens.New, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestNext()
- {
- ILexer lexer = GenerateLexer(new StringReader("Next"));
- Assert.AreEqual(Tokens.Next, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestNot()
- {
- ILexer lexer = GenerateLexer(new StringReader("Not"));
- Assert.AreEqual(Tokens.Not, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestNothing()
- {
- ILexer lexer = GenerateLexer(new StringReader("Nothing"));
- Assert.AreEqual(Tokens.Nothing, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestNotInheritable()
- {
- ILexer lexer = GenerateLexer(new StringReader("NotInheritable"));
- Assert.AreEqual(Tokens.NotInheritable, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestNotOverridable()
- {
- ILexer lexer = GenerateLexer(new StringReader("NotOverridable"));
- Assert.AreEqual(Tokens.NotOverridable, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestObject()
- {
- ILexer lexer = GenerateLexer(new StringReader("Object"));
- Assert.AreEqual(Tokens.Object, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestOf()
- {
- ILexer lexer = GenerateLexer(new StringReader("Of"));
- Assert.AreEqual(Tokens.Of, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestOff()
- {
- ILexer lexer = GenerateLexer(new StringReader("Off"));
- Assert.AreEqual(Tokens.Off, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestOn()
- {
- ILexer lexer = GenerateLexer(new StringReader("On"));
- Assert.AreEqual(Tokens.On, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestOperator()
- {
- ILexer lexer = GenerateLexer(new StringReader("Operator"));
- Assert.AreEqual(Tokens.Operator, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestOption()
- {
- ILexer lexer = GenerateLexer(new StringReader("Option"));
- Assert.AreEqual(Tokens.Option, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestOptional()
- {
- ILexer lexer = GenerateLexer(new StringReader("Optional"));
- Assert.AreEqual(Tokens.Optional, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestOr()
- {
- ILexer lexer = GenerateLexer(new StringReader("Or"));
- Assert.AreEqual(Tokens.Or, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestOrder()
- {
- ILexer lexer = GenerateLexer(new StringReader("Order"));
- Assert.AreEqual(Tokens.Order, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestOrElse()
- {
- ILexer lexer = GenerateLexer(new StringReader("OrElse"));
- Assert.AreEqual(Tokens.OrElse, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestOverloads()
- {
- ILexer lexer = GenerateLexer(new StringReader("Overloads"));
- Assert.AreEqual(Tokens.Overloads, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestOverridable()
- {
- ILexer lexer = GenerateLexer(new StringReader("Overridable"));
- Assert.AreEqual(Tokens.Overridable, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestOverrides()
- {
- ILexer lexer = GenerateLexer(new StringReader("Overrides"));
- Assert.AreEqual(Tokens.Overrides, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestParamArray()
- {
- ILexer lexer = GenerateLexer(new StringReader("ParamArray"));
- Assert.AreEqual(Tokens.ParamArray, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestPartial()
- {
- ILexer lexer = GenerateLexer(new StringReader("Partial"));
- Assert.AreEqual(Tokens.Partial, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestPreserve()
- {
- ILexer lexer = GenerateLexer(new StringReader("Preserve"));
- Assert.AreEqual(Tokens.Preserve, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestPrivate()
- {
- ILexer lexer = GenerateLexer(new StringReader("Private"));
- Assert.AreEqual(Tokens.Private, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestProperty()
- {
- ILexer lexer = GenerateLexer(new StringReader("Property"));
- Assert.AreEqual(Tokens.Property, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestProtected()
- {
- ILexer lexer = GenerateLexer(new StringReader("Protected"));
- Assert.AreEqual(Tokens.Protected, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestPublic()
- {
- ILexer lexer = GenerateLexer(new StringReader("Public"));
- Assert.AreEqual(Tokens.Public, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestRaiseEvent()
- {
- ILexer lexer = GenerateLexer(new StringReader("RaiseEvent"));
- Assert.AreEqual(Tokens.RaiseEvent, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestReadOnly()
- {
- ILexer lexer = GenerateLexer(new StringReader("ReadOnly"));
- Assert.AreEqual(Tokens.ReadOnly, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestReDim()
- {
- ILexer lexer = GenerateLexer(new StringReader("ReDim"));
- Assert.AreEqual(Tokens.ReDim, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestRemoveHandler()
- {
- ILexer lexer = GenerateLexer(new StringReader("RemoveHandler"));
- Assert.AreEqual(Tokens.RemoveHandler, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestResume()
- {
- ILexer lexer = GenerateLexer(new StringReader("Resume"));
- Assert.AreEqual(Tokens.Resume, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestReturn()
- {
- ILexer lexer = GenerateLexer(new StringReader("Return"));
- Assert.AreEqual(Tokens.Return, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestSByte()
- {
- ILexer lexer = GenerateLexer(new StringReader("SByte"));
- Assert.AreEqual(Tokens.SByte, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestSelect()
- {
- ILexer lexer = GenerateLexer(new StringReader("Select"));
- Assert.AreEqual(Tokens.Select, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestSet()
- {
- ILexer lexer = GenerateLexer(new StringReader("Set"));
- Assert.AreEqual(Tokens.Set, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestShadows()
- {
- ILexer lexer = GenerateLexer(new StringReader("Shadows"));
- Assert.AreEqual(Tokens.Shadows, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestShared()
- {
- ILexer lexer = GenerateLexer(new StringReader("Shared"));
- Assert.AreEqual(Tokens.Shared, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestShort()
- {
- ILexer lexer = GenerateLexer(new StringReader("Short"));
- Assert.AreEqual(Tokens.Short, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestSingle()
- {
- ILexer lexer = GenerateLexer(new StringReader("Single"));
- Assert.AreEqual(Tokens.Single, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestSkip()
- {
- ILexer lexer = GenerateLexer(new StringReader("Skip"));
- Assert.AreEqual(Tokens.Skip, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestStatic()
- {
- ILexer lexer = GenerateLexer(new StringReader("Static"));
- Assert.AreEqual(Tokens.Static, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestStep()
- {
- ILexer lexer = GenerateLexer(new StringReader("Step"));
- Assert.AreEqual(Tokens.Step, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestStop()
- {
- ILexer lexer = GenerateLexer(new StringReader("Stop"));
- Assert.AreEqual(Tokens.Stop, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestStrict()
- {
- ILexer lexer = GenerateLexer(new StringReader("Strict"));
- Assert.AreEqual(Tokens.Strict, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestString()
- {
- ILexer lexer = GenerateLexer(new StringReader("String"));
- Assert.AreEqual(Tokens.String, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestStructure()
- {
- ILexer lexer = GenerateLexer(new StringReader("Structure"));
- Assert.AreEqual(Tokens.Structure, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestSub()
- {
- ILexer lexer = GenerateLexer(new StringReader("Sub"));
- Assert.AreEqual(Tokens.Sub, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestSyncLock()
- {
- ILexer lexer = GenerateLexer(new StringReader("SyncLock"));
- Assert.AreEqual(Tokens.SyncLock, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestTake()
- {
- ILexer lexer = GenerateLexer(new StringReader("Take"));
- Assert.AreEqual(Tokens.Take, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestText()
- {
- ILexer lexer = GenerateLexer(new StringReader("Text"));
- Assert.AreEqual(Tokens.Text, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestThen()
- {
- ILexer lexer = GenerateLexer(new StringReader("Then"));
- Assert.AreEqual(Tokens.Then, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestThrow()
- {
- ILexer lexer = GenerateLexer(new StringReader("Throw"));
- Assert.AreEqual(Tokens.Throw, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestTo()
- {
- ILexer lexer = GenerateLexer(new StringReader("To"));
- Assert.AreEqual(Tokens.To, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestTrue()
- {
- ILexer lexer = GenerateLexer(new StringReader("True"));
- Assert.AreEqual(Tokens.True, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestTry()
- {
- ILexer lexer = GenerateLexer(new StringReader("Try"));
- Assert.AreEqual(Tokens.Try, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestTryCast()
- {
- ILexer lexer = GenerateLexer(new StringReader("TryCast"));
- Assert.AreEqual(Tokens.TryCast, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestTypeOf()
- {
- ILexer lexer = GenerateLexer(new StringReader("TypeOf"));
- Assert.AreEqual(Tokens.TypeOf, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestUInteger()
- {
- ILexer lexer = GenerateLexer(new StringReader("UInteger"));
- Assert.AreEqual(Tokens.UInteger, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestULong()
- {
- ILexer lexer = GenerateLexer(new StringReader("ULong"));
- Assert.AreEqual(Tokens.ULong, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestUnicode()
- {
- ILexer lexer = GenerateLexer(new StringReader("Unicode"));
- Assert.AreEqual(Tokens.Unicode, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestUntil()
- {
- ILexer lexer = GenerateLexer(new StringReader("Until"));
- Assert.AreEqual(Tokens.Until, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestUShort()
- {
- ILexer lexer = GenerateLexer(new StringReader("UShort"));
- Assert.AreEqual(Tokens.UShort, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestUsing()
- {
- ILexer lexer = GenerateLexer(new StringReader("Using"));
- Assert.AreEqual(Tokens.Using, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestVariant()
- {
- ILexer lexer = GenerateLexer(new StringReader("Variant"));
- Assert.AreEqual(Tokens.Variant, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestWend()
- {
- ILexer lexer = GenerateLexer(new StringReader("Wend"));
- Assert.AreEqual(Tokens.Wend, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestWhen()
- {
- ILexer lexer = GenerateLexer(new StringReader("When"));
- Assert.AreEqual(Tokens.When, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestWhere()
- {
- ILexer lexer = GenerateLexer(new StringReader("Where"));
- Assert.AreEqual(Tokens.Where, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestWhile()
- {
- ILexer lexer = GenerateLexer(new StringReader("While"));
- Assert.AreEqual(Tokens.While, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestWidening()
- {
- ILexer lexer = GenerateLexer(new StringReader("Widening"));
- Assert.AreEqual(Tokens.Widening, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestWith()
- {
- ILexer lexer = GenerateLexer(new StringReader("With"));
- Assert.AreEqual(Tokens.With, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestWithEvents()
- {
- ILexer lexer = GenerateLexer(new StringReader("WithEvents"));
- Assert.AreEqual(Tokens.WithEvents, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestWriteOnly()
- {
- ILexer lexer = GenerateLexer(new StringReader("WriteOnly"));
- Assert.AreEqual(Tokens.WriteOnly, lexer.NextToken().Kind);
- }
- [Test()]
- public void TestXor()
- {
- ILexer lexer = GenerateLexer(new StringReader("Xor"));
- Assert.AreEqual(Tokens.Xor, lexer.NextToken().Kind);
- }
- }
-}
diff --git a/main/contrib/NRefactory/Test/Lexer/VBNet/LiteralsTests.cs b/main/contrib/NRefactory/Test/Lexer/VBNet/LiteralsTests.cs
deleted file mode 100644
index 254c2f4690..0000000000
--- a/main/contrib/NRefactory/Test/Lexer/VBNet/LiteralsTests.cs
+++ /dev/null
@@ -1,192 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="none" email=""/>
-// <version>$Revision: 3715 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Parser.VB;
-using ICSharpCode.NRefactory.PrettyPrinter;
-
-namespace ICSharpCode.NRefactory.Tests.Lexer.VB
-{
- [TestFixture]
- public sealed class LiteralsTests
- {
- ILexer GenerateLexer(StringReader sr)
- {
- return ParserFactory.CreateLexer(SupportedLanguage.VBNet, sr);
- }
-
- Token GetSingleToken(string text)
- {
- ILexer lexer = GenerateLexer(new StringReader(text));
- Token t = lexer.NextToken();
- Assert.AreEqual(Tokens.EOL, lexer.NextToken().Kind, "Tokens.EOL");
- Assert.AreEqual(Tokens.EOF, lexer.NextToken().Kind, "Tokens.EOF");
- Assert.AreEqual("", lexer.Errors.ErrorOutput);
- return t;
- }
-
- void CheckToken(string text, int tokenType, object val)
- {
- Token t = GetSingleToken(text);
- Assert.AreEqual(tokenType, t.Kind, "Tokens.Literal");
- Assert.IsNotNull(t.LiteralValue, "literalValue is null");
- Assert.AreEqual(val.GetType(), t.LiteralValue.GetType(), "literalValue.GetType()");
- Assert.AreEqual(val, t.LiteralValue, "literalValue");
- }
-
- [Test]
- public void TestSingleDigit()
- {
- CheckToken("5", Tokens.LiteralInteger, 5);
- }
-
- [Test]
- public void TestZero()
- {
- CheckToken("0", Tokens.LiteralInteger, 0);
- }
-
- [Test]
- public void TestInteger()
- {
- CheckToken("15", Tokens.LiteralInteger, 15);
- CheckToken("8581", Tokens.LiteralInteger, 8581);
- }
-
- [Test]
- public void TestHexadecimalInteger()
- {
- CheckToken("&H10", Tokens.LiteralInteger, 0x10);
- CheckToken("&H10&", Tokens.LiteralInteger, (long)0x10);
- CheckToken("&h3ff%", Tokens.LiteralInteger, 0x3ff);
- CheckToken("&h8000s", Tokens.LiteralInteger, short.MinValue);
- CheckToken("&h8000us", Tokens.LiteralInteger, (ushort)0x8000);
- CheckToken("&HffffFFFF", Tokens.LiteralInteger, -1);
- CheckToken("&HffffFFFF%", Tokens.LiteralInteger, -1);
- CheckToken("&HffffFFFFui", Tokens.LiteralInteger, uint.MaxValue);
- CheckToken("&HffffFFFF&", Tokens.LiteralInteger, (long)uint.MaxValue);
- }
-
- [Test]
- public void TestLongHexadecimalInteger()
- {
- CheckToken("&H4244636f446c6d58", Tokens.LiteralInteger, 0x4244636f446c6d58);
- CheckToken("&hf244636f446c6d58", Tokens.LiteralInteger, -989556688574190248);
- CheckToken("&hf244636f446c6d58&", Tokens.LiteralInteger, -989556688574190248);
- CheckToken("&hf244636f446c6d58ul", Tokens.LiteralInteger, 0xf244636f446c6d58);
- }
-
- [Test]
- public void InvalidHexadecimalInteger()
- {
- // just check that we don't get exceptions:
- GenerateLexer(new StringReader("&H")).NextToken();
- // >ulong.MaxValue
- GenerateLexer(new StringReader("&hff244636f446c6d58")).NextToken();
- // needs an ulong, but "i" postfix specified integer
- GenerateLexer(new StringReader("&hf244636f446c6d58i")).NextToken();
- GenerateLexer(new StringReader("&hf244636f446c6d58ui")).NextToken();
- }
-
- [Test]
- public void TestIncompleteHexadecimal()
- {
- ILexer lexer = GenerateLexer(new StringReader("&H\r\nabc"));
- Token t = lexer.NextToken();
- Assert.AreEqual(Tokens.LiteralInteger, t.Kind);
- Assert.AreEqual(0, (int)t.LiteralValue);
- Assert.AreEqual(Tokens.EOL, lexer.NextToken().Kind, "Tokens.EOL (1)");
- Assert.AreEqual(Tokens.Identifier, lexer.NextToken().Kind, "Tokens.Identifier");
- Assert.AreEqual(Tokens.EOL, lexer.NextToken().Kind, "Tokens.EOL (2)");
- Assert.AreEqual(Tokens.EOF, lexer.NextToken().Kind, "Tokens.EOF");
- Assert.AreNotEqual("", lexer.Errors.ErrorOutput);
- }
-
- [Test]
- public void TestStringLiterals()
- {
- CheckToken("\"\"", Tokens.LiteralString, "");
- CheckToken("\"Hello, World!\"", Tokens.LiteralString, "Hello, World!");
- CheckToken("\"\"\"\"", Tokens.LiteralString, "\"");
- }
-
- [Test]
- public void TestCharacterLiterals()
- {
- CheckToken("\" \"c", Tokens.LiteralCharacter, ' ');
- CheckToken("\"!\"c", Tokens.LiteralCharacter, '!');
- CheckToken("\"\"\"\"c", Tokens.LiteralCharacter, '"');
- }
-
- [Test]
- public void TestDateLiterals()
- {
- CheckToken("# 8/23/1970 #", Tokens.LiteralDate, new DateTime(1970, 8, 23, 0, 0, 0));
- CheckToken("#8/23/1970#", Tokens.LiteralDate, new DateTime(1970, 8, 23, 0, 0, 0));
- CheckToken("# 8/23/1970 3:45:39AM #", Tokens.LiteralDate, new DateTime(1970, 8, 23, 3, 45, 39));
- CheckToken("# 3:45:39AM #", Tokens.LiteralDate, new DateTime(1, 1, 1, 3, 45, 39));
- CheckToken("# 3:45:39 PM #", Tokens.LiteralDate, new DateTime(1, 1, 1, 15, 45, 39));
- CheckToken("# 3:45:39 #", Tokens.LiteralDate, new DateTime(1, 1, 1, 3, 45, 39));
- CheckToken("# 13:45:39 #", Tokens.LiteralDate, new DateTime(1, 1, 1, 13, 45, 39));
- CheckToken("# 1AM #", Tokens.LiteralDate, new DateTime(1, 1, 1, 1, 0, 0));
- }
-
- [Test]
- public void TestDouble()
- {
- CheckToken("1.0", Tokens.LiteralDouble, 1.0);
- CheckToken("1.1", Tokens.LiteralDouble, 1.1);
- CheckToken("2e-5", Tokens.LiteralDouble, 2e-5);
- CheckToken("2.0e-5", Tokens.LiteralDouble, 2e-5);
- CheckToken("2e5", Tokens.LiteralDouble, 2e5);
- CheckToken("2.2e5", Tokens.LiteralDouble, 2.2e5);
- CheckToken("2e+5", Tokens.LiteralDouble, 2e5);
- CheckToken("2.2e+5", Tokens.LiteralDouble, 2.2e5);
-
- CheckToken("1r", Tokens.LiteralDouble, 1.0);
- CheckToken("1.0r", Tokens.LiteralDouble, 1.0);
- CheckToken("1.1r", Tokens.LiteralDouble, 1.1);
- CheckToken("2e-5r", Tokens.LiteralDouble, 2e-5);
- CheckToken("2.0e-5r", Tokens.LiteralDouble, 2e-5);
- CheckToken("2e5r", Tokens.LiteralDouble, 2e5);
- CheckToken("2.2e5r", Tokens.LiteralDouble, 2.2e5);
- CheckToken("2e+5r", Tokens.LiteralDouble, 2e5);
- CheckToken("2.2e+5r", Tokens.LiteralDouble, 2.2e5);
- }
-
- [Test]
- public void TestSingle()
- {
- CheckToken("1f", Tokens.LiteralSingle, 1.0f);
- CheckToken("1.0f", Tokens.LiteralSingle, 1.0f);
- CheckToken("1.1f", Tokens.LiteralSingle, 1.1f);
- CheckToken("2e-5f", Tokens.LiteralSingle, 2e-5f);
- CheckToken("2.0e-5f", Tokens.LiteralSingle, 2e-5f);
- CheckToken("2e5f", Tokens.LiteralSingle, 2e5f);
- CheckToken("2.2e5f", Tokens.LiteralSingle, 2.2e5f);
- CheckToken("2e+5f", Tokens.LiteralSingle, 2e5f);
- CheckToken("2.2e+5f", Tokens.LiteralSingle, 2.2e5f);
- }
-
- [Test]
- public void TestDecimal()
- {
- CheckToken("1d", Tokens.LiteralDecimal, 1m);
- CheckToken("1.0d", Tokens.LiteralDecimal, 1.0m);
- CheckToken("1.1d", Tokens.LiteralDecimal, 1.1m);
- CheckToken("2e-5d", Tokens.LiteralDecimal, 2e-5m);
- CheckToken("2.0e-5d", Tokens.LiteralDecimal, 2.0e-5m);
- CheckToken("2e5d", Tokens.LiteralDecimal, 2e5m);
- CheckToken("2.2e5d", Tokens.LiteralDecimal, 2.2e5m);
- CheckToken("2e+5d", Tokens.LiteralDecimal, 2e5m);
- CheckToken("2.2e+5d", Tokens.LiteralDecimal, 2.2e5m);
- }
- }
-}
diff --git a/main/contrib/NRefactory/Test/NRefactoryTests.csproj b/main/contrib/NRefactory/Test/NRefactoryTests.csproj
deleted file mode 100644
index 139748779d..0000000000
--- a/main/contrib/NRefactory/Test/NRefactoryTests.csproj
+++ /dev/null
@@ -1,167 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.50215</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{870115DD-960A-4406-A6B9-600BCDC36A03}</ProjectGuid>
- <RootNamespace>ICSharpCode.NRefactory.Tests</RootNamespace>
- <AssemblyName>ICSharpCode.NRefactory.Tests</AssemblyName>
- <OutputTarget>Library</OutputTarget>
- <NoStdLib>False</NoStdLib>
- <NoConfig>False</NoConfig>
- <RunPostBuildEvent>OnSuccessfulBuild</RunPostBuildEvent>
- <OutputType>Library</OutputType>
- <OutputPath>..\..\..\..\bin\UnitTests\</OutputPath>
- <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
- <PlatformTarget>AnyCPU</PlatformTarget>
- <WarningLevel>4</WarningLevel>
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
- <DefineConstants>DEBUG</DefineConstants>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug</OutputPath>
- <DebugType>none</DebugType>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <Optimize>true</Optimize>
- <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
- <OutputPath>bin\Release</OutputPath>
- <DebugType>none</DebugType>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
- <DebugType>full</DebugType>
- <DebugSymbols>true</DebugSymbols>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
- <DebugSymbols>False</DebugSymbols>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="nunit.framework, Version=2.4.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\Tools\NUnit\nunit.framework.dll</HintPath>
- </Reference>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="AssemblyInfo.cs" />
- <Compile Include="Lexer\CSharp\LexerTests.cs" />
- <Compile Include="General\UnitTest.cs" />
- <Compile Include="Lexer\CSharp\PreprocessingTests.cs" />
- <Compile Include="Lexer\VBNet\CustomLexerTests.cs" />
- <Compile Include="Parser\CheckParentVisitor.cs" />
- <Compile Include="Parser\Expressions\AddressOfExpressionTests.cs" />
- <Compile Include="Parser\Expressions\LambdaExpressionTests.cs" />
- <Compile Include="Parser\Expressions\QueryExpressionTests.cs" />
- <Compile Include="Output\SnippetConversion.cs" />
- <Compile Include="Parser\GlobalScope\AttributeSectionTests.cs" />
- <Compile Include="Output\CSharp\CSharpOutputTest.cs" />
- <Compile Include="Parser\Expressions\PrimitiveExpressionTests.cs" />
- <Compile Include="Parser\Expressions\ParenthesizedExpressionTest.cs" />
- <Compile Include="Parser\Expressions\ThisReferenceExpressionTests.cs" />
- <Compile Include="Parser\Expressions\BaseReferenceExpressionTests.cs" />
- <Compile Include="Parser\Expressions\IdentifierExpressionTests.cs" />
- <Compile Include="Parser\GlobalScope\NamespaceDeclarationTests.cs" />
- <Compile Include="Parser\Expressions\AssignmentExpressionTests.cs" />
- <Compile Include="Parser\Expressions\BinaryOperatorExpressionTests.cs" />
- <Compile Include="Parser\Expressions\UnaryOperatorExpressionTests.cs" />
- <Compile Include="Parser\Expressions\CastExpressionTests.cs" />
- <Compile Include="Parser\Expressions\MemberReferenceExpressionTests.cs" />
- <Compile Include="Parser\Expressions\InvocationExpressionTests.cs" />
- <Compile Include="Parser\Expressions\TypeOfExpressionTests.cs" />
- <Compile Include="Parser\Expressions\ArrayCreateExpressionTests.cs" />
- <Compile Include="Parser\Expressions\ObjectCreateExpressionTests.cs" />
- <Compile Include="Parser\GlobalScope\DelegateDeclarationTests.cs" />
- <Compile Include="Parser\Expressions\CheckedExpressionTests.cs" />
- <Compile Include="Parser\Expressions\UncheckedExpressionTests.cs" />
- <Compile Include="Parser\Expressions\ConditionalExpressionTests.cs" />
- <Compile Include="Parser\Expressions\PointerReferenceExpressionTests.cs" />
- <Compile Include="Parser\Expressions\IndexerExpressionTests.cs" />
- <Compile Include="Parser\Expressions\SizeOfExpressionTests.cs" />
- <Compile Include="Parser\Expressions\StackAllocExpressionTests.cs" />
- <Compile Include="Parser\GlobalScope\UsingDeclarationTests.cs" />
- <Compile Include="Parser\GlobalScope\TypeDeclarationTests.cs" />
- <Compile Include="Parser\TypeLevel\ConstructorDeclarationTests.cs" />
- <Compile Include="Parser\TypeLevel\EventDeclarationTests.cs" />
- <Compile Include="Parser\TypeLevel\FieldDeclarationTests.cs" />
- <Compile Include="Parser\TypeLevel\MethodDeclarationTests.cs" />
- <Compile Include="Parser\TypeLevel\PropertyDeclarationTests.cs" />
- <Compile Include="Parser\TypeLevel\DestructorDeclarationTests.cs" />
- <Compile Include="Parser\TypeLevel\IndexerDeclarationTests.cs" />
- <Compile Include="Parser\TypeLevel\OperatorDeclarationTests.cs" />
- <Compile Include="Parser\Statements\BlockStatementTests.cs" />
- <Compile Include="Parser\Statements\BreakStatementTests.cs" />
- <Compile Include="Parser\Statements\ContinueStatementTests.cs" />
- <Compile Include="Parser\Statements\EmptyStatementTests.cs" />
- <Compile Include="Parser\Statements\DoLoopStatementTests.cs" />
- <Compile Include="Parser\Statements\ForeachStatementTests.cs" />
- <Compile Include="Parser\Statements\ForStatementTests.cs" />
- <Compile Include="Parser\Statements\GotoStatementTests.cs" />
- <Compile Include="Parser\Statements\IfElseStatementTests.cs" />
- <Compile Include="Parser\Statements\LabelStatementTests.cs" />
- <Compile Include="Parser\Statements\LocalVariableDeclarationTests.cs" />
- <Compile Include="Parser\Statements\LockStatementTests.cs" />
- <Compile Include="Parser\Statements\ReturnStatementTests.cs" />
- <Compile Include="Parser\Statements\ExpressionStatementTests.cs" />
- <Compile Include="Parser\Statements\SwitchStatementTests.cs" />
- <Compile Include="Parser\Statements\ThrowStatementTests.cs" />
- <Compile Include="Parser\Statements\TryCatchStatementTests.cs" />
- <Compile Include="Parser\Statements\CheckedStatementTests.cs" />
- <Compile Include="Parser\Statements\UncheckedStatementTests.cs" />
- <Compile Include="Parser\Statements\UnsafeStatementTests.cs" />
- <Compile Include="Parser\Statements\FixedStatementTests.cs" />
- <Compile Include="Parser\Statements\GotoCaseStatementTests.cs" />
- <Compile Include="Parser\Statements\UsingStatementTests.cs" />
- <Compile Include="Parser\Expressions\ClassReferenceExpressionTests.cs" />
- <Compile Include="Parser\Expressions\TypeOfIsExpressionTests.cs" />
- <Compile Include="Parser\ParseUtilCSharp.cs" />
- <Compile Include="Parser\ParseUtilVBNet.cs" />
- <Compile Include="Parser\GlobalScope\OptionDeclarationTests.cs" />
- <Compile Include="Parser\TypeLevel\DeclareDeclarationTests.cs" />
- <Compile Include="Parser\Statements\AddHandlerStatementTests.cs" />
- <Compile Include="Parser\Statements\EndStatementTests.cs" />
- <Compile Include="Parser\Statements\EraseStatementTests.cs" />
- <Compile Include="Parser\Statements\ErrorStatementTests.cs" />
- <Compile Include="Parser\Statements\ForNextStatementTests.cs" />
- <Compile Include="Parser\Statements\OnErrorStatementTest.cs" />
- <Compile Include="Parser\Statements\RaiseEventStatementTest.cs" />
- <Compile Include="Parser\Statements\ReDimStatementTests.cs" />
- <Compile Include="Parser\Statements\RemoveHandlerStatement.cs" />
- <Compile Include="Parser\Statements\ResumeStatement.cs" />
- <Compile Include="Parser\Statements\StopStatementTests.cs" />
- <Compile Include="Parser\Statements\WithStatementTests.cs" />
- <Compile Include="Lexer\VBNet\LexerTests.cs" />
- <Compile Include="Output\CodeDOM\CodeDOMPrimitiveExpressionTest.cs" />
- <Compile Include="Output\CodeDOM\CodeDOMParenthesizedExpressionTest.cs" />
- <Compile Include="Parser\Statements\YieldStatementTests.cs" />
- <Compile Include="Lexer\CSharp\NumberLexerTest.cs" />
- <Compile Include="Lexer\VBNet\LiteralsTests.cs" />
- <Compile Include="Parser\SkipMethodBodiesTest.cs" />
- <Compile Include="Parser\Expressions\AnonymousMethodTests.cs" />
- <Compile Include="Output\CodeDOM\InvocationExpressionTest.cs" />
- <Compile Include="Parser\Expressions\TypeReferenceExpressionTests.cs" />
- <Compile Include="Parser\Expressions\GlobalReferenceExpressionTests.cs" />
- <Compile Include="Parser\TypeLevel\CustomEventTests.cs" />
- <Compile Include="Lexer\CSharp\LexerPositionTests.cs" />
- <Compile Include="Lexer\VBNet\LexerPositionTests.cs" />
- <Compile Include="Lexer\CSharp\CustomLexerTests.cs" />
- <Compile Include="Parser\Expressions\DefaultValueExpressionTests.cs" />
- <Compile Include="Output\VBNet\VBNetOutputTest.cs" />
- <Compile Include="Output\VBNet\CSharpToVBNetConverterTest.cs" />
- <Compile Include="Output\CSharp\VBNetToCSharpConverterTest.cs" />
- <Compile Include="Output\SpecialOutputVisitorTest.cs" />
- </ItemGroup>
- <ItemGroup>
- <Folder Include="Output\" />
- <ProjectReference Include="..\Project\NRefactory.csproj">
- <Project>{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}</Project>
- <Name>NRefactory</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
-</Project> \ No newline at end of file
diff --git a/main/contrib/NRefactory/Test/NRefactoryTests.csproj.user b/main/contrib/NRefactory/Test/NRefactoryTests.csproj.user
deleted file mode 100644
index 2f5eff5a8b..0000000000
--- a/main/contrib/NRefactory/Test/NRefactoryTests.csproj.user
+++ /dev/null
@@ -1,10 +0,0 @@
-<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <LastOpenVersion>8.0.50215</LastOpenVersion>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <StartAction>Program</StartAction>
- <StartProgram>D:\Corsavy\SharpDevelop\bin\SharpDevelop.exe</StartProgram>
- <StartArguments>D:\Corsavy\SharpDevelop\src\Libraries\NRefactory\NRefactory.sln</StartArguments>
- </PropertyGroup>
-</Project> \ No newline at end of file
diff --git a/main/contrib/NRefactory/Test/Output/CSharp/CSharpOutputTest.cs b/main/contrib/NRefactory/Test/Output/CSharp/CSharpOutputTest.cs
deleted file mode 100644
index 64e9d4b99e..0000000000
--- a/main/contrib/NRefactory/Test/Output/CSharp/CSharpOutputTest.cs
+++ /dev/null
@@ -1,601 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 3763 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-using ICSharpCode.NRefactory.PrettyPrinter;
-
-namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
-{
- [TestFixture]
- public class CSharpOutputTest
- {
- void TestProgram(string program)
- {
- IParser parser = ParserFactory.CreateParser(SupportedLanguage.CSharp, new StringReader(program));
- parser.Parse();
- Assert.AreEqual("", parser.Errors.ErrorOutput);
- CSharpOutputVisitor outputVisitor = new CSharpOutputVisitor();
- outputVisitor.VisitCompilationUnit(parser.CompilationUnit, null);
- Assert.AreEqual("", outputVisitor.Errors.ErrorOutput);
- Assert.AreEqual(StripWhitespace(program), StripWhitespace(outputVisitor.Text));
- }
-
- internal static string StripWhitespace(string text)
- {
- return text.Trim().Replace("\t", "").Replace("\r", "").Replace("\n", " ").Replace(" ", " ");
- }
-
- void TestTypeMember(string program)
- {
- TestProgram("class A { " + program + " }");
- }
-
- void TestStatement(string statement)
- {
- TestTypeMember("void Method() { " + statement + " }");
- }
-
- void TestExpression(string expression)
- {
- // SEMICOLON HACK : without a trailing semicolon, parsing expressions does not work correctly
- IParser parser = ParserFactory.CreateParser(SupportedLanguage.CSharp, new StringReader(expression + ";"));
- Expression e = parser.ParseExpression();
- Assert.AreEqual("", parser.Errors.ErrorOutput);
- Assert.IsNotNull(e, "ParseExpression returned null");
- CSharpOutputVisitor outputVisitor = new CSharpOutputVisitor();
- e.AcceptVisitor(outputVisitor, null);
- Assert.AreEqual("", outputVisitor.Errors.ErrorOutput);
- Assert.AreEqual(StripWhitespace(expression), StripWhitespace(outputVisitor.Text));
- }
-
- [Test]
- public void Namespace()
- {
- TestProgram("namespace System { }");
- }
-
- [Test]
- public void CustomEvent()
- {
- TestTypeMember("public event EventHandler Click {" +
- " add { obj.Click += value; }" +
- " remove { obj.Click -= value; } " +
- "}");
- }
-
- [Test]
- public void EventWithInitializer()
- {
- TestTypeMember("public event EventHandler Click = delegate { };");
- }
-
- [Test]
- public void Field()
- {
- TestTypeMember("int a;");
- }
-
- [Test]
- public void Method()
- {
- TestTypeMember("void Method() { }");
- }
-
- [Test]
- public void StaticMethod()
- {
- TestTypeMember("static void Method() { }");
- }
-
- [Test]
- public void PartialModifier()
- {
- TestProgram("public partial class Foo { }");
- }
-
- [Test]
- public void GenericClassDefinition()
- {
- TestProgram("public class Foo<T> where T : IDisposable, ICloneable { }");
- }
-
- [Test]
- public void InterfaceWithOutParameters()
- {
- TestProgram("public interface ITest { void Method(out int a, ref double b); }");
- }
-
- [Test]
- public void GenericClassDefinitionWithBaseType()
- {
- TestProgram("public class Foo<T> : BaseClass where T : IDisposable, ICloneable { }");
- }
-
- [Test]
- public void GenericMethodDefinition()
- {
- TestTypeMember("public void Foo<T>(T arg) where T : IDisposable, ICloneable { }");
- }
-
- [Test]
- public void ArrayRank()
- {
- TestStatement("object[,,] a = new object[1, 2, 3];");
- }
-
- [Test]
- public void JaggedArrayRank()
- {
- TestStatement("object[,][,,] a = new object[1, 2][,,];");
- }
-
- [Test]
- public void ArrayInitializer()
- {
- TestStatement("object[] a = new object[] { 1, 2, 3 };");
- }
-
- [Test]
- public void IfStatement()
- {
- TestStatement("if (a) { m1(); } else { m2(); }");
-
- TestStatement("if (a) m1(); else m2(); ");
-
- TestStatement("if (a) {\n" +
- "\tm1();\n" +
- "} else if (b) {\n" +
- "\tm2();\n" +
- "} else {\n" +
- "\tm3();\n" +
- "}");
- }
-
- [Test]
- public void Assignment()
- {
- TestExpression("a = b");
- }
-
- [Test]
- public void UnaryOperator()
- {
- TestExpression("a = -b");
- }
-
- [Test]
- public void BlockStatements()
- {
- TestStatement("checked { }");
- TestStatement("unchecked { }");
- TestStatement("unsafe { }");
- }
-
- [Test]
- public void ExceptionHandling()
- {
- TestStatement("try { throw new Exception(); } " +
- "catch (FirstException e) { } " +
- "catch (SecondException) { } " +
- "catch { throw; } " +
- "finally { }");
- }
-
- [Test]
- public void LoopStatements()
- {
- TestStatement("foreach (Type var in col) { }");
- TestStatement("while (true) { }");
- TestStatement("do { } while (true);");
- }
-
- [Test]
- public void Switch()
- {
- TestStatement("switch (a) {" +
- " case 0:" +
- " case 1:" +
- " break;" +
- " case 2:" +
- " return;" +
- " default:" +
- " throw new Exception(); " +
- "}");
- }
-
- [Test]
- public void MultipleVariableForLoop()
- {
- TestStatement("for (int a = 0, b = 0; b < 100; ++b,a--) { }");
- }
-
- [Test]
- public void SizeOf()
- {
- TestExpression("sizeof(IntPtr)");
- }
-
- [Test]
- public void ParenthesizedExpression()
- {
- TestExpression("(a)");
- }
-
- [Test]
- public void MethodOnGenericClass()
- {
- TestExpression("Container<string>.CreateInstance()");
- }
-
- [Test]
- public void EmptyStatement()
- {
- TestStatement(";");
- }
-
- [Test]
- public void Yield()
- {
- TestStatement("yield break;");
- TestStatement("yield return null;");
- }
-
- [Test]
- public void Integer()
- {
- TestExpression("16");
- }
-
- [Test]
- public void HexadecimalInteger()
- {
- TestExpression("0x10");
- }
-
- [Test]
- public void LongInteger()
- {
- TestExpression("12L");
- }
-
- [Test]
- public void LongUnsignedInteger()
- {
- TestExpression("12uL");
- }
-
- [Test]
- public void UnsignedInteger()
- {
- TestExpression("12u");
- }
-
- [Test]
- public void Double()
- {
- TestExpression("12.5");
- TestExpression("12.0");
- }
-
- [Test]
- public void StringWithUnicodeLiteral()
- {
- TestExpression(@"""\u0001""");
- }
-
- [Test]
- public void GenericMethodInvocation()
- {
- TestExpression("GenericMethod<T>(arg)");
- }
-
- [Test]
- public void Cast()
- {
- TestExpression("(T)a");
- }
-
- [Test]
- public void AsCast()
- {
- TestExpression("a as T");
- }
-
- [Test]
- public void NullCoalescing()
- {
- TestExpression("a ?? b");
- }
-
- [Test]
- public void SpecialIdentifierName()
- {
- TestExpression("@class");
- }
-
- [Test]
- public void InnerClassTypeReference()
- {
- TestExpression("typeof(List<string>.Enumerator)");
- }
-
- [Test]
- public void GenericDelegate()
- {
- TestProgram("public delegate void Predicate<T>(T item) where T : IDisposable, ICloneable;");
- }
-
- [Test]
- public void Enum()
- {
- TestProgram("enum MyTest { Red, Green, Blue, Yellow }");
- }
-
- [Test]
- public void EnumWithInitializers()
- {
- TestProgram("enum MyTest { Red = 1, Green = 2, Blue = 4, Yellow = 8 }");
- }
-
- [Test]
- public void SyncLock()
- {
- TestStatement("lock (a) { Work(); }");
- }
-
- [Test]
- public void Using()
- {
- TestStatement("using (A a = new A()) { a.Work(); }");
- }
-
- [Test]
- public void AbstractProperty()
- {
- TestTypeMember("public abstract bool ExpectsValue { get; set; }");
- TestTypeMember("public abstract bool ExpectsValue { get; }");
- TestTypeMember("public abstract bool ExpectsValue { set; }");
- }
-
- [Test]
- public void SetOnlyProperty()
- {
- TestTypeMember("public bool ExpectsValue { set { DoSomething(value); } }");
- }
-
- [Test]
- public void AbstractMethod()
- {
- TestTypeMember("public abstract void Run();");
- TestTypeMember("public abstract bool Run();");
- }
-
- [Test]
- public void AnonymousMethod()
- {
- TestStatement("Func b = delegate { return true; };");
- TestStatement("Func a = delegate() { return false; };");
- }
-
- [Test]
- public void Interface()
- {
- TestProgram("interface ITest {" +
- " bool GetterAndSetter { get; set; }" +
- " bool GetterOnly { get; }" +
- " bool SetterOnly { set; }" +
- " void InterfaceMethod();" +
- " string InterfaceMethod2();\n" +
- "}");
- }
-
- [Test]
- public void IndexerDeclaration()
- {
- TestTypeMember("public string this[int index] { get { return index.ToString(); } set { } }");
- TestTypeMember("public string IList.this[int index] { get { return index.ToString(); } set { } }");
- }
-
- [Test]
- public void OverloadedConversionOperators()
- {
- TestTypeMember("public static explicit operator TheBug(XmlNode xmlNode) { }");
- TestTypeMember("public static implicit operator XmlNode(TheBug bugNode) { }");
- }
-
- [Test]
- public void OverloadedTrueFalseOperators()
- {
- TestTypeMember("public static bool operator true(TheBug bugNode) { }");
- TestTypeMember("public static bool operator false(TheBug bugNode) { }");
- }
-
- [Test]
- public void OverloadedOperators()
- {
- TestTypeMember("public static TheBug operator +(TheBug bugNode, TheBug bugNode2) { }");
- TestTypeMember("public static TheBug operator >>(TheBug bugNode, int b) { }");
- }
-
- [Test]
- public void PropertyWithAccessorAccessModifiers()
- {
- TestTypeMember("public bool ExpectsValue {\n" +
- "\tinternal get {\n" +
- "\t}\n" +
- "\tprotected set {\n" +
- "\t}\n" +
- "}");
- }
-
- [Test]
- public void UsingStatementForExistingVariable()
- {
- TestStatement("using (obj) {\n}");
- }
-
- [Test]
- public void NewConstraint()
- {
- TestProgram("public struct Rational<T, O> where O : IRationalMath<T>, new()\n{\n}");
- }
-
- [Test]
- public void StructConstraint()
- {
- TestProgram("public struct Rational<T, O> where O : struct\n{\n}");
- }
-
- [Test]
- public void ClassConstraint()
- {
- TestProgram("public struct Rational<T, O> where O : class\n{\n}");
- }
-
- [Test]
- public void ExtensionMethod()
- {
- TestTypeMember("public static T[] Slice<T>(this T[] source, int index, int count)\n{ }");
- }
-
- [Test]
- public void FixedStructField()
- {
- TestProgram(@"unsafe struct CrudeMessage
-{
- public fixed byte data[256];
-}");
- }
-
- [Test]
- public void FixedStructField2()
- {
- TestProgram(@"unsafe struct CrudeMessage
-{
- fixed byte data[4 * sizeof(int)], data2[10];
-}");
- }
-
- [Test]
- public void ImplicitlyTypedLambda()
- {
- TestExpression("x => x + 1");
- }
-
- [Test]
- public void ImplicitlyTypedLambdaWithBody()
- {
- TestExpression("x => { return x + 1; }");
- TestStatement("Func<int, int> f = x => { return x + 1; };");
- }
-
- [Test]
- public void ExplicitlyTypedLambda()
- {
- TestExpression("(int x) => x + 1");
- }
-
- [Test]
- public void ExplicitlyTypedLambdaWithBody()
- {
- TestExpression("(int x) => { return x + 1; }");
- }
-
- [Test]
- public void LambdaMultipleParameters()
- {
- TestExpression("(x, y) => x * y");
- TestExpression("(x, y) => { return x * y; }");
- TestExpression("(int x, int y) => x * y");
- TestExpression("(int x, int y) => { return x * y; }");
- }
-
- [Test]
- public void LambdaNoParameters()
- {
- TestExpression("() => Console.WriteLine()");
- TestExpression("() => { Console.WriteLine(); }");
- }
-
- [Test]
- public void ObjectInitializer()
- {
- TestExpression("new Point { X = 0, Y = 1 }");
- TestExpression("new Rectangle { P1 = new Point { X = 0, Y = 1 }, P2 = new Point { X = 2, Y = 3 } }");
- TestExpression("new Rectangle(arguments) { P1 = { X = 0, Y = 1 }, P2 = { X = 2, Y = 3 } }");
- }
-
- [Test]
- public void CollectionInitializer()
- {
- TestExpression("new List<int> { 0, 1, 2, 3, 4, 5 }");
- TestExpression(@"new List<Contact> { new Contact { Name = ""Chris Smith"", PhoneNumbers = { ""206-555-0101"", ""425-882-8080"" } }, new Contact { Name = ""Bob Harris"", PhoneNumbers = { ""650-555-0199"" } } }");
- }
-
- [Test]
- public void AnonymousTypeCreation()
- {
- TestExpression("new { obj.Name, Price = 26.9, ident }");
- }
-
- [Test]
- public void ImplicitlyTypedArrayCreation()
- {
- TestExpression("new[] { 1, 10, 100, 1000 }");
- }
-
- [Test]
- public void QuerySimpleWhere()
- {
- TestExpression("from n in numbers where n < 5 select n");
- }
-
- [Test]
- public void QueryMultipleFrom()
- {
- TestExpression("from c in customers" +
- " where c.Region == \"WA\"" +
- " from o in c.Orders" +
- " where o.OrderDate >= cutoffDate" +
- " select new { c.CustomerID, o.OrderID }");
- }
-
- [Test]
- public void QuerySimpleOrdering()
- {
- TestExpression("from w in words" +
- " orderby w" +
- " select w");
- }
-
- [Test]
- public void QueryComplexOrdering()
- {
- TestExpression("from w in words" +
- " orderby w.Length descending, w ascending" +
- " select w");
- }
-
- [Test]
- public void QueryGroupInto()
- {
- TestExpression("from n in numbers" +
- " group n by n % 5 into g" +
- " select new { Remainder = g.Key, Numbers = g }");
- }
-
- [Test]
- public void ExternAlias()
- {
- TestProgram("extern alias Name;");
- }
- }
-}
diff --git a/main/contrib/NRefactory/Test/Output/CSharp/VBNetToCSharpConverterTest.cs b/main/contrib/NRefactory/Test/Output/CSharp/VBNetToCSharpConverterTest.cs
deleted file mode 100644
index ac0ecdb31d..0000000000
--- a/main/contrib/NRefactory/Test/Output/CSharp/VBNetToCSharpConverterTest.cs
+++ /dev/null
@@ -1,705 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 3841 $</version>
-// </file>
-
-using System;
-using System.Text;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-using ICSharpCode.NRefactory.PrettyPrinter;
-using ICSharpCode.NRefactory.Visitors;
-
-namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
-{
- [TestFixture]
- public class VBNetToCSharpConverterTest
- {
- public void TestProgram(string input, string expectedOutput)
- {
- IParser parser = ParserFactory.CreateParser(SupportedLanguage.VBNet, new StringReader(input));
- parser.Parse();
- Assert.AreEqual("", parser.Errors.ErrorOutput);
- parser.CompilationUnit.AcceptVisitor(new VBNetConstructsConvertVisitor(), null);
- parser.CompilationUnit.AcceptVisitor(new ToCSharpConvertVisitor(), null);
- CSharpOutputVisitor outputVisitor = new CSharpOutputVisitor();
- outputVisitor.Options.IndentationChar = ' ';
- outputVisitor.Options.IndentSize = 2;
- outputVisitor.VisitCompilationUnit(parser.CompilationUnit, null);
- Assert.AreEqual("", outputVisitor.Errors.ErrorOutput);
- Assert.AreEqual(expectedOutput, outputVisitor.Text);
- }
-
- public void TestMember(string input, string expectedOutput)
- {
- TestMember(input, expectedOutput, null);
- }
-
- public void TestMember(string input, string expectedOutput, string expectedAutomaticImport)
- {
- StringBuilder b = new StringBuilder();
- if (expectedAutomaticImport != null) {
- b.Append("using ");
- b.Append(expectedAutomaticImport);
- b.AppendLine(";");
- }
- b.AppendLine("class tmp1");
- b.AppendLine("{");
- using (StringReader r = new StringReader(expectedOutput)) {
- string line;
- while ((line = r.ReadLine()) != null) {
- b.Append(" ");
- b.AppendLine(line);
- }
- }
- b.AppendLine("}");
- TestProgram("Class tmp1 \n" + input + "\nEnd Class", b.ToString());
- }
-
- public void TestStatement(string input, string expectedOutput)
- {
- StringBuilder b = new StringBuilder();
- b.AppendLine("class tmp1");
- b.AppendLine("{");
- b.AppendLine(" public void tmp2()");
- b.AppendLine(" {");
- using (StringReader r = new StringReader(expectedOutput)) {
- string line;
- while ((line = r.ReadLine()) != null) {
- b.Append(" ");
- b.AppendLine(line);
- }
- }
- b.AppendLine(" }");
- b.AppendLine("}");
- TestProgram("Class tmp1 \n Sub tmp2() \n" + input + "\n End Sub \n End Class", b.ToString());
- }
-
- [Test]
- public void ReferenceEquality()
- {
- TestStatement("b = a Is Nothing",
- "b = a == null;");
- TestStatement("b = a IsNot Nothing",
- "b = a != null;");
- TestStatement("b = Nothing Is a",
- "b = null == a;");
- TestStatement("b = Nothing IsNot a",
- "b = null != a;");
- TestStatement("c = a Is b",
- "c = object.ReferenceEquals(a, b);");
- TestStatement("c = a IsNot b",
- "c = !object.ReferenceEquals(a, b);");
- }
-
- [Test]
- public void AddHandler()
- {
- TestStatement("AddHandler someEvent, AddressOf tmp2",
- "someEvent += tmp2;");
- TestStatement("AddHandler someEvent, AddressOf Me.tmp2",
- "someEvent += this.tmp2;");
- }
-
- [Test]
- public void RemoveHandler()
- {
- TestStatement("RemoveHandler someEvent, AddressOf tmp2",
- "someEvent -= tmp2;");
- TestStatement("RemoveHandler someEvent, AddressOf Me.tmp2",
- "someEvent -= this.tmp2;");
- }
-
- [Test]
- public void RaiseEvent()
- {
- TestStatement("RaiseEvent someEvent(Me, EventArgs.Empty)",
- "if (someEvent != null) {\n someEvent(this, EventArgs.Empty);\n}");
- }
-
- [Test]
- public void EraseStatement()
- {
- TestStatement("Erase a, b",
- "a = null;\nb = null;");
- }
-
- [Test]
- public void VBEvent()
- {
- TestMember("Friend Event CancelNow(ByVal a As String)",
- "internal event CancelNowEventHandler CancelNow;\n" +
- "internal delegate void CancelNowEventHandler(string a);");
- }
-
- [Test]
- public void StaticMethod()
- {
- TestMember("Shared Sub A()\nEnd Sub",
- "public static void A()\n{\n}");
- }
-
- [Test]
- public void Property()
- {
- TestMember("ReadOnly Property A()\nGet\nReturn Nothing\nEnd Get\nEnd Property",
- "public object A {\n get { return null; }\n}");
- }
-
- [Test]
- public void ValueInPropertySetter()
- {
- TestMember("WriteOnly Property A()\nSet\nDim x As Object = Value\nEnd Set\nEnd Property",
- "public object A {\n set {\n object x = value;\n }\n}");
- }
-
- [Test]
- public void ValueInPropertySetter2()
- {
- TestMember("WriteOnly Property A()\nSet(ByVal otherName)\nDim x As Object = otherName\nEnd Set\nEnd Property",
- "public object A {\n set {\n object x = value;\n }\n}");
- }
-
- [Test]
- public void AbstractProperty1()
- {
- TestMember("Public MustOverride Property Salary() As Decimal",
- "public abstract decimal Salary {\n get;\n set;\n}");
- }
-
- [Test]
- public void AbstractProperty2()
- {
- TestMember("Public ReadOnly MustOverride Property Salary() As Decimal",
- "public abstract decimal Salary {\n get;\n}");
- }
-
- [Test]
- public void AbstractProperty3()
- {
- TestMember("Public WriteOnly MustOverride Property Salary() As Decimal",
- "public abstract decimal Salary {\n set;\n}");
- }
-
- [Test]
- public void FieldDeclaredWithDim()
- {
- TestMember("Dim f as String",
- "string f;");
- }
-
- [Test]
- public void MultipleFields()
- {
- TestMember("Private example, test As Single",
- "private float example;\n" +
- "private float test;");
- }
-
- [Test]
- public void MultipleVariables()
- {
- TestStatement("Dim example, test As Single",
- "float example = 0;\n" +
- "float test = 0;");
- }
-
- [Test]
- public void PInvoke()
- {
- TestMember("Declare Function SendMessage Lib \"user32.dll\" (ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As UIntPtr, ByVal lParam As IntPtr) As IntPtr",
- "[DllImport(\"user32.dll\", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]\n" +
- "public static extern IntPtr SendMessage(IntPtr hWnd, int Msg, UIntPtr wParam, IntPtr lParam);",
- "System.Runtime.InteropServices");
-
- TestMember("Declare Unicode Function SendMessage Lib \"user32.dll\" Alias \"SendMessageW\" (ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As UIntPtr, ByVal lParam As IntPtr) As IntPtr",
- "[DllImport(\"user32.dll\", EntryPoint = \"SendMessageW\", CharSet = CharSet.Unicode, SetLastError = true, ExactSpelling = true)]\n" +
- "public static extern IntPtr SendMessage(IntPtr hWnd, int Msg, UIntPtr wParam, IntPtr lParam);",
- "System.Runtime.InteropServices");
-
- TestMember("Declare Auto Function SendMessage Lib \"user32.dll\" (ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As UIntPtr, ByVal lParam As IntPtr) As IntPtr",
- "[DllImport(\"user32.dll\", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)]\n" +
- "public static extern IntPtr SendMessage(IntPtr hWnd, int Msg, UIntPtr wParam, IntPtr lParam);",
- "System.Runtime.InteropServices");
-
- TestMember("<DllImport(\"user32.dll\", CharSet:=CharSet.Auto)> _\n" +
- "Shared Function MessageBox(ByVal hwnd As IntPtr, ByVal t As String, ByVal caption As String, ByVal t2 As UInt32) As Integer\n" +
- "End Function",
- "[DllImport(\"user32.dll\", CharSet = CharSet.Auto)]\n" +
- "public static extern int MessageBox(IntPtr hwnd, string t, string caption, UInt32 t2);");
- }
-
- [Test]
- public void PInvokeSub()
- {
- TestMember("Private Declare Sub Sleep Lib \"kernel32\" (ByVal dwMilliseconds As Long)",
- "[DllImport(\"kernel32\", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]\n" +
- "private static extern void Sleep(long dwMilliseconds);",
- "System.Runtime.InteropServices");
- }
-
- [Test]
- public void Constructor()
- {
- TestMember("Sub New()\n MyBase.New(1)\nEnd Sub",
- "public tmp1() : base(1)\n{\n}");
- TestMember("Public Sub New()\n Me.New(1)\nEnd Sub",
- "public tmp1() : this(1)\n{\n}");
- }
-
- [Test]
- public void StaticConstructor()
- {
- TestMember("Shared Sub New()\nEnd Sub",
- "static tmp1()\n{\n}");
- }
-
- [Test]
- public void Destructor()
- {
- TestMember("Protected Overrides Sub Finalize()\n" +
- " Try\n" +
- " Dead()\n" +
- " Finally\n" +
- " MyBase.Finalize()\n" +
- " End Try\n" +
- "End Sub",
-
- "~tmp1()\n" +
- "{\n" +
- " Dead();\n" +
- "}");
- }
-
- [Test]
- public void IIFExpression()
- {
- TestStatement("a = iif(cond, trueEx, falseEx)",
- "a = (cond ? trueEx : falseEx);");
- }
-
- [Test]
- public void IsNothing()
- {
- TestStatement("a = IsNothing(ex)",
- "a = (ex == null);");
- }
-
- [Test]
- public void IsNotNothing()
- {
- TestStatement("a = Not IsNothing(ex)",
- "a = (ex != null);");
- }
-
- [Test]
- public void CompatibilityMethods()
- {
- TestStatement("Beep()",
- "Interaction.Beep();");
- }
-
- [Test]
- public void EqualsCall()
- {
- TestStatement("Equals(a, b)",
- "Equals(a, b);");
- }
-
- [Test]
- public void Concatenation()
- {
- TestStatement("x = \"Hello \" & \"World\"",
- "x = \"Hello \" + \"World\";");
-
- TestStatement("x &= \"Hello\"",
- "x += \"Hello\";");
- }
-
- [Test]
- public void IntegerDivision()
- {
- TestStatement(@"x = x \ b",
- "x = x / b;");
- TestStatement(@"x \= b",
- "x /= b;");
- }
-
- [Test]
- public void VBConstants()
- {
- TestStatement("a = vbYesNo",
- "a = Constants.vbYesNo;");
- }
-
- [Test]
- public void ForNextLoop()
- {
- TestStatement("For i = 0 To 10\n" +
- "Next",
- "for (i = 0; i <= 10; i++) {\n" +
- "}");
- TestStatement("For l As Long = 0 To 10 Step 2\n" +
- "Next",
- "for (long l = 0; l <= 10; l += 2) {\n" +
- "}");
- TestStatement("For l As Long = 10 To 0 Step -1\n" +
- "Next",
- "for (long l = 10; l >= 0; l += -1) {\n" +
- "}");
- }
-
- [Test]
- public void DoLoop()
- {
- TestStatement("Do \n Loop",
- "do {\n" +
- "}\n" +
- "while (true);");
- TestStatement("Do \n Loop Until i = 10000",
- "do {\n" +
- "}\n" +
- "while (!(i == 10000));");
- }
-
- [Test]
- public void UsingStatement()
- {
- TestStatement("Using r1 As New StreamReader(file1), r2 As New StreamReader(file2)\n" +
- "End Using",
- "using (StreamReader r1 = new StreamReader(file1)) {\n" +
- " using (StreamReader r2 = new StreamReader(file2)) {\n" +
- " }\n" +
- "}");
- }
-
- [Test]
- public void SwitchStatement()
- {
- TestStatement(@"Select Case i
- Case 0 To 5
- i = 10
- Case 11
- i = 0
- Case Else
- i = 9
- End Select",
- "switch (i) {\n" +
- " case 0:\n" +
- " case 1:\n" +
- " case 2:\n" +
- " case 3:\n" +
- " case 4:\n" +
- " case 5:\n" +
- " i = 10;\n" +
- " break;\n" +
- " case 11:\n" +
- " i = 0;\n" +
- " break;\n" +
- " default:\n" +
- " i = 9;\n" +
- " break;\n" +
- "}");
- }
-
- [Test]
- public void FunctionWithoutImplicitReturn()
- {
- TestMember("Public Function run(i As Integer) As Integer\n" +
- " Return 0\n" +
- "End Function",
- "public int run(int i)\n" +
- "{\n" +
- " return 0;\n" +
- "}");
- }
-
- [Test]
- public void FunctionWithImplicitReturn()
- {
- TestMember("Public Function run(i As Integer) As Integer\n" +
- " run = 0\n" +
- "End Function",
- "public int run(int i)\n" +
- "{\n" +
- " return 0;\n" +
- "}");
- }
-
- [Test]
- public void FunctionWithImplicitReturn2()
- {
- TestMember("Public Function run(i As Integer) As Integer\n" +
- " While something\n" +
- " run += i\n" +
- " End While\n" +
- "End Function",
- "public int run(int i)\n" +
- "{\n" +
- " int " + VBNetConstructsConvertVisitor.FunctionReturnValueName + " = 0;\n" +
- " while (something) {\n" +
- " " + VBNetConstructsConvertVisitor.FunctionReturnValueName + " += i;\n" +
- " }\n" +
- " return " + VBNetConstructsConvertVisitor.FunctionReturnValueName + ";\n" +
- "}");
- }
-
- [Test]
- public void FunctionWithImplicitReturn2b()
- {
- const string ReturnValueName = VBNetConstructsConvertVisitor.FunctionReturnValueName;
- TestMember("Public Function run(i As Integer) As Integer\n" +
- " While something\n" +
- " run = run + run(i - 1)\n" +
- " End While\n" +
- "End Function",
- "public int run(int i)\n" +
- "{\n" +
- " int " + ReturnValueName + " = 0;\n" +
- " while (something) {\n" +
- " " + ReturnValueName + " = " + ReturnValueName + " + run(i - 1);\n" +
- " }\n" +
- " return " + ReturnValueName + ";\n" +
- "}");
- }
-
- [Test]
- public void FunctionWithImplicitReturn3()
- {
- TestMember("Public Function run(i As Integer) As CustomType\n" +
- " While something\n" +
- " run = New CustomType()\n" +
- " End While\n" +
- "End Function",
- "public CustomType run(int i)\n" +
- "{\n" +
- " CustomType " + VBNetConstructsConvertVisitor.FunctionReturnValueName + " = default(CustomType);\n" +
- " while (something) {\n" +
- " " + VBNetConstructsConvertVisitor.FunctionReturnValueName + " = new CustomType();\n" +
- " }\n" +
- " return " + VBNetConstructsConvertVisitor.FunctionReturnValueName + ";\n" +
- "}");
- }
-
- [Test]
- public void Exponentiation()
- {
- TestStatement("i = i ^ 2", "i = Math.Pow(i, 2);");
- TestStatement("i ^= 2", "i = Math.Pow(i, 2);");
- }
-
- [Test]
- public void AddNotParenthesis()
- {
- TestStatement("a = Not b = c", "a = !(b == c);");
- }
-
- [Test]
- public void NotIsNothing()
- {
- TestStatement("a = Not fs Is Nothing",
- "a = (fs != null);");
- }
-
- [Test]
- public void StaticMethodVariable()
- {
- TestMember(@"Private Sub Test
- Static j As Integer = 0
- j += 1
-End Sub",
- @"private void Test()
-{
- static_Test_j += 1;
-}
-static int static_Test_j = 0;");
- }
-
- [Test]
- public void StaticMethodVariable2()
- {
- TestMember(@"Private Sub Test
- Static j As Integer = 0
- j += 1
-End Sub
-Private Sub Test2
- Static j As Integer = 0
- j += 2
-End Sub",
- @"private void Test()
-{
- static_Test_j += 1;
-}
-static int static_Test_j = 0;
-private void Test2()
-{
- static_Test2_j += 2;
-}
-static int static_Test2_j = 0;");
- }
-
- [Test]
- public void UsingStatementForExistingVariable()
- {
- TestStatement("Using sw\nEnd Using",
- "using (sw) {\n}");
- }
-
- [Test]
- public void WithStatementTest()
- {
- TestStatement("With Ejes\n" +
- " .AddLine(p1, p2)\n" +
- "End With",
- "{\n Ejes.AddLine(p1, p2);\n}");
- }
-
- [Test]
- public void NestedWithStatements()
- {
- TestStatement(
- "With tb1\n" +
- " With .Font\n" +
- " .Italic = True\n" +
- " End With\n" +
- "End With",
-
- "{\n {\n tb1.Font.Italic = true;\n }\n}");
- }
-
- [Test]
- public void NestedWithStatements2()
- {
- TestStatement(
- "With tb1\n" +
- " With .Something.Font\n" +
- " .Italic = True\n" +
- " End With\n" +
- "End With",
-
- "{\n {\n tb1.Something.Font.Italic = true;\n }\n}");
- }
-
- [Test]
- public void StructureWithImplicitPublicField()
- {
- TestMember("Public Structure Example \n Dim x As Object \n End Structure",
- "public struct Example\n{\n public object x;\n}");
- }
-
- [Test]
- public void InnerClassVisibility()
- {
- TestMember("Class Inner \n End Class",
- "public class Inner\n{\n}");
- }
-
- [Test]
- public void InnerDelegateVisibility()
- {
- TestMember("Delegate Sub Test()",
- "public delegate void Test();");
- }
-
- [Test]
- public void InterfaceVisibility()
- {
- TestMember("Public Interface ITest\n" +
- " Sub Test()\n" +
- " Property Name As String\n" +
- "End Interface",
- "public interface ITest\n" +
- "{\n" +
- " void Test();\n" +
- " string Name {\n" +
- " get;\n" +
- " set;\n" +
- " }\n" +
- "}");
- }
-
- [Test]
- public void ImportAliasPrimitiveType()
- {
- TestProgram("Imports T = System.Boolean", "using T = System.Boolean;" + Environment.NewLine);
- }
-
- [Test]
- public void GlobalTypeReference()
- {
- TestStatement("Dim a As Global.System.String", "global::System.String a = null;");
- }
-
- [Test]
- public void FieldReferenceOnCastExpression()
- {
- TestStatement("CType(obj, IDisposable).Dispose()", "((IDisposable)obj).Dispose();");
- }
-
- [Test]
- public void ComparisonWithEmptyStringLiteral()
- {
- TestStatement("If a = \"\" Then Return", "if (string.IsNullOrEmpty(a)) return; ");
- TestStatement("If a <> \"\" Then Return", "if (!string.IsNullOrEmpty(a)) return; ");
-
- TestStatement("If \"\" = a Then Return", "if (string.IsNullOrEmpty(a)) return; ");
- TestStatement("If \"\" <> a Then Return", "if (!string.IsNullOrEmpty(a)) return; ");
- }
-
- [Test]
- public void ElseIfConversion()
- {
- TestStatement("If a Then\nElse If b Then\nElse\nEnd If",
- "if (a) {\n" +
- "}\n" +
- "else if (b) {\n" +
- "}\n" +
- "else {\n" +
- "}");
- }
-
- [Test]
- public void ArrayCreationUpperBound()
- {
- TestStatement("Dim i As String() = New String(1) {}",
- "string[] i = new string[2];");
- TestStatement("Dim i(1) As String",
- "string[] i = new string[2];");
- TestStatement("Dim i As String() = New String(1) {\"0\", \"1\"}",
- "string[] i = new string[2] { \"0\", \"1\" };");
- TestStatement("Dim i As String(,) = New String(5, 5) {}",
- "string[,] i = new string[6, 6];");
- }
-
- [Test]
- public void InitializeLocalVariables()
- {
- TestStatement("Dim x As Integer", "int x = 0;");
- TestStatement("Dim x As Object", "object x = null;");
- TestStatement("Dim x As String", "string x = null;");
- TestStatement("Dim x", "object x = null;");
- TestStatement("Dim x As Char", "char x = '\\0';");
- TestStatement("Dim x As System.DateTime", "System.DateTime x = default(System.DateTime);");
- }
-
- [Test]
- public void ExpressionAsLoopVariable()
- {
- TestStatement("For Me.Field = 1 To 10 : Next Me.Field", "for (this.Field = 1; this.Field <= 10; this.Field++) {\n}");
- }
-
- [Test]
- public void ConstModuleMember()
- {
- TestProgram("Module Test : Public Const C As Integer = 0 : End Module",
- "static class Test" + Environment.NewLine +
- "{" + Environment.NewLine +
- " public const int C = 0;" + Environment.NewLine +
- "}" + Environment.NewLine);
- }
- }
-}
diff --git a/main/contrib/NRefactory/Test/Output/CodeDOM/CodeDOMParenthesizedExpressionTest.cs b/main/contrib/NRefactory/Test/Output/CodeDOM/CodeDOMParenthesizedExpressionTest.cs
deleted file mode 100644
index f3dd065a96..0000000000
--- a/main/contrib/NRefactory/Test/Output/CodeDOM/CodeDOMParenthesizedExpressionTest.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.CodeDom;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-using ICSharpCode.NRefactory.Visitors;
-
-namespace ICSharpCode.NRefactory.Tests.Output.CodeDOM.Tests
-{
- [TestFixture]
- public class CodeDOMParenthesizedExpressionTest
- {
- [Test]
- public void TestParenthesizedExpression()
- {
- object output = new ParenthesizedExpression(new PrimitiveExpression(5, "5")).AcceptVisitor(new CodeDomVisitor(), null);
- Assert.IsTrue(output is CodePrimitiveExpression);
- }
- }
-}
diff --git a/main/contrib/NRefactory/Test/Output/CodeDOM/CodeDOMPrimitiveExpressionTest.cs b/main/contrib/NRefactory/Test/Output/CodeDOM/CodeDOMPrimitiveExpressionTest.cs
deleted file mode 100644
index ecca93692f..0000000000
--- a/main/contrib/NRefactory/Test/Output/CodeDOM/CodeDOMPrimitiveExpressionTest.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.CodeDom;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-using ICSharpCode.NRefactory.Visitors;
-
-namespace ICSharpCode.NRefactory.Tests.Output.CodeDOM.Tests
-{
- [TestFixture]
- public class CodeDOMPrimitiveExpressionsTests
- {
- [Test]
- public void TestPrimitiveExpression()
- {
- object output = new PrimitiveExpression(5, "5").AcceptVisitor(new CodeDomVisitor(), null);
- Assert.IsTrue(output is CodePrimitiveExpression);
- Assert.AreEqual(((CodePrimitiveExpression)output).Value, 5);
- }
- }
-}
diff --git a/main/contrib/NRefactory/Test/Output/CodeDOM/InvocationExpressionTest.cs b/main/contrib/NRefactory/Test/Output/CodeDOM/InvocationExpressionTest.cs
deleted file mode 100644
index 5f3bbc6410..0000000000
--- a/main/contrib/NRefactory/Test/Output/CodeDOM/InvocationExpressionTest.cs
+++ /dev/null
@@ -1,128 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 2676 $</version>
-// </file>
-
-using System;
-using System.Collections.Generic;
-using System.CodeDom;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-using ICSharpCode.NRefactory.Visitors;
-
-namespace ICSharpCode.NRefactory.Tests.Output.CodeDom.Tests
-{
- [TestFixture]
- public class InvocationExpressionsTests
- {
- [Test]
- public void IdentifierOnlyInvocation()
- {
- // InitializeComponents();
- IdentifierExpression identifier = new IdentifierExpression("InitializeComponents");
- InvocationExpression invocation = new InvocationExpression(identifier, new List<Expression>());
- object output = invocation.AcceptVisitor(new CodeDomVisitor(), null);
- Assert.IsTrue(output is CodeMethodInvokeExpression);
- CodeMethodInvokeExpression mie = (CodeMethodInvokeExpression)output;
- Assert.AreEqual("InitializeComponents", mie.Method.MethodName);
- Assert.IsTrue(mie.Method.TargetObject is CodeThisReferenceExpression);
- }
-
- [Test]
- public void MethodOnThisReferenceInvocation()
- {
- // InitializeComponents();
- MemberReferenceExpression field = new MemberReferenceExpression(new ThisReferenceExpression(), "InitializeComponents");
- InvocationExpression invocation = new InvocationExpression(field, new List<Expression>());
- object output = invocation.AcceptVisitor(new CodeDomVisitor(), null);
- Assert.IsTrue(output is CodeMethodInvokeExpression);
- CodeMethodInvokeExpression mie = (CodeMethodInvokeExpression)output;
- Assert.AreEqual("InitializeComponents", mie.Method.MethodName);
- Assert.IsTrue(mie.Method.TargetObject is CodeThisReferenceExpression);
- }
-
- [Test]
- public void InvocationOfStaticMethod()
- {
- // System.Drawing.Color.FromArgb();
- MemberReferenceExpression field = new MemberReferenceExpression(new IdentifierExpression("System"), "Drawing");
- field = new MemberReferenceExpression(field, "Color");
- field = new MemberReferenceExpression(field, "FromArgb");
- InvocationExpression invocation = new InvocationExpression(field, new List<Expression>());
- object output = invocation.AcceptVisitor(new CodeDomVisitor(), null);
- Assert.IsTrue(output is CodeMethodInvokeExpression);
- CodeMethodInvokeExpression mie = (CodeMethodInvokeExpression)output;
- Assert.AreEqual("FromArgb", mie.Method.MethodName);
- Assert.IsTrue(mie.Method.TargetObject is CodeTypeReferenceExpression);
- Assert.AreEqual("System.Drawing.Color", (mie.Method.TargetObject as CodeTypeReferenceExpression).Type.BaseType);
- }
-
- [Test]
- public void ComplexExample()
- {
- string code = @"class A {
- Button closeButton;
- void M() {
- System.Windows.Forms.Panel panel1;
- closeButton = new System.Windows.Forms.Button();
- panel1 = new System.Windows.Forms.Panel();
- panel1.SuspendLayout();
- panel1.Controls.Add(this.closeButton);
- closeButton.BackColor = System.Drawing.Color.FromArgb();
- panel1.BackColor = System.Drawing.SystemColors.Info;
- }
-}";
- TypeDeclaration decl = Ast.ParseUtilCSharp.ParseGlobal<TypeDeclaration>(code);
- CompilationUnit cu = new CompilationUnit();
- cu.AddChild(decl);
- CodeNamespace ns = (CodeNamespace)cu.AcceptVisitor(new CodeDomVisitor(), null);
- Assert.AreEqual("A", ns.Types[0].Name);
- Assert.AreEqual("closeButton", ns.Types[0].Members[0].Name);
- Assert.AreEqual("M", ns.Types[0].Members[1].Name);
- CodeMemberMethod m = (CodeMemberMethod)ns.Types[0].Members[1];
-
- CodeVariableDeclarationStatement s0 = (CodeVariableDeclarationStatement)m.Statements[0];
- Assert.AreEqual("panel1", s0.Name);
- Assert.AreEqual("System.Windows.Forms.Panel", s0.Type.BaseType);
-
- CodeAssignStatement cas = (CodeAssignStatement)m.Statements[1];
- Assert.AreEqual("closeButton", ((CodeFieldReferenceExpression)cas.Left).FieldName);
-
- cas = (CodeAssignStatement)m.Statements[2];
- Assert.AreEqual("panel1", ((CodeVariableReferenceExpression)cas.Left).VariableName);
-
- CodeExpressionStatement ces = (CodeExpressionStatement)m.Statements[3];
- CodeMethodInvokeExpression mie = (CodeMethodInvokeExpression)ces.Expression;
- Assert.AreEqual("SuspendLayout", mie.Method.MethodName);
- Assert.AreEqual("panel1", ((CodeVariableReferenceExpression)mie.Method.TargetObject).VariableName);
-
- ces = (CodeExpressionStatement)m.Statements[4];
- mie = (CodeMethodInvokeExpression)ces.Expression;
- Assert.AreEqual("Add", mie.Method.MethodName);
- CodePropertyReferenceExpression pre = (CodePropertyReferenceExpression)mie.Method.TargetObject;
- Assert.AreEqual("Controls", pre.PropertyName);
- Assert.AreEqual("panel1", ((CodeVariableReferenceExpression)pre.TargetObject).VariableName);
-
- cas = (CodeAssignStatement)m.Statements[5];
- pre = (CodePropertyReferenceExpression)cas.Left;
- Assert.AreEqual("BackColor", pre.PropertyName);
- Assert.AreEqual("closeButton", ((CodeFieldReferenceExpression)pre.TargetObject).FieldName);
- mie = (CodeMethodInvokeExpression)cas.Right;
- Assert.AreEqual("FromArgb", mie.Method.MethodName);
- Assert.IsTrue(mie.Method.TargetObject is CodeTypeReferenceExpression);
- Assert.AreEqual("System.Drawing.Color", (mie.Method.TargetObject as CodeTypeReferenceExpression).Type.BaseType);
-
- cas = (CodeAssignStatement)m.Statements[6];
- pre = (CodePropertyReferenceExpression)cas.Left;
- Assert.AreEqual("BackColor", pre.PropertyName);
- Assert.AreEqual("panel1", ((CodeVariableReferenceExpression)pre.TargetObject).VariableName);
- pre = (CodePropertyReferenceExpression)cas.Right;
- Assert.AreEqual("Info", pre.PropertyName);
- Assert.IsTrue(pre.TargetObject is CodeTypeReferenceExpression);
- Assert.AreEqual("System.Drawing.SystemColors", (pre.TargetObject as CodeTypeReferenceExpression).Type.BaseType);
- }
- }
-}
diff --git a/main/contrib/NRefactory/Test/Output/SnippetConversion.cs b/main/contrib/NRefactory/Test/Output/SnippetConversion.cs
deleted file mode 100644
index 63b8dfa12c..0000000000
--- a/main/contrib/NRefactory/Test/Output/SnippetConversion.cs
+++ /dev/null
@@ -1,165 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald"/>
-// <version>$Revision: 3841 $</version>
-// </file>
-
-using System;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Ast;
-using ICSharpCode.NRefactory.Visitors;
-using ICSharpCode.NRefactory.PrettyPrinter;
-
-namespace ICSharpCode.NRefactory.Tests.Output
-{
- [TestFixture]
- public class SnippetConversion
- {
- void CS2VB(string input, string expectedOutput)
- {
- SnippetParser parser = new SnippetParser(SupportedLanguage.CSharp);
- INode node = parser.Parse(input);
- // parser.Errors.ErrorOutput contains syntax errors, if any
- Assert.IsNotNull(node);
- Assert.AreEqual("", parser.Errors.ErrorOutput);
- // parser.Specials is the list of comments, preprocessor directives etc.
- PreprocessingDirective.CSharpToVB(parser.Specials);
- // Convert C# constructs to VB.NET:
- node.AcceptVisitor(new CSharpConstructsConvertVisitor(), null);
- node.AcceptVisitor(new ToVBNetConvertVisitor(), null);
-
- VBNetOutputVisitor output = new VBNetOutputVisitor();
-
- using (SpecialNodesInserter.Install(parser.Specials, output)) {
- node.AcceptVisitor(output, null);
- }
- // output.Errors.ErrorOutput contains conversion errors/warnings, if any
- // output.Text contains the converted code
- Assert.AreEqual("", output.Errors.ErrorOutput);
- Assert.AreEqual(expectedOutput, output.Text);
- }
-
- void VB2CS(string input, string expectedOutput)
- {
- SnippetParser parser = new SnippetParser(SupportedLanguage.VBNet);
- INode node = parser.Parse(input);
- // parser.Errors.ErrorOutput contains syntax errors, if any
- Assert.IsNotNull(node);
- Assert.AreEqual("", parser.Errors.ErrorOutput);
- // parser.Specials is the list of comments, preprocessor directives etc.
- PreprocessingDirective.VBToCSharp(parser.Specials);
- // Convert VB.NET constructs to C#:
- node.AcceptVisitor(new VBNetConstructsConvertVisitor(), null);
- node.AcceptVisitor(new ToCSharpConvertVisitor(), null);
-
- CSharpOutputVisitor output = new CSharpOutputVisitor();
- using (SpecialNodesInserter.Install(parser.Specials, output)) {
- node.AcceptVisitor(output, null);
- }
- // output.Errors.ErrorOutput contains conversion errors/warnings, if any
- // output.Text contains the converted code
- Assert.AreEqual("", output.Errors.ErrorOutput);
- Assert.AreEqual(expectedOutput, output.Text);
- }
-
- [Test]
- public void CompilationUnitCS2VB()
- {
- CS2VB(
- @"using System;" + Environment.NewLine +
-"" + Environment.NewLine +
-"public class MyClass" + Environment.NewLine +
-"{" + Environment.NewLine +
-" string abc;" + Environment.NewLine +
-"" + Environment.NewLine +
-" public string Abc { get { return abc; } }" + Environment.NewLine +
-"" + Environment.NewLine +
-" // This is a test method" + Environment.NewLine +
-" static void M<T>(params T[] args) where T : IDisposable" + Environment.NewLine +
-" {" + Environment.NewLine +
-" Console.WriteLine(\"Hello!\");" + Environment.NewLine +
-" }" + Environment.NewLine +
-"}",
-
- @"Imports System" + Environment.NewLine +
-"" + Environment.NewLine +
-"Public Class [MyClass]" + Environment.NewLine +
-" Private m_abc As String" + Environment.NewLine +
-"" + Environment.NewLine +
-" Public ReadOnly Property Abc() As String" + Environment.NewLine +
-" Get" + Environment.NewLine +
-" Return m_abc" + Environment.NewLine +
-" End Get" + Environment.NewLine +
-" End Property" + Environment.NewLine +
-"" + Environment.NewLine +
-" ' This is a test method" + Environment.NewLine +
-" Private Shared Sub M(Of T As IDisposable)(ParamArray args As T())" + Environment.NewLine +
-" Console.WriteLine(\"Hello!\")" + Environment.NewLine +
-" End Sub" + Environment.NewLine +
-"End Class" + Environment.NewLine +
-""
- );
- }
-
-
-
-
- [Test]
- public void TypeMembersCS2VB()
- {
- CS2VB(
- "void Test() {}" + Environment.NewLine +
- "void Test2() {}",
-
- @"Private Sub Test()" + Environment.NewLine +
-"End Sub" + Environment.NewLine +
-"Private Sub Test2()" + Environment.NewLine +
-"End Sub" + Environment.NewLine
-
- );
- }
-
- [Test]
- public void StatementsCS2VB()
- {
- CS2VB(
- "int a = 3;" + Environment.NewLine +
- "a++;",
-
- @"Dim a As Integer = 3" + Environment.NewLine +
-"a += 1" + Environment.NewLine
- );
- }
-
-
- [Test]
- public void TypeMembersVB2CS()
- {
- VB2CS(
- @"Sub Test()" + Environment.NewLine +
-"End Sub" + Environment.NewLine +
-"Sub Test2()" + Environment.NewLine +
-"End Sub" + Environment.NewLine,
- @"public void Test()" + Environment.NewLine +
-"{" + Environment.NewLine +
-"}" + Environment.NewLine +
-"public void Test2()" + Environment.NewLine +
-"{" + Environment.NewLine +
-"}" + Environment.NewLine
-
- );
- }
-
- [Test]
- public void StatementsVB2CS()
- {
- VB2CS(
- @"Dim a As Integer = 3" + Environment.NewLine +
-"a += 1" + Environment.NewLine,
- "int a = 3;" + Environment.NewLine +
- "a += 1;" + Environment.NewLine
- );
- }
- }
-}
diff --git a/main/contrib/NRefactory/Test/Output/SpecialOutputVisitorTest.cs b/main/contrib/NRefactory/Test/Output/SpecialOutputVisitorTest.cs
deleted file mode 100644
index fb5a4d437f..0000000000
--- a/main/contrib/NRefactory/Test/Output/SpecialOutputVisitorTest.cs
+++ /dev/null
@@ -1,265 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 3824 $</version>
-// </file>
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-using ICSharpCode.NRefactory.PrettyPrinter;
-
-namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
-{
- [TestFixture]
- public class SpecialOutputVisitorTest
- {
- void TestProgram(string program)
- {
- IParser parser = ParserFactory.CreateParser(SupportedLanguage.CSharp, new StringReader(program));
- parser.Parse();
- Assert.AreEqual("", parser.Errors.ErrorOutput);
- CSharpOutputVisitor outputVisitor = new CSharpOutputVisitor();
- outputVisitor.Options.IndentationChar = ' ';
- outputVisitor.Options.TabSize = 2;
- outputVisitor.Options.IndentSize = 2;
- using (SpecialNodesInserter.Install(parser.Lexer.SpecialTracker.RetrieveSpecials(),
- outputVisitor)) {
- outputVisitor.VisitCompilationUnit(parser.CompilationUnit, null);
- }
- Assert.AreEqual("", outputVisitor.Errors.ErrorOutput);
- Assert.AreEqual(program.Replace("\r", ""), outputVisitor.Text.TrimEnd().Replace("\r", ""));
- parser.Dispose();
- }
-
- void TestProgramVB(string program)
- {
- IParser parser = ParserFactory.CreateParser(SupportedLanguage.VBNet, new StringReader(program));
- parser.Parse();
- Assert.AreEqual("", parser.Errors.ErrorOutput);
- VBNetOutputVisitor outputVisitor = new VBNetOutputVisitor();
- outputVisitor.Options.IndentationChar = ' ';
- outputVisitor.Options.TabSize = 2;
- outputVisitor.Options.IndentSize = 2;
- using (SpecialNodesInserter.Install(parser.Lexer.SpecialTracker.RetrieveSpecials(),
- outputVisitor)) {
- outputVisitor.VisitCompilationUnit(parser.CompilationUnit, null);
- }
- Assert.AreEqual("", outputVisitor.Errors.ErrorOutput);
- Assert.AreEqual(program.Replace("\r", ""), outputVisitor.Text.TrimEnd().Replace("\r", ""));
- parser.Dispose();
- }
-
- void TestProgramCS2VB(string programCS, string programVB)
- {
- IParser parser = ParserFactory.CreateParser(SupportedLanguage.CSharp, new StringReader(programCS));
- parser.Parse();
- Assert.AreEqual("", parser.Errors.ErrorOutput);
- VBNetOutputVisitor outputVisitor = new VBNetOutputVisitor();
- List<ISpecial> specials = parser.Lexer.SpecialTracker.RetrieveSpecials();
- PreprocessingDirective.CSharpToVB(specials);
- outputVisitor.Options.IndentationChar = ' ';
- outputVisitor.Options.IndentSize = 2;
- using (SpecialNodesInserter.Install(specials, outputVisitor)) {
- outputVisitor.VisitCompilationUnit(parser.CompilationUnit, null);
- }
- Assert.AreEqual("", outputVisitor.Errors.ErrorOutput);
- Assert.AreEqual(programVB.Replace("\r", ""), outputVisitor.Text.TrimEnd().Replace("\r", ""));
- parser.Dispose();
- }
-
- [Test]
- public void BlankLine()
- {
- TestProgram("using A;\n\nusing B;");
- }
-
- [Test]
- public void BlankLineAtBeginning()
- {
- TestProgram("\nusing A;\n\nusing B;");
- }
-
- [Test]
- public void SimpleComments()
- {
- TestProgram("// before class\n" +
- "class A\n" +
- "{\n" +
- " // in class\n" +
- "}\n" +
- "// after class");
- }
-
- [Test]
- public void BlockComment()
- {
- TestProgram("/* before class */\n" +
- "class A\n" +
- "{\n" +
- " /* in class */\n" +
- "}\n" +
- "/* after class */");
- }
-
- [Test]
- public void ComplexCommentMix()
- {
- TestProgram("/* before class */\n" +
- "// line comment before\n" +
- "/* block comment before */\n" +
- "class A\n" +
- "{\n" +
- " /* in class */\n" +
- " // in class 2" +
- " /* in class 3 */\n" +
- "}\n" +
- "/* after class */\n" +
- "// after class 2\n" +
- "/* after class 3*/");
- }
-
- [Test]
- public void PreProcessing()
- {
- TestProgram("#if WITH_A\n" +
- "class A\n" +
- "{\n" +
- "}\n" +
- "#end if");
- }
-
- [Test]
- public void Enum()
- {
- TestProgram("enum Test\n" +
- "{\n" +
- " // a\n" +
- " m1,\n" +
- " // b\n" +
- " m2\n" +
- " // c\n" +
- "}\n" +
- "// d");
- }
-
- [Test]
- public void EnumVB()
- {
- TestProgramVB("Enum Test\n" +
- " ' a\n" +
- " m1\n" +
- " ' b\n" +
- " m2\n" +
- " ' c\n" +
- "End Enum\n" +
- "' d");
- }
-
- [Test]
- public void RegionInsideMethod()
- {
- TestProgram(@"public class Class1
-{
- private bool test(int l, int lvw)
- {
- #region Metodos Auxiliares
- int i = 1;
- return false;
- #endregion
- }
-}");
- }
-
- [Test]
- public void CommentsInsideMethodVB()
- {
- TestProgramVB(@"Public Class Class1
- Private Function test(l As Integer, lvw As Integer) As Boolean
- ' Begin
- Dim i As Integer = 1
- Return False
- ' End of method
- End Function
-End Class");
- }
-
- [Test]
- public void BlankLinesVB()
- {
- TestProgramVB("Imports System\n" +
- "\n" +
- "Imports System.IO");
- TestProgramVB("Imports System\n" +
- "\n" +
- "\n" +
- "Imports System.IO");
- TestProgramVB("\n" +
- "' Some comment\n" +
- "\n" +
- "Imports System.IO");
- }
-
- [Test]
- public void CommentAfterAttribute()
- {
- TestProgramCS2VB("class A { [PreserveSig] public void B(// comment\nint c) {} }",
- "Class A\n" +
- " ' comment\n" +
- " <PreserveSig> _\n" +
- " Public Sub B(c As Integer)\n" +
- " End Sub\n" +
- "End Class");
- }
-
- [Test]
- public void ConditionalAttribute()
- {
- TestProgram("class A\n" +
- "{\n" +
- " #if TEST\n" +
- " [MyAttribute()]\n" +
- " #endif\n" +
- " public int Field;\n" +
- "}\n" +
- "#end if");
- }
-
- [Test]
- public void ConditionalCompilationCS2VB()
- {
- TestProgramCS2VB("class A\n" +
- "{\n" +
- " #if TEST\n" +
- " public int Field;\n" +
- " #endif\n" +
- "}",
- "Class A\n" +
- " #If TEST Then\n" +
- " Public Field As Integer\n" +
- " #End If\n" +
- "End Class");
- }
-
- [Test]
- public void RegionInsideMethodCS2VB()
- {
- TestProgramCS2VB("class A { void M() {\n" +
- " #region PP\n" +
- " return;" +
- " #endregion\n" +
- "} }",
- "Class A\n" +
- " Sub M()\n" +
- " '#Region \"PP\"\n" +
- " Return\n" +
- " '#End Region\n" +
- " End Sub\n" +
- "End Class");
- }
- }
-}
diff --git a/main/contrib/NRefactory/Test/Output/VBNet/CSharpToVBNetConverterTest.cs b/main/contrib/NRefactory/Test/Output/VBNet/CSharpToVBNetConverterTest.cs
deleted file mode 100644
index f6932751f5..0000000000
--- a/main/contrib/NRefactory/Test/Output/VBNet/CSharpToVBNetConverterTest.cs
+++ /dev/null
@@ -1,542 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 3841 $</version>
-// </file>
-
-using System;
-using System.Text;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-using ICSharpCode.NRefactory.PrettyPrinter;
-using ICSharpCode.NRefactory.Visitors;
-
-namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
-{
- [TestFixture]
- public class CSharpToVBNetConverterTest
- {
- public void TestProgram(string input, string expectedOutput)
- {
- IParser parser = ParserFactory.CreateParser(SupportedLanguage.CSharp, new StringReader(input));
- parser.Parse();
- Assert.AreEqual("", parser.Errors.ErrorOutput);
- parser.CompilationUnit.AcceptVisitor(new CSharpConstructsConvertVisitor(), null);
- parser.CompilationUnit.AcceptVisitor(new ToVBNetConvertVisitor(), null);
- VBNetOutputVisitor outputVisitor = new VBNetOutputVisitor();
- outputVisitor.Options.IndentationChar = ' ';
- outputVisitor.Options.IndentSize = 2;
- outputVisitor.Options.OutputByValModifier = true;
- outputVisitor.VisitCompilationUnit(parser.CompilationUnit, null);
- Assert.AreEqual("", outputVisitor.Errors.ErrorOutput);
- Assert.AreEqual(expectedOutput, outputVisitor.Text);
- }
-
- public void TestMember(string input, string expectedOutput)
- {
- StringBuilder b = new StringBuilder();
- b.AppendLine("Class tmp1");
- using (StringReader r = new StringReader(expectedOutput)) {
- string line;
- while ((line = r.ReadLine()) != null) {
- b.Append(" ");
- b.AppendLine(line);
- }
- }
- b.AppendLine("End Class");
- TestProgram("class tmp1 { \n" + input + "\n}", b.ToString());
- }
-
- public void TestStatement(string input, string expectedOutput)
- {
- StringBuilder b = new StringBuilder();
- b.AppendLine("Class tmp1");
- b.AppendLine(" Private Sub tmp2()");
- using (StringReader r = new StringReader(expectedOutput)) {
- string line;
- while ((line = r.ReadLine()) != null) {
- b.Append(" ");
- b.AppendLine(line);
- }
- }
- b.AppendLine(" End Sub");
- b.AppendLine("End Class");
- TestProgram("class tmp1 { void tmp2() {\n" + input + "\n}}", b.ToString());
- }
-
- [Test]
- public void MoveImportsStatement()
- {
- TestProgram("namespace test { using SomeNamespace; }",
- "Imports SomeNamespace" + Environment.NewLine +
- "Namespace test" + Environment.NewLine +
- "End Namespace" + Environment.NewLine);
- }
-
- [Test]
- public void ClassImplementsInterface()
- {
- TestProgram("class test : IComparable { }",
- "Class test" + Environment.NewLine +
- " Implements IComparable" + Environment.NewLine +
- "End Class" + Environment.NewLine);
- }
-
- [Test]
- public void ClassImplementsInterface2()
- {
- TestProgram("class test : System.IComparable { }",
- "Class test" + Environment.NewLine +
- " Implements System.IComparable" + Environment.NewLine +
- "End Class" + Environment.NewLine);
- }
-
- [Test]
- public void ClassInheritsClass()
- {
- TestProgram("class test : InvalidDataException { }",
- "Class test" + Environment.NewLine +
- " Inherits InvalidDataException" + Environment.NewLine +
- "End Class"+ Environment.NewLine);
- }
-
- [Test]
- public void ClassInheritsClass2()
- {
- TestProgram("class test : System.IO.InvalidDataException { }",
- "Class test" + Environment.NewLine +
- " Inherits System.IO.InvalidDataException" + Environment.NewLine +
- "End Class" + Environment.NewLine);
- }
-
- [Test]
- public void ForWithUnknownConditionAndSingleStatement()
- {
- TestStatement("for (i = 0; unknownCondition; i++) b[i] = s[i];",
- "i = 0\n" +
- "While unknownCondition\n" +
- " b(i) = s(i)\n" +
- " i += 1\n" +
- "End While");
- }
-
- [Test]
- public void ForWithUnknownConditionAndBlock()
- {
- TestStatement("for (i = 0; unknownCondition; i++) { b[i] = s[i]; }",
- "i = 0\n" +
- "While unknownCondition\n" +
- " b(i) = s(i)\n" +
- " i += 1\n" +
- "End While");
- }
-
- [Test]
- public void ForWithSingleStatement()
- {
- TestStatement("for (i = 0; i < end; i++) b[i] = s[i];",
- "For i = 0 To [end] - 1\n" +
- " b(i) = s(i)\n" +
- "Next");
- }
- [Test]
- public void ForWithBlock()
- {
- TestStatement("for (i = 0; i < end; i++) { b[i] = s[i]; }",
- "For i = 0 To [end] - 1\n" +
- " b(i) = s(i)\n" +
- "Next");
- }
-
- [Test]
- public void RaiseEvent()
- {
- TestStatement("if (MyEvent != null) MyEvent(this, EventArgs.Empty);",
- "RaiseEvent MyEvent(Me, EventArgs.Empty)");
- TestStatement("if ((MyEvent != null)) MyEvent(this, EventArgs.Empty);",
- "RaiseEvent MyEvent(Me, EventArgs.Empty)");
- TestStatement("if (null != MyEvent) { MyEvent(this, EventArgs.Empty); }",
- "RaiseEvent MyEvent(Me, EventArgs.Empty)");
- TestStatement("if (this.MyEvent != null) MyEvent(this, EventArgs.Empty);",
- "RaiseEvent MyEvent(Me, EventArgs.Empty)");
- TestStatement("if (MyEvent != null) this.MyEvent(this, EventArgs.Empty);",
- "RaiseEvent MyEvent(Me, EventArgs.Empty)");
- TestStatement("if ((this.MyEvent != null)) { this.MyEvent(this, EventArgs.Empty); }",
- "RaiseEvent MyEvent(Me, EventArgs.Empty)");
- }
-
- [Test]
- public void IfStatementSimilarToRaiseEvent()
- {
- TestStatement("if (FullImage != null) DrawImage();",
- "If FullImage IsNot Nothing Then\n" +
- " DrawImage()\n" +
- "End If");
- // regression test:
- TestStatement("if (FullImage != null) e.DrawImage();",
- "If FullImage IsNot Nothing Then\n" +
- " e.DrawImage()\n" +
- "End If");
- // with braces:
- TestStatement("if (FullImage != null) { DrawImage(); }",
- "If FullImage IsNot Nothing Then\n" +
- " DrawImage()\n" +
- "End If");
- TestStatement("if (FullImage != null) { e.DrawImage(); }",
- "If FullImage IsNot Nothing Then\n" +
- " e.DrawImage()\n" +
- "End If");
- // another bug related to the IfStatement code:
- TestStatement("if (Tiles != null) foreach (Tile t in Tiles) this.TileTray.Controls.Remove(t);",
- "If Tiles IsNot Nothing Then\n" +
- " For Each t As Tile In Tiles\n" +
- " Me.TileTray.Controls.Remove(t)\n" +
- " Next\n" +
- "End If");
- }
-
- [Test]
- public void ElseIfStatement()
- {
- TestStatement("if (a) {} else if (b) {} else {}",
- "If a Then\n" +
- "ElseIf b Then\n" +
- "Else\n" +
- "End If");
- }
-
- [Test]
- public void AnonymousMethod()
- {
- TestMember("void A() { Converter<int, int> i = delegate(int argument) { return argument * 2; }; }",
- "Private Sub A()\n" +
- " Dim i As Converter(Of Integer, Integer) = Function(ByVal argument As Integer) argument * 2\n" +
- "End Sub");
- }
-
- [Test]
- public void StaticMethod()
- {
- TestMember("static void A() {}",
- "Private Shared Sub A()\nEnd Sub");
- }
-
- [Test]
- public void PInvoke()
- {
- TestMember("[DllImport(\"user32.dll\", CharSet = CharSet.Auto)]" + Environment.NewLine +
- "public static extern int MessageBox(IntPtr hwnd, string t, string caption, UInt32 t2);",
- "<DllImport(\"user32.dll\", CharSet := CharSet.Auto)> _" + Environment.NewLine +
- "Public Shared Function MessageBox(ByVal hwnd As IntPtr, ByVal t As String, ByVal caption As String, ByVal t2 As UInt32) As Integer\n" +
- "End Function");
-
- TestMember("[DllImport(\"user32.dll\", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]\n" +
- "public static extern IntPtr SendMessage(IntPtr hWnd, int Msg, UIntPtr wParam, IntPtr lParam);",
- "Public Declare Ansi Function SendMessage Lib \"user32.dll\" (ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As UIntPtr, ByVal lParam As IntPtr) As IntPtr");
-
- TestMember("[DllImport(\"user32.dll\", SetLastError = true, ExactSpelling = true, EntryPoint = \"SendMessageW\")]\n" +
- "public static extern IntPtr SendMessage(IntPtr hWnd, int Msg, UIntPtr wParam, IntPtr lParam);",
- "Public Declare Auto Function SendMessage Lib \"user32.dll\" Alias \"SendMessageW\" (ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As UIntPtr, ByVal lParam As IntPtr) As IntPtr");
- }
-
- [Test]
- public void PInvokeSub()
- {
- TestMember("[DllImport(\"kernel32\", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]\n" +
- "private static extern void Sleep(long dwMilliseconds);",
- "Private Declare Ansi Sub Sleep Lib \"kernel32\" (ByVal dwMilliseconds As Long)");
- }
-
- [Test]
- public void Constructor()
- {
- TestMember("public tmp1() : base(1) { }",
- "Public Sub New()\n MyBase.New(1)\nEnd Sub");
- TestMember("public tmp1() : this(1) { }",
- "Public Sub New()\n Me.New(1)\nEnd Sub");
- }
-
- [Test]
- public void StaticConstructor()
- {
- TestMember("static tmp1() { }",
- "Shared Sub New()\nEnd Sub");
- }
-
- [Test]
- public void Destructor()
- {
- TestMember("~tmp1() { Dead(); }",
- "Protected Overrides Sub Finalize()\n" +
- " Try\n" +
- " Dead()\n" +
- " Finally\n" +
- " MyBase.Finalize()\n" +
- " End Try\n" +
- "End Sub");
- }
-
- [Test]
- public void Indexer()
- {
- TestMember("public CategoryInfo this[int index] { get { return List[index] as CategoryInfo; } }",
- "Public Default ReadOnly Property Item(ByVal index As Integer) As CategoryInfo\n" +
- " Get\n" +
- " Return TryCast(List(index), CategoryInfo)\n" +
- " End Get\n" +
- "End Property");
- }
-
- [Test]
- public void RenameConflictingNames()
- {
- TestMember("int count;" +
- "public int Count { get { return count; } }" +
- "void Test1(int count) { count = 3; }" +
- "void Test2() { int count; count = 3; }" +
- "void Test3() { foreach (int count in someList) { count = 3; } }",
-
- "Private m_count As Integer\n" +
- "Public ReadOnly Property Count() As Integer\n" +
- " Get\n" +
- " Return m_count\n" +
- " End Get\n" +
- "End Property\n" +
- "Private Sub Test1(ByVal count As Integer)\n" +
- " count = 3\n" +
- "End Sub\n" +
- "Private Sub Test2()\n" +
- " Dim count As Integer\n" +
- " count = 3\n" +
- "End Sub\n" +
- "Private Sub Test3()\n" +
- " For Each count As Integer In someList\n" +
- " count = 3\n" +
- " Next\n" +
- "End Sub");
- }
-
- [Test]
- public void NullCoalescing()
- {
- TestStatement("c = a ?? b;",
- "c = If(a, b)");
- }
-
- [Test]
- public void Ternary()
- {
- TestStatement("d = a ? b : c;",
- "d = If(a, b, c)");
- }
-
- [Test]
- public void ConvertedLoop()
- {
- TestStatement("while (cond) example();",
- "While cond\n" +
- " example()\n" +
- "End While");
- }
-
- [Test]
- public void UIntVariableDeclaration()
- {
- TestStatement("uint s = 0;", "Dim s As UInteger = 0");
- }
-
- [Test]
- public void BreakInWhileLoop()
- {
- TestStatement("while (test != null) { break; }",
- "While test IsNot Nothing\n" +
- " Exit While\n" +
- "End While");
- }
-
- [Test]
- public void BreakInDoLoop()
- {
- TestStatement("do { break; } while (test != null);",
- "Do\n" +
- " Exit Do\n" +
- "Loop While test IsNot Nothing");
- }
-
- [Test]
- public void StructFieldVisibility()
- {
- TestMember("public struct A { int field; }",
- "Public Structure A\n" +
- " Private field As Integer\n" +
- "End Structure");
- }
-
- [Test]
- public void InnerClassVisibility()
- {
- TestMember("class Inner\n{\n}",
- "Private Class Inner\n" +
- "End Class");
- }
-
- [Test]
- public void InnerDelegateVisibility()
- {
- TestMember("delegate void Test();",
- "Private Delegate Sub Test()");
- }
-
- [Test]
- public void InterfaceVisibility()
- {
- TestMember("public interface ITest {\n" +
- " void Test();\n" +
- " string Name { get; set; }\n" +
- "}",
- "Public Interface ITest\n" +
- " Sub Test()\n" +
- " Property Name() As String\n" +
- "End Interface");
- }
-
- [Test]
- public void ImportAliasPrimitiveType()
- {
- TestProgram("using T = System.Boolean;", "Imports T = System.Boolean"+ Environment.NewLine);
- }
-
- [Test]
- public void DefaultExpression()
- {
- TestStatement("T oldValue = default(T);", "Dim oldValue As T = Nothing");
- }
-
- [Test]
- public void StaticClass()
- {
- TestProgram("public static class Test {}", @"Public NotInheritable Class Test" + Environment.NewLine +
-" Private Sub New()" + Environment.NewLine +
-" End Sub" + Environment.NewLine +
-"End Class" + Environment.NewLine);
- }
-
- [Test]
- public void GlobalTypeReference()
- {
- TestStatement("global::System.String a;", "Dim a As Global.System.String");
- }
-
- [Test]
- public void TestMethodCallOnCastExpression()
- {
- TestStatement("((IDisposable)o).Dispose();", "DirectCast(o, IDisposable).Dispose()");
- }
-
- [Test]
- public void CaseConflictingMethod()
- {
- TestMember("void T(int v) { int V = v; M(V, v); }",
- "Private Sub T(ByVal v__1 As Integer)\n" +
- " Dim V__2 As Integer = v__1\n" +
- " M(V__2, v__1)\n" +
- "End Sub");
- }
-
- [Test]
- public void ArrayCreationUpperBound()
- {
- TestStatement("string[] i = new string[2];",
- "Dim i As String() = New String(1) {}");
- TestStatement("string[] i = new string[2] { \"0\", \"1\" };",
- "Dim i As String() = New String(1) {\"0\", \"1\"}");
- TestStatement("string[,] i = new string[6, 6];",
- "Dim i As String(,) = New String(5, 5) {}");
- }
-
- [Test]
- public void VariableNamedRem()
- {
- TestStatement("int rem;", "Dim [rem] As Integer");
- TestStatement("int Rem;", "Dim [Rem] As Integer");
- TestStatement("int a = rem;", "Dim a As Integer = [rem]");
- }
-
- [Test]
- public void ArrayCast()
- {
- TestStatement("string[] i = (string[])obj;",
- "Dim i As String() = DirectCast(obj, String())");
-
- // ensure the converter does not use CInt:
- TestStatement("int[] i = (int[])obj;",
- "Dim i As Integer() = DirectCast(obj, Integer())");
- }
-
-
- [Test]
- public void PrimitiveCast()
- {
- TestStatement("int a = (int)number;", "Dim a As Integer = CInt(number)");
- TestStatement("byte i = (byte)obj;", "Dim i As Byte = CByte(obj)");
- TestStatement("short i = (short)obj;", "Dim i As Short = CShort(obj)");
- TestStatement("long i = (long)obj;", "Dim i As Long = CLng(obj)");
- }
-
- [Test]
- public void PrimitiveUnsignedCast()
- {
- TestStatement("uint i = (uint)obj;", "Dim i As UInteger = CUInt(obj)");
- TestStatement("sbyte i = (sbyte)obj;", "Dim i As SByte = CSByte(obj)");
- TestStatement("ushort i = (ushort)obj;", "Dim i As UShort = CUShort(obj)");
- TestStatement("ulong i = (ulong)obj;", "Dim i As ULong = CULng(obj)");
- }
-
- [Test]
- public void InlineAssignment()
- {
- TestProgram(@"public class Convert { void Run(string s) { char c; if ((c = s[0]) == '\n') { c = ' '; } } }",
- @"Public Class Convert" + Environment.NewLine +
-" Private Sub Run(ByVal s As String)" + Environment.NewLine +
-" Dim c As Char" + Environment.NewLine +
-" If (InlineAssignHelper(c, s(0))) = ControlChars.Lf Then" + Environment.NewLine +
-" c = \" \"C" + Environment.NewLine +
-" End If" + Environment.NewLine +
-" End Sub" + Environment.NewLine +
-" Private Shared Function InlineAssignHelper(Of T)(ByRef target As T, ByVal value As T) As T" + Environment.NewLine +
-" target = value" + Environment.NewLine +
-" Return value" + Environment.NewLine +
-" End Function" + Environment.NewLine +
-"End Class" + Environment.NewLine);
- }
-
- [Test]
- public void StandaloneBlockStatement()
- {
- TestStatement("{ int a; } { string a; }",
- "If True Then\n" +
- " Dim a As Integer\n" +
- "End If\n" +
- "If True Then\n" +
- " Dim a As String\n" +
- "End If");
- }
-
- [Test]
- public void CSharpLinefeedToVBString()
- {
- TestStatement(@"string Test = ""My Test\n"";",
- @"Dim Test As String = ""My Test"" & vbLf");
- }
-
- [Test]
- public void CSharpTabToVBString()
- {
- TestStatement(@"string Test = ""\t\a"";",
- @"Dim Test As String = vbTab & ChrW(7)");
- }
- }
-}
diff --git a/main/contrib/NRefactory/Test/Output/VBNet/VBNetOutputTest.cs b/main/contrib/NRefactory/Test/Output/VBNet/VBNetOutputTest.cs
deleted file mode 100644
index 608beedd40..0000000000
--- a/main/contrib/NRefactory/Test/Output/VBNet/VBNetOutputTest.cs
+++ /dev/null
@@ -1,446 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 3712 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-using ICSharpCode.NRefactory.PrettyPrinter;
-
-namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
-{
- [TestFixture]
- public class VBNetOutputTest
- {
- void TestProgram(string program)
- {
- IParser parser = ParserFactory.CreateParser(SupportedLanguage.VBNet, new StringReader(program));
- parser.Parse();
- Assert.AreEqual("", parser.Errors.ErrorOutput);
- VBNetOutputVisitor outputVisitor = new VBNetOutputVisitor();
- outputVisitor.Options.OutputByValModifier = true;
- outputVisitor.VisitCompilationUnit(parser.CompilationUnit, null);
- Assert.AreEqual("", outputVisitor.Errors.ErrorOutput);
- Assert.AreEqual(StripWhitespace(program), StripWhitespace(outputVisitor.Text));
- }
-
- string StripWhitespace(string text)
- {
- return text.Trim().Replace("\t", "").Replace("\r", "").Replace("\n", " ").Replace(" ", " ");
- }
-
- void TestTypeMember(string program)
- {
- TestProgram("Class A\n" + program + "\nEnd Class");
- }
-
- void TestStatement(string statement)
- {
- TestTypeMember("Sub Method()\n" + statement + "\nEnd Sub");
- }
-
- void TestExpression(string expression)
- {
- IParser parser = ParserFactory.CreateParser(SupportedLanguage.VBNet, new StringReader(expression));
- Expression e = parser.ParseExpression();
- Assert.AreEqual("", parser.Errors.ErrorOutput);
- VBNetOutputVisitor outputVisitor = new VBNetOutputVisitor();
- e.AcceptVisitor(outputVisitor, null);
- Assert.AreEqual("", outputVisitor.Errors.ErrorOutput);
- Assert.AreEqual(StripWhitespace(expression), StripWhitespace(outputVisitor.Text));
- }
-
- [Test]
- public void Field()
- {
- TestTypeMember("Private a As Integer");
- }
-
- [Test]
- public void Method()
- {
- TestTypeMember("Sub Method()\nEnd Sub");
- }
-
- [Test]
- public void EnumWithBaseType()
- {
- TestProgram("Public Enum Foo As UShort\nEnd Enum");
- }
-
- [Test]
- public void PartialModifier()
- {
- TestProgram("Public Partial Class Foo\nEnd Class");
- }
-
- [Test]
- public void MustInheritClass()
- {
- TestProgram("Public MustInherit Class Foo\nEnd Class");
- }
-
- [Test]
- public void GenericClassDefinition()
- {
- TestProgram("Public Class Foo(Of T As {IDisposable, ICloneable})\nEnd Class");
- }
-
- [Test]
- public void GenericClassDefinitionWithBaseType()
- {
- TestProgram("Public Class Foo(Of T As IDisposable)\nInherits BaseType\nEnd Class");
- }
-
- [Test]
- public void GenericMethodDefinition()
- {
- TestTypeMember("Public Sub Foo(Of T As {IDisposable, ICloneable})(ByVal arg As T)\nEnd Sub");
- }
-
- [Test]
- public void ArrayRank()
- {
- TestStatement("Dim a As Object(,,)");
- }
-
- [Test]
- public void ArrayInitialization()
- {
- TestStatement("Dim a As Object() = New Object(10) {}");
- TestTypeMember("Private MultiDim As Integer(,) = {{1, 2}, {1, 3}}");
- TestExpression("New Integer(, ) {{1, 1}, {1, 1}}");
- }
-
- [Test]
- public void MethodCallWithOptionalArguments()
- {
- TestExpression("M(, )");
- }
-
- [Test]
- public void IfStatement()
- {
- TestStatement("If a Then\n" +
- "\tm1()\n" +
- "ElseIf b Then\n" +
- "\tm2()\n" +
- "Else\n" +
- "\tm3()\n" +
- "End If");
- }
-
- [Test]
- public void ForNextLoop()
- {
- TestStatement("For i = 0 To 10\n" +
- "Next");
- TestStatement("For i As Long = 10 To 0 Step -1\n" +
- "Next");
- }
-
- [Test]
- public void DoLoop()
- {
- TestStatement("Do\n" +
- "Loop");
- TestStatement("Do\n" +
- "Loop While Not (i = 10)");
- }
-
- [Test]
- public void SelectCase()
- {
- TestStatement(@"Select Case i
- Case 0
- Case 1 To 4
- Case Else
-End Select");
- }
-
- [Test]
- public void UsingStatement()
- {
- TestStatement(@"Using nf As New Font(), nf2 As New List(Of Font)(), nf3 = Nothing
- Bla(nf)
-End Using");
- }
-
- [Test]
- public void UntypedVariable()
- {
- TestStatement("Dim x = 0");
- }
-
- [Test]
- public void UntypedField()
- {
- TestTypeMember("Dim x = 0");
- }
-
- [Test]
- public void Assignment()
- {
- TestExpression("a = b");
- }
-
- [Test]
- public void SpecialIdentifiers()
- {
- // Assembly, Ansi and Until are contextual keywords
- // Custom is valid inside methods, but not valid for field names
- TestExpression("Assembly = Ansi * [For] + Until - [Custom]");
- }
-
- [Test]
- public void DictionaryAccess()
- {
- TestExpression("c!key");
- }
-
- [Test]
- public void GenericMethodInvocation()
- {
- TestExpression("GenericMethod(Of T)(arg)");
- }
-
- [Test]
- public void SpecialIdentifierName()
- {
- TestExpression("[Class]");
- }
-
- [Test]
- public void GenericDelegate()
- {
- TestProgram("Public Delegate Function Predicate(Of T)(ByVal item As T) As String");
- }
-
- [Test]
- public void Enum()
- {
- TestProgram("Enum MyTest\nRed\n Green\n Blue\nYellow\n End Enum");
- }
-
- [Test]
- public void EnumWithInitializers()
- {
- TestProgram("Enum MyTest\nRed = 1\n Green = 2\n Blue = 4\n Yellow = 8\n End Enum");
- }
-
- [Test]
- public void SyncLock()
- {
- TestStatement("SyncLock a\nWork()\nEnd SyncLock");
- }
-
- [Test]
- public void Using()
- {
- TestStatement("Using a As New A()\na.Work()\nEnd Using");
- }
-
- [Test]
- public void Cast()
- {
- TestExpression("CType(a, T)");
- }
-
- [Test]
- public void DirectCast()
- {
- TestExpression("DirectCast(a, T)");
- }
-
- [Test]
- public void TryCast()
- {
- TestExpression("TryCast(a, T)");
- }
-
- [Test]
- public void PrimitiveCast()
- {
- TestExpression("CStr(a)");
- }
-
- [Test]
- public void TypeOfIs()
- {
- TestExpression("TypeOf a Is String");
- }
-
- [Test]
- public void PropertyWithAccessorAccessModifiers()
- {
- TestTypeMember("Public Property ExpectsValue() As Boolean\n" +
- "\tPublic Get\n" +
- "\tEnd Get\n" +
- "\tProtected Set\n" +
- "\tEnd Set\n" +
- "End Property");
- }
-
- [Test]
- public void AbstractProperty()
- {
- TestTypeMember("Public MustOverride Property ExpectsValue() As Boolean");
- TestTypeMember("Public MustOverride ReadOnly Property ExpectsValue() As Boolean");
- TestTypeMember("Public MustOverride WriteOnly Property ExpectsValue() As Boolean");
- }
-
- [Test]
- public void AbstractMethod()
- {
- TestTypeMember("Public MustOverride Sub Run()");
- TestTypeMember("Public MustOverride Function Run() As Boolean");
- }
-
- [Test]
- public void InterfaceImplementingMethod()
- {
- TestTypeMember("Public Sub Run() Implements SomeInterface.Run\nEnd Sub");
- TestTypeMember("Public Function Run() As Boolean Implements SomeInterface.Bla\nEnd Function");
- }
-
- [Test]
- public void NamedAttributeArgument()
- {
- TestProgram("<Attribute(ArgName := \"value\")> _\n" +
- "Class Test\n" +
- "End Class");
- }
-
- [Test]
- public void ReturnTypeAttribute()
- {
- TestTypeMember("Function A() As <Attribute> String\n" +
- "End Function");
- }
-
- [Test]
- public void AssemblyAttribute()
- {
- TestProgram("<Assembly: CLSCompliant>");
- }
-
- [Test]
- public void ModuleAttribute()
- {
- TestProgram("<Module: SuppressMessageAttribute>");
- }
-
- [Test]
- public void Interface()
- {
- TestProgram("Interface ITest\n" +
- "Property GetterAndSetter() As Boolean\n" +
- "ReadOnly Property GetterOnly() As Boolean\n" +
- "WriteOnly Property SetterOnly() As Boolean\n" +
- "Sub InterfaceMethod()\n" +
- "Function InterfaceMethod2() As String\n" +
- "End Interface");
- }
-
- [Test]
- public void OnErrorStatement()
- {
- TestStatement("On Error Resume Next");
- }
-
- [Test]
- public void OverloadedConversionOperators()
- {
- TestTypeMember("Public Shared Narrowing Operator CType(ByVal xmlNode As XmlNode) As TheBug\nEnd Operator");
- TestTypeMember("Public Shared Widening Operator CType(ByVal bugNode As TheBug) As XmlNode\nEnd Operator");
- }
-
- [Test]
- public void OverloadedTrueFalseOperators()
- {
- TestTypeMember("Public Shared Operator IsTrue(ByVal a As TheBug) As Boolean\nEnd Operator");
- TestTypeMember("Public Shared Operator IsFalse(ByVal a As TheBug) As Boolean\nEnd Operator");
- }
-
- [Test]
- public void OverloadedOperators()
- {
- TestTypeMember("Public Shared Operator +(ByVal bugNode As TheBug, ByVal bugNode2 As TheBug) As TheBug\nEnd Operator");
- TestTypeMember("Public Shared Operator >>(ByVal bugNode As TheBug, ByVal b As Integer) As TheBug\nEnd Operator");
- }
-
- [Test]
- public void AttributeOnParameter()
- {
- TestTypeMember("Sub Main(ByRef one As Integer, ByRef two As Integer, <Out> ByRef three As Integer)\nEnd Sub");
- }
-
- [Test]
- public void UsingStatementForExistingVariable()
- {
- TestStatement("Using obj\nEnd Using");
- }
-
- [Test]
- public void ContinueFor()
- {
- TestStatement("Continue For");
- }
-
- [Test]
- public void ForNextStatementWithFieldLoopVariable()
- {
- TestStatement("For Me.Field = 0 To 10\n" +
- "Next Me.Field");
- }
-
- [Test]
- public void WithStatement()
- {
- TestStatement("With Ejes\n" +
- "\t.AddLine(New Point(Me.ClientSize.Width / 2, 0), (New Point(Me.ClientSize.Width / 2, Me.ClientSize.Height)))\n" +
- "End With");
- }
-
- [Test]
- public void NewConstraint()
- {
- TestProgram("Public Class Rational(Of T, O As {IRationalMath(Of T), New})\nEnd Class");
- }
-
- [Test]
- public void StructConstraint()
- {
- TestProgram("Public Class Rational(Of T, O As {IRationalMath(Of T), Structure})\nEnd Class");
- }
-
- [Test]
- public void ClassConstraint()
- {
- TestProgram("Public Class Rational(Of T, O As {IRationalMath(Of T), Class})\nEnd Class");
- }
-
- [Test]
- public void Integer()
- {
- TestExpression("16");
- }
-
- [Test]
- public void HexadecimalInteger()
- {
- TestExpression("&H10");
- }
-
- [Test]
- public void HexadecimalMinusOne()
- {
- TestExpression("&Hffffffff");
- }
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/CheckParentVisitor.cs b/main/contrib/NRefactory/Test/Parser/CheckParentVisitor.cs
deleted file mode 100644
index b58b3e3081..0000000000
--- a/main/contrib/NRefactory/Test/Parser/CheckParentVisitor.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald"/>
-// <version>$Revision$</version>
-// </file>
-using NUnit.Framework;
-using System;
-using System.Collections.Generic;
-using ICSharpCode.NRefactory.Ast;
-using ICSharpCode.NRefactory.Visitors;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- /// <summary>
- /// Ensures that all nodes have the Parent property correctly set.
- /// </summary>
- public class CheckParentVisitor : NodeTrackingAstVisitor
- {
- Stack<INode> nodeStack = new Stack<INode>();
-
- public CheckParentVisitor()
- {
- nodeStack.Push(null);
- }
-
- protected override void BeginVisit(INode node)
- {
- nodeStack.Push(node);
- }
-
- protected override void EndVisit(INode node)
- {
- Assert.AreSame(node, nodeStack.Pop(), "nodeStack was corrupted!");
- Assert.AreSame(nodeStack.Peek(), node.Parent, "node " + node + " is missing parent: " + nodeStack.Peek());
- }
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Expressions/AddressOfExpressionTests.cs b/main/contrib/NRefactory/Test/Parser/Expressions/AddressOfExpressionTests.cs
deleted file mode 100644
index e9e408aebc..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Expressions/AddressOfExpressionTests.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Markus Palme" email="markuspalme@gmx.de"/>
-// <version>$Revision: 3125 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class AddressOfExpressionTests
- {
- #region VB.NET
-
- [Test]
- public void SimpleAddressOfExpressionTest()
- {
- AddressOfExpression ae = ParseUtilVBNet.ParseExpression<AddressOfExpression>("AddressOf t");
- Assert.IsNotNull(ae);
- Assert.IsInstanceOfType(typeof(IdentifierExpression), ae.Expression);
- Assert.AreEqual("t", ((IdentifierExpression)ae.Expression).Identifier, "t");
- }
-
- [Test]
- public void GenericAddressOfExpressionTest()
- {
- AddressOfExpression ae = ParseUtilVBNet.ParseExpression<AddressOfExpression>("AddressOf t(Of X)");
- Assert.IsNotNull(ae);
- Assert.IsInstanceOfType(typeof(IdentifierExpression), ae.Expression);
- Assert.AreEqual("t", ((IdentifierExpression)ae.Expression).Identifier, "t");
- Assert.AreEqual(1, ((IdentifierExpression)ae.Expression).TypeArguments.Count);
- Assert.AreEqual("X", ((IdentifierExpression)ae.Expression).TypeArguments[0].Type);
- }
-
- [Test]
- public void MemberReferenceAddressOfExpressionTest()
- {
- AddressOfExpression ae = ParseUtilVBNet.ParseExpression<AddressOfExpression>("AddressOf Me.t(Of X)");
- Assert.IsNotNull(ae);
- Assert.IsInstanceOfType(typeof(MemberReferenceExpression), ae.Expression);
- Assert.AreEqual("t", ((MemberReferenceExpression)ae.Expression).MemberName, "t");
- Assert.IsInstanceOfType(typeof(ThisReferenceExpression), ((MemberReferenceExpression)ae.Expression).TargetObject);
- }
-
- #endregion
-
- #region C#
-
- // no C# representation
-
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Expressions/AnonymousMethodTests.cs b/main/contrib/NRefactory/Test/Parser/Expressions/AnonymousMethodTests.cs
deleted file mode 100644
index 30516489c9..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Expressions/AnonymousMethodTests.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 1899 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class AnonymousMethodTests
- {
- AnonymousMethodExpression Parse(string program)
- {
- return ParseUtilCSharp.ParseExpression<AnonymousMethodExpression>(program);
- }
-
- [Test]
- public void AnonymousMethodWithoutParameterList()
- {
- AnonymousMethodExpression ame = Parse("delegate {}");
- Assert.AreEqual(0, ame.Parameters.Count);
- Assert.AreEqual(0, ame.Body.Children.Count);
- Assert.IsFalse(ame.HasParameterList);
- }
-
- [Test]
- public void AnonymousMethodAfterCast()
- {
- CastExpression c = ParseUtilCSharp.ParseExpression<CastExpression>("(ThreadStart)delegate {}");
- Assert.AreEqual("ThreadStart", c.CastTo.Type);
- AnonymousMethodExpression ame = (AnonymousMethodExpression)c.Expression;
- Assert.AreEqual(0, ame.Parameters.Count);
- Assert.AreEqual(0, ame.Body.Children.Count);
- }
-
- [Test]
- public void EmptyAnonymousMethod()
- {
- AnonymousMethodExpression ame = Parse("delegate() {}");
- Assert.AreEqual(0, ame.Parameters.Count);
- Assert.AreEqual(0, ame.Body.Children.Count);
- Assert.IsTrue(ame.HasParameterList);
- }
-
- [Test]
- public void SimpleAnonymousMethod()
- {
- AnonymousMethodExpression ame = Parse("delegate(int a, int b) { return a + b; }");
- Assert.AreEqual(2, ame.Parameters.Count);
- // blocks can't be added without compilation unit -> anonymous method body
- // is always empty when using ParseExpression
- //Assert.AreEqual(1, ame.Body.Children.Count);
- //Assert.IsTrue(ame.Body.Children[0] is ReturnStatement);
- }
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Expressions/ArrayCreateExpressionTests.cs b/main/contrib/NRefactory/Test/Parser/Expressions/ArrayCreateExpressionTests.cs
deleted file mode 100644
index 7ab925a4ce..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Expressions/ArrayCreateExpressionTests.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 3660 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class ArrayCreateExpressionTests
- {
- #region C#
- [Test]
- public void CSharpArrayCreateExpressionTest1()
- {
- ArrayCreateExpression ace = ParseUtilCSharp.ParseExpression<ArrayCreateExpression>("new int[5]");
- Assert.AreEqual("System.Int32", ace.CreateType.Type);
- Assert.IsTrue(ace.CreateType.IsKeyword);
- Assert.AreEqual(1, ace.Arguments.Count);
- Assert.AreEqual(new int[] {0}, ace.CreateType.RankSpecifier);
- }
-
- [Test]
- public void CSharpImplicitlyTypedArrayCreateExpression()
- {
- ArrayCreateExpression ace = ParseUtilCSharp.ParseExpression<ArrayCreateExpression>("new[] { 1, 10, 100, 1000 }");
- Assert.AreEqual("", ace.CreateType.Type);
- Assert.AreEqual(0, ace.Arguments.Count);
- Assert.AreEqual(4, ace.ArrayInitializer.CreateExpressions.Count);
- }
- #endregion
-
- #region VB.NET
-
- [Test]
- public void VBNetArrayCreateExpressionTest1()
- {
- ArrayCreateExpression ace = ParseUtilVBNet.ParseExpression<ArrayCreateExpression>("new Integer() {1, 2, 3, 4}");
-
- Assert.AreEqual("System.Int32", ace.CreateType.Type);
- Assert.AreEqual(0, ace.Arguments.Count);
- Assert.AreEqual(new int[] {0}, ace.CreateType.RankSpecifier);
- }
-
- [Test]
- public void VBNetArrayCreateExpressionTest2()
- {
- ArrayCreateExpression ace = ParseUtilVBNet.ParseExpression<ArrayCreateExpression>("New Integer(0 To 5){0, 1, 2, 3, 4, 5}");
-
- Assert.AreEqual("System.Int32", ace.CreateType.Type);
- Assert.AreEqual(1, ace.Arguments.Count);
- Assert.AreEqual(5, (ace.Arguments[0] as PrimitiveExpression).Value);
- Assert.AreEqual(new int[] {0}, ace.CreateType.RankSpecifier);
- }
- #endregion
-
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Expressions/AssignmentExpressionTests.cs b/main/contrib/NRefactory/Test/Parser/Expressions/AssignmentExpressionTests.cs
deleted file mode 100644
index 2f659ec3b3..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Expressions/AssignmentExpressionTests.cs
+++ /dev/null
@@ -1,157 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class AssignmentExpressionTests
- {
- #region C#
- void CSharpTestAssignmentExpression(string program, AssignmentOperatorType op)
- {
- AssignmentExpression ae = ParseUtilCSharp.ParseExpression<AssignmentExpression>(program);
-
- Assert.AreEqual(op, ae.Op);
-
- Assert.IsTrue(ae.Left is IdentifierExpression);
- Assert.IsTrue(ae.Right is IdentifierExpression);
- }
-
- [Test]
- public void CSharpAssignTest()
- {
- CSharpTestAssignmentExpression("a = b", AssignmentOperatorType.Assign);
- }
-
- [Test]
- public void CSharpAddTest()
- {
- CSharpTestAssignmentExpression("a += b", AssignmentOperatorType.Add);
- }
-
- [Test]
- public void CSharpSubtractTest()
- {
- CSharpTestAssignmentExpression("a -= b", AssignmentOperatorType.Subtract);
- }
-
- [Test]
- public void CSharpMultiplyTest()
- {
- CSharpTestAssignmentExpression("a *= b", AssignmentOperatorType.Multiply);
- }
-
- [Test]
- public void CSharpDivideTest()
- {
- CSharpTestAssignmentExpression("a /= b", AssignmentOperatorType.Divide);
- }
-
- [Test]
- public void CSharpModulusTest()
- {
- CSharpTestAssignmentExpression("a %= b", AssignmentOperatorType.Modulus);
- }
-
- [Test]
- public void CSharpShiftLeftTest()
- {
- CSharpTestAssignmentExpression("a <<= b", AssignmentOperatorType.ShiftLeft);
- }
-
- [Test]
- public void CSharpShiftRightTest()
- {
- CSharpTestAssignmentExpression("a >>= b", AssignmentOperatorType.ShiftRight);
- }
-
- [Test]
- public void CSharpBitwiseAndTest()
- {
- CSharpTestAssignmentExpression("a &= b", AssignmentOperatorType.BitwiseAnd);
- }
-
- [Test]
- public void CSharpBitwiseOrTest()
- {
- CSharpTestAssignmentExpression("a |= b", AssignmentOperatorType.BitwiseOr);
- }
-
- [Test]
- public void CSharpExclusiveOrTest()
- {
- CSharpTestAssignmentExpression("a ^= b", AssignmentOperatorType.ExclusiveOr);
- }
- #endregion
-
- #region VB.NET
- void VBNetTestAssignmentExpression(string program, AssignmentOperatorType op)
- {
- ExpressionStatement se = ParseUtilVBNet.ParseStatement<ExpressionStatement>(program);
- AssignmentExpression ae = se.Expression as AssignmentExpression;
- Assert.AreEqual(op, ae.Op);
-
- Assert.IsTrue(ae.Left is IdentifierExpression);
- Assert.IsTrue(ae.Right is IdentifierExpression);
- }
-
- [Test]
- public void VBNetAssignTest()
- {
- VBNetTestAssignmentExpression("a = b", AssignmentOperatorType.Assign);
- }
-
- [Test]
- public void VBNetAddTest()
- {
- VBNetTestAssignmentExpression("a += b", AssignmentOperatorType.Add);
- }
-
- [Test]
- public void VBNetSubtractTest()
- {
- VBNetTestAssignmentExpression("a -= b", AssignmentOperatorType.Subtract);
- }
-
- [Test]
- public void VBNetMultiplyTest()
- {
- VBNetTestAssignmentExpression("a *= b", AssignmentOperatorType.Multiply);
- }
-
- [Test]
- public void VBNetDivideTest()
- {
- VBNetTestAssignmentExpression("a /= b", AssignmentOperatorType.Divide);
- }
-
- [Test]
- public void VBNetExclusiveOrTest()
- {
- VBNetTestAssignmentExpression("a ^= b", AssignmentOperatorType.Power);
- }
-
- [Test]
- public void VBNetStringConcatTest()
- {
- VBNetTestAssignmentExpression("a &= b", AssignmentOperatorType.ConcatString);
- }
-
- [Test]
- public void VBNetModulusTest()
- {
- VBNetTestAssignmentExpression("a \\= b", AssignmentOperatorType.DivideInteger);
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Expressions/BaseReferenceExpressionTests.cs b/main/contrib/NRefactory/Test/Parser/Expressions/BaseReferenceExpressionTests.cs
deleted file mode 100644
index e199c661cc..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Expressions/BaseReferenceExpressionTests.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 2676 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class BaseReferenceExpressionTests
- {
- #region C#
- [Test]
- public void CSharpBaseReferenceExpressionTest1()
- {
- MemberReferenceExpression fre = ParseUtilCSharp.ParseExpression<MemberReferenceExpression>("base.myField");
- Assert.IsTrue(fre.TargetObject is BaseReferenceExpression);
- }
- #endregion
-
- #region VB.NET
- [Test]
- public void VBNetBaseReferenceExpressionTest1()
- {
- MemberReferenceExpression fre = ParseUtilVBNet.ParseExpression<MemberReferenceExpression>("MyBase.myField");
- Assert.IsTrue(fre.TargetObject is BaseReferenceExpression);
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Expressions/BinaryOperatorExpressionTests.cs b/main/contrib/NRefactory/Test/Parser/Expressions/BinaryOperatorExpressionTests.cs
deleted file mode 100644
index 81cc9a7bcc..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Expressions/BinaryOperatorExpressionTests.cs
+++ /dev/null
@@ -1,486 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 3370 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-using ICSharpCode.NRefactory.PrettyPrinter;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class BinaryOperatorExpressionTests
- {
- void OperatorPrecedenceTest(string strongOperator, BinaryOperatorType strongOperatorType,
- string weakOperator, BinaryOperatorType weakOperatorType, bool vb)
- {
- string program = "a " + weakOperator + " b " + strongOperator + " c";
- BinaryOperatorExpression boe;
- if (vb)
- boe = ParseUtilVBNet.ParseExpression<BinaryOperatorExpression>(program);
- else
- boe = ParseUtilCSharp.ParseExpression<BinaryOperatorExpression>(program);
- Assert.AreEqual(weakOperatorType, boe.Op);
- Assert.IsTrue(boe.Left is IdentifierExpression);
- boe = (BinaryOperatorExpression)boe.Right;
- Assert.AreEqual(strongOperatorType, boe.Op);
- Assert.IsTrue(boe.Left is IdentifierExpression);
- Assert.IsTrue(boe.Right is IdentifierExpression);
-
- program = "a " + strongOperator + " b " + weakOperator + " c";
- if (vb)
- boe = ParseUtilVBNet.ParseExpression<BinaryOperatorExpression>(program);
- else
- boe = ParseUtilCSharp.ParseExpression<BinaryOperatorExpression>(program);
- Assert.AreEqual(weakOperatorType, boe.Op);
- Assert.IsTrue(boe.Right is IdentifierExpression);
- boe = (BinaryOperatorExpression)boe.Left;
- Assert.AreEqual(strongOperatorType, boe.Op);
- Assert.IsTrue(boe.Left is IdentifierExpression);
- Assert.IsTrue(boe.Right is IdentifierExpression);
- }
-
- void SameOperatorPrecedenceTest(string firstOperator, BinaryOperatorType firstOperatorType,
- string secondOperator, BinaryOperatorType secondOperatorType, bool vb)
- {
- string program = "a " + secondOperator + " b " + firstOperator + " c";
- BinaryOperatorExpression boe;
- if (vb)
- boe = ParseUtilVBNet.ParseExpression<BinaryOperatorExpression>(program);
- else
- boe = ParseUtilCSharp.ParseExpression<BinaryOperatorExpression>(program);
- Assert.AreEqual(firstOperatorType, boe.Op);
- Assert.IsTrue(boe.Right is IdentifierExpression);
- boe = (BinaryOperatorExpression)boe.Left;
- Assert.AreEqual(secondOperatorType, boe.Op);
- Assert.IsTrue(boe.Left is IdentifierExpression);
- Assert.IsTrue(boe.Right is IdentifierExpression);
-
- program = "a " + firstOperator + " b " + secondOperator + " c";
- if (vb)
- boe = ParseUtilVBNet.ParseExpression<BinaryOperatorExpression>(program);
- else
- boe = ParseUtilCSharp.ParseExpression<BinaryOperatorExpression>(program);
- Assert.AreEqual(secondOperatorType, boe.Op);
- Assert.IsTrue(boe.Right is IdentifierExpression);
- boe = (BinaryOperatorExpression)boe.Left;
- Assert.AreEqual(firstOperatorType, boe.Op);
- Assert.IsTrue(boe.Left is IdentifierExpression);
- Assert.IsTrue(boe.Right is IdentifierExpression);
- }
-
- #region C#
- void CSharpTestBinaryOperatorExpressionTest(string program, BinaryOperatorType op)
- {
- BinaryOperatorExpression boe = ParseUtilCSharp.ParseExpression<BinaryOperatorExpression>(program);
- Assert.AreEqual(op, boe.Op);
-
- Assert.IsTrue(boe.Left is IdentifierExpression);
- Assert.IsTrue(boe.Right is IdentifierExpression);
-
- }
-
- [Test]
- public void CSharpOperatorPrecedenceTest()
- {
- SameOperatorPrecedenceTest("*", BinaryOperatorType.Multiply, "/", BinaryOperatorType.Divide, false);
- SameOperatorPrecedenceTest("*", BinaryOperatorType.Multiply, "%", BinaryOperatorType.Modulus, false);
- OperatorPrecedenceTest("*", BinaryOperatorType.Multiply, "+", BinaryOperatorType.Add, false);
- SameOperatorPrecedenceTest("-", BinaryOperatorType.Subtract, "+", BinaryOperatorType.Add, false);
- OperatorPrecedenceTest("+", BinaryOperatorType.Add, "<<", BinaryOperatorType.ShiftLeft, false);
- SameOperatorPrecedenceTest(">>", BinaryOperatorType.ShiftRight, "<<", BinaryOperatorType.ShiftLeft, false);
- OperatorPrecedenceTest("<<", BinaryOperatorType.ShiftLeft, "==", BinaryOperatorType.Equality, false);
- SameOperatorPrecedenceTest("!=", BinaryOperatorType.InEquality, "==", BinaryOperatorType.Equality, false);
- OperatorPrecedenceTest("==", BinaryOperatorType.Equality, "&", BinaryOperatorType.BitwiseAnd, false);
- OperatorPrecedenceTest("&", BinaryOperatorType.BitwiseAnd, "^", BinaryOperatorType.ExclusiveOr, false);
- OperatorPrecedenceTest("^", BinaryOperatorType.ExclusiveOr, "|", BinaryOperatorType.BitwiseOr, false);
- OperatorPrecedenceTest("|", BinaryOperatorType.BitwiseOr, "&&", BinaryOperatorType.LogicalAnd, false);
- OperatorPrecedenceTest("&&", BinaryOperatorType.LogicalAnd, "||", BinaryOperatorType.LogicalOr, false);
- OperatorPrecedenceTest("||", BinaryOperatorType.LogicalOr, "??", BinaryOperatorType.NullCoalescing, false);
- }
-
- [Test]
- public void CSharpSubtractionLeftToRight()
- {
- BinaryOperatorExpression boe = ParseUtilCSharp.ParseExpression<BinaryOperatorExpression>("a - b - c");
- Assert.IsTrue(boe.Right is IdentifierExpression);
- Assert.IsTrue(boe.Left is BinaryOperatorExpression);
- }
-
- [Test]
- public void CSharpNullCoalescingRightToLeft()
- {
- BinaryOperatorExpression boe = ParseUtilCSharp.ParseExpression<BinaryOperatorExpression>("a ?? b ?? c");
- Assert.IsTrue(boe.Left is IdentifierExpression);
- Assert.IsTrue(boe.Right is BinaryOperatorExpression);
- }
-
- [Test]
- public void CSharpBitwiseAndTest()
- {
- CSharpTestBinaryOperatorExpressionTest("a & b", BinaryOperatorType.BitwiseAnd);
- }
-
- [Test]
- public void CSharpBitwiseOrTest()
- {
- CSharpTestBinaryOperatorExpressionTest("a | b", BinaryOperatorType.BitwiseOr);
- }
-
- [Test]
- public void CSharpLogicalAndTest()
- {
- CSharpTestBinaryOperatorExpressionTest("a && b", BinaryOperatorType.LogicalAnd);
- }
-
- [Test]
- public void CSharpLogicalOrTest()
- {
- CSharpTestBinaryOperatorExpressionTest("a || b", BinaryOperatorType.LogicalOr);
- }
-
- [Test]
- public void CSharpExclusiveOrTest()
- {
- CSharpTestBinaryOperatorExpressionTest("a ^ b", BinaryOperatorType.ExclusiveOr);
- }
-
-
- [Test]
- public void CSharpGreaterThanTest()
- {
- CSharpTestBinaryOperatorExpressionTest("a > b", BinaryOperatorType.GreaterThan);
- }
-
- [Test]
- public void CSharpGreaterThanOrEqualTest()
- {
- CSharpTestBinaryOperatorExpressionTest("a >= b", BinaryOperatorType.GreaterThanOrEqual);
- }
-
- [Test]
- public void CSharpEqualityTest()
- {
- CSharpTestBinaryOperatorExpressionTest("a == b", BinaryOperatorType.Equality);
- }
-
- [Test]
- public void CSharpInEqualityTest()
- {
- CSharpTestBinaryOperatorExpressionTest("a != b", BinaryOperatorType.InEquality);
- }
-
- [Test]
- public void CSharpLessThanTest()
- {
- CSharpTestBinaryOperatorExpressionTest("a < b", BinaryOperatorType.LessThan);
- }
-
- [Test]
- public void CSharpLessThanOrEqualTest()
- {
- CSharpTestBinaryOperatorExpressionTest("a <= b", BinaryOperatorType.LessThanOrEqual);
- }
-
- [Test]
- public void CSharpAddTest()
- {
- CSharpTestBinaryOperatorExpressionTest("a + b", BinaryOperatorType.Add);
- }
-
- [Test]
- public void CSharpSubtractTest()
- {
- CSharpTestBinaryOperatorExpressionTest("a - b", BinaryOperatorType.Subtract);
- }
-
- [Test]
- public void CSharpMultiplyTest()
- {
- CSharpTestBinaryOperatorExpressionTest("a * b", BinaryOperatorType.Multiply);
- }
-
- [Test]
- public void CSharpDivideTest()
- {
- CSharpTestBinaryOperatorExpressionTest("a / b", BinaryOperatorType.Divide);
- }
-
- [Test]
- public void CSharpModulusTest()
- {
- CSharpTestBinaryOperatorExpressionTest("a % b", BinaryOperatorType.Modulus);
- }
-
- [Test]
- public void CSharpShiftLeftTest()
- {
- CSharpTestBinaryOperatorExpressionTest("a << b", BinaryOperatorType.ShiftLeft);
- }
-
- [Test]
- public void CSharpShiftRightTest()
- {
- CSharpTestBinaryOperatorExpressionTest("a >> b", BinaryOperatorType.ShiftRight);
- }
-
- [Test]
- public void CSharpNullCoalescingTest()
- {
- CSharpTestBinaryOperatorExpressionTest("a ?? b", BinaryOperatorType.NullCoalescing);
- }
-
- [Test]
- public void CSharpLessThanOrGreaterTest()
- {
- const string expr = "i1 < 0 || i1 > (Count - 1)";
- BinaryOperatorExpression boe = ParseUtilCSharp.ParseExpression<BinaryOperatorExpression>(expr);
- Assert.AreEqual(BinaryOperatorType.LogicalOr, boe.Op);
- }
- #endregion
-
- #region VB.NET
- void VBNetTestBinaryOperatorExpressionTest(string program, BinaryOperatorType op)
- {
- BinaryOperatorExpression boe = ParseUtilVBNet.ParseExpression<BinaryOperatorExpression>(program);
- Assert.AreEqual(op, boe.Op);
-
- Assert.IsTrue(boe.Left is IdentifierExpression);
- Assert.IsTrue(boe.Right is IdentifierExpression);
-
- }
-
- [Test]
- public void VBOperatorPrecedenceTest()
- {
- OperatorPrecedenceTest("^", BinaryOperatorType.Power, "*", BinaryOperatorType.Multiply, true);
- SameOperatorPrecedenceTest("*", BinaryOperatorType.Multiply, "/", BinaryOperatorType.Divide, true);
- OperatorPrecedenceTest("/", BinaryOperatorType.Divide, "\\", BinaryOperatorType.DivideInteger, true);
- OperatorPrecedenceTest("\\", BinaryOperatorType.DivideInteger, "Mod", BinaryOperatorType.Modulus, true);
- OperatorPrecedenceTest("Mod", BinaryOperatorType.Modulus, "+", BinaryOperatorType.Add, true);
- SameOperatorPrecedenceTest("+", BinaryOperatorType.Add, "-", BinaryOperatorType.Subtract, true);
- OperatorPrecedenceTest("-", BinaryOperatorType.Subtract, "&", BinaryOperatorType.Concat, true);
- OperatorPrecedenceTest("&", BinaryOperatorType.Concat, "<<", BinaryOperatorType.ShiftLeft, true);
- SameOperatorPrecedenceTest("<<", BinaryOperatorType.ShiftLeft, ">>", BinaryOperatorType.ShiftRight, true);
- OperatorPrecedenceTest("<<", BinaryOperatorType.ShiftLeft, "=", BinaryOperatorType.Equality, true);
- SameOperatorPrecedenceTest("<>", BinaryOperatorType.InEquality, "=", BinaryOperatorType.Equality, true);
- SameOperatorPrecedenceTest("<", BinaryOperatorType.LessThan, "=", BinaryOperatorType.Equality, true);
- SameOperatorPrecedenceTest("<=", BinaryOperatorType.LessThanOrEqual, "=", BinaryOperatorType.Equality, true);
- SameOperatorPrecedenceTest(">", BinaryOperatorType.GreaterThan, "=", BinaryOperatorType.Equality, true);
- SameOperatorPrecedenceTest(">=", BinaryOperatorType.GreaterThanOrEqual, "=", BinaryOperatorType.Equality, true);
- SameOperatorPrecedenceTest("Like", BinaryOperatorType.Like, "=", BinaryOperatorType.Equality, true);
- SameOperatorPrecedenceTest("Is", BinaryOperatorType.ReferenceEquality, "=", BinaryOperatorType.Equality, true);
- SameOperatorPrecedenceTest("IsNot", BinaryOperatorType.ReferenceInequality, "=", BinaryOperatorType.Equality, true);
- OperatorPrecedenceTest("=", BinaryOperatorType.Equality, "And", BinaryOperatorType.BitwiseAnd, true);
- SameOperatorPrecedenceTest("And", BinaryOperatorType.BitwiseAnd, "AndAlso", BinaryOperatorType.LogicalAnd, true);
- OperatorPrecedenceTest("And", BinaryOperatorType.BitwiseAnd, "Or", BinaryOperatorType.BitwiseOr, true);
- SameOperatorPrecedenceTest("Or", BinaryOperatorType.BitwiseOr, "OrElse", BinaryOperatorType.LogicalOr, true);
- SameOperatorPrecedenceTest("Or", BinaryOperatorType.BitwiseOr, "Xor", BinaryOperatorType.ExclusiveOr, true);
- }
-
- [Test]
- public void VBNetTest()
- {
- VBNetTestBinaryOperatorExpressionTest("a ^ b", BinaryOperatorType.Power);
- }
-
- [Test]
- public void VBNetPowerTest()
- {
- VBNetTestBinaryOperatorExpressionTest("a ^ b", BinaryOperatorType.Power);
- }
-
- [Test]
- public void VBNetConcatTest()
- {
- VBNetTestBinaryOperatorExpressionTest("a & b", BinaryOperatorType.Concat);
- }
-
- [Test]
- public void VBNetLogicalAndTest()
- {
- VBNetTestBinaryOperatorExpressionTest("a AndAlso b", BinaryOperatorType.LogicalAnd);
- }
- [Test]
- public void VBNetLogicalAndNotLazyTest()
- {
- VBNetTestBinaryOperatorExpressionTest("a And b", BinaryOperatorType.BitwiseAnd);
- }
-
- [Test]
- public void VBNetLogicalOrTest()
- {
- VBNetTestBinaryOperatorExpressionTest("a OrElse b", BinaryOperatorType.LogicalOr);
- }
- [Test]
- public void VBNetLogicalOrNotLazyTest()
- {
- VBNetTestBinaryOperatorExpressionTest("a Or b", BinaryOperatorType.BitwiseOr);
- }
-
- [Test]
- public void VBNetExclusiveOrTest()
- {
- VBNetTestBinaryOperatorExpressionTest("a Xor b", BinaryOperatorType.ExclusiveOr);
- }
-
-
- [Test]
- public void VBNetGreaterThanTest()
- {
- VBNetTestBinaryOperatorExpressionTest("a > b", BinaryOperatorType.GreaterThan);
- }
-
- [Test]
- public void VBNetGreaterThanOrEqualTest()
- {
- VBNetTestBinaryOperatorExpressionTest("a >= b", BinaryOperatorType.GreaterThanOrEqual);
- }
-
- [Test]
- public void VBNetEqualityTest()
- {
- VBNetTestBinaryOperatorExpressionTest("a = b", BinaryOperatorType.Equality);
- }
-
- [Test]
- public void VBNetInEqualityTest()
- {
- VBNetTestBinaryOperatorExpressionTest("a <> b", BinaryOperatorType.InEquality);
- }
-
- [Test]
- public void VBNetLessThanTest()
- {
- VBNetTestBinaryOperatorExpressionTest("a < b", BinaryOperatorType.LessThan);
- }
-
- [Test]
- public void VBNetLessThanOrEqualTest()
- {
- VBNetTestBinaryOperatorExpressionTest("a <= b", BinaryOperatorType.LessThanOrEqual);
- }
-
- [Test]
- public void VBNetAddTest()
- {
- VBNetTestBinaryOperatorExpressionTest("a + b", BinaryOperatorType.Add);
- }
-
- [Test]
- public void VBNetSubtractTest()
- {
- VBNetTestBinaryOperatorExpressionTest("a - b", BinaryOperatorType.Subtract);
- }
-
- [Test]
- public void VBNetMultiplyTest()
- {
- VBNetTestBinaryOperatorExpressionTest("a * b", BinaryOperatorType.Multiply);
- }
-
- [Test]
- public void VBNetDivideTest()
- {
- VBNetTestBinaryOperatorExpressionTest("a / b", BinaryOperatorType.Divide);
- }
-
- [Test]
- public void VBNetDivideIntegerTest()
- {
- VBNetTestBinaryOperatorExpressionTest("a \\ b", BinaryOperatorType.DivideInteger);
- }
-
- [Test]
- public void VBNetModulusTest()
- {
- VBNetTestBinaryOperatorExpressionTest("a Mod b", BinaryOperatorType.Modulus);
- }
-
- [Test]
- public void VBNetShiftLeftTest()
- {
- VBNetTestBinaryOperatorExpressionTest("a << b", BinaryOperatorType.ShiftLeft);
- }
-
- [Test]
- public void VBNetShiftRightTest()
- {
- VBNetTestBinaryOperatorExpressionTest("a >> b", BinaryOperatorType.ShiftRight);
- }
-
- [Test]
- public void VBNetISTest()
- {
- VBNetTestBinaryOperatorExpressionTest("a is b", BinaryOperatorType.ReferenceEquality);
- }
-
- [Test]
- public void VBNetISNotTest()
- {
- VBNetTestBinaryOperatorExpressionTest("a IsNot b", BinaryOperatorType.ReferenceInequality);
- }
-
- [Test]
- public void VBNetLikeTest()
- {
- VBNetTestBinaryOperatorExpressionTest("a Like b", BinaryOperatorType.Like);
- }
-
- [Test]
- public void VBNetNullCoalescingTest()
- {
- VBNetTestBinaryOperatorExpressionTest("If(a, b)", BinaryOperatorType.NullCoalescing);
- }
-
- #endregion
-
- #region AddIntegerTests
- string AddIntegerToBoe(string input, int number)
- {
- return AddInteger<BinaryOperatorExpression>(input, number);
- }
-
- string AddInteger<T>(string input, int number) where T : Expression
- {
- Expression e = ParseUtilCSharp.ParseExpression<T>(input);
- e = Expression.AddInteger(e, number);
- CSharpOutputVisitor v = new CSharpOutputVisitor();
- e.AcceptVisitor(v, null);
- return v.Text;
- }
-
- [Test]
- public void AddInteger()
- {
- Assert.AreEqual("a + 2", AddIntegerToBoe("a + 1", 1));
- Assert.AreEqual("a + 2", AddIntegerToBoe("a + 3", -1));
- Assert.AreEqual("a + b + c + 2", AddIntegerToBoe("a + b + c + 1", 1));
- Assert.AreEqual("a", AddIntegerToBoe("a + 1", -1));
- Assert.AreEqual("2", AddInteger<PrimitiveExpression>("1", 1));
- Assert.AreEqual("-1", AddInteger<PrimitiveExpression>("1", -2));
- Assert.AreEqual("0", AddInteger<PrimitiveExpression>("1", -1));
- Assert.AreEqual("a + 1", AddInteger<IdentifierExpression>("a", 1));
- }
-
- [Test]
- public void AddIntegerWithNegativeResult()
- {
- Assert.AreEqual("a - 1", AddIntegerToBoe("a + 1", -2));
- Assert.AreEqual("a - 2", AddIntegerToBoe("a - 1", -1));
- Assert.AreEqual("a + b + c - 2", AddIntegerToBoe("a + b + c + 2", -4));
- Assert.AreEqual("a + b + c - 6", AddIntegerToBoe("a + b + c - 2", -4));
- Assert.AreEqual("a + b + c", AddIntegerToBoe("a + b + c + 2", -2));
- Assert.AreEqual("a", AddIntegerToBoe("a - 1", 1));
- Assert.AreEqual("a + 1", AddIntegerToBoe("a - 2", 3));
- Assert.AreEqual("a - 1", AddInteger<IdentifierExpression>("a", -1));
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Expressions/CastExpressionTests.cs b/main/contrib/NRefactory/Test/Parser/Expressions/CastExpressionTests.cs
deleted file mode 100644
index c2ec4e1e8b..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Expressions/CastExpressionTests.cs
+++ /dev/null
@@ -1,313 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 3660 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class CastExpressionTests
- {
- #region C#
- [Test]
- public void CSharpSimpleCastExpression()
- {
- CastExpression ce = ParseUtilCSharp.ParseExpression<CastExpression>("(MyObject)o");
- Assert.AreEqual("MyObject", ce.CastTo.Type);
- Assert.IsTrue(ce.Expression is IdentifierExpression);
- Assert.AreEqual(CastType.Cast, ce.CastType);
- }
-
- [Test]
- public void CSharpArrayCastExpression()
- {
- CastExpression ce = ParseUtilCSharp.ParseExpression<CastExpression>("(MyType[])o");
- Assert.AreEqual("MyType", ce.CastTo.Type);
- Assert.AreEqual(new int[] { 0 }, ce.CastTo.RankSpecifier);
- Assert.IsTrue(ce.Expression is IdentifierExpression);
- Assert.AreEqual(CastType.Cast, ce.CastType);
- }
-
- [Test]
- public void NullablePrimitiveCastExpression()
- {
- CastExpression ce = ParseUtilCSharp.ParseExpression<CastExpression>("(int?)o");
- Assert.AreEqual("System.Nullable", ce.CastTo.Type);
- Assert.AreEqual("System.Int32", ce.CastTo.GenericTypes[0].Type);
- Assert.IsTrue(ce.Expression is IdentifierExpression);
- Assert.AreEqual(CastType.Cast, ce.CastType);
- }
-
- [Test]
- public void NullableCastExpression()
- {
- CastExpression ce = ParseUtilCSharp.ParseExpression<CastExpression>("(MyType?)o");
- Assert.AreEqual("System.Nullable", ce.CastTo.Type);
- Assert.AreEqual("MyType", ce.CastTo.GenericTypes[0].Type);
- Assert.IsTrue(ce.Expression is IdentifierExpression);
- Assert.AreEqual(CastType.Cast, ce.CastType);
- }
-
- [Test]
- public void NullableTryCastExpression()
- {
- CastExpression ce = ParseUtilCSharp.ParseExpression<CastExpression>("o as int?");
- Assert.AreEqual("System.Nullable", ce.CastTo.Type);
- Assert.IsTrue(ce.CastTo.IsKeyword);
- Assert.AreEqual("System.Int32", ce.CastTo.GenericTypes[0].Type);
- Assert.IsTrue(ce.Expression is IdentifierExpression);
- Assert.AreEqual(CastType.TryCast, ce.CastType);
- }
-
- [Test]
- public void GenericCastExpression()
- {
- CastExpression ce = ParseUtilCSharp.ParseExpression<CastExpression>("(List<string>)o");
- Assert.AreEqual("List", ce.CastTo.Type);
- Assert.AreEqual("System.String", ce.CastTo.GenericTypes[0].Type);
- Assert.IsTrue(ce.Expression is IdentifierExpression);
- Assert.AreEqual(CastType.Cast, ce.CastType);
- }
-
- [Test]
- public void GenericArrayCastExpression()
- {
- CastExpression ce = ParseUtilCSharp.ParseExpression<CastExpression>("(List<string>[])o");
- Assert.AreEqual("List", ce.CastTo.Type);
- Assert.AreEqual("System.String", ce.CastTo.GenericTypes[0].Type);
- Assert.AreEqual(new int[] { 0 }, ce.CastTo.RankSpecifier);
- Assert.IsTrue(ce.Expression is IdentifierExpression);
- Assert.AreEqual(CastType.Cast, ce.CastType);
- }
-
- [Test]
- public void GenericArrayAsCastExpression()
- {
- CastExpression ce = ParseUtilCSharp.ParseExpression<CastExpression>("o as List<string>[]");
- Assert.AreEqual("List", ce.CastTo.Type);
- Assert.AreEqual("System.String", ce.CastTo.GenericTypes[0].Type);
- Assert.AreEqual(new int[] { 0 }, ce.CastTo.RankSpecifier);
- Assert.IsTrue(ce.Expression is IdentifierExpression);
- Assert.AreEqual(CastType.TryCast, ce.CastType);
- }
-
- [Test]
- public void CSharpCastMemberReferenceOnParenthesizedExpression()
- {
- // yes, we really wanted to evaluate .Member on expr and THEN cast the result to MyType
- CastExpression ce = ParseUtilCSharp.ParseExpression<CastExpression>("(MyType)(expr).Member");
- Assert.AreEqual("MyType", ce.CastTo.Type);
- Assert.IsTrue(ce.Expression is MemberReferenceExpression);
- Assert.AreEqual(CastType.Cast, ce.CastType);
- }
-
- [Test]
- public void CSharpTryCastParenthesizedExpression()
- {
- CastExpression ce = ParseUtilCSharp.ParseExpression<CastExpression>("(o) as string");
- Assert.AreEqual("System.String", ce.CastTo.ToString());
- Assert.IsTrue(ce.Expression is ParenthesizedExpression);
- Assert.AreEqual(CastType.TryCast, ce.CastType);
- }
-
- [Test]
- public void CSharpCastNegation()
- {
- CastExpression ce = ParseUtilCSharp.ParseExpression<CastExpression>("(uint)-negativeValue");
- Assert.AreEqual("System.UInt32", ce.CastTo.ToString());
- Assert.IsTrue(ce.Expression is UnaryOperatorExpression);
- Assert.AreEqual(CastType.Cast, ce.CastType);
- }
-
- [Test]
- public void CSharpSubtractionIsNotCast()
- {
- BinaryOperatorExpression boe = ParseUtilCSharp.ParseExpression<BinaryOperatorExpression>("(BigInt)-negativeValue");
- Assert.IsTrue(boe.Left is ParenthesizedExpression);
- Assert.IsTrue(boe.Right is IdentifierExpression);
- }
-
- [Test]
- public void CSharpIntMaxValueToBigInt()
- {
- CastExpression ce = ParseUtilCSharp.ParseExpression<CastExpression>("(BigInt)int.MaxValue");
- Assert.AreEqual("BigInt", ce.CastTo.ToString());
- Assert.IsTrue(ce.Expression is MemberReferenceExpression);
- }
- #endregion
-
- #region VB.NET
- void TestSpecializedCast(string castExpression, Type castType)
- {
- CastExpression ce = ParseUtilVBNet.ParseExpression<CastExpression>(castExpression);
- Assert.AreEqual(castType.FullName, ce.CastTo.Type);
- Assert.IsTrue(ce.Expression is IdentifierExpression);
- Assert.AreEqual(CastType.PrimitiveConversion, ce.CastType);
- }
-
-
- [Test]
- public void VBNetSimpleCastExpression()
- {
- CastExpression ce = ParseUtilVBNet.ParseExpression<CastExpression>("CType(o, MyObject)");
- Assert.AreEqual("MyObject", ce.CastTo.Type);
- Assert.IsTrue(ce.Expression is IdentifierExpression);
- Assert.AreEqual(CastType.Conversion, ce.CastType);
- }
-
- [Test]
- public void VBNetGenericCastExpression()
- {
- CastExpression ce = ParseUtilVBNet.ParseExpression<CastExpression>("CType(o, List(of T))");
- Assert.AreEqual("List", ce.CastTo.Type);
- Assert.AreEqual("T", ce.CastTo.GenericTypes[0].Type);
- Assert.IsTrue(ce.Expression is IdentifierExpression);
- Assert.AreEqual(CastType.Conversion, ce.CastType);
- }
-
- [Test]
- public void VBNetSimpleDirectCastExpression()
- {
- CastExpression ce = ParseUtilVBNet.ParseExpression<CastExpression>("DirectCast(o, MyObject)");
- Assert.AreEqual("MyObject", ce.CastTo.Type);
- Assert.IsTrue(ce.Expression is IdentifierExpression);
- Assert.AreEqual(CastType.Cast, ce.CastType);
- }
-
- [Test]
- public void VBNetGenericDirectCastExpression()
- {
- CastExpression ce = ParseUtilVBNet.ParseExpression<CastExpression>("DirectCast(o, List(of T))");
- Assert.AreEqual("List", ce.CastTo.Type);
- Assert.AreEqual("T", ce.CastTo.GenericTypes[0].Type);
- Assert.IsTrue(ce.Expression is IdentifierExpression);
- Assert.AreEqual(CastType.Cast, ce.CastType);
- }
-
- [Test]
- public void VBNetSimpleTryCastExpression()
- {
- CastExpression ce = ParseUtilVBNet.ParseExpression<CastExpression>("TryCast(o, MyObject)");
- Assert.AreEqual("MyObject", ce.CastTo.Type);
- Assert.IsTrue(ce.Expression is IdentifierExpression);
- Assert.AreEqual(CastType.TryCast, ce.CastType);
- }
-
- [Test]
- public void VBNetGenericTryCastExpression()
- {
- CastExpression ce = ParseUtilVBNet.ParseExpression<CastExpression>("TryCast(o, List(of T))");
- Assert.AreEqual("List", ce.CastTo.Type);
- Assert.AreEqual("T", ce.CastTo.GenericTypes[0].Type);
- Assert.IsTrue(ce.Expression is IdentifierExpression);
- Assert.AreEqual(CastType.TryCast, ce.CastType);
- }
-
- [Test]
- public void VBNetSpecializedBoolCastExpression()
- {
- TestSpecializedCast("CBool(o)", typeof(System.Boolean));
- }
-
- [Test]
- public void VBNetSpecializedCharCastExpression()
- {
- TestSpecializedCast("CChar(o)", typeof(System.Char));
- }
-
-
- [Test]
- public void VBNetSpecializedStringCastExpression()
- {
- TestSpecializedCast("CStr(o)", typeof(System.String));
- }
-
- [Test]
- public void VBNetSpecializedDateTimeCastExpression()
- {
- TestSpecializedCast("CDate(o)", typeof(System.DateTime));
- }
-
- [Test]
- public void VBNetSpecializedDecimalCastExpression()
- {
- TestSpecializedCast("CDec(o)", typeof(System.Decimal));
- }
-
- [Test]
- public void VBNetSpecializedSingleCastExpression()
- {
- TestSpecializedCast("CSng(o)", typeof(System.Single));
- }
-
- [Test]
- public void VBNetSpecializedDoubleCastExpression()
- {
- TestSpecializedCast("CDbl(o)", typeof(System.Double));
- }
-
- [Test]
- public void VBNetSpecializedByteCastExpression()
- {
- TestSpecializedCast("CByte(o)", typeof(System.Byte));
- }
-
- [Test]
- public void VBNetSpecializedInt16CastExpression()
- {
- TestSpecializedCast("CShort(o)", typeof(System.Int16));
- }
-
- [Test]
- public void VBNetSpecializedInt32CastExpression()
- {
- TestSpecializedCast("CInt(o)", typeof(System.Int32));
- }
-
- [Test]
- public void VBNetSpecializedInt64CastExpression()
- {
- TestSpecializedCast("CLng(o)", typeof(System.Int64));
- }
-
- [Test]
- public void VBNetSpecializedSByteCastExpression()
- {
- TestSpecializedCast("CSByte(o)", typeof(System.SByte));
- }
-
- [Test]
- public void VBNetSpecializedUInt16CastExpression()
- {
- TestSpecializedCast("CUShort(o)", typeof(System.UInt16));
- }
-
- [Test]
- public void VBNetSpecializedUInt32CastExpression()
- {
- TestSpecializedCast("CUInt(o)", typeof(System.UInt32));
- }
-
- [Test]
- public void VBNetSpecializedUInt64CastExpression()
- {
- TestSpecializedCast("CULng(o)", typeof(System.UInt64));
- }
-
-
- [Test]
- public void VBNetSpecializedObjectCastExpression()
- {
- TestSpecializedCast("CObj(o)", typeof(System.Object));
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Expressions/CheckedExpressionTests.cs b/main/contrib/NRefactory/Test/Parser/Expressions/CheckedExpressionTests.cs
deleted file mode 100644
index cd02b7552f..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Expressions/CheckedExpressionTests.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class CheckedExpressionTests
- {
- #region C#
- [Test]
- public void CSharpCheckedExpressionTest()
- {
- CheckedExpression ce = ParseUtilCSharp.ParseExpression<CheckedExpression>("checked(a)");
- Assert.IsTrue(ce.Expression is IdentifierExpression);
- }
- #endregion
-
- #region VB.NET
- // No VB.NET representation
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Expressions/ClassReferenceExpressionTests.cs b/main/contrib/NRefactory/Test/Parser/Expressions/ClassReferenceExpressionTests.cs
deleted file mode 100644
index def8e38aec..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Expressions/ClassReferenceExpressionTests.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 2676 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class ClassReferenceExpressionTests
- {
- #region C#
- // No C# representation
- #endregion
-
- #region VB.NET
- [Test]
- public void VBNetClassReferenceExpressionTest1()
- {
- MemberReferenceExpression fre = ParseUtilVBNet.ParseExpression<MemberReferenceExpression>("MyClass.myField");
- Assert.IsTrue(fre.TargetObject is ClassReferenceExpression);
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Expressions/ConditionalExpressionTests.cs b/main/contrib/NRefactory/Test/Parser/Expressions/ConditionalExpressionTests.cs
deleted file mode 100644
index 01fa0803f1..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Expressions/ConditionalExpressionTests.cs
+++ /dev/null
@@ -1,107 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 3370 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class ConditionalExpressionTests
- {
- #region C#
- [Test]
- public void CSharpConditionalExpressionTest()
- {
- ConditionalExpression ce = ParseUtilCSharp.ParseExpression<ConditionalExpression>("a == b ? a() : a.B");
-
- Assert.IsTrue(ce.Condition is BinaryOperatorExpression);
- Assert.IsTrue(ce.TrueExpression is InvocationExpression);
- Assert.IsTrue(ce.FalseExpression is MemberReferenceExpression);
- }
-
- [Test]
- public void CSharpConditionalIsExpressionTest()
- {
- // (as is b?) ERROR (conflict with nullables, SD2-419)
- ConditionalExpression ce = ParseUtilCSharp.ParseExpression<ConditionalExpression>("a is b ? a() : a.B");
-
- Assert.IsTrue(ce.Condition is TypeOfIsExpression);
- Assert.IsTrue(ce.TrueExpression is InvocationExpression);
- Assert.IsTrue(ce.FalseExpression is MemberReferenceExpression);
- }
-
- [Test]
- public void CSharpConditionalIsWithNullableExpressionTest()
- {
- ConditionalExpression ce = ParseUtilCSharp.ParseExpression<ConditionalExpression>("a is b? ? a() : a.B");
-
- Assert.IsTrue(ce.Condition is TypeOfIsExpression);
- Assert.IsTrue(ce.TrueExpression is InvocationExpression);
- Assert.IsTrue(ce.FalseExpression is MemberReferenceExpression);
- }
-
- [Test]
- public void CSharpConditionalIsExpressionTest2()
- {
- ConditionalExpression ce = ParseUtilCSharp.ParseExpression<ConditionalExpression>("a is b ? (a()) : a.B");
-
- Assert.IsTrue(ce.Condition is TypeOfIsExpression);
- Assert.IsTrue(ce.TrueExpression is ParenthesizedExpression);
- Assert.IsTrue(ce.FalseExpression is MemberReferenceExpression);
- }
-
- [Test]
- public void CSharpConditionalExpressionNegativeValue()
- {
- ConditionalExpression ce = ParseUtilCSharp.ParseExpression<ConditionalExpression>("isNegative ? -1 : 1");
-
- Assert.IsTrue(ce.Condition is IdentifierExpression);
- Assert.IsTrue(ce.TrueExpression is UnaryOperatorExpression);
- Assert.IsTrue(ce.FalseExpression is PrimitiveExpression);
- }
-
-
- [Test]
- public void CSharpConditionalIsWithNegativeValue()
- {
- ConditionalExpression ce = ParseUtilCSharp.ParseExpression<ConditionalExpression>("a is b ? -1 : 1");
-
- Assert.IsTrue(ce.Condition is TypeOfIsExpression);
- Assert.IsTrue(ce.TrueExpression is UnaryOperatorExpression);
- Assert.IsTrue(ce.FalseExpression is PrimitiveExpression);
- }
-
- [Test]
- public void CSharpConditionalIsWithExplicitPositiveValue()
- {
- ConditionalExpression ce = ParseUtilCSharp.ParseExpression<ConditionalExpression>("a is b ? +1 : 1");
-
- Assert.IsTrue(ce.Condition is TypeOfIsExpression);
- Assert.IsTrue(ce.TrueExpression is UnaryOperatorExpression);
- Assert.IsTrue(ce.FalseExpression is PrimitiveExpression);
- }
- #endregion
-
- #region VB.NET
-
- [Test]
- public void VBNetConditionalExpressionTest()
- {
- ConditionalExpression ce = ParseUtilVBNet.ParseExpression<ConditionalExpression>("If(x IsNot Nothing, x.Test, \"nothing\")");
-
- Assert.IsTrue(ce.Condition is BinaryOperatorExpression);
- Assert.IsTrue(ce.TrueExpression is MemberReferenceExpression);
- Assert.IsTrue(ce.FalseExpression is PrimitiveExpression);
- }
-
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Expressions/DefaultValueExpressionTests.cs b/main/contrib/NRefactory/Test/Parser/Expressions/DefaultValueExpressionTests.cs
deleted file mode 100644
index ce0af15f8c..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Expressions/DefaultValueExpressionTests.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-// <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 System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class DefaultValueExpressionTests
- {
- [Test]
- public void CSharpSimpleDefaultValue()
- {
- DefaultValueExpression toe = ParseUtilCSharp.ParseExpression<DefaultValueExpression>("default(T)");
- Assert.AreEqual("T", toe.TypeReference.Type);
- }
-
- [Test]
- public void CSharpFullQualifiedDefaultValue()
- {
- DefaultValueExpression toe = ParseUtilCSharp.ParseExpression<DefaultValueExpression>("default(global::MyNamespace.N1.MyType)");
- Assert.IsTrue(toe.TypeReference.IsGlobal);
- Assert.AreEqual("MyNamespace.N1.MyType", toe.TypeReference.Type);
- }
-
- [Test]
- public void CSharpGenericDefaultValue()
- {
- DefaultValueExpression toe = ParseUtilCSharp.ParseExpression<DefaultValueExpression>("default(MyNamespace.N1.MyType<string>)");
- Assert.AreEqual("MyNamespace.N1.MyType", toe.TypeReference.Type);
- Assert.AreEqual("System.String", toe.TypeReference.GenericTypes[0].Type);
- }
-
- [Test]
- public void CSharpDefaultValueAsIntializer()
- {
- // This test is failing because we need a resolver for the "default:" / "default(" conflict.
- LocalVariableDeclaration lvd = ParseUtilCSharp.ParseStatement<LocalVariableDeclaration>("T a = default(T);");
- DefaultValueExpression dve = (DefaultValueExpression)lvd.Variables[0].Initializer;
- Assert.AreEqual("T", dve.TypeReference.Type);
- }
-
- [Test]
- public void CSharpDefaultValueInReturnStatement()
- {
- ReturnStatement rs = ParseUtilCSharp.ParseStatement<ReturnStatement>("return default(T);");
- DefaultValueExpression dve = (DefaultValueExpression)rs.Expression;
- Assert.AreEqual("T", dve.TypeReference.Type);
- }
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Expressions/GlobalReferenceExpressionTests.cs b/main/contrib/NRefactory/Test/Parser/Expressions/GlobalReferenceExpressionTests.cs
deleted file mode 100644
index 2d3ae770f2..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Expressions/GlobalReferenceExpressionTests.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 1634 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class GlobalReferenceExpressionTests
- {
- [Test]
- public void CSharpGlobalReferenceExpressionTest()
- {
- TypeReferenceExpression tre = ParseUtilCSharp.ParseExpression<TypeReferenceExpression>("global::System");
- Assert.IsTrue(tre.TypeReference.IsGlobal);
- Assert.AreEqual("System", tre.TypeReference.Type);
- }
-
- [Test]
- public void VBNetGlobalReferenceExpressionTest()
- {
- TypeReferenceExpression tre = ParseUtilVBNet.ParseExpression<TypeReferenceExpression>("Global.System");
- Assert.IsTrue(tre.TypeReference.IsGlobal);
- Assert.AreEqual("System", tre.TypeReference.Type);
- }
-
- [Test]
- public void CSharpGlobalTypeDeclaration()
- {
- LocalVariableDeclaration lvd = ParseUtilCSharp.ParseStatement<LocalVariableDeclaration>("global::System.String a;");
- TypeReference typeRef = lvd.GetTypeForVariable(0);
- Assert.IsTrue(typeRef.IsGlobal);
- Assert.AreEqual("System.String", typeRef.Type);
- }
-
- [Test]
- public void VBNetGlobalTypeDeclaration()
- {
- LocalVariableDeclaration lvd = ParseUtilVBNet.ParseStatement<LocalVariableDeclaration>("Dim a As Global.System.String");
- TypeReference typeRef = lvd.GetTypeForVariable(0);
- Assert.IsTrue(typeRef.IsGlobal);
- Assert.AreEqual("System.String", typeRef.Type);
- }
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Expressions/IdentifierExpressionTests.cs b/main/contrib/NRefactory/Test/Parser/Expressions/IdentifierExpressionTests.cs
deleted file mode 100644
index ed9adeccf4..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Expressions/IdentifierExpressionTests.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 2819 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class IdentifierExpressionTests
- {
- #region C#
- [Test]
- public void CSharpIdentifierExpressionTest1()
- {
- IdentifierExpression ident = ParseUtilCSharp.ParseExpression<IdentifierExpression>("MyIdentifier");
- Assert.AreEqual("MyIdentifier", ident.Identifier);
- }
-
- [Test]
- public void CSharpIdentifierExpressionTest2()
- {
- IdentifierExpression ident = ParseUtilCSharp.ParseExpression<IdentifierExpression>("@public");
- Assert.AreEqual("public", ident.Identifier);
- }
-
- [Test]
- public void CSharpGenericMethodReference()
- {
- IdentifierExpression ident = ParseUtilCSharp.ParseExpression<IdentifierExpression>("M<int>");
- Assert.AreEqual("M", ident.Identifier);
- Assert.AreEqual(1, ident.TypeArguments.Count);
- }
-
- [Test]
- public void CSharpGenericMethodReference2()
- {
- IdentifierExpression ident = ParseUtilCSharp.ParseExpression<IdentifierExpression>("TargetMethod<string>");
- Assert.AreEqual("TargetMethod", ident.Identifier);
- Assert.AreEqual(1, ident.TypeArguments.Count);
- }
- #endregion
-
- #region VB.NET
- [Test]
- public void VBNetIdentifierExpressionTest1()
- {
- IdentifierExpression ie = ParseUtilVBNet.ParseExpression<IdentifierExpression>("MyIdentifier");
- Assert.AreEqual("MyIdentifier", ie.Identifier);
- }
-
- [Test]
- public void VBNetIdentifierExpressionTest2()
- {
- IdentifierExpression ie = ParseUtilVBNet.ParseExpression<IdentifierExpression>("[Public]");
- Assert.AreEqual("Public", ie.Identifier);
- }
-
- [Test]
- public void VBNetContextKeywordsTest()
- {
- Assert.AreEqual("Assembly", ParseUtilVBNet.ParseExpression<IdentifierExpression>("Assembly").Identifier);
- Assert.AreEqual("Custom", ParseUtilVBNet.ParseExpression<IdentifierExpression>("Custom").Identifier);
- Assert.AreEqual("Off", ParseUtilVBNet.ParseExpression<IdentifierExpression>("Off").Identifier);
- Assert.AreEqual("Explicit", ParseUtilVBNet.ParseExpression<IdentifierExpression>("Explicit").Identifier);
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Expressions/IndexerExpressionTests.cs b/main/contrib/NRefactory/Test/Parser/Expressions/IndexerExpressionTests.cs
deleted file mode 100644
index 1f6b050c4d..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Expressions/IndexerExpressionTests.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class IndexerExpressionTests
- {
- #region C#
- [Test]
- public void CSharpIndexerExpressionTest()
- {
- IndexerExpression ie = ParseUtilCSharp.ParseExpression<IndexerExpression>("field[1, \"Hello\", 'a']");
- Assert.IsTrue(ie.TargetObject is IdentifierExpression);
-
- Assert.AreEqual(3, ie.Indexes.Count);
-
- Assert.IsTrue(ie.Indexes[0] is PrimitiveExpression);
- Assert.AreEqual(1, (int)((PrimitiveExpression)ie.Indexes[0]).Value);
- Assert.IsTrue(ie.Indexes[1] is PrimitiveExpression);
- Assert.AreEqual("Hello", (string)((PrimitiveExpression)ie.Indexes[1]).Value);
- Assert.IsTrue(ie.Indexes[2] is PrimitiveExpression);
- Assert.AreEqual('a', (char)((PrimitiveExpression)ie.Indexes[2]).Value);
- }
- #endregion
-
- #region VB.NET
- // No VB.NET representation
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Expressions/InvocationExpressionTests.cs b/main/contrib/NRefactory/Test/Parser/Expressions/InvocationExpressionTests.cs
deleted file mode 100644
index bac3fe2d8a..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Expressions/InvocationExpressionTests.cs
+++ /dev/null
@@ -1,136 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 3660 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class InvocationExpressionTests
- {
- void CheckSimpleInvoke(InvocationExpression ie)
- {
- Assert.AreEqual(0, ie.Arguments.Count);
- Assert.IsTrue(ie.TargetObject is IdentifierExpression);
- Assert.AreEqual("myMethod", ((IdentifierExpression)ie.TargetObject).Identifier);
- }
-
- void CheckGenericInvoke(InvocationExpression expr)
- {
- Assert.AreEqual(1, expr.Arguments.Count);
- Assert.IsTrue(expr.TargetObject is IdentifierExpression);
- IdentifierExpression ident = (IdentifierExpression)expr.TargetObject;
- Assert.AreEqual("myMethod", ident.Identifier);
- Assert.AreEqual(1, ident.TypeArguments.Count);
- Assert.AreEqual("System.Char", ident.TypeArguments[0].Type);
- }
-
- void CheckGenericInvoke2(InvocationExpression expr)
- {
- Assert.AreEqual(0, expr.Arguments.Count);
- Assert.IsTrue(expr.TargetObject is IdentifierExpression);
- IdentifierExpression ident = (IdentifierExpression)expr.TargetObject;
- Assert.AreEqual("myMethod", ident.Identifier);
- Assert.AreEqual(2, ident.TypeArguments.Count);
- Assert.AreEqual("T", ident.TypeArguments[0].Type);
- Assert.IsFalse(ident.TypeArguments[0].IsKeyword);
- Assert.AreEqual("System.Boolean", ident.TypeArguments[1].Type);
- Assert.IsTrue(ident.TypeArguments[1].IsKeyword);
- }
-
-
- #region C#
- [Test]
- public void CSharpSimpleInvocationExpressionTest()
- {
- CheckSimpleInvoke(ParseUtilCSharp.ParseExpression<InvocationExpression>("myMethod()"));
- }
-
- [Test]
- public void CSharpGenericInvocationExpressionTest()
- {
- CheckGenericInvoke(ParseUtilCSharp.ParseExpression<InvocationExpression>("myMethod<char>('a')"));
- }
-
- [Test]
- public void CSharpGenericInvocation2ExpressionTest()
- {
- CheckGenericInvoke2(ParseUtilCSharp.ParseExpression<InvocationExpression>("myMethod<T,bool>()"));
- }
-
- [Test]
- public void CSharpAmbiguousGrammarGenericMethodCall()
- {
- InvocationExpression ie = ParseUtilCSharp.ParseExpression<InvocationExpression>("F(G<A,B>(7))");
- Assert.IsTrue(ie.TargetObject is IdentifierExpression);
- Assert.AreEqual(1, ie.Arguments.Count);
- ie = (InvocationExpression)ie.Arguments[0];
- Assert.AreEqual(1, ie.Arguments.Count);
- Assert.IsTrue(ie.Arguments[0] is PrimitiveExpression);
- IdentifierExpression ident = (IdentifierExpression)ie.TargetObject;
- Assert.AreEqual("G", ident.Identifier);
- Assert.AreEqual(2, ident.TypeArguments.Count);
- }
-
- [Test]
- public void CSharpAmbiguousGrammarNotAGenericMethodCall()
- {
- BinaryOperatorExpression boe = ParseUtilCSharp.ParseExpression<BinaryOperatorExpression>("F<A>+y");
- Assert.AreEqual(BinaryOperatorType.GreaterThan, boe.Op);
- Assert.IsTrue(boe.Left is BinaryOperatorExpression);
- Assert.IsTrue(boe.Right is UnaryOperatorExpression);
- }
-
- [Test]
- public void CSharpInvalidNestedInvocationExpressionTest()
- {
- // this test was written because this bug caused the AbstractASTVisitor to crash
-
- InvocationExpression expr = ParseUtilCSharp.ParseExpression<InvocationExpression>("WriteLine(myMethod(,))", true);
- Assert.IsTrue(expr.TargetObject is IdentifierExpression);
- Assert.AreEqual("WriteLine", ((IdentifierExpression)expr.TargetObject).Identifier);
-
- Assert.AreEqual(1, expr.Arguments.Count); // here a second null parameter was added incorrectly
-
- Assert.IsTrue(expr.Arguments[0] is InvocationExpression);
- CheckSimpleInvoke((InvocationExpression)expr.Arguments[0]);
- }
- #endregion
-
- #region VB.NET
- [Test]
- public void VBNetSimpleInvocationExpressionTest()
- {
- CheckSimpleInvoke(ParseUtilVBNet.ParseExpression<InvocationExpression>("myMethod()"));
- }
-
- [Test]
- public void VBNetGenericInvocationExpressionTest()
- {
- CheckGenericInvoke(ParseUtilVBNet.ParseExpression<InvocationExpression>("myMethod(Of Char)(\"a\"c)"));
- }
-
- [Test]
- public void VBNetGenericInvocation2ExpressionTest()
- {
- CheckGenericInvoke2(ParseUtilVBNet.ParseExpression<InvocationExpression>("myMethod(Of T, Boolean)()"));
- }
-
- [Test]
- public void PrimitiveExpression1Test()
- {
- InvocationExpression ie = ParseUtilVBNet.ParseExpression<InvocationExpression>("546.ToString()");
- Assert.AreEqual(0, ie.Arguments.Count);
- }
-
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Expressions/LambdaExpressionTests.cs b/main/contrib/NRefactory/Test/Parser/Expressions/LambdaExpressionTests.cs
deleted file mode 100644
index f592007168..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Expressions/LambdaExpressionTests.cs
+++ /dev/null
@@ -1,116 +0,0 @@
-// <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 System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class LambdaExpressionTests
- {
- #region C#
-
- static LambdaExpression ParseCSharp(string program)
- {
- return ParseUtilCSharp.ParseExpression<LambdaExpression>(program);
- }
-
- [Test]
- public void ImplicitlyTypedExpressionBody()
- {
- LambdaExpression e = ParseCSharp("(x) => x + 1");
- Assert.AreEqual("x", e.Parameters[0].ParameterName);
- Assert.IsTrue(e.Parameters[0].TypeReference.IsNull);
- Assert.IsTrue(e.ExpressionBody is BinaryOperatorExpression);
- }
-
- [Test]
- public void ImplicitlyTypedExpressionBodyWithoutParenthesis()
- {
- LambdaExpression e = ParseCSharp("x => x + 1");
- Assert.AreEqual("x", e.Parameters[0].ParameterName);
- Assert.IsTrue(e.Parameters[0].TypeReference.IsNull);
- Assert.IsTrue(e.ExpressionBody is BinaryOperatorExpression);
- }
-
- [Test]
- public void ImplicitlyTypedStatementBody()
- {
- LambdaExpression e = ParseCSharp("(x) => { return x + 1; }");
- Assert.AreEqual("x", e.Parameters[0].ParameterName);
- Assert.IsTrue(e.Parameters[0].TypeReference.IsNull);
- Assert.IsTrue(e.StatementBody.Children[0] is ReturnStatement);
- }
-
- [Test]
- public void ImplicitlyTypedStatementBodyWithoutParenthesis()
- {
- LambdaExpression e = ParseCSharp("x => { return x + 1; }");
- Assert.AreEqual("x", e.Parameters[0].ParameterName);
- Assert.IsTrue(e.Parameters[0].TypeReference.IsNull);
- Assert.IsTrue(e.StatementBody.Children[0] is ReturnStatement);
- }
-
- [Test]
- public void ExplicitlyTypedStatementBody()
- {
- LambdaExpression e = ParseCSharp("(int x) => { return x + 1; }");
- Assert.AreEqual("x", e.Parameters[0].ParameterName);
- Assert.AreEqual("System.Int32", e.Parameters[0].TypeReference.Type);
- Assert.IsTrue(e.StatementBody.Children[0] is ReturnStatement);
- }
-
- [Test]
- public void LambdaExpressionContainingConditionalExpression()
- {
- LambdaExpression e = ParseCSharp("rr => rr != null ? rr.ResolvedType : null");
- Assert.AreEqual("rr", e.Parameters[0].ParameterName);
- Assert.IsTrue(e.ExpressionBody is ConditionalExpression);
- }
-
- #endregion
-
- #region VB.NET
-
- static LambdaExpression ParseVBNet(string program)
- {
- return ParseUtilVBNet.ParseExpression<LambdaExpression>(program);
- }
-
- [Test]
- public void VBNetLambdaWithParameters()
- {
- LambdaExpression e = ParseVBNet("Function(x As Boolean) x Or True");
- Assert.AreEqual(1, e.Parameters.Count);
- Assert.AreEqual("x", e.Parameters[0].ParameterName);
- Assert.AreEqual("System.Boolean", e.Parameters[0].TypeReference.Type);
- Assert.IsTrue(e.ExpressionBody is BinaryOperatorExpression);
- }
-
- [Test]
- public void VBNetLambdaWithoutParameters()
- {
- LambdaExpression e = ParseVBNet("Function x Or True");
- Assert.AreEqual(0, e.Parameters.Count);
- Assert.IsTrue(e.ExpressionBody is BinaryOperatorExpression);
- }
-
- [Test]
- public void VBNetNestedLambda()
- {
- LambdaExpression e = ParseVBNet("Function(x As Boolean) Function(y As Boolean) x And y");
- Assert.AreEqual(1, e.Parameters.Count);
- Assert.IsTrue(e.ExpressionBody is LambdaExpression);
- }
-
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Expressions/MemberReferenceExpressionTests.cs b/main/contrib/NRefactory/Test/Parser/Expressions/MemberReferenceExpressionTests.cs
deleted file mode 100644
index bc89cfd878..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Expressions/MemberReferenceExpressionTests.cs
+++ /dev/null
@@ -1,150 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 3660 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class MemberReferenceExpressionTests
- {
- #region C#
- [Test]
- public void CSharpSimpleFieldReferenceExpressionTest()
- {
- MemberReferenceExpression fre = ParseUtilCSharp.ParseExpression<MemberReferenceExpression>("myTargetObject.myField");
- Assert.AreEqual("myField", fre.MemberName);
- Assert.IsTrue(fre.TargetObject is IdentifierExpression);
- Assert.AreEqual("myTargetObject", ((IdentifierExpression)fre.TargetObject).Identifier);
- }
-
- [Test]
- public void CSharpGenericFieldReferenceExpressionTest()
- {
- MemberReferenceExpression fre = ParseUtilCSharp.ParseExpression<MemberReferenceExpression>("SomeClass<string>.myField");
- Assert.AreEqual("myField", fre.MemberName);
- Assert.IsTrue(fre.TargetObject is TypeReferenceExpression);
- TypeReference tr = ((TypeReferenceExpression)fre.TargetObject).TypeReference;
- Assert.AreEqual("SomeClass", tr.Type);
- Assert.AreEqual(1, tr.GenericTypes.Count);
- Assert.AreEqual("System.String", tr.GenericTypes[0].Type);
- }
-
- [Test]
- public void CSharpFullNamespaceGenericFieldReferenceExpressionTest()
- {
- MemberReferenceExpression fre = ParseUtilCSharp.ParseExpression<MemberReferenceExpression>("Namespace.Subnamespace.SomeClass<string>.myField");
- Assert.AreEqual("myField", fre.MemberName);
- Assert.IsTrue(fre.TargetObject is TypeReferenceExpression);
- TypeReference tr = ((TypeReferenceExpression)fre.TargetObject).TypeReference;
- Assert.AreEqual("Namespace.Subnamespace.SomeClass", tr.Type);
- Assert.AreEqual(1, tr.GenericTypes.Count);
- Assert.AreEqual("System.String", tr.GenericTypes[0].Type);
- }
-
- [Test]
- public void CSharpGlobalFullNamespaceGenericFieldReferenceExpressionTest()
- {
- MemberReferenceExpression fre = ParseUtilCSharp.ParseExpression<MemberReferenceExpression>("global::Namespace.Subnamespace.SomeClass<string>.myField");
- Assert.AreEqual("myField", fre.MemberName);
- Assert.IsTrue(fre.TargetObject is TypeReferenceExpression);
- TypeReference tr = ((TypeReferenceExpression)fre.TargetObject).TypeReference;
- Assert.IsFalse(tr is InnerClassTypeReference);
- Assert.AreEqual("Namespace.Subnamespace.SomeClass", tr.Type);
- Assert.AreEqual(1, tr.GenericTypes.Count);
- Assert.AreEqual("System.String", tr.GenericTypes[0].Type);
- Assert.IsTrue(tr.IsGlobal);
- }
-
- [Test]
- public void CSharpNestedGenericFieldReferenceExpressionTest()
- {
- MemberReferenceExpression fre = ParseUtilCSharp.ParseExpression<MemberReferenceExpression>("MyType<string>.InnerClass<int>.myField");
- Assert.AreEqual("myField", fre.MemberName);
- Assert.IsTrue(fre.TargetObject is TypeReferenceExpression);
- InnerClassTypeReference ic = (InnerClassTypeReference)((TypeReferenceExpression)fre.TargetObject).TypeReference;
- Assert.AreEqual("InnerClass", ic.Type);
- Assert.AreEqual(1, ic.GenericTypes.Count);
- Assert.AreEqual("System.Int32", ic.GenericTypes[0].Type);
- Assert.AreEqual("MyType", ic.BaseType.Type);
- Assert.AreEqual(1, ic.BaseType.GenericTypes.Count);
- Assert.AreEqual("System.String", ic.BaseType.GenericTypes[0].Type);
- }
- #endregion
-
- #region VB.NET
- [Test]
- public void VBNetSimpleFieldReferenceExpressionTest()
- {
- MemberReferenceExpression fre = ParseUtilVBNet.ParseExpression<MemberReferenceExpression>("myTargetObject.myField");
- Assert.AreEqual("myField", fre.MemberName);
- Assert.IsTrue(fre.TargetObject is IdentifierExpression);
- Assert.AreEqual("myTargetObject", ((IdentifierExpression)fre.TargetObject).Identifier);
- }
-
- [Test]
- public void VBNetFieldReferenceExpressionWithoutTargetTest()
- {
- MemberReferenceExpression fre = ParseUtilVBNet.ParseExpression<MemberReferenceExpression>(".myField");
- Assert.AreEqual("myField", fre.MemberName);
- Assert.IsTrue(fre.TargetObject.IsNull);
- }
-
- [Test]
- public void VBNetGenericFieldReferenceExpressionTest()
- {
- MemberReferenceExpression fre = ParseUtilVBNet.ParseExpression<MemberReferenceExpression>("SomeClass(of string).myField");
- Assert.AreEqual("myField", fre.MemberName);
- Assert.IsInstanceOfType(typeof(IdentifierExpression), fre.TargetObject);
- TypeReference tr = ((IdentifierExpression)fre.TargetObject).TypeArguments[0];
- Assert.AreEqual("System.String", tr.Type);
- }
-
- [Test]
- public void VBNetFullNamespaceGenericFieldReferenceExpressionTest()
- {
- MemberReferenceExpression fre = ParseUtilVBNet.ParseExpression<MemberReferenceExpression>("System.Subnamespace.SomeClass(of string).myField");
- Assert.AreEqual("myField", fre.MemberName);
- Assert.IsInstanceOfType(typeof(MemberReferenceExpression), fre.TargetObject);
-
- MemberReferenceExpression inner = (MemberReferenceExpression)fre.TargetObject;
- Assert.AreEqual("SomeClass", inner.MemberName);
- Assert.AreEqual(1, inner.TypeArguments.Count);
- Assert.AreEqual("System.String", inner.TypeArguments[0].Type);
- }
-
- [Test]
- public void VBNetGlobalFullNamespaceGenericFieldReferenceExpressionTest()
- {
- MemberReferenceExpression fre = ParseUtilVBNet.ParseExpression<MemberReferenceExpression>("Global.System.Subnamespace.SomeClass(of string).myField");
- Assert.AreEqual("myField", fre.MemberName);
- Assert.IsInstanceOfType(typeof(MemberReferenceExpression), fre.TargetObject);
- MemberReferenceExpression inner = (MemberReferenceExpression)fre.TargetObject;
-
- Assert.AreEqual("SomeClass", inner.MemberName);
- Assert.AreEqual(1, inner.TypeArguments.Count);
- Assert.AreEqual("System.String", inner.TypeArguments[0].Type);
- }
-
- [Test]
- public void VBNetNestedGenericFieldReferenceExpressionTest()
- {
- MemberReferenceExpression fre = ParseUtilVBNet.ParseExpression<MemberReferenceExpression>("MyType(of string).InnerClass(of integer).myField");
- Assert.AreEqual("myField", fre.MemberName);
- Assert.IsInstanceOfType(typeof(MemberReferenceExpression), fre.TargetObject);
-
- MemberReferenceExpression inner = (MemberReferenceExpression)fre.TargetObject;
- Assert.AreEqual("InnerClass", inner.MemberName);
- }
-
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Expressions/ObjectCreateExpressionTests.cs b/main/contrib/NRefactory/Test/Parser/Expressions/ObjectCreateExpressionTests.cs
deleted file mode 100644
index 7a46d5f891..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Expressions/ObjectCreateExpressionTests.cs
+++ /dev/null
@@ -1,264 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 3660 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class ObjectCreateExpressionTests
- {
- void CheckSimpleObjectCreateExpression(ObjectCreateExpression oce)
- {
- Assert.AreEqual("MyObject", oce.CreateType.Type);
- Assert.AreEqual(3, oce.Parameters.Count);
- Assert.IsTrue(oce.ObjectInitializer.IsNull);
-
- for (int i = 0; i < oce.Parameters.Count; ++i) {
- Assert.IsTrue(oce.Parameters[i] is PrimitiveExpression);
- }
- }
-
- #region C#
- [Test]
- public void CSharpSimpleObjectCreateExpressionTest()
- {
- CheckSimpleObjectCreateExpression(ParseUtilCSharp.ParseExpression<ObjectCreateExpression>("new MyObject(1, 2, 3)"));
- }
-
- [Test]
- public void CSharpNullableObjectCreateExpressionTest()
- {
- ObjectCreateExpression oce = ParseUtilCSharp.ParseExpression<ObjectCreateExpression>("new IntPtr?(1)");
- Assert.AreEqual("System.Nullable", oce.CreateType.Type);
- Assert.AreEqual(1, oce.CreateType.GenericTypes.Count);
- Assert.AreEqual("IntPtr", oce.CreateType.GenericTypes[0].Type);
- }
-
- [Test]
- public void CSharpInvalidNestedObjectCreateExpressionTest()
- {
- // this test was written because this bug caused the AbstractASTVisitor to crash
-
- InvocationExpression expr = ParseUtilCSharp.ParseExpression<InvocationExpression>("WriteLine(new MyObject(1, 2, 3,))", true);
- Assert.IsTrue(expr.TargetObject is IdentifierExpression);
- Assert.AreEqual("WriteLine", ((IdentifierExpression)expr.TargetObject).Identifier);
-
- Assert.AreEqual(1, expr.Arguments.Count); // here a second null parameter was added incorrectly
-
- Assert.IsTrue(expr.Arguments[0] is ObjectCreateExpression);
- CheckSimpleObjectCreateExpression((ObjectCreateExpression)expr.Arguments[0]);
- }
-
- [Test]
- public void CSharpInvalidTypeArgumentListObjectCreateExpressionTest()
- {
- // this test was written because this bug caused the AbstractASTVisitor to crash
-
- InvocationExpression expr = ParseUtilCSharp.ParseExpression<InvocationExpression>("WriteLine(new SomeGenericType<int, >())", true);
- Assert.IsTrue(expr.TargetObject is IdentifierExpression);
- Assert.AreEqual("WriteLine", ((IdentifierExpression)expr.TargetObject).Identifier);
- Assert.AreEqual(1, expr.Arguments.Count); // here a second null parameter was added incorrectly
-
- Assert.IsTrue(expr.Arguments[0] is ObjectCreateExpression);
- TypeReference typeRef = ((ObjectCreateExpression)expr.Arguments[0]).CreateType;
- Assert.AreEqual("SomeGenericType", typeRef.Type);
- Assert.AreEqual(1, typeRef.GenericTypes.Count);
- Assert.AreEqual("System.Int32", typeRef.GenericTypes[0].Type);
- }
-
- Expression CheckPropertyInitializationExpression(Expression e, string name)
- {
- Assert.IsInstanceOfType(typeof(NamedArgumentExpression), e);
- Assert.AreEqual(name, ((NamedArgumentExpression)e).Name);
- return ((NamedArgumentExpression)e).Expression;
- }
-
- void CheckPointObjectCreation(ObjectCreateExpression oce)
- {
- Assert.AreEqual(0, oce.Parameters.Count);
- Assert.AreEqual(2, oce.ObjectInitializer.CreateExpressions.Count);
- Assert.IsInstanceOfType(typeof(PrimitiveExpression), CheckPropertyInitializationExpression(oce.ObjectInitializer.CreateExpressions[0], "X"));
- Assert.IsInstanceOfType(typeof(PrimitiveExpression), CheckPropertyInitializationExpression(oce.ObjectInitializer.CreateExpressions[1], "Y"));
- }
-
- [Test]
- public void CSharpObjectInitializer()
- {
- CheckPointObjectCreation(ParseUtilCSharp.ParseExpression<ObjectCreateExpression>("new Point() { X = 0, Y = 1 }"));
- }
-
- [Test]
- public void CSharpObjectInitializerWithoutParenthesis()
- {
- CheckPointObjectCreation(ParseUtilCSharp.ParseExpression<ObjectCreateExpression>("new Point { X = 0, Y = 1 }"));
- }
-
- [Test]
- public void CSharpObjectInitializerTrailingComma()
- {
- CheckPointObjectCreation(ParseUtilCSharp.ParseExpression<ObjectCreateExpression>("new Point() { X = 0, Y = 1, }"));
- }
-
- [Test]
- public void CSharpNestedObjectInitializer()
- {
- ObjectCreateExpression oce = ParseUtilCSharp.ParseExpression<ObjectCreateExpression>(
- "new Rectangle { P1 = new Point { X = 0, Y = 1 }, P2 = new Point { X = 2, Y = 3 } }"
- );
- Assert.AreEqual(0, oce.Parameters.Count);
- Assert.AreEqual(2, oce.ObjectInitializer.CreateExpressions.Count);
- CheckPointObjectCreation((ObjectCreateExpression)CheckPropertyInitializationExpression(oce.ObjectInitializer.CreateExpressions[0], "P1"));
- CheckPointObjectCreation((ObjectCreateExpression)CheckPropertyInitializationExpression(oce.ObjectInitializer.CreateExpressions[1], "P2"));
- }
-
- [Test]
- public void CSharpNestedObjectInitializerForPreinitializedProperty()
- {
- ObjectCreateExpression oce = ParseUtilCSharp.ParseExpression<ObjectCreateExpression>(
- "new Rectangle { P1 = { X = 0, Y = 1 }, P2 = { X = 2, Y = 3 } }"
- );
- Assert.AreEqual(0, oce.Parameters.Count);
- Assert.AreEqual(2, oce.ObjectInitializer.CreateExpressions.Count);
- CollectionInitializerExpression aie = (CollectionInitializerExpression)CheckPropertyInitializationExpression(oce.ObjectInitializer.CreateExpressions[0], "P1");
- Assert.IsInstanceOfType(typeof(PrimitiveExpression), CheckPropertyInitializationExpression(aie.CreateExpressions[0], "X"));
- Assert.IsInstanceOfType(typeof(PrimitiveExpression), CheckPropertyInitializationExpression(aie.CreateExpressions[1], "Y"));
- aie = (CollectionInitializerExpression)CheckPropertyInitializationExpression(oce.ObjectInitializer.CreateExpressions[1], "P2");
- Assert.IsInstanceOfType(typeof(PrimitiveExpression), CheckPropertyInitializationExpression(aie.CreateExpressions[0], "X"));
- Assert.IsInstanceOfType(typeof(PrimitiveExpression), CheckPropertyInitializationExpression(aie.CreateExpressions[1], "Y"));
- }
-
- [Test]
- public void CSharpCollectionInitializer()
- {
- ObjectCreateExpression oce = ParseUtilCSharp.ParseExpression<ObjectCreateExpression>(
- "new List<int> { 0, 1, 2 }"
- );
- Assert.AreEqual(0, oce.Parameters.Count);
- Assert.AreEqual(3, oce.ObjectInitializer.CreateExpressions.Count);
- Assert.IsInstanceOfType(typeof(PrimitiveExpression), oce.ObjectInitializer.CreateExpressions[0]);
- Assert.IsInstanceOfType(typeof(PrimitiveExpression), oce.ObjectInitializer.CreateExpressions[1]);
- Assert.IsInstanceOfType(typeof(PrimitiveExpression), oce.ObjectInitializer.CreateExpressions[2]);
- }
-
- [Test]
- public void CSharpComplexCollectionInitializer()
- {
- ObjectCreateExpression oce = ParseUtilCSharp.ParseExpression<ObjectCreateExpression>(
- @"new List<Contact> {
- new Contact {
- Name = ""Chris"",
- PhoneNumbers = { ""206-555-0101"" }
- },
- new Contact(additionalParameter) {
- Name = ""Bob"",
- PhoneNumbers = { ""650-555-0199"", ""425-882-8080"" }
- }
-}" );
- Assert.AreEqual(0, oce.Parameters.Count);
- Assert.AreEqual(2, oce.ObjectInitializer.CreateExpressions.Count);
-
- oce = (ObjectCreateExpression)oce.ObjectInitializer.CreateExpressions[1]; // look at Bob
- Assert.AreEqual(1, oce.Parameters.Count);
- Assert.IsInstanceOfType(typeof(IdentifierExpression), oce.Parameters[0]);
- Assert.IsInstanceOfType(typeof(PrimitiveExpression), CheckPropertyInitializationExpression(oce.ObjectInitializer.CreateExpressions[0], "Name"));
- CollectionInitializerExpression phoneNumbers = (CollectionInitializerExpression)CheckPropertyInitializationExpression(oce.ObjectInitializer.CreateExpressions[1], "PhoneNumbers");
- Assert.AreEqual(2, phoneNumbers.CreateExpressions.Count);
- }
-
- [Test]
- public void CSharpAnonymousType()
- {
- ObjectCreateExpression oce = ParseUtilCSharp.ParseExpression<ObjectCreateExpression>(
- "new { Name = \"Test\", Price, Something.Property }"
- );
- Assert.IsTrue(oce.CreateType.IsNull);
- Assert.AreEqual(0, oce.Parameters.Count);
- Assert.AreEqual(3, oce.ObjectInitializer.CreateExpressions.Count);
- Assert.IsInstanceOfType(typeof(PrimitiveExpression), CheckPropertyInitializationExpression(oce.ObjectInitializer.CreateExpressions[0], "Name"));
- Assert.IsInstanceOfType(typeof(IdentifierExpression), oce.ObjectInitializer.CreateExpressions[1]);
- Assert.IsInstanceOfType(typeof(MemberReferenceExpression), oce.ObjectInitializer.CreateExpressions[2]);
- }
- #endregion
-
- #region VB.NET
-
- [Test]
- public void VBNetAnonymousType()
- {
- ObjectCreateExpression oce = ParseUtilVBNet.ParseExpression<ObjectCreateExpression>(
- "New With {.Id = 1, .Name= \"Bill Gates\" }");
-
- Assert.IsTrue(oce.CreateType.IsNull);
- Assert.AreEqual(0, oce.Parameters.Count);
- Assert.AreEqual(2, oce.ObjectInitializer.CreateExpressions.Count);
-
- Assert.IsInstanceOfType(typeof(PrimitiveExpression), CheckPropertyInitializationExpression(oce.ObjectInitializer.CreateExpressions[0], "Id"));
- Assert.IsInstanceOfType(typeof(NamedArgumentExpression), oce.ObjectInitializer.CreateExpressions[1]);
- }
-
- [Test]
- public void VBNetSimpleObjectCreateExpressionTest()
- {
- CheckSimpleObjectCreateExpression(ParseUtilVBNet.ParseExpression<ObjectCreateExpression>("New MyObject(1, 2, 3)"));
- }
-
- [Test]
- public void VBNetInvalidTypeArgumentListObjectCreateExpressionTest()
- {
- // this test was written because this bug caused the AbstractASTVisitor to crash
-
- InvocationExpression expr = ParseUtilVBNet.ParseExpression<InvocationExpression>("WriteLine(New SomeGenericType(Of Integer, )())", true);
- Assert.IsTrue(expr.TargetObject is IdentifierExpression);
- Assert.AreEqual("WriteLine", ((IdentifierExpression)expr.TargetObject).Identifier);
- Assert.AreEqual(1, expr.Arguments.Count); // here a second null parameter was added incorrectly
-
- Assert.IsTrue(expr.Arguments[0] is ObjectCreateExpression);
- TypeReference typeRef = ((ObjectCreateExpression)expr.Arguments[0]).CreateType;
- Assert.AreEqual("SomeGenericType", typeRef.Type);
- Assert.AreEqual(1, typeRef.GenericTypes.Count);
- Assert.AreEqual("System.Int32", typeRef.GenericTypes[0].Type);
- }
-
- [Test]
- public void VBNetMemberInitializationTest()
- {
- ObjectCreateExpression oce = ParseUtilVBNet.ParseExpression<ObjectCreateExpression>("new Contact() With { .FirstName = \"Bill\", .LastName = \"Gates\" }");
- Assert.AreEqual(2, oce.ObjectInitializer.CreateExpressions.Count);
-
- Assert.AreEqual("FirstName", ((NamedArgumentExpression)oce.ObjectInitializer.CreateExpressions[0]).Name);
- Assert.AreEqual("LastName", ((NamedArgumentExpression)oce.ObjectInitializer.CreateExpressions[1]).Name);
-
- Assert.IsInstanceOfType(typeof(PrimitiveExpression), ((NamedArgumentExpression)oce.ObjectInitializer.CreateExpressions[0]).Expression);
- Assert.IsInstanceOfType(typeof(PrimitiveExpression), ((NamedArgumentExpression)oce.ObjectInitializer.CreateExpressions[1]).Expression);
- }
-
- [Test]
- public void VBNetNullableObjectCreateExpressionTest()
- {
- ObjectCreateExpression oce = ParseUtilVBNet.ParseExpression<ObjectCreateExpression>("New Integer?");
- Assert.AreEqual("System.Nullable", oce.CreateType.Type);
- Assert.AreEqual(1, oce.CreateType.GenericTypes.Count);
- Assert.AreEqual("System.Int32", oce.CreateType.GenericTypes[0].Type);
- }
-
- [Test]
- public void VBNetNullableObjectArrayCreateExpressionTest()
- {
- ObjectCreateExpression oce = ParseUtilVBNet.ParseExpression<ObjectCreateExpression>("New Integer?()");
- Assert.AreEqual("System.Nullable", oce.CreateType.Type);
- Assert.AreEqual(1, oce.CreateType.GenericTypes.Count);
- Assert.AreEqual("System.Int32", oce.CreateType.GenericTypes[0].Type);
- }
-
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Expressions/ParenthesizedExpressionTest.cs b/main/contrib/NRefactory/Test/Parser/Expressions/ParenthesizedExpressionTest.cs
deleted file mode 100644
index 427142ae16..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Expressions/ParenthesizedExpressionTest.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class ParenthesizedExpressionTests
- {
- #region C#
- [Test]
- public void CSharpPrimitiveParenthesizedExpression()
- {
- ParenthesizedExpression p = ParseUtilCSharp.ParseExpression<ParenthesizedExpression>("((1))");
- Assert.IsTrue(p.Expression is ParenthesizedExpression);
- p = p.Expression as ParenthesizedExpression;;
- Assert.IsTrue(p.Expression is PrimitiveExpression);
- }
- #endregion
-
- #region VB.NET
- [Test]
- public void VBNetPrimitiveParenthesizedExpression()
- {
- ParenthesizedExpression p = ParseUtilVBNet.ParseExpression<ParenthesizedExpression>("((1))");
- Assert.IsTrue(p.Expression is ParenthesizedExpression);
- p = p.Expression as ParenthesizedExpression;;
- Assert.IsTrue(p.Expression is PrimitiveExpression);
- }
- #endregion
-
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Expressions/PointerReferenceExpressionTests.cs b/main/contrib/NRefactory/Test/Parser/Expressions/PointerReferenceExpressionTests.cs
deleted file mode 100644
index 93d22390a7..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Expressions/PointerReferenceExpressionTests.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 3660 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class PointerReferenceExpressionTests
- {
- #region C#
- [Test]
- public void CSharpPointerReferenceExpressionTest()
- {
- PointerReferenceExpression pre = ParseUtilCSharp.ParseExpression<PointerReferenceExpression>("myObj.field->b");
- Assert.IsTrue(pre.TargetObject is MemberReferenceExpression);
- Assert.AreEqual("b", pre.MemberName);
- }
- #endregion
-
- #region VB.NET
- // No VB.NET representation
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Expressions/PrimitiveExpressionTests.cs b/main/contrib/NRefactory/Test/Parser/Expressions/PrimitiveExpressionTests.cs
deleted file mode 100644
index 163ac8287e..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Expressions/PrimitiveExpressionTests.cs
+++ /dev/null
@@ -1,104 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 2819 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class PrimitiveExpressionTests
- {
- #region C#
- [Test]
- public void CSharpHexIntegerTest1()
- {
- InvocationExpression invExpr = ParseUtilCSharp.ParseExpression<InvocationExpression>("0xAFFE.ToString()");
- Assert.AreEqual(0, invExpr.Arguments.Count);
- Assert.IsTrue(invExpr.TargetObject is MemberReferenceExpression);
- MemberReferenceExpression fre = invExpr.TargetObject as MemberReferenceExpression;
- Assert.AreEqual("ToString", fre.MemberName);
-
- Assert.IsTrue(fre.TargetObject is PrimitiveExpression);
- PrimitiveExpression pe = fre.TargetObject as PrimitiveExpression;
-
- Assert.AreEqual("0xAFFE", pe.StringValue);
- Assert.AreEqual(0xAFFE, (int)pe.Value);
-
- }
-
- [Test]
- public void CSharpDoubleTest1()
- {
- PrimitiveExpression pe = ParseUtilCSharp.ParseExpression<PrimitiveExpression>(".5e-06");
- Assert.AreEqual(".5e-06", pe.StringValue);
- Assert.AreEqual(.5e-06, (double)pe.Value);
- }
-
- [Test]
- public void CSharpCharTest1()
- {
- PrimitiveExpression pe = ParseUtilCSharp.ParseExpression<PrimitiveExpression>("'\\u0356'");
- Assert.AreEqual("'\\u0356'", pe.StringValue);
- Assert.AreEqual('\u0356', (char)pe.Value);
- }
-
- [Test]
- public void IntMinValueTest()
- {
- PrimitiveExpression pe = ParseUtilCSharp.ParseExpression<PrimitiveExpression>("-2147483648");
- Assert.AreEqual(-2147483648, (int)pe.Value);
- }
-
- [Test]
- public void IntMaxValueTest()
- {
- PrimitiveExpression pe = ParseUtilCSharp.ParseExpression<PrimitiveExpression>("2147483647");
- Assert.AreEqual(2147483647, (int)pe.Value);
-
- pe = ParseUtilCSharp.ParseExpression<PrimitiveExpression>("2147483648");
- Assert.AreEqual(2147483648, (uint)pe.Value);
- }
-
- [Test]
- public void LongMinValueTest()
- {
- PrimitiveExpression pe = ParseUtilCSharp.ParseExpression<PrimitiveExpression>("-9223372036854775808");
- Assert.AreEqual(-9223372036854775808, (long)pe.Value);
- }
-
- [Test]
- public void LongMaxValueTest()
- {
- PrimitiveExpression pe = ParseUtilCSharp.ParseExpression<PrimitiveExpression>("9223372036854775807");
- Assert.AreEqual(9223372036854775807, (long)pe.Value);
-
- pe = ParseUtilCSharp.ParseExpression<PrimitiveExpression>("9223372036854775808");
- Assert.AreEqual(9223372036854775808, (ulong)pe.Value);
- }
-
- [Test]
- public void CSharpStringTest1()
- {
- PrimitiveExpression pe = ParseUtilCSharp.ParseExpression<PrimitiveExpression>("\"\\n\\t\\u0005 Hello World !!!\"");
- Assert.AreEqual("\"\\n\\t\\u0005 Hello World !!!\"", pe.StringValue);
- Assert.AreEqual("\n\t\u0005 Hello World !!!", (string)pe.Value);
- }
- #endregion
-
- #region VB.NET
- [Test]
- public void PrimitiveExpression1Test()
- {
- InvocationExpression ie = ParseUtilVBNet.ParseExpression<InvocationExpression>("546.ToString()");
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Expressions/QueryExpressionTests.cs b/main/contrib/NRefactory/Test/Parser/Expressions/QueryExpressionTests.cs
deleted file mode 100644
index 7cd9a3c62c..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Expressions/QueryExpressionTests.cs
+++ /dev/null
@@ -1,113 +0,0 @@
-// <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 System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class QueryExpressionTests
- {
- [Test]
- public void SimpleExpression()
- {
- QueryExpression qe = ParseUtilCSharp.ParseExpression<QueryExpression>(
- "from c in customers where c.City == \"London\" select c"
- );
- Assert.AreEqual("c", qe.FromClause.Identifier);
- Assert.AreEqual("customers", ((IdentifierExpression)qe.FromClause.InExpression).Identifier);
- Assert.AreEqual(1, qe.MiddleClauses.Count);
- Assert.IsInstanceOfType(typeof(QueryExpressionWhereClause), qe.MiddleClauses[0]);
- QueryExpressionWhereClause wc = (QueryExpressionWhereClause)qe.MiddleClauses[0];
- Assert.IsInstanceOfType(typeof(BinaryOperatorExpression), wc.Condition);
- Assert.IsInstanceOfType(typeof(QueryExpressionSelectClause), qe.SelectOrGroupClause);
- }
-
- [Test]
- public void ExpressionWithType1()
- {
- QueryExpression qe = ParseUtilCSharp.ParseExpression<QueryExpression>(
- "from Customer c in customers select c"
- );
- Assert.AreEqual("c", qe.FromClause.Identifier);
- Assert.AreEqual("Customer", qe.FromClause.Type.ToString());
- Assert.AreEqual("customers", ((IdentifierExpression)qe.FromClause.InExpression).Identifier);
- Assert.IsInstanceOfType(typeof(QueryExpressionSelectClause), qe.SelectOrGroupClause);
- }
-
- [Test]
- public void ExpressionWithType2()
- {
- QueryExpression qe = ParseUtilCSharp.ParseExpression<QueryExpression>(
- "from int c in customers select c"
- );
- Assert.AreEqual("c", qe.FromClause.Identifier);
- Assert.AreEqual("System.Int32", qe.FromClause.Type.Type);
- Assert.AreEqual("customers", ((IdentifierExpression)qe.FromClause.InExpression).Identifier);
- Assert.IsInstanceOfType(typeof(QueryExpressionSelectClause), qe.SelectOrGroupClause);
- }
-
-
- [Test]
- public void ExpressionWithType3()
- {
- QueryExpression qe = ParseUtilCSharp.ParseExpression<QueryExpression>(
- "from S<int[]>? c in customers select c"
- );
- Assert.AreEqual("c", qe.FromClause.Identifier);
- Assert.AreEqual("System.Nullable<S<System.Int32[]>>", qe.FromClause.Type.ToString());
- Assert.AreEqual("customers", ((IdentifierExpression)qe.FromClause.InExpression).Identifier);
- Assert.IsInstanceOfType(typeof(QueryExpressionSelectClause), qe.SelectOrGroupClause);
- }
-
- [Test]
- public void MultipleGenerators()
- {
- QueryExpression qe = ParseUtilCSharp.ParseExpression<QueryExpression>(@"
-from c in customers
-where c.City == ""London""
-from o in c.Orders
-where o.OrderDate.Year == 2005
-select new { c.Name, o.OrderID, o.Total }");
- Assert.AreEqual(3, qe.MiddleClauses.Count);
- Assert.IsInstanceOfType(typeof(QueryExpressionWhereClause), qe.MiddleClauses[0]);
- Assert.IsInstanceOfType(typeof(QueryExpressionFromClause), qe.MiddleClauses[1]);
- Assert.IsInstanceOfType(typeof(QueryExpressionWhereClause), qe.MiddleClauses[2]);
-
- Assert.IsInstanceOfType(typeof(QueryExpressionSelectClause), qe.SelectOrGroupClause);
- }
-
- [Test]
- public void ExpressionWithOrderBy()
- {
- QueryExpression qe = ParseUtilCSharp.ParseExpression<QueryExpression>(
- "from c in customers orderby c.Name select c"
- );
- Assert.AreEqual("c", qe.FromClause.Identifier);
- Assert.AreEqual("customers", ((IdentifierExpression)qe.FromClause.InExpression).Identifier);
- Assert.IsInstanceOfType(typeof(QueryExpressionOrderClause), qe.MiddleClauses[0]);
- Assert.IsInstanceOfType(typeof(QueryExpressionSelectClause), qe.SelectOrGroupClause);
- }
-
- [Test]
- public void ExpressionWithOrderByAndLet()
- {
- QueryExpression qe = ParseUtilCSharp.ParseExpression<QueryExpression>(
- "from c in customers orderby c.Name let x = c select x"
- );
- Assert.AreEqual("c", qe.FromClause.Identifier);
- Assert.AreEqual("customers", ((IdentifierExpression)qe.FromClause.InExpression).Identifier);
- Assert.IsInstanceOfType(typeof(QueryExpressionOrderClause), qe.MiddleClauses[0]);
- Assert.IsInstanceOfType(typeof(QueryExpressionLetClause), qe.MiddleClauses[1]);
- Assert.IsInstanceOfType(typeof(QueryExpressionSelectClause), qe.SelectOrGroupClause);
- }
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Expressions/SizeOfExpressionTests.cs b/main/contrib/NRefactory/Test/Parser/Expressions/SizeOfExpressionTests.cs
deleted file mode 100644
index 44aaf5d2d8..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Expressions/SizeOfExpressionTests.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class SizeOfExpressionTests
- {
- #region C#
- [Test]
- public void CSharpSizeOfExpressionTest()
- {
- SizeOfExpression soe = ParseUtilCSharp.ParseExpression<SizeOfExpression>("sizeof(MyType)");
- Assert.AreEqual("MyType", soe.TypeReference.Type);
- }
- #endregion
-
- #region VB.NET
- // No VB.NET representation
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Expressions/StackAllocExpressionTests.cs b/main/contrib/NRefactory/Test/Parser/Expressions/StackAllocExpressionTests.cs
deleted file mode 100644
index 5bbf980fe9..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Expressions/StackAllocExpressionTests.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class StackAllocExpressionTests
- {
- #region C#
- [Test]
- public void CSharpStackAllocExpressionTest()
- {
- string program = "class A { unsafe void A() { int* fib = stackalloc int[100]; } }";
- IParser parser = ParserFactory.CreateParser(SupportedLanguage.CSharp, new StringReader(program));
- parser.Parse();
- Assert.AreEqual("", parser.Errors.ErrorOutput);
-
-// Assert.IsTrue(expr is StackAllocExpression);
-// StackAllocExpression sae = (StackAllocExpression)expr;
-//
-// Assert.AreEqual("int", sae.TypeReference.Type);
-// Assert.IsTrue(sae.Expression is PrimitiveExpression);
- }
- #endregion
-
- #region VB.NET
- // No VB.NET representation
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Expressions/ThisReferenceExpressionTests.cs b/main/contrib/NRefactory/Test/Parser/Expressions/ThisReferenceExpressionTests.cs
deleted file mode 100644
index 6ad653223c..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Expressions/ThisReferenceExpressionTests.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class ThisReferenceExpressionTests
- {
- #region C#
- [Test]
- public void CSharpThisReferenceExpressionTest1()
- {
- ThisReferenceExpression tre = ParseUtilCSharp.ParseExpression<ThisReferenceExpression>("this");
- }
- #endregion
-
- #region VB.NET
- [Test]
- public void VBNetThisReferenceExpressionTest1()
- {
- ThisReferenceExpression ie = ParseUtilVBNet.ParseExpression<ThisReferenceExpression>("Me");
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Expressions/TypeOfExpressionTests.cs b/main/contrib/NRefactory/Test/Parser/Expressions/TypeOfExpressionTests.cs
deleted file mode 100644
index 81d05e8f29..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Expressions/TypeOfExpressionTests.cs
+++ /dev/null
@@ -1,170 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 3660 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class TypeOfExpressionTests
- {
- #region C#
- [Test]
- public void CSharpSimpleTypeOfExpressionTest()
- {
- TypeOfExpression toe = ParseUtilCSharp.ParseExpression<TypeOfExpression>("typeof(MyNamespace.N1.MyType)");
- Assert.AreEqual("MyNamespace.N1.MyType", toe.TypeReference.Type);
- }
-
- [Test]
- public void CSharpGlobalTypeOfExpressionTest()
- {
- TypeOfExpression toe = ParseUtilCSharp.ParseExpression<TypeOfExpression>("typeof(global::System.Console)");
- Assert.AreEqual("System.Console", toe.TypeReference.Type);
- }
-
- [Test]
- public void CSharpPrimitiveTypeOfExpressionTest()
- {
- TypeOfExpression toe = ParseUtilCSharp.ParseExpression<TypeOfExpression>("typeof(int)");
- Assert.AreEqual("System.Int32", toe.TypeReference.Type);
- }
-
- [Test]
- public void CSharpVoidTypeOfExpressionTest()
- {
- TypeOfExpression toe = ParseUtilCSharp.ParseExpression<TypeOfExpression>("typeof(void)");
- Assert.AreEqual("System.Void", toe.TypeReference.Type);
- }
-
- [Test]
- public void CSharpArrayTypeOfExpressionTest()
- {
- TypeOfExpression toe = ParseUtilCSharp.ParseExpression<TypeOfExpression>("typeof(MyType[])");
- Assert.AreEqual("MyType", toe.TypeReference.Type);
- Assert.AreEqual(new int[] {0}, toe.TypeReference.RankSpecifier);
- }
-
- [Test]
- public void CSharpGenericTypeOfExpressionTest()
- {
- TypeOfExpression toe = ParseUtilCSharp.ParseExpression<TypeOfExpression>("typeof(MyNamespace.N1.MyType<string>)");
- Assert.AreEqual("MyNamespace.N1.MyType", toe.TypeReference.Type);
- Assert.AreEqual("System.String", toe.TypeReference.GenericTypes[0].Type);
- }
-
- [Test]
- public void CSharpNestedGenericTypeOfExpressionTest()
- {
- TypeOfExpression toe = ParseUtilCSharp.ParseExpression<TypeOfExpression>("typeof(MyType<string>.InnerClass<int>.InnerInnerClass)");
- InnerClassTypeReference ic = (InnerClassTypeReference)toe.TypeReference;
- Assert.AreEqual("InnerInnerClass", ic.Type);
- Assert.AreEqual(0, ic.GenericTypes.Count);
- ic = (InnerClassTypeReference)ic.BaseType;
- Assert.AreEqual("InnerClass", ic.Type);
- Assert.AreEqual(1, ic.GenericTypes.Count);
- Assert.AreEqual("System.Int32", ic.GenericTypes[0].Type);
- Assert.AreEqual("MyType", ic.BaseType.Type);
- Assert.AreEqual(1, ic.BaseType.GenericTypes.Count);
- Assert.AreEqual("System.String", ic.BaseType.GenericTypes[0].Type);
- }
-
- [Test]
- public void CSharpNullableTypeOfExpressionTest()
- {
- TypeOfExpression toe = ParseUtilCSharp.ParseExpression<TypeOfExpression>("typeof(MyStruct?)");
- Assert.AreEqual("System.Nullable", toe.TypeReference.Type);
- Assert.AreEqual("MyStruct", toe.TypeReference.GenericTypes[0].Type);
- }
-
- [Test]
- public void CSharpUnboundTypeOfExpressionTest()
- {
- TypeOfExpression toe = ParseUtilCSharp.ParseExpression<TypeOfExpression>("typeof(MyType<,>)");
- Assert.AreEqual("MyType", toe.TypeReference.Type);
- Assert.IsTrue(toe.TypeReference.GenericTypes[0].IsNull);
- Assert.IsTrue(toe.TypeReference.GenericTypes[1].IsNull);
- }
- #endregion
-
- #region VB.NET
- [Test]
- public void VBSimpleTypeOfExpressionTest()
- {
- TypeOfExpression toe = ParseUtilVBNet.ParseExpression<TypeOfExpression>("GetType(MyNamespace.N1.MyType)");
- Assert.AreEqual("MyNamespace.N1.MyType", toe.TypeReference.Type);
- }
-
-
- [Test]
- public void VBGlobalTypeOfExpressionTest()
- {
- TypeOfExpression toe = ParseUtilVBNet.ParseExpression<TypeOfExpression>("GetType(Global.System.Console)");
- Assert.AreEqual("System.Console", toe.TypeReference.Type);
- }
-
- [Test]
- public void VBPrimitiveTypeOfExpressionTest()
- {
- TypeOfExpression toe = ParseUtilVBNet.ParseExpression<TypeOfExpression>("GetType(integer)");
- Assert.AreEqual("System.Int32", toe.TypeReference.Type);
- }
-
- [Test]
- public void VBVoidTypeOfExpressionTest()
- {
- TypeOfExpression toe = ParseUtilVBNet.ParseExpression<TypeOfExpression>("GetType(void)");
- Assert.AreEqual("void", toe.TypeReference.Type);
- }
-
- [Test]
- public void VBArrayTypeOfExpressionTest()
- {
- TypeOfExpression toe = ParseUtilVBNet.ParseExpression<TypeOfExpression>("GetType(MyType())");
- Assert.AreEqual("MyType", toe.TypeReference.Type);
- Assert.AreEqual(new int[] {0}, toe.TypeReference.RankSpecifier);
- }
-
- [Test]
- public void VBGenericTypeOfExpressionTest()
- {
- TypeOfExpression toe = ParseUtilVBNet.ParseExpression<TypeOfExpression>("GetType(MyNamespace.N1.MyType(Of string))");
- Assert.AreEqual("MyNamespace.N1.MyType", toe.TypeReference.Type);
- Assert.AreEqual("System.String", toe.TypeReference.GenericTypes[0].Type);
- }
-
- [Test]
- public void VBUnboundTypeOfExpressionTest()
- {
- TypeOfExpression toe = ParseUtilVBNet.ParseExpression<TypeOfExpression>("GetType(MyType(Of ,))");
- Assert.AreEqual("MyType", toe.TypeReference.Type);
- Assert.IsTrue(toe.TypeReference.GenericTypes[0].IsNull);
- Assert.IsTrue(toe.TypeReference.GenericTypes[1].IsNull);
- }
-
- [Test]
- public void VBNestedGenericTypeOfExpressionTest()
- {
- TypeOfExpression toe = ParseUtilVBNet.ParseExpression<TypeOfExpression>("GetType(MyType(Of string).InnerClass(of integer).InnerInnerClass)");
- InnerClassTypeReference ic = (InnerClassTypeReference)toe.TypeReference;
- Assert.AreEqual("InnerInnerClass", ic.Type);
- Assert.AreEqual(0, ic.GenericTypes.Count);
- ic = (InnerClassTypeReference)ic.BaseType;
- Assert.AreEqual("InnerClass", ic.Type);
- Assert.AreEqual(1, ic.GenericTypes.Count);
- Assert.AreEqual("System.Int32", ic.GenericTypes[0].Type);
- Assert.AreEqual("MyType", ic.BaseType.Type);
- Assert.AreEqual(1, ic.BaseType.GenericTypes.Count);
- Assert.AreEqual("System.String", ic.BaseType.GenericTypes[0].Type);
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Expressions/TypeOfIsExpressionTests.cs b/main/contrib/NRefactory/Test/Parser/Expressions/TypeOfIsExpressionTests.cs
deleted file mode 100644
index 67441f7a99..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Expressions/TypeOfIsExpressionTests.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 3660 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class TypeOfIsExpressionTests
- {
- #region C#
- [Test]
- public void GenericArrayIsExpression()
- {
- TypeOfIsExpression ce = ParseUtilCSharp.ParseExpression<TypeOfIsExpression>("o is List<string>[]");
- Assert.AreEqual("List", ce.TypeReference.Type);
- Assert.AreEqual("System.String", ce.TypeReference.GenericTypes[0].Type);
- Assert.AreEqual(new int[] { 0 }, ce.TypeReference.RankSpecifier);
- Assert.IsTrue(ce.Expression is IdentifierExpression);
- }
-
- [Test]
- public void NullableIsExpression()
- {
- TypeOfIsExpression ce = ParseUtilCSharp.ParseExpression<TypeOfIsExpression>("o is int?");
- Assert.AreEqual("System.Nullable", ce.TypeReference.Type);
- Assert.AreEqual("System.Int32", ce.TypeReference.GenericTypes[0].Type);
- Assert.IsTrue(ce.Expression is IdentifierExpression);
- }
-
- [Test]
- public void NullableIsExpressionInBinaryOperatorExpression()
- {
- BinaryOperatorExpression boe;
- boe = ParseUtilCSharp.ParseExpression<BinaryOperatorExpression>("o is int? == true");
- TypeOfIsExpression ce = (TypeOfIsExpression)boe.Left;
- Assert.AreEqual("System.Nullable", ce.TypeReference.Type);
- Assert.AreEqual("System.Int32", ce.TypeReference.GenericTypes[0].Type);
- Assert.IsTrue(ce.Expression is IdentifierExpression);
- }
- #endregion
-
- #region VB.NET
- [Test]
- public void VBNetSimpleTypeOfIsExpression()
- {
- TypeOfIsExpression ce = ParseUtilVBNet.ParseExpression<TypeOfIsExpression>("TypeOf o Is MyObject");
- Assert.AreEqual("MyObject", ce.TypeReference.Type);
- Assert.IsTrue(ce.Expression is IdentifierExpression);
- }
-
- [Test]
- public void VBNetGenericTypeOfIsExpression()
- {
- TypeOfIsExpression ce = ParseUtilVBNet.ParseExpression<TypeOfIsExpression>("TypeOf o Is List(of T)");
- Assert.AreEqual("List", ce.TypeReference.Type);
- Assert.AreEqual("T", ce.TypeReference.GenericTypes[0].Type);
- Assert.IsTrue(ce.Expression is IdentifierExpression);
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Expressions/TypeReferenceExpressionTests.cs b/main/contrib/NRefactory/Test/Parser/Expressions/TypeReferenceExpressionTests.cs
deleted file mode 100644
index 3cf8ac6b93..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Expressions/TypeReferenceExpressionTests.cs
+++ /dev/null
@@ -1,93 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 3715 $</version>
-// </file>
-
-/*
- * Created by SharpDevelop.
- * User: Omnibrain
- * Date: 13.09.2004
- * Time: 19:54
- *
- * To change this template use Tools | Options | Coding | Edit Standard Headers.
- */
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class TypeReferenceExpressionTests
- {
- #region C#
- [Test]
- public void GlobalTypeReferenceExpression()
- {
- TypeReferenceExpression tr = ParseUtilCSharp.ParseExpression<TypeReferenceExpression>("global::System");
- Assert.AreEqual("System", tr.TypeReference.Type);
- Assert.IsTrue(tr.TypeReference.IsGlobal);
- }
-
- [Test]
- public void GlobalTypeReferenceExpressionWithoutTypeName()
- {
- TypeReferenceExpression tr = ParseUtilCSharp.ParseExpression<TypeReferenceExpression>("global::", true);
- Assert.AreEqual("?", tr.TypeReference.Type);
- Assert.IsTrue(tr.TypeReference.IsGlobal);
- }
-
- [Test]
- public void IntReferenceExpression()
- {
- MemberReferenceExpression fre = ParseUtilCSharp.ParseExpression<MemberReferenceExpression>("int.MaxValue");
- Assert.AreEqual("MaxValue", fre.MemberName);
- Assert.AreEqual("System.Int32", ((TypeReferenceExpression)fre.TargetObject).TypeReference.Type);
- }
-
- [Test]
- public void StandaloneIntReferenceExpression()
- {
- TypeReferenceExpression tre = ParseUtilCSharp.ParseExpression<TypeReferenceExpression>("int");
- Assert.AreEqual("System.Int32", tre.TypeReference.Type);
- }
- #endregion
-
- #region VB.NET
- [Test]
- public void VBIntReferenceExpression()
- {
- MemberReferenceExpression fre = ParseUtilVBNet.ParseExpression<MemberReferenceExpression>("inTeGer.MaxValue");
- Assert.AreEqual("MaxValue", fre.MemberName);
- Assert.AreEqual("System.Int32", ((TypeReferenceExpression)fre.TargetObject).TypeReference.Type);
- }
-
- [Test]
- public void VBStandaloneIntReferenceExpression()
- {
- TypeReferenceExpression tre = ParseUtilVBNet.ParseExpression<TypeReferenceExpression>("inTeGer");
- Assert.AreEqual("System.Int32", tre.TypeReference.Type);
- }
-
- [Test]
- public void VBObjectReferenceExpression()
- {
- MemberReferenceExpression fre = ParseUtilVBNet.ParseExpression<MemberReferenceExpression>("Object.ReferenceEquals");
- Assert.AreEqual("ReferenceEquals", fre.MemberName);
- Assert.AreEqual("System.Object", ((TypeReferenceExpression)fre.TargetObject).TypeReference.Type);
- }
-
- [Test]
- public void VBStandaloneObjectReferenceExpression()
- {
- TypeReferenceExpression tre = ParseUtilVBNet.ParseExpression<TypeReferenceExpression>("obJect");
- Assert.AreEqual("System.Object", tre.TypeReference.Type);
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Expressions/UnaryOperatorExpressionTests.cs b/main/contrib/NRefactory/Test/Parser/Expressions/UnaryOperatorExpressionTests.cs
deleted file mode 100644
index a15cc28ea8..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Expressions/UnaryOperatorExpressionTests.cs
+++ /dev/null
@@ -1,148 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 3656 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class UnaryOperatorExpressionTests
- {
- #region C#
- void CSharpTestUnaryOperatorExpressionTest(string program, UnaryOperatorType op)
- {
- UnaryOperatorExpression uoe = ParseUtilCSharp.ParseExpression<UnaryOperatorExpression>(program);
- Assert.AreEqual(op, uoe.Op);
-
- Assert.IsTrue(uoe.Expression is IdentifierExpression);
- }
-
- [Test]
- public void CSharpNotTest()
- {
- CSharpTestUnaryOperatorExpressionTest("!a", UnaryOperatorType.Not);
- }
-
- [Test]
- public void CSharpBitNotTest()
- {
- CSharpTestUnaryOperatorExpressionTest("~a", UnaryOperatorType.BitNot);
- }
-
- [Test]
- public void CSharpMinusTest()
- {
- CSharpTestUnaryOperatorExpressionTest("-a", UnaryOperatorType.Minus);
- }
-
- [Test]
- public void CSharpPlusTest()
- {
- CSharpTestUnaryOperatorExpressionTest("+a", UnaryOperatorType.Plus);
- }
-
- [Test]
- public void CSharpIncrementTest()
- {
- CSharpTestUnaryOperatorExpressionTest("++a", UnaryOperatorType.Increment);
- }
-
- [Test]
- public void CSharpDecrementTest()
- {
- CSharpTestUnaryOperatorExpressionTest("--a", UnaryOperatorType.Decrement);
- }
-
- [Test]
- public void CSharpPostIncrementTest()
- {
- CSharpTestUnaryOperatorExpressionTest("a++", UnaryOperatorType.PostIncrement);
- }
-
- [Test]
- public void CSharpPostDecrementTest()
- {
- CSharpTestUnaryOperatorExpressionTest("a--", UnaryOperatorType.PostDecrement);
- }
-
- [Test]
- public void CSharpStarTest()
- {
- CSharpTestUnaryOperatorExpressionTest("*a", UnaryOperatorType.Dereference);
- }
-
- [Test]
- public void CSharpBitWiseAndTest()
- {
- CSharpTestUnaryOperatorExpressionTest("&a", UnaryOperatorType.AddressOf);
- }
-
- [Test]
- public void DereferenceAfterCast()
- {
- UnaryOperatorExpression uoe = ParseUtilCSharp.ParseExpression<UnaryOperatorExpression>("*((SomeType*) &w)");
- Assert.AreEqual(UnaryOperatorType.Dereference, uoe.Op);
- ParenthesizedExpression pe = (ParenthesizedExpression)uoe.Expression;
- CastExpression ce = (CastExpression)pe.Expression;
- Assert.AreEqual("SomeType", ce.CastTo.Type);
- Assert.AreEqual(1, ce.CastTo.PointerNestingLevel);
- UnaryOperatorExpression adrOf = (UnaryOperatorExpression)ce.Expression;
- Assert.AreEqual(UnaryOperatorType.AddressOf, adrOf.Op);
- }
- #endregion
-
- #region VB.NET
- void VBNetTestUnaryOperatorExpressionTest(string program, UnaryOperatorType op)
- {
- UnaryOperatorExpression uoe = ParseUtilVBNet.ParseExpression<UnaryOperatorExpression>(program);
- Assert.AreEqual(op, uoe.Op);
-
- Assert.IsTrue(uoe.Expression is IdentifierExpression);
- }
-
- [Test]
- public void VBNetNotTest()
- {
- VBNetTestUnaryOperatorExpressionTest("Not a", UnaryOperatorType.Not);
- }
-
- [Test]
- public void VBNetInEqualsNotTest()
- {
- BinaryOperatorExpression e = ParseUtilVBNet.ParseExpression<BinaryOperatorExpression>("b <> Not a");
- Assert.AreEqual(BinaryOperatorType.InEquality, e.Op);
- UnaryOperatorExpression ue = (UnaryOperatorExpression)e.Right;
- Assert.AreEqual(UnaryOperatorType.Not, ue.Op);
- }
-
- [Test]
- public void VBNetNotEqualTest()
- {
- UnaryOperatorExpression e = ParseUtilVBNet.ParseExpression<UnaryOperatorExpression>("Not a = b");
- Assert.AreEqual(UnaryOperatorType.Not, e.Op);
- BinaryOperatorExpression boe = (BinaryOperatorExpression)e.Expression;
- Assert.AreEqual(BinaryOperatorType.Equality, boe.Op);
- }
-
- [Test]
- public void VBNetPlusTest()
- {
- VBNetTestUnaryOperatorExpressionTest("+a", UnaryOperatorType.Plus);
- }
-
- [Test]
- public void VBNetMinusTest()
- {
- VBNetTestUnaryOperatorExpressionTest("-a", UnaryOperatorType.Minus);
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Expressions/UncheckedExpressionTests.cs b/main/contrib/NRefactory/Test/Parser/Expressions/UncheckedExpressionTests.cs
deleted file mode 100644
index 4218ec93bb..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Expressions/UncheckedExpressionTests.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class UncheckedExpressionTests
- {
- #region C#
- [Test]
- public void CSharpUncheckedExpressionTest()
- {
- UncheckedExpression ce = ParseUtilCSharp.ParseExpression<UncheckedExpression>("unchecked(a)");
- Assert.IsTrue(ce.Expression is IdentifierExpression);
- }
- #endregion
-
- #region VB.NET
- // No VB.NET representation
- #endregion
-
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/GlobalScope/AttributeSectionTests.cs b/main/contrib/NRefactory/Test/Parser/GlobalScope/AttributeSectionTests.cs
deleted file mode 100644
index 8afba53241..0000000000
--- a/main/contrib/NRefactory/Test/Parser/GlobalScope/AttributeSectionTests.cs
+++ /dev/null
@@ -1,119 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 3124 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Parser.VB;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class AttributeSectionTests
- {
- [Test]
- public void AttributeOnStructure()
- {
- string program = @"
-<StructLayout( LayoutKind.Explicit )> _
-Public Structure MyUnion
-
- <FieldOffset( 0 )> Public i As Integer
- < FieldOffset( 0 )> Public d As Double
-
-End Structure 'MyUnion
-";
- TypeDeclaration decl = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
- Assert.AreEqual("StructLayout", decl.Attributes[0].Attributes[0].Name);
- }
-
- [Test]
- public void AttributeOnModule()
- {
- string program = @"
-<HideModule> _
-Public Module MyExtra
-
- Public i As Integer
- Public d As Double
-
-End Module
-";
- TypeDeclaration decl = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
- Assert.AreEqual("HideModule", decl.Attributes[0].Attributes[0].Name);
- }
-
- [Test]
- public void GlobalAttributeVB()
- {
- string program = @"<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
-Public Class Form1
-
-End Class";
- TypeDeclaration decl = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
- Assert.AreEqual("Microsoft.VisualBasic.CompilerServices.DesignerGenerated", decl.Attributes[0].Attributes[0].Name);
- }
-
- [Test]
- public void GlobalAttributeCSharp()
- {
- string program = @"[global::Microsoft.VisualBasic.CompilerServices.DesignerGenerated()]
-[someprefix::DesignerGenerated()]
-public class Form1 {
-}";
- TypeDeclaration decl = ParseUtilCSharp.ParseGlobal<TypeDeclaration>(program);
- Assert.AreEqual("Microsoft.VisualBasic.CompilerServices.DesignerGenerated", decl.Attributes[0].Attributes[0].Name);
- Assert.AreEqual("someprefix.DesignerGenerated", decl.Attributes[1].Attributes[0].Name);
- }
-
- [Test]
- public void AssemblyAttributeCSharp()
- {
- string program = @"[assembly: System.Attribute()]";
- AttributeSection decl = ParseUtilCSharp.ParseGlobal<AttributeSection>(program);
- Assert.AreEqual(new Location(1, 1), decl.StartLocation);
- Assert.AreEqual("assembly", decl.AttributeTarget);
- }
-
- [Test]
- public void ModuleAttributeCSharp()
- {
- string program = @"[module: System.Attribute()]";
- AttributeSection decl = ParseUtilCSharp.ParseGlobal<AttributeSection>(program);
- Assert.AreEqual(new Location(1, 1), decl.StartLocation);
- Assert.AreEqual("module", decl.AttributeTarget);
- }
-
- [Test]
- public void TypeAttributeCSharp()
- {
- string program = @"[type: System.Attribute()] class Test {}";
- TypeDeclaration type = ParseUtilCSharp.ParseGlobal<TypeDeclaration>(program);
- AttributeSection decl = type.Attributes[0];
- Assert.AreEqual(new Location(1, 1), decl.StartLocation);
- Assert.AreEqual("type", decl.AttributeTarget);
- }
-
- [Test]
- public void AssemblyAttributeVBNet()
- {
- string program = @"<assembly: System.Attribute()>";
- AttributeSection decl = ParseUtilVBNet.ParseGlobal<AttributeSection>(program);
- Assert.AreEqual(new Location(1, 1), decl.StartLocation);
- Assert.AreEqual("assembly", decl.AttributeTarget);
- }
-
- [Test]
- public void ModuleAttributeTargetEscapedVB()
- {
- // check that this doesn't crash the parser:
- ParseUtilVBNet.ParseGlobal<AttributeSection>("<[Module]: SuppressMessageAttribute>", true);
- }
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/GlobalScope/DelegateDeclarationTests.cs b/main/contrib/NRefactory/Test/Parser/GlobalScope/DelegateDeclarationTests.cs
deleted file mode 100644
index b54b2bc7ff..0000000000
--- a/main/contrib/NRefactory/Test/Parser/GlobalScope/DelegateDeclarationTests.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 3660 $</version>
-// </file>
-
-using System;
-using ICSharpCode.NRefactory.Ast;
-using NUnit.Framework;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class DelegateDeclarationTests
- {
- void TestDelegateDeclaration(DelegateDeclaration dd)
- {
- Assert.AreEqual("System.Void", dd.ReturnType.Type);
- Assert.AreEqual("MyDelegate", dd.Name);
- }
-
- void TestParameters(DelegateDeclaration dd)
- {
- Assert.AreEqual(3, dd.Parameters.Count);
-
- Assert.AreEqual("a", ((ParameterDeclarationExpression)dd.Parameters[0]).ParameterName);
- Assert.AreEqual("System.Int32", ((ParameterDeclarationExpression)dd.Parameters[0]).TypeReference.Type);
-
- Assert.AreEqual("secondParam", ((ParameterDeclarationExpression)dd.Parameters[1]).ParameterName);
- Assert.AreEqual("System.Int32", ((ParameterDeclarationExpression)dd.Parameters[1]).TypeReference.Type);
-
- Assert.AreEqual("lastParam", ((ParameterDeclarationExpression)dd.Parameters[2]).ParameterName);
- Assert.AreEqual("MyObj", ((ParameterDeclarationExpression)dd.Parameters[2]).TypeReference.Type);
- }
-
- #region C#
- [Test]
- public void SimpleCSharpDelegateDeclarationTest()
- {
- string program = "public delegate void MyDelegate(int a, int secondParam, MyObj lastParam);\n";
- TestDelegateDeclaration(ParseUtilCSharp.ParseGlobal<DelegateDeclaration>(program));
- }
-
- [Test]
- public void CSharpDelegateWithoutNameDeclarationTest()
- {
- string program = "public delegate void(int a, int secondParam, MyObj lastParam);\n";
- DelegateDeclaration dd = ParseUtilCSharp.ParseGlobal<DelegateDeclaration>(program, true);
- Assert.AreEqual("System.Void", dd.ReturnType.Type);
- //Assert.AreEqual("?", dd.Name);
- TestParameters(dd);
- }
-
- [Test]
- public void CSharpGenericDelegateDeclarationTest()
- {
- string program = "public delegate T CreateObject<T>(int a, int secondParam, MyObj lastParam) where T : ICloneable;\n";
- DelegateDeclaration dd = ParseUtilCSharp.ParseGlobal<DelegateDeclaration>(program);
- Assert.AreEqual("CreateObject", dd.Name);
- Assert.AreEqual("T", dd.ReturnType.Type);
- TestParameters(dd);
- Assert.AreEqual(1, dd.Templates.Count);
- Assert.AreEqual("T", dd.Templates[0].Name);
- Assert.AreEqual(1, dd.Templates[0].Bases.Count);
- Assert.AreEqual("ICloneable", dd.Templates[0].Bases[0].Type);
- }
- #endregion
-
- #region VB.NET
- [Test]
- public void SimpleVBNetDelegateDeclarationTest()
- {
- string program = "Public Delegate Sub MyDelegate(ByVal a As Integer, ByVal secondParam As Integer, ByVal lastParam As MyObj)\n";
- TestDelegateDeclaration(ParseUtilVBNet.ParseGlobal<DelegateDeclaration>(program));
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/GlobalScope/NamespaceDeclarationTests.cs b/main/contrib/NRefactory/Test/Parser/GlobalScope/NamespaceDeclarationTests.cs
deleted file mode 100644
index 75871f7785..0000000000
--- a/main/contrib/NRefactory/Test/Parser/GlobalScope/NamespaceDeclarationTests.cs
+++ /dev/null
@@ -1,77 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using ICSharpCode.NRefactory.Ast;
-using NUnit.Framework;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class NamespaceDeclarationTests
- {
- #region C#
- [Test]
- public void CSharpSimpleNamespaceTest()
- {
- string program = "namespace TestNamespace {\n" +
- "}\n";
- NamespaceDeclaration ns = ParseUtilCSharp.ParseGlobal<NamespaceDeclaration>(program);
- Assert.AreEqual("TestNamespace", ns.Name);
- }
-
-
- [Test]
- public void CSharpJuggedNamespaceTest()
- {
- string program = "namespace N1 {//TestNamespace\n" +
- " namespace N2 {// Declares a namespace named N2 within N1.\n" +
- " }\n" +
- "}\n";
- NamespaceDeclaration ns = ParseUtilCSharp.ParseGlobal<NamespaceDeclaration>(program);
-
- Assert.AreEqual("N1", ns.Name);
-
- Assert.IsTrue(ns.Children[0] is NamespaceDeclaration);
-
- ns = (NamespaceDeclaration)ns.Children[0];
-
- Assert.AreEqual("N2", ns.Name);
- }
- #endregion
-
- #region VB.NET
- [Test]
- public void VBNetSimpleNamespaceTest()
- {
- string program = "Namespace TestNamespace" + Environment.NewLine +
- "End Namespace" +Environment.NewLine;
- NamespaceDeclaration ns = ParseUtilVBNet.ParseGlobal<NamespaceDeclaration>(program);
- Assert.AreEqual("TestNamespace", ns.Name);
- }
-
- [Test]
- public void VBNetJuggedNamespaceTest()
- {
- string program = "Namespace N1 'TestNamespace\n" +
- " Namespace N2 ' Declares a namespace named N2 within N1.\n" +
- " End Namespace\n" +
- "End Namespace\n";
-
- NamespaceDeclaration ns = ParseUtilVBNet.ParseGlobal<NamespaceDeclaration>(program);
-
- Assert.AreEqual("N1", ns.Name);
-
- Assert.IsTrue(ns.Children[0] is NamespaceDeclaration);
-
- ns = (NamespaceDeclaration)ns.Children[0];
-
- Assert.AreEqual("N2", ns.Name);
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/GlobalScope/OptionDeclarationTests.cs b/main/contrib/NRefactory/Test/Parser/GlobalScope/OptionDeclarationTests.cs
deleted file mode 100644
index 5a31486e82..0000000000
--- a/main/contrib/NRefactory/Test/Parser/GlobalScope/OptionDeclarationTests.cs
+++ /dev/null
@@ -1,91 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 3381 $</version>
-// </file>
-
-using System;
-using System.IO;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-using NUnit.Framework;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class OptionDeclarationTests
- {
- [Test]
- public void VBNetStrictOptionDeclarationTest()
- {
- string program = "Option Strict On\n";
- OptionDeclaration opDec = ParseUtilVBNet.ParseGlobal<OptionDeclaration>(program);
- Assert.AreEqual(OptionType.Strict, opDec.OptionType);
- Assert.IsTrue(opDec.OptionValue);
- }
-
- [Test]
- public void VBNetExplicitOptionDeclarationTest()
- {
- string program = "Option Explicit Off\n";
- OptionDeclaration opDec = ParseUtilVBNet.ParseGlobal<OptionDeclaration>(program);
- Assert.AreEqual(OptionType.Explicit, opDec.OptionType);
- Assert.IsFalse(opDec.OptionValue, "Off option value excepted!");
- }
-
- [Test]
- public void VBNetCompareBinaryOptionDeclarationTest()
- {
- string program = "Option Compare Binary\n";
- OptionDeclaration opDec = ParseUtilVBNet.ParseGlobal<OptionDeclaration>(program);
- Assert.AreEqual(OptionType.CompareBinary, opDec.OptionType);
- Assert.IsTrue(opDec.OptionValue);
- }
-
- [Test]
- public void VBNetCompareTextOptionDeclarationTest()
- {
- string program = "Option Compare Text\n";
- OptionDeclaration opDec = ParseUtilVBNet.ParseGlobal<OptionDeclaration>(program);
- Assert.AreEqual(OptionType.CompareText, opDec.OptionType);
- Assert.IsTrue(opDec.OptionValue);
- }
-
- [Test]
- public void VBNetInferOnOptionDeclarationTest()
- {
- string program = "Option Infer On\n";
- OptionDeclaration opDec = ParseUtilVBNet.ParseGlobal<OptionDeclaration>(program);
- Assert.AreEqual(OptionType.Infer, opDec.OptionType);
- Assert.IsTrue(opDec.OptionValue);
- }
-
- [Test]
- public void VBNetInferOffOptionDeclarationTest()
- {
- string program = "Option Infer\n";
- OptionDeclaration opDec = ParseUtilVBNet.ParseGlobal<OptionDeclaration>(program);
- Assert.AreEqual(OptionType.Infer, opDec.OptionType);
- Assert.IsTrue(opDec.OptionValue);
- }
-
- [Test]
- public void VBNetInferOptionDeclarationTest()
- {
- string program = "Option Infer\n";
- OptionDeclaration opDec = ParseUtilVBNet.ParseGlobal<OptionDeclaration>(program);
- Assert.AreEqual(OptionType.Infer, opDec.OptionType);
- Assert.IsTrue(opDec.OptionValue);
- }
-
- [Test]
- public void VBNetInvalidOptionDeclarationTest()
- {
- string program = "Option\n";
- IParser parser = ParserFactory.CreateParser(SupportedLanguage.VBNet, new StringReader(program));
- parser.Parse();
- Assert.IsFalse(parser.Errors.ErrorOutput.Length == 0, "Expected errors, but operation completed successfully");
- }
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/GlobalScope/TypeDeclarationTests.cs b/main/contrib/NRefactory/Test/Parser/GlobalScope/TypeDeclarationTests.cs
deleted file mode 100644
index e8e1e3e563..0000000000
--- a/main/contrib/NRefactory/Test/Parser/GlobalScope/TypeDeclarationTests.cs
+++ /dev/null
@@ -1,372 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 3735 $</version>
-// </file>
-
-using System;
-using ICSharpCode.NRefactory.Ast;
-using NUnit.Framework;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class TypeDeclarationTests
- {
- #region C#
- [Test]
- public void CSharpSimpleClassTypeDeclarationTest()
- {
- TypeDeclaration td = ParseUtilCSharp.ParseGlobal<TypeDeclaration>("class MyClass : My.Base.Class { }");
-
- Assert.AreEqual(ClassType.Class, td.Type);
- Assert.AreEqual("MyClass", td.Name);
- Assert.AreEqual("My.Base.Class", td.BaseTypes[0].Type);
- Assert.AreEqual(Modifiers.None, td.Modifier);
- }
-
- [Test]
- public void CSharpSimpleClassRegionTest()
- {
- const string program = "class MyClass\n{\n}\n";
- TypeDeclaration td = ParseUtilCSharp.ParseGlobal<TypeDeclaration>(program);
- Assert.AreEqual(1, td.StartLocation.Line, "StartLocation.Y");
- Assert.AreEqual(1, td.StartLocation.Column, "StartLocation.X");
- Assert.AreEqual(1, td.BodyStartLocation.Line, "BodyStartLocation.Y");
- Assert.AreEqual(14, td.BodyStartLocation.Column, "BodyStartLocation.X");
- Assert.AreEqual(3, td.EndLocation.Line, "EndLocation.Y");
- }
-
- [Test]
- public void CSharpSimplePartialClassTypeDeclarationTest()
- {
- TypeDeclaration td = ParseUtilCSharp.ParseGlobal<TypeDeclaration>("partial class MyClass { }");
- Assert.IsNotNull(td);
- Assert.AreEqual(ClassType.Class, td.Type);
- Assert.AreEqual("MyClass", td.Name);
- Assert.AreEqual(Modifiers.Partial, td.Modifier);
- }
-
- [Test]
- public void CSharpNestedClassesTest()
- {
- TypeDeclaration td = ParseUtilCSharp.ParseGlobal<TypeDeclaration>("class MyClass { partial class P1 {} public partial class P2 {} static class P3 {} internal static class P4 {} }");
- Assert.IsNotNull(td);
- Assert.AreEqual(ClassType.Class, td.Type);
- Assert.AreEqual("MyClass", td.Name);
- Assert.AreEqual(Modifiers.Partial, ((TypeDeclaration)td.Children[0]).Modifier);
- Assert.AreEqual(Modifiers.Partial | Modifiers.Public, ((TypeDeclaration)td.Children[1]).Modifier);
- Assert.AreEqual(Modifiers.Static, ((TypeDeclaration)td.Children[2]).Modifier);
- Assert.AreEqual(Modifiers.Static | Modifiers.Internal, ((TypeDeclaration)td.Children[3]).Modifier);
- }
-
- [Test]
- public void CSharpSimpleStaticClassTypeDeclarationTest()
- {
- TypeDeclaration td = ParseUtilCSharp.ParseGlobal<TypeDeclaration>("static class MyClass { }");
- Assert.IsNotNull(td);
- Assert.AreEqual(ClassType.Class, td.Type);
- Assert.AreEqual("MyClass", td.Name);
- Assert.AreEqual(Modifiers.Static, td.Modifier);
- }
-
- [Test]
- public void CSharpGenericClassTypeDeclarationTest()
- {
- TypeDeclaration td = ParseUtilCSharp.ParseGlobal<TypeDeclaration>("public class G<T> {}");
-
- Assert.AreEqual(ClassType.Class, td.Type);
- Assert.AreEqual("G", td.Name);
- Assert.AreEqual(Modifiers.Public, td.Modifier);
- Assert.AreEqual(0, td.BaseTypes.Count);
- Assert.AreEqual(1, td.Templates.Count);
- Assert.AreEqual("T", td.Templates[0].Name);
- }
-
-
- [Test]
- public void CSharpGenericClassWithWhere()
- {
- string declr = @"
-public class Test<T> where T : IMyInterface
-{
-}
-";
- TypeDeclaration td = ParseUtilCSharp.ParseGlobal<TypeDeclaration>(declr);
-
- Assert.AreEqual(ClassType.Class, td.Type);
- Assert.AreEqual("Test", td.Name);
-
- Assert.AreEqual(1, td.Templates.Count);
- Assert.AreEqual("T", td.Templates[0].Name);
- Assert.AreEqual("IMyInterface", td.Templates[0].Bases[0].Type);
- }
-
- [Test]
- public void CSharpComplexGenericClassTypeDeclarationTest()
- {
- string declr = @"
-public class Generic<T, S> : System.IComparable where S : G<T[]> where T : MyNamespace.IMyInterface
-{
-}
-";
- TypeDeclaration td = ParseUtilCSharp.ParseGlobal<TypeDeclaration>(declr);
-
- Assert.AreEqual(ClassType.Class, td.Type);
- Assert.AreEqual("Generic", td.Name);
- Assert.AreEqual(Modifiers.Public, td.Modifier);
- Assert.AreEqual(1, td.BaseTypes.Count);
- Assert.AreEqual("System.IComparable", td.BaseTypes[0].Type);
-
- Assert.AreEqual(2, td.Templates.Count);
- Assert.AreEqual("T", td.Templates[0].Name);
- Assert.AreEqual("MyNamespace.IMyInterface", td.Templates[0].Bases[0].Type);
-
- Assert.AreEqual("S", td.Templates[1].Name);
- Assert.AreEqual("G", td.Templates[1].Bases[0].Type);
- Assert.AreEqual(1, td.Templates[1].Bases[0].GenericTypes.Count);
- Assert.IsTrue(td.Templates[1].Bases[0].GenericTypes[0].IsArrayType);
- Assert.AreEqual("T", td.Templates[1].Bases[0].GenericTypes[0].Type);
- Assert.AreEqual(new int[] {0}, td.Templates[1].Bases[0].GenericTypes[0].RankSpecifier);
- }
-
- [Test]
- public void CSharpComplexClassTypeDeclarationTest()
- {
- string declr = @"
-[MyAttr()]
-public abstract class MyClass : MyBase, Interface1, My.Test.Interface2
-{
-}
-";
- TypeDeclaration td = ParseUtilCSharp.ParseGlobal<TypeDeclaration>(declr);
-
- Assert.AreEqual(ClassType.Class, td.Type);
- Assert.AreEqual("MyClass", td.Name);
- Assert.AreEqual(Modifiers.Public | Modifiers.Abstract, td.Modifier);
- Assert.AreEqual(1, td.Attributes.Count);
- Assert.AreEqual(3, td.BaseTypes.Count);
- Assert.AreEqual("MyBase", td.BaseTypes[0].Type);
- Assert.AreEqual("Interface1", td.BaseTypes[1].Type);
- Assert.AreEqual("My.Test.Interface2", td.BaseTypes[2].Type);
- }
-
- [Test]
- public void CSharpSimpleStructTypeDeclarationTest()
- {
- TypeDeclaration td = ParseUtilCSharp.ParseGlobal<TypeDeclaration>("struct MyStruct {}");
-
- Assert.AreEqual(ClassType.Struct, td.Type);
- Assert.AreEqual("MyStruct", td.Name);
- }
-
- [Test]
- public void CSharpSimpleInterfaceTypeDeclarationTest()
- {
- TypeDeclaration td = ParseUtilCSharp.ParseGlobal<TypeDeclaration>("interface MyInterface {}");
-
- Assert.AreEqual(ClassType.Interface, td.Type);
- Assert.AreEqual("MyInterface", td.Name);
- }
-
- [Test]
- public void CSharpSimpleEnumTypeDeclarationTest()
- {
- TypeDeclaration td = ParseUtilCSharp.ParseGlobal<TypeDeclaration>("enum MyEnum {}");
-
- Assert.AreEqual(ClassType.Enum, td.Type);
- Assert.AreEqual("MyEnum", td.Name);
- }
- #endregion
-
- #region VB.NET
- [Test]
- public void VBNetSimpleClassTypeDeclarationTest()
- {
- string program = "Class TestClass\n" +
- "End Class\n";
- TypeDeclaration td = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
-
- Assert.AreEqual("TestClass", td.Name);
- Assert.AreEqual(ClassType.Class, td.Type);
- Assert.AreEqual(1, td.StartLocation.Line, "start line");
- Assert.AreEqual(1, td.BodyStartLocation.Line, "bodystart line");
- Assert.AreEqual(16, td.BodyStartLocation.Column, "bodystart col");
- Assert.AreEqual(2, td.EndLocation.Line, "end line");
- }
-
- [Test]
- public void VBNetMissingBaseClassTest()
- {
- // SD2-1499: test that this invalid code doesn't crash
- TypeDeclaration td = ParseUtilVBNet.ParseGlobal<TypeDeclaration>("public class test inherits", true);
- Assert.AreEqual(0, td.BaseTypes.Count);
- }
-
- [Test]
- public void VBNetEnumWithBaseClassDeclarationTest()
- {
- string program = "Enum TestEnum As Byte\n" +
- "End Enum\n";
- TypeDeclaration td = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
-
- Assert.AreEqual("TestEnum", td.Name);
- Assert.AreEqual(ClassType.Enum, td.Type);
- Assert.AreEqual("System.Byte", td.BaseTypes[0].Type);
- Assert.AreEqual(0, td.Children.Count);
- }
-
- [Test]
- public void VBNetEnumOnSingleLine()
- {
- string program = "Enum TestEnum : A : B = 1 : C : End Enum";
- TypeDeclaration td = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
-
- Assert.AreEqual("TestEnum", td.Name);
- Assert.AreEqual(ClassType.Enum, td.Type);
- Assert.AreEqual(3, td.Children.Count);
- }
-
- [Test]
- public void VBNetEnumOnSingleLine2()
- {
- string program = "Enum TestEnum : A : : B = 1 :: C : End Enum";
- TypeDeclaration td = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
-
- Assert.AreEqual("TestEnum", td.Name);
- Assert.AreEqual(ClassType.Enum, td.Type);
- Assert.AreEqual(3, td.Children.Count);
- }
-
-
- [Test]
- public void VBNetEnumWithSystemBaseClassDeclarationTest()
- {
- string program = "Enum TestEnum As System.UInt16\n" +
- "End Enum\n";
- TypeDeclaration td = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
-
- Assert.AreEqual("TestEnum", td.Name);
- Assert.AreEqual(ClassType.Enum, td.Type);
- Assert.AreEqual("System.UInt16", td.BaseTypes[0].Type);
- Assert.AreEqual(0, td.Children.Count);
- }
-
- [Test]
- public void VBNetSimpleClassTypeDeclarationWithoutLastNewLineTest()
- {
- string program = "Class TestClass\n" +
- "End Class";
- TypeDeclaration td = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
-
- Assert.AreEqual("TestClass", td.Name);
- Assert.AreEqual(ClassType.Class, td.Type);
- Assert.AreEqual(1, td.StartLocation.Line, "start line");
- Assert.AreEqual(2, td.EndLocation.Line, "end line");
- }
-
- [Test]
- public void VBNetSimpleClassTypeDeclarationWithColon()
- {
- string program = "Class TestClass\n" +
- " : \n" +
- "End Class";
- TypeDeclaration td = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
-
- Assert.AreEqual("TestClass", td.Name);
- Assert.AreEqual(ClassType.Class, td.Type);
- }
-
- [Test]
- public void VBNetSimplePartialClassTypeDeclarationTest()
- {
- string program = "Partial Class TestClass\n" +
- "End Class\n";
- TypeDeclaration td = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
-
- Assert.AreEqual("TestClass", td.Name);
- Assert.AreEqual(ClassType.Class, td.Type);
- Assert.AreEqual(Modifiers.Partial, td.Modifier);
- }
-
- [Test]
- public void VBNetPartialPublicClass()
- {
- string program = "Partial Public Class TestClass\nEnd Class\n";
- TypeDeclaration td = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
-
- Assert.AreEqual("TestClass", td.Name);
- Assert.AreEqual(ClassType.Class, td.Type);
- Assert.AreEqual(Modifiers.Partial | Modifiers.Public, td.Modifier);
- }
-
- [Test]
- public void VBNetGenericClassTypeDeclarationTest()
- {
- string declr = @"
-Public Class Test(Of T)
-
-End Class
-";
- TypeDeclaration td = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(declr);
-
- Assert.AreEqual(ClassType.Class, td.Type);
- Assert.AreEqual("Test", td.Name);
- Assert.AreEqual(Modifiers.Public, td.Modifier);
- Assert.AreEqual(0, td.BaseTypes.Count);
- Assert.AreEqual(1, td.Templates.Count);
- Assert.AreEqual("T", td.Templates[0].Name);
- }
-
- [Test]
- public void VBNetGenericClassWithConstraint()
- {
- string declr = @"
-Public Class Test(Of T As IMyInterface)
-
-End Class
-";
- TypeDeclaration td = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(declr);
-
- Assert.AreEqual(ClassType.Class, td.Type);
- Assert.AreEqual("Test", td.Name);
-
- Assert.AreEqual(1, td.Templates.Count);
- Assert.AreEqual("T", td.Templates[0].Name);
- Assert.AreEqual("IMyInterface", td.Templates[0].Bases[0].Type);
- }
-
- [Test]
- public void VBNetComplexGenericClassTypeDeclarationTest()
- {
- string declr = @"
-Public Class Generic(Of T As MyNamespace.IMyInterface, S As {G(Of T()), IAnotherInterface})
- Implements System.IComparable
-
-End Class
-";
- TypeDeclaration td = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(declr);
-
- Assert.AreEqual(ClassType.Class, td.Type);
- Assert.AreEqual("Generic", td.Name);
- Assert.AreEqual(Modifiers.Public, td.Modifier);
- Assert.AreEqual(1, td.BaseTypes.Count);
- Assert.AreEqual("System.IComparable", td.BaseTypes[0].Type);
-
- Assert.AreEqual(2, td.Templates.Count);
- Assert.AreEqual("T", td.Templates[0].Name);
- Assert.AreEqual("MyNamespace.IMyInterface", td.Templates[0].Bases[0].Type);
-
- Assert.AreEqual("S", td.Templates[1].Name);
- Assert.AreEqual(2, td.Templates[1].Bases.Count);
- Assert.AreEqual("G", td.Templates[1].Bases[0].Type);
- Assert.AreEqual(1, td.Templates[1].Bases[0].GenericTypes.Count);
- Assert.IsTrue(td.Templates[1].Bases[0].GenericTypes[0].IsArrayType);
- Assert.AreEqual("T", td.Templates[1].Bases[0].GenericTypes[0].Type);
- Assert.AreEqual(new int[] {0}, td.Templates[1].Bases[0].GenericTypes[0].RankSpecifier);
- Assert.AreEqual("IAnotherInterface", td.Templates[1].Bases[1].Type);
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/GlobalScope/UsingDeclarationTests.cs b/main/contrib/NRefactory/Test/Parser/GlobalScope/UsingDeclarationTests.cs
deleted file mode 100644
index 5edf909e66..0000000000
--- a/main/contrib/NRefactory/Test/Parser/GlobalScope/UsingDeclarationTests.cs
+++ /dev/null
@@ -1,163 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 3660 $</version>
-// </file>
-
-using System;
-using System.IO;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-using NUnit.Framework;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class UsingDeclarationTests
- {
- void CheckTwoSimpleUsings(CompilationUnit u)
- {
- Assert.AreEqual(2, u.Children.Count);
- Assert.IsTrue(u.Children[0] is UsingDeclaration);
- UsingDeclaration ud = (UsingDeclaration)u.Children[0];
- Assert.AreEqual(1, ud.Usings.Count);
- Assert.IsTrue(!ud.Usings[0].IsAlias);
- Assert.AreEqual("System", ud.Usings[0].Name);
-
-
- Assert.IsTrue(u.Children[1] is UsingDeclaration);
- ud = (UsingDeclaration)u.Children[1];
- Assert.AreEqual(1, ud.Usings.Count);
- Assert.IsTrue(!ud.Usings[0].IsAlias);
- Assert.AreEqual("My.Name.Space", ud.Usings[0].Name);
- }
-
- void CheckAliases(CompilationUnit u)
- {
- Assert.AreEqual(3, u.Children.Count);
-
- Assert.IsTrue(u.Children[0] is UsingDeclaration);
- UsingDeclaration ud = (UsingDeclaration)u.Children[0];
- Assert.AreEqual(1, ud.Usings.Count);
- Assert.IsTrue(((Using)ud.Usings[0]).IsAlias);
- Assert.AreEqual("TESTME", ud.Usings[0].Name);
- Assert.AreEqual("System", ud.Usings[0].Alias.Type);
-
- Assert.IsTrue(u.Children[1] is UsingDeclaration);
- ud = (UsingDeclaration)u.Children[1];
- Assert.AreEqual(1, ud.Usings.Count);
- Assert.IsTrue(((Using)ud.Usings[0]).IsAlias);
- Assert.AreEqual("myAlias", ud.Usings[0].Name);
- Assert.AreEqual("My.Name.Space", ud.Usings[0].Alias.Type);
-
- Assert.IsTrue(u.Children[2] is UsingDeclaration);
- ud = (UsingDeclaration)u.Children[2];
- Assert.AreEqual(1, ud.Usings.Count);
- Assert.IsTrue(((Using)ud.Usings[0]).IsAlias);
- Assert.AreEqual("StringCollection", ud.Usings[0].Name);
- Assert.AreEqual("System.Collections.Generic.List", ud.Usings[0].Alias.Type);
- Assert.AreEqual("System.String", ud.Usings[0].Alias.GenericTypes[0].Type);
- }
-
- #region C#
- [Test]
- public void CSharpWrongUsingTest()
- {
- string program = "using\n";
- IParser parser = ParserFactory.CreateParser(SupportedLanguage.CSharp, new StringReader(program));
- parser.Parse();
- Assert.IsTrue(parser.Errors.Count > 0);
- }
-
- [Test]
- public void CSharpDeclarationTest()
- {
- string program = "using System;\n" +
- "using My.Name.Space;\n";
- IParser parser = ParserFactory.CreateParser(SupportedLanguage.CSharp, new StringReader(program));
- parser.Parse();
-
- Assert.AreEqual("", parser.Errors.ErrorOutput);
- CheckTwoSimpleUsings(parser.CompilationUnit);
- }
-
- [Test]
- public void CSharpUsingAliasDeclarationTest()
- {
- string program = "using TESTME=System;\n" +
- "using myAlias=My.Name.Space;\n" +
- "using StringCollection = System.Collections.Generic.List<string>;\n";
- IParser parser = ParserFactory.CreateParser(SupportedLanguage.CSharp, new StringReader(program));
- parser.Parse();
-
- Assert.AreEqual("", parser.Errors.ErrorOutput);
- CheckAliases(parser.CompilationUnit);
- }
- #endregion
-
- #region VB.NET
- [Test]
- public void VBNetWrongUsingTest()
- {
- string program = "Imports\n";
- IParser parser = ParserFactory.CreateParser(SupportedLanguage.VBNet, new StringReader(program));
- parser.Parse();
- Assert.IsTrue(parser.Errors.Count > 0);
- UsingDeclaration u = (UsingDeclaration)parser.CompilationUnit.Children[0];
- foreach (Using us in u.Usings) {
- Assert.IsNotNull(us);
- }
- }
-
- [Test]
- public void VBNetWrongUsing2Test()
- {
- string program = "Imports ,\n";
- IParser parser = ParserFactory.CreateParser(SupportedLanguage.VBNet, new StringReader(program));
- parser.Parse();
- Assert.IsTrue(parser.Errors.Count > 0);
- UsingDeclaration u = (UsingDeclaration)parser.CompilationUnit.Children[0];
- foreach (Using us in u.Usings) {
- Assert.IsNotNull(us);
- }
- }
-
- [Test]
- public void VBNetDeclarationTest()
- {
- string program = "Imports System\n" +
- "Imports My.Name.Space\n";
- IParser parser = ParserFactory.CreateParser(SupportedLanguage.VBNet, new StringReader(program));
- parser.Parse();
-
- Assert.AreEqual("", parser.Errors.ErrorOutput);
- CheckTwoSimpleUsings(parser.CompilationUnit);
- }
-
- [Test]
- public void VBNetUsingAliasDeclarationTest()
- {
- string program = "Imports TESTME=System\n" +
- "Imports myAlias=My.Name.Space\n" +
- "Imports StringCollection = System.Collections.Generic.List(Of string)\n";
- IParser parser = ParserFactory.CreateParser(SupportedLanguage.VBNet, new StringReader(program));
- parser.Parse();
-
- Assert.AreEqual("", parser.Errors.ErrorOutput);
- CheckAliases(parser.CompilationUnit);
- }
-
- [Test]
- public void VBNetComplexUsingAliasDeclarationTest()
- {
- string program = "Imports NS1, AL=NS2, NS3, AL2=NS4, NS5\n";
- IParser parser = ParserFactory.CreateParser(SupportedLanguage.VBNet, new StringReader(program));
- parser.Parse();
-
- Assert.AreEqual("", parser.Errors.ErrorOutput);
- // TODO : Extend test ...
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/ParseUtilCSharp.cs b/main/contrib/NRefactory/Test/Parser/ParseUtilCSharp.cs
deleted file mode 100644
index fed144fafb..0000000000
--- a/main/contrib/NRefactory/Test/Parser/ParseUtilCSharp.cs
+++ /dev/null
@@ -1,92 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 3351 $</version>
-// </file>
-
-using System;
-using System.IO;
-
-using NUnit.Framework;
-
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- public class ParseUtilCSharp
- {
- public static T ParseGlobal<T>(string program) where T : INode
- {
- return ParseGlobal<T>(program, false);
- }
-
- public static T ParseGlobal<T>(string program, bool expectError) where T : INode
- {
- return ParseGlobal<T>(program, expectError, false);
- }
-
- public static T ParseGlobal<T>(string program, bool expectError, bool skipMethodBodies) where T : INode
- {
- IParser parser = ParserFactory.CreateParser(SupportedLanguage.CSharp, new StringReader(program));
- parser.ParseMethodBodies = !skipMethodBodies;
- parser.Parse();
- Assert.IsNotNull(parser.Errors);
- if (expectError)
- Assert.IsTrue(parser.Errors.ErrorOutput.Length > 0, "There were errors expected, but parser finished without errors.");
- else
- Assert.AreEqual("", parser.Errors.ErrorOutput);
- Assert.IsNotNull(parser.CompilationUnit);
- Assert.IsNotNull(parser.CompilationUnit.Children);
- Assert.IsNotNull(parser.CompilationUnit.Children[0]);
- Assert.IsTrue(parser.CompilationUnit.Children.Count > 0);
- Type type = typeof(T);
- Assert.IsTrue(type.IsAssignableFrom(parser.CompilationUnit.Children[0].GetType()), String.Format("Parsed expression was {0} instead of {1} ({2})", parser.CompilationUnit.Children[0].GetType(), type, parser.CompilationUnit.Children[0]));
- parser.CompilationUnit.AcceptVisitor(new CheckParentVisitor(), null);
- return (T)parser.CompilationUnit.Children[0];
- }
-
- public static T ParseTypeMember<T>(string typeMember) where T : INode
- {
- return ParseTypeMember<T>(typeMember, false);
- }
-
- public static T ParseTypeMember<T>(string typeMember, bool expectError) where T : INode
- {
- TypeDeclaration td = ParseGlobal<TypeDeclaration>("class MyClass {" + typeMember + "}", expectError);
- Assert.IsTrue(td.Children.Count > 0);
- Type type = typeof(T);
- Assert.IsTrue(type.IsAssignableFrom(td.Children[0].GetType()), String.Format("Parsed expression was {0} instead of {1} ({2})", td.GetType(), type, td));
- return (T)td.Children[0];
- }
-
- public static T ParseStatement<T>(string statement) where T : INode
- {
- MethodDeclaration md = ParseTypeMember<MethodDeclaration>("void A() { " + statement + " }");
- Assert.IsTrue(md.Body.Children.Count > 0);
- Type type = typeof(T);
- Assert.IsTrue(type.IsAssignableFrom(md.Body.Children[0].GetType()), String.Format("Parsed expression was {0} instead of {1} ({2})", md.GetType(), type, md));
- return (T)md.Body.Children[0];
- }
-
- public static T ParseExpression<T>(string expr) where T : INode
- {
- return ParseExpression<T>(expr, false);
- }
-
- public static T ParseExpression<T>(string expr, bool expectErrors) where T : INode
- {
- // SEMICOLON HACK : without a trailing semicolon, parsing expressions does not work correctly
- IParser parser = ParserFactory.CreateParser(SupportedLanguage.CSharp, new StringReader(expr + ";"));
- object parsedExpression = parser.ParseExpression();
- if (expectErrors)
- Assert.IsTrue(parser.Errors.ErrorOutput.Length > 0, "There were errors expected, but parser finished without errors.");
- else
- Assert.AreEqual("", parser.Errors.ErrorOutput);
- Type type = typeof(T);
- Assert.IsTrue(type.IsAssignableFrom(parsedExpression.GetType()), String.Format("Parsed expression was {0} instead of {1} ({2})", parsedExpression.GetType(), type, parsedExpression));
- return (T)parsedExpression;
- }
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/ParseUtilVBNet.cs b/main/contrib/NRefactory/Test/Parser/ParseUtilVBNet.cs
deleted file mode 100644
index fa35cc27d0..0000000000
--- a/main/contrib/NRefactory/Test/Parser/ParseUtilVBNet.cs
+++ /dev/null
@@ -1,92 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 3361 $</version>
-// </file>
-
-using System;
-using System.IO;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-using NUnit.Framework;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- public class ParseUtilVBNet
- {
- public static T ParseGlobal<T>(string program) where T : INode
- {
- return ParseGlobal<T>(program, false);
- }
-
- public static T ParseGlobal<T>(string program, bool expectErrors) where T : INode
- {
- IParser parser = ParserFactory.CreateParser(SupportedLanguage.VBNet, new StringReader(program));
- parser.Parse();
-
- if (expectErrors)
- Assert.IsFalse(parser.Errors.ErrorOutput.Length == 0, "Expected errors, but operation completed successfully");
- else
- Assert.AreEqual("", parser.Errors.ErrorOutput);
-
- Assert.IsNotNull(parser.CompilationUnit);
- Assert.IsNotNull(parser.CompilationUnit.Children);
- Assert.IsNotNull(parser.CompilationUnit.Children[0]);
- Assert.AreEqual(1, parser.CompilationUnit.Children.Count);
-
- Type type = typeof(T);
- Assert.IsTrue(type.IsAssignableFrom(parser.CompilationUnit.Children[0].GetType()), String.Format("Parsed expression was {0} instead of {1} ({2})", parser.CompilationUnit.Children[0].GetType(), type, parser.CompilationUnit.Children[0]));
-
- parser.CompilationUnit.AcceptVisitor(new CheckParentVisitor(), null);
-
- return (T)parser.CompilationUnit.Children[0];
- }
-
- public static T ParseTypeMember<T>(string typeMember, bool expectErrors) where T : INode
- {
- TypeDeclaration td = ParseGlobal<TypeDeclaration>("Class TestClass\n " + typeMember + "\n End Class\n", expectErrors);
- Assert.AreEqual(1, td.Children.Count);
- Type type = typeof(T);
- Assert.IsTrue(type.IsAssignableFrom(td.Children[0].GetType()), String.Format("Parsed expression was {0} instead of {1} ({2})", td.GetType(), type, td));
- return (T)td.Children[0];
- }
-
- public static T ParseTypeMember<T>(string typeMember) where T : INode
- {
- return ParseTypeMember<T>(typeMember, false);
- }
-
- public static T ParseStatement<T>(string statement, bool expectErrors) where T : INode
- {
- MethodDeclaration md = ParseTypeMember<MethodDeclaration>("Sub A()\n " + statement + "\nEnd Sub\n", expectErrors);
- Assert.AreEqual(1, md.Body.Children.Count);
- Type type = typeof(T);
- Assert.IsTrue(type.IsAssignableFrom(md.Body.Children[0].GetType()), String.Format("Parsed expression was {0} instead of {1} ({2})", md.GetType(), type, md));
- return (T)md.Body.Children[0];
- }
-
- public static T ParseStatement<T>(string statement) where T : INode
- {
- return ParseStatement<T>(statement, false);
- }
-
- public static T ParseExpression<T>(string expr) where T : INode
- {
- return ParseExpression<T>(expr, false);
- }
-
- public static T ParseExpression<T>(string expr, bool expectErrors) where T : INode
- {
- IParser parser = ParserFactory.CreateParser(SupportedLanguage.VBNet, new StringReader(expr));
- object parsedExpression = parser.ParseExpression();
- if (expectErrors)
- Assert.IsFalse(parser.Errors.ErrorOutput.Length == 0, "Expected errors, but operation completed successfully");
- else
- Assert.AreEqual("", parser.Errors.ErrorOutput);
- Type type = typeof(T);
- Assert.IsTrue(type.IsAssignableFrom(parsedExpression.GetType()), String.Format("Parsed expression was {0} instead of {1} ({2})", parsedExpression.GetType(), type, parsedExpression));
- return (T)parsedExpression;
- }
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/SkipMethodBodiesTest.cs b/main/contrib/NRefactory/Test/Parser/SkipMethodBodiesTest.cs
deleted file mode 100644
index 7279fe6f92..0000000000
--- a/main/contrib/NRefactory/Test/Parser/SkipMethodBodiesTest.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using ICSharpCode.NRefactory.Ast;
-using NUnit.Framework;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class SkipMethodBodiesTest
- {
- [Test]
- public void EmptyMethods()
- {
- string txt = @"internal sealed class Lexer : AbstractLexer
- {
- public Lexer(TextReader reader) : base(reader)
- {
- }
-
- void Method()
- {
- }
- }";
- Check(ParseUtilCSharp.ParseGlobal<TypeDeclaration>(txt, false, true));
- }
-
- [Test]
- public void NonEmptyMethods()
- {
- string txt = @"internal sealed class Lexer : AbstractLexer
- {
- public Lexer(TextReader reader) : base(reader)
- {
- if (reader == null) {
- throw new ArgumentNullException(""reader"");
- }
- }
-
- void Method()
- {
- while(something) {
- if (anything)
- break;
- }
- }
- }";
- Check(ParseUtilCSharp.ParseGlobal<TypeDeclaration>(txt, false, true));
- }
-
- void Check(TypeDeclaration td)
- {
- Assert.AreEqual("Lexer", td.Name);
- Assert.AreEqual(2, td.Children.Count);
- Assert.AreEqual(0, ((ConstructorDeclaration)td.Children[0]).Body.Children.Count);
- Assert.AreEqual(0, ((MethodDeclaration)td.Children[1]).Body.Children.Count);
- }
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Statements/AddHandlerStatementTests.cs b/main/contrib/NRefactory/Test/Parser/Statements/AddHandlerStatementTests.cs
deleted file mode 100644
index 7c309fb347..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Statements/AddHandlerStatementTests.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class AddHandlerStatementTests
- {
- #region C#
- // No C# representation
- #endregion
-
- #region VB.NET
- [Test]
- public void VBNetAddHandlerTest()
- {
- AddHandlerStatement addHandlerStatement = ParseUtilVBNet.ParseStatement<AddHandlerStatement>("AddHandler Obj.Ev_Event, AddressOf EventHandler");
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Statements/BlockStatementTests.cs b/main/contrib/NRefactory/Test/Parser/Statements/BlockStatementTests.cs
deleted file mode 100644
index 940de00053..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Statements/BlockStatementTests.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 3717 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class BlockStatementTests
- {
- #region C#
- [Test]
- public void CSharpBlockStatementTest()
- {
- BlockStatement blockStmt = ParseUtilCSharp.ParseStatement<BlockStatement>("{}");
- }
-
- [Test]
- public void CSharpComplexBlockStatementPositionTest()
- {
- string code = @"{
- WebClient wc = new WebClient();
- wc.Test();
- wc.UploadStringCompleted += delegate {
- output.BeginInvoke((MethodInvoker)delegate {
- output.Text += newText;
- });
- };
-}";
- BlockStatement blockStmt = ParseUtilCSharp.ParseStatement<BlockStatement>(code);
- //Assert.AreEqual(1, blockStmt.StartLocation.Column); // does not work because ParseStatement inserts special code
- Assert.AreEqual(1, blockStmt.StartLocation.Line);
- Assert.AreEqual(2, blockStmt.EndLocation.Column);
- Assert.AreEqual(9, blockStmt.EndLocation.Line);
- }
-
- #endregion
-
- #region VB.NET
- // TODO
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Statements/BreakStatementTests.cs b/main/contrib/NRefactory/Test/Parser/Statements/BreakStatementTests.cs
deleted file mode 100644
index 108b8d7986..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Statements/BreakStatementTests.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class BreakStatementTests
- {
- #region C#
- [Test]
- public void CSharpBreakStatementTest()
- {
- BreakStatement breakStmt = ParseUtilCSharp.ParseStatement<BreakStatement>("break;");
- }
- #endregion
-
- #region VB.NET
- // No VB.NET representation
- #endregion
-
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Statements/CheckedStatementTests.cs b/main/contrib/NRefactory/Test/Parser/Statements/CheckedStatementTests.cs
deleted file mode 100644
index 4778f215bf..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Statements/CheckedStatementTests.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class CheckedStatementTests
- {
- #region C#
- [Test]
- public void CSharpCheckedStatementTest()
- {
- CheckedStatement checkedStatement = ParseUtilCSharp.ParseStatement<CheckedStatement>("checked { }");
- Assert.IsFalse(checkedStatement.Block.IsNull);
- }
- #endregion
-
- #region VB.NET
- // No VB.NET representation
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Statements/ContinueStatementTests.cs b/main/contrib/NRefactory/Test/Parser/Statements/ContinueStatementTests.cs
deleted file mode 100644
index 68b0b610f9..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Statements/ContinueStatementTests.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class ContinueStatementTests
- {
- #region C#
- [Test]
- public void CSharpContinueStatementTest()
- {
- ContinueStatement continueStmt = ParseUtilCSharp.ParseStatement<ContinueStatement>("continue;");
- }
- #endregion
-
- #region VB.NET
- // No VB.NET representation
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Statements/DoLoopStatementTests.cs b/main/contrib/NRefactory/Test/Parser/Statements/DoLoopStatementTests.cs
deleted file mode 100644
index 59ca2d7558..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Statements/DoLoopStatementTests.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class DoLoopStatementTests
- {
- #region C#
- [Test]
- public void CSharpWhileStatementTest()
- {
- DoLoopStatement doLoopStmt = ParseUtilCSharp.ParseStatement<DoLoopStatement>("while (true) { }");
- Assert.AreEqual(ConditionPosition.Start, doLoopStmt.ConditionPosition);
- Assert.AreEqual(ConditionType.While, doLoopStmt.ConditionType);
- Assert.IsTrue(doLoopStmt.Condition is PrimitiveExpression);
- Assert.IsTrue(doLoopStmt.EmbeddedStatement is BlockStatement);
- }
-
- [Test]
- public void CSharpDoWhileStatementTest()
- {
- DoLoopStatement doLoopStmt = ParseUtilCSharp.ParseStatement<DoLoopStatement>("do { } while (true);");
- Assert.AreEqual(ConditionPosition.End, doLoopStmt.ConditionPosition);
- Assert.AreEqual(ConditionType.While, doLoopStmt.ConditionType);
- Assert.IsTrue(doLoopStmt.Condition is PrimitiveExpression);
- Assert.IsTrue(doLoopStmt.EmbeddedStatement is BlockStatement);
- }
- #endregion
-
- #region VB.NET
- // TODO
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Statements/EmptyStatementTests.cs b/main/contrib/NRefactory/Test/Parser/Statements/EmptyStatementTests.cs
deleted file mode 100644
index 3ccdce421c..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Statements/EmptyStatementTests.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class EmptyStatementTests
- {
- #region C#
- [Test]
- public void CSharpEmptyStatementTest()
- {
- EmptyStatement emptyStmt = ParseUtilCSharp.ParseStatement<EmptyStatement>(";");
- }
- #endregion
-
- #region VB.NET
- // No VB.NET representation
- #endregion
-
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Statements/EndStatementTests.cs b/main/contrib/NRefactory/Test/Parser/Statements/EndStatementTests.cs
deleted file mode 100644
index 0216c44c16..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Statements/EndStatementTests.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class EndStatementTests
- {
- #region C#
- // No C# representation
- #endregion
-
- #region VB.NET
- [Test]
- public void VBNetEndStatementTest()
- {
- EndStatement endStatement = ParseUtilVBNet.ParseStatement<EndStatement>("End");
- }
-
- [Test]
- public void VBNetEndStatementInIfThenTest2()
- {
- IfElseStatement endStatement = ParseUtilVBNet.ParseStatement<IfElseStatement>("IF a THEN End");
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Statements/EraseStatementTests.cs b/main/contrib/NRefactory/Test/Parser/Statements/EraseStatementTests.cs
deleted file mode 100644
index 39b9a0dd69..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Statements/EraseStatementTests.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class EraseStatementTests
- {
- #region C#
- // No C# representation
- #endregion
-
- #region VB.NET
- [Test]
- public void VBNetEraseStatementTest()
- {
- EraseStatement eraseStatement = ParseUtilVBNet.ParseStatement<EraseStatement>("Erase a, b, c");
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Statements/ErrorStatementTests.cs b/main/contrib/NRefactory/Test/Parser/Statements/ErrorStatementTests.cs
deleted file mode 100644
index 59011c1377..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Statements/ErrorStatementTests.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class ErrorStatementTests
- {
- #region C#
- // No C# representation
- #endregion
-
- #region VB.NET
- [Test]
- public void VBNetErrorStatementTest()
- {
- ErrorStatement errorStatement = ParseUtilVBNet.ParseStatement<ErrorStatement>("Error a");
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Statements/ExpressionStatementTests.cs b/main/contrib/NRefactory/Test/Parser/Statements/ExpressionStatementTests.cs
deleted file mode 100644
index e30defbd36..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Statements/ExpressionStatementTests.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 2676 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class ExpressionStatementTests
- {
- #region C#
- [Test]
- public void CSharpStatementExpressionTest()
- {
- ExpressionStatement stmtExprStmt = ParseUtilCSharp.ParseStatement<ExpressionStatement>("my.Obj.PropCall;");
- Assert.IsTrue(stmtExprStmt.Expression is MemberReferenceExpression);
- }
- [Test]
- public void CSharpStatementExpressionTest1()
- {
- ExpressionStatement stmtExprStmt = ParseUtilCSharp.ParseStatement<ExpressionStatement>("yield.yield;");
- Assert.IsTrue(stmtExprStmt.Expression is MemberReferenceExpression);
- }
- #endregion
-
- #region VB.NET
- // TODO
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Statements/FixedStatementTests.cs b/main/contrib/NRefactory/Test/Parser/Statements/FixedStatementTests.cs
deleted file mode 100644
index 3918653b68..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Statements/FixedStatementTests.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class FixedStatementTests
- {
- #region C#
- [Test]
- public void CSharpFixedStatementTest()
- {
- FixedStatement fixedStmt = ParseUtilCSharp.ParseStatement<FixedStatement>("fixed (int* ptr = &myIntArr) { }");
- // TODO : Extend test.
- }
- #endregion
-
- #region VB.NET
- // No VB.NET representation
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Statements/ForNextStatementTests.cs b/main/contrib/NRefactory/Test/Parser/Statements/ForNextStatementTests.cs
deleted file mode 100644
index 6ca05c3460..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Statements/ForNextStatementTests.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 3473 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class ForNextStatementTests
- {
- #region C#
- // No C# representation
- #endregion
-
- #region VB.NET
- [Test]
- public void VBNetForNextStatementTest()
- {
- ForNextStatement forNextStatement = ParseUtilVBNet.ParseStatement<ForNextStatement>("For i=0 To 10 Step 2 : Next i");
- }
-
- [Test]
- public void VBNetForNextStatementWithComplexExpressionTest()
- {
- ForNextStatement forNextStatement = ParseUtilVBNet.ParseStatement<ForNextStatement>("For SomeMethod().Property = 0 To 10 : Next SomeMethod().Property");
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Statements/ForStatementTests.cs b/main/contrib/NRefactory/Test/Parser/Statements/ForStatementTests.cs
deleted file mode 100644
index bc2a233770..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Statements/ForStatementTests.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class ForStatementTests
- {
- #region C#
- [Test]
- public void CSharpEmptyForStatementTest()
- {
- ForStatement forStmt = ParseUtilCSharp.ParseStatement<ForStatement>("for (;;) ;");
- Assert.AreEqual(0, forStmt.Initializers.Count);
- Assert.AreEqual(0, forStmt.Iterator.Count);
- Assert.IsTrue(forStmt.Condition.IsNull);
- Assert.IsTrue(forStmt.EmbeddedStatement is EmptyStatement);
- }
-
- [Test]
- public void CSharpForStatementTest()
- {
- ForStatement forStmt = ParseUtilCSharp.ParseStatement<ForStatement>("for (int i = 5; i < 6; ++i) {} ");
- // TODO : Extend test.
- }
- #endregion
-
- #region VB.NET
- // No VB.NET representation (for ... next is different)
- #endregion
-
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Statements/ForeachStatementTests.cs b/main/contrib/NRefactory/Test/Parser/Statements/ForeachStatementTests.cs
deleted file mode 100644
index 2d9635d36c..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Statements/ForeachStatementTests.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class ForeachStatementTests
- {
- #region C#
- [Test]
- public void CSharpForeachStatementTest()
- {
- ForeachStatement foreachStmt = ParseUtilCSharp.ParseStatement<ForeachStatement>("foreach (int i in myColl) {} ");
- // TODO : Extend test.
- }
- #endregion
-
- #region VB.NET
- [Test]
- public void VBNetForeachStatementTest()
- {
- ForeachStatement foreachStmt = ParseUtilVBNet.ParseStatement<ForeachStatement>("For Each i As Integer In myColl : Next");
- // TODO : Extend test.
- }
- #endregion
-
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Statements/GotoCaseStatementTests.cs b/main/contrib/NRefactory/Test/Parser/Statements/GotoCaseStatementTests.cs
deleted file mode 100644
index 3d86bd644f..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Statements/GotoCaseStatementTests.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class GotoCaseStatementTests
- {
- #region C#
- [Test]
- public void CSharpGotoCaseDefaltStatementTest()
- {
- GotoCaseStatement gotoCaseStmt = ParseUtilCSharp.ParseStatement<GotoCaseStatement>("goto default;");
- Assert.IsTrue(gotoCaseStmt.IsDefaultCase);
- }
-
- [Test]
- public void CSharpGotoCaseStatementTest()
- {
- GotoCaseStatement gotoCaseStmt = ParseUtilCSharp.ParseStatement<GotoCaseStatement>("goto case 6;");
- Assert.IsFalse(gotoCaseStmt.IsDefaultCase);
- Assert.IsTrue(gotoCaseStmt.Expression is PrimitiveExpression);
- }
- #endregion
-
- #region VB.NET
- // No VB.NET representation
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Statements/GotoStatementTests.cs b/main/contrib/NRefactory/Test/Parser/Statements/GotoStatementTests.cs
deleted file mode 100644
index 679b074da4..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Statements/GotoStatementTests.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class GotoStatementTests
- {
- #region C#
- [Test]
- public void CSharpGotoStatementTest()
- {
- GotoStatement gotoStmt = ParseUtilCSharp.ParseStatement<GotoStatement>("goto myLabel;");
- Assert.AreEqual("myLabel", gotoStmt.Label);
- }
- #endregion
-
- #region VB.NET
- [Test]
- public void VBNetGotoStatementTest()
- {
- GotoStatement gotoStmt = ParseUtilVBNet.ParseStatement<GotoStatement>("GoTo myLabel");
- Assert.AreEqual("myLabel", gotoStmt.Label);
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Statements/IfElseStatementTests.cs b/main/contrib/NRefactory/Test/Parser/Statements/IfElseStatementTests.cs
deleted file mode 100644
index 8d31fe8590..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Statements/IfElseStatementTests.cs
+++ /dev/null
@@ -1,176 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 3717 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class IfElseStatementTests
- {
- #region C#
- [Test]
- public void CSharpSimpleIfStatementTest()
- {
- IfElseStatement ifElseStatement = ParseUtilCSharp.ParseStatement<IfElseStatement>("if (true) { }");
- Assert.IsFalse(ifElseStatement.Condition.IsNull);
- Assert.IsTrue(ifElseStatement.TrueStatement.Count == 1, "true count != 1:" + ifElseStatement.TrueStatement.Count);
- Assert.IsTrue(ifElseStatement.FalseStatement.Count == 0, "false count != 0:" + ifElseStatement.FalseStatement.Count);
-
- Assert.IsTrue(ifElseStatement.TrueStatement[0] is BlockStatement);
- }
-
- [Test]
- public void CSharpSimpleIfElseStatementTest()
- {
- IfElseStatement ifElseStatement = ParseUtilCSharp.ParseStatement<IfElseStatement>("if (true) { } else { }");
- Assert.IsFalse(ifElseStatement.Condition.IsNull);
- Assert.IsTrue(ifElseStatement.TrueStatement.Count == 1, "true count != 1:" + ifElseStatement.TrueStatement.Count);
- Assert.IsTrue(ifElseStatement.FalseStatement.Count == 1, "false count != 1:" + ifElseStatement.FalseStatement.Count);
-
- Assert.IsTrue(ifElseStatement.TrueStatement[0] is BlockStatement, "Statement was: " + ifElseStatement.TrueStatement[0]);
- Assert.IsTrue(ifElseStatement.FalseStatement[0] is BlockStatement, "Statement was: " + ifElseStatement.FalseStatement[0]);
- }
-
-
- [Test]
- public void CSharpIfElseIfStatementTest()
- {
- IfElseStatement ifElseStatement = ParseUtilCSharp.ParseStatement<IfElseStatement>("if (1) { } else if (2) { } else if (3) { } else { }");
- Assert.IsFalse(ifElseStatement.Condition.IsNull);
- Assert.IsTrue(ifElseStatement.ElseIfSections.Count == 2, "elseif section count != 2:" + ifElseStatement.ElseIfSections.Count);
- Assert.IsTrue(ifElseStatement.TrueStatement.Count == 1, "true count != 1:" + ifElseStatement.TrueStatement.Count);
- Assert.IsTrue(ifElseStatement.FalseStatement.Count == 1, "false count != 1:" + ifElseStatement.FalseStatement.Count);
-
- Assert.IsTrue(ifElseStatement.TrueStatement[0] is BlockStatement, "Statement was: " + ifElseStatement.TrueStatement[0]);
- Assert.IsTrue(ifElseStatement.FalseStatement[0] is BlockStatement, "Statement was: " + ifElseStatement.FalseStatement[0]);
- Assert.IsTrue(ifElseStatement.ElseIfSections[0].EmbeddedStatement is BlockStatement, "Statement was: " + ifElseStatement.ElseIfSections[0].EmbeddedStatement);
- Assert.IsTrue(ifElseStatement.ElseIfSections[1].EmbeddedStatement is BlockStatement, "Statement was: " + ifElseStatement.ElseIfSections[1].EmbeddedStatement);
- Assert.AreEqual(2, (ifElseStatement.ElseIfSections[0].Condition as PrimitiveExpression).Value);
- Assert.AreEqual(3, (ifElseStatement.ElseIfSections[1].Condition as PrimitiveExpression).Value);
- }
- #endregion
-
- #region VB.NET
- [Test]
- public void VBNetSimpleIfStatementTest()
- {
- IfElseStatement ifElseStatement = ParseUtilVBNet.ParseStatement<IfElseStatement>("If True THEN END");
- Assert.IsFalse(ifElseStatement.Condition.IsNull);
- Assert.IsTrue(ifElseStatement.TrueStatement.Count == 1, "true count != 1:" + ifElseStatement.TrueStatement.Count);
- Assert.IsTrue(ifElseStatement.FalseStatement.Count == 0, "false count != 0:" + ifElseStatement.FalseStatement.Count);
-
- Assert.IsTrue(ifElseStatement.TrueStatement[0] is EndStatement, "Statement was: " + ifElseStatement.TrueStatement[0]);
- }
- [Test]
- public void VBNetSimpleIfStatementTest2()
- {
- IfElseStatement ifElseStatement = ParseUtilVBNet.ParseStatement<IfElseStatement>("If True THEN\n END\n END IF");
- Assert.IsFalse(ifElseStatement.Condition.IsNull);
- Assert.IsTrue(ifElseStatement.TrueStatement.Count == 1, "true count != 1:" + ifElseStatement.TrueStatement.Count);
- Assert.IsTrue(ifElseStatement.FalseStatement.Count == 0, "false count != 0:" + ifElseStatement.FalseStatement.Count);
-
- Assert.IsTrue(ifElseStatement.TrueStatement[0] is BlockStatement, "Statement was: " + ifElseStatement.TrueStatement[0]);
- }
-
- // test for SD2-1201
- [Test]
- public void VBNetIfStatementLocationTest()
- {
- IfElseStatement ifElseStatement = ParseUtilVBNet.ParseStatement<IfElseStatement>("If True THEN\n" +
- "DoIt()\n" +
- "ElseIf False Then\n" +
- "DoIt()\n" +
- "End If");
- Assert.AreEqual(3, (ifElseStatement.StartLocation).Line);
- Assert.AreEqual(7, (ifElseStatement.EndLocation).Line);
- Assert.AreEqual(5, (ifElseStatement.ElseIfSections[0].StartLocation).Line);
- Assert.AreEqual(6, (ifElseStatement.ElseIfSections[0].EndLocation).Line);
- Assert.IsNotNull(ifElseStatement.ElseIfSections[0].Parent);
-
- }
-
- [Test]
- public void VBNetElseIfStatementTest()
- {
- IfElseStatement ifElseStatement = ParseUtilVBNet.ParseStatement<IfElseStatement>("If True THEN\n" +
- "END\n" +
- "ElseIf False Then\n" +
- "Stop\n" +
- "End If");
- Assert.IsFalse(ifElseStatement.Condition.IsNull);
- Assert.IsTrue(ifElseStatement.TrueStatement.Count == 1, "true count != 1:" + ifElseStatement.TrueStatement.Count);
- Assert.IsTrue(ifElseStatement.FalseStatement.Count == 0, "false count != 0:" + ifElseStatement.FalseStatement.Count);
- Assert.IsFalse((bool)(ifElseStatement.ElseIfSections[0].Condition as PrimitiveExpression).Value);
-
- Assert.IsTrue(ifElseStatement.TrueStatement[0] is BlockStatement, "Statement was: " + ifElseStatement.TrueStatement[0]);
- Assert.IsTrue(ifElseStatement.ElseIfSections[0].EmbeddedStatement.Children[0] is StopStatement, "Statement was: " + ifElseStatement.ElseIfSections[0].EmbeddedStatement.Children[0]);
- }
- [Test]
- public void VBNetElse_IfStatementTest()
- {
- IfElseStatement ifElseStatement = ParseUtilVBNet.ParseStatement<IfElseStatement>("If True THEN\n" +
- "END\n" +
- "Else If False Then\n" +
- "Stop\n" +
- "End If");
- Assert.IsFalse(ifElseStatement.Condition.IsNull);
- Assert.IsTrue(ifElseStatement.TrueStatement.Count == 1, "true count != 1:" + ifElseStatement.TrueStatement.Count);
- Assert.IsTrue(ifElseStatement.FalseStatement.Count == 0, "false count != 0:" + ifElseStatement.FalseStatement.Count);
- Assert.IsFalse((bool)(ifElseStatement.ElseIfSections[0].Condition as PrimitiveExpression).Value);
-
- Assert.IsTrue(ifElseStatement.TrueStatement[0] is BlockStatement, "Statement was: " + ifElseStatement.TrueStatement[0]);
- Assert.IsTrue(ifElseStatement.ElseIfSections[0].EmbeddedStatement.Children[0] is StopStatement, "Statement was: " + ifElseStatement.ElseIfSections[0].EmbeddedStatement.Children[0]);
- }
- [Test]
- public void VBNetMultiStatementIfStatementTest()
- {
- IfElseStatement ifElseStatement = ParseUtilVBNet.ParseStatement<IfElseStatement>("If True THEN Stop : b");
- Assert.IsFalse(ifElseStatement.Condition.IsNull);
- Assert.AreEqual(2, ifElseStatement.TrueStatement.Count, "true count");
- Assert.AreEqual(0, ifElseStatement.FalseStatement.Count, "false count");
-
- Assert.IsTrue(ifElseStatement.TrueStatement[0] is StopStatement);
- Assert.IsTrue(ifElseStatement.TrueStatement[1] is ExpressionStatement);
- }
- [Test]
- public void VBNetMultiStatementIfStatementWithEndStatementTest()
- {
- IfElseStatement ifElseStatement = ParseUtilVBNet.ParseStatement<IfElseStatement>("If True THEN Stop : End : b");
- Assert.IsFalse(ifElseStatement.Condition.IsNull);
- Assert.AreEqual(3, ifElseStatement.TrueStatement.Count, "true count");
- Assert.AreEqual(0, ifElseStatement.FalseStatement.Count, "false count");
-
- Assert.IsTrue(ifElseStatement.TrueStatement[0] is StopStatement);
- Assert.IsTrue(ifElseStatement.TrueStatement[1] is EndStatement);
- Assert.IsTrue(ifElseStatement.TrueStatement[2] is ExpressionStatement);
- }
-
- [Test]
- public void VBNetIfWithEmptyElseTest()
- {
- IfElseStatement ifElseStatement = ParseUtilVBNet.ParseStatement<IfElseStatement>("If True THEN a Else");
- Assert.IsFalse(ifElseStatement.Condition.IsNull);
- Assert.AreEqual(1, ifElseStatement.TrueStatement.Count, "true count");
- Assert.AreEqual(0, ifElseStatement.FalseStatement.Count, "false count");
- }
-
- [Test]
- public void VBNetIfWithMultipleColons()
- {
- IfElseStatement ifElseStatement = ParseUtilVBNet.ParseStatement<IfElseStatement>("If True THEN a : : b");
- Assert.IsFalse(ifElseStatement.Condition.IsNull);
- Assert.AreEqual(2, ifElseStatement.TrueStatement.Count, "true count");
- Assert.AreEqual(0, ifElseStatement.FalseStatement.Count, "false count");
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Statements/LabelStatementTests.cs b/main/contrib/NRefactory/Test/Parser/Statements/LabelStatementTests.cs
deleted file mode 100644
index 2b42a35306..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Statements/LabelStatementTests.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 3139 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class LabelStatementTests
- {
- #region C#
- [Test]
- public void CSharpLabelStatementTest()
- {
- LabelStatement labelStmt = ParseUtilCSharp.ParseStatement<LabelStatement>("myLabel: ; ");
- Assert.AreEqual("myLabel", labelStmt.Label);
- }
- [Test]
- public void CSharpLabel2StatementTest()
- {
- LabelStatement labelStmt = ParseUtilCSharp.ParseStatement<LabelStatement>("yield: ; ");
- Assert.AreEqual("yield", labelStmt.Label);
- }
- #endregion
-
- #region VB.NET
- [Test]
- public void VBNetLabelStatementTest()
- {
- MethodDeclaration method = ParseUtilVBNet.ParseTypeMember<MethodDeclaration>("Sub Test \n myLabel: Console.WriteLine() \n End Sub");
- Assert.AreEqual(2, method.Body.Children.Count);
- LabelStatement labelStmt = (LabelStatement)method.Body.Children[0];
- Assert.AreEqual("myLabel", labelStmt.Label);
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Statements/LocalVariableDeclarationTests.cs b/main/contrib/NRefactory/Test/Parser/Statements/LocalVariableDeclarationTests.cs
deleted file mode 100644
index 8b69206f81..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Statements/LocalVariableDeclarationTests.cs
+++ /dev/null
@@ -1,402 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 3663 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class LocalVariableDeclarationTests
- {
- #region C#
-
- [Test]
- public void CSharpLocalVariableDeclarationTest()
- {
- LocalVariableDeclaration lvd = ParseUtilCSharp.ParseStatement<LocalVariableDeclaration>("int a = 5;");
- Assert.AreEqual(1, lvd.Variables.Count);
- Assert.AreEqual("a", ((VariableDeclaration)lvd.Variables[0]).Name);
- TypeReference type = lvd.GetTypeForVariable(0);
- Assert.AreEqual("System.Int32", type.Type);
- Assert.AreEqual(5, ((PrimitiveExpression)lvd.Variables[0].Initializer).Value);
- }
-
- [Test]
- public void CSharpVoidPointerVariableDeclarationTest()
- {
- LocalVariableDeclaration lvd = ParseUtilCSharp.ParseStatement<LocalVariableDeclaration>("void *a;");
- Assert.AreEqual(1, lvd.Variables.Count);
- Assert.AreEqual("a", ((VariableDeclaration)lvd.Variables[0]).Name);
- TypeReference type = lvd.GetTypeForVariable(0);
- Assert.AreEqual("System.Void", type.Type);
- Assert.AreEqual(1, type.PointerNestingLevel);
- }
-
- [Test]
- public void CSharpComplexGenericLocalVariableDeclarationTest()
- {
- LocalVariableDeclaration lvd = ParseUtilCSharp.ParseStatement<LocalVariableDeclaration>("Generic<Namespace.Printable, G<Printable[]> > where = new Generic<Namespace.Printable, G<Printable[]>>();");
- Assert.AreEqual(1, lvd.Variables.Count);
- Assert.AreEqual("where", ((VariableDeclaration)lvd.Variables[0]).Name);
- TypeReference type = lvd.GetTypeForVariable(0);
- Assert.AreEqual("Generic", type.Type);
- Assert.AreEqual(2, type.GenericTypes.Count);
- Assert.AreEqual("Namespace.Printable", type.GenericTypes[0].Type);
- Assert.AreEqual(0, type.GenericTypes[0].GenericTypes.Count);
- Assert.AreEqual("G", type.GenericTypes[1].Type);
- Assert.AreEqual(1, type.GenericTypes[1].GenericTypes.Count);
- Assert.AreEqual("Printable", type.GenericTypes[1].GenericTypes[0].Type);
-
- // TODO: Check initializer
- }
-
- [Test]
- public void CSharpNestedGenericLocalVariableDeclarationTest()
- {
- LocalVariableDeclaration lvd = ParseUtilCSharp.ParseStatement<LocalVariableDeclaration>("MyType<string>.InnerClass<int>.InnerInnerClass a;");
- Assert.AreEqual(1, lvd.Variables.Count);
- InnerClassTypeReference ic = (InnerClassTypeReference)lvd.GetTypeForVariable(0);
- Assert.AreEqual("InnerInnerClass", ic.Type);
- Assert.AreEqual(0, ic.GenericTypes.Count);
- ic = (InnerClassTypeReference)ic.BaseType;
- Assert.AreEqual("InnerClass", ic.Type);
- Assert.AreEqual(1, ic.GenericTypes.Count);
- Assert.AreEqual("System.Int32", ic.GenericTypes[0].Type);
- Assert.AreEqual("MyType", ic.BaseType.Type);
- Assert.AreEqual(1, ic.BaseType.GenericTypes.Count);
- Assert.AreEqual("System.String", ic.BaseType.GenericTypes[0].Type);
- }
-
- [Test]
- public void CSharpGenericWithArrayLocalVariableDeclarationTest1()
- {
- LocalVariableDeclaration lvd = ParseUtilCSharp.ParseStatement<LocalVariableDeclaration>("G<int>[] a;");
- Assert.AreEqual(1, lvd.Variables.Count);
- TypeReference type = lvd.GetTypeForVariable(0);
- Assert.AreEqual("G", type.Type);
- Assert.AreEqual(1, type.GenericTypes.Count);
- Assert.AreEqual("System.Int32", type.GenericTypes[0].Type);
- Assert.AreEqual(0, type.GenericTypes[0].GenericTypes.Count);
- Assert.IsFalse(type.GenericTypes[0].IsArrayType);
- Assert.AreEqual(new int[] {0}, type.RankSpecifier);
- }
-
- [Test]
- public void CSharpGenericWithArrayLocalVariableDeclarationTest2()
- {
- LocalVariableDeclaration lvd = ParseUtilCSharp.ParseStatement<LocalVariableDeclaration>("G<int[]> a;");
- Assert.AreEqual(1, lvd.Variables.Count);
- TypeReference type = lvd.GetTypeForVariable(0);
- Assert.AreEqual("G", type.Type);
- Assert.AreEqual(1, type.GenericTypes.Count);
- Assert.AreEqual("System.Int32", type.GenericTypes[0].Type);
- Assert.AreEqual(0, type.GenericTypes[0].GenericTypes.Count);
- Assert.IsFalse(type.IsArrayType);
- Assert.AreEqual(new int[] {0}, type.GenericTypes[0].RankSpecifier);
- }
-
- [Test]
- public void CSharpGenericLocalVariableDeclarationTest2()
- {
- LocalVariableDeclaration lvd = ParseUtilCSharp.ParseStatement<LocalVariableDeclaration>("G<G<int> > a;");
- Assert.AreEqual(1, lvd.Variables.Count);
- TypeReference type = lvd.GetTypeForVariable(0);
- Assert.AreEqual("G", type.Type);
- Assert.AreEqual(1, type.GenericTypes.Count);
- Assert.AreEqual("G", type.GenericTypes[0].Type);
- Assert.AreEqual(1, type.GenericTypes[0].GenericTypes.Count);
- Assert.AreEqual("System.Int32", type.GenericTypes[0].GenericTypes[0].Type);
- }
-
- [Test]
- public void CSharpGenericLocalVariableDeclarationTest2WithoutSpace()
- {
- LocalVariableDeclaration lvd = ParseUtilCSharp.ParseStatement<LocalVariableDeclaration>("G<G<int>> a;");
- Assert.AreEqual(1, lvd.Variables.Count);
- TypeReference type = lvd.GetTypeForVariable(0);
- Assert.AreEqual("G", type.Type);
- Assert.AreEqual(1, type.GenericTypes.Count);
- Assert.AreEqual("G", type.GenericTypes[0].Type);
- Assert.AreEqual(1, type.GenericTypes[0].GenericTypes.Count);
- Assert.AreEqual("System.Int32", type.GenericTypes[0].GenericTypes[0].Type);
- }
-
- [Test]
- public void CSharpGenericLocalVariableDeclarationTest()
- {
- LocalVariableDeclaration lvd = ParseUtilCSharp.ParseStatement<LocalVariableDeclaration>("G<int> a;");
- Assert.AreEqual(1, lvd.Variables.Count);
- TypeReference type = lvd.GetTypeForVariable(0);
- Assert.AreEqual("G", type.Type);
- Assert.AreEqual(1, type.GenericTypes.Count);
- Assert.AreEqual("System.Int32", type.GenericTypes[0].Type);
- }
-
- [Test]
- public void CSharpSimpleLocalVariableDeclarationTest()
- {
- LocalVariableDeclaration lvd = ParseUtilCSharp.ParseStatement<LocalVariableDeclaration>("MyVar var = new MyVar();");
- Assert.AreEqual(1, lvd.Variables.Count);
- Assert.AreEqual("var", ((VariableDeclaration)lvd.Variables[0]).Name);
- TypeReference type = lvd.GetTypeForVariable(0);
- Assert.AreEqual("MyVar", type.Type);
- // TODO: Check initializer
- }
-
- [Test]
- public void CSharpSimpleLocalVariableDeclarationTest1()
- {
- LocalVariableDeclaration lvd = ParseUtilCSharp.ParseStatement<LocalVariableDeclaration>("yield yield = new yield();");
- Assert.AreEqual(1, lvd.Variables.Count);
- Assert.AreEqual("yield", ((VariableDeclaration)lvd.Variables[0]).Name);
- TypeReference type = lvd.GetTypeForVariable(0);
- Assert.AreEqual("yield", type.Type);
- // TODO: Check initializer
- }
-
- [Test]
- public void CSharpNullableLocalVariableDeclarationTest1()
- {
- LocalVariableDeclaration lvd = ParseUtilCSharp.ParseStatement<LocalVariableDeclaration>("int? a;");
- Assert.AreEqual(1, lvd.Variables.Count);
- Assert.AreEqual("a", ((VariableDeclaration)lvd.Variables[0]).Name);
- TypeReference type = lvd.GetTypeForVariable(0);
- Assert.AreEqual("System.Nullable", type.Type);
- Assert.AreEqual("System.Int32", type.GenericTypes[0].Type);
- }
-
- [Test]
- public void CSharpNullableLocalVariableDeclarationTest2()
- {
- LocalVariableDeclaration lvd = ParseUtilCSharp.ParseStatement<LocalVariableDeclaration>("DateTime? a;");
- Assert.AreEqual(1, lvd.Variables.Count);
- Assert.AreEqual("a", ((VariableDeclaration)lvd.Variables[0]).Name);
- TypeReference type = lvd.GetTypeForVariable(0);
- Assert.AreEqual("System.Nullable", type.Type);
- Assert.AreEqual("DateTime", type.GenericTypes[0].Type);
- }
-
- [Test]
- public void CSharpNullableLocalVariableDeclarationTest3()
- {
- LocalVariableDeclaration lvd = ParseUtilCSharp.ParseStatement<LocalVariableDeclaration>("DateTime?[] a;");
- Assert.AreEqual(1, lvd.Variables.Count);
- Assert.AreEqual("a", ((VariableDeclaration)lvd.Variables[0]).Name);
- TypeReference type = lvd.GetTypeForVariable(0);
- Assert.IsTrue(type.IsArrayType);
- Assert.AreEqual("System.Nullable", type.Type);
- Assert.AreEqual("DateTime", type.GenericTypes[0].Type);
- }
-
- [Test]
- public void CSharpNullableLocalVariableDeclarationTest4()
- {
- LocalVariableDeclaration lvd = ParseUtilCSharp.ParseStatement<LocalVariableDeclaration>("SomeStruct<int?>? a;");
- Assert.AreEqual(1, lvd.Variables.Count);
- Assert.AreEqual("a", ((VariableDeclaration)lvd.Variables[0]).Name);
- TypeReference type = lvd.GetTypeForVariable(0);
- Assert.AreEqual("System.Nullable", type.Type);
- Assert.AreEqual("SomeStruct", type.GenericTypes[0].Type);
- Assert.AreEqual("System.Nullable", type.GenericTypes[0].GenericTypes[0].Type);
- Assert.AreEqual("System.Int32", type.GenericTypes[0].GenericTypes[0].GenericTypes[0].Type);
- }
- #endregion
-
- #region VB.NET
- [Test]
- public void VBNetLocalVariableDeclarationTest()
- {
- LocalVariableDeclaration lvd = ParseUtilVBNet.ParseStatement<LocalVariableDeclaration>("Dim a As Integer = 5");
- Assert.AreEqual(1, lvd.Variables.Count);
- Assert.AreEqual("a", lvd.Variables[0].Name);
- TypeReference type = lvd.GetTypeForVariable(0);
- Assert.AreEqual("System.Int32", type.Type);
- Assert.AreEqual(5, ((PrimitiveExpression)lvd.Variables[0].Initializer).Value);
- }
-
- [Test]
- public void VBNetLocalVariableNamedOverrideDeclarationTest()
- {
- LocalVariableDeclaration lvd = ParseUtilVBNet.ParseStatement<LocalVariableDeclaration>("Dim override As Integer = 5");
- Assert.AreEqual(1, lvd.Variables.Count);
- Assert.AreEqual("override", lvd.Variables[0].Name);
- TypeReference type = lvd.GetTypeForVariable(0);
- Assert.AreEqual("System.Int32", type.Type);
- Assert.AreEqual(5, ((PrimitiveExpression)lvd.Variables[0].Initializer).Value);
- }
-
- [Test]
- public void VBNetLocalArrayDeclarationWithInitializationTest()
- {
- LocalVariableDeclaration lvd = ParseUtilVBNet.ParseStatement<LocalVariableDeclaration>("Dim a(10) As Integer");
- Assert.AreEqual(1, lvd.Variables.Count);
- Assert.AreEqual("a", lvd.Variables[0].Name);
- TypeReference type = lvd.GetTypeForVariable(0);
- Assert.AreEqual("System.Int32", type.Type);
- Assert.AreEqual(new int[] { 0 } , type.RankSpecifier);
- ArrayCreateExpression ace = (ArrayCreateExpression)lvd.Variables[0].Initializer;
- Assert.AreEqual(new int[] { 0 } , ace.CreateType.RankSpecifier);
- Assert.AreEqual(1, ace.Arguments.Count);
- Assert.AreEqual(10, ((PrimitiveExpression)ace.Arguments[0]).Value);
- }
-
- [Test]
- public void VBNetLocalArrayDeclarationWithInitializationAndLowerBoundTest()
- {
- // VB.NET allows only "0" as lower bound
- LocalVariableDeclaration lvd = ParseUtilVBNet.ParseStatement<LocalVariableDeclaration>("Dim a(0 To 10) As Integer");
- Assert.AreEqual(1, lvd.Variables.Count);
- Assert.AreEqual("a", lvd.Variables[0].Name);
- TypeReference type = lvd.GetTypeForVariable(0);
- Assert.AreEqual("System.Int32", type.Type);
- Assert.AreEqual(new int[] { 0 } , type.RankSpecifier);
- ArrayCreateExpression ace = (ArrayCreateExpression)lvd.Variables[0].Initializer;
- Assert.AreEqual(new int[] { 0 } , ace.CreateType.RankSpecifier);
- Assert.AreEqual(1, ace.Arguments.Count);
- Assert.AreEqual(10, ((PrimitiveExpression)ace.Arguments[0]).Value);
- }
-
- [Test]
- public void VBNetLocalArrayDeclarationTest()
- {
- LocalVariableDeclaration lvd = ParseUtilVBNet.ParseStatement<LocalVariableDeclaration>("Dim a() As Integer");
- Assert.AreEqual(1, lvd.Variables.Count);
- Assert.AreEqual("a", lvd.Variables[0].Name);
- TypeReference type = lvd.GetTypeForVariable(0);
- Assert.AreEqual("System.Int32", type.Type);
- Assert.AreEqual(new int[] { 0 } , type.RankSpecifier);
- }
-
- [Test]
- public void VBNetLocalJaggedArrayDeclarationTest()
- {
- LocalVariableDeclaration lvd = ParseUtilVBNet.ParseStatement<LocalVariableDeclaration>("Dim a(10)() As Integer");
- Assert.AreEqual(1, lvd.Variables.Count);
- Assert.AreEqual("a", lvd.Variables[0].Name);
- TypeReference type = lvd.GetTypeForVariable(0);
- Assert.AreEqual("System.Int32", type.Type);
- Assert.AreEqual(new int[] { 0, 0 } , type.RankSpecifier);
- ArrayCreateExpression ace = (ArrayCreateExpression)lvd.Variables[0].Initializer;
- Assert.AreEqual(new int[] {0, 0}, ace.CreateType.RankSpecifier);
- Assert.AreEqual(1, ace.Arguments.Count);
- Assert.AreEqual(10, ((PrimitiveExpression)ace.Arguments[0]).Value);
- }
-
- [Test]
- public void VBNetComplexGenericLocalVariableDeclarationTest()
- {
- LocalVariableDeclaration lvd = ParseUtilVBNet.ParseStatement<LocalVariableDeclaration>("Dim where As Generic(Of Printable, G(Of Printable()))");
- Assert.AreEqual(1, lvd.Variables.Count);
- Assert.AreEqual("where", lvd.Variables[0].Name);
- TypeReference type = lvd.GetTypeForVariable(0);
- Assert.AreEqual("Generic", type.Type);
- Assert.AreEqual(2, type.GenericTypes.Count);
- Assert.AreEqual("Printable", type.GenericTypes[0].Type);
- Assert.AreEqual(0, type.GenericTypes[0].GenericTypes.Count);
- Assert.AreEqual("G", type.GenericTypes[1].Type);
- Assert.AreEqual(1, type.GenericTypes[1].GenericTypes.Count);
- Assert.AreEqual("Printable", type.GenericTypes[1].GenericTypes[0].Type);
- }
-
- [Test]
- public void VBNetGenericWithArrayLocalVariableDeclarationTest1()
- {
- LocalVariableDeclaration lvd = ParseUtilVBNet.ParseStatement<LocalVariableDeclaration>("Dim a As G(Of Integer)()");
- Assert.AreEqual(1, lvd.Variables.Count);
- TypeReference type = lvd.GetTypeForVariable(0);
- Assert.AreEqual("G", type.Type);
- Assert.AreEqual(1, type.GenericTypes.Count);
- Assert.AreEqual("System.Int32", type.GenericTypes[0].Type);
- Assert.AreEqual(0, type.GenericTypes[0].GenericTypes.Count);
- Assert.IsFalse(type.GenericTypes[0].IsArrayType);
- Assert.AreEqual(new int[] { 0 }, type.RankSpecifier);
- }
-
- [Test]
- public void VBNetGenericWithArrayLocalVariableDeclarationTest2()
- {
- LocalVariableDeclaration lvd = ParseUtilVBNet.ParseStatement<LocalVariableDeclaration>("Dim a As G(Of Integer())");
- Assert.AreEqual(1, lvd.Variables.Count);
- TypeReference type = lvd.GetTypeForVariable(0);
- Assert.AreEqual("G", type.Type);
- Assert.AreEqual(1, type.GenericTypes.Count);
- Assert.AreEqual("System.Int32", type.GenericTypes[0].Type);
- Assert.AreEqual(0, type.GenericTypes[0].GenericTypes.Count);
- Assert.IsFalse(type.IsArrayType);
- Assert.AreEqual(1, type.GenericTypes[0].RankSpecifier.Length);
- Assert.AreEqual(0, type.GenericTypes[0].RankSpecifier[0]);
- }
-
- [Test]
- public void VBNetGenericLocalVariableDeclarationTest2()
- {
- LocalVariableDeclaration lvd = ParseUtilVBNet.ParseStatement<LocalVariableDeclaration>("Dim a As G(Of G(Of Integer))");
- Assert.AreEqual(1, lvd.Variables.Count);
- TypeReference type = lvd.GetTypeForVariable(0);
- Assert.AreEqual("G", type.Type);
- Assert.AreEqual(1, type.GenericTypes.Count);
- Assert.AreEqual("G", type.GenericTypes[0].Type);
- Assert.AreEqual(1, type.GenericTypes[0].GenericTypes.Count);
- Assert.AreEqual("System.Int32", type.GenericTypes[0].GenericTypes[0].Type);
- }
-
- [Test]
- public void VBNetGenericLocalVariableDeclarationTest()
- {
- LocalVariableDeclaration lvd = ParseUtilVBNet.ParseStatement<LocalVariableDeclaration>("Dim a As G(Of Integer)");
- Assert.AreEqual(1, lvd.Variables.Count);
- TypeReference type = lvd.GetTypeForVariable(0);
- Assert.AreEqual("G", type.Type);
- Assert.AreEqual(1, type.GenericTypes.Count);
- Assert.AreEqual("System.Int32", type.GenericTypes[0].Type);
- }
-
- [Test]
- public void VBNetGenericLocalVariableInitializationTest()
- {
- LocalVariableDeclaration lvd = ParseUtilVBNet.ParseStatement<LocalVariableDeclaration>("Dim a As New G(Of Integer)");
- Assert.AreEqual(1, lvd.Variables.Count);
- TypeReference type = lvd.GetTypeForVariable(0);
- Assert.AreEqual("G", type.Type);
- Assert.AreEqual(1, type.GenericTypes.Count);
- Assert.AreEqual("System.Int32", type.GenericTypes[0].Type);
- // TODO: Check initializer
- }
-
- [Test]
- public void VBNetNestedGenericLocalVariableDeclarationTest()
- {
- LocalVariableDeclaration lvd = ParseUtilVBNet.ParseStatement<LocalVariableDeclaration>("Dim a as MyType(of string).InnerClass(of integer).InnerInnerClass");
- Assert.AreEqual(1, lvd.Variables.Count);
- InnerClassTypeReference ic = (InnerClassTypeReference)lvd.GetTypeForVariable(0);
- Assert.AreEqual("InnerInnerClass", ic.Type);
- Assert.AreEqual(0, ic.GenericTypes.Count);
- ic = (InnerClassTypeReference)ic.BaseType;
- Assert.AreEqual("InnerClass", ic.Type);
- Assert.AreEqual(1, ic.GenericTypes.Count);
- Assert.AreEqual("System.Int32", ic.GenericTypes[0].Type);
- Assert.AreEqual("MyType", ic.BaseType.Type);
- Assert.AreEqual(1, ic.BaseType.GenericTypes.Count);
- Assert.AreEqual("System.String", ic.BaseType.GenericTypes[0].Type);
- }
-
- [Test]
- public void VBNetDimInSingleLineIf()
- {
- IfElseStatement ifes = ParseUtilVBNet.ParseStatement<IfElseStatement>("If a Then Dim b As String");
- LocalVariableDeclaration lvd = (LocalVariableDeclaration)ifes.TrueStatement[0];
- Assert.AreEqual(1, lvd.Variables.Count);
- TypeReference type = lvd.GetTypeForVariable(0);
- Assert.AreEqual("System.String", type.Type);
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Statements/LockStatementTests.cs b/main/contrib/NRefactory/Test/Parser/Statements/LockStatementTests.cs
deleted file mode 100644
index f067b68f96..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Statements/LockStatementTests.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class LockStatementTests
- {
- #region C#
- [Test]
- public void CSharpLockStatementTest()
- {
- LockStatement lockStmt = ParseUtilCSharp.ParseStatement<LockStatement>("lock (myObj) {}");
- // TODO : Extend test.
- }
- #endregion
-
- #region VB.NET
- // No VB.NET representation
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Statements/OnErrorStatementTest.cs b/main/contrib/NRefactory/Test/Parser/Statements/OnErrorStatementTest.cs
deleted file mode 100644
index fbec30b883..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Statements/OnErrorStatementTest.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class OnErrorStatementTest
- {
- #region C#
- // No C# representation
- #endregion
-
- #region VB.NET
- [Test]
- public void VBNetOnErrorStatementTest()
- {
- OnErrorStatement onErrorStatement = ParseUtilVBNet.ParseStatement<OnErrorStatement>("On Error Goto err");
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Statements/RaiseEventStatementTest.cs b/main/contrib/NRefactory/Test/Parser/Statements/RaiseEventStatementTest.cs
deleted file mode 100644
index 5e7e06336f..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Statements/RaiseEventStatementTest.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class RaiseEventStatementTest
- {
- #region C#
- // No C# representation
- #endregion
-
- #region VB.NET
- [Test]
- public void VBNetRaiseEventStatementTest()
- {
- RaiseEventStatement raiseEventStatement = ParseUtilVBNet.ParseStatement<RaiseEventStatement>("RaiseEvent MyEvent(a, 5, (6))");
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Statements/ReDimStatementTests.cs b/main/contrib/NRefactory/Test/Parser/Statements/ReDimStatementTests.cs
deleted file mode 100644
index 6ed55fe052..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Statements/ReDimStatementTests.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-// <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;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class ReDimStatementTests
- {
- [Test]
- public void VBNetReDimStatementTest()
- {
- ReDimStatement reDimStatement = ParseUtilVBNet.ParseStatement<ReDimStatement>("ReDim Preserve MyArray(15)");
- Assert.AreEqual(1, reDimStatement.ReDimClauses.Count);
- Assert.AreSame(reDimStatement, reDimStatement.ReDimClauses[0].Parent);
- }
-
- [Test]
- public void VBNetReDimStatementTest2()
- {
- ReDimStatement reDimStatement = ParseUtilVBNet.ParseStatement<ReDimStatement>("ReDim calCheckData(channelNum, lambdaNum).ShiftFromLastFullCalPixels(CalCheckPeak.HighWavelength)");
- }
-
- [Test]
- public void VBNetBigReDimStatementTest()
- {
- string program = @"
-Class X
- Sub x
- ReDim sU(m - 1, n - 1)
- ReDim sW(n - 1)
- ReDim sV(n - 1, n - 1)
- ReDim rv1(n - 1)
- ReDim sMt(iNrCols - 1, 0)
- ReDim Preserve sMt(iNrCols - 1, iRowNr)
- ReDim sM(iRowNr - 1, iNrCols - 1)
- If (IsNothing(ColLengths)) Then ReDim ColLengths(0)
- If (ColLengths.Length = (SubItem + 1)) Then ReDim Preserve ColLengths(SubItem + 1)
- ReDim sTransform(2, iTransformType - 1)
- ReDim Preserve _Items(_Count)
- ReDim Preserve _Items(nCapacity)
- ReDim Preserve _Items(0 To _Count)
- ReDim Preserve _Items(0 To nCapacity)
- ReDim sU(m - 1, n - 1)
- ReDim sW(n - 1)
- ReDim sV(n - 1, n - 1)
- ReDim rv1(n - 1)
- ReDim sMt(iNrCols - 1, 0)
- ReDim Preserve sMt(iNrCols - 1, iRowNr)
- ReDim sM(iRowNr - 1, iNrCols - 1)
- If (IsNothing(ColLengths)) Then ReDim ColLengths(0)
- If (ColLengths.Length = (SubItem + 1)) Then ReDim Preserve ColLengths(SubItem + 1)
- ReDim sTransform(2, iTransformType - 1)
- ReDim Preserve Samples(Samples.GetUpperBound(0) + 1)
- ReDim Samples(0)
- ReDim BaseCssContent(BaseCssContentRows - 1)
- ReDim mabtRxBuf(Bytes2Read - 1)
- ReDim Preserve primarykey(primarykey.Length)
- ReDim Preserve IntArray(10, 10, 15)
- ReDim X(10, 10)
- ReDim Preserve IntArray(0 To 10, 10, 0 To 20)
- ReDim Preserve IntArray(10, 10, 15)
- ReDim X(0 To 10, 0 To 10)
- ReDim GetMe().IntArray(0 To 10, 10, 0 To 20)
- ReDim GetMe(ExplicitParameter := 3).IntArray(0 To 10, 10, 0 To 20)
- ReDim SomeType(Of Integer).IntArray(0 To 10, 10, 0 To 20)
- End Sub
-End Class";
- TypeDeclaration typeDeclaration = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
- }
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Statements/RemoveHandlerStatement.cs b/main/contrib/NRefactory/Test/Parser/Statements/RemoveHandlerStatement.cs
deleted file mode 100644
index fba13f622a..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Statements/RemoveHandlerStatement.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class RemoveHandlerStatementTests
- {
- #region C#
- // No C# representation
- #endregion
-
- #region VB.NET
- [Test]
- public void VBNetRemoveHandlerTest()
- {
- RemoveHandlerStatement removeHandlerStatement = ParseUtilVBNet.ParseStatement<RemoveHandlerStatement>("RemoveHandler MyHandler, AddressOf MyMethod");
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Statements/ResumeStatement.cs b/main/contrib/NRefactory/Test/Parser/Statements/ResumeStatement.cs
deleted file mode 100644
index 87bed179d0..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Statements/ResumeStatement.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class ResumeStatementTests
- {
- #region C#
- // No C# representation
- #endregion
-
- #region VB.NET
- [Test]
- public void VBNetResumeStatementTest()
- {
- ResumeStatement resumeStatement = ParseUtilVBNet.ParseStatement<ResumeStatement>("Resume");
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Statements/ReturnStatementTests.cs b/main/contrib/NRefactory/Test/Parser/Statements/ReturnStatementTests.cs
deleted file mode 100644
index 62ec258d40..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Statements/ReturnStatementTests.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class ReturnStatementTests
- {
- #region C#
- [Test]
- public void CSharpEmptyReturnStatementTest()
- {
- ReturnStatement returnStatement = ParseUtilCSharp.ParseStatement<ReturnStatement>("return;");
- Assert.IsTrue(returnStatement.Expression.IsNull);
- }
-
- [Test]
- public void CSharpReturnStatementTest()
- {
- ReturnStatement returnStatement = ParseUtilCSharp.ParseStatement<ReturnStatement>("return 5;");
- Assert.IsFalse(returnStatement.Expression.IsNull);
- Assert.IsTrue(returnStatement.Expression is PrimitiveExpression);
- }
- [Test]
- public void CSharpReturnStatementTest1()
- {
- ReturnStatement returnStatement = ParseUtilCSharp.ParseStatement<ReturnStatement>("return yield;");
- Assert.IsFalse(returnStatement.Expression.IsNull);
- Assert.IsTrue(returnStatement.Expression is IdentifierExpression);
- }
- #endregion
-
- #region VB.NET
- [Test]
- public void VBNetEmptyReturnStatementTest()
- {
- ReturnStatement returnStatement = ParseUtilVBNet.ParseStatement<ReturnStatement>("Return");
- Assert.IsTrue(returnStatement.Expression.IsNull);
- }
-
- [Test]
- public void VBNetReturnStatementTest()
- {
- ReturnStatement returnStatement = ParseUtilVBNet.ParseStatement<ReturnStatement>("Return 5");
- Assert.IsFalse(returnStatement.Expression.IsNull);
- Assert.IsTrue(returnStatement.Expression is PrimitiveExpression);
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Statements/StopStatementTests.cs b/main/contrib/NRefactory/Test/Parser/Statements/StopStatementTests.cs
deleted file mode 100644
index fb772a9a31..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Statements/StopStatementTests.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class StopStatementTests
- {
- #region C#
- // No C# representation
- #endregion
-
- #region VB.NET
- [Test]
- public void VBNetStopStatementTest()
- {
- StopStatement stopStatement = ParseUtilVBNet.ParseStatement<StopStatement>("Stop");
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Statements/SwitchStatementTests.cs b/main/contrib/NRefactory/Test/Parser/Statements/SwitchStatementTests.cs
deleted file mode 100644
index 4b02319665..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Statements/SwitchStatementTests.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class SwitchStatementTests
- {
- #region C#
- [Test]
- public void CSharpSwitchStatementTest()
- {
- SwitchStatement switchStmt = ParseUtilCSharp.ParseStatement<SwitchStatement>("switch (a) { case 4: case 5: break; case 6: break; default: break; }");
- Assert.AreEqual("a", ((IdentifierExpression)switchStmt.SwitchExpression).Identifier);
- // TODO: Extend test
- }
- #endregion
-
- #region VB.NET
- [Test]
- public void VBSwitchStatementTest()
- {
- SwitchStatement switchStmt = ParseUtilVBNet.ParseStatement<SwitchStatement>("Select Case a\n Case 4, 5\n Case 6\n Case Else\n End Select");
- Assert.AreEqual("a", ((IdentifierExpression)switchStmt.SwitchExpression).Identifier);
- // TODO: Extend test
- }
-
- [Test]
- public void InvalidVBSwitchStatementTest()
- {
- SwitchStatement switchStmt = ParseUtilVBNet.ParseStatement<SwitchStatement>("Select Case a\n Case \n End Select", true);
- Assert.AreEqual("a", ((IdentifierExpression)switchStmt.SwitchExpression).Identifier);
- SwitchSection sec = switchStmt.SwitchSections[0];
- Assert.AreEqual(0, sec.SwitchLabels.Count);
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Statements/ThrowStatementTests.cs b/main/contrib/NRefactory/Test/Parser/Statements/ThrowStatementTests.cs
deleted file mode 100644
index d0fe96c553..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Statements/ThrowStatementTests.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class ThrowStatementTests
- {
- #region C#
- [Test]
- public void CSharpEmptyThrowStatementTest()
- {
- ThrowStatement throwStmt = ParseUtilCSharp.ParseStatement<ThrowStatement>("throw;");
- Assert.IsTrue(throwStmt.Expression.IsNull);
- }
-
- [Test]
- public void CSharpThrowStatementTest()
- {
- ThrowStatement throwStmt = ParseUtilCSharp.ParseStatement<ThrowStatement>("throw new Exception();");
- Assert.IsTrue(throwStmt.Expression is ObjectCreateExpression);
- }
- #endregion
-
- #region VB.NET
- // TODO
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Statements/TryCatchStatementTests.cs b/main/contrib/NRefactory/Test/Parser/Statements/TryCatchStatementTests.cs
deleted file mode 100644
index 9df43b5034..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Statements/TryCatchStatementTests.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class TryCatchStatementTests
- {
- #region C#
- [Test]
- public void CSharpSimpleTryCatchStatementTest()
- {
- TryCatchStatement tryCatchStatement = ParseUtilCSharp.ParseStatement<TryCatchStatement>("try { } catch { } ");
- // TODO : Extend test.
- }
-
- [Test]
- public void CSharpSimpleTryCatchStatementTest2()
- {
- TryCatchStatement tryCatchStatement = ParseUtilCSharp.ParseStatement<TryCatchStatement>("try { } catch (Exception e) { } ");
- // TODO : Extend test.
- }
-
- [Test]
- public void CSharpSimpleTryCatchFinallyStatementTest()
- {
- TryCatchStatement tryCatchStatement = ParseUtilCSharp.ParseStatement<TryCatchStatement>("try { } catch (Exception) { } finally { } ");
- // TODO : Extend test.
- }
- #endregion
-
- #region VB.NET
- // TODO
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Statements/UncheckedStatementTests.cs b/main/contrib/NRefactory/Test/Parser/Statements/UncheckedStatementTests.cs
deleted file mode 100644
index 38baedcb2e..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Statements/UncheckedStatementTests.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class UncheckedStatementTests
- {
- #region C#
- [Test]
- public void CSharpUncheckedStatementTest()
- {
- UncheckedStatement uncheckedStatement = ParseUtilCSharp.ParseStatement<UncheckedStatement>("unchecked { }");
- Assert.IsFalse(uncheckedStatement.Block.IsNull);
- }
- #endregion
-
- #region VB.NET
- // No VB.NET representation
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Statements/UnsafeStatementTests.cs b/main/contrib/NRefactory/Test/Parser/Statements/UnsafeStatementTests.cs
deleted file mode 100644
index ff50f3ea6d..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Statements/UnsafeStatementTests.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class UnsafeStatementTests
- {
- #region C#
- [Test]
- public void CSharpUnsafeStatementTest()
- {
- UnsafeStatement unsafeStatement = ParseUtilCSharp.ParseStatement<UnsafeStatement>("unsafe { }");
- Assert.IsFalse(unsafeStatement.Block.IsNull);
- }
- #endregion
-
- #region VB.NET
- // No VB.NET representation
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Statements/UsingStatementTests.cs b/main/contrib/NRefactory/Test/Parser/Statements/UsingStatementTests.cs
deleted file mode 100644
index 9faa8b6225..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Statements/UsingStatementTests.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class UsingStatementTests
- {
- #region C#
- [Test]
- public void CSharpUsingStatementTest()
- {
- UsingStatement usingStmt = ParseUtilCSharp.ParseStatement<UsingStatement>("using (MyVar var = new MyVar()) { } ");
- // TODO : Extend test.
- }
- #endregion
-
- #region VB.NET
- [Test]
- public void VBNetUsingStatementTest()
- {
- string usingText = @"
-Using nf As New System.Drawing.Font(""Arial"", 12.0F, FontStyle.Bold)
- c.Font = nf
- c.Text = ""This is 12-point Arial bold""
-End Using";
- UsingStatement usingStmt = ParseUtilVBNet.ParseStatement<UsingStatement>(usingText);
- // TODO : Extend test.
- }
- [Test]
- public void VBNetUsingStatementTest2()
- {
- string usingText = @"
-Using nf As Font = New Font()
- Bla(nf)
-End Using";
- UsingStatement usingStmt = ParseUtilVBNet.ParseStatement<UsingStatement>(usingText);
- // TODO : Extend test.
- }
- [Test]
- public void VBNetUsingStatementTest3()
- {
- string usingText = @"
-Using nf As New Font(), nf2 As New List(Of Font)(), nf3 = Nothing
- Bla(nf)
-End Using";
- UsingStatement usingStmt = ParseUtilVBNet.ParseStatement<UsingStatement>(usingText);
- // TODO : Extend test.
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Statements/WithStatementTests.cs b/main/contrib/NRefactory/Test/Parser/Statements/WithStatementTests.cs
deleted file mode 100644
index 7502145e03..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Statements/WithStatementTests.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class WithStatementTests
- {
- #region C#
- // No C# representation
- #endregion
-
- #region VB.NET
- [Test]
- public void VBNetWithStatementTest()
- {
- WithStatement withStatement = ParseUtilVBNet.ParseStatement<WithStatement>("With MyObj : End With");
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/Statements/YieldStatementTests.cs b/main/contrib/NRefactory/Test/Parser/Statements/YieldStatementTests.cs
deleted file mode 100644
index 517b289efd..0000000000
--- a/main/contrib/NRefactory/Test/Parser/Statements/YieldStatementTests.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
-// <version>$Revision: 1609 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class YieldStatementTests
- {
- [Test]
- public void YieldReturnStatementTest()
- {
- YieldStatement yieldStmt = ParseUtilCSharp.ParseStatement<YieldStatement>("yield return \"Foo\";");
- Assert.IsTrue(yieldStmt.IsYieldReturn);
- ReturnStatement retStmt = (ReturnStatement)yieldStmt.Statement;
- PrimitiveExpression expr = (PrimitiveExpression)retStmt.Expression;
- Assert.AreEqual("Foo", expr.Value);
- }
-
- [Test]
- public void YieldBreakStatementTest()
- {
- YieldStatement yieldStmt = ParseUtilCSharp.ParseStatement<YieldStatement>("yield break;");
- Assert.IsTrue(yieldStmt.IsYieldBreak);
- }
-
- [Test]
- public void YieldAsVariableTest()
- {
- ExpressionStatement se = ParseUtilCSharp.ParseStatement<ExpressionStatement>("yield = 3;");
- AssignmentExpression ae = se.Expression as AssignmentExpression;
-
- Assert.AreEqual(AssignmentOperatorType.Assign, ae.Op);
-
- Assert.IsTrue(ae.Left is IdentifierExpression);
- Assert.AreEqual("yield", ((IdentifierExpression)ae.Left).Identifier);
- Assert.IsTrue(ae.Right is PrimitiveExpression);
- }
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/TypeLevel/ConstructorDeclarationTests.cs b/main/contrib/NRefactory/Test/Parser/TypeLevel/ConstructorDeclarationTests.cs
deleted file mode 100644
index 3cea3f468c..0000000000
--- a/main/contrib/NRefactory/Test/Parser/TypeLevel/ConstructorDeclarationTests.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 3660 $</version>
-// </file>
-
-using System;
-using ICSharpCode.NRefactory.Ast;
-using NUnit.Framework;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class ConstructorDeclarationTests
- {
- #region C#
- [Test]
- public void CSharpConstructorDeclarationTest1()
- {
- ConstructorDeclaration cd = ParseUtilCSharp.ParseTypeMember<ConstructorDeclaration>("MyClass() {}");
- Assert.IsTrue(cd.ConstructorInitializer.IsNull);
- }
-
- [Test]
- public void CSharpConstructorDeclarationTest2()
- {
- ConstructorDeclaration cd = ParseUtilCSharp.ParseTypeMember<ConstructorDeclaration>("MyClass() : this(5) {}");
- Assert.AreEqual(ConstructorInitializerType.This, cd.ConstructorInitializer.ConstructorInitializerType);
- Assert.AreEqual(1, cd.ConstructorInitializer.Arguments.Count);
- }
-
- [Test]
- public void CSharpConstructorDeclarationTest3()
- {
- ConstructorDeclaration cd = ParseUtilCSharp.ParseTypeMember<ConstructorDeclaration>("MyClass() : base(1, 2, 3) {}");
- Assert.AreEqual(ConstructorInitializerType.Base, cd.ConstructorInitializer.ConstructorInitializerType);
- Assert.AreEqual(3, cd.ConstructorInitializer.Arguments.Count);
- }
-
- [Test]
- public void CSharpStaticConstructorDeclarationTest1()
- {
- ConstructorDeclaration cd = ParseUtilCSharp.ParseTypeMember<ConstructorDeclaration>("static MyClass() {}");
- Assert.IsTrue(cd.ConstructorInitializer.IsNull);
- Assert.AreEqual(Modifiers.Static, cd.Modifier);
- }
-
- [Test]
- public void CSharpExternStaticConstructorDeclarationTest()
- {
- ConstructorDeclaration cd = ParseUtilCSharp.ParseTypeMember<ConstructorDeclaration>("extern static MyClass();");
- Assert.IsTrue(cd.ConstructorInitializer.IsNull);
- Assert.AreEqual(Modifiers.Static | Modifiers.Extern, cd.Modifier);
- }
- #endregion
-
- #region VB.NET
- [Test]
- public void VBNetConstructorDeclarationTest1()
- {
- string program = @"Sub New()
- End Sub";
- ConstructorDeclaration cd = ParseUtilVBNet.ParseTypeMember<ConstructorDeclaration>(program);
- Assert.IsTrue(cd.ConstructorInitializer.IsNull);
- }
-
- [Test]
- public void VBNetConstructorDeclarationTest2()
- {
- ConstructorDeclaration cd = ParseUtilVBNet.ParseTypeMember<ConstructorDeclaration>("Sub New(x As Integer, Optional y As String) \nEnd Sub");
- Assert.AreEqual(2, cd.Parameters.Count);
- Assert.AreEqual("System.Int32", cd.Parameters[0].TypeReference.Type);
- Assert.AreEqual("System.String", cd.Parameters[1].TypeReference.Type);
- Assert.AreEqual(ParameterModifiers.Optional, cd.Parameters[1].ParamModifier & ParameterModifiers.Optional);
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/TypeLevel/CustomEventTests.cs b/main/contrib/NRefactory/Test/Parser/TypeLevel/CustomEventTests.cs
deleted file mode 100644
index cb1001b033..0000000000
--- a/main/contrib/NRefactory/Test/Parser/TypeLevel/CustomEventTests.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Markus Palme" email="MarkusPalme@gmx.de"/>
-// <version>$Revision: 1634 $</version>
-// </file>
-
-using System;
-using System.IO;
-using NUnit.Framework;
-using ICSharpCode.NRefactory.Parser;
-using ICSharpCode.NRefactory.Ast;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class CustomEventTests
- {
- #region C#
- // No C# representation
- #endregion
-
- #region VB.NET
- [Test]
- public void VBNetCustomEventsStatementTest()
- {
- string code = @" Public Custom Event TestEvent As EventHandler
- AddHandler(ByVal value As EventHandler)
- Handlers = CType([Delegate].Combine(Handlers, value), _
- EventHandler)
- End AddHandler
-
- RemoveHandler(ByVal value as EventHandler)
- Handlers = CType([Delegate].Remove(Handlers, value), _
- EventHandler)
- End RemoveHandler
-
- RaiseEvent(ByVal sender As Object, ByVal e As EventArgs)
- Dim TempHandlers As EventHandler = Handlers
-
- If TempHandlers IsNot Nothing Then
- TempHandlers(sender, e)
- End If
- End RaiseEvent
- End Event";
- EventDeclaration customEventDecl = ParseUtilVBNet.ParseTypeMember<EventDeclaration>(code);
- Assert.IsNotNull(customEventDecl);
- Assert.AreEqual("TestEvent", customEventDecl.Name);
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/TypeLevel/DeclareDeclarationTests.cs b/main/contrib/NRefactory/Test/Parser/TypeLevel/DeclareDeclarationTests.cs
deleted file mode 100644
index 6f4a9564a4..0000000000
--- a/main/contrib/NRefactory/Test/Parser/TypeLevel/DeclareDeclarationTests.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 3660 $</version>
-// </file>
-
-using System;
-using ICSharpCode.NRefactory.Ast;
-using NUnit.Framework;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class DeclareDeclarationTests
- {
- #region C#
- // No C# representation
- #endregion
-
- #region VB.NET
- [Test]
- public void VBNetDeclareDeclarationTest()
- {
- string program = "Declare Ansi Function GetUserName Lib \"advapi32.dll\" Alias \"GetUserNameA\" (ByVal lpBuffer As String, ByRef nSize As Integer) As Integer\n";
- DeclareDeclaration dd = ParseUtilVBNet.ParseTypeMember<DeclareDeclaration>(program);
- Assert.AreEqual("System.Int32", dd.TypeReference.Type);
- Assert.AreEqual("GetUserName", dd.Name);
- Assert.AreEqual("advapi32.dll", dd.Library);
- Assert.AreEqual("GetUserNameA", dd.Alias);
- Assert.AreEqual(CharsetModifier.Ansi, dd.Charset);
- }
- #endregion
-
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/TypeLevel/DestructorDeclarationTests.cs b/main/contrib/NRefactory/Test/Parser/TypeLevel/DestructorDeclarationTests.cs
deleted file mode 100644
index cf0c8b2342..0000000000
--- a/main/contrib/NRefactory/Test/Parser/TypeLevel/DestructorDeclarationTests.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 2676 $</version>
-// </file>
-
-using System;
-using ICSharpCode.NRefactory.Ast;
-using NUnit.Framework;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class DestructorDeclarationTests
- {
- #region C#
- [Test]
- public void CSharpDestructorDeclarationTest()
- {
- DestructorDeclaration dd = ParseUtilCSharp.ParseTypeMember<DestructorDeclaration>("~MyClass() {}");
- }
-
- [Test]
- public void CSharpExternDestructorDeclarationTest()
- {
- DestructorDeclaration dd = ParseUtilCSharp.ParseTypeMember<DestructorDeclaration>("extern ~MyClass();");
- Assert.AreEqual(Modifiers.Extern, dd.Modifier);
- }
-
- [Test]
- public void CSharpUnsafeDestructorDeclarationTest()
- {
- DestructorDeclaration dd = ParseUtilCSharp.ParseTypeMember<DestructorDeclaration>("unsafe ~MyClass() {}");
- Assert.AreEqual(Modifiers.Unsafe, dd.Modifier);
- }
- #endregion
-
- #region VB.NET
- // No VB.NET representation
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/TypeLevel/EventDeclarationTests.cs b/main/contrib/NRefactory/Test/Parser/TypeLevel/EventDeclarationTests.cs
deleted file mode 100644
index 3395122118..0000000000
--- a/main/contrib/NRefactory/Test/Parser/TypeLevel/EventDeclarationTests.cs
+++ /dev/null
@@ -1,84 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 3660 $</version>
-// </file>
-
-using System;
-using ICSharpCode.NRefactory.Ast;
-using NUnit.Framework;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class EventDeclarationTests
- {
- #region C#
- [Test]
- public void CSharpSimpleEventDeclarationTest()
- {
- EventDeclaration ed = ParseUtilCSharp.ParseTypeMember<EventDeclaration>("event System.EventHandler MyEvent;");
- Assert.AreEqual("MyEvent", ed.Name);
- Assert.AreEqual("System.EventHandler", ed.TypeReference.Type);
-
- Assert.IsFalse(ed.HasAddRegion);
- Assert.IsFalse(ed.HasRemoveRegion);
- }
-
- [Test]
- public void CSharpEventImplementingInterfaceDeclarationTest()
- {
- EventDeclaration ed = ParseUtilCSharp.ParseTypeMember<EventDeclaration>("event EventHandler MyInterface.MyEvent;");
-
- Assert.AreEqual("MyEvent", ed.Name);
- Assert.AreEqual("EventHandler", ed.TypeReference.Type);
-
- Assert.IsFalse(ed.HasAddRegion);
- Assert.IsFalse(ed.HasRemoveRegion);
-
- Assert.AreEqual("MyInterface", ed.InterfaceImplementations[0].InterfaceType.Type);
- Assert.AreEqual("MyEvent", ed.InterfaceImplementations[0].MemberName);
- }
-
- [Test]
- public void CSharpEventImplementingGenericInterfaceDeclarationTest()
- {
- EventDeclaration ed = ParseUtilCSharp.ParseTypeMember<EventDeclaration>("event EventHandler MyInterface<string>.MyEvent;");
-
- Assert.AreEqual("MyEvent", ed.Name);
- Assert.AreEqual("EventHandler", ed.TypeReference.Type);
-
- Assert.IsFalse(ed.HasAddRegion);
- Assert.IsFalse(ed.HasRemoveRegion);
-
- Assert.AreEqual("MyInterface", ed.InterfaceImplementations[0].InterfaceType.Type);
- Assert.AreEqual("System.String", ed.InterfaceImplementations[0].InterfaceType.GenericTypes[0].Type);
- Assert.AreEqual("MyEvent", ed.InterfaceImplementations[0].MemberName);
- }
-
- [Test]
- public void CSharpAddRemoveEventDeclarationTest()
- {
- EventDeclaration ed = ParseUtilCSharp.ParseTypeMember<EventDeclaration>("event System.EventHandler MyEvent { add { } remove { } }");
- Assert.AreEqual("MyEvent", ed.Name);
- Assert.AreEqual("System.EventHandler", ed.TypeReference.Type);
-
- Assert.IsTrue(ed.HasAddRegion);
- Assert.IsTrue(ed.HasRemoveRegion);
- }
- #endregion
-
- #region VB.NET
- [Test]
- public void VBNetSimpleEventDeclarationTest()
- {
- EventDeclaration ed = ParseUtilVBNet.ParseTypeMember<EventDeclaration>("event MyEvent(x as Integer)");
- Assert.AreEqual(1, ed.Parameters.Count);
- Assert.AreEqual("MyEvent", ed.Name);
- Assert.IsFalse(ed.HasAddRegion);
- Assert.IsFalse(ed.HasRemoveRegion);
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/TypeLevel/FieldDeclarationTests.cs b/main/contrib/NRefactory/Test/Parser/TypeLevel/FieldDeclarationTests.cs
deleted file mode 100644
index 91ebf84413..0000000000
--- a/main/contrib/NRefactory/Test/Parser/TypeLevel/FieldDeclarationTests.cs
+++ /dev/null
@@ -1,91 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 3660 $</version>
-// </file>
-
-using System;
-using ICSharpCode.NRefactory.Ast;
-using NUnit.Framework;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class FieldDeclarationTests
- {
- #region C#
- [Test]
- public void CSharpSimpleFieldDeclarationTest()
- {
- FieldDeclaration fd = ParseUtilCSharp.ParseTypeMember<FieldDeclaration>("int[,,,] myField;");
- Assert.AreEqual("System.Int32", fd.TypeReference.Type);
- Assert.AreEqual(new int[] { 3 } , fd.TypeReference.RankSpecifier);
- Assert.AreEqual(1, fd.Fields.Count);
-
- Assert.AreEqual("myField", ((VariableDeclaration)fd.Fields[0]).Name);
- }
- #endregion
-
- #region VB.NET
- [Test]
- public void VBNetSimpleFieldDeclarationTest()
- {
- FieldDeclaration fd = ParseUtilVBNet.ParseTypeMember<FieldDeclaration>("myField As Integer(,,,)");
- Assert.AreEqual(1, fd.Fields.Count);
-
- Assert.AreEqual("System.Int32", ((VariableDeclaration)fd.Fields[0]).TypeReference.Type);
- Assert.AreEqual("System.Int32", ((VariableDeclaration)fd.Fields[0]).TypeReference.Type);
- Assert.AreEqual("myField", ((VariableDeclaration)fd.Fields[0]).Name);
- Assert.AreEqual(new int[] { 3 } , ((VariableDeclaration)fd.Fields[0]).TypeReference.RankSpecifier);
- }
-
- [Test]
- public void VBNetMultiFieldDeclarationTest()
- {
- FieldDeclaration fd = ParseUtilVBNet.ParseTypeMember<FieldDeclaration>("a, b As String");
- Assert.AreEqual(2, fd.Fields.Count);
-
- Assert.AreEqual("System.String", ((VariableDeclaration)fd.Fields[0]).TypeReference.Type);
- Assert.IsFalse(((VariableDeclaration)fd.Fields[0]).TypeReference.IsArrayType);
- Assert.AreEqual("System.String", ((VariableDeclaration)fd.Fields[1]).TypeReference.Type);
- Assert.IsFalse(((VariableDeclaration)fd.Fields[1]).TypeReference.IsArrayType);
- }
-
- [Test]
- public void VBNetMultiFieldsOnSingleLineTest()
- {
- string program = "Class TestClass : Dim a : Dim b : End Class";
- TypeDeclaration td = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
-
- Assert.AreEqual(2, td.Children.Count);
- Assert.IsTrue(td.Children[0] is FieldDeclaration);
- Assert.IsTrue(td.Children[1] is FieldDeclaration);
- }
-
- [Test]
- public void VBNetMultiFieldDeclarationTest2()
- {
- FieldDeclaration fd = ParseUtilVBNet.ParseTypeMember<FieldDeclaration>("Dim a, b() As String");
- Assert.AreEqual(2, fd.Fields.Count);
-
- Assert.AreEqual("System.String", ((VariableDeclaration)fd.Fields[0]).TypeReference.Type);
- Assert.AreEqual("System.String", ((VariableDeclaration)fd.Fields[1]).TypeReference.Type);
- Assert.IsFalse(((VariableDeclaration)fd.Fields[0]).TypeReference.IsArrayType);
- Assert.IsTrue(((VariableDeclaration)fd.Fields[1]).TypeReference.IsArrayType);
- }
-
- [Test]
- public void VBNetMultiFieldDeclarationTest3()
- {
- FieldDeclaration fd = ParseUtilVBNet.ParseTypeMember<FieldDeclaration>("Dim a(), b As String");
- Assert.AreEqual(2, fd.Fields.Count);
-
- Assert.AreEqual("System.String", ((VariableDeclaration)fd.Fields[0]).TypeReference.Type);
- Assert.AreEqual("System.String", ((VariableDeclaration)fd.Fields[1]).TypeReference.Type);
- Assert.IsTrue(((VariableDeclaration)fd.Fields[0]).TypeReference.IsArrayType);
- Assert.IsFalse(((VariableDeclaration)fd.Fields[1]).TypeReference.IsArrayType);
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/TypeLevel/IndexerDeclarationTests.cs b/main/contrib/NRefactory/Test/Parser/TypeLevel/IndexerDeclarationTests.cs
deleted file mode 100644
index 486093c9ac..0000000000
--- a/main/contrib/NRefactory/Test/Parser/TypeLevel/IndexerDeclarationTests.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 3660 $</version>
-// </file>
-
-using System;
-using ICSharpCode.NRefactory.Ast;
-using NUnit.Framework;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class IndexerDeclarationTests
- {
- #region C#
- [Test]
- public void CSharpIndexerDeclarationTest()
- {
- IndexerDeclaration id = ParseUtilCSharp.ParseTypeMember<IndexerDeclaration>("int this[int a, string b] { get { } set { } }");
- Assert.AreEqual(2, id.Parameters.Count);
- Assert.IsTrue(id.HasGetRegion, "No get region found!");
- Assert.IsTrue(id.HasSetRegion, "No set region found!");
- }
-
- [Test]
- public void CSharpIndexerImplementingInterfaceTest()
- {
- IndexerDeclaration id = ParseUtilCSharp.ParseTypeMember<IndexerDeclaration>("int MyInterface.this[int a, string b] { get { } set { } }");
- Assert.AreEqual(2, id.Parameters.Count);
- Assert.IsTrue(id.HasGetRegion, "No get region found!");
- Assert.IsTrue(id.HasSetRegion, "No set region found!");
-
- Assert.AreEqual("MyInterface", id.InterfaceImplementations[0].InterfaceType.Type);
- }
-
- [Test]
- public void CSharpIndexerImplementingGenericInterfaceTest()
- {
- IndexerDeclaration id = ParseUtilCSharp.ParseTypeMember<IndexerDeclaration>("int MyInterface<string>.this[int a, string b] { get { } set { } }");
- Assert.AreEqual(2, id.Parameters.Count);
- Assert.IsTrue(id.HasGetRegion, "No get region found!");
- Assert.IsTrue(id.HasSetRegion, "No set region found!");
-
- Assert.AreEqual("MyInterface", id.InterfaceImplementations[0].InterfaceType.Type);
- Assert.AreEqual("System.String", id.InterfaceImplementations[0].InterfaceType.GenericTypes[0].Type);
- }
- #endregion
-
- #region VB.NET
- // no vb.net representation (indexers are properties named "item" in vb.net)
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/TypeLevel/MethodDeclarationTests.cs b/main/contrib/NRefactory/Test/Parser/TypeLevel/MethodDeclarationTests.cs
deleted file mode 100644
index 9708e22176..0000000000
--- a/main/contrib/NRefactory/Test/Parser/TypeLevel/MethodDeclarationTests.cs
+++ /dev/null
@@ -1,446 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 3717 $</version>
-// </file>
-
-using System;
-using ICSharpCode.NRefactory.Ast;
-using NUnit.Framework;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class MethodDeclarationTests
- {
- #region C#
- [Test]
- public void CSharpSimpleMethodDeclarationTest()
- {
- MethodDeclaration md = ParseUtilCSharp.ParseTypeMember<MethodDeclaration>("void MyMethod() {} ");
- Assert.AreEqual("System.Void", md.TypeReference.Type);
- Assert.AreEqual(0, md.Parameters.Count);
- Assert.IsFalse(md.IsExtensionMethod);
- }
-
- [Test]
- public void CSharpAbstractMethodDeclarationTest()
- {
- MethodDeclaration md = ParseUtilCSharp.ParseTypeMember<MethodDeclaration>("abstract void MyMethod();");
- Assert.AreEqual("System.Void", md.TypeReference.Type);
- Assert.AreEqual(0, md.Parameters.Count);
- Assert.IsFalse(md.IsExtensionMethod);
- Assert.IsTrue(md.Body.IsNull);
- Assert.AreEqual(Modifiers.Abstract, md.Modifier);
- }
-
- [Test]
- public void CSharpDefiningPartialMethodDeclarationTest()
- {
- MethodDeclaration md = ParseUtilCSharp.ParseTypeMember<MethodDeclaration>("partial void MyMethod();");
- Assert.AreEqual("System.Void", md.TypeReference.Type);
- Assert.AreEqual(0, md.Parameters.Count);
- Assert.IsFalse(md.IsExtensionMethod);
- Assert.IsTrue(md.Body.IsNull);
- Assert.AreEqual(Modifiers.Partial, md.Modifier);
- }
-
- [Test]
- public void CSharpImplementingPartialMethodDeclarationTest()
- {
- MethodDeclaration md = ParseUtilCSharp.ParseTypeMember<MethodDeclaration>("partial void MyMethod() { }");
- Assert.AreEqual("System.Void", md.TypeReference.Type);
- Assert.AreEqual(0, md.Parameters.Count);
- Assert.IsFalse(md.IsExtensionMethod);
- Assert.IsFalse(md.Body.IsNull);
- Assert.AreEqual(Modifiers.Partial, md.Modifier);
- }
-
- [Test]
- public void CSharpSimpleMethodRegionTest()
- {
- const string program = @"
- void MyMethod()
- {
- OtherMethod();
- }
-";
- MethodDeclaration md = ParseUtilCSharp.ParseTypeMember<MethodDeclaration>(program);
- Assert.AreEqual(2, md.StartLocation.Line, "StartLocation.Y");
- Assert.AreEqual(2, md.EndLocation.Line, "EndLocation.Y");
- Assert.AreEqual(3, md.StartLocation.Column, "StartLocation.X");
-
- // endLocation.X is currently 20. It should be 18, but that error is not critical
- //Assert.AreEqual(18, md.EndLocation.X, "EndLocation.X");
- }
-
- [Test]
- public void CSharpMethodWithModifiersRegionTest()
- {
- const string program = @"
- public static void MyMethod()
- {
- OtherMethod();
- }
-";
- MethodDeclaration md = ParseUtilCSharp.ParseTypeMember<MethodDeclaration>(program);
- Assert.AreEqual(2, md.StartLocation.Line, "StartLocation.Y");
- Assert.AreEqual(2, md.EndLocation.Line, "EndLocation.Y");
- Assert.AreEqual(3, md.StartLocation.Column, "StartLocation.X");
- }
-
- [Test]
- public void CSharpMethodWithUnnamedParameterDeclarationTest()
- {
- MethodDeclaration md = ParseUtilCSharp.ParseTypeMember<MethodDeclaration>("void MyMethod(int) {} ", true);
- Assert.AreEqual("System.Void", md.TypeReference.Type);
- Assert.AreEqual(1, md.Parameters.Count);
- //Assert.AreEqual("?", ((ParameterDeclarationExpression)md.Parameters[0]).ParameterName);
- }
-
- [Test]
- public void CSharpGenericVoidMethodDeclarationTest()
- {
- MethodDeclaration md = ParseUtilCSharp.ParseTypeMember<MethodDeclaration>("void MyMethod<T>(T a) {} ");
- Assert.AreEqual("System.Void", md.TypeReference.Type);
- Assert.AreEqual(1, md.Parameters.Count);
- Assert.AreEqual("T", ((ParameterDeclarationExpression)md.Parameters[0]).TypeReference.Type);
- Assert.AreEqual("a", ((ParameterDeclarationExpression)md.Parameters[0]).ParameterName);
-
- Assert.AreEqual(1, md.Templates.Count);
- Assert.AreEqual("T", md.Templates[0].Name);
- }
-
- [Test]
- public void CSharpGenericMethodDeclarationTest()
- {
- MethodDeclaration md = ParseUtilCSharp.ParseTypeMember<MethodDeclaration>("T MyMethod<T>(T a) {} ");
- Assert.AreEqual("T", md.TypeReference.Type);
- Assert.AreEqual(1, md.Parameters.Count);
- Assert.AreEqual("T", ((ParameterDeclarationExpression)md.Parameters[0]).TypeReference.Type);
- Assert.AreEqual("a", ((ParameterDeclarationExpression)md.Parameters[0]).ParameterName);
-
- Assert.AreEqual(1, md.Templates.Count);
- Assert.AreEqual("T", md.Templates[0].Name);
- }
-
- [Test]
- public void CSharpGenericMethodDeclarationWithConstraintTest()
- {
- string program = "T MyMethod<T>(T a) where T : ISomeInterface {} ";
- MethodDeclaration md = ParseUtilCSharp.ParseTypeMember<MethodDeclaration>(program);
- Assert.AreEqual("T", md.TypeReference.Type);
- Assert.AreEqual(1, md.Parameters.Count);
- Assert.AreEqual("T", ((ParameterDeclarationExpression)md.Parameters[0]).TypeReference.Type);
- Assert.AreEqual("a", ((ParameterDeclarationExpression)md.Parameters[0]).ParameterName);
-
- Assert.AreEqual(1, md.Templates.Count);
- Assert.AreEqual("T", md.Templates[0].Name);
- Assert.AreEqual(1, md.Templates[0].Bases.Count);
- Assert.AreEqual("ISomeInterface", md.Templates[0].Bases[0].Type);
- }
-
- [Test]
- public void CSharpGenericMethodInInterface()
- {
- const string program = @"interface MyInterface {
- T MyMethod<T>(T a) where T : ISomeInterface;
-}
-";
- TypeDeclaration td = ParseUtilCSharp.ParseGlobal<TypeDeclaration>(program);
- MethodDeclaration md = (MethodDeclaration)td.Children[0];
- Assert.AreEqual("T", md.TypeReference.Type);
- Assert.AreEqual(1, md.Parameters.Count);
- Assert.AreEqual("T", ((ParameterDeclarationExpression)md.Parameters[0]).TypeReference.Type);
- Assert.AreEqual("a", ((ParameterDeclarationExpression)md.Parameters[0]).ParameterName);
-
- Assert.AreEqual(1, md.Templates.Count);
- Assert.AreEqual("T", md.Templates[0].Name);
- Assert.AreEqual(1, md.Templates[0].Bases.Count);
- Assert.AreEqual("ISomeInterface", md.Templates[0].Bases[0].Type);
- }
-
- [Test]
- public void CSharpGenericVoidMethodInInterface()
- {
- const string program = @"interface MyInterface {
- void MyMethod<T>(T a) where T : ISomeInterface;
-}
-";
- TypeDeclaration td = ParseUtilCSharp.ParseGlobal<TypeDeclaration>(program);
- MethodDeclaration md = (MethodDeclaration)td.Children[0];
- Assert.AreEqual("System.Void", md.TypeReference.Type);
- Assert.AreEqual(1, md.Parameters.Count);
- Assert.AreEqual("T", ((ParameterDeclarationExpression)md.Parameters[0]).TypeReference.Type);
- Assert.AreEqual("a", ((ParameterDeclarationExpression)md.Parameters[0]).ParameterName);
-
- Assert.AreEqual(1, md.Templates.Count);
- Assert.AreEqual("T", md.Templates[0].Name);
- Assert.AreEqual(1, md.Templates[0].Bases.Count);
- Assert.AreEqual("ISomeInterface", md.Templates[0].Bases[0].Type);
- }
-
- [Test]
- public void CSharpShadowingMethodInInterface()
- {
- const string program = @"interface MyInterface : IDisposable {
- new void Dispose();
-}
-";
- TypeDeclaration td = ParseUtilCSharp.ParseGlobal<TypeDeclaration>(program);
- MethodDeclaration md = (MethodDeclaration)td.Children[0];
- Assert.AreEqual("System.Void", md.TypeReference.Type);
- Assert.AreEqual(0, md.Parameters.Count);
- Assert.AreEqual(Modifiers.New, md.Modifier);
- }
-
- [Test]
- public void CSharpMethodImplementingInterfaceTest()
- {
- MethodDeclaration md = ParseUtilCSharp.ParseTypeMember<MethodDeclaration>("int MyInterface.MyMethod() {} ");
- Assert.AreEqual("System.Int32", md.TypeReference.Type);
-
- Assert.AreEqual("MyInterface", md.InterfaceImplementations[0].InterfaceType.Type);
- }
-
- [Test]
- public void CSharpMethodImplementingGenericInterfaceTest()
- {
- MethodDeclaration md = ParseUtilCSharp.ParseTypeMember<MethodDeclaration>("int MyInterface<string>.MyMethod() {} ");
- Assert.AreEqual("System.Int32", md.TypeReference.Type);
-
- Assert.AreEqual("MyInterface", md.InterfaceImplementations[0].InterfaceType.Type);
- Assert.AreEqual("System.String", md.InterfaceImplementations[0].InterfaceType.GenericTypes[0].Type);
- }
-
- [Test]
- public void CSharpVoidMethodImplementingInterfaceTest()
- {
- MethodDeclaration md = ParseUtilCSharp.ParseTypeMember<MethodDeclaration>("void MyInterface.MyMethod() {} ");
- Assert.AreEqual("System.Void", md.TypeReference.Type);
-
- Assert.AreEqual("MyInterface", md.InterfaceImplementations[0].InterfaceType.Type);
- }
-
- [Test]
- public void CSharpVoidMethodImplementingGenericInterfaceTest()
- {
- MethodDeclaration md = ParseUtilCSharp.ParseTypeMember<MethodDeclaration>("void MyInterface<string>.MyMethod() {} ");
- Assert.AreEqual("System.Void", md.TypeReference.Type);
-
- Assert.AreEqual("MyInterface", md.InterfaceImplementations[0].InterfaceType.Type);
- Assert.AreEqual("System.String", md.InterfaceImplementations[0].InterfaceType.GenericTypes[0].Type);
- }
-
- [Test]
- public void CSharpIncompleteConstraintsTest()
- {
- MethodDeclaration md = ParseUtilCSharp.ParseTypeMember<MethodDeclaration>(
- "void a<T>() where T { }", true /* expect errors */
- );
- Assert.AreEqual("a", md.Name);
- Assert.AreEqual(1, md.Templates.Count);
- Assert.AreEqual("T", md.Templates[0].Name);
- Assert.AreEqual(0, md.Templates[0].Bases.Count);
- }
-
- [Test]
- public void CSharpExtensionMethodTest()
- {
- MethodDeclaration md = ParseUtilCSharp.ParseTypeMember<MethodDeclaration>(
- "public static int ToInt32(this string s) { return int.Parse(s); }"
- );
- Assert.AreEqual("ToInt32", md.Name);
- Assert.IsTrue(md.IsExtensionMethod);
- Assert.AreEqual("s", md.Parameters[0].ParameterName);
- Assert.AreEqual("System.String", md.Parameters[0].TypeReference.Type);
- }
-
- [Test]
- public void CSharpVoidExtensionMethodTest()
- {
- MethodDeclaration md = ParseUtilCSharp.ParseTypeMember<MethodDeclaration>(
- "public static void Print(this string s) { Console.WriteLine(s); }"
- );
- Assert.AreEqual("Print", md.Name);
- Assert.IsTrue(md.IsExtensionMethod);
- Assert.AreEqual("s", md.Parameters[0].ParameterName);
- Assert.AreEqual("System.String", md.Parameters[0].TypeReference.Type);
- }
-
- [Test]
- public void CSharpMethodWithEmptyAssignmentErrorInBody()
- {
- MethodDeclaration md = ParseUtilCSharp.ParseTypeMember<MethodDeclaration>(
- "void A\n" +
- "{\n" +
- "int a = 3;\n" +
- " = 4;\n" +
- "}", true /* expect errors */
- );
- Assert.AreEqual("A", md.Name);
- Assert.AreEqual(new Location(1, 2), md.Body.StartLocation);
- Assert.AreEqual(new Location(2, 5), md.Body.EndLocation);
- }
- #endregion
-
- #region VB.NET
-
- [Test]
- public void VBNetDefiningPartialMethodDeclarationTest()
- {
- MethodDeclaration md = ParseUtilVBNet.ParseTypeMember<MethodDeclaration>(@"Partial Sub MyMethod()
- End Sub");
- Assert.AreEqual(0, md.Parameters.Count);
- Assert.AreEqual("MyMethod", md.Name);
- Assert.IsFalse(md.IsExtensionMethod);
- Assert.AreEqual(Modifiers.Partial, md.Modifier);
- }
-
- [Test]
- public void VBNetMethodWithModifiersRegionTest()
- {
- const string program = @"public shared sub MyMethod()
- OtherMethod()
- end sub";
-
- MethodDeclaration md = ParseUtilVBNet.ParseTypeMember<MethodDeclaration>(program);
- Assert.AreEqual(Modifiers.Public | Modifiers.Static, md.Modifier);
- Assert.AreEqual(2, md.StartLocation.Line, "StartLocation.Y");
- Assert.AreEqual(2, md.EndLocation.Line, "EndLocation.Y");
- Assert.AreEqual(2, md.StartLocation.Column, "StartLocation.X");
- }
-
- [Test]
- public void VBNetGenericFunctionMethodDeclarationTest()
- {
- MethodDeclaration md = ParseUtilVBNet.ParseTypeMember<MethodDeclaration>("function MyMethod(Of T)(a As T) As Double\nEnd Function");
- Assert.AreEqual("System.Double", md.TypeReference.Type);
- Assert.AreEqual(1, md.Parameters.Count);
- Assert.AreEqual("T", ((ParameterDeclarationExpression)md.Parameters[0]).TypeReference.Type);
- Assert.AreEqual("a", ((ParameterDeclarationExpression)md.Parameters[0]).ParameterName);
-
- Assert.AreEqual(1, md.Templates.Count);
- Assert.AreEqual("T", md.Templates[0].Name);
- }
-
- [Test]
- public void VBNetGenericMethodDeclarationTest()
- {
- MethodDeclaration md = ParseUtilVBNet.ParseTypeMember<MethodDeclaration>("Function MyMethod(Of T)(a As T) As T\nEnd Function ");
- Assert.AreEqual("T", md.TypeReference.Type);
- Assert.AreEqual(1, md.Parameters.Count);
- Assert.AreEqual("T", ((ParameterDeclarationExpression)md.Parameters[0]).TypeReference.Type);
- Assert.AreEqual("a", ((ParameterDeclarationExpression)md.Parameters[0]).ParameterName);
-
- Assert.AreEqual(1, md.Templates.Count);
- Assert.AreEqual("T", md.Templates[0].Name);
- }
-
- [Test]
- public void VBNetGenericMethodDeclarationWithConstraintTest()
- {
- string program = "Function MyMethod(Of T As { ISomeInterface })(a As T) As T\n End Function";
- MethodDeclaration md = ParseUtilVBNet.ParseTypeMember<MethodDeclaration>(program);
- Assert.AreEqual("T", md.TypeReference.Type);
- Assert.AreEqual(1, md.Parameters.Count);
- Assert.AreEqual("T", ((ParameterDeclarationExpression)md.Parameters[0]).TypeReference.Type);
- Assert.AreEqual("a", ((ParameterDeclarationExpression)md.Parameters[0]).ParameterName);
-
- Assert.AreEqual(1, md.Templates.Count);
- Assert.AreEqual("T", md.Templates[0].Name);
- Assert.AreEqual(1, md.Templates[0].Bases.Count);
- Assert.AreEqual("ISomeInterface", md.Templates[0].Bases[0].Type);
- }
-
- [Test]
- public void VBNetExtensionMethodDeclaration()
- {
- MethodDeclaration md = ParseUtilVBNet.ParseTypeMember<MethodDeclaration>(
- @"<Extension> _
- Sub Print(s As String)
- Console.WriteLine(s)
- End Sub");
-
- Assert.AreEqual("Print", md.Name);
-
- // IsExtensionMethod is only valid for c#.
- // Assert.IsTrue(md.IsExtensionMethod);
-
- Assert.AreEqual("s", md.Parameters[0].ParameterName);
- Assert.AreEqual("System.String", md.Parameters[0].TypeReference.Type);
- }
-
- [Test]
- public void VBNetGenericMethodInInterface()
- {
- const string program = @"Interface MyInterface
- Function MyMethod(Of T As {ISomeInterface})(a As T) As T
- End Interface";
- TypeDeclaration td = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
- MethodDeclaration md = (MethodDeclaration)td.Children[0];
- Assert.AreEqual("T", md.TypeReference.Type);
- Assert.AreEqual(1, md.Parameters.Count);
- Assert.AreEqual("T", ((ParameterDeclarationExpression)md.Parameters[0]).TypeReference.Type);
- Assert.AreEqual("a", ((ParameterDeclarationExpression)md.Parameters[0]).ParameterName);
-
- Assert.AreEqual(1, md.Templates.Count);
- Assert.AreEqual("T", md.Templates[0].Name);
- Assert.AreEqual(1, md.Templates[0].Bases.Count);
- Assert.AreEqual("ISomeInterface", md.Templates[0].Bases[0].Type);
- }
-
- [Test]
- public void VBNetGenericVoidMethodInInterface()
- {
- const string program = @"interface MyInterface
- Sub MyMethod(Of T As {ISomeInterface})(a as T)
-End Interface
-";
- TypeDeclaration td = ParseUtilVBNet.ParseGlobal<TypeDeclaration>(program);
- MethodDeclaration md = (MethodDeclaration)td.Children[0];
- Assert.AreEqual("System.Void", md.TypeReference.Type);
- Assert.AreEqual(1, md.Parameters.Count);
- Assert.AreEqual("T", ((ParameterDeclarationExpression)md.Parameters[0]).TypeReference.Type);
- Assert.AreEqual("a", ((ParameterDeclarationExpression)md.Parameters[0]).ParameterName);
-
- Assert.AreEqual(1, md.Templates.Count);
- Assert.AreEqual("T", md.Templates[0].Name);
- Assert.AreEqual(1, md.Templates[0].Bases.Count);
- Assert.AreEqual("ISomeInterface", md.Templates[0].Bases[0].Type);
- }
-
- [Test]
- public void VBNetMethodWithHandlesClause()
- {
- MethodDeclaration md = ParseUtilVBNet.ParseTypeMember<MethodDeclaration>(
- @"Public Sub MyMethod(sender As Object, e As EventArgs) Handles x.y
- End Sub");
- Assert.AreEqual(new string[] { "x.y" }, md.HandlesClause.ToArray());
-
- md = ParseUtilVBNet.ParseTypeMember<MethodDeclaration>(
- @"Public Sub MyMethod() Handles Me.FormClosing
- End Sub");
- Assert.AreEqual(new string[] { "Me.FormClosing" }, md.HandlesClause.ToArray());
-
- md = ParseUtilVBNet.ParseTypeMember<MethodDeclaration>(
- @"Public Sub MyMethod() Handles MyBase.Event, Button1.Click
- End Sub");
- Assert.AreEqual(new string[] { "MyBase.Event", "Button1.Click" }, md.HandlesClause.ToArray());
- }
-
- [Test]
- public void VBNetMethodWithTypeCharactersTest()
- {
- const string program = @"Public Function Func!(ByVal Param&)
- Func! = CSingle(Param&)
- End Function";
-
- MethodDeclaration md = ParseUtilVBNet.ParseTypeMember<MethodDeclaration>(program);
- Assert.AreEqual(Modifiers.Public, md.Modifier);
- }
-
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/TypeLevel/OperatorDeclarationTests.cs b/main/contrib/NRefactory/Test/Parser/TypeLevel/OperatorDeclarationTests.cs
deleted file mode 100644
index 9b8101e2e4..0000000000
--- a/main/contrib/NRefactory/Test/Parser/TypeLevel/OperatorDeclarationTests.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 3660 $</version>
-// </file>
-
-using System;
-using ICSharpCode.NRefactory.Ast;
-using NUnit.Framework;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class OperatorDeclarationTests
- {
- #region C#
- [Test]
- public void CSharpImplictOperatorDeclarationTest()
- {
- OperatorDeclaration od = ParseUtilCSharp.ParseTypeMember<OperatorDeclaration>("public static implicit operator double(MyObject f) { return 0.5d; }");
- Assert.IsTrue(od.IsConversionOperator);
- Assert.AreEqual(1, od.Parameters.Count);
- Assert.AreEqual(ConversionType.Implicit, od.ConversionType);
- Assert.AreEqual("System.Double", od.TypeReference.Type);
- }
-
- [Test]
- public void CSharpExplicitOperatorDeclarationTest()
- {
- OperatorDeclaration od = ParseUtilCSharp.ParseTypeMember<OperatorDeclaration>("public static explicit operator double(MyObject f) { return 0.5d; }");
- Assert.IsTrue(od.IsConversionOperator);
- Assert.AreEqual(1, od.Parameters.Count);
- Assert.AreEqual(ConversionType.Explicit, od.ConversionType);
- Assert.AreEqual("System.Double", od.TypeReference.Type);
- }
-
- [Test]
- public void CSharpPlusOperatorDeclarationTest()
- {
- OperatorDeclaration od = ParseUtilCSharp.ParseTypeMember<OperatorDeclaration>("public static MyObject operator +(MyObject a, MyObject b) {}");
- Assert.IsTrue(!od.IsConversionOperator);
- Assert.AreEqual(2, od.Parameters.Count);
- Assert.AreEqual("MyObject", od.TypeReference.Type);
- }
- #endregion
-
- #region VB.NET
-
- [Test]
- public void VBNetImplictOperatorDeclarationTest()
- {
- string programm = @"Public Shared Operator + (ByVal v As Complex) As Complex
- Return v
- End Operator";
-
- OperatorDeclaration od = ParseUtilVBNet.ParseTypeMember<OperatorDeclaration>(programm);
- Assert.IsFalse(od.IsConversionOperator);
- Assert.AreEqual(1, od.Parameters.Count);
- Assert.AreEqual(ConversionType.None, od.ConversionType);
- Assert.AreEqual("Complex", od.TypeReference.Type);
- }
- #endregion
- }
-}
diff --git a/main/contrib/NRefactory/Test/Parser/TypeLevel/PropertyDeclarationTests.cs b/main/contrib/NRefactory/Test/Parser/TypeLevel/PropertyDeclarationTests.cs
deleted file mode 100644
index a0ef1d475c..0000000000
--- a/main/contrib/NRefactory/Test/Parser/TypeLevel/PropertyDeclarationTests.cs
+++ /dev/null
@@ -1,139 +0,0 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
-// <version>$Revision: 3660 $</version>
-// </file>
-
-using System;
-using System.IO;
-using ICSharpCode.NRefactory.Ast;
-using NUnit.Framework;
-
-namespace ICSharpCode.NRefactory.Tests.Ast
-{
- [TestFixture]
- public class PropertyDeclarationTests
- {
- #region C#
- [Test]
- public void CSharpSimpleGetSetPropertyDeclarationTest()
- {
- PropertyDeclaration pd = ParseUtilCSharp.ParseTypeMember<PropertyDeclaration>("int MyProperty { get {} set {} } ");
- Assert.AreEqual("MyProperty", pd.Name);
- Assert.IsTrue(pd.HasGetRegion);
- Assert.IsTrue(pd.HasSetRegion);
- }
-
- [Test]
- public void CSharpGetSetPropertyDeclarationWithAccessorModifiers()
- {
- PropertyDeclaration pd = ParseUtilCSharp.ParseTypeMember<PropertyDeclaration>("int MyProperty { private get {} protected internal set {} } ");
- Assert.AreEqual("MyProperty", pd.Name);
- Assert.IsTrue(pd.HasGetRegion);
- Assert.IsTrue(pd.HasSetRegion);
- }
-
- [Test]
- public void CSharpSimpleGetPropertyDeclarationTest()
- {
- PropertyDeclaration pd = ParseUtilCSharp.ParseTypeMember<PropertyDeclaration>("int MyProperty { get {} } ");
- Assert.AreEqual("MyProperty", pd.Name);
- Assert.IsTrue(pd.HasGetRegion);
- Assert.IsTrue(!pd.HasSetRegion);
- }
-
- [Test]
- public void CSharpSimpleSetPropertyDeclarationTest()
- {
- PropertyDeclaration pd = ParseUtilCSharp.ParseTypeMember<PropertyDeclaration>("int MyProperty { set {} } ");
- Assert.AreEqual("MyProperty", pd.Name);
- Assert.IsTrue(!pd.HasGetRegion);
- Assert.IsTrue(pd.HasSetRegion);
- }
-
- void CSharpPropertyRegionTest(bool parseMethodBodies)
- {
- const string code = "class T {\n\tint Prop {\n\t\tget { return f; }\n\t\tset { f = value; }\n\t}\n}\n";
- int line2Pos = code.IndexOf("\tint Prop");
- int line3Pos = code.IndexOf("\t\tget");
- int line4Pos = code.IndexOf("\t\tset");
-
- IParser p = ParserFactory.CreateParser(SupportedLanguage.CSharp, new StringReader(code));
- p.ParseMethodBodies = parseMethodBodies;
- p.Parse();
- PropertyDeclaration pd = (PropertyDeclaration)p.CompilationUnit.Children[0].Children[0];
- Assert.AreEqual(new Location(code.IndexOf("{\n\t\tget") - line2Pos + 1, 2), pd.BodyStart);
- Assert.AreEqual(new Location(3, 5), pd.BodyEnd);
- Assert.AreEqual(new Location(code.IndexOf("{ return") - line3Pos + 1, 3), pd.GetRegion.Block.StartLocation);
- Assert.AreEqual(new Location(code.IndexOf("}\n\t\tset") + 1 - line3Pos + 1, 3), pd.GetRegion.Block.EndLocation);
- Assert.AreEqual(new Location(code.IndexOf("{ f =") - line4Pos + 1, 4), pd.SetRegion.Block.StartLocation);
- Assert.AreEqual(new Location(code.IndexOf("}\n\t}") + 1 - line4Pos + 1, 4), pd.SetRegion.Block.EndLocation);
- }
-
- [Test]
- public void CSharpPropertyRegionTest()
- {
- CSharpPropertyRegionTest(true);
- }
-
- [Test]
- public void CSharpPropertyRegionTestSkipParseMethodBodies()
- {
- CSharpPropertyRegionTest(false);
- }
-
- [Test]
- public void CSharpPropertyImplementingInterfaceTest()
- {
- PropertyDeclaration pd = ParseUtilCSharp.ParseTypeMember<PropertyDeclaration>("int MyInterface.MyProperty { get {} } ");
- Assert.AreEqual("MyProperty", pd.Name);
- Assert.IsTrue(pd.HasGetRegion);
- Assert.IsTrue(!pd.HasSetRegion);
-
- Assert.AreEqual("MyInterface", pd.InterfaceImplementations[0].InterfaceType.Type);
- }
-
- [Test]
- public void CSharpPropertyImplementingGenericInterfaceTest()
- {
- PropertyDeclaration pd = ParseUtilCSharp.ParseTypeMember<PropertyDeclaration>("int MyInterface<string>.MyProperty { get {} } ");
- Assert.AreEqual("MyProperty", pd.Name);
- Assert.IsTrue(pd.HasGetRegion);
- Assert.IsTrue(!pd.HasSetRegion);
-
- Assert.AreEqual("MyInterface", pd.InterfaceImplementations[0].InterfaceType.Type);
- Assert.AreEqual("System.String", pd.InterfaceImplementations[0].InterfaceType.GenericTypes[0].Type);
- }
- #endregion
-
- #region VB.NET
- [Test]
- public void VBNetSimpleGetSetPropertyDeclarationTest()
- {
- PropertyDeclaration pd = ParseUtilVBNet.ParseTypeMember<PropertyDeclaration>("Property MyProperty As Integer \n Get \n End Get \n Set \n End Set\nEnd Property");
- Assert.AreEqual("MyProperty", pd.Name);
- Assert.IsTrue(pd.HasGetRegion);
- Assert.IsTrue(pd.HasSetRegion);
- }
-
- [Test]
- public void VBNetSimpleGetPropertyDeclarationTest()
- {
- PropertyDeclaration pd = ParseUtilVBNet.ParseTypeMember<PropertyDeclaration>("Property MyProperty \nGet\nEnd Get\nEnd Property");
- Assert.AreEqual("MyProperty", pd.Name);
- Assert.IsTrue(pd.HasGetRegion);
- Assert.IsFalse(pd.HasSetRegion);
- }
-
- [Test]
- public void VBNetSimpleSetPropertyDeclarationTest()
- {
- PropertyDeclaration pd = ParseUtilVBNet.ParseTypeMember<PropertyDeclaration>("Property MyProperty \n Set\nEnd Set\nEnd Property ");
- Assert.AreEqual("MyProperty", pd.Name);
- Assert.IsFalse(pd.HasGetRegion);
- Assert.IsTrue(pd.HasSetRegion);
- }
- #endregion
- }
-}
diff --git a/main/monodevelop.pc.in b/main/monodevelop.pc.in
index eaecb9b027..a1bd4cd57b 100644
--- a/main/monodevelop.pc.in
+++ b/main/monodevelop.pc.in
@@ -10,4 +10,4 @@ MonoAddinsTestCommand=MonoDevelop.exe
Name: MonoDevelop
Description: Free .NET Development Environment
Version: @VERSION@
-Libs: -r:${libdir}/bin/MonoDevelop.Core.dll -r:${libdir}/bin/MonoDevelop.Ide.dll -r:${libdir}/bin/OldNRefactory.dll -r:${libdir}/bin/ICSharpCode.NRefactory.dll -r:${libdir}/bin/ICSharpCode.NRefactory.CSharp.dll -r:${libdir}/bin/Mono.Cecil.dll -r:${libdir}/bin/Mono.TextEditor.dll -r:${libdir}/bin/Mono.Debugging.dll -r:${libdir}/bin/Newtonsoft.Json.dll -r:${libdir}/bin/Xwt.dll -r:${libdir}/bin/Xwt.Gtk.dll
+Libs: -r:${libdir}/bin/MonoDevelop.Core.dll -r:${libdir}/bin/MonoDevelop.Ide.dll -r:${libdir}/bin/ICSharpCode.NRefactory.dll -r:${libdir}/bin/ICSharpCode.NRefactory.CSharp.dll -r:${libdir}/bin/Mono.Cecil.dll -r:${libdir}/bin/Mono.TextEditor.dll -r:${libdir}/bin/Mono.Debugging.dll -r:${libdir}/bin/Newtonsoft.Json.dll -r:${libdir}/bin/Xwt.dll -r:${libdir}/bin/Xwt.Gtk.dll
diff --git a/setup/WixSetup/Product.wxs b/setup/WixSetup/Product.wxs
index f611259872..363885351a 100644
--- a/setup/WixSetup/Product.wxs
+++ b/setup/WixSetup/Product.wxs
@@ -59,7 +59,6 @@
<File Name="MonoDevelop.Ide.dll" Source="$(var.BuildRoot)\bin\MonoDevelop.Ide.dll" />
<File Name="MonoDevelop.Projects.Formats.MSBuild.exe" Source="$(var.BuildRoot)\bin\MonoDevelop.Projects.Formats.MSBuild.exe" />
<File Name="MonoDevelop.Projects.Formats.MSBuild.exe.config" Source="$(var.BuildRoot)\bin\MonoDevelop.Projects.Formats.MSBuild.exe.config" />
- <File Name="OldNRefactory.dll" Source="$(var.BuildRoot)\bin\OldNRefactory.dll" />
<File Name="ICSharpCode.Decompiler.dll" Source="$(var.BuildRoot)\bin\ICSharpCode.Decompiler.dll" />
<File Name="ICSharpCode.NRefactory.dll" Source="$(var.BuildRoot)\bin\ICSharpCode.NRefactory.dll" />