diff --git a/.travis.yml b/.travis.yml index e75fe73221..d56301c453 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ os: osx_image: xcode8.2 branches: only: - - dev + - master - /^release\/.*$/ - /^(.*\/)?ci-.*$/ before_install: diff --git a/.vsts-pipelines/builds/ci-internal.yml b/.vsts-pipelines/builds/ci-internal.yml index dc7b8a3cb9..c2c5336fd0 100644 --- a/.vsts-pipelines/builds/ci-internal.yml +++ b/.vsts-pipelines/builds/ci-internal.yml @@ -7,7 +7,7 @@ resources: - repository: buildtools type: git name: aspnet-BuildTools - ref: refs/heads/release/2.2 + ref: refs/heads/master phases: - template: .vsts-pipelines/templates/project-ci.yml@buildtools diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 64ff041d5c..eac4268e4c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,4 @@ Contributing ====== -Information on contributing to this repo is in the [Contributing Guide](https://github.com/aspnet/Home/blob/dev/CONTRIBUTING.md) in the Home repo. +Information on contributing to this repo is in the [Contributing Guide](https://github.com/aspnet/Home/blob/master/CONTRIBUTING.md) in the Home repo. diff --git a/LICENSE.txt b/LICENSE.txt index 7b2956ecee..b3b180cd51 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,14 +1,201 @@ -Copyright (c) .NET Foundation and Contributors + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ -All rights reserved. + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at + 1. Definitions. - http://www.apache.org/licenses/LICENSE-2.0 + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. -Unless required by applicable law or agreed to in writing, software distributed -under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR -CONDITIONS OF ANY KIND, either express or implied. See the License for the -specific language governing permissions and limitations under the License. + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright (c) .NET Foundation and Contributors + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/benchmarks/Microsoft.AspNetCore.Razor.Performance/ProjectSystem/ProjectSnapshotManagerBenchmarkBase.cs b/benchmarks/Microsoft.AspNetCore.Razor.Performance/ProjectSystem/ProjectSnapshotManagerBenchmarkBase.cs index 70590a6a35..580ddd1572 100644 --- a/benchmarks/Microsoft.AspNetCore.Razor.Performance/ProjectSystem/ProjectSnapshotManagerBenchmarkBase.cs +++ b/benchmarks/Microsoft.AspNetCore.Razor.Performance/ProjectSystem/ProjectSnapshotManagerBenchmarkBase.cs @@ -132,14 +132,6 @@ namespace Microsoft.AspNetCore.Razor.Performance private class StaticProjectSnapshotProjectEngineFactory : ProjectSnapshotProjectEngineFactory { - public override RazorProjectEngine Create(ProjectSnapshot project, RazorProjectFileSystem fileSystem, Action configure) - { - return RazorProjectEngine.Create(project.Configuration, fileSystem, b => - { - RazorExtensions.Register(b); - }); - } - public override IProjectEngineFactory FindFactory(ProjectSnapshot project) { throw new NotImplementedException(); @@ -149,6 +141,14 @@ namespace Microsoft.AspNetCore.Razor.Performance { throw new NotImplementedException(); } + + public override RazorProjectEngine Create(RazorConfiguration configuration, RazorProjectFileSystem fileSystem, Action configure) + { + return RazorProjectEngine.Create(configuration, fileSystem, b => + { + RazorExtensions.Register(b); + }); + } } } } diff --git a/build/VSIX.targets b/build/VSIX.targets index 8027af296d..ae33c87310 100644 --- a/build/VSIX.targets +++ b/build/VSIX.targets @@ -105,7 +105,7 @@ /p:Configuration=$(Configuration); /p:FeatureBranchVersionSuffix=$(FeatureBranchVersionSuffix); /p:BuildNumber=$(BuildNumber); - /p:LangVersion=7.1" /> + /p:LangVersion=7.2" /> diff --git a/build/dependencies.props b/build/dependencies.props index fc5e7a6682..a79fd5d296 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -4,49 +4,52 @@ 0.10.13 - 2.2.0-preview2-20181019.2 - 2.2.0-rtm-35519 - 2.2.0-rtm-35519 - 2.2.0-rtm-35519 - 15.6.82 - 15.6.82 - 15.6.82 + 3.0.0-alpha1-20181017.7 + 3.0.0-alpha1-10549 + 3.0.0-alpha1-10549 + 3.0.0-alpha1-10549 + 15.8.166 + 15.8.166 + 15.8.166 2.8.0 2.8.0 - 2.2.0-rtm-35519 - 2.2.0-rtm-35519 - 2.1.0 - 2.2.0-rtm-35519 - 2.2.0-rtm-35519 - 2.2.0-rtm-35519 + 3.0.0-alpha1-10549 + 3.0.0-alpha1-10549 + 3.0.0-preview1-26907-05 + 3.0.0-alpha1-10549 + 3.0.0-alpha1-10549 + 3.0.0-alpha1-10549 2.0.9 2.1.3 2.2.0-preview3-27014-02 15.6.1 - 15.0.26606 - 15.6.161-preview - 15.6.161-preview - 7.10.6070 - 15.3.224 + 15.8.525 + 15.8.28010 + 16.0.142-g25b7188c54 + 16.0.142-g25b7188c54 + 16.0.142-g25b7188c54 + 7.10.6071 + 15.8.243 2.0.6142705 - 15.3.224 - 15.0.26606 - 10.0.30319 - 11.0.61030 - 12.0.30110 - 8.0.50727 - 9.0.30729 - 7.10.6071 - 15.6.161-preview + 15.8.243 + 15.8.28010 + 10.0.30320 + 11.0.61031 + 12.0.30111 + 8.0.50728 + 9.0.30730 + 7.10.6072 + 16.0.142-g25b7188c54 + 15.8.168 1.3.8 1.0.1 4.10.0 2.0.3 11.0.2 - 1.1.92 - 4.5.0 + 1.3.23 + 4.6.0-preview1-26907-04 4.3.0 - 4.5.0 + 4.6.0-preview1-26829-04 9.0.1 2.9.0-beta4-62911-02 2.9.0-beta4-62911-02 diff --git a/build/repo.props b/build/repo.props index def34f0b6f..fef2fdc0eb 100644 --- a/build/repo.props +++ b/build/repo.props @@ -21,7 +21,6 @@ Internal.AspNetCore.Universe.Lineup - 2.2.0-* https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json diff --git a/korebuild-lock.txt b/korebuild-lock.txt index 9bbcbd3257..bbb101c1a4 100644 --- a/korebuild-lock.txt +++ b/korebuild-lock.txt @@ -1,2 +1,2 @@ -version:2.2.0-preview2-20181019.2 -commithash:72ba316025aca165c09cb97b407965d944bad93f +version:3.0.0-alpha1-20181017.7 +commithash:f4082c290c6c7610e7cb9d787072004453fc175f diff --git a/korebuild.json b/korebuild.json index a8b81a48a2..b25cdff3c4 100644 --- a/korebuild.json +++ b/korebuild.json @@ -1,6 +1,6 @@ { - "$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/release/2.2/tools/korebuild.schema.json", - "channel": "release/2.2", + "$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/master/tools/korebuild.schema.json", + "channel": "master", "toolsets": { "visualstudio": { "required": false, diff --git a/src/Microsoft.AspNetCore.Razor.Language/DefaultRazorIntermediateNodeLoweringPhase.cs b/src/Microsoft.AspNetCore.Razor.Language/DefaultRazorIntermediateNodeLoweringPhase.cs index a711567547..762fd61d63 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/DefaultRazorIntermediateNodeLoweringPhase.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/DefaultRazorIntermediateNodeLoweringPhase.cs @@ -595,9 +595,9 @@ namespace Microsoft.AspNetCore.Razor.Language { if (span.Tokens.Count == 1) { - var token = span.Tokens[0] as HtmlToken; + var token = span.Tokens[0]; if (token != null && - token.Type == HtmlTokenType.Unknown && + token.Kind == SyntaxKind.Unknown && token.Content.Length == 0) { // We don't want to create IR nodes for marker tokens. diff --git a/src/Microsoft.AspNetCore.Razor.Language/DefaultRazorProjectFileSystem.cs b/src/Microsoft.AspNetCore.Razor.Language/DefaultRazorProjectFileSystem.cs index 2600ce5efe..9283088cd1 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/DefaultRazorProjectFileSystem.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/DefaultRazorProjectFileSystem.cs @@ -49,6 +49,10 @@ namespace Microsoft.AspNetCore.Razor.Language var absolutePath = NormalizeAndEnsureValidPath(path); var file = new FileInfo(absolutePath); + if (!absolutePath.StartsWith(absoluteBasePath)) + { + throw new InvalidOperationException($"The file '{file.FullName}' is not a descendent of the base path '{absoluteBasePath}'."); + } var relativePhysicalPath = file.FullName.Substring(absoluteBasePath.Length + 1); // Include leading separator var filePath = "/" + relativePhysicalPath.Replace(Path.DirectorySeparatorChar, '/'); diff --git a/src/Microsoft.AspNetCore.Razor.Language/DirectiveTokenEditHandler.cs b/src/Microsoft.AspNetCore.Razor.Language/DirectiveTokenEditHandler.cs index 308c274518..b4edccf638 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/DirectiveTokenEditHandler.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/DirectiveTokenEditHandler.cs @@ -4,18 +4,19 @@ using System; using System.Collections.Generic; using Microsoft.AspNetCore.Razor.Language.Legacy; +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; namespace Microsoft.AspNetCore.Razor.Language { internal class DirectiveTokenEditHandler : SpanEditHandler { - public DirectiveTokenEditHandler(Func> tokenizer) : base(tokenizer) + public DirectiveTokenEditHandler(Func> tokenizer) : base(tokenizer) { } protected override PartialParseResultInternal CanAcceptChange(Span target, SourceChange change) { - if (AcceptedCharacters == AcceptedCharactersInternal.NonWhiteSpace) + if (AcceptedCharacters == AcceptedCharactersInternal.NonWhitespace) { var originalText = change.GetOriginalText(target); var editedContent = change.GetEditedContent(target); diff --git a/src/Microsoft.AspNetCore.Razor.Language/Extensions/DesignTimeDirectiveTargetExtension.cs b/src/Microsoft.AspNetCore.Razor.Language/Extensions/DesignTimeDirectiveTargetExtension.cs index 316c255bfe..29cc438fbb 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Extensions/DesignTimeDirectiveTargetExtension.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Extensions/DesignTimeDirectiveTargetExtension.cs @@ -65,15 +65,17 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions } // {node.Content} __typeHelper = default({node.Content}); - - context.AddSourceMappingFor(node); - context.CodeWriter - .Write(node.Content) - .Write(" ") - .WriteStartAssignment(TypeHelper) - .Write("default(") - .Write(node.Content) - .WriteLine(");"); + using (context.CodeWriter.BuildLinePragma(node.Source)) + { + context.AddSourceMappingFor(node); + context.CodeWriter + .Write(node.Content) + .Write(" ") + .WriteStartAssignment(TypeHelper) + .Write("default(") + .Write(node.Content) + .WriteLine(");"); + } break; case DirectiveTokenKind.Member: @@ -86,16 +88,18 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions } // global::System.Object {node.content} = null; - - context.CodeWriter + using (context.CodeWriter.BuildLinePragma(node.Source)) + { + context.CodeWriter .Write("global::") .Write(typeof(object).FullName) .Write(" "); - context.AddSourceMappingFor(node); - context.CodeWriter - .Write(node.Content) - .WriteLine(" = null;"); + context.AddSourceMappingFor(node); + context.CodeWriter + .Write(node.Content) + .WriteLine(" = null;"); + } break; case DirectiveTokenKind.Namespace: @@ -108,46 +112,50 @@ namespace Microsoft.AspNetCore.Razor.Language.Extensions } // global::System.Object __typeHelper = nameof({node.Content}); - - context.CodeWriter + using (context.CodeWriter.BuildLinePragma(node.Source)) + { + context.CodeWriter .Write("global::") .Write(typeof(object).FullName) .Write(" ") .WriteStartAssignment(TypeHelper); - context.CodeWriter.Write("nameof("); + context.CodeWriter.Write("nameof("); - context.AddSourceMappingFor(node); - context.CodeWriter - .Write(node.Content) - .WriteLine(");"); + context.AddSourceMappingFor(node); + context.CodeWriter + .Write(node.Content) + .WriteLine(");"); + } break; case DirectiveTokenKind.String: // global::System.Object __typeHelper = "{node.Content}"; - - context.CodeWriter + using (context.CodeWriter.BuildLinePragma(node.Source)) + { + context.CodeWriter .Write("global::") .Write(typeof(object).FullName) .Write(" ") .WriteStartAssignment(TypeHelper); - if (node.Content.StartsWith("\"", StringComparison.Ordinal)) - { - context.AddSourceMappingFor(node); - context.CodeWriter.Write(node.Content); - } - else - { - context.CodeWriter.Write("\""); - context.AddSourceMappingFor(node); - context.CodeWriter - .Write(node.Content) - .Write("\""); - } + if (node.Content.StartsWith("\"", StringComparison.Ordinal)) + { + context.AddSourceMappingFor(node); + context.CodeWriter.Write(node.Content); + } + else + { + context.CodeWriter.Write("\""); + context.AddSourceMappingFor(node); + context.CodeWriter + .Write(node.Content) + .Write("\""); + } - context.CodeWriter.WriteLine(";"); + context.CodeWriter.WriteLine(";"); + } break; } context.CodeWriter.CurrentIndent = originalIndent; diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/AcceptedCharactersInternal.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/AcceptedCharactersInternal.cs index f6b658f769..9838a182b5 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/AcceptedCharactersInternal.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/AcceptedCharactersInternal.cs @@ -10,13 +10,13 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { None = 0, NewLine = 1, - WhiteSpace = 2, + Whitespace = 2, - NonWhiteSpace = 4, + NonWhitespace = 4, - AllWhiteSpace = NewLine | WhiteSpace, - Any = AllWhiteSpace | NonWhiteSpace, + AllWhitespace = NewLine | Whitespace, + Any = AllWhitespace | NonWhitespace, - AnyExceptNewline = NonWhiteSpace | WhiteSpace + AnyExceptNewline = NonWhitespace | Whitespace } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/AutoCompleteEditHandler.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/AutoCompleteEditHandler.cs index 3aecb29a52..a20dbddfb9 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/AutoCompleteEditHandler.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/AutoCompleteEditHandler.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; using Microsoft.Extensions.Internal; namespace Microsoft.AspNetCore.Razor.Language.Legacy @@ -11,18 +12,18 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { private static readonly int TypeHashCode = typeof(AutoCompleteEditHandler).GetHashCode(); - public AutoCompleteEditHandler(Func> tokenizer) + public AutoCompleteEditHandler(Func> tokenizer) : base(tokenizer) { } - public AutoCompleteEditHandler(Func> tokenizer, bool autoCompleteAtEndOfSpan) + public AutoCompleteEditHandler(Func> tokenizer, bool autoCompleteAtEndOfSpan) : this(tokenizer) { AutoCompleteAtEndOfSpan = autoCompleteAtEndOfSpan; } - public AutoCompleteEditHandler(Func> tokenizer, AcceptedCharactersInternal accepted) + public AutoCompleteEditHandler(Func> tokenizer, AcceptedCharactersInternal accepted) : base(tokenizer, accepted) { } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpCodeParser.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpCodeParser.cs index a75c983fec..1269709459 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpCodeParser.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpCodeParser.cs @@ -5,17 +5,18 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; namespace Microsoft.AspNetCore.Razor.Language.Legacy { - internal class CSharpCodeParser : TokenizerBackedParser + internal class CSharpCodeParser : TokenizerBackedParser { private static HashSet InvalidNonWhitespaceNameCharacters = new HashSet(new[] { '@', '!', '<', '/', '?', '[', '>', ']', '=', '"', '\'', '*' }); - private static readonly Func IsValidStatementSpacingToken = + private static readonly Func IsValidStatementSpacingToken = IsSpacingToken(includeNewLines: true, includeComments: true); internal static readonly DirectiveDescriptor AddTagHelperDirectiveDescriptor = DirectiveDescriptor.CreateDirective( @@ -102,7 +103,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy public bool IsNested { get; set; } - protected override bool TokenTypeEquals(CSharpTokenType x, CSharpTokenType y) => x == y; + protected override bool TokenKindEquals(SyntaxKind x, SyntaxKind y) => x == y; protected void MapDirectives(Action handler, params string[] directives) { @@ -161,16 +162,18 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy [Conditional("DEBUG")] internal void Assert(CSharpKeyword expectedKeyword) { - Debug.Assert(CurrentToken.Type == CSharpTokenType.Keyword && - CurrentToken.Keyword.HasValue && - CurrentToken.Keyword.Value == expectedKeyword); + var result = CSharpTokenizer.GetTokenKeyword(CurrentToken); + Debug.Assert(CurrentToken.Kind == SyntaxKind.Keyword && + result.HasValue && + result.Value == expectedKeyword); } protected internal bool At(CSharpKeyword keyword) { - return At(CSharpTokenType.Keyword) && - CurrentToken.Keyword.HasValue && - CurrentToken.Keyword.Value == keyword; + var result = CSharpTokenizer.GetTokenKeyword(CurrentToken); + return At(SyntaxKind.Keyword) && + result.HasValue && + result.Value == keyword; } protected internal bool AcceptIf(CSharpKeyword keyword) @@ -183,11 +186,11 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return false; } - protected static Func IsSpacingToken(bool includeNewLines, bool includeComments) + protected static Func IsSpacingToken(bool includeNewLines, bool includeComments) { - return token => token.Type == CSharpTokenType.WhiteSpace || - (includeNewLines && token.Type == CSharpTokenType.NewLine) || - (includeComments && token.Type == CSharpTokenType.Comment); + return token => token.Kind == SyntaxKind.Whitespace || + (includeNewLines && token.Kind == SyntaxKind.NewLine) || + (includeComments && token.Kind == SyntaxKind.CSharpComment); } public override void ParseBlock() @@ -209,24 +212,24 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy AcceptWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); var current = CurrentToken; - if (At(CSharpTokenType.StringLiteral) && + if (At(SyntaxKind.StringLiteral) && CurrentToken.Content.Length > 0 && CurrentToken.Content[0] == SyntaxConstants.TransitionCharacter) { - var split = Language.SplitToken(CurrentToken, 1, CSharpTokenType.Transition); + var split = Language.SplitToken(CurrentToken, 1, SyntaxKind.Transition); current = split.Item1; // Back up to the end of the transition Context.Source.Position -= split.Item2.Content.Length; NextToken(); } - else if (At(CSharpTokenType.Transition)) + else if (At(SyntaxKind.Transition)) { NextToken(); } // Accept "@" if we see it, but if we don't, that's OK. We assume we were started for a good reason - if (current.Type == CSharpTokenType.Transition) + if (current.Kind == SyntaxKind.Transition) { if (Span.Tokens.Count > 0) { @@ -251,9 +254,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy span.ChunkGenerator = new StatementChunkGenerator(); } - private void AtTransition(CSharpToken current) + private void AtTransition(SyntaxToken current) { - Debug.Assert(current.Type == CSharpTokenType.Transition); + Debug.Assert(current.Kind == SyntaxKind.Transition); Accept(current); Span.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.None; Span.ChunkGenerator = SpanChunkGenerator.Null; @@ -273,14 +276,14 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy // What type of block is this? if (!EndOfFile) { - if (CurrentToken.Type == CSharpTokenType.LeftParenthesis) + if (CurrentToken.Kind == SyntaxKind.LeftParenthesis) { Context.Builder.CurrentBlock.Type = BlockKindInternal.Expression; Context.Builder.CurrentBlock.ChunkGenerator = new ExpressionChunkGenerator(); ExplicitExpression(); return; } - else if (CurrentToken.Type == CSharpTokenType.Identifier) + else if (CurrentToken.Kind == SyntaxKind.Identifier) { if (TryGetDirectiveHandler(CurrentToken.Content, out var handler)) { @@ -306,7 +309,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return; } } - else if (CurrentToken.Type == CSharpTokenType.Keyword) + else if (CurrentToken.Kind == SyntaxKind.Keyword) { if (TryGetDirectiveHandler(CurrentToken.Content, out var handler)) { @@ -320,7 +323,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return; } } - else if (CurrentToken.Type == CSharpTokenType.LeftBrace) + else if (CurrentToken.Kind == SyntaxKind.LeftBrace) { VerbatimBlock(); return; @@ -337,9 +340,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy CurrentKeywords, acceptTrailingDot: IsNested) { - AcceptedCharacters = AcceptedCharactersInternal.NonWhiteSpace + AcceptedCharacters = AcceptedCharactersInternal.NonWhitespace }; - if (At(CSharpTokenType.WhiteSpace) || At(CSharpTokenType.NewLine)) + if (At(SyntaxKind.Whitespace) || At(SyntaxKind.NewLine)) { Context.ErrorSink.OnError( RazorDiagnosticFactory.CreateParsing_UnexpectedWhiteSpaceAtStartOfCodeBlock( @@ -369,7 +372,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy private void VerbatimBlock() { - Assert(CSharpTokenType.LeftBrace); + Assert(SyntaxKind.LeftBrace); var block = new Block(Resources.BlockName_Code, CurrentStart); AcceptAndMoveNext(); @@ -385,13 +388,13 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy Span.ChunkGenerator = new StatementChunkGenerator(); AddMarkerTokenIfNecessary(); - if (!At(CSharpTokenType.RightBrace)) + if (!At(SyntaxKind.RightBrace)) { editHandler.AutoCompleteString = "}"; } Output(SpanKindInternal.Code); - if (Optional(CSharpTokenType.RightBrace)) + if (Optional(SyntaxKind.RightBrace)) { // Set up the "}" span Span.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.None; @@ -401,8 +404,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy if (!IsNested) { EnsureCurrent(); - if (At(CSharpTokenType.NewLine) || - (At(CSharpTokenType.WhiteSpace) && NextIs(CSharpTokenType.NewLine))) + if (At(SyntaxKind.NewLine) || + (At(SyntaxKind.Whitespace) && NextIs(SyntaxKind.NewLine))) { Context.NullGenerateWhitespaceAndNewLine = true; } @@ -413,7 +416,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy private void ImplicitExpression() { - ImplicitExpression(AcceptedCharactersInternal.NonWhiteSpace); + ImplicitExpression(AcceptedCharactersInternal.NonWhitespace); } // Async implicit expressions include the "await" keyword and therefore need to allow spaces to @@ -456,13 +459,13 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { if (!EndOfFile) { - if (CurrentToken.Type == CSharpTokenType.LeftParenthesis || - CurrentToken.Type == CSharpTokenType.LeftBracket) + if (CurrentToken.Kind == SyntaxKind.LeftParenthesis || + CurrentToken.Kind == SyntaxKind.LeftBracket) { // If we end within "(", whitespace is fine Span.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.Any; - CSharpTokenType right; + SyntaxKind right; bool success; using (PushSpanConfig((span, prev) => @@ -471,13 +474,13 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy span.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.Any; })) { - right = Language.FlipBracket(CurrentToken.Type); + right = Language.FlipBracket(CurrentToken.Kind); success = Balance(BalancingModes.BacktrackOnFailure | BalancingModes.AllowCommentsAndTemplates); } if (!success) { - AcceptUntil(CSharpTokenType.LessThan); + AcceptUntil(SyntaxKind.LessThan); } if (At(right)) { @@ -488,22 +491,22 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } return MethodCallOrArrayIndex(acceptedCharacters); } - if (At(CSharpTokenType.QuestionMark)) + if (At(SyntaxKind.QuestionMark)) { var next = Lookahead(count: 1); if (next != null) { - if (next.Type == CSharpTokenType.Dot) + if (next.Kind == SyntaxKind.Dot) { // Accept null conditional dot operator (?.). AcceptAndMoveNext(); AcceptAndMoveNext(); // If the next piece after the ?. is a keyword or identifier then we want to continue. - return At(CSharpTokenType.Identifier) || At(CSharpTokenType.Keyword); + return At(SyntaxKind.Identifier) || At(SyntaxKind.Keyword); } - else if (next.Type == CSharpTokenType.LeftBracket) + else if (next.Kind == SyntaxKind.LeftBracket) { // We're at the ? for a null conditional bracket operator (?[). AcceptAndMoveNext(); @@ -513,12 +516,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } } } - else if (At(CSharpTokenType.Dot)) + else if (At(SyntaxKind.Dot)) { var dot = CurrentToken; if (NextToken()) { - if (At(CSharpTokenType.Identifier) || At(CSharpTokenType.Keyword)) + if (At(SyntaxKind.Identifier) || At(SyntaxKind.Keyword)) { // Accept the dot and return to the start Accept(dot); @@ -540,7 +543,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy Accept(dot); } } - else if (!At(CSharpTokenType.WhiteSpace) && !At(CSharpTokenType.NewLine)) + else if (!At(SyntaxKind.Whitespace) && !At(SyntaxKind.NewLine)) { PutCurrentBack(); } @@ -587,8 +590,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy private void CaptureWhitespaceAtEndOfCodeOnlyLine() { - var whitespace = ReadWhile(token => token.Type == CSharpTokenType.WhiteSpace); - if (At(CSharpTokenType.NewLine)) + var whitespace = ReadWhile(token => token.Kind == SyntaxKind.Whitespace); + if (At(SyntaxKind.NewLine)) { Accept(whitespace); AcceptAndMoveNext(); @@ -610,7 +613,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy private void ExplicitExpression() { var block = new Block(Resources.BlockName_ExplicitExpression, CurrentStart); - Assert(CSharpTokenType.LeftParenthesis); + Assert(SyntaxKind.LeftParenthesis); AcceptAndMoveNext(); Span.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.None; Span.ChunkGenerator = SpanChunkGenerator.Null; @@ -621,13 +624,13 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy BalancingModes.BacktrackOnFailure | BalancingModes.NoErrorOnFailure | BalancingModes.AllowCommentsAndTemplates, - CSharpTokenType.LeftParenthesis, - CSharpTokenType.RightParenthesis, + SyntaxKind.LeftParenthesis, + SyntaxKind.RightParenthesis, block.Start); if (!success) { - AcceptUntil(CSharpTokenType.LessThan); + AcceptUntil(SyntaxKind.LessThan); Context.ErrorSink.OnError( RazorDiagnosticFactory.CreateParsing_ExpectedEndOfBlockBeforeEOF( new SourceSpan(block.Start, contentLength: 1 /* ( */), block.Name, ")", "(")); @@ -636,13 +639,13 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy // If necessary, put an empty-content marker token here if (Span.Tokens.Count == 0) { - Accept(new CSharpToken(string.Empty, CSharpTokenType.Unknown)); + Accept(SyntaxFactory.Token(SyntaxKind.Unknown, string.Empty)); } // Output the content span and then capture the ")" Output(SpanKindInternal.Code); } - Optional(CSharpTokenType.RightParenthesis); + Optional(SyntaxKind.RightParenthesis); if (!EndOfFile) { PutCurrentBack(); @@ -702,7 +705,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy // No embedded transitions in C#, so ignore that param return allowTemplatesAndComments && ((Language.IsTransition(CurrentToken) - && NextIs(CSharpTokenType.LessThan, CSharpTokenType.Colon, CSharpTokenType.DoubleColon)) + && NextIs(SyntaxKind.LessThan, SyntaxKind.Colon, SyntaxKind.DoubleColon)) || Language.IsCommentStart(CurrentToken)); } @@ -783,12 +786,13 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy private void CaseStatement(bool topLevel) { - Assert(CSharpTokenType.Keyword); - Debug.Assert(CurrentToken.Keyword != null && - (CurrentToken.Keyword.Value == CSharpKeyword.Case || - CurrentToken.Keyword.Value == CSharpKeyword.Default)); - AcceptUntil(CSharpTokenType.Colon); - Optional(CSharpTokenType.Colon); + Assert(SyntaxKind.Keyword); + var result = CSharpTokenizer.GetTokenKeyword(CurrentToken); + Debug.Assert(result.HasValue && + (result.Value == CSharpKeyword.Case || + result.Value == CSharpKeyword.Default)); + AcceptUntil(SyntaxKind.Colon); + Optional(SyntaxKind.Colon); } private void DoStatement(bool topLevel) @@ -813,7 +817,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy Assert(CSharpKeyword.While); AcceptAndMoveNext(); AcceptWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); - if (AcceptCondition() && Optional(CSharpTokenType.Semicolon)) + if (AcceptCondition() && Optional(SyntaxKind.Semicolon)) { Span.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.None; } @@ -832,12 +836,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy AcceptAndMoveNext(); AcceptWhile(IsSpacingToken(includeNewLines: false, includeComments: true)); - if (At(CSharpTokenType.LeftParenthesis)) + if (At(SyntaxKind.LeftParenthesis)) { // using ( ==> Using Statement UsingStatement(block); } - else if (At(CSharpTokenType.Identifier) || At(CSharpKeyword.Static)) + else if (At(SyntaxKind.Identifier) || At(CSharpKeyword.Static)) { // using Identifier ==> Using Declaration if (!topLevel) @@ -865,16 +869,16 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy Context.Builder.CurrentBlock.Type = BlockKindInternal.Directive; var start = CurrentStart; - if (At(CSharpTokenType.Identifier)) + if (At(SyntaxKind.Identifier)) { // non-static using NamespaceOrTypeName(); var whitespace = ReadWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); - if (At(CSharpTokenType.Assign)) + if (At(SyntaxKind.Assign)) { // Alias Accept(whitespace); - Assert(CSharpTokenType.Assign); + Assert(SyntaxKind.Assign); AcceptAndMoveNext(); AcceptWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); @@ -904,7 +908,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy // Optional ";" if (EnsureCurrent()) { - Optional(CSharpTokenType.Semicolon); + Optional(SyntaxKind.Semicolon); } } @@ -919,16 +923,16 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy var expectingDot = false; var tokens = ReadWhile(token => { - var type = token.Type; - if ((expectingDot && type == CSharpTokenType.Dot) || - (!expectingDot && type == CSharpTokenType.Identifier)) + var type = token.Kind; + if ((expectingDot && type == SyntaxKind.Dot) || + (!expectingDot && type == SyntaxKind.Identifier)) { expectingDot = !expectingDot; return true; } - if (type != CSharpTokenType.WhiteSpace && - type != CSharpTokenType.NewLine) + if (type != SyntaxKind.Whitespace && + type != SyntaxKind.NewLine) { expectingDot = false; currentIdentifierLength += token.Content.Length; @@ -966,69 +970,69 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy protected bool NamespaceOrTypeName() { - if (Optional(CSharpTokenType.LeftParenthesis)) + if (Optional(SyntaxKind.LeftParenthesis)) { - while (!Optional(CSharpTokenType.RightParenthesis) && !EndOfFile) + while (!Optional(SyntaxKind.RightParenthesis) && !EndOfFile) { - Optional(CSharpTokenType.WhiteSpace); + Optional(SyntaxKind.Whitespace); if (!NamespaceOrTypeName()) { return false; } - Optional(CSharpTokenType.WhiteSpace); - Optional(CSharpTokenType.Identifier); - Optional(CSharpTokenType.WhiteSpace); - Optional(CSharpTokenType.Comma); + Optional(SyntaxKind.Whitespace); + Optional(SyntaxKind.Identifier); + Optional(SyntaxKind.Whitespace); + Optional(SyntaxKind.Comma); } - if (At(CSharpTokenType.WhiteSpace) && NextIs(CSharpTokenType.QuestionMark)) + if (At(SyntaxKind.Whitespace) && NextIs(SyntaxKind.QuestionMark)) { // Only accept the whitespace if we are going to consume the next token. AcceptAndMoveNext(); } - Optional(CSharpTokenType.QuestionMark); // Nullable + Optional(SyntaxKind.QuestionMark); // Nullable return true; } - else if (Optional(CSharpTokenType.Identifier) || Optional(CSharpTokenType.Keyword)) + else if (Optional(SyntaxKind.Identifier) || Optional(SyntaxKind.Keyword)) { - if (Optional(CSharpTokenType.DoubleColon)) + if (Optional(SyntaxKind.DoubleColon)) { - if (!Optional(CSharpTokenType.Identifier)) + if (!Optional(SyntaxKind.Identifier)) { - Optional(CSharpTokenType.Keyword); + Optional(SyntaxKind.Keyword); } } - if (At(CSharpTokenType.LessThan)) + if (At(SyntaxKind.LessThan)) { TypeArgumentList(); } - if (Optional(CSharpTokenType.Dot)) + if (Optional(SyntaxKind.Dot)) { NamespaceOrTypeName(); } - if (At(CSharpTokenType.WhiteSpace) && NextIs(CSharpTokenType.QuestionMark)) + if (At(SyntaxKind.Whitespace) && NextIs(SyntaxKind.QuestionMark)) { // Only accept the whitespace if we are going to consume the next token. AcceptAndMoveNext(); } - Optional(CSharpTokenType.QuestionMark); // Nullable + Optional(SyntaxKind.QuestionMark); // Nullable - if (At(CSharpTokenType.WhiteSpace) && NextIs(CSharpTokenType.LeftBracket)) + if (At(SyntaxKind.Whitespace) && NextIs(SyntaxKind.LeftBracket)) { // Only accept the whitespace if we are going to consume the next token. AcceptAndMoveNext(); } - while (At(CSharpTokenType.LeftBracket)) + while (At(SyntaxKind.LeftBracket)) { Balance(BalancingModes.None); - Optional(CSharpTokenType.RightBracket); + Optional(SyntaxKind.RightBracket); } return true; } @@ -1040,14 +1044,14 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy private void TypeArgumentList() { - Assert(CSharpTokenType.LessThan); + Assert(SyntaxKind.LessThan); Balance(BalancingModes.None); - Optional(CSharpTokenType.GreaterThan); + Optional(SyntaxKind.GreaterThan); } private void UsingStatement(Block block) { - Assert(CSharpTokenType.LeftParenthesis); + Assert(SyntaxKind.LeftParenthesis); // Parse condition if (AcceptCondition()) @@ -1159,12 +1163,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy if (!EndOfFile) { // Check for "{" to make sure we're at a block - if (!At(CSharpTokenType.LeftBrace)) + if (!At(SyntaxKind.LeftBrace)) { Context.ErrorSink.OnError( RazorDiagnosticFactory.CreateParsing_SingleLineControlFlowStatementsNotAllowed( new SourceSpan(CurrentStart, CurrentToken.Content.Length), - Language.GetSample(CSharpTokenType.LeftBrace), + Language.GetSample(SyntaxKind.LeftBrace), CurrentToken.Content)); } @@ -1175,7 +1179,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy private void UnconditionalBlock() { - Assert(CSharpTokenType.Keyword); + Assert(SyntaxKind.Keyword); var block = new Block(CurrentToken, CurrentStart); AcceptAndMoveNext(); AcceptWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); @@ -1219,7 +1223,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy private void ConditionalBlock(bool topLevel) { - Assert(CSharpTokenType.Keyword); + Assert(SyntaxKind.Keyword); var block = new Block(CurrentToken, CurrentStart); ConditionalBlock(block); if (topLevel) @@ -1243,16 +1247,16 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy private bool AcceptCondition() { - if (At(CSharpTokenType.LeftParenthesis)) + if (At(SyntaxKind.LeftParenthesis)) { var complete = Balance(BalancingModes.BacktrackOnFailure | BalancingModes.AllowCommentsAndTemplates); if (!complete) { - AcceptUntil(CSharpTokenType.NewLine); + AcceptUntil(SyntaxKind.NewLine); } else { - Optional(CSharpTokenType.RightParenthesis); + Optional(SyntaxKind.RightParenthesis); } return complete; } @@ -1280,16 +1284,16 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return; } - var type = CurrentToken.Type; + var type = CurrentToken.Kind; var loc = CurrentStart; // Both cases @: and @:: are triggered as markup, second colon in second case will be triggered as a plain text - var isSingleLineMarkup = type == CSharpTokenType.Transition && - (NextIs(CSharpTokenType.Colon, CSharpTokenType.DoubleColon)); + var isSingleLineMarkup = type == SyntaxKind.Transition && + (NextIs(SyntaxKind.Colon, SyntaxKind.DoubleColon)); var isMarkup = isSingleLineMarkup || - type == CSharpTokenType.LessThan || - (type == CSharpTokenType.Transition && NextIs(CSharpTokenType.LessThan)); + type == SyntaxKind.LessThan || + (type == SyntaxKind.Transition && NextIs(SyntaxKind.LessThan)); if (Context.DesignTimeMode || !isMarkup) { @@ -1321,7 +1325,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy if (isMarkup) { - if (type == CSharpTokenType.Transition && !isSingleLineMarkup) + if (type == SyntaxKind.Transition && !isSingleLineMarkup) { Context.ErrorSink.OnError( RazorDiagnosticFactory.CreateParsing_AtInCodeMustBeFollowedByColonParenOrIdentifierStart( @@ -1331,7 +1335,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy // Markup block Output(SpanKindInternal.Code); if (Context.DesignTimeMode && CurrentToken != null && - (CurrentToken.Type == CSharpTokenType.LessThan || CurrentToken.Type == CSharpTokenType.Transition)) + (CurrentToken.Kind == SyntaxKind.LessThan || CurrentToken.Kind == SyntaxKind.Transition)) { PutCurrentBack(); } @@ -1344,33 +1348,33 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } } - private void HandleStatement(Block block, CSharpTokenType type) + private void HandleStatement(Block block, SyntaxKind type) { switch (type) { - case CSharpTokenType.RazorCommentTransition: + case SyntaxKind.RazorCommentTransition: Output(SpanKindInternal.Code); RazorComment(); Statement(block); break; - case CSharpTokenType.LeftBrace: + case SyntaxKind.LeftBrace: // Verbatim Block block = block ?? new Block(Resources.BlockName_Code, CurrentStart); AcceptAndMoveNext(); CodeBlock(block); break; - case CSharpTokenType.Keyword: + case SyntaxKind.Keyword: // Keyword block HandleKeyword(false, StandardStatement); break; - case CSharpTokenType.Transition: + case SyntaxKind.Transition: // Embedded Expression block EmbeddedExpression(); break; - case CSharpTokenType.RightBrace: + case SyntaxKind.RightBrace: // Possible end of Code Block, just run the continuation break; - case CSharpTokenType.Comment: + case SyntaxKind.CSharpComment: AcceptAndMoveNext(); break; default: @@ -1383,11 +1387,11 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy private void EmbeddedExpression() { // First, verify the type of the block - Assert(CSharpTokenType.Transition); + Assert(SyntaxKind.Transition); var transition = CurrentToken; NextToken(); - if (At(CSharpTokenType.Transition)) + if (At(SyntaxKind.Transition)) { // Escaped "@" Output(SpanKindInternal.Code); @@ -1397,14 +1401,14 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy Span.ChunkGenerator = SpanChunkGenerator.Null; Output(SpanKindInternal.Code); - Assert(CSharpTokenType.Transition); + Assert(SyntaxKind.Transition); AcceptAndMoveNext(); StandardStatement(); } else { // Throw errors as necessary, but continue parsing - if (At(CSharpTokenType.LeftBrace)) + if (At(SyntaxKind.LeftBrace)) { Context.ErrorSink.OnError( RazorDiagnosticFactory.CreateParsing_UnexpectedNestedCodeBlock( @@ -1428,48 +1432,48 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { var bookmark = CurrentStart.AbsoluteIndex; var read = ReadWhile(token => - token.Type != CSharpTokenType.Semicolon && - token.Type != CSharpTokenType.RazorCommentTransition && - token.Type != CSharpTokenType.Transition && - token.Type != CSharpTokenType.LeftBrace && - token.Type != CSharpTokenType.LeftParenthesis && - token.Type != CSharpTokenType.LeftBracket && - token.Type != CSharpTokenType.RightBrace); + token.Kind != SyntaxKind.Semicolon && + token.Kind != SyntaxKind.RazorCommentTransition && + token.Kind != SyntaxKind.Transition && + token.Kind != SyntaxKind.LeftBrace && + token.Kind != SyntaxKind.LeftParenthesis && + token.Kind != SyntaxKind.LeftBracket && + token.Kind != SyntaxKind.RightBrace); - if (At(CSharpTokenType.LeftBrace) || - At(CSharpTokenType.LeftParenthesis) || - At(CSharpTokenType.LeftBracket)) + if (At(SyntaxKind.LeftBrace) || + At(SyntaxKind.LeftParenthesis) || + At(SyntaxKind.LeftBracket)) { Accept(read); if (Balance(BalancingModes.AllowCommentsAndTemplates | BalancingModes.BacktrackOnFailure)) { - Optional(CSharpTokenType.RightBrace); + Optional(SyntaxKind.RightBrace); } else { // Recovery - AcceptUntil(CSharpTokenType.LessThan, CSharpTokenType.RightBrace); + AcceptUntil(SyntaxKind.LessThan, SyntaxKind.RightBrace); return; } } - else if (At(CSharpTokenType.Transition) && (NextIs(CSharpTokenType.LessThan, CSharpTokenType.Colon))) + else if (At(SyntaxKind.Transition) && (NextIs(SyntaxKind.LessThan, SyntaxKind.Colon))) { Accept(read); Output(SpanKindInternal.Code); Template(); } - else if (At(CSharpTokenType.RazorCommentTransition)) + else if (At(SyntaxKind.RazorCommentTransition)) { Accept(read); RazorComment(); } - else if (At(CSharpTokenType.Semicolon)) + else if (At(SyntaxKind.Semicolon)) { Accept(read); AcceptAndMoveNext(); return; } - else if (At(CSharpTokenType.RightBrace)) + else if (At(SyntaxKind.RightBrace)) { Accept(read); return; @@ -1478,7 +1482,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { Context.Source.Position = bookmark; NextToken(); - AcceptUntil(CSharpTokenType.LessThan, CSharpTokenType.LeftBrace, CSharpTokenType.RightBrace); + AcceptUntil(SyntaxKind.LessThan, SyntaxKind.LeftBrace, SyntaxKind.RightBrace); return; } } @@ -1492,7 +1496,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy private void CodeBlock(bool acceptTerminatingBrace, Block block) { EnsureCurrent(); - while (!EndOfFile && !At(CSharpTokenType.RightBrace)) + while (!EndOfFile && !At(SyntaxKind.RightBrace)) { // Parse a statement, then return here Statement(); @@ -1507,7 +1511,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } else if (acceptTerminatingBrace) { - Assert(CSharpTokenType.RightBrace); + Assert(SyntaxKind.RightBrace); Span.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.None; AcceptAndMoveNext(); } @@ -1515,8 +1519,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy private void HandleKeyword(bool topLevel, Action fallback) { - Debug.Assert(CurrentToken.Type == CSharpTokenType.Keyword && CurrentToken.Keyword != null); - if (_keywordParsers.TryGetValue(CurrentToken.Keyword.Value, out var handler)) + var result = CSharpTokenizer.GetTokenKeyword(CurrentToken); + Debug.Assert(CurrentToken.Kind == SyntaxKind.Keyword && result.HasValue); + if (_keywordParsers.TryGetValue(result.Value, out var handler)) { handler(topLevel); } @@ -1526,12 +1531,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } } - private IEnumerable SkipToNextImportantToken() + private IEnumerable SkipToNextImportantToken() { while (!EndOfFile) { var whitespace = ReadWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); - if (At(CSharpTokenType.RazorCommentTransition)) + if (At(SyntaxKind.RazorCommentTransition)) { Accept(whitespace); Span.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.Any; @@ -1542,7 +1547,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return whitespace; } } - return Enumerable.Empty(); + return Enumerable.Empty(); } // Common code for Parsers, but FxCop REALLY doesn't like it in the base class.. moving it here for now. @@ -1644,8 +1649,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy for (var i = 0; i < descriptor.Tokens.Count; i++) { - if (!At(CSharpTokenType.WhiteSpace) && - !At(CSharpTokenType.NewLine) && + if (!At(SyntaxKind.Whitespace) && + !At(SyntaxKind.NewLine) && !EndOfFile) { Context.ErrorSink.OnError( @@ -1662,24 +1667,24 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy tokenDescriptor.Kind == DirectiveTokenKind.Type) { Span.ChunkGenerator = SpanChunkGenerator.Null; - Output(SpanKindInternal.Code, AcceptedCharactersInternal.WhiteSpace); + Output(SpanKindInternal.Code, AcceptedCharactersInternal.Whitespace); - if (EndOfFile || At(CSharpTokenType.NewLine)) + if (EndOfFile || At(SyntaxKind.NewLine)) { // Add a marker token to provide CSharp intellisense when we start typing the directive token. AddMarkerTokenIfNecessary(); Span.ChunkGenerator = new DirectiveTokenChunkGenerator(tokenDescriptor); Span.EditHandler = new DirectiveTokenEditHandler(Language.TokenizeString); - Output(SpanKindInternal.Code, AcceptedCharactersInternal.NonWhiteSpace); + Output(SpanKindInternal.Code, AcceptedCharactersInternal.NonWhitespace); } } else { Span.ChunkGenerator = SpanChunkGenerator.Null; - Output(SpanKindInternal.Markup, AcceptedCharactersInternal.WhiteSpace); + Output(SpanKindInternal.Markup, AcceptedCharactersInternal.Whitespace); } - if (tokenDescriptor.Optional && (EndOfFile || At(CSharpTokenType.NewLine))) + if (tokenDescriptor.Optional && (EndOfFile || At(SyntaxKind.NewLine))) { break; } @@ -1718,7 +1723,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy break; case DirectiveTokenKind.Member: - if (At(CSharpTokenType.Identifier)) + if (At(SyntaxKind.Identifier)) { AcceptAndMoveNext(); } @@ -1732,7 +1737,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy break; case DirectiveTokenKind.String: - if (At(CSharpTokenType.StringLiteral) && CurrentToken.Errors.Count == 0) + if (At(SyntaxKind.StringLiteral) && !CurrentToken.ContainsDiagnostics) { AcceptAndMoveNext(); } @@ -1748,7 +1753,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy Span.ChunkGenerator = new DirectiveTokenChunkGenerator(tokenDescriptor); Span.EditHandler = new DirectiveTokenEditHandler(Language.TokenizeString); - Output(SpanKindInternal.Code, AcceptedCharactersInternal.NonWhiteSpace); + Output(SpanKindInternal.Code, AcceptedCharactersInternal.NonWhitespace); } AcceptWhile(IsSpacingToken(includeNewLines: false, includeComments: true)); @@ -1757,15 +1762,15 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy switch (descriptor.Kind) { case DirectiveKind.SingleLine: - Output(SpanKindInternal.None, AcceptedCharactersInternal.WhiteSpace); + Output(SpanKindInternal.None, AcceptedCharactersInternal.Whitespace); - Optional(CSharpTokenType.Semicolon); + Optional(SyntaxKind.Semicolon); Span.ChunkGenerator = SpanChunkGenerator.Null; - Output(SpanKindInternal.MetaCode, AcceptedCharactersInternal.WhiteSpace); + Output(SpanKindInternal.MetaCode, AcceptedCharactersInternal.Whitespace); AcceptWhile(IsSpacingToken(includeNewLines: false, includeComments: true)); - if (At(CSharpTokenType.NewLine)) + if (At(SyntaxKind.NewLine)) { AcceptAndMoveNext(); } @@ -1782,11 +1787,11 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy // This should contain the optional whitespace after the optional semicolon and the new line. // Output as Markup as we want intellisense here. - Output(SpanKindInternal.Markup, AcceptedCharactersInternal.WhiteSpace); + Output(SpanKindInternal.Markup, AcceptedCharactersInternal.Whitespace); break; case DirectiveKind.RazorBlock: AcceptWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); - Output(SpanKindInternal.Markup, AcceptedCharactersInternal.AllWhiteSpace); + Output(SpanKindInternal.Markup, AcceptedCharactersInternal.AllWhitespace); ParseDirectiveBlock(descriptor, parseChildren: (startingBraceLocation) => { @@ -1811,12 +1816,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy break; case DirectiveKind.CodeBlock: AcceptWhile(IsSpacingToken(includeNewLines: true, includeComments: true)); - Output(SpanKindInternal.Markup, AcceptedCharactersInternal.AllWhiteSpace); + Output(SpanKindInternal.Markup, AcceptedCharactersInternal.AllWhitespace); ParseDirectiveBlock(descriptor, parseChildren: (startingBraceLocation) => { NextToken(); - Balance(BalancingModes.NoErrorOnFailure, CSharpTokenType.LeftBrace, CSharpTokenType.RightBrace, startingBraceLocation); + Balance(BalancingModes.NoErrorOnFailure, SyntaxKind.LeftBrace, SyntaxKind.RightBrace, startingBraceLocation); Span.ChunkGenerator = new StatementChunkGenerator(); var existingEditHandler = Span.EditHandler; Span.EditHandler = new CodeBlockEditHandler(Language.TokenizeString); @@ -1868,7 +1873,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy RazorDiagnosticFactory.CreateParsing_UnexpectedEOFAfterDirective( new SourceSpan(CurrentStart, contentLength: 1 /* { */), descriptor.Directive, "{")); } - else if (!At(CSharpTokenType.LeftBrace)) + else if (!At(SyntaxKind.LeftBrace)) { Context.ErrorSink.OnError( RazorDiagnosticFactory.CreateParsing_UnexpectedDirectiveLiteral( @@ -1886,7 +1891,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy parseChildren(startingBraceLocation); Span.ChunkGenerator = SpanChunkGenerator.Null; - if (!Optional(CSharpTokenType.RightBrace)) + if (!Optional(SyntaxKind.RightBrace)) { editHandler.AutoCompleteString = "}"; Context.ErrorSink.OnError( @@ -1982,7 +1987,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy // Ex: @addTagHelper "*, Microsoft.AspNetCore.CoolLibrary" // ^ ^ // Start End - if (Span.Tokens.Count == 1 && (Span.Tokens[0] as CSharpToken)?.Type == CSharpTokenType.StringLiteral) + if (Span.Tokens.Count == 1 && (Span.Tokens[0] as SyntaxToken)?.Kind == SyntaxKind.StringLiteral) { offset += Span.Tokens[0].Content.IndexOf(directiveText, StringComparison.Ordinal); @@ -2081,7 +2086,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy [Conditional("DEBUG")] protected void AssertDirective(string directive) { - Debug.Assert(CurrentToken.Type == CSharpTokenType.Identifier || CurrentToken.Type == CSharpTokenType.Keyword); + Debug.Assert(CurrentToken.Kind == SyntaxKind.Identifier || CurrentToken.Kind == SyntaxKind.Keyword); Debug.Assert(string.Equals(CurrentToken.Content, directive, StringComparison.Ordinal)); } @@ -2108,18 +2113,18 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy var keywordLength = Span.End.AbsoluteIndex - Span.Start.AbsoluteIndex; - var foundWhitespace = At(CSharpTokenType.WhiteSpace); + var foundWhitespace = At(SyntaxKind.Whitespace); // If we found whitespace then any content placed within the whitespace MAY cause a destructive change // to the document. We can't accept it. var acceptedCharacters = foundWhitespace ? AcceptedCharactersInternal.None : AcceptedCharactersInternal.AnyExceptNewline; Output(SpanKindInternal.MetaCode, acceptedCharacters); - AcceptWhile(CSharpTokenType.WhiteSpace); + AcceptWhile(SyntaxKind.Whitespace); Span.ChunkGenerator = SpanChunkGenerator.Null; Output(SpanKindInternal.Markup, acceptedCharacters); - if (EndOfFile || At(CSharpTokenType.NewLine)) + if (EndOfFile || At(SyntaxKind.NewLine)) { Context.ErrorSink.OnError( RazorDiagnosticFactory.CreateParsing_DirectiveMustHaveValue( @@ -2134,7 +2139,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy // Parse to the end of the line. Essentially accepts anything until end of line, comments, invalid code // etc. - AcceptUntil(CSharpTokenType.NewLine); + AcceptUntil(SyntaxKind.NewLine); // Pull out the value and remove whitespaces and optional quotes var rawValue = string.Concat(Span.Tokens.Select(s => s.Content)).Trim(); @@ -2170,7 +2175,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy Start = start; } - public Block(CSharpToken token, SourceLocation start) + public Block(SyntaxToken token, SourceLocation start) : this(GetName(token), start) { } @@ -2178,11 +2183,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy public string Name { get; set; } public SourceLocation Start { get; set; } - private static string GetName(CSharpToken token) + private static string GetName(SyntaxToken token) { - if (token.Type == CSharpTokenType.Keyword) + var result = CSharpTokenizer.GetTokenKeyword(token); + if (result.HasValue && token.Kind == SyntaxKind.Keyword) { - return CSharpLanguageCharacteristics.GetKeyword(token.Keyword.Value); + return CSharpLanguageCharacteristics.GetKeyword(result.Value); } return token.Content; } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpLanguageCharacteristics.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpLanguageCharacteristics.cs index 70d4bfeda1..e8144cbc0e 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpLanguageCharacteristics.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpLanguageCharacteristics.cs @@ -3,64 +3,65 @@ using System.Collections.Generic; using System.Diagnostics; +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; namespace Microsoft.AspNetCore.Razor.Language.Legacy { - internal class CSharpLanguageCharacteristics : LanguageCharacteristics + internal class CSharpLanguageCharacteristics : LanguageCharacteristics { private static readonly CSharpLanguageCharacteristics _instance = new CSharpLanguageCharacteristics(); - private static Dictionary _tokenSamples = new Dictionary() + private static Dictionary _tokenSamples = new Dictionary() { - { CSharpTokenType.Arrow, "->" }, - { CSharpTokenType.Minus, "-" }, - { CSharpTokenType.Decrement, "--" }, - { CSharpTokenType.MinusAssign, "-=" }, - { CSharpTokenType.NotEqual, "!=" }, - { CSharpTokenType.Not, "!" }, - { CSharpTokenType.Modulo, "%" }, - { CSharpTokenType.ModuloAssign, "%=" }, - { CSharpTokenType.AndAssign, "&=" }, - { CSharpTokenType.And, "&" }, - { CSharpTokenType.DoubleAnd, "&&" }, - { CSharpTokenType.LeftParenthesis, "(" }, - { CSharpTokenType.RightParenthesis, ")" }, - { CSharpTokenType.Star, "*" }, - { CSharpTokenType.MultiplyAssign, "*=" }, - { CSharpTokenType.Comma, "," }, - { CSharpTokenType.Dot, "." }, - { CSharpTokenType.Slash, "/" }, - { CSharpTokenType.DivideAssign, "/=" }, - { CSharpTokenType.DoubleColon, "::" }, - { CSharpTokenType.Colon, ":" }, - { CSharpTokenType.Semicolon, ";" }, - { CSharpTokenType.QuestionMark, "?" }, - { CSharpTokenType.NullCoalesce, "??" }, - { CSharpTokenType.RightBracket, "]" }, - { CSharpTokenType.LeftBracket, "[" }, - { CSharpTokenType.XorAssign, "^=" }, - { CSharpTokenType.Xor, "^" }, - { CSharpTokenType.LeftBrace, "{" }, - { CSharpTokenType.OrAssign, "|=" }, - { CSharpTokenType.DoubleOr, "||" }, - { CSharpTokenType.Or, "|" }, - { CSharpTokenType.RightBrace, "}" }, - { CSharpTokenType.Tilde, "~" }, - { CSharpTokenType.Plus, "+" }, - { CSharpTokenType.PlusAssign, "+=" }, - { CSharpTokenType.Increment, "++" }, - { CSharpTokenType.LessThan, "<" }, - { CSharpTokenType.LessThanEqual, "<=" }, - { CSharpTokenType.LeftShift, "<<" }, - { CSharpTokenType.LeftShiftAssign, "<<=" }, - { CSharpTokenType.Assign, "=" }, - { CSharpTokenType.Equals, "==" }, - { CSharpTokenType.GreaterThan, ">" }, - { CSharpTokenType.GreaterThanEqual, ">=" }, - { CSharpTokenType.RightShift, ">>" }, - { CSharpTokenType.RightShiftAssign, ">>=" }, - { CSharpTokenType.Hash, "#" }, - { CSharpTokenType.Transition, "@" }, + { SyntaxKind.Arrow, "->" }, + { SyntaxKind.Minus, "-" }, + { SyntaxKind.Decrement, "--" }, + { SyntaxKind.MinusAssign, "-=" }, + { SyntaxKind.NotEqual, "!=" }, + { SyntaxKind.Not, "!" }, + { SyntaxKind.Modulo, "%" }, + { SyntaxKind.ModuloAssign, "%=" }, + { SyntaxKind.AndAssign, "&=" }, + { SyntaxKind.And, "&" }, + { SyntaxKind.DoubleAnd, "&&" }, + { SyntaxKind.LeftParenthesis, "(" }, + { SyntaxKind.RightParenthesis, ")" }, + { SyntaxKind.Star, "*" }, + { SyntaxKind.MultiplyAssign, "*=" }, + { SyntaxKind.Comma, "," }, + { SyntaxKind.Dot, "." }, + { SyntaxKind.Slash, "/" }, + { SyntaxKind.DivideAssign, "/=" }, + { SyntaxKind.DoubleColon, "::" }, + { SyntaxKind.Colon, ":" }, + { SyntaxKind.Semicolon, ";" }, + { SyntaxKind.QuestionMark, "?" }, + { SyntaxKind.NullCoalesce, "??" }, + { SyntaxKind.RightBracket, "]" }, + { SyntaxKind.LeftBracket, "[" }, + { SyntaxKind.XorAssign, "^=" }, + { SyntaxKind.Xor, "^" }, + { SyntaxKind.LeftBrace, "{" }, + { SyntaxKind.OrAssign, "|=" }, + { SyntaxKind.DoubleOr, "||" }, + { SyntaxKind.Or, "|" }, + { SyntaxKind.RightBrace, "}" }, + { SyntaxKind.Tilde, "~" }, + { SyntaxKind.Plus, "+" }, + { SyntaxKind.PlusAssign, "+=" }, + { SyntaxKind.Increment, "++" }, + { SyntaxKind.LessThan, "<" }, + { SyntaxKind.LessThanEqual, "<=" }, + { SyntaxKind.LeftShift, "<<" }, + { SyntaxKind.LeftShiftAssign, "<<=" }, + { SyntaxKind.Assign, "=" }, + { SyntaxKind.Equals, "==" }, + { SyntaxKind.GreaterThan, ">" }, + { SyntaxKind.GreaterThanEqual, ">=" }, + { SyntaxKind.RightShift, ">>" }, + { SyntaxKind.RightShiftAssign, ">>=" }, + { SyntaxKind.Hash, "#" }, + { SyntaxKind.Transition, "@" }, }; protected CSharpLanguageCharacteristics() @@ -74,35 +75,35 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return new CSharpTokenizer(source); } - protected override CSharpToken CreateToken(string content, CSharpTokenType type, IReadOnlyList errors) + protected override SyntaxToken CreateToken(string content, SyntaxKind kind, IReadOnlyList errors) { - return new CSharpToken(content, type, errors); + return SyntaxFactory.Token(kind, content, errors); } - public override string GetSample(CSharpTokenType type) + public override string GetSample(SyntaxKind kind) { string sample; - if (!_tokenSamples.TryGetValue(type, out sample)) + if (!_tokenSamples.TryGetValue(kind, out sample)) { - switch (type) + switch (kind) { - case CSharpTokenType.Identifier: + case SyntaxKind.Identifier: return Resources.CSharpToken_Identifier; - case CSharpTokenType.Keyword: + case SyntaxKind.Keyword: return Resources.CSharpToken_Keyword; - case CSharpTokenType.IntegerLiteral: + case SyntaxKind.IntegerLiteral: return Resources.CSharpToken_IntegerLiteral; - case CSharpTokenType.NewLine: + case SyntaxKind.NewLine: return Resources.CSharpToken_Newline; - case CSharpTokenType.WhiteSpace: + case SyntaxKind.Whitespace: return Resources.CSharpToken_Whitespace; - case CSharpTokenType.Comment: + case SyntaxKind.CSharpComment: return Resources.CSharpToken_Comment; - case CSharpTokenType.RealLiteral: + case SyntaxKind.RealLiteral: return Resources.CSharpToken_RealLiteral; - case CSharpTokenType.CharacterLiteral: + case SyntaxKind.CharacterLiteral: return Resources.CSharpToken_CharacterLiteral; - case CSharpTokenType.StringLiteral: + case SyntaxKind.StringLiteral: return Resources.CSharpToken_StringLiteral; default: return Resources.Token_Unknown; @@ -111,59 +112,59 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return sample; } - public override CSharpToken CreateMarkerToken() + public override SyntaxToken CreateMarkerToken() { - return new CSharpToken(string.Empty, CSharpTokenType.Unknown); + return SyntaxFactory.Token(SyntaxKind.Unknown, string.Empty); } - public override CSharpTokenType GetKnownTokenType(KnownTokenType type) + public override SyntaxKind GetKnownTokenType(KnownTokenType type) { switch (type) { case KnownTokenType.Identifier: - return CSharpTokenType.Identifier; + return SyntaxKind.Identifier; case KnownTokenType.Keyword: - return CSharpTokenType.Keyword; + return SyntaxKind.Keyword; case KnownTokenType.NewLine: - return CSharpTokenType.NewLine; + return SyntaxKind.NewLine; case KnownTokenType.WhiteSpace: - return CSharpTokenType.WhiteSpace; + return SyntaxKind.Whitespace; case KnownTokenType.Transition: - return CSharpTokenType.Transition; + return SyntaxKind.Transition; case KnownTokenType.CommentStart: - return CSharpTokenType.RazorCommentTransition; + return SyntaxKind.RazorCommentTransition; case KnownTokenType.CommentStar: - return CSharpTokenType.RazorCommentStar; + return SyntaxKind.RazorCommentStar; case KnownTokenType.CommentBody: - return CSharpTokenType.RazorComment; + return SyntaxKind.RazorCommentLiteral; default: - return CSharpTokenType.Unknown; + return SyntaxKind.Unknown; } } - public override CSharpTokenType FlipBracket(CSharpTokenType bracket) + public override SyntaxKind FlipBracket(SyntaxKind bracket) { switch (bracket) { - case CSharpTokenType.LeftBrace: - return CSharpTokenType.RightBrace; - case CSharpTokenType.LeftBracket: - return CSharpTokenType.RightBracket; - case CSharpTokenType.LeftParenthesis: - return CSharpTokenType.RightParenthesis; - case CSharpTokenType.LessThan: - return CSharpTokenType.GreaterThan; - case CSharpTokenType.RightBrace: - return CSharpTokenType.LeftBrace; - case CSharpTokenType.RightBracket: - return CSharpTokenType.LeftBracket; - case CSharpTokenType.RightParenthesis: - return CSharpTokenType.LeftParenthesis; - case CSharpTokenType.GreaterThan: - return CSharpTokenType.LessThan; + case SyntaxKind.LeftBrace: + return SyntaxKind.RightBrace; + case SyntaxKind.LeftBracket: + return SyntaxKind.RightBracket; + case SyntaxKind.LeftParenthesis: + return SyntaxKind.RightParenthesis; + case SyntaxKind.LessThan: + return SyntaxKind.GreaterThan; + case SyntaxKind.RightBrace: + return SyntaxKind.LeftBrace; + case SyntaxKind.RightBracket: + return SyntaxKind.LeftBracket; + case SyntaxKind.RightParenthesis: + return SyntaxKind.LeftParenthesis; + case SyntaxKind.GreaterThan: + return SyntaxKind.LessThan; default: Debug.Fail("FlipBracket must be called with a bracket character"); - return CSharpTokenType.Unknown; + return SyntaxKind.Unknown; } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpToken.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpToken.cs deleted file mode 100644 index c928f0880e..0000000000 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpToken.cs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; - -namespace Microsoft.AspNetCore.Razor.Language.Legacy -{ - internal class CSharpToken : TokenBase - { - public CSharpToken( - string content, - CSharpTokenType type) - : base(content, type, RazorDiagnostic.EmptyArray) - { - if (content == null) - { - throw new ArgumentNullException(nameof(content)); - } - } - - public CSharpToken( - string content, - CSharpTokenType type, - IReadOnlyList errors) - : base(content, type, errors) - { - if (content == null) - { - throw new ArgumentNullException(nameof(content)); - } - } - - public CSharpKeyword? Keyword { get; set; } - - public override bool Equals(object obj) - { - var other = obj as CSharpToken; - return base.Equals(other) && - other.Keyword == Keyword; - } - - public override int GetHashCode() - { - // Hash code should include only immutable properties. - return base.GetHashCode(); - } - } -} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpTokenizer.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpTokenizer.cs index f819e98a3a..8d29ab0fea 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpTokenizer.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpTokenizer.cs @@ -5,12 +5,13 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; namespace Microsoft.AspNetCore.Razor.Language.Legacy { - internal class CSharpTokenizer : Tokenizer + internal class CSharpTokenizer : Tokenizer { - private Dictionary> _operatorHandlers; + private Dictionary> _operatorHandlers; private static readonly Dictionary _keywords = new Dictionary(StringComparer.Ordinal) { @@ -100,31 +101,31 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { base.CurrentState = StartState; - _operatorHandlers = new Dictionary>() + _operatorHandlers = new Dictionary>() { { '-', MinusOperator }, { '<', LessThanOperator }, { '>', GreaterThanOperator }, - { '&', CreateTwoCharOperatorHandler(CSharpTokenType.And, '=', CSharpTokenType.AndAssign, '&', CSharpTokenType.DoubleAnd) }, - { '|', CreateTwoCharOperatorHandler(CSharpTokenType.Or, '=', CSharpTokenType.OrAssign, '|', CSharpTokenType.DoubleOr) }, - { '+', CreateTwoCharOperatorHandler(CSharpTokenType.Plus, '=', CSharpTokenType.PlusAssign, '+', CSharpTokenType.Increment) }, - { '=', CreateTwoCharOperatorHandler(CSharpTokenType.Assign, '=', CSharpTokenType.Equals, '>', CSharpTokenType.GreaterThanEqual) }, - { '!', CreateTwoCharOperatorHandler(CSharpTokenType.Not, '=', CSharpTokenType.NotEqual) }, - { '%', CreateTwoCharOperatorHandler(CSharpTokenType.Modulo, '=', CSharpTokenType.ModuloAssign) }, - { '*', CreateTwoCharOperatorHandler(CSharpTokenType.Star, '=', CSharpTokenType.MultiplyAssign) }, - { ':', CreateTwoCharOperatorHandler(CSharpTokenType.Colon, ':', CSharpTokenType.DoubleColon) }, - { '?', CreateTwoCharOperatorHandler(CSharpTokenType.QuestionMark, '?', CSharpTokenType.NullCoalesce) }, - { '^', CreateTwoCharOperatorHandler(CSharpTokenType.Xor, '=', CSharpTokenType.XorAssign) }, - { '(', () => CSharpTokenType.LeftParenthesis }, - { ')', () => CSharpTokenType.RightParenthesis }, - { '{', () => CSharpTokenType.LeftBrace }, - { '}', () => CSharpTokenType.RightBrace }, - { '[', () => CSharpTokenType.LeftBracket }, - { ']', () => CSharpTokenType.RightBracket }, - { ',', () => CSharpTokenType.Comma }, - { ';', () => CSharpTokenType.Semicolon }, - { '~', () => CSharpTokenType.Tilde }, - { '#', () => CSharpTokenType.Hash } + { '&', CreateTwoCharOperatorHandler(SyntaxKind.And, '=', SyntaxKind.AndAssign, '&', SyntaxKind.DoubleAnd) }, + { '|', CreateTwoCharOperatorHandler(SyntaxKind.Or, '=', SyntaxKind.OrAssign, '|', SyntaxKind.DoubleOr) }, + { '+', CreateTwoCharOperatorHandler(SyntaxKind.Plus, '=', SyntaxKind.PlusAssign, '+', SyntaxKind.Increment) }, + { '=', CreateTwoCharOperatorHandler(SyntaxKind.Assign, '=', SyntaxKind.Equals, '>', SyntaxKind.GreaterThanEqual) }, + { '!', CreateTwoCharOperatorHandler(SyntaxKind.Not, '=', SyntaxKind.NotEqual) }, + { '%', CreateTwoCharOperatorHandler(SyntaxKind.Modulo, '=', SyntaxKind.ModuloAssign) }, + { '*', CreateTwoCharOperatorHandler(SyntaxKind.Star, '=', SyntaxKind.MultiplyAssign) }, + { ':', CreateTwoCharOperatorHandler(SyntaxKind.Colon, ':', SyntaxKind.DoubleColon) }, + { '?', CreateTwoCharOperatorHandler(SyntaxKind.QuestionMark, '?', SyntaxKind.NullCoalesce) }, + { '^', CreateTwoCharOperatorHandler(SyntaxKind.Xor, '=', SyntaxKind.XorAssign) }, + { '(', () => SyntaxKind.LeftParenthesis }, + { ')', () => SyntaxKind.RightParenthesis }, + { '{', () => SyntaxKind.LeftBrace }, + { '}', () => SyntaxKind.RightBrace }, + { '[', () => SyntaxKind.LeftBracket }, + { ']', () => SyntaxKind.RightBracket }, + { ',', () => SyntaxKind.Comma }, + { ';', () => SyntaxKind.Semicolon }, + { '~', () => SyntaxKind.Tilde }, + { '#', () => SyntaxKind.Hash } }; } @@ -132,11 +133,11 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy private new CSharpTokenizerState? CurrentState => (CSharpTokenizerState?)base.CurrentState; - public override CSharpTokenType RazorCommentType => CSharpTokenType.RazorComment; + public override SyntaxKind RazorCommentKind => SyntaxKind.RazorCommentLiteral; - public override CSharpTokenType RazorCommentTransitionType => CSharpTokenType.RazorCommentTransition; + public override SyntaxKind RazorCommentTransitionKind => SyntaxKind.RazorCommentTransition; - public override CSharpTokenType RazorCommentStarType => CSharpTokenType.RazorCommentStar; + public override SyntaxKind RazorCommentStarKind => SyntaxKind.RazorCommentStar; protected override StateResult Dispatch() { @@ -169,7 +170,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } // Optimize memory allocation by returning constants for the most frequent cases - protected override string GetTokenContent(CSharpTokenType type) + protected override string GetTokenContent(SyntaxKind type) { var tokenLength = Buffer.Length; @@ -177,7 +178,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { switch (type) { - case CSharpTokenType.IntegerLiteral: + case SyntaxKind.IntegerLiteral: switch (Buffer[0]) { case '0': @@ -202,13 +203,13 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return "9"; } break; - case CSharpTokenType.NewLine: + case SyntaxKind.NewLine: if (Buffer[0] == '\n') { return "\n"; } break; - case CSharpTokenType.WhiteSpace: + case SyntaxKind.Whitespace: if (Buffer[0] == ' ') { return " "; @@ -218,57 +219,57 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return "\t"; } break; - case CSharpTokenType.Minus: + case SyntaxKind.Minus: return "-"; - case CSharpTokenType.Not: + case SyntaxKind.Not: return "!"; - case CSharpTokenType.Modulo: + case SyntaxKind.Modulo: return "%"; - case CSharpTokenType.And: + case SyntaxKind.And: return "&"; - case CSharpTokenType.LeftParenthesis: + case SyntaxKind.LeftParenthesis: return "("; - case CSharpTokenType.RightParenthesis: + case SyntaxKind.RightParenthesis: return ")"; - case CSharpTokenType.Star: + case SyntaxKind.Star: return "*"; - case CSharpTokenType.Comma: + case SyntaxKind.Comma: return ","; - case CSharpTokenType.Dot: + case SyntaxKind.Dot: return "."; - case CSharpTokenType.Slash: + case SyntaxKind.Slash: return "/"; - case CSharpTokenType.Colon: + case SyntaxKind.Colon: return ":"; - case CSharpTokenType.Semicolon: + case SyntaxKind.Semicolon: return ";"; - case CSharpTokenType.QuestionMark: + case SyntaxKind.QuestionMark: return "?"; - case CSharpTokenType.RightBracket: + case SyntaxKind.RightBracket: return "]"; - case CSharpTokenType.LeftBracket: + case SyntaxKind.LeftBracket: return "["; - case CSharpTokenType.Xor: + case SyntaxKind.Xor: return "^"; - case CSharpTokenType.LeftBrace: + case SyntaxKind.LeftBrace: return "{"; - case CSharpTokenType.Or: + case SyntaxKind.Or: return "|"; - case CSharpTokenType.RightBrace: + case SyntaxKind.RightBrace: return "}"; - case CSharpTokenType.Tilde: + case SyntaxKind.Tilde: return "~"; - case CSharpTokenType.Plus: + case SyntaxKind.Plus: return "+"; - case CSharpTokenType.LessThan: + case SyntaxKind.LessThan: return "<"; - case CSharpTokenType.Assign: + case SyntaxKind.Assign: return "="; - case CSharpTokenType.GreaterThan: + case SyntaxKind.GreaterThan: return ">"; - case CSharpTokenType.Hash: + case SyntaxKind.Hash: return "#"; - case CSharpTokenType.Transition: + case SyntaxKind.Transition: return "@"; } @@ -277,53 +278,53 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { switch (type) { - case CSharpTokenType.NewLine: + case SyntaxKind.NewLine: return "\r\n"; - case CSharpTokenType.Arrow: + case SyntaxKind.Arrow: return "->"; - case CSharpTokenType.Decrement: + case SyntaxKind.Decrement: return "--"; - case CSharpTokenType.MinusAssign: + case SyntaxKind.MinusAssign: return "-="; - case CSharpTokenType.NotEqual: + case SyntaxKind.NotEqual: return "!="; - case CSharpTokenType.ModuloAssign: + case SyntaxKind.ModuloAssign: return "%="; - case CSharpTokenType.AndAssign: + case SyntaxKind.AndAssign: return "&="; - case CSharpTokenType.DoubleAnd: + case SyntaxKind.DoubleAnd: return "&&"; - case CSharpTokenType.MultiplyAssign: + case SyntaxKind.MultiplyAssign: return "*="; - case CSharpTokenType.DivideAssign: + case SyntaxKind.DivideAssign: return "/="; - case CSharpTokenType.DoubleColon: + case SyntaxKind.DoubleColon: return "::"; - case CSharpTokenType.NullCoalesce: + case SyntaxKind.NullCoalesce: return "??"; - case CSharpTokenType.XorAssign: + case SyntaxKind.XorAssign: return "^="; - case CSharpTokenType.OrAssign: + case SyntaxKind.OrAssign: return "|="; - case CSharpTokenType.DoubleOr: + case SyntaxKind.DoubleOr: return "||"; - case CSharpTokenType.PlusAssign: + case SyntaxKind.PlusAssign: return "+="; - case CSharpTokenType.Increment: + case SyntaxKind.Increment: return "++"; - case CSharpTokenType.LessThanEqual: + case SyntaxKind.LessThanEqual: return "<="; - case CSharpTokenType.LeftShift: + case SyntaxKind.LeftShift: return "<<"; - case CSharpTokenType.Equals: + case SyntaxKind.Equals: return "=="; - case CSharpTokenType.GreaterThanEqual: + case SyntaxKind.GreaterThanEqual: if (Buffer[0] == '=') { return "=>"; } return ">="; - case CSharpTokenType.RightShift: + case SyntaxKind.RightShift: return ">>"; @@ -333,9 +334,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { switch (type) { - case CSharpTokenType.LeftShiftAssign: + case SyntaxKind.LeftShiftAssign: return "<<="; - case CSharpTokenType.RightShiftAssign: + case SyntaxKind.RightShiftAssign: return ">>="; } } @@ -343,9 +344,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return base.GetTokenContent(type); } - protected override CSharpToken CreateToken(string content, CSharpTokenType type, IReadOnlyList errors) + protected override SyntaxToken CreateToken(string content, SyntaxKind kind, IReadOnlyList errors) { - return new CSharpToken(content, type, errors); + return SyntaxFactory.Token(kind, content, errors); } private StateResult Data() @@ -359,13 +360,13 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { TakeCurrent(); } - return Stay(EndToken(CSharpTokenType.NewLine)); + return Stay(EndToken(SyntaxKind.NewLine)); } else if (ParserHelpers.IsWhitespace(CurrentCharacter)) { // CSharp Spec §2.3.3 TakeUntil(c => !ParserHelpers.IsWhitespace(c)); - return Stay(EndToken(CSharpTokenType.WhiteSpace)); + return Stay(EndToken(SyntaxKind.Whitespace)); } else if (IsIdentifierStart(CurrentCharacter)) { @@ -390,7 +391,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { return RealLiteral(); } - return Stay(Single(CSharpTokenType.Dot)); + return Stay(Single(SyntaxKind.Dot)); case '/': TakeCurrent(); if (CurrentCharacter == '/') @@ -406,11 +407,11 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy else if (CurrentCharacter == '=') { TakeCurrent(); - return Stay(EndToken(CSharpTokenType.DivideAssign)); + return Stay(EndToken(SyntaxKind.DivideAssign)); } else { - return Stay(EndToken(CSharpTokenType.Slash)); + return Stay(EndToken(SyntaxKind.Slash)); } default: return Stay(EndToken(Operator())); @@ -429,78 +430,78 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { return Transition( CSharpTokenizerState.AfterRazorCommentTransition, - EndToken(CSharpTokenType.RazorCommentTransition)); + EndToken(SyntaxKind.RazorCommentTransition)); } else if (CurrentCharacter == '@') { // Could be escaped comment transition return Transition( CSharpTokenizerState.EscapedRazorCommentTransition, - EndToken(CSharpTokenType.Transition)); + EndToken(SyntaxKind.Transition)); } - return Stay(EndToken(CSharpTokenType.Transition)); + return Stay(EndToken(SyntaxKind.Transition)); } private StateResult EscapedRazorCommentTransition() { TakeCurrent(); - return Transition(CSharpTokenizerState.Data, EndToken(CSharpTokenType.Transition)); + return Transition(CSharpTokenizerState.Data, EndToken(SyntaxKind.Transition)); } - private CSharpTokenType Operator() + private SyntaxKind Operator() { var first = CurrentCharacter; TakeCurrent(); - Func handler; + Func handler; if (_operatorHandlers.TryGetValue(first, out handler)) { return handler(); } - return CSharpTokenType.Unknown; + return SyntaxKind.Unknown; } - private CSharpTokenType LessThanOperator() + private SyntaxKind LessThanOperator() { if (CurrentCharacter == '=') { TakeCurrent(); - return CSharpTokenType.LessThanEqual; + return SyntaxKind.LessThanEqual; } - return CSharpTokenType.LessThan; + return SyntaxKind.LessThan; } - private CSharpTokenType GreaterThanOperator() + private SyntaxKind GreaterThanOperator() { if (CurrentCharacter == '=') { TakeCurrent(); - return CSharpTokenType.GreaterThanEqual; + return SyntaxKind.GreaterThanEqual; } - return CSharpTokenType.GreaterThan; + return SyntaxKind.GreaterThan; } - private CSharpTokenType MinusOperator() + private SyntaxKind MinusOperator() { if (CurrentCharacter == '>') { TakeCurrent(); - return CSharpTokenType.Arrow; + return SyntaxKind.Arrow; } else if (CurrentCharacter == '-') { TakeCurrent(); - return CSharpTokenType.Decrement; + return SyntaxKind.Decrement; } else if (CurrentCharacter == '=') { TakeCurrent(); - return CSharpTokenType.MinusAssign; + return SyntaxKind.MinusAssign; } - return CSharpTokenType.Minus; + return SyntaxKind.Minus; } - private Func CreateTwoCharOperatorHandler(CSharpTokenType typeIfOnlyFirst, char second, CSharpTokenType typeIfBoth) + private Func CreateTwoCharOperatorHandler(SyntaxKind typeIfOnlyFirst, char second, SyntaxKind typeIfBoth) { return () => { @@ -513,7 +514,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy }; } - private Func CreateTwoCharOperatorHandler(CSharpTokenType typeIfOnlyFirst, char option1, CSharpTokenType typeIfOption1, char option2, CSharpTokenType typeIfOption2) + private Func CreateTwoCharOperatorHandler(SyntaxKind typeIfOnlyFirst, char option1, SyntaxKind typeIfOption1, char option2, SyntaxKind typeIfOption2) { return () => { @@ -550,14 +551,14 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy RazorDiagnosticFactory.CreateParsing_UnterminatedStringLiteral( new SourceSpan(CurrentStart, contentLength: 1 /* end of file */))); } - return Transition(CSharpTokenizerState.Data, EndToken(CSharpTokenType.StringLiteral)); + return Transition(CSharpTokenizerState.Data, EndToken(SyntaxKind.StringLiteral)); } - private StateResult QuotedCharacterLiteral() => QuotedLiteral('\'', CSharpTokenType.CharacterLiteral); + private StateResult QuotedCharacterLiteral() => QuotedLiteral('\'', SyntaxKind.CharacterLiteral); - private StateResult QuotedStringLiteral() => QuotedLiteral('\"', CSharpTokenType.StringLiteral); + private StateResult QuotedStringLiteral() => QuotedLiteral('\"', SyntaxKind.StringLiteral); - private StateResult QuotedLiteral(char quote, CSharpTokenType literalType) + private StateResult QuotedLiteral(char quote, SyntaxKind literalType) { TakeUntil(c => c == '\\' || c == quote || ParserHelpers.IsNewLine(c)); if (CurrentCharacter == '\\') @@ -594,7 +595,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy RazorDiagnosticFactory.CreateParsing_BlockCommentNotTerminated( new SourceSpan(CurrentStart, contentLength: 1 /* end of file */))); - return Transition(CSharpTokenizerState.Data, EndToken(CSharpTokenType.Comment)); + return Transition(CSharpTokenizerState.Data, EndToken(SyntaxKind.CSharpComment)); } if (CurrentCharacter == '*') { @@ -602,7 +603,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy if (CurrentCharacter == '/') { TakeCurrent(); - return Transition(CSharpTokenizerState.Data, EndToken(CSharpTokenType.Comment)); + return Transition(CSharpTokenizerState.Data, EndToken(SyntaxKind.CSharpComment)); } } return Stay(); @@ -612,7 +613,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy private StateResult SingleLineComment() { TakeUntil(c => ParserHelpers.IsNewLine(c)); - return Stay(EndToken(CSharpTokenType.Comment)); + return Stay(EndToken(SyntaxKind.CSharpComment)); } // CSharp Spec §2.4.4 @@ -632,7 +633,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { TakeUntil(c => !IsHexDigit(c)); TakeIntegerSuffix(); - return Stay(EndToken(CSharpTokenType.IntegerLiteral)); + return Stay(EndToken(SyntaxKind.IntegerLiteral)); } private StateResult DecimalLiteral() @@ -650,7 +651,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy else { TakeIntegerSuffix(); - return Stay(EndToken(CSharpTokenType.IntegerLiteral)); + return Stay(EndToken(SyntaxKind.IntegerLiteral)); } } @@ -669,7 +670,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { TakeCurrent(); } - return Stay(EndToken(CSharpTokenType.RealLiteral)); + return Stay(EndToken(SyntaxKind.RealLiteral)); } // CSharp Spec §2.4.4.3 @@ -708,21 +709,18 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy Debug.Assert(IsIdentifierStart(CurrentCharacter)); TakeCurrent(); TakeUntil(c => !IsIdentifierPart(c)); - CSharpToken token = null; + SyntaxToken token = null; if (HaveContent) { CSharpKeyword keyword; - var type = CSharpTokenType.Identifier; + var type = SyntaxKind.Identifier; var tokenContent = Buffer.ToString(); if (_keywords.TryGetValue(tokenContent, out keyword)) { - type = CSharpTokenType.Keyword; + type = SyntaxKind.Keyword; } - - token = new CSharpToken(tokenContent, type) - { - Keyword = type == CSharpTokenType.Keyword ? (CSharpKeyword?)keyword : null, - }; + + token = SyntaxFactory.Token(type, tokenContent); Buffer.Clear(); CurrentErrors.Clear(); @@ -736,7 +734,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return Transition((int)state, result: null); } - private StateResult Transition(CSharpTokenizerState state, CSharpToken result) + private StateResult Transition(CSharpTokenizerState state, SyntaxToken result) { return Transition((int)state, result); } @@ -780,6 +778,16 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return (value >= '0' && value <= '9') || (value >= 'A' && value <= 'F') || (value >= 'a' && value <= 'f'); } + internal static CSharpKeyword? GetTokenKeyword(SyntaxToken token) + { + if (token != null && _keywords.TryGetValue(token.Content, out var keyword)) + { + return keyword; + } + + return null; + } + private enum CSharpTokenizerState { Data, diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/CodeBlockEditHandler.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/CodeBlockEditHandler.cs index d5ce71c43e..89d1f3d6c6 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/CodeBlockEditHandler.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/CodeBlockEditHandler.cs @@ -4,12 +4,13 @@ using System; using System.Collections.Generic; using System.Globalization; +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; namespace Microsoft.AspNetCore.Razor.Language.Legacy { internal class CodeBlockEditHandler : SpanEditHandler { - public CodeBlockEditHandler(Func> tokenizer) : base(tokenizer) + public CodeBlockEditHandler(Func> tokenizer) : base(tokenizer) { } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/DirectiveCSharpTokenizer.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/DirectiveCSharpTokenizer.cs index a9befaa302..59224e709f 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/DirectiveCSharpTokenizer.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/DirectiveCSharpTokenizer.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Diagnostics; +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; namespace Microsoft.AspNetCore.Razor.Language.Legacy { @@ -17,11 +18,11 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy protected override StateResult Dispatch() { var result = base.Dispatch(); - if (result.Result != null && !_visitedFirstTokenStart && IsValidTokenType(result.Result.Type)) + if (result.Result != null && !_visitedFirstTokenStart && IsValidTokenType(result.Result.Kind)) { _visitedFirstTokenStart = true; } - else if (result.Result != null && _visitedFirstTokenStart && result.Result.Type == CSharpTokenType.NewLine) + else if (result.Result != null && _visitedFirstTokenStart && result.Result.Kind == SyntaxKind.NewLine) { _visitedFirstTokenLineEnd = true; } @@ -29,7 +30,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return result; } - public override CSharpToken NextToken() + public override SyntaxToken NextToken() { // Post-Condition: Buffer should be empty at the start of Next() Debug.Assert(Buffer.Length == 0); @@ -48,15 +49,15 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return token; } - private bool IsValidTokenType(CSharpTokenType type) + private bool IsValidTokenType(SyntaxKind kind) { - return type != CSharpTokenType.WhiteSpace && - type != CSharpTokenType.NewLine && - type != CSharpTokenType.Comment && - type != CSharpTokenType.RazorComment && - type != CSharpTokenType.RazorCommentStar && - type != CSharpTokenType.RazorCommentTransition && - type != CSharpTokenType.Transition; + return kind != SyntaxKind.Whitespace && + kind != SyntaxKind.NewLine && + kind != SyntaxKind.CSharpComment && + kind != SyntaxKind.RazorCommentLiteral && + kind != SyntaxKind.RazorCommentStar && + kind != SyntaxKind.RazorCommentTransition && + kind != SyntaxKind.Transition; } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/DirectiveHtmlTokenizer.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/DirectiveHtmlTokenizer.cs index 034977c758..4921c8aa1e 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/DirectiveHtmlTokenizer.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/DirectiveHtmlTokenizer.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Diagnostics; +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; namespace Microsoft.AspNetCore.Razor.Language.Legacy { @@ -16,7 +17,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy protected override StateResult Dispatch() { var result = base.Dispatch(); - if (result.Result != null && IsValidTokenType(result.Result.Type)) + if (result.Result != null && IsValidTokenType(result.Result.Kind)) { _visitedFirstTokenStart = true; } @@ -24,7 +25,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return result; } - public override HtmlToken NextToken() + public override SyntaxToken NextToken() { // Post-Condition: Buffer should be empty at the start of Next() Debug.Assert(Buffer.Length == 0); @@ -43,14 +44,14 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return token; } - private bool IsValidTokenType(HtmlTokenType type) + private bool IsValidTokenType(SyntaxKind kind) { - return type != HtmlTokenType.WhiteSpace && - type != HtmlTokenType.NewLine && - type != HtmlTokenType.RazorComment && - type != HtmlTokenType.RazorCommentStar && - type != HtmlTokenType.RazorCommentTransition && - type != HtmlTokenType.Transition; + return kind != SyntaxKind.Whitespace && + kind != SyntaxKind.NewLine && + kind != SyntaxKind.RazorCommentLiteral && + kind != SyntaxKind.RazorCommentStar && + kind != SyntaxKind.RazorCommentTransition && + kind != SyntaxKind.Transition; } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlLanguageCharacteristics.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlLanguageCharacteristics.cs index 096ae84dc0..c404183ed0 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlLanguageCharacteristics.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlLanguageCharacteristics.cs @@ -3,10 +3,11 @@ using System.Collections.Generic; using System.Diagnostics; +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; namespace Microsoft.AspNetCore.Razor.Language.Legacy { - internal class HtmlLanguageCharacteristics : LanguageCharacteristics + internal class HtmlLanguageCharacteristics : LanguageCharacteristics { private static readonly HtmlLanguageCharacteristics _instance = new HtmlLanguageCharacteristics(); @@ -19,47 +20,47 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy get { return _instance; } } - public override string GetSample(HtmlTokenType type) + public override string GetSample(SyntaxKind type) { switch (type) { - case HtmlTokenType.Text: + case SyntaxKind.Text: return Resources.HtmlToken_Text; - case HtmlTokenType.WhiteSpace: + case SyntaxKind.Whitespace: return Resources.HtmlToken_WhiteSpace; - case HtmlTokenType.NewLine: + case SyntaxKind.NewLine: return Resources.HtmlToken_NewLine; - case HtmlTokenType.OpenAngle: + case SyntaxKind.OpenAngle: return "<"; - case HtmlTokenType.Bang: + case SyntaxKind.Bang: return "!"; - case HtmlTokenType.ForwardSlash: + case SyntaxKind.ForwardSlash: return "/"; - case HtmlTokenType.QuestionMark: + case SyntaxKind.QuestionMark: return "?"; - case HtmlTokenType.DoubleHyphen: + case SyntaxKind.DoubleHyphen: return "--"; - case HtmlTokenType.LeftBracket: + case SyntaxKind.LeftBracket: return "["; - case HtmlTokenType.CloseAngle: + case SyntaxKind.CloseAngle: return ">"; - case HtmlTokenType.RightBracket: + case SyntaxKind.RightBracket: return "]"; - case HtmlTokenType.Equals: + case SyntaxKind.Equals: return "="; - case HtmlTokenType.DoubleQuote: + case SyntaxKind.DoubleQuote: return "\""; - case HtmlTokenType.SingleQuote: + case SyntaxKind.SingleQuote: return "'"; - case HtmlTokenType.Transition: + case SyntaxKind.Transition: return "@"; - case HtmlTokenType.Colon: + case SyntaxKind.Colon: return ":"; - case HtmlTokenType.RazorComment: + case SyntaxKind.RazorCommentLiteral: return Resources.HtmlToken_RazorComment; - case HtmlTokenType.RazorCommentStar: + case SyntaxKind.RazorCommentStar: return "*"; - case HtmlTokenType.RazorCommentTransition: + case SyntaxKind.RazorCommentTransition: return "@"; default: return Resources.Token_Unknown; @@ -71,57 +72,57 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return new HtmlTokenizer(source); } - public override HtmlTokenType FlipBracket(HtmlTokenType bracket) + public override SyntaxKind FlipBracket(SyntaxKind bracket) { switch (bracket) { - case HtmlTokenType.LeftBracket: - return HtmlTokenType.RightBracket; - case HtmlTokenType.OpenAngle: - return HtmlTokenType.CloseAngle; - case HtmlTokenType.RightBracket: - return HtmlTokenType.LeftBracket; - case HtmlTokenType.CloseAngle: - return HtmlTokenType.OpenAngle; + case SyntaxKind.LeftBracket: + return SyntaxKind.RightBracket; + case SyntaxKind.OpenAngle: + return SyntaxKind.CloseAngle; + case SyntaxKind.RightBracket: + return SyntaxKind.LeftBracket; + case SyntaxKind.CloseAngle: + return SyntaxKind.OpenAngle; default: Debug.Fail("FlipBracket must be called with a bracket character"); - return HtmlTokenType.Unknown; + return SyntaxKind.Unknown; } } - public override HtmlToken CreateMarkerToken() + public override SyntaxToken CreateMarkerToken() { - return new HtmlToken(string.Empty, HtmlTokenType.Unknown); + return SyntaxFactory.Token(SyntaxKind.Unknown, string.Empty); } - public override HtmlTokenType GetKnownTokenType(KnownTokenType type) + public override SyntaxKind GetKnownTokenType(KnownTokenType type) { switch (type) { case KnownTokenType.CommentStart: - return HtmlTokenType.RazorCommentTransition; + return SyntaxKind.RazorCommentTransition; case KnownTokenType.CommentStar: - return HtmlTokenType.RazorCommentStar; + return SyntaxKind.RazorCommentStar; case KnownTokenType.CommentBody: - return HtmlTokenType.RazorComment; + return SyntaxKind.RazorCommentLiteral; case KnownTokenType.Identifier: - return HtmlTokenType.Text; + return SyntaxKind.Text; case KnownTokenType.Keyword: - return HtmlTokenType.Text; + return SyntaxKind.Text; case KnownTokenType.NewLine: - return HtmlTokenType.NewLine; + return SyntaxKind.NewLine; case KnownTokenType.Transition: - return HtmlTokenType.Transition; + return SyntaxKind.Transition; case KnownTokenType.WhiteSpace: - return HtmlTokenType.WhiteSpace; + return SyntaxKind.Whitespace; default: - return HtmlTokenType.Unknown; + return SyntaxKind.Unknown; } } - protected override HtmlToken CreateToken(string content, HtmlTokenType type, IReadOnlyList errors) + protected override SyntaxToken CreateToken(string content, SyntaxKind kind, IReadOnlyList errors) { - return new HtmlToken(content, type, errors); + return SyntaxFactory.Token(kind, content, errors); } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlMarkupParser.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlMarkupParser.cs index 2408c552dd..efc0d27598 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlMarkupParser.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlMarkupParser.cs @@ -5,22 +5,31 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; namespace Microsoft.AspNetCore.Razor.Language.Legacy { - internal class HtmlMarkupParser : TokenizerBackedParser + internal class HtmlMarkupParser : TokenizerBackedParser { private const string ScriptTagName = "script"; - private static readonly HtmlToken[] nonAllowedHtmlCommentEnding = new[] { HtmlToken.Hyphen, new HtmlToken("!", HtmlTokenType.Bang), new HtmlToken("<", HtmlTokenType.OpenAngle) }; - private static readonly HtmlToken[] singleHyphenArray = new[] { HtmlToken.Hyphen }; + private static readonly SyntaxToken[] nonAllowedHtmlCommentEnding = new[] + { + SyntaxFactory.Token(SyntaxKind.Text, "-"), + SyntaxFactory.Token(SyntaxKind.Bang, "!"), + SyntaxFactory.Token(SyntaxKind.OpenAngle, "<"), + }; + private static readonly SyntaxToken[] singleHyphenArray = new[] + { + SyntaxFactory.Token(SyntaxKind.Text, "-") + }; private static readonly char[] ValidAfterTypeAttributeNameCharacters = { ' ', '\t', '\r', '\n', '\f', '=' }; private SourceLocation _lastTagStart = SourceLocation.Zero; - private HtmlToken _bufferedOpenAngle; + private SyntaxToken _bufferedOpenAngle; //From http://dev.w3.org/html5/spec/Overview.html#elements-0 - private ISet _voidElements = new HashSet(StringComparer.OrdinalIgnoreCase) + private readonly ISet _voidElements = new HashSet(StringComparer.OrdinalIgnoreCase) { "area", "base", @@ -59,7 +68,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy get { return CaseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase; } } - protected override bool TokenTypeEquals(HtmlTokenType x, HtmlTokenType y) => x == y; + protected override bool TokenKindEquals(SyntaxKind x, SyntaxKind y) => x == y; public override void BuildSpan(SpanBuilder span, SourceLocation start, string content) { @@ -73,14 +82,14 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy Output(SpanKindInternal.Markup); } - protected void SkipToAndParseCode(HtmlTokenType type) + protected void SkipToAndParseCode(SyntaxKind type) { - SkipToAndParseCode(token => token.Type == type); + SkipToAndParseCode(token => token.Kind == type); } - protected void SkipToAndParseCode(Func condition) + protected void SkipToAndParseCode(Func condition) { - HtmlToken last = null; + SyntaxToken last = null; var startOfLine = false; while (!EndOfFile && !condition(CurrentToken)) { @@ -88,15 +97,15 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { Context.NullGenerateWhitespaceAndNewLine = false; Span.ChunkGenerator = SpanChunkGenerator.Null; - AcceptWhile(token => token.Type == HtmlTokenType.WhiteSpace); - if (At(HtmlTokenType.NewLine)) + AcceptWhile(token => token.Kind == SyntaxKind.Whitespace); + if (At(SyntaxKind.NewLine)) { AcceptAndMoveNext(); } Output(SpanKindInternal.Markup); } - else if (At(HtmlTokenType.NewLine)) + else if (At(SyntaxKind.NewLine)) { if (last != null) { @@ -108,11 +117,11 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy last = null; AcceptAndMoveNext(); } - else if (At(HtmlTokenType.Transition)) + else if (At(SyntaxKind.Transition)) { var transition = CurrentToken; NextToken(); - if (At(HtmlTokenType.Transition)) + if (At(SyntaxKind.Transition)) { if (last != null) { @@ -138,7 +147,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy // Handle whitespace rewriting if (last != null) { - if (!Context.DesignTimeMode && last.Type == HtmlTokenType.WhiteSpace && startOfLine) + if (!Context.DesignTimeMode && last.Kind == SyntaxKind.Whitespace && startOfLine) { // Put the whitespace back too startOfLine = false; @@ -155,12 +164,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy OtherParserBlock(); } - else if (At(HtmlTokenType.RazorCommentTransition)) + else if (At(SyntaxKind.RazorCommentTransition)) { if (last != null) { // Don't render the whitespace between the start of the line and the razor comment. - if (startOfLine && last.Type == HtmlTokenType.WhiteSpace) + if (startOfLine && last.Kind == SyntaxKind.Whitespace) { AddMarkerTokenIfNecessary(); // Output the tokens that may have been accepted prior to the whitespace. @@ -180,8 +189,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy // Handle the whitespace and newline at the end of a razor comment. if (startOfLine && - (At(HtmlTokenType.NewLine) || - (At(HtmlTokenType.WhiteSpace) && NextIs(HtmlTokenType.NewLine)))) + (At(SyntaxKind.NewLine) || + (At(SyntaxKind.Whitespace) && NextIs(SyntaxKind.NewLine)))) { AcceptWhile(IsSpacingToken(includeNewLines: false)); AcceptAndMoveNext(); @@ -192,7 +201,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy else { // As long as we see whitespace, we're still at the "start" of the line - startOfLine &= At(HtmlTokenType.WhiteSpace); + startOfLine &= At(SyntaxKind.Whitespace); // If there's a last token, accept it if (last != null) @@ -213,9 +222,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } } - protected static Func IsSpacingToken(bool includeNewLines) + protected static Func IsSpacingToken(bool includeNewLines) { - return token => token.Type == HtmlTokenType.WhiteSpace || (includeNewLines && token.Type == HtmlTokenType.NewLine); + return token => token.Kind == SyntaxKind.Whitespace || (includeNewLines && token.Kind == SyntaxKind.NewLine); } private void OtherParserBlock() @@ -238,12 +247,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy var potentialBang = Lookahead(lookahead); if (potentialBang != null && - potentialBang.Type == HtmlTokenType.Bang) + potentialBang.Kind == SyntaxKind.Bang) { var afterBang = Lookahead(lookahead + 1); return afterBang != null && - afterBang.Type == HtmlTokenType.Text && + afterBang.Kind == SyntaxKind.Text && !string.Equals(afterBang.Content, "DOCTYPE", StringComparison.OrdinalIgnoreCase); } @@ -257,7 +266,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy Output(SpanKindInternal.Markup); // Accept the parser escape character '!'. - Assert(HtmlTokenType.Bang); + Assert(SyntaxKind.Bang); AcceptAndMoveNext(); // Setup the metacode span that we will be outputing. @@ -286,23 +295,23 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy AcceptWhile(IsSpacingToken(includeNewLines: true)); - if (CurrentToken.Type == HtmlTokenType.OpenAngle) + if (CurrentToken.Kind == SyntaxKind.OpenAngle) { // "<" => Implicit Tag Block - TagBlock(new Stack>()); + TagBlock(new Stack>()); } - else if (CurrentToken.Type == HtmlTokenType.Transition) + else if (CurrentToken.Kind == SyntaxKind.Transition) { // "@" => Explicit Tag/Single Line Block OR Template Output(SpanKindInternal.Markup); // Definitely have a transition span - Assert(HtmlTokenType.Transition); + Assert(SyntaxKind.Transition); AcceptAndMoveNext(); Span.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.None; Span.ChunkGenerator = SpanChunkGenerator.Null; Output(SpanKindInternal.Transition); - if (At(HtmlTokenType.Transition)) + if (At(SyntaxKind.Transition)) { Span.ChunkGenerator = SpanChunkGenerator.Null; AcceptAndMoveNext(); @@ -330,10 +339,10 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy private void AfterTransition() { // "@:" => Explicit Single Line Block - if (CurrentToken.Type == HtmlTokenType.Text && CurrentToken.Content.Length > 0 && CurrentToken.Content[0] == ':') + if (CurrentToken.Kind == SyntaxKind.Text && CurrentToken.Content.Length > 0 && CurrentToken.Content[0] == ':') { // Split the token - Tuple split = Language.SplitToken(CurrentToken, 1, HtmlTokenType.Colon); + var split = Language.SplitToken(CurrentToken, 1, SyntaxKind.Colon); // The first part (left) is added to this span and we return a MetaCode span Accept(split.Item1); @@ -346,9 +355,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy NextToken(); SingleLineMarkup(); } - else if (CurrentToken.Type == HtmlTokenType.OpenAngle) + else if (CurrentToken.Kind == SyntaxKind.OpenAngle) { - TagBlock(new Stack>()); + TagBlock(new Stack>()); } } @@ -359,8 +368,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy var old = Context.WhiteSpaceIsSignificantToAncestorBlock; Context.WhiteSpaceIsSignificantToAncestorBlock = true; Span.EditHandler = new SpanEditHandler(Language.TokenizeString); - SkipToAndParseCode(HtmlTokenType.NewLine); - if (!EndOfFile && CurrentToken.Type == HtmlTokenType.NewLine) + SkipToAndParseCode(SyntaxKind.NewLine); + if (!EndOfFile && CurrentToken.Kind == SyntaxKind.NewLine) { AcceptAndMoveNext(); Span.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.None; @@ -370,13 +379,13 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy Output(SpanKindInternal.Markup); } - private void TagBlock(Stack> tags) + private void TagBlock(Stack> tags) { // Skip Whitespace and Text var complete = false; do { - SkipToAndParseCode(HtmlTokenType.OpenAngle); + SkipToAndParseCode(SyntaxKind.OpenAngle); // Output everything prior to the OpenAngle into a markup span Output(SpanKindInternal.Markup); @@ -401,7 +410,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { _bufferedOpenAngle = null; _lastTagStart = CurrentStart; - Assert(HtmlTokenType.OpenAngle); + Assert(SyntaxKind.OpenAngle); _bufferedOpenAngle = CurrentToken; var tagStart = CurrentStart; if (!NextToken()) @@ -440,18 +449,18 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } private bool AfterTagStart(SourceLocation tagStart, - Stack> tags, + Stack> tags, bool atSpecialTag, IDisposable tagBlockWrapper) { if (!EndOfFile) { - switch (CurrentToken.Type) + switch (CurrentToken.Kind) { - case HtmlTokenType.ForwardSlash: + case SyntaxKind.ForwardSlash: // End Tag return EndTag(tagStart, tags, tagBlockWrapper); - case HtmlTokenType.Bang: + case SyntaxKind.Bang: // Comment, CDATA, DOCTYPE, or a parser-escaped HTML tag. if (atSpecialTag) { @@ -462,7 +471,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { goto default; } - case HtmlTokenType.QuestionMark: + case SyntaxKind.QuestionMark: // XML PI Accept(_bufferedOpenAngle); return XmlPI(); @@ -483,15 +492,15 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy private bool XmlPI() { // Accept "?" - Assert(HtmlTokenType.QuestionMark); + Assert(SyntaxKind.QuestionMark); AcceptAndMoveNext(); - return AcceptUntilAll(HtmlTokenType.QuestionMark, HtmlTokenType.CloseAngle); + return AcceptUntilAll(SyntaxKind.QuestionMark, SyntaxKind.CloseAngle); } private bool BangTag() { // Accept "!" - Assert(HtmlTokenType.Bang); + Assert(SyntaxKind.Bang); if (AcceptAndMoveNext()) { @@ -503,16 +512,16 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy AcceptAndMoveNext(); Output(SpanKindInternal.Markup, AcceptedCharactersInternal.None); - Span.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.WhiteSpace; + Span.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.Whitespace; while (!EndOfFile) { - SkipToAndParseCode(HtmlTokenType.DoubleHyphen); + SkipToAndParseCode(SyntaxKind.DoubleHyphen); var lastDoubleHyphen = AcceptAllButLastDoubleHyphens(); - if (At(HtmlTokenType.CloseAngle)) + if (At(SyntaxKind.CloseAngle)) { // Output the content in the comment block as a separate markup - Output(SpanKindInternal.Markup, AcceptedCharactersInternal.WhiteSpace); + Output(SpanKindInternal.Markup, AcceptedCharactersInternal.Whitespace); // This is the end of a comment block Accept(lastDoubleHyphen); @@ -527,7 +536,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } } } - else if (CurrentToken.Type == HtmlTokenType.LeftBracket) + else if (CurrentToken.Kind == SyntaxKind.LeftBracket) { if (AcceptAndMoveNext()) { @@ -537,19 +546,19 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy else { AcceptAndMoveNext(); - return AcceptUntilAll(HtmlTokenType.CloseAngle); + return AcceptUntilAll(SyntaxKind.CloseAngle); } } return false; } - protected HtmlToken AcceptAllButLastDoubleHyphens() + protected SyntaxToken AcceptAllButLastDoubleHyphens() { var lastDoubleHyphen = CurrentToken; AcceptWhile(s => { - if (NextIs(HtmlTokenType.DoubleHyphen)) + if (NextIs(SyntaxKind.DoubleHyphen)) { lastDoubleHyphen = s; return true; @@ -560,10 +569,10 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy NextToken(); - if (At(HtmlTokenType.Text) && IsHyphen(CurrentToken)) + if (At(SyntaxKind.Text) && IsHyphen(CurrentToken)) { // Doing this here to maintain the order of tokens - if (!NextIs(HtmlTokenType.CloseAngle)) + if (!NextIs(SyntaxKind.CloseAngle)) { Accept(lastDoubleHyphen); lastDoubleHyphen = null; @@ -575,9 +584,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return lastDoubleHyphen; } - internal static bool IsHyphen(HtmlToken token) + internal static bool IsHyphen(SyntaxToken token) { - return token.Equals(HtmlToken.Hyphen); + return token.Kind == SyntaxKind.Text && token.Content == "-"; } protected bool IsHtmlCommentAhead() @@ -595,13 +604,13 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy // 2.3 nor end with the string "" - if (CurrentToken.Type != HtmlTokenType.DoubleHyphen) + if (CurrentToken.Kind != SyntaxKind.DoubleHyphen) { return false; } // Check condition 2.1 - if (NextIs(HtmlTokenType.CloseAngle) || NextIs(next => IsHyphen(next) && NextIs(HtmlTokenType.CloseAngle))) + if (NextIs(SyntaxKind.CloseAngle) || NextIs(next => IsHyphen(next) && NextIs(SyntaxKind.CloseAngle))) { return false; } @@ -610,15 +619,15 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy var isValidComment = false; LookaheadUntil((token, prevTokens) => { - if (token.Type == HtmlTokenType.DoubleHyphen) + if (token.Kind == SyntaxKind.DoubleHyphen) { - if (NextIs(HtmlTokenType.CloseAngle)) + if (NextIs(SyntaxKind.CloseAngle)) { // Check condition 2.3: We're at the end of a comment. Check to make sure the text ending is allowed. isValidComment = !IsCommentContentEndingInvalid(prevTokens); return true; } - else if (NextIs(ns => IsHyphen(ns) && NextIs(HtmlTokenType.CloseAngle))) + else if (NextIs(ns => IsHyphen(ns) && NextIs(SyntaxKind.CloseAngle))) { // Check condition 2.3: we're at the end of a comment, which has an extra dash. // Need to treat the dash as part of the content and check the ending. @@ -627,17 +636,17 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy isValidComment = true; return true; } - else if (NextIs(ns => ns.Type == HtmlTokenType.Bang && NextIs(HtmlTokenType.CloseAngle))) + else if (NextIs(ns => ns.Kind == SyntaxKind.Bang && NextIs(SyntaxKind.CloseAngle))) { // This is condition 2.2.3 isValidComment = false; return true; } } - else if (token.Type == HtmlTokenType.OpenAngle) + else if (token.Kind == SyntaxKind.OpenAngle) { // Checking condition 2.2.1 - if (NextIs(ns => ns.Type == HtmlTokenType.Bang && NextIs(HtmlTokenType.DoubleHyphen))) + if (NextIs(ns => ns.Kind == SyntaxKind.Bang && NextIs(SyntaxKind.DoubleHyphen))) { isValidComment = false; return true; @@ -653,13 +662,13 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy /// /// Verifies, that the sequence doesn't end with the "<!-" HtmlTokens. Note, the first token is an opening bracket token /// - internal static bool IsCommentContentEndingInvalid(IEnumerable sequence) + internal static bool IsCommentContentEndingInvalid(IEnumerable sequence) { var reversedSequence = sequence.Reverse(); var index = 0; foreach (var item in reversedSequence) { - if (!item.Equals(nonAllowedHtmlCommentEnding[index++])) + if (!item.IsEquivalentTo(nonAllowedHtmlCommentEnding[index++])) { return false; } @@ -675,13 +684,13 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy private bool CData() { - if (CurrentToken.Type == HtmlTokenType.Text && string.Equals(CurrentToken.Content, "cdata", StringComparison.OrdinalIgnoreCase)) + if (CurrentToken.Kind == SyntaxKind.Text && string.Equals(CurrentToken.Content, "cdata", StringComparison.OrdinalIgnoreCase)) { if (AcceptAndMoveNext()) { - if (CurrentToken.Type == HtmlTokenType.LeftBracket) + if (CurrentToken.Kind == SyntaxKind.LeftBracket) { - return AcceptUntilAll(HtmlTokenType.RightBracket, HtmlTokenType.RightBracket, HtmlTokenType.CloseAngle); + return AcceptUntilAll(SyntaxKind.RightBracket, SyntaxKind.RightBracket, SyntaxKind.CloseAngle); } } } @@ -690,11 +699,11 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } private bool EndTag(SourceLocation tagStart, - Stack> tags, + Stack> tags, IDisposable tagBlockWrapper) { // Accept "/" and move next - Assert(HtmlTokenType.ForwardSlash); + Assert(SyntaxKind.ForwardSlash); var forwardSlash = CurrentToken; if (!NextToken()) { @@ -705,20 +714,20 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy else { var tagName = string.Empty; - HtmlToken bangToken = null; + SyntaxToken bangToken = null; - if (At(HtmlTokenType.Bang)) + if (At(SyntaxKind.Bang)) { bangToken = CurrentToken; var nextToken = Lookahead(count: 1); - if (nextToken != null && nextToken.Type == HtmlTokenType.Text) + if (nextToken != null && nextToken.Kind == SyntaxKind.Text) { tagName = "!" + nextToken.Content; } } - else if (At(HtmlTokenType.Text)) + else if (At(SyntaxKind.Text)) { tagName = CurrentToken.Content; } @@ -738,32 +747,32 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy OptionalBangEscape(); - AcceptUntil(HtmlTokenType.CloseAngle); + AcceptUntil(SyntaxKind.CloseAngle); // Accept the ">" - return Optional(HtmlTokenType.CloseAngle); + return Optional(SyntaxKind.CloseAngle); } } private void RecoverTextTag() { // We don't want to skip-to and parse because there shouldn't be anything in the body of text tags. - AcceptUntil(HtmlTokenType.CloseAngle, HtmlTokenType.NewLine); + AcceptUntil(SyntaxKind.CloseAngle, SyntaxKind.NewLine); // Include the close angle in the text tag block if it's there, otherwise just move on - Optional(HtmlTokenType.CloseAngle); + Optional(SyntaxKind.CloseAngle); } - private bool EndTextTag(HtmlToken solidus, IDisposable tagBlockWrapper) + private bool EndTextTag(SyntaxToken solidus, IDisposable tagBlockWrapper) { Accept(_bufferedOpenAngle); Accept(solidus); var textLocation = CurrentStart; - Assert(HtmlTokenType.Text); + Assert(SyntaxKind.Text); AcceptAndMoveNext(); - var seenCloseAngle = Optional(HtmlTokenType.CloseAngle); + var seenCloseAngle = Optional(SyntaxKind.CloseAngle); if (!seenCloseAngle) { @@ -791,32 +800,32 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { get { - if (At(HtmlTokenType.OpenAngle)) + if (At(SyntaxKind.OpenAngle)) { - if (NextIs(HtmlTokenType.Bang)) + if (NextIs(SyntaxKind.Bang)) { return !IsBangEscape(lookahead: 1); } - return NextIs(HtmlTokenType.QuestionMark); + return NextIs(SyntaxKind.QuestionMark); } return false; } } - private bool IsTagRecoveryStopPoint(HtmlToken token) + private bool IsTagRecoveryStopPoint(SyntaxToken token) { - return token.Type == HtmlTokenType.CloseAngle || - token.Type == HtmlTokenType.ForwardSlash || - token.Type == HtmlTokenType.OpenAngle || - token.Type == HtmlTokenType.SingleQuote || - token.Type == HtmlTokenType.DoubleQuote; + return token.Kind == SyntaxKind.CloseAngle || + token.Kind == SyntaxKind.ForwardSlash || + token.Kind == SyntaxKind.OpenAngle || + token.Kind == SyntaxKind.SingleQuote || + token.Kind == SyntaxKind.DoubleQuote; } private void TagContent() { - if (!At(HtmlTokenType.WhiteSpace) && !At(HtmlTokenType.NewLine)) + if (!At(SyntaxKind.Whitespace) && !At(SyntaxKind.NewLine)) { // We should be right after the tag name, so if there's no whitespace or new line, something is wrong RecoverToEndOfTag(); @@ -833,9 +842,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy private bool IsEndOfTag() { - if (At(HtmlTokenType.ForwardSlash)) + if (At(SyntaxKind.ForwardSlash)) { - if (NextIs(HtmlTokenType.CloseAngle)) + if (NextIs(SyntaxKind.CloseAngle)) { return true; } @@ -844,16 +853,16 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy AcceptAndMoveNext(); } } - return At(HtmlTokenType.CloseAngle) || At(HtmlTokenType.OpenAngle); + return At(SyntaxKind.CloseAngle) || At(SyntaxKind.OpenAngle); } private void BeforeAttribute() { // http://dev.w3.org/html5/spec/tokenization.html#before-attribute-name-state // Capture whitespace - var whitespace = ReadWhile(token => token.Type == HtmlTokenType.WhiteSpace || token.Type == HtmlTokenType.NewLine); + var whitespace = ReadWhile(token => token.Kind == SyntaxKind.Whitespace || token.Kind == SyntaxKind.NewLine); - if (At(HtmlTokenType.Transition)) + if (At(SyntaxKind.Transition) || At(SyntaxKind.RazorCommentTransition)) { // Transition outside of attribute value => Switch to recovery mode Accept(whitespace); @@ -863,21 +872,21 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy // http://dev.w3.org/html5/spec/tokenization.html#attribute-name-state // Read the 'name' (i.e. read until the '=' or whitespace/newline) - var name = Enumerable.Empty(); - var whitespaceAfterAttributeName = Enumerable.Empty(); + var name = Enumerable.Empty(); + var whitespaceAfterAttributeName = Enumerable.Empty(); if (IsValidAttributeNameToken(CurrentToken)) { name = ReadWhile(token => - token.Type != HtmlTokenType.WhiteSpace && - token.Type != HtmlTokenType.NewLine && - token.Type != HtmlTokenType.Equals && - token.Type != HtmlTokenType.CloseAngle && - token.Type != HtmlTokenType.OpenAngle && - (token.Type != HtmlTokenType.ForwardSlash || !NextIs(HtmlTokenType.CloseAngle))); + token.Kind != SyntaxKind.Whitespace && + token.Kind != SyntaxKind.NewLine && + token.Kind != SyntaxKind.Equals && + token.Kind != SyntaxKind.CloseAngle && + token.Kind != SyntaxKind.OpenAngle && + (token.Kind != SyntaxKind.ForwardSlash || !NextIs(SyntaxKind.CloseAngle))); // capture whitespace after attribute name (if any) whitespaceAfterAttributeName = ReadWhile( - token => token.Type == HtmlTokenType.WhiteSpace || token.Type == HtmlTokenType.NewLine); + token => token.Kind == SyntaxKind.Whitespace || token.Kind == SyntaxKind.NewLine); } else { @@ -887,7 +896,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return; } - if (!At(HtmlTokenType.Equals)) + if (!At(SyntaxKind.Equals)) { // Minimized attribute @@ -922,13 +931,13 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } private void AttributePrefix( - IEnumerable whitespace, - IEnumerable nameTokens, - IEnumerable whitespaceAfterAttributeName) + IEnumerable whitespace, + IEnumerable nameTokens, + IEnumerable whitespaceAfterAttributeName) { // First, determine if this is a 'data-' attribute (since those can't use conditional attributes) var name = string.Concat(nameTokens.Select(s => s.Content)); - var attributeCanBeConditional = + var attributeCanBeConditional = Context.FeatureFlags.EXPERIMENTAL_AllowConditionalDataDashAttributes || !name.StartsWith("data-", StringComparison.OrdinalIgnoreCase); @@ -938,16 +947,16 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy // Since this is not a minimized attribute, the whitespace after attribute name belongs to this attribute. Accept(whitespaceAfterAttributeName); - Assert(HtmlTokenType.Equals); // We should be at "=" + Assert(SyntaxKind.Equals); // We should be at "=" AcceptAndMoveNext(); - var whitespaceAfterEquals = ReadWhile(token => token.Type == HtmlTokenType.WhiteSpace || token.Type == HtmlTokenType.NewLine); - var quote = HtmlTokenType.Unknown; - if (At(HtmlTokenType.SingleQuote) || At(HtmlTokenType.DoubleQuote)) + var whitespaceAfterEquals = ReadWhile(token => token.Kind == SyntaxKind.Whitespace || token.Kind == SyntaxKind.NewLine); + var quote = SyntaxKind.Unknown; + if (At(SyntaxKind.SingleQuote) || At(SyntaxKind.DoubleQuote)) { // Found a quote, the whitespace belongs to this attribute. Accept(whitespaceAfterEquals); - quote = CurrentToken.Type; + quote = CurrentToken.Kind; AcceptAndMoveNext(); } else if (whitespaceAfterEquals.Any()) @@ -967,7 +976,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy // Read the attribute value only if the value is quoted // or if there is no whitespace between '=' and the unquoted value. - if (quote != HtmlTokenType.Unknown || !whitespaceAfterEquals.Any()) + if (quote != SyntaxKind.Unknown || !whitespaceAfterEquals.Any()) { // Read the attribute value. while (!EndOfFile && !IsEndOfAttributeValue(quote, CurrentToken)) @@ -978,7 +987,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy // Capture the suffix var suffix = new LocationTagged(string.Empty, CurrentStart); - if (quote != HtmlTokenType.Unknown && At(quote)) + if (quote != SyntaxKind.Unknown && At(quote)) { suffix = new LocationTagged(CurrentToken.Content, CurrentStart); AcceptAndMoveNext(); @@ -1000,7 +1009,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy // Output the attribute name, the equals and optional quote. Ex: foo=" Output(SpanKindInternal.Markup); - if (quote == HtmlTokenType.Unknown && whitespaceAfterEquals.Any()) + if (quote == SyntaxKind.Unknown && whitespaceAfterEquals.Any()) { return; } @@ -1011,7 +1020,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy // Output the attribute value (will include everything in-between the attribute's quotes). Output(SpanKindInternal.Markup); - if (quote != HtmlTokenType.Unknown) + if (quote != SyntaxKind.Unknown) { Optional(quote); } @@ -1019,14 +1028,14 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } } - private void AttributeValue(HtmlTokenType quote) + private void AttributeValue(SyntaxKind quote) { var prefixStart = CurrentStart; - var prefix = ReadWhile(token => token.Type == HtmlTokenType.WhiteSpace || token.Type == HtmlTokenType.NewLine); + var prefix = ReadWhile(token => token.Kind == SyntaxKind.Whitespace || token.Kind == SyntaxKind.NewLine); - if (At(HtmlTokenType.Transition)) + if (At(SyntaxKind.Transition)) { - if (NextIs(HtmlTokenType.Transition)) + if (NextIs(SyntaxKind.Transition)) { // Wrapping this in a block so that the ConditionalAttributeCollapser doesn't rewrite it. using (Context.Builder.StartBlock(BlockKindInternal.Markup)) @@ -1076,9 +1085,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy var valueStart = CurrentStart; var value = ReadWhile(token => // These three conditions find separators which break the attribute value into portions - token.Type != HtmlTokenType.WhiteSpace && - token.Type != HtmlTokenType.NewLine && - token.Type != HtmlTokenType.Transition && + token.Kind != SyntaxKind.Whitespace && + token.Kind != SyntaxKind.NewLine && + token.Kind != SyntaxKind.Transition && // This condition checks for the end of the attribute value (it repeats some of the checks above // but for now that's ok) !IsEndOfAttributeValue(quote, token)); @@ -1090,27 +1099,27 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy Output(SpanKindInternal.Markup); } - private bool IsEndOfAttributeValue(HtmlTokenType quote, HtmlToken token) + private bool IsEndOfAttributeValue(SyntaxKind quote, SyntaxToken token) { return EndOfFile || token == null || - (quote != HtmlTokenType.Unknown - ? token.Type == quote // If quoted, just wait for the quote + (quote != SyntaxKind.Unknown + ? token.Kind == quote // If quoted, just wait for the quote : IsUnquotedEndOfAttributeValue(token)); } - private bool IsUnquotedEndOfAttributeValue(HtmlToken token) + private bool IsUnquotedEndOfAttributeValue(SyntaxToken token) { // If unquoted, we have a larger set of terminating characters: // http://dev.w3.org/html5/spec/tokenization.html#attribute-value-unquoted-state // Also we need to detect "/" and ">" - return token.Type == HtmlTokenType.DoubleQuote || - token.Type == HtmlTokenType.SingleQuote || - token.Type == HtmlTokenType.OpenAngle || - token.Type == HtmlTokenType.Equals || - (token.Type == HtmlTokenType.ForwardSlash && NextIs(HtmlTokenType.CloseAngle)) || - token.Type == HtmlTokenType.CloseAngle || - token.Type == HtmlTokenType.WhiteSpace || - token.Type == HtmlTokenType.NewLine; + return token.Kind == SyntaxKind.DoubleQuote || + token.Kind == SyntaxKind.SingleQuote || + token.Kind == SyntaxKind.OpenAngle || + token.Kind == SyntaxKind.Equals || + (token.Kind == SyntaxKind.ForwardSlash && NextIs(SyntaxKind.CloseAngle)) || + token.Kind == SyntaxKind.CloseAngle || + token.Kind == SyntaxKind.Whitespace || + token.Kind == SyntaxKind.NewLine; } private void RecoverToEndOfTag() @@ -1122,17 +1131,17 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy if (!EndOfFile) { EnsureCurrent(); - switch (CurrentToken.Type) + switch (CurrentToken.Kind) { - case HtmlTokenType.SingleQuote: - case HtmlTokenType.DoubleQuote: + case SyntaxKind.SingleQuote: + case SyntaxKind.DoubleQuote: ParseQuoted(); break; - case HtmlTokenType.OpenAngle: + case SyntaxKind.OpenAngle: // Another "<" means this tag is invalid. - case HtmlTokenType.ForwardSlash: + case SyntaxKind.ForwardSlash: // Empty tag - case HtmlTokenType.CloseAngle: + case SyntaxKind.CloseAngle: // End of tag return; default: @@ -1145,12 +1154,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy private void ParseQuoted() { - var type = CurrentToken.Type; + var type = CurrentToken.Kind; AcceptAndMoveNext(); ParseQuoted(type); } - private void ParseQuoted(HtmlTokenType type) + private void ParseQuoted(SyntaxKind type) { SkipToAndParseCode(type); if (!EndOfFile) @@ -1160,12 +1169,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } } - private bool StartTag(Stack> tags, IDisposable tagBlockWrapper) + private bool StartTag(Stack> tags, IDisposable tagBlockWrapper) { - HtmlToken bangToken = null; - HtmlToken potentialTagNameToken; + SyntaxToken bangToken = null; + SyntaxToken potentialTagNameToken; - if (At(HtmlTokenType.Bang)) + if (At(SyntaxKind.Bang)) { bangToken = CurrentToken; @@ -1176,22 +1185,22 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy potentialTagNameToken = CurrentToken; } - HtmlToken tagName; + SyntaxToken tagName; - if (potentialTagNameToken == null || potentialTagNameToken.Type != HtmlTokenType.Text) + if (potentialTagNameToken == null || potentialTagNameToken.Kind != SyntaxKind.Text) { - tagName = new HtmlToken(string.Empty, HtmlTokenType.Unknown); + tagName = SyntaxFactory.Token(SyntaxKind.Unknown, string.Empty); } else if (bangToken != null) { - tagName = new HtmlToken("!" + potentialTagNameToken.Content, HtmlTokenType.Text); + tagName = SyntaxFactory.Token(SyntaxKind.Text, "!" + potentialTagNameToken.Content); } else { tagName = potentialTagNameToken; } - Tuple tag = Tuple.Create(tagName, _lastTagStart); + var tag = Tuple.Create(tagName, _lastTagStart); if (tags.Count == 0 && // Note tagName may contain a '!' escape character. This ensures doesn't match here. @@ -1203,23 +1212,23 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy Accept(_bufferedOpenAngle); var textLocation = CurrentStart; - Assert(HtmlTokenType.Text); + Assert(SyntaxKind.Text); AcceptAndMoveNext(); var bookmark = CurrentStart.AbsoluteIndex; - IEnumerable tokens = ReadWhile(IsSpacingToken(includeNewLines: true)); - var empty = At(HtmlTokenType.ForwardSlash); + var tokens = ReadWhile(IsSpacingToken(includeNewLines: true)); + var empty = At(SyntaxKind.ForwardSlash); if (empty) { Accept(tokens); - Assert(HtmlTokenType.ForwardSlash); + Assert(SyntaxKind.ForwardSlash); AcceptAndMoveNext(); bookmark = CurrentStart.AbsoluteIndex; tokens = ReadWhile(IsSpacingToken(includeNewLines: true)); } - if (!Optional(HtmlTokenType.CloseAngle)) + if (!Optional(SyntaxKind.CloseAngle)) { Context.Source.Position = bookmark; NextToken(); @@ -1247,24 +1256,24 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy Accept(_bufferedOpenAngle); OptionalBangEscape(); - Optional(HtmlTokenType.Text); + Optional(SyntaxKind.Text); return RestOfTag(tag, tags, tagBlockWrapper); } - private bool RestOfTag(Tuple tag, - Stack> tags, + private bool RestOfTag(Tuple tag, + Stack> tags, IDisposable tagBlockWrapper) { TagContent(); // We are now at a possible end of the tag // Found '<', so we just abort this tag. - if (At(HtmlTokenType.OpenAngle)) + if (At(SyntaxKind.OpenAngle)) { return false; } - var isEmpty = At(HtmlTokenType.ForwardSlash); + var isEmpty = At(SyntaxKind.ForwardSlash); // Found a solidus, so don't accept it but DON'T push the tag to the stack if (isEmpty) { @@ -1272,7 +1281,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } // Check for the '>' to determine if the tag is finished - var seenClose = Optional(HtmlTokenType.CloseAngle); + var seenClose = Optional(SyntaxKind.CloseAngle); if (!seenClose) { Context.ErrorSink.OnError( @@ -1298,17 +1307,17 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy var bookmark = CurrentStart.AbsoluteIndex; // Skip whitespace - IEnumerable whiteSpace = ReadWhile(IsSpacingToken(includeNewLines: true)); + var whiteSpace = ReadWhile(IsSpacingToken(includeNewLines: true)); // Open Angle - if (At(HtmlTokenType.OpenAngle) && NextIs(HtmlTokenType.ForwardSlash)) + if (At(SyntaxKind.OpenAngle) && NextIs(SyntaxKind.ForwardSlash)) { var openAngle = CurrentToken; NextToken(); - Assert(HtmlTokenType.ForwardSlash); + Assert(SyntaxKind.ForwardSlash); var solidus = CurrentToken; NextToken(); - if (At(HtmlTokenType.Text) && string.Equals(CurrentToken.Content, tagName, StringComparison.OrdinalIgnoreCase)) + if (At(SyntaxKind.Text) && string.Equals(CurrentToken.Content, tagName, StringComparison.OrdinalIgnoreCase)) { // Accept up to here Accept(whiteSpace); @@ -1321,9 +1330,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy AcceptAndMoveNext(); // Accept to '>', '<' or EOF - AcceptUntil(HtmlTokenType.CloseAngle, HtmlTokenType.OpenAngle); + AcceptUntil(SyntaxKind.CloseAngle, SyntaxKind.OpenAngle); // Accept the '>' if we saw it. And if we do see it, we're complete - var complete = Optional(HtmlTokenType.CloseAngle); + var complete = Optional(SyntaxKind.CloseAngle); if (complete) { @@ -1373,17 +1382,17 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy while (!seenEndScript && !EndOfFile) { - SkipToAndParseCode(HtmlTokenType.OpenAngle); + SkipToAndParseCode(SyntaxKind.OpenAngle); var tagStart = CurrentStart; - if (NextIs(HtmlTokenType.ForwardSlash)) + if (NextIs(SyntaxKind.ForwardSlash)) { var openAngle = CurrentToken; NextToken(); // Skip over '<', current is '/' var solidus = CurrentToken; NextToken(); // Skip over '/', current should be text - if (At(HtmlTokenType.Text) && + if (At(SyntaxKind.Text) && string.Equals(CurrentToken.Content, ScriptTagName, StringComparison.OrdinalIgnoreCase)) { seenEndScript = true; @@ -1409,8 +1418,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy AcceptAndMoveNext(); // '<' AcceptAndMoveNext(); // '/' - SkipToAndParseCode(HtmlTokenType.CloseAngle); - if (!Optional(HtmlTokenType.CloseAngle)) + SkipToAndParseCode(SyntaxKind.CloseAngle); + if (!Optional(SyntaxKind.CloseAngle)) { Context.ErrorSink.OnError( RazorDiagnosticFactory.CreateParsing_UnfinishedTag( @@ -1441,7 +1450,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy tagBlockWrapper.Dispose(); } - private bool AcceptUntilAll(params HtmlTokenType[] endSequence) + private bool AcceptUntilAll(params SyntaxKind[] endSequence) { while (!EndOfFile) { @@ -1456,9 +1465,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return false; } - private bool RemoveTag(Stack> tags, string tagName, SourceLocation tagStart) + private bool RemoveTag(Stack> tags, string tagName, SourceLocation tagStart) { - Tuple currentTag = null; + Tuple currentTag = null; while (tags.Count > 0) { currentTag = tags.Pop(); @@ -1486,7 +1495,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return false; } - private void EndTagBlock(Stack> tags, bool complete) + private void EndTagBlock(Stack> tags, bool complete) { if (tags.Count > 0) { @@ -1515,11 +1524,11 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy if (Context.Builder.LastSpan.Kind == SpanKindInternal.Transition) { var tokens = ReadWhile( - f => (f.Type == HtmlTokenType.WhiteSpace) || (f.Type == HtmlTokenType.NewLine)); + f => (f.Kind == SyntaxKind.Whitespace) || (f.Kind == SyntaxKind.NewLine)); // Make sure the current token is not markup, which can be html start tag or @: - if (!(At(HtmlTokenType.OpenAngle) || - (At(HtmlTokenType.Transition) && Lookahead(count: 1).Content.StartsWith(":")))) + if (!(At(SyntaxKind.OpenAngle) || + (At(SyntaxKind.Transition) && Lookahead(count: 1).Content.StartsWith(":")))) { // Don't accept whitespace as markup if the end text tag is followed by csharp. shouldAcceptWhitespaceAndNewLine = false; @@ -1533,14 +1542,14 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy if (shouldAcceptWhitespaceAndNewLine) { // Accept whitespace and a single newline if present - AcceptWhile(HtmlTokenType.WhiteSpace); - Optional(HtmlTokenType.NewLine); + AcceptWhile(SyntaxKind.Whitespace); + Optional(SyntaxKind.NewLine); } } else if (Span.EditHandler.AcceptedCharacters == AcceptedCharactersInternal.Any) { - AcceptWhile(HtmlTokenType.WhiteSpace); - Optional(HtmlTokenType.NewLine); + AcceptWhile(SyntaxKind.Whitespace); + Optional(SyntaxKind.NewLine); } PutCurrentBack(); @@ -1551,7 +1560,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy Output(SpanKindInternal.Markup); } - internal static bool IsValidAttributeNameToken(HtmlToken token) + internal static bool IsValidAttributeNameToken(SyntaxToken token) { if (token == null) { @@ -1562,16 +1571,16 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy // However, it's not all of it. For instance we don't special case control characters or allow OpenAngle. // It also doesn't try to exclude Razor specific features such as the @ transition. This is based on the // expectation that the parser handles such scenarios prior to falling through to name resolution. - var tokenType = token.Type; - return tokenType != HtmlTokenType.WhiteSpace && - tokenType != HtmlTokenType.NewLine && - tokenType != HtmlTokenType.CloseAngle && - tokenType != HtmlTokenType.OpenAngle && - tokenType != HtmlTokenType.ForwardSlash && - tokenType != HtmlTokenType.DoubleQuote && - tokenType != HtmlTokenType.SingleQuote && - tokenType != HtmlTokenType.Equals && - tokenType != HtmlTokenType.Unknown; + var tokenType = token.Kind; + return tokenType != SyntaxKind.Whitespace && + tokenType != SyntaxKind.NewLine && + tokenType != SyntaxKind.CloseAngle && + tokenType != SyntaxKind.OpenAngle && + tokenType != SyntaxKind.ForwardSlash && + tokenType != SyntaxKind.DoubleQuote && + tokenType != SyntaxKind.SingleQuote && + tokenType != SyntaxKind.Equals && + tokenType != SyntaxKind.Unknown; } public void ParseDocument() @@ -1587,10 +1596,11 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { Span.Start = CurrentLocation; + ParserState = ParserState.Misc; NextToken(); while (!EndOfFile) { - SkipToAndParseCode(HtmlTokenType.OpenAngle); + SkipToAndParseCode(SyntaxKind.OpenAngle); ScanTagInDocumentContext(); } AddMarkerTokenIfNecessary(); @@ -1605,14 +1615,14 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy /// private void ScanTagInDocumentContext() { - if (At(HtmlTokenType.OpenAngle)) + if (At(SyntaxKind.OpenAngle)) { - if (NextIs(HtmlTokenType.Bang)) + if (NextIs(SyntaxKind.Bang)) { // Checking to see if we meet the conditions of a special '!' tag: ';" as an HTML tag. @@ -1667,13 +1687,15 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { // Parsing an end tag // This section can accept things like: '

' or '

' etc. - Optional(HtmlTokenType.ForwardSlash); + ParserState = ParserState.EndTag; + Optional(SyntaxKind.ForwardSlash); // Whitespace here is invalid (according to the spec) OptionalBangEscape(); - Optional(HtmlTokenType.Text); - Optional(HtmlTokenType.WhiteSpace); - Optional(HtmlTokenType.CloseAngle); + Optional(SyntaxKind.Text); + Optional(SyntaxKind.Whitespace); + Optional(SyntaxKind.CloseAngle); + ParserState = ParserState.Content; } Output(SpanKindInternal.Markup); @@ -1714,9 +1736,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy private static bool IsTypeAttribute(Block block) { - var span = block.Children.First() as Span; - if (span == null) + if (!(block.Children.First() is Span span)) { return false; } @@ -1765,7 +1786,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { do { - SkipToAndParseCode(token => token.Type == HtmlTokenType.OpenAngle || AtEnd(nestingSequenceComponents)); + SkipToAndParseCode(token => token.Kind == SyntaxKind.OpenAngle || AtEnd(nestingSequenceComponents)); ScanTagInDocumentContext(); if (!EndOfFile && AtEnd(nestingSequenceComponents)) { @@ -1783,9 +1804,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy while (nesting > 0 && !EndOfFile) { SkipToAndParseCode(token => - token.Type == HtmlTokenType.Text || - token.Type == HtmlTokenType.OpenAngle); - if (At(HtmlTokenType.Text)) + token.Kind == SyntaxKind.Text || + token.Kind == SyntaxKind.OpenAngle); + if (At(SyntaxKind.Text)) { nesting += ProcessTextToken(nestingSequences, nesting); if (CurrentToken != null) @@ -1812,7 +1833,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy var bookmark = Context.Source.Position - CurrentToken.Content.Length; try { - foreach (string component in nestingSequenceComponents) + foreach (var component in nestingSequenceComponents) { if (!EndOfFile && !string.Equals(CurrentToken.Content, component, Comparison)) { @@ -1837,7 +1858,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy private int ProcessTextToken(Tuple nestingSequences, int currentNesting) { - for (int i = 0; i < CurrentToken.Content.Length; i++) + for (var i = 0; i < CurrentToken.Content.Length; i++) { var nestingDelta = HandleNestingSequence(nestingSequences.Item1, i, currentNesting, 1); if (nestingDelta == 0) @@ -1868,10 +1889,10 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy PutCurrentBack(); // Carve up the token - Tuple pair = Language.SplitToken(token, position, HtmlTokenType.Text); + var pair = Language.SplitToken(token, position, SyntaxKind.Text); var preSequence = pair.Item1; Debug.Assert(pair.Item2 != null); - pair = Language.SplitToken(pair.Item2, sequence.Length, HtmlTokenType.Text); + pair = Language.SplitToken(pair.Item2, sequence.Length, SyntaxKind.Text); var sequenceToken = pair.Item1; var postSequence = pair.Item2; var postSequenceBookmark = bookmark.AbsoluteIndex + preSequence.Content.Length + pair.Item1.Content.Length; diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlToken.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlToken.cs deleted file mode 100644 index 2d52ed14e2..0000000000 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlToken.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; - -namespace Microsoft.AspNetCore.Razor.Language.Legacy -{ - internal class HtmlToken : TokenBase - { - internal static readonly HtmlToken Hyphen = new HtmlToken("-", HtmlTokenType.Text); - - public HtmlToken(string content, HtmlTokenType type) - : base(content, type, RazorDiagnostic.EmptyArray) - { - if (content == null) - { - throw new ArgumentNullException(nameof(content)); - } - } - - public HtmlToken( - string content, - HtmlTokenType type, - IReadOnlyList errors) - : base(content, type, errors) - { - if (content == null) - { - throw new ArgumentNullException(nameof(content)); - } - } - } -} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlTokenType.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlTokenType.cs deleted file mode 100644 index 82d96d7ebc..0000000000 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlTokenType.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; - -namespace Microsoft.AspNetCore.Razor.Language.Legacy -{ - [Flags] - internal enum HtmlTokenType - { - Unknown, - Text, // Text which isn't one of the below - WhiteSpace, // Non-newline Whitespace - NewLine, // Newline - OpenAngle, // < - Bang, // ! - ForwardSlash, // / - QuestionMark, // ? - DoubleHyphen, // -- - LeftBracket, // [ - CloseAngle, // > - RightBracket, // ] - Equals, // = - DoubleQuote, // " - SingleQuote, // ' - Transition, // @ - Colon, - RazorComment, - RazorCommentStar, - RazorCommentTransition - } -} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlTokenizer.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlTokenizer.cs index 99a7152447..bc55f991a1 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlTokenizer.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/HtmlTokenizer.cs @@ -3,11 +3,12 @@ using System.Collections.Generic; using System.Diagnostics; +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; namespace Microsoft.AspNetCore.Razor.Language.Legacy { // Tokenizer _loosely_ based on http://dev.w3.org/html5/spec/Overview.html#tokenization - internal class HtmlTokenizer : Tokenizer + internal class HtmlTokenizer : Tokenizer { private const char TransitionChar = '@'; @@ -21,24 +22,24 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy private new HtmlTokenizerState? CurrentState => (HtmlTokenizerState?)base.CurrentState; - public override HtmlTokenType RazorCommentType + public override SyntaxKind RazorCommentKind { - get { return HtmlTokenType.RazorComment; } + get { return SyntaxKind.RazorCommentLiteral; } } - public override HtmlTokenType RazorCommentTransitionType + public override SyntaxKind RazorCommentTransitionKind { - get { return HtmlTokenType.RazorCommentTransition; } + get { return SyntaxKind.RazorCommentTransition; } } - public override HtmlTokenType RazorCommentStarType + public override SyntaxKind RazorCommentStarKind { - get { return HtmlTokenType.RazorCommentStar; } + get { return SyntaxKind.RazorCommentStar; } } - protected override HtmlToken CreateToken(string content, HtmlTokenType type, IReadOnlyList errors) + protected override SyntaxToken CreateToken(string content, SyntaxKind type, IReadOnlyList errors) { - return new HtmlToken(content, type, errors); + return SyntaxFactory.Token(type, content, errors); } protected override StateResult Dispatch() @@ -66,7 +67,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } // Optimize memory allocation by returning constants for the most frequent cases - protected override string GetTokenContent(HtmlTokenType type) + protected override string GetTokenContent(SyntaxKind type) { var tokenLength = Buffer.Length; @@ -74,27 +75,27 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { switch (type) { - case HtmlTokenType.OpenAngle: + case SyntaxKind.OpenAngle: return "<"; - case HtmlTokenType.Bang: + case SyntaxKind.Bang: return "!"; - case HtmlTokenType.ForwardSlash: + case SyntaxKind.ForwardSlash: return "/"; - case HtmlTokenType.QuestionMark: + case SyntaxKind.QuestionMark: return "?"; - case HtmlTokenType.LeftBracket: + case SyntaxKind.LeftBracket: return "["; - case HtmlTokenType.CloseAngle: + case SyntaxKind.CloseAngle: return ">"; - case HtmlTokenType.RightBracket: + case SyntaxKind.RightBracket: return "]"; - case HtmlTokenType.Equals: + case SyntaxKind.Equals: return "="; - case HtmlTokenType.DoubleQuote: + case SyntaxKind.DoubleQuote: return "\""; - case HtmlTokenType.SingleQuote: + case SyntaxKind.SingleQuote: return "'"; - case HtmlTokenType.WhiteSpace: + case SyntaxKind.Whitespace: if (Buffer[0] == ' ') { return " "; @@ -104,7 +105,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return "\t"; } break; - case HtmlTokenType.NewLine: + case SyntaxKind.NewLine: if (Buffer[0] == '\n') { return "\n"; @@ -113,7 +114,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } } - if (tokenLength == 2 && type == HtmlTokenType.NewLine) + if (tokenLength == 2 && type == SyntaxKind.NewLine) { return "\r\n"; } @@ -139,17 +140,17 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { return Transition( HtmlTokenizerState.AfterRazorCommentTransition, - EndToken(HtmlTokenType.RazorCommentTransition)); + EndToken(SyntaxKind.RazorCommentTransition)); } else if (CurrentCharacter == '@') { // Could be escaped comment transition return Transition( HtmlTokenizerState.EscapedRazorCommentTransition, - EndToken(HtmlTokenType.Transition)); + EndToken(SyntaxKind.Transition)); } - return Stay(EndToken(HtmlTokenType.Transition)); + return Stay(EndToken(SyntaxKind.Transition)); } else if (AtToken()) { @@ -164,7 +165,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy private StateResult EscapedRazorCommentTransition() { TakeCurrent(); - return Transition(HtmlTokenizerState.Data, EndToken(HtmlTokenType.Transition)); + return Transition(HtmlTokenizerState.Data, EndToken(SyntaxKind.Transition)); } private StateResult Text() @@ -190,10 +191,10 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } // Output the Text token and return to the Data state to tokenize the next character (if there is one) - return Transition(HtmlTokenizerState.Data, EndToken(HtmlTokenType.Text)); + return Transition(HtmlTokenizerState.Data, EndToken(SyntaxKind.Text)); } - private HtmlToken Token() + private SyntaxToken Token() { Debug.Assert(AtToken()); var sym = CurrentCharacter; @@ -201,45 +202,45 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy switch (sym) { case '<': - return EndToken(HtmlTokenType.OpenAngle); + return EndToken(SyntaxKind.OpenAngle); case '!': - return EndToken(HtmlTokenType.Bang); + return EndToken(SyntaxKind.Bang); case '/': - return EndToken(HtmlTokenType.ForwardSlash); + return EndToken(SyntaxKind.ForwardSlash); case '?': - return EndToken(HtmlTokenType.QuestionMark); + return EndToken(SyntaxKind.QuestionMark); case '[': - return EndToken(HtmlTokenType.LeftBracket); + return EndToken(SyntaxKind.LeftBracket); case '>': - return EndToken(HtmlTokenType.CloseAngle); + return EndToken(SyntaxKind.CloseAngle); case ']': - return EndToken(HtmlTokenType.RightBracket); + return EndToken(SyntaxKind.RightBracket); case '=': - return EndToken(HtmlTokenType.Equals); + return EndToken(SyntaxKind.Equals); case '"': - return EndToken(HtmlTokenType.DoubleQuote); + return EndToken(SyntaxKind.DoubleQuote); case '\'': - return EndToken(HtmlTokenType.SingleQuote); + return EndToken(SyntaxKind.SingleQuote); case '-': Debug.Assert(CurrentCharacter == '-'); TakeCurrent(); - return EndToken(HtmlTokenType.DoubleHyphen); + return EndToken(SyntaxKind.DoubleHyphen); default: Debug.Fail("Unexpected token!"); - return EndToken(HtmlTokenType.Unknown); + return EndToken(SyntaxKind.Unknown); } } - private HtmlToken Whitespace() + private SyntaxToken Whitespace() { while (ParserHelpers.IsWhitespace(CurrentCharacter)) { TakeCurrent(); } - return EndToken(HtmlTokenType.WhiteSpace); + return EndToken(SyntaxKind.Whitespace); } - private HtmlToken Newline() + private SyntaxToken Newline() { Debug.Assert(ParserHelpers.IsNewLine(CurrentCharacter)); // CSharp Spec §2.3.1 @@ -249,7 +250,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { TakeCurrent(); } - return EndToken(HtmlTokenType.NewLine); + return EndToken(SyntaxKind.NewLine); } private bool AtToken() @@ -274,7 +275,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return Transition((int)state, result: null); } - private StateResult Transition(HtmlTokenizerState state, HtmlToken result) + private StateResult Transition(HtmlTokenizerState state, SyntaxToken result) { return Transition((int)state, result); } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/IToken.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/IToken.cs deleted file mode 100644 index 2f8eb1214d..0000000000 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/IToken.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace Microsoft.AspNetCore.Razor.Language.Legacy -{ - internal interface IToken - { - Span Parent { get; set; } - - string Content { get; } - - SourceLocation Start { get; } - } -} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/ITokenizer.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/ITokenizer.cs index 530df75dbc..0dac9f1b4f 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/ITokenizer.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/ITokenizer.cs @@ -1,10 +1,12 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; + namespace Microsoft.AspNetCore.Razor.Language.Legacy { internal interface ITokenizer { - IToken NextToken(); + SyntaxToken NextToken(); } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/ImplicitExpressionEditHandler.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/ImplicitExpressionEditHandler.cs index b3869f00d0..fb9efdc751 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/ImplicitExpressionEditHandler.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/ImplicitExpressionEditHandler.cs @@ -7,6 +7,7 @@ using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; +using Microsoft.AspNetCore.Razor.Language.Syntax; using Microsoft.Extensions.Internal; namespace Microsoft.AspNetCore.Razor.Language.Legacy @@ -16,7 +17,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy private readonly ISet _keywords; private readonly IReadOnlyCollection _readOnlyKeywords; - public ImplicitExpressionEditHandler(Func> tokenizer, ISet keywords, bool acceptTrailingDot) + public ImplicitExpressionEditHandler(Func> tokenizer, ISet keywords, bool acceptTrailingDot) : base(tokenizer) { _keywords = keywords ?? new HashSet(); @@ -172,20 +173,20 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy for (var i = 0; i < target.Tokens.Count; i++) { - var token = target.Tokens[i] as CSharpToken; + var token = target.Tokens[i]; if (token == null) { break; } - var tokenStartIndex = token.Start.AbsoluteIndex; - var tokenEndIndex = tokenStartIndex + token.Content.Length; + var tokenStartIndex = token.Position; + var tokenEndIndex = token.EndPosition; // We're looking for the first token that contains the SourceChange. if (tokenEndIndex > change.Span.AbsoluteIndex) { - if (tokenEndIndex >= change.Span.AbsoluteIndex + change.Span.Length && token.Type == CSharpTokenType.Identifier) + if (tokenEndIndex >= change.Span.AbsoluteIndex + change.Span.Length && token.Kind == SyntaxKind.Identifier) { // The token we're changing happens to be an identifier. Need to check if its transformed state is also one. // We do this transformation logic to capture the case that the new text change happens to not be an identifier; @@ -200,8 +201,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy break; } - var newToken = (CSharpToken)newTokens.First(); - if (newToken.Type == CSharpTokenType.Identifier) + var newToken = newTokens.First(); + if (newToken.Kind == SyntaxKind.Identifier) { return true; } @@ -241,8 +242,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy var changeStart = change.Span.AbsoluteIndex; var changeLength = change.Span.Length; var changeEnd = changeStart + changeLength; - var tokens = target.Tokens.Cast().ToArray(); - if (!IsInsideParenthesis(changeStart, tokens) || !IsInsideParenthesis(changeEnd, tokens)) + if (!IsInsideParenthesis(changeStart, target.Tokens) || !IsInsideParenthesis(changeEnd, target.Tokens)) { // Either the start or end of the delete does not fall inside of parenthesis, unacceptable inner deletion. return false; @@ -274,8 +274,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return false; } - var tokens = target.Tokens.Cast().ToArray(); - if (IsInsideParenthesis(change.Span.AbsoluteIndex, tokens)) + if (IsInsideParenthesis(change.Span.AbsoluteIndex, target.Tokens)) { return true; } @@ -284,7 +283,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } // Internal for testing - internal static bool IsInsideParenthesis(int position, IReadOnlyList tokens) + internal static bool IsInsideParenthesis(int position, IReadOnlyList tokens) { var balanceCount = 0; var foundInsertionPoint = false; @@ -322,9 +321,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } // Internal for testing - internal static bool ContainsPosition(int position, CSharpToken currentToken) + internal static bool ContainsPosition(int position, SyntaxToken currentToken) { - var tokenStart = currentToken.Start.AbsoluteIndex; + var tokenStart = currentToken.Position; if (tokenStart == position) { // Token is exactly at the insertion point. @@ -342,14 +341,14 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } // Internal for testing - internal static bool TryUpdateBalanceCount(CSharpToken token, ref int count) + internal static bool TryUpdateBalanceCount(SyntaxToken token, ref int count) { var updatedCount = count; - if (token.Type == CSharpTokenType.LeftParenthesis) + if (token.Kind == SyntaxKind.LeftParenthesis) { updatedCount++; } - else if (token.Type == CSharpTokenType.RightParenthesis) + else if (token.Kind == SyntaxKind.RightParenthesis) { if (updatedCount == 0) { @@ -358,7 +357,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy updatedCount--; } - else if (token.Type == CSharpTokenType.StringLiteral) + else if (token.Kind == SyntaxKind.StringLiteral) { var content = token.Content; if (content.Length > 0 && content[content.Length - 1] != '"') @@ -370,7 +369,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } } } - else if (token.Type == CSharpTokenType.CharacterLiteral) + else if (token.Kind == SyntaxKind.CharacterLiteral) { var content = token.Content; if (content.Length > 0 && content[content.Length - 1] != '\'') diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/LanguageCharacteristics.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/LanguageCharacteristics.cs index b12bf612b9..b08bbb0fe1 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/LanguageCharacteristics.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/LanguageCharacteristics.cs @@ -3,30 +3,29 @@ using System; using System.Collections.Generic; +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; namespace Microsoft.AspNetCore.Razor.Language.Legacy { - internal abstract class LanguageCharacteristics - where TTokenType : struct - where TTokenizer : Tokenizer - where TToken : TokenBase + internal abstract class LanguageCharacteristics + where TTokenizer : Tokenizer { - public abstract string GetSample(TTokenType type); + public abstract string GetSample(SyntaxKind type); public abstract TTokenizer CreateTokenizer(ITextDocument source); - public abstract TTokenType FlipBracket(TTokenType bracket); - public abstract TToken CreateMarkerToken(); + public abstract SyntaxKind FlipBracket(SyntaxKind bracket); + public abstract SyntaxToken CreateMarkerToken(); - public virtual IEnumerable TokenizeString(string content) + public virtual IEnumerable TokenizeString(string content) { return TokenizeString(SourceLocation.Zero, content); } - public virtual IEnumerable TokenizeString(SourceLocation start, string input) + public virtual IEnumerable TokenizeString(SourceLocation start, string input) { using (var reader = new SeekableTextReader(input, start.FilePath)) { var tok = CreateTokenizer(reader); - TToken token; + SyntaxToken token; while ((token = tok.NextToken()) != null) { yield return token; @@ -34,76 +33,76 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } } - public virtual bool IsWhiteSpace(TToken token) + public virtual bool IsWhiteSpace(SyntaxToken token) { return IsKnownTokenType(token, KnownTokenType.WhiteSpace); } - public virtual bool IsNewLine(TToken token) + public virtual bool IsNewLine(SyntaxToken token) { return IsKnownTokenType(token, KnownTokenType.NewLine); } - public virtual bool IsIdentifier(TToken token) + public virtual bool IsIdentifier(SyntaxToken token) { return IsKnownTokenType(token, KnownTokenType.Identifier); } - public virtual bool IsKeyword(TToken token) + public virtual bool IsKeyword(SyntaxToken token) { return IsKnownTokenType(token, KnownTokenType.Keyword); } - public virtual bool IsTransition(TToken token) + public virtual bool IsTransition(SyntaxToken token) { return IsKnownTokenType(token, KnownTokenType.Transition); } - public virtual bool IsCommentStart(TToken token) + public virtual bool IsCommentStart(SyntaxToken token) { return IsKnownTokenType(token, KnownTokenType.CommentStart); } - public virtual bool IsCommentStar(TToken token) + public virtual bool IsCommentStar(SyntaxToken token) { return IsKnownTokenType(token, KnownTokenType.CommentStar); } - public virtual bool IsCommentBody(TToken token) + public virtual bool IsCommentBody(SyntaxToken token) { return IsKnownTokenType(token, KnownTokenType.CommentBody); } - public virtual bool IsUnknown(TToken token) + public virtual bool IsUnknown(SyntaxToken token) { return IsKnownTokenType(token, KnownTokenType.Unknown); } - public virtual bool IsKnownTokenType(TToken token, KnownTokenType type) + public virtual bool IsKnownTokenType(SyntaxToken token, KnownTokenType type) { - return token != null && Equals(token.Type, GetKnownTokenType(type)); + return token != null && Equals(token.Kind, GetKnownTokenType(type)); } - public virtual Tuple SplitToken(TToken token, int splitAt, TTokenType leftType) + public virtual Tuple SplitToken(SyntaxToken token, int splitAt, SyntaxKind leftType) { var left = CreateToken(token.Content.Substring(0, splitAt), leftType, RazorDiagnostic.EmptyArray); - TToken right = null; + SyntaxToken right = null; if (splitAt < token.Content.Length) { - right = CreateToken(token.Content.Substring(splitAt), token.Type, token.Errors); + right = CreateToken(token.Content.Substring(splitAt), token.Kind, token.GetDiagnostics()); } return Tuple.Create(left, right); } - public abstract TTokenType GetKnownTokenType(KnownTokenType type); + public abstract SyntaxKind GetKnownTokenType(KnownTokenType type); public virtual bool KnowsTokenType(KnownTokenType type) { return type == KnownTokenType.Unknown || !Equals(GetKnownTokenType(type), GetKnownTokenType(KnownTokenType.Unknown)); } - protected abstract TToken CreateToken(string content, TTokenType type, IReadOnlyList errors); + protected abstract SyntaxToken CreateToken(string content, SyntaxKind type, IReadOnlyList errors); } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/MarkupRewriter.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/MarkupRewriter.cs index 42074050ff..95908fb736 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/MarkupRewriter.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/MarkupRewriter.cs @@ -67,9 +67,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy builder.Kind = SpanKindInternal.Markup; builder.ChunkGenerator = new MarkupChunkGenerator(); - foreach (IToken sym in HtmlLanguageCharacteristics.Instance.TokenizeString(start, content)) + foreach (var token in HtmlLanguageCharacteristics.Instance.TokenizeString(start, content)) { - builder.Accept(sym); + builder.Accept(token); } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/Span.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/Span.cs index fbf9f9f2c2..b9147e8dac 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/Span.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/Span.cs @@ -5,12 +5,16 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; +using Microsoft.AspNetCore.Razor.Language.Syntax; +using Microsoft.Extensions.Internal; namespace Microsoft.AspNetCore.Razor.Language.Legacy { internal class Span : SyntaxTreeNode { + private static readonly List EmptyTokenList = new List(0); private static readonly int TypeHashCode = typeof(Span).GetHashCode(); + private IReadOnlyList _greenTokens; private string _content; private int? _length; private SourceLocation _start; @@ -23,7 +27,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy public ISpanChunkGenerator ChunkGenerator { get; private set; } public SpanKindInternal Kind { get; private set; } - public IReadOnlyList Tokens { get; private set; } + + public IReadOnlyList Tokens { get; private set; } // Allow test code to re-link spans public Span Previous { get; internal set; } @@ -31,6 +36,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy public SpanEditHandler EditHandler { get; private set; } + public SyntaxNode SyntaxNode { get; private set; } + public override bool IsBlock => false; public override int Length @@ -93,19 +100,29 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy public void ReplaceWith(SpanBuilder builder) { Kind = builder.Kind; - Tokens = builder.Tokens; - - for (var i = 0; i 0) + { + tokens = new List(); + var currentStart = _start.AbsoluteIndex; + for (var i = 0; i < _greenTokens.Count; i++) + { + var token = new SyntaxToken(_greenTokens[i], parent: SyntaxNode, parentSpan: this, position: currentStart); + tokens.Add(token); + currentStart += token.FullWidth; + } + } + + Tokens = tokens; + Parent?.ChildChanged(); // Since we took references to the values in SpanBuilder, clear its references out @@ -145,8 +162,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy /// public override bool EquivalentTo(SyntaxTreeNode node) { - var other = node as Span; - return other != null && + return node is Span other && Kind.Equals(other.Kind) && Start.Equals(other.Start) && EditHandler.Equals(other.EditHandler) && @@ -161,12 +177,11 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy public override bool Equals(object obj) { - var other = obj as Span; - return other != null && + return obj is Span other && Kind.Equals(other.Kind) && EditHandler.Equals(other.EditHandler) && ChunkGenerator.Equals(other.ChunkGenerator) && - Tokens.SequenceEqual(other.Tokens); + Tokens.SequenceEqual(other.Tokens, SyntaxTokenComparer.Default); } public override int GetHashCode() @@ -185,5 +200,28 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy var spanBuilder = new SpanBuilder(this); return spanBuilder.Build(); } + + private class SyntaxTokenComparer : IEqualityComparer + { + public static readonly SyntaxTokenComparer Default = new SyntaxTokenComparer(); + + private SyntaxTokenComparer() + { + } + + public bool Equals(SyntaxToken x, SyntaxToken y) + { + return x.IsEquivalentTo(y); + } + + public int GetHashCode(SyntaxToken obj) + { + var hash = HashCodeCombiner.Start(); + hash.Add(obj.Content, StringComparer.Ordinal); + hash.Add(obj.Kind); + + return hash; + } + } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/SpanBuilder.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/SpanBuilder.cs index 6d2e647b91..ad2b08b61c 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/SpanBuilder.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/SpanBuilder.cs @@ -3,14 +3,16 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; namespace Microsoft.AspNetCore.Razor.Language.Legacy { internal class SpanBuilder { private SourceLocation _start; - private List _tokens; + private List _tokens; private SourceLocationTracker _tracker; public SpanBuilder(Span original) @@ -20,7 +22,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy _start = original.Start; ChunkGenerator = original.ChunkGenerator; - _tokens = new List(original.Tokens); + _tokens = new List(original.Tokens.Select(t =>t.Green)); _tracker = new SourceLocationTracker(original.Start); } @@ -33,6 +35,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy Start = location; } + public Syntax.GreenNode SyntaxNode { get; private set; } + public ISpanChunkGenerator ChunkGenerator { get; set; } public SourceLocation Start @@ -49,13 +53,13 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy public SpanKindInternal Kind { get; set; } - public IReadOnlyList Tokens + public IReadOnlyList Tokens { get { if (_tokens == null) { - _tokens = new List(); + _tokens = new List(); } return _tokens; @@ -69,22 +73,18 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy // Need to potentially allocate a new list because Span.ReplaceWith takes ownership // of the original list. _tokens = null; - _tokens = new List(); + _tokens = new List(); - EditHandler = SpanEditHandler.CreateDefault((content) => Enumerable.Empty()); + EditHandler = SpanEditHandler.CreateDefault((content) => Enumerable.Empty()); ChunkGenerator = SpanChunkGenerator.Null; Start = SourceLocation.Undefined; } - public Span Build() + public Span Build(SyntaxKind syntaxKind = SyntaxKind.Unknown) { + SyntaxNode = GetSyntaxNode(syntaxKind); + var span = new Span(this); - - for (var i = 0; i < span.Tokens.Count; i++) - { - var token = span.Tokens[i]; - token.Parent = span; - } return span; } @@ -94,7 +94,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy _tokens?.Clear(); } - public void Accept(IToken token) + public void Accept(SyntaxToken token) { if (token == null) { @@ -109,5 +109,27 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy _tokens.Add(token); _tracker.UpdateLocation(token.Content); } + + private Syntax.GreenNode GetSyntaxNode(SyntaxKind syntaxKind) + { + if (syntaxKind == SyntaxKind.HtmlTextLiteral) + { + var textTokens = new SyntaxListBuilder(SyntaxListBuilder.Create()); + foreach (var token in Tokens) + { + if (token.Kind == SyntaxKind.Unknown) + { + Debug.Assert(false, $"Unexpected token {token.Kind}"); + continue; + } + + textTokens.Add(token); + } + var textResult = textTokens.ToList(); + return SyntaxFactory.HtmlTextLiteral(new SyntaxList(textResult.Node)); + } + + return null; + } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/SpanEditHandler.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/SpanEditHandler.cs index d5407f34dd..321b4d37ce 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/SpanEditHandler.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/SpanEditHandler.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Generic; -using System.Diagnostics; +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; namespace Microsoft.AspNetCore.Razor.Language.Legacy { @@ -11,12 +11,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { private static readonly int TypeHashCode = typeof(SpanEditHandler).GetHashCode(); - public SpanEditHandler(Func> tokenizer) + public SpanEditHandler(Func> tokenizer) : this(tokenizer, AcceptedCharactersInternal.Any) { } - public SpanEditHandler(Func> tokenizer, AcceptedCharactersInternal accepted) + public SpanEditHandler(Func> tokenizer, AcceptedCharactersInternal accepted) { AcceptedCharacters = accepted; Tokenizer = tokenizer; @@ -24,9 +24,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy public AcceptedCharactersInternal AcceptedCharacters { get; set; } - public Func> Tokenizer { get; set; } + public Func> Tokenizer { get; set; } - public static SpanEditHandler CreateDefault(Func> tokenizer) + public static SpanEditHandler CreateDefault(Func> tokenizer) { return new SpanEditHandler(tokenizer); } @@ -116,8 +116,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy public override bool Equals(object obj) { - var other = obj as SpanEditHandler; - return other != null && + return obj is SpanEditHandler other && GetType() == other.GetType() && AcceptedCharacters == other.AcceptedCharacters; } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/TagHelperBlockRewriter.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/TagHelperBlockRewriter.cs index f08d0579e5..1aea40a746 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/TagHelperBlockRewriter.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/TagHelperBlockRewriter.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; +using Microsoft.AspNetCore.Razor.Language.Syntax; namespace Microsoft.AspNetCore.Razor.Language.Legacy { @@ -150,7 +151,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy }; // Will contain tokens that represent a single attribute value: - var htmlTokens = span.Tokens.OfType().ToArray(); + var tokens = span.Tokens; var capturedAttributeValueStart = false; var attributeValueStartLocation = span.Start; @@ -165,9 +166,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy // Iterate down through the tokens to find the name and the start of the value. // We subtract the tokenOffset so we don't accept an ending quote of a span. - for (var i = 0; i < htmlTokens.Length - tokenOffset; i++) + for (var i = 0; i < tokens.Count - tokenOffset; i++) { - var token = htmlTokens[i]; + var token = tokens[i]; if (afterEquals) { @@ -186,9 +187,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy attributeValueStartLocation = token.Start; } - builder.Accept(token); + builder.Accept(token.Green); } - else if (name == null && HtmlMarkupParser.IsValidAttributeNameToken(token)) + else if (name == null && HtmlMarkupParser.IsValidAttributeNameToken(token.Green)) { // We've captured all leading whitespace prior to the attribute name. // We're now at: " |asp-for='...'" or " |asp-for=..." @@ -196,10 +197,10 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy var nameBuilder = new StringBuilder(); // Move the indexer past the attribute name tokens. - for (var j = i; j < htmlTokens.Length; j++) + for (var j = i; j < tokens.Count; j++) { - var nameToken = htmlTokens[j]; - if (!HtmlMarkupParser.IsValidAttributeNameToken(nameToken)) + var nameToken = tokens[j]; + if (!HtmlMarkupParser.IsValidAttributeNameToken(nameToken.Green)) { break; } @@ -213,7 +214,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy name = nameBuilder.ToString(); attributeValueStartLocation = SourceLocationTracker.Advance(attributeValueStartLocation, name); } - else if (token.Type == HtmlTokenType.Equals) + else if (token.Kind == SyntaxKind.Equals) { // We've captured all leading whitespace and the attribute name. // We're now at: " asp-for|='...'" or " asp-for|=..." @@ -227,19 +228,19 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy do { i++; // Start from the token after '='. - } while (i < htmlTokens.Length && - (htmlTokens[i].Type == HtmlTokenType.WhiteSpace || - htmlTokens[i].Type == HtmlTokenType.NewLine)); + } while (i < tokens.Count && + (tokens[i].Kind == SyntaxKind.Whitespace || + tokens[i].Kind == SyntaxKind.NewLine)); // Check for attribute start values, aka single or double quote - if (i < htmlTokens.Length && IsQuote(htmlTokens[i])) + if (i < tokens.Count && IsQuote(tokens[i])) { - if (htmlTokens[i].Type == HtmlTokenType.SingleQuote) + if (tokens[i].Kind == SyntaxKind.SingleQuote) { attributeValueStyle = AttributeStructure.SingleQuotes; } - tokenStartLocation = htmlTokens[i].Start; + tokenStartLocation = tokens[i].Start; // If there's a start quote then there must be an end quote to be valid, skip it. tokenOffset = 1; @@ -260,7 +261,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy afterEquals = true; } - else if (token.Type == HtmlTokenType.WhiteSpace) + else if (token.Kind == SyntaxKind.Whitespace) { // We're at the start of the attribute, this branch may be hit on the first iterations of // the loop since the parser separates attributes with their spaces included as tokens. @@ -343,9 +344,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy var nameTokens = childSpan .Tokens - .OfType() - .SkipWhile(token => !HtmlMarkupParser.IsValidAttributeNameToken(token)) // Skip prefix - .TakeWhile(nameToken => HtmlMarkupParser.IsValidAttributeNameToken(nameToken)) + .SkipWhile(token => !HtmlMarkupParser.IsValidAttributeNameToken(token.Green)) // Skip prefix + .TakeWhile(nameToken => HtmlMarkupParser.IsValidAttributeNameToken(nameToken.Green)) .Select(nameToken => nameToken.Content); var name = string.Concat(nameTokens); @@ -362,12 +362,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy var result = CreateTryParseResult(name, descriptors, processedBoundAttributeNames); var firstChild = builder.Children[0] as Span; - if (firstChild != null && firstChild.Tokens[0] is HtmlToken) + if (firstChild != null) { - var htmlToken = firstChild.Tokens[firstChild.Tokens.Count - 1] as HtmlToken; - switch (htmlToken.Type) + var token = firstChild.Tokens[firstChild.Tokens.Count - 1]; + switch (token.Kind) { - case HtmlTokenType.Equals: + case SyntaxKind.Equals: if (builder.Children.Count == 2 && builder.Children[1] is Span value && value.Kind == SpanKindInternal.Markup) @@ -385,10 +385,10 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy result.AttributeStructure = AttributeStructure.DoubleQuotes; } break; - case HtmlTokenType.DoubleQuote: + case SyntaxKind.DoubleQuote: result.AttributeStructure = AttributeStructure.DoubleQuotes; break; - case HtmlTokenType.SingleQuote: + case SyntaxKind.SingleQuote: result.AttributeStructure = AttributeStructure.SingleQuotes; break; default: @@ -408,8 +408,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy // In some malformed cases e.g.

: ITokenizer - where TTokenType : struct - where TToken : TokenBase + internal abstract class Tokenizer : ITokenizer { protected Tokenizer(ITextDocument source) { @@ -31,7 +30,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy protected int? CurrentState { get; set; } - protected TToken CurrentToken { get; private set; } + protected SyntaxToken CurrenSyntaxToken { get; private set; } public ITextDocument Source { get; private set; } @@ -42,9 +41,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy get { return Source.Peek() == -1; } } - public abstract TTokenType RazorCommentStarType { get; } - public abstract TTokenType RazorCommentType { get; } - public abstract TTokenType RazorCommentTransitionType { get; } + public abstract SyntaxKind RazorCommentStarKind { get; } + public abstract SyntaxKind RazorCommentKind { get; } + public abstract SyntaxKind RazorCommentTransitionKind { get; } protected bool HaveContent { @@ -64,16 +63,16 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy public SourceLocation CurrentStart { get; private set; } - protected abstract TToken CreateToken(string content, TTokenType type, IReadOnlyList errors); + protected abstract SyntaxToken CreateToken(string content, SyntaxKind type, IReadOnlyList errors); protected abstract StateResult Dispatch(); - IToken ITokenizer.NextToken() + SyntaxToken ITokenizer.NextToken() { return NextToken(); } - public virtual TToken NextToken() + public virtual SyntaxToken NextToken() { // Post-Condition: Buffer should be empty at the start of Next() Debug.Assert(Buffer.Length == 0); @@ -95,7 +94,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return token; } - protected virtual TToken Turn() + protected virtual SyntaxToken Turn() { if (CurrentState != null) { @@ -105,19 +104,19 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy var next = Dispatch(); CurrentState = next.State; - CurrentToken = next.Result; + CurrenSyntaxToken = next.Result; } - while (CurrentState != null && CurrentToken == null); + while (CurrentState != null && CurrenSyntaxToken == null); if (CurrentState == null) { - return default(TToken); // Terminated + return default(SyntaxToken); // Terminated } - return CurrentToken; + return CurrenSyntaxToken; } - return default(TToken); + return default(SyntaxToken); } public void Reset() @@ -149,7 +148,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy /// Returns a result containing the specified output and indicating that the next call to /// should invoke the provided state. /// - protected StateResult Transition(int state, TToken result) + protected StateResult Transition(int state, SyntaxToken result) { return new StateResult(state, result); } @@ -159,7 +158,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return new StateResult((int)state, result: null); } - protected StateResult Transition(RazorCommentTokenizerState state, TToken result) + protected StateResult Transition(RazorCommentTokenizerState state, SyntaxToken result) { return new StateResult((int)state, result); } @@ -180,12 +179,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy /// Returns a result containing the specified output and indicating that the next call to /// should re-invoke the current state. /// - protected StateResult Stay(TToken result) + protected StateResult Stay(SyntaxToken result) { return new StateResult(CurrentState, result); } - protected TToken Single(TTokenType type) + protected SyntaxToken Single(SyntaxKind type) { TakeCurrent(); return EndToken(type); @@ -199,9 +198,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy CurrentStart = CurrentLocation; } - protected TToken EndToken(TTokenType type) + protected SyntaxToken EndToken(SyntaxKind type) { - TToken token = null; + SyntaxToken token = null; if (HaveContent) { // Perf: Don't allocate a new errors array unless necessary. @@ -222,7 +221,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return token; } - protected virtual string GetTokenContent(TTokenType type) + protected virtual string GetTokenContent(SyntaxKind type) { return Buffer.ToString(); } @@ -278,7 +277,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy AssertCurrent('*'); TakeCurrent(); - return Transition(1002, EndToken(RazorCommentStarType)); + return Transition(1002, EndToken(RazorCommentStarKind)); } protected StateResult RazorCommentBody() @@ -292,7 +291,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { return Transition( RazorCommentTokenizerState.StarAfterRazorCommentBody, - EndToken(RazorCommentType)); + EndToken(RazorCommentKind)); } else { @@ -306,7 +305,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } } - return Transition(StartState, EndToken(RazorCommentType)); + return Transition(StartState, EndToken(RazorCommentKind)); } protected StateResult StarAfterRazorCommentBody() @@ -315,14 +314,14 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy TakeCurrent(); return Transition( RazorCommentTokenizerState.AtTokenAfterRazorCommentBody, - EndToken(RazorCommentStarType)); + EndToken(RazorCommentStarKind)); } protected StateResult AtTokenAfterRazorCommentBody() { AssertCurrent('@'); TakeCurrent(); - return Transition(StartState, EndToken(RazorCommentTransitionType)); + return Transition(StartState, EndToken(RazorCommentTransitionKind)); } ///

@@ -397,7 +396,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy protected struct StateResult { - public StateResult(int? state, TToken result) + public StateResult(int? state, SyntaxToken result) { State = state; Result = result; @@ -405,7 +404,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy public int? State { get; } - public TToken Result { get; } + public SyntaxToken Result { get; } } private static LookaheadToken BeginLookahead(ITextBuffer buffer) diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/TokenizerBackedParser.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/TokenizerBackedParser.cs index af5a08831f..5168dbe79c 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/TokenizerBackedParser.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/TokenizerBackedParser.cs @@ -5,36 +5,37 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; namespace Microsoft.AspNetCore.Razor.Language.Legacy { - internal abstract partial class TokenizerBackedParser : ParserBase - where TTokenType : struct - where TTokenizer : Tokenizer - where TToken : TokenBase + internal abstract class TokenizerBackedParser : ParserBase + where TTokenizer : Tokenizer { - private readonly TokenizerView _tokenizer; + private readonly TokenizerView _tokenizer; - protected TokenizerBackedParser(LanguageCharacteristics language, ParserContext context) + protected TokenizerBackedParser(LanguageCharacteristics language, ParserContext context) : base(context) { Language = language; var languageTokenizer = Language.CreateTokenizer(Context.Source); - _tokenizer = new TokenizerView(languageTokenizer); + _tokenizer = new TokenizerView(languageTokenizer); Span = new SpanBuilder(CurrentLocation); } + protected ParserState ParserState { get; set; } + protected SpanBuilder Span { get; private set; } protected Action SpanConfig { get; set; } - protected TToken CurrentToken + protected SyntaxToken CurrentToken { get { return _tokenizer.Current; } } - protected TToken PreviousToken { get; private set; } + protected SyntaxToken PreviousToken { get; private set; } protected SourceLocation CurrentLocation => _tokenizer.Tokenizer.CurrentLocation; @@ -45,7 +46,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy get { return _tokenizer.EndOfFile; } } - protected LanguageCharacteristics Language { get; } + protected LanguageCharacteristics Language { get; } protected virtual void HandleEmbeddedTransition() { @@ -58,21 +59,18 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy public override void BuildSpan(SpanBuilder span, SourceLocation start, string content) { - foreach (IToken sym in Language.TokenizeString(start, content)) + foreach (var token in Language.TokenizeString(start, content)) { - span.Accept(sym); + span.Accept(token); } } protected void Initialize(SpanBuilder span) { - if (SpanConfig != null) - { - SpanConfig(span); - } + SpanConfig?.Invoke(span); } - protected TToken Lookahead(int count) + protected SyntaxToken Lookahead(int count) { if (count < 0) { @@ -84,7 +82,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } // We add 1 in order to store the current token. - var tokens = new TToken[count + 1]; + var tokens = new SyntaxToken[count + 1]; var currentToken = CurrentToken; tokens[0] = currentToken; @@ -115,7 +113,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy /// A predicate accepting the token being evaluated and the list of tokens which have been looped through. /// true, if the condition was met. false - if the condition wasn't met and the last token has already been processed. /// The list of previous tokens is passed in the reverse order. So the last processed element will be the first one in the list. - protected bool LookaheadUntil(Func, bool> condition) + protected bool LookaheadUntil(Func, bool> condition) { if (condition == null) { @@ -124,7 +122,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy var matchFound = false; - var tokens = new List(); + var tokens = new List(); tokens.Add(CurrentToken); while (true) @@ -163,14 +161,14 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy // Helpers [Conditional("DEBUG")] - internal void Assert(TTokenType expectedType) + internal void Assert(SyntaxKind expectedType) { - Debug.Assert(!EndOfFile && TokenTypeEquals(CurrentToken.Type, expectedType)); + Debug.Assert(!EndOfFile && TokenKindEquals(CurrentToken.Kind, expectedType)); } - abstract protected bool TokenTypeEquals(TTokenType x, TTokenType y); + protected abstract bool TokenKindEquals(SyntaxKind x, SyntaxKind y); - protected internal void PutBack(TToken token) + protected internal void PutBack(SyntaxToken token) { if (token != null) { @@ -180,7 +178,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy /// /// Put the specified tokens back in the input stream. The provided list MUST be in the ORDER THE TOKENS WERE READ. The - /// list WILL be reversed and the Putback(TToken) will be called on each item. + /// list WILL be reversed and the Putback(SyntaxToken) will be called on each item. /// /// /// If a document contains tokens: a, b, c, d, e, f @@ -189,9 +187,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy /// that is the correct format for providing to this method. The caller of this method would, /// in that case, want to put c, b and a back into the stream, so "a, b, c" is the CORRECT order /// - protected internal void PutBack(IEnumerable tokens) + protected internal void PutBack(IEnumerable tokens) { - foreach (TToken token in tokens.Reverse()) + foreach (var token in tokens.Reverse()) { PutBack(token); } @@ -207,7 +205,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy protected internal bool Balance(BalancingModes mode) { - var left = CurrentToken.Type; + var left = CurrentToken.Kind; var right = Language.FlipBracket(left); var start = CurrentStart; AcceptAndMoveNext(); @@ -223,21 +221,21 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return Balance(mode, left, right, start); } - protected internal bool Balance(BalancingModes mode, TTokenType left, TTokenType right, SourceLocation start) + protected internal bool Balance(BalancingModes mode, SyntaxKind left, SyntaxKind right, SourceLocation start) { var startPosition = CurrentStart.AbsoluteIndex; var nesting = 1; if (!EndOfFile) { - var syms = new List(); + var tokens = new List(); do { if (IsAtEmbeddedTransition( (mode & BalancingModes.AllowCommentsAndTemplates) == BalancingModes.AllowCommentsAndTemplates, (mode & BalancingModes.AllowEmbeddedTransitions) == BalancingModes.AllowEmbeddedTransitions)) { - Accept(syms); - syms.Clear(); + Accept(tokens); + tokens.Clear(); HandleEmbeddedTransition(); // Reset backtracking since we've already outputted some spans. @@ -253,7 +251,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } if (nesting > 0) { - syms.Add(CurrentToken); + tokens.Add(CurrentToken); } } while (nesting > 0 && NextToken()); @@ -275,29 +273,29 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } else { - Accept(syms); + Accept(tokens); } } else { // Accept all the tokens we saw - Accept(syms); + Accept(tokens); } } return nesting == 0; } - protected internal bool NextIs(TTokenType type) + protected internal bool NextIs(SyntaxKind type) { - return NextIs(sym => sym != null && TokenTypeEquals(type, sym.Type)); + return NextIs(token => token != null && TokenKindEquals(type, token.Kind)); } - protected internal bool NextIs(params TTokenType[] types) + protected internal bool NextIs(params SyntaxKind[] types) { - return NextIs(sym => sym != null && types.Any(t => TokenTypeEquals(t, sym.Type))); + return NextIs(token => token != null && types.Any(t => TokenKindEquals(t, token.Kind))); } - protected internal bool NextIs(Func condition) + protected internal bool NextIs(Func condition) { var cur = CurrentToken; if (NextToken()) @@ -317,14 +315,14 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return false; } - protected internal bool Was(TTokenType type) + protected internal bool Was(SyntaxKind type) { - return PreviousToken != null && TokenTypeEquals(PreviousToken.Type, type); + return PreviousToken != null && TokenKindEquals(PreviousToken.Kind, type); } - protected internal bool At(TTokenType type) + protected internal bool At(SyntaxKind type) { - return !EndOfFile && CurrentToken != null && TokenTypeEquals(CurrentToken.Type, type); + return !EndOfFile && CurrentToken != null && TokenKindEquals(CurrentToken.Kind, type); } protected internal bool AcceptAndMoveNext() @@ -333,11 +331,11 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return NextToken(); } - protected TToken AcceptSingleWhiteSpaceCharacter() + protected SyntaxToken AcceptSingleWhiteSpaceCharacter() { if (Language.IsWhiteSpace(CurrentToken)) { - Tuple pair = Language.SplitToken(CurrentToken, 1, Language.GetKnownTokenType(KnownTokenType.WhiteSpace)); + var pair = Language.SplitToken(CurrentToken, 1, Language.GetKnownTokenType(KnownTokenType.WhiteSpace)); Accept(pair.Item1); Span.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.None; NextToken(); @@ -346,19 +344,19 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return null; } - protected internal void Accept(IEnumerable tokens) + protected internal void Accept(IEnumerable tokens) { - foreach (TToken token in tokens) + foreach (var token in tokens) { Accept(token); } } - protected internal void Accept(TToken token) + protected internal void Accept(SyntaxToken token) { if (token != null) { - foreach (var error in token.Errors) + foreach (var error in token.GetDiagnostics()) { Context.ErrorSink.OnError(error); } @@ -367,11 +365,11 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } } - protected internal bool AcceptAll(params TTokenType[] types) + protected internal bool AcceptAll(params SyntaxKind[] kinds) { - foreach (TTokenType type in types) + foreach (var kind in kinds) { - if (CurrentToken == null || !TokenTypeEquals(CurrentToken.Type, type)) + if (CurrentToken == null || !TokenKindEquals(CurrentToken.Kind, kind)) { return false; } @@ -388,31 +386,31 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } } - protected internal void Output(SpanKindInternal kind) + protected internal void Output(SpanKindInternal kind, SyntaxKind syntaxKind = SyntaxKind.Unknown) { Configure(kind, null); - Output(); + Output(syntaxKind); } - protected internal void Output(SpanKindInternal kind, AcceptedCharactersInternal accepts) + protected internal void Output(SpanKindInternal kind, AcceptedCharactersInternal accepts, SyntaxKind syntaxKind = SyntaxKind.Unknown) { Configure(kind, accepts); - Output(); + Output(syntaxKind); } - protected internal void Output(AcceptedCharactersInternal accepts) + protected internal void Output(AcceptedCharactersInternal accepts, SyntaxKind syntaxKind = SyntaxKind.Unknown) { Configure(null, accepts); - Output(); + Output(syntaxKind); } - private void Output() + private void Output(SyntaxKind syntaxKind) { if (Span.Tokens.Count > 0) { var nextStart = Span.End; - var builtSpan = Span.Build(); + var builtSpan = Span.Build(syntaxKind); Context.Builder.Add(builtSpan); Initialize(Span); @@ -437,7 +435,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy protected IDisposable PushSpanConfig(Action> newConfig) { - Action old = SpanConfig; + var old = SpanConfig; ConfigureSpan(newConfig); return new DisposableAction(() => SpanConfig = old); } @@ -450,7 +448,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy protected void ConfigureSpan(Action> config) { - Action prev = SpanConfig; + var prev = SpanConfig; if (config == null) { SpanConfig = null; @@ -467,9 +465,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy Expected(Language.GetKnownTokenType(type)); } - protected internal void Expected(params TTokenType[] types) + protected internal void Expected(params SyntaxKind[] types) { - Debug.Assert(!EndOfFile && CurrentToken != null && types.Contains(CurrentToken.Type)); + Debug.Assert(!EndOfFile && CurrentToken != null && types.Contains(CurrentToken.Kind)); AcceptAndMoveNext(); } @@ -478,7 +476,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return Optional(Language.GetKnownTokenType(type)); } - protected internal bool Optional(TTokenType type) + protected internal bool Optional(SyntaxKind type) { if (At(type)) { @@ -498,61 +496,61 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return true; } - protected internal void AcceptWhile(TTokenType type) + protected internal void AcceptWhile(SyntaxKind type) { - AcceptWhile(sym => TokenTypeEquals(type, sym.Type)); + AcceptWhile(token => TokenKindEquals(type, token.Kind)); } // We want to avoid array allocations and enumeration where possible, so we use the same technique as string.Format - protected internal void AcceptWhile(TTokenType type1, TTokenType type2) + protected internal void AcceptWhile(SyntaxKind type1, SyntaxKind type2) { - AcceptWhile(sym => TokenTypeEquals(type1, sym.Type) || TokenTypeEquals(type2, sym.Type)); + AcceptWhile(token => TokenKindEquals(type1, token.Kind) || TokenKindEquals(type2, token.Kind)); } - protected internal void AcceptWhile(TTokenType type1, TTokenType type2, TTokenType type3) + protected internal void AcceptWhile(SyntaxKind type1, SyntaxKind type2, SyntaxKind type3) { - AcceptWhile(sym => TokenTypeEquals(type1, sym.Type) || TokenTypeEquals(type2, sym.Type) || TokenTypeEquals(type3, sym.Type)); + AcceptWhile(token => TokenKindEquals(type1, token.Kind) || TokenKindEquals(type2, token.Kind) || TokenKindEquals(type3, token.Kind)); } - protected internal void AcceptWhile(params TTokenType[] types) + protected internal void AcceptWhile(params SyntaxKind[] types) { - AcceptWhile(sym => types.Any(expected => TokenTypeEquals(expected, sym.Type))); + AcceptWhile(token => types.Any(expected => TokenKindEquals(expected, token.Kind))); } - protected internal void AcceptUntil(TTokenType type) + protected internal void AcceptUntil(SyntaxKind type) { - AcceptWhile(sym => !TokenTypeEquals(type, sym.Type)); + AcceptWhile(token => !TokenKindEquals(type, token.Kind)); } // We want to avoid array allocations and enumeration where possible, so we use the same technique as string.Format - protected internal void AcceptUntil(TTokenType type1, TTokenType type2) + protected internal void AcceptUntil(SyntaxKind type1, SyntaxKind type2) { - AcceptWhile(sym => !TokenTypeEquals(type1, sym.Type) && !TokenTypeEquals(type2, sym.Type)); + AcceptWhile(token => !TokenKindEquals(type1, token.Kind) && !TokenKindEquals(type2, token.Kind)); } - protected internal void AcceptUntil(TTokenType type1, TTokenType type2, TTokenType type3) + protected internal void AcceptUntil(SyntaxKind type1, SyntaxKind type2, SyntaxKind type3) { - AcceptWhile(sym => !TokenTypeEquals(type1, sym.Type) && !TokenTypeEquals(type2, sym.Type) && !TokenTypeEquals(type3, sym.Type)); + AcceptWhile(token => !TokenKindEquals(type1, token.Kind) && !TokenKindEquals(type2, token.Kind) && !TokenKindEquals(type3, token.Kind)); } - protected internal void AcceptUntil(params TTokenType[] types) + protected internal void AcceptUntil(params SyntaxKind[] types) { - AcceptWhile(sym => types.All(expected => !TokenTypeEquals(expected, sym.Type))); + AcceptWhile(token => types.All(expected => !TokenKindEquals(expected, token.Kind))); } - protected internal void AcceptWhile(Func condition) + protected internal void AcceptWhile(Func condition) { Accept(ReadWhileLazy(condition)); } - protected internal IEnumerable ReadWhile(Func condition) + protected internal IEnumerable ReadWhile(Func condition) { return ReadWhileLazy(condition).ToList(); } - protected TToken AcceptWhiteSpaceInLines() + protected SyntaxToken AcceptWhiteSpaceInLines() { - TToken lastWs = null; + SyntaxToken lastWs = null; while (Language.IsWhiteSpace(CurrentToken) || Language.IsNewLine(CurrentToken)) { // Capture the previous whitespace node @@ -586,7 +584,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy // Don't open this to sub classes because it's lazy but it looks eager. // You have to advance the Enumerable to read the next characters. - internal IEnumerable ReadWhileLazy(Func condition) + internal IEnumerable ReadWhileLazy(Func condition) { while (EnsureCurrent() && condition(CurrentToken)) { diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/TokenizerView.cs b/src/Microsoft.AspNetCore.Razor.Language/Legacy/TokenizerView.cs index 2b290bda5c..ef481af1ac 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/TokenizerView.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Legacy/TokenizerView.cs @@ -1,12 +1,12 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; + namespace Microsoft.AspNetCore.Razor.Language.Legacy { - internal class TokenizerView - where TTokenType : struct - where TTokenizer : Tokenizer - where TToken : TokenBase + internal class TokenizerView + where TTokenizer : Tokenizer { public TokenizerView(TTokenizer tokenizer) { @@ -15,7 +15,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy public TTokenizer Tokenizer { get; private set; } public bool EndOfFile { get; private set; } - public TToken Current { get; private set; } + public SyntaxToken Current { get; private set; } public ITextDocument Source { @@ -29,7 +29,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return !EndOfFile; } - public void PutBack(TToken token) + public void PutBack(SyntaxToken token) { Source.Position -= token.Content.Length; Current = null; diff --git a/src/Microsoft.AspNetCore.Razor.Language/Properties/AssemblyInfo.cs b/src/Microsoft.AspNetCore.Razor.Language/Properties/AssemblyInfo.cs index 7214d8baca..310bbca195 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Properties/AssemblyInfo.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Properties/AssemblyInfo.cs @@ -2,6 +2,8 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Runtime.CompilerServices; +[assembly: InternalsVisibleTo("rzls, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] +[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Razor.LanguageServer.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.AspNetCore.Razor.Performance, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Razor.Extensions.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/ArrayElement.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/ArrayElement.cs new file mode 100644 index 0000000000..85345e657b --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/ArrayElement.cs @@ -0,0 +1,58 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace Microsoft.AspNetCore.Razor.Language.Syntax +{ + internal struct ArrayElement + { + public T Value; + + public static implicit operator T(ArrayElement element) + { + return element.Value; + } + + //NOTE: there is no opposite conversion operator T -> ArrayElement + // + // that is because it is preferred to update array elements in-place + // "elements[i].Value = v" results in much better code than "elements[i] = (ArrayElement)v" + // + // The reason is that x86 ABI requires that structs must be returned in + // a return buffer even if they can fit in a register like this one. + // Also since struct contains a reference, the write to the buffer is done with a checked GC barrier + // as JIT does not know if the write goes to a stack or a heap location. + // Assigning to Value directly easily avoids all this redundancy. + + public static ArrayElement[] MakeElementArray(T[] items) + { + if (items == null) + { + return null; + } + + var array = new ArrayElement[items.Length]; + for (var i = 0; i < items.Length; i++) + { + array[i].Value = items[i]; + } + + return array; + } + + public static T[] MakeArray(ArrayElement[] items) + { + if (items == null) + { + return null; + } + + var array = new T[items.Length]; + for (var i = 0; i < items.Length; i++) + { + array[i] = items[i].Value; + } + + return array; + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/Generated/Syntax.xml.Internal.Generated.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/Generated/Syntax.xml.Internal.Generated.cs new file mode 100644 index 0000000000..aee8330582 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/Generated/Syntax.xml.Internal.Generated.cs @@ -0,0 +1,1406 @@ +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; + +namespace Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax +{ + internal abstract partial class RazorSyntaxNode : GreenNode + { + internal RazorSyntaxNode(SyntaxKind kind, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) + : base(kind, diagnostics, annotations) + { + } + internal RazorSyntaxNode(SyntaxKind kind) + : base(kind) + { + } + } + + internal sealed partial class RazorCommentBlockSyntax : RazorSyntaxNode + { + private readonly SyntaxToken _startCommentTransition; + private readonly SyntaxToken _startCommentStar; + private readonly SyntaxToken _comment; + private readonly SyntaxToken _endCommentStar; + private readonly SyntaxToken _endCommentTransition; + + internal RazorCommentBlockSyntax(SyntaxKind kind, SyntaxToken startCommentTransition, SyntaxToken startCommentStar, SyntaxToken comment, SyntaxToken endCommentStar, SyntaxToken endCommentTransition, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) + : base(kind, diagnostics, annotations) + { + SlotCount = 5; + AdjustFlagsAndWidth(startCommentTransition); + _startCommentTransition = startCommentTransition; + AdjustFlagsAndWidth(startCommentStar); + _startCommentStar = startCommentStar; + if (comment != null) + { + AdjustFlagsAndWidth(comment); + _comment = comment; + } + AdjustFlagsAndWidth(endCommentStar); + _endCommentStar = endCommentStar; + AdjustFlagsAndWidth(endCommentTransition); + _endCommentTransition = endCommentTransition; + } + + + internal RazorCommentBlockSyntax(SyntaxKind kind, SyntaxToken startCommentTransition, SyntaxToken startCommentStar, SyntaxToken comment, SyntaxToken endCommentStar, SyntaxToken endCommentTransition) + : base(kind) + { + SlotCount = 5; + AdjustFlagsAndWidth(startCommentTransition); + _startCommentTransition = startCommentTransition; + AdjustFlagsAndWidth(startCommentStar); + _startCommentStar = startCommentStar; + if (comment != null) + { + AdjustFlagsAndWidth(comment); + _comment = comment; + } + AdjustFlagsAndWidth(endCommentStar); + _endCommentStar = endCommentStar; + AdjustFlagsAndWidth(endCommentTransition); + _endCommentTransition = endCommentTransition; + } + + public SyntaxToken StartCommentTransition { get { return _startCommentTransition; } } + public SyntaxToken StartCommentStar { get { return _startCommentStar; } } + public SyntaxToken Comment { get { return _comment; } } + public SyntaxToken EndCommentStar { get { return _endCommentStar; } } + public SyntaxToken EndCommentTransition { get { return _endCommentTransition; } } + + internal override GreenNode GetSlot(int index) + { + switch (index) + { + case 0: return _startCommentTransition; + case 1: return _startCommentStar; + case 2: return _comment; + case 3: return _endCommentStar; + case 4: return _endCommentTransition; + default: return null; + } + } + + internal override SyntaxNode CreateRed(SyntaxNode parent, int position) + { + return new Syntax.RazorCommentBlockSyntax(this, parent, position); + } + + public override TResult Accept(SyntaxVisitor visitor) + { + return visitor.VisitRazorCommentBlock(this); + } + + public override void Accept(SyntaxVisitor visitor) + { + visitor.VisitRazorCommentBlock(this); + } + + public RazorCommentBlockSyntax Update(SyntaxToken startCommentTransition, SyntaxToken startCommentStar, SyntaxToken comment, SyntaxToken endCommentStar, SyntaxToken endCommentTransition) + { + if (startCommentTransition != StartCommentTransition || startCommentStar != StartCommentStar || comment != Comment || endCommentStar != EndCommentStar || endCommentTransition != EndCommentTransition) + { + var newNode = SyntaxFactory.RazorCommentBlock(startCommentTransition, startCommentStar, comment, endCommentStar, endCommentTransition); + var diags = GetDiagnostics(); + if (diags != null && diags.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations != null && annotations.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) + { + return new RazorCommentBlockSyntax(Kind, _startCommentTransition, _startCommentStar, _comment, _endCommentStar, _endCommentTransition, diagnostics, GetAnnotations()); + } + + internal override GreenNode SetAnnotations(SyntaxAnnotation[] annotations) + { + return new RazorCommentBlockSyntax(Kind, _startCommentTransition, _startCommentStar, _comment, _endCommentStar, _endCommentTransition, GetDiagnostics(), annotations); + } + } + + internal abstract partial class HtmlSyntaxNode : RazorSyntaxNode + { + internal HtmlSyntaxNode(SyntaxKind kind, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) + : base(kind, diagnostics, annotations) + { + } + internal HtmlSyntaxNode(SyntaxKind kind) + : base(kind) + { + } + } + + internal sealed partial class HtmlTextLiteralSyntax : HtmlSyntaxNode + { + private readonly GreenNode _textTokens; + + internal HtmlTextLiteralSyntax(SyntaxKind kind, GreenNode textTokens, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) + : base(kind, diagnostics, annotations) + { + SlotCount = 1; + if (textTokens != null) + { + AdjustFlagsAndWidth(textTokens); + _textTokens = textTokens; + } + } + + + internal HtmlTextLiteralSyntax(SyntaxKind kind, GreenNode textTokens) + : base(kind) + { + SlotCount = 1; + if (textTokens != null) + { + AdjustFlagsAndWidth(textTokens); + _textTokens = textTokens; + } + } + + public SyntaxList TextTokens { get { return new SyntaxList(_textTokens); } } + + internal override GreenNode GetSlot(int index) + { + switch (index) + { + case 0: return _textTokens; + default: return null; + } + } + + internal override SyntaxNode CreateRed(SyntaxNode parent, int position) + { + return new Syntax.HtmlTextLiteralSyntax(this, parent, position); + } + + public override TResult Accept(SyntaxVisitor visitor) + { + return visitor.VisitHtmlTextLiteral(this); + } + + public override void Accept(SyntaxVisitor visitor) + { + visitor.VisitHtmlTextLiteral(this); + } + + public HtmlTextLiteralSyntax Update(Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax.SyntaxList textTokens) + { + if (textTokens != TextTokens) + { + var newNode = SyntaxFactory.HtmlTextLiteral(textTokens); + var diags = GetDiagnostics(); + if (diags != null && diags.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations != null && annotations.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) + { + return new HtmlTextLiteralSyntax(Kind, _textTokens, diagnostics, GetAnnotations()); + } + + internal override GreenNode SetAnnotations(SyntaxAnnotation[] annotations) + { + return new HtmlTextLiteralSyntax(Kind, _textTokens, GetDiagnostics(), annotations); + } + } + + internal abstract partial class CSharpSyntaxNode : RazorSyntaxNode + { + internal CSharpSyntaxNode(SyntaxKind kind, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) + : base(kind, diagnostics, annotations) + { + } + internal CSharpSyntaxNode(SyntaxKind kind) + : base(kind) + { + } + } + + internal sealed partial class CSharpTransitionSyntax : CSharpSyntaxNode + { + private readonly SyntaxToken _transition; + + internal CSharpTransitionSyntax(SyntaxKind kind, SyntaxToken transition, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) + : base(kind, diagnostics, annotations) + { + SlotCount = 1; + AdjustFlagsAndWidth(transition); + _transition = transition; + } + + + internal CSharpTransitionSyntax(SyntaxKind kind, SyntaxToken transition) + : base(kind) + { + SlotCount = 1; + AdjustFlagsAndWidth(transition); + _transition = transition; + } + + public SyntaxToken Transition { get { return _transition; } } + + internal override GreenNode GetSlot(int index) + { + switch (index) + { + case 0: return _transition; + default: return null; + } + } + + internal override SyntaxNode CreateRed(SyntaxNode parent, int position) + { + return new Syntax.CSharpTransitionSyntax(this, parent, position); + } + + public override TResult Accept(SyntaxVisitor visitor) + { + return visitor.VisitCSharpTransition(this); + } + + public override void Accept(SyntaxVisitor visitor) + { + visitor.VisitCSharpTransition(this); + } + + public CSharpTransitionSyntax Update(SyntaxToken transition) + { + if (transition != Transition) + { + var newNode = SyntaxFactory.CSharpTransition(transition); + var diags = GetDiagnostics(); + if (diags != null && diags.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations != null && annotations.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) + { + return new CSharpTransitionSyntax(Kind, _transition, diagnostics, GetAnnotations()); + } + + internal override GreenNode SetAnnotations(SyntaxAnnotation[] annotations) + { + return new CSharpTransitionSyntax(Kind, _transition, GetDiagnostics(), annotations); + } + } + + internal sealed partial class CSharpMetaCodeSyntax : CSharpSyntaxNode + { + private readonly GreenNode _metaCode; + + internal CSharpMetaCodeSyntax(SyntaxKind kind, GreenNode metaCode, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) + : base(kind, diagnostics, annotations) + { + SlotCount = 1; + if (metaCode != null) + { + AdjustFlagsAndWidth(metaCode); + _metaCode = metaCode; + } + } + + + internal CSharpMetaCodeSyntax(SyntaxKind kind, GreenNode metaCode) + : base(kind) + { + SlotCount = 1; + if (metaCode != null) + { + AdjustFlagsAndWidth(metaCode); + _metaCode = metaCode; + } + } + + public SyntaxList MetaCode { get { return new SyntaxList(_metaCode); } } + + internal override GreenNode GetSlot(int index) + { + switch (index) + { + case 0: return _metaCode; + default: return null; + } + } + + internal override SyntaxNode CreateRed(SyntaxNode parent, int position) + { + return new Syntax.CSharpMetaCodeSyntax(this, parent, position); + } + + public override TResult Accept(SyntaxVisitor visitor) + { + return visitor.VisitCSharpMetaCode(this); + } + + public override void Accept(SyntaxVisitor visitor) + { + visitor.VisitCSharpMetaCode(this); + } + + public CSharpMetaCodeSyntax Update(Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax.SyntaxList metaCode) + { + if (metaCode != MetaCode) + { + var newNode = SyntaxFactory.CSharpMetaCode(metaCode); + var diags = GetDiagnostics(); + if (diags != null && diags.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations != null && annotations.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) + { + return new CSharpMetaCodeSyntax(Kind, _metaCode, diagnostics, GetAnnotations()); + } + + internal override GreenNode SetAnnotations(SyntaxAnnotation[] annotations) + { + return new CSharpMetaCodeSyntax(Kind, _metaCode, GetDiagnostics(), annotations); + } + } + + internal sealed partial class CSharpCodeLiteralSyntax : CSharpSyntaxNode + { + private readonly GreenNode _cSharpTokens; + + internal CSharpCodeLiteralSyntax(SyntaxKind kind, GreenNode cSharpTokens, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) + : base(kind, diagnostics, annotations) + { + SlotCount = 1; + if (cSharpTokens != null) + { + AdjustFlagsAndWidth(cSharpTokens); + _cSharpTokens = cSharpTokens; + } + } + + + internal CSharpCodeLiteralSyntax(SyntaxKind kind, GreenNode cSharpTokens) + : base(kind) + { + SlotCount = 1; + if (cSharpTokens != null) + { + AdjustFlagsAndWidth(cSharpTokens); + _cSharpTokens = cSharpTokens; + } + } + + public SyntaxList CSharpTokens { get { return new SyntaxList(_cSharpTokens); } } + + internal override GreenNode GetSlot(int index) + { + switch (index) + { + case 0: return _cSharpTokens; + default: return null; + } + } + + internal override SyntaxNode CreateRed(SyntaxNode parent, int position) + { + return new Syntax.CSharpCodeLiteralSyntax(this, parent, position); + } + + public override TResult Accept(SyntaxVisitor visitor) + { + return visitor.VisitCSharpCodeLiteral(this); + } + + public override void Accept(SyntaxVisitor visitor) + { + visitor.VisitCSharpCodeLiteral(this); + } + + public CSharpCodeLiteralSyntax Update(Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax.SyntaxList cSharpTokens) + { + if (cSharpTokens != CSharpTokens) + { + var newNode = SyntaxFactory.CSharpCodeLiteral(cSharpTokens); + var diags = GetDiagnostics(); + if (diags != null && diags.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations != null && annotations.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) + { + return new CSharpCodeLiteralSyntax(Kind, _cSharpTokens, diagnostics, GetAnnotations()); + } + + internal override GreenNode SetAnnotations(SyntaxAnnotation[] annotations) + { + return new CSharpCodeLiteralSyntax(Kind, _cSharpTokens, GetDiagnostics(), annotations); + } + } + + internal sealed partial class CSharpCodeBlockSyntax : CSharpSyntaxNode + { + private readonly GreenNode _children; + + internal CSharpCodeBlockSyntax(SyntaxKind kind, GreenNode children, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) + : base(kind, diagnostics, annotations) + { + SlotCount = 1; + if (children != null) + { + AdjustFlagsAndWidth(children); + _children = children; + } + } + + + internal CSharpCodeBlockSyntax(SyntaxKind kind, GreenNode children) + : base(kind) + { + SlotCount = 1; + if (children != null) + { + AdjustFlagsAndWidth(children); + _children = children; + } + } + + public SyntaxList Children { get { return new SyntaxList(_children); } } + + internal override GreenNode GetSlot(int index) + { + switch (index) + { + case 0: return _children; + default: return null; + } + } + + internal override SyntaxNode CreateRed(SyntaxNode parent, int position) + { + return new Syntax.CSharpCodeBlockSyntax(this, parent, position); + } + + public override TResult Accept(SyntaxVisitor visitor) + { + return visitor.VisitCSharpCodeBlock(this); + } + + public override void Accept(SyntaxVisitor visitor) + { + visitor.VisitCSharpCodeBlock(this); + } + + public CSharpCodeBlockSyntax Update(Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax.SyntaxList children) + { + if (children != Children) + { + var newNode = SyntaxFactory.CSharpCodeBlock(children); + var diags = GetDiagnostics(); + if (diags != null && diags.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations != null && annotations.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) + { + return new CSharpCodeBlockSyntax(Kind, _children, diagnostics, GetAnnotations()); + } + + internal override GreenNode SetAnnotations(SyntaxAnnotation[] annotations) + { + return new CSharpCodeBlockSyntax(Kind, _children, GetDiagnostics(), annotations); + } + } + + internal abstract partial class CSharpBlockSyntax : CSharpSyntaxNode + { + internal CSharpBlockSyntax(SyntaxKind kind, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) + : base(kind, diagnostics, annotations) + { + } + internal CSharpBlockSyntax(SyntaxKind kind) + : base(kind) + { + } + + public abstract CSharpTransitionSyntax Transition { get; } + + public abstract CSharpSyntaxNode Body { get; } + } + + internal sealed partial class CSharpStatement : CSharpBlockSyntax + { + private readonly CSharpTransitionSyntax _transition; + private readonly CSharpSyntaxNode _body; + + internal CSharpStatement(SyntaxKind kind, CSharpTransitionSyntax transition, CSharpSyntaxNode body, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) + : base(kind, diagnostics, annotations) + { + SlotCount = 2; + AdjustFlagsAndWidth(transition); + _transition = transition; + AdjustFlagsAndWidth(body); + _body = body; + } + + + internal CSharpStatement(SyntaxKind kind, CSharpTransitionSyntax transition, CSharpSyntaxNode body) + : base(kind) + { + SlotCount = 2; + AdjustFlagsAndWidth(transition); + _transition = transition; + AdjustFlagsAndWidth(body); + _body = body; + } + + public override CSharpTransitionSyntax Transition { get { return _transition; } } + public override CSharpSyntaxNode Body { get { return _body; } } + + internal override GreenNode GetSlot(int index) + { + switch (index) + { + case 0: return _transition; + case 1: return _body; + default: return null; + } + } + + internal override SyntaxNode CreateRed(SyntaxNode parent, int position) + { + return new Syntax.CSharpStatement(this, parent, position); + } + + public override TResult Accept(SyntaxVisitor visitor) + { + return visitor.VisitCSharpStatement(this); + } + + public override void Accept(SyntaxVisitor visitor) + { + visitor.VisitCSharpStatement(this); + } + + public CSharpStatement Update(CSharpTransitionSyntax transition, CSharpSyntaxNode body) + { + if (transition != Transition || body != Body) + { + var newNode = SyntaxFactory.CSharpStatement(transition, body); + var diags = GetDiagnostics(); + if (diags != null && diags.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations != null && annotations.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) + { + return new CSharpStatement(Kind, _transition, _body, diagnostics, GetAnnotations()); + } + + internal override GreenNode SetAnnotations(SyntaxAnnotation[] annotations) + { + return new CSharpStatement(Kind, _transition, _body, GetDiagnostics(), annotations); + } + } + + internal sealed partial class CSharpStatementBodySyntax : CSharpSyntaxNode + { + private readonly CSharpMetaCodeSyntax _openBrace; + private readonly CSharpCodeBlockSyntax _cSharpCode; + private readonly CSharpMetaCodeSyntax _closeBrace; + + internal CSharpStatementBodySyntax(SyntaxKind kind, CSharpMetaCodeSyntax openBrace, CSharpCodeBlockSyntax cSharpCode, CSharpMetaCodeSyntax closeBrace, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) + : base(kind, diagnostics, annotations) + { + SlotCount = 3; + AdjustFlagsAndWidth(openBrace); + _openBrace = openBrace; + AdjustFlagsAndWidth(cSharpCode); + _cSharpCode = cSharpCode; + AdjustFlagsAndWidth(closeBrace); + _closeBrace = closeBrace; + } + + + internal CSharpStatementBodySyntax(SyntaxKind kind, CSharpMetaCodeSyntax openBrace, CSharpCodeBlockSyntax cSharpCode, CSharpMetaCodeSyntax closeBrace) + : base(kind) + { + SlotCount = 3; + AdjustFlagsAndWidth(openBrace); + _openBrace = openBrace; + AdjustFlagsAndWidth(cSharpCode); + _cSharpCode = cSharpCode; + AdjustFlagsAndWidth(closeBrace); + _closeBrace = closeBrace; + } + + public CSharpMetaCodeSyntax OpenBrace { get { return _openBrace; } } + public CSharpCodeBlockSyntax CSharpCode { get { return _cSharpCode; } } + public CSharpMetaCodeSyntax CloseBrace { get { return _closeBrace; } } + + internal override GreenNode GetSlot(int index) + { + switch (index) + { + case 0: return _openBrace; + case 1: return _cSharpCode; + case 2: return _closeBrace; + default: return null; + } + } + + internal override SyntaxNode CreateRed(SyntaxNode parent, int position) + { + return new Syntax.CSharpStatementBodySyntax(this, parent, position); + } + + public override TResult Accept(SyntaxVisitor visitor) + { + return visitor.VisitCSharpStatementBody(this); + } + + public override void Accept(SyntaxVisitor visitor) + { + visitor.VisitCSharpStatementBody(this); + } + + public CSharpStatementBodySyntax Update(CSharpMetaCodeSyntax openBrace, CSharpCodeBlockSyntax cSharpCode, CSharpMetaCodeSyntax closeBrace) + { + if (openBrace != OpenBrace || cSharpCode != CSharpCode || closeBrace != CloseBrace) + { + var newNode = SyntaxFactory.CSharpStatementBody(openBrace, cSharpCode, closeBrace); + var diags = GetDiagnostics(); + if (diags != null && diags.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations != null && annotations.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) + { + return new CSharpStatementBodySyntax(Kind, _openBrace, _cSharpCode, _closeBrace, diagnostics, GetAnnotations()); + } + + internal override GreenNode SetAnnotations(SyntaxAnnotation[] annotations) + { + return new CSharpStatementBodySyntax(Kind, _openBrace, _cSharpCode, _closeBrace, GetDiagnostics(), annotations); + } + } + + internal sealed partial class CSharpExpression : CSharpBlockSyntax + { + private readonly CSharpTransitionSyntax _transition; + private readonly CSharpSyntaxNode _body; + + internal CSharpExpression(SyntaxKind kind, CSharpTransitionSyntax transition, CSharpSyntaxNode body, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) + : base(kind, diagnostics, annotations) + { + SlotCount = 2; + AdjustFlagsAndWidth(transition); + _transition = transition; + AdjustFlagsAndWidth(body); + _body = body; + } + + + internal CSharpExpression(SyntaxKind kind, CSharpTransitionSyntax transition, CSharpSyntaxNode body) + : base(kind) + { + SlotCount = 2; + AdjustFlagsAndWidth(transition); + _transition = transition; + AdjustFlagsAndWidth(body); + _body = body; + } + + public override CSharpTransitionSyntax Transition { get { return _transition; } } + public override CSharpSyntaxNode Body { get { return _body; } } + + internal override GreenNode GetSlot(int index) + { + switch (index) + { + case 0: return _transition; + case 1: return _body; + default: return null; + } + } + + internal override SyntaxNode CreateRed(SyntaxNode parent, int position) + { + return new Syntax.CSharpExpression(this, parent, position); + } + + public override TResult Accept(SyntaxVisitor visitor) + { + return visitor.VisitCSharpExpression(this); + } + + public override void Accept(SyntaxVisitor visitor) + { + visitor.VisitCSharpExpression(this); + } + + public CSharpExpression Update(CSharpTransitionSyntax transition, CSharpSyntaxNode body) + { + if (transition != Transition || body != Body) + { + var newNode = SyntaxFactory.CSharpExpression(transition, body); + var diags = GetDiagnostics(); + if (diags != null && diags.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations != null && annotations.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) + { + return new CSharpExpression(Kind, _transition, _body, diagnostics, GetAnnotations()); + } + + internal override GreenNode SetAnnotations(SyntaxAnnotation[] annotations) + { + return new CSharpExpression(Kind, _transition, _body, GetDiagnostics(), annotations); + } + } + + internal sealed partial class CSharpExpressionBodySyntax : CSharpSyntaxNode + { + private readonly CSharpMetaCodeSyntax _openParen; + private readonly CSharpCodeBlockSyntax _cSharpCode; + private readonly CSharpMetaCodeSyntax _closeParen; + + internal CSharpExpressionBodySyntax(SyntaxKind kind, CSharpMetaCodeSyntax openParen, CSharpCodeBlockSyntax cSharpCode, CSharpMetaCodeSyntax closeParen, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) + : base(kind, diagnostics, annotations) + { + SlotCount = 3; + if (openParen != null) + { + AdjustFlagsAndWidth(openParen); + _openParen = openParen; + } + AdjustFlagsAndWidth(cSharpCode); + _cSharpCode = cSharpCode; + if (closeParen != null) + { + AdjustFlagsAndWidth(closeParen); + _closeParen = closeParen; + } + } + + + internal CSharpExpressionBodySyntax(SyntaxKind kind, CSharpMetaCodeSyntax openParen, CSharpCodeBlockSyntax cSharpCode, CSharpMetaCodeSyntax closeParen) + : base(kind) + { + SlotCount = 3; + if (openParen != null) + { + AdjustFlagsAndWidth(openParen); + _openParen = openParen; + } + AdjustFlagsAndWidth(cSharpCode); + _cSharpCode = cSharpCode; + if (closeParen != null) + { + AdjustFlagsAndWidth(closeParen); + _closeParen = closeParen; + } + } + + public CSharpMetaCodeSyntax OpenParen { get { return _openParen; } } + public CSharpCodeBlockSyntax CSharpCode { get { return _cSharpCode; } } + public CSharpMetaCodeSyntax CloseParen { get { return _closeParen; } } + + internal override GreenNode GetSlot(int index) + { + switch (index) + { + case 0: return _openParen; + case 1: return _cSharpCode; + case 2: return _closeParen; + default: return null; + } + } + + internal override SyntaxNode CreateRed(SyntaxNode parent, int position) + { + return new Syntax.CSharpExpressionBodySyntax(this, parent, position); + } + + public override TResult Accept(SyntaxVisitor visitor) + { + return visitor.VisitCSharpExpressionBody(this); + } + + public override void Accept(SyntaxVisitor visitor) + { + visitor.VisitCSharpExpressionBody(this); + } + + public CSharpExpressionBodySyntax Update(CSharpMetaCodeSyntax openParen, CSharpCodeBlockSyntax cSharpCode, CSharpMetaCodeSyntax closeParen) + { + if (openParen != OpenParen || cSharpCode != CSharpCode || closeParen != CloseParen) + { + var newNode = SyntaxFactory.CSharpExpressionBody(openParen, cSharpCode, closeParen); + var diags = GetDiagnostics(); + if (diags != null && diags.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations != null && annotations.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) + { + return new CSharpExpressionBodySyntax(Kind, _openParen, _cSharpCode, _closeParen, diagnostics, GetAnnotations()); + } + + internal override GreenNode SetAnnotations(SyntaxAnnotation[] annotations) + { + return new CSharpExpressionBodySyntax(Kind, _openParen, _cSharpCode, _closeParen, GetDiagnostics(), annotations); + } + } + + internal sealed partial class CSharpDirectiveSyntax : CSharpBlockSyntax + { + private readonly CSharpTransitionSyntax _transition; + private readonly CSharpSyntaxNode _body; + + internal CSharpDirectiveSyntax(SyntaxKind kind, CSharpTransitionSyntax transition, CSharpSyntaxNode body, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) + : base(kind, diagnostics, annotations) + { + SlotCount = 2; + AdjustFlagsAndWidth(transition); + _transition = transition; + AdjustFlagsAndWidth(body); + _body = body; + } + + + internal CSharpDirectiveSyntax(SyntaxKind kind, CSharpTransitionSyntax transition, CSharpSyntaxNode body) + : base(kind) + { + SlotCount = 2; + AdjustFlagsAndWidth(transition); + _transition = transition; + AdjustFlagsAndWidth(body); + _body = body; + } + + public override CSharpTransitionSyntax Transition { get { return _transition; } } + public override CSharpSyntaxNode Body { get { return _body; } } + + internal override GreenNode GetSlot(int index) + { + switch (index) + { + case 0: return _transition; + case 1: return _body; + default: return null; + } + } + + internal override SyntaxNode CreateRed(SyntaxNode parent, int position) + { + return new Syntax.CSharpDirectiveSyntax(this, parent, position); + } + + public override TResult Accept(SyntaxVisitor visitor) + { + return visitor.VisitCSharpDirective(this); + } + + public override void Accept(SyntaxVisitor visitor) + { + visitor.VisitCSharpDirective(this); + } + + public CSharpDirectiveSyntax Update(CSharpTransitionSyntax transition, CSharpSyntaxNode body) + { + if (transition != Transition || body != Body) + { + var newNode = SyntaxFactory.CSharpDirective(transition, body); + var diags = GetDiagnostics(); + if (diags != null && diags.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations != null && annotations.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) + { + return new CSharpDirectiveSyntax(Kind, _transition, _body, diagnostics, GetAnnotations()); + } + + internal override GreenNode SetAnnotations(SyntaxAnnotation[] annotations) + { + return new CSharpDirectiveSyntax(Kind, _transition, _body, GetDiagnostics(), annotations); + } + } + + internal sealed partial class CSharpDirectiveBodySyntax : CSharpSyntaxNode + { + private readonly CSharpMetaCodeSyntax _keyword; + private readonly CSharpCodeBlockSyntax _cSharpCode; + + internal CSharpDirectiveBodySyntax(SyntaxKind kind, CSharpMetaCodeSyntax keyword, CSharpCodeBlockSyntax cSharpCode, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) + : base(kind, diagnostics, annotations) + { + SlotCount = 2; + AdjustFlagsAndWidth(keyword); + _keyword = keyword; + AdjustFlagsAndWidth(cSharpCode); + _cSharpCode = cSharpCode; + } + + + internal CSharpDirectiveBodySyntax(SyntaxKind kind, CSharpMetaCodeSyntax keyword, CSharpCodeBlockSyntax cSharpCode) + : base(kind) + { + SlotCount = 2; + AdjustFlagsAndWidth(keyword); + _keyword = keyword; + AdjustFlagsAndWidth(cSharpCode); + _cSharpCode = cSharpCode; + } + + public CSharpMetaCodeSyntax Keyword { get { return _keyword; } } + public CSharpCodeBlockSyntax CSharpCode { get { return _cSharpCode; } } + + internal override GreenNode GetSlot(int index) + { + switch (index) + { + case 0: return _keyword; + case 1: return _cSharpCode; + default: return null; + } + } + + internal override SyntaxNode CreateRed(SyntaxNode parent, int position) + { + return new Syntax.CSharpDirectiveBodySyntax(this, parent, position); + } + + public override TResult Accept(SyntaxVisitor visitor) + { + return visitor.VisitCSharpDirectiveBody(this); + } + + public override void Accept(SyntaxVisitor visitor) + { + visitor.VisitCSharpDirectiveBody(this); + } + + public CSharpDirectiveBodySyntax Update(CSharpMetaCodeSyntax keyword, CSharpCodeBlockSyntax cSharpCode) + { + if (keyword != Keyword || cSharpCode != CSharpCode) + { + var newNode = SyntaxFactory.CSharpDirectiveBody(keyword, cSharpCode); + var diags = GetDiagnostics(); + if (diags != null && diags.Length > 0) + newNode = newNode.WithDiagnosticsGreen(diags); + var annotations = GetAnnotations(); + if (annotations != null && annotations.Length > 0) + newNode = newNode.WithAnnotationsGreen(annotations); + return newNode; + } + + return this; + } + + internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) + { + return new CSharpDirectiveBodySyntax(Kind, _keyword, _cSharpCode, diagnostics, GetAnnotations()); + } + + internal override GreenNode SetAnnotations(SyntaxAnnotation[] annotations) + { + return new CSharpDirectiveBodySyntax(Kind, _keyword, _cSharpCode, GetDiagnostics(), annotations); + } + } + + internal partial class SyntaxVisitor + { + public virtual TResult VisitRazorCommentBlock(RazorCommentBlockSyntax node) + { + return DefaultVisit(node); + } + + public virtual TResult VisitHtmlTextLiteral(HtmlTextLiteralSyntax node) + { + return DefaultVisit(node); + } + + public virtual TResult VisitCSharpTransition(CSharpTransitionSyntax node) + { + return DefaultVisit(node); + } + + public virtual TResult VisitCSharpMetaCode(CSharpMetaCodeSyntax node) + { + return DefaultVisit(node); + } + + public virtual TResult VisitCSharpCodeLiteral(CSharpCodeLiteralSyntax node) + { + return DefaultVisit(node); + } + + public virtual TResult VisitCSharpCodeBlock(CSharpCodeBlockSyntax node) + { + return DefaultVisit(node); + } + + public virtual TResult VisitCSharpStatement(CSharpStatement node) + { + return DefaultVisit(node); + } + + public virtual TResult VisitCSharpStatementBody(CSharpStatementBodySyntax node) + { + return DefaultVisit(node); + } + + public virtual TResult VisitCSharpExpression(CSharpExpression node) + { + return DefaultVisit(node); + } + + public virtual TResult VisitCSharpExpressionBody(CSharpExpressionBodySyntax node) + { + return DefaultVisit(node); + } + + public virtual TResult VisitCSharpDirective(CSharpDirectiveSyntax node) + { + return DefaultVisit(node); + } + + public virtual TResult VisitCSharpDirectiveBody(CSharpDirectiveBodySyntax node) + { + return DefaultVisit(node); + } + } + + + internal partial class SyntaxVisitor + { + public virtual void VisitRazorCommentBlock(RazorCommentBlockSyntax node) + { + DefaultVisit(node); + } + + public virtual void VisitHtmlTextLiteral(HtmlTextLiteralSyntax node) + { + DefaultVisit(node); + } + + public virtual void VisitCSharpTransition(CSharpTransitionSyntax node) + { + DefaultVisit(node); + } + + public virtual void VisitCSharpMetaCode(CSharpMetaCodeSyntax node) + { + DefaultVisit(node); + } + + public virtual void VisitCSharpCodeLiteral(CSharpCodeLiteralSyntax node) + { + DefaultVisit(node); + } + + public virtual void VisitCSharpCodeBlock(CSharpCodeBlockSyntax node) + { + DefaultVisit(node); + } + + public virtual void VisitCSharpStatement(CSharpStatement node) + { + DefaultVisit(node); + } + + public virtual void VisitCSharpStatementBody(CSharpStatementBodySyntax node) + { + DefaultVisit(node); + } + + public virtual void VisitCSharpExpression(CSharpExpression node) + { + DefaultVisit(node); + } + + public virtual void VisitCSharpExpressionBody(CSharpExpressionBodySyntax node) + { + DefaultVisit(node); + } + + public virtual void VisitCSharpDirective(CSharpDirectiveSyntax node) + { + DefaultVisit(node); + } + + public virtual void VisitCSharpDirectiveBody(CSharpDirectiveBodySyntax node) + { + DefaultVisit(node); + } + } + + internal static partial class SyntaxFactory + { + public static RazorCommentBlockSyntax RazorCommentBlock(SyntaxToken startCommentTransition, SyntaxToken startCommentStar, SyntaxToken comment, SyntaxToken endCommentStar, SyntaxToken endCommentTransition) + { + if (startCommentTransition == null) + throw new ArgumentNullException(nameof(startCommentTransition)); + switch (startCommentTransition.Kind) + { + case SyntaxKind.RazorCommentTransition: + break; + default: + throw new ArgumentException("startCommentTransition"); + } + if (startCommentStar == null) + throw new ArgumentNullException(nameof(startCommentStar)); + switch (startCommentStar.Kind) + { + case SyntaxKind.RazorCommentStar: + break; + default: + throw new ArgumentException("startCommentStar"); + } + if (comment != null) + { + switch (comment.Kind) + { + case SyntaxKind.RazorComment: + case SyntaxKind.Unknown: + break; + default: + throw new ArgumentException("comment"); + } + } + if (endCommentStar == null) + throw new ArgumentNullException(nameof(endCommentStar)); + switch (endCommentStar.Kind) + { + case SyntaxKind.RazorCommentStar: + break; + default: + throw new ArgumentException("endCommentStar"); + } + if (endCommentTransition == null) + throw new ArgumentNullException(nameof(endCommentTransition)); + switch (endCommentTransition.Kind) + { + case SyntaxKind.RazorCommentTransition: + break; + default: + throw new ArgumentException("endCommentTransition"); + } + + return new RazorCommentBlockSyntax(SyntaxKind.RazorComment, startCommentTransition, startCommentStar, comment, endCommentStar, endCommentTransition); + } + + public static HtmlTextLiteralSyntax HtmlTextLiteral(Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax.SyntaxList textTokens) + { + var result = new HtmlTextLiteralSyntax(SyntaxKind.HtmlTextLiteral, textTokens.Node); + + return result; + } + + public static CSharpTransitionSyntax CSharpTransition(SyntaxToken transition) + { + if (transition == null) + throw new ArgumentNullException(nameof(transition)); + switch (transition.Kind) + { + case SyntaxKind.Transition: + break; + default: + throw new ArgumentException("transition"); + } + + var result = new CSharpTransitionSyntax(SyntaxKind.CSharpTransition, transition); + + return result; + } + + public static CSharpMetaCodeSyntax CSharpMetaCode(Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax.SyntaxList metaCode) + { + var result = new CSharpMetaCodeSyntax(SyntaxKind.CSharpMetaCode, metaCode.Node); + + return result; + } + + public static CSharpCodeLiteralSyntax CSharpCodeLiteral(Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax.SyntaxList cSharpTokens) + { + var result = new CSharpCodeLiteralSyntax(SyntaxKind.CSharpCodeLiteral, cSharpTokens.Node); + + return result; + } + + public static CSharpCodeBlockSyntax CSharpCodeBlock(Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax.SyntaxList children) + { + var result = new CSharpCodeBlockSyntax(SyntaxKind.CSharpCodeBlock, children.Node); + + return result; + } + + public static CSharpStatement CSharpStatement(CSharpTransitionSyntax transition, CSharpSyntaxNode body) + { + if (transition == null) + throw new ArgumentNullException(nameof(transition)); + if (body == null) + throw new ArgumentNullException(nameof(body)); + + var result = new CSharpStatement(SyntaxKind.CSharpStatement, transition, body); + + return result; + } + + public static CSharpStatementBodySyntax CSharpStatementBody(CSharpMetaCodeSyntax openBrace, CSharpCodeBlockSyntax cSharpCode, CSharpMetaCodeSyntax closeBrace) + { + if (openBrace == null) + throw new ArgumentNullException(nameof(openBrace)); + if (cSharpCode == null) + throw new ArgumentNullException(nameof(cSharpCode)); + if (closeBrace == null) + throw new ArgumentNullException(nameof(closeBrace)); + + var result = new CSharpStatementBodySyntax(SyntaxKind.CSharpStatementBody, openBrace, cSharpCode, closeBrace); + + return result; + } + + public static CSharpExpression CSharpExpression(CSharpTransitionSyntax transition, CSharpSyntaxNode body) + { + if (transition == null) + throw new ArgumentNullException(nameof(transition)); + if (body == null) + throw new ArgumentNullException(nameof(body)); + + var result = new CSharpExpression(SyntaxKind.CSharpExpression, transition, body); + + return result; + } + + public static CSharpExpressionBodySyntax CSharpExpressionBody(CSharpMetaCodeSyntax openParen, CSharpCodeBlockSyntax cSharpCode, CSharpMetaCodeSyntax closeParen) + { + if (cSharpCode == null) + throw new ArgumentNullException(nameof(cSharpCode)); + + var result = new CSharpExpressionBodySyntax(SyntaxKind.CSharpExpressionBody, openParen, cSharpCode, closeParen); + + return result; + } + + public static CSharpDirectiveSyntax CSharpDirective(CSharpTransitionSyntax transition, CSharpSyntaxNode body) + { + if (transition == null) + throw new ArgumentNullException(nameof(transition)); + if (body == null) + throw new ArgumentNullException(nameof(body)); + + var result = new CSharpDirectiveSyntax(SyntaxKind.CSharpDirective, transition, body); + + return result; + } + + public static CSharpDirectiveBodySyntax CSharpDirectiveBody(CSharpMetaCodeSyntax keyword, CSharpCodeBlockSyntax cSharpCode) + { + if (keyword == null) + throw new ArgumentNullException(nameof(keyword)); + if (cSharpCode == null) + throw new ArgumentNullException(nameof(cSharpCode)); + + var result = new CSharpDirectiveBodySyntax(SyntaxKind.CSharpDirectiveBody, keyword, cSharpCode); + + return result; + } + + internal static IEnumerable GetNodeTypes() + { + return new Type[] { + typeof(RazorCommentBlockSyntax), + typeof(HtmlTextLiteralSyntax), + typeof(CSharpTransitionSyntax), + typeof(CSharpMetaCodeSyntax), + typeof(CSharpCodeLiteralSyntax), + typeof(CSharpCodeBlockSyntax), + typeof(CSharpStatement), + typeof(CSharpStatementBodySyntax), + typeof(CSharpExpression), + typeof(CSharpExpressionBodySyntax), + typeof(CSharpDirectiveSyntax), + typeof(CSharpDirectiveBodySyntax) + }; + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/Generated/Syntax.xml.Main.Generated.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/Generated/Syntax.xml.Main.Generated.cs new file mode 100644 index 0000000000..d22da664db --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/Generated/Syntax.xml.Main.Generated.cs @@ -0,0 +1,375 @@ +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; + + +namespace Microsoft.AspNetCore.Razor.Language.Syntax +{ + internal partial class SyntaxVisitor + { + /// Called when the visitor visits a RazorCommentBlockSyntax node. + public virtual TResult VisitRazorCommentBlock(RazorCommentBlockSyntax node) + { + return DefaultVisit(node); + } + + /// Called when the visitor visits a HtmlTextLiteralSyntax node. + public virtual TResult VisitHtmlTextLiteral(HtmlTextLiteralSyntax node) + { + return DefaultVisit(node); + } + + /// Called when the visitor visits a CSharpTransitionSyntax node. + public virtual TResult VisitCSharpTransition(CSharpTransitionSyntax node) + { + return DefaultVisit(node); + } + + /// Called when the visitor visits a CSharpMetaCodeSyntax node. + public virtual TResult VisitCSharpMetaCode(CSharpMetaCodeSyntax node) + { + return DefaultVisit(node); + } + + /// Called when the visitor visits a CSharpCodeLiteralSyntax node. + public virtual TResult VisitCSharpCodeLiteral(CSharpCodeLiteralSyntax node) + { + return DefaultVisit(node); + } + + /// Called when the visitor visits a CSharpCodeBlockSyntax node. + public virtual TResult VisitCSharpCodeBlock(CSharpCodeBlockSyntax node) + { + return DefaultVisit(node); + } + + /// Called when the visitor visits a CSharpStatement node. + public virtual TResult VisitCSharpStatement(CSharpStatement node) + { + return DefaultVisit(node); + } + + /// Called when the visitor visits a CSharpStatementBodySyntax node. + public virtual TResult VisitCSharpStatementBody(CSharpStatementBodySyntax node) + { + return DefaultVisit(node); + } + + /// Called when the visitor visits a CSharpExpression node. + public virtual TResult VisitCSharpExpression(CSharpExpression node) + { + return DefaultVisit(node); + } + + /// Called when the visitor visits a CSharpExpressionBodySyntax node. + public virtual TResult VisitCSharpExpressionBody(CSharpExpressionBodySyntax node) + { + return DefaultVisit(node); + } + + /// Called when the visitor visits a CSharpDirectiveSyntax node. + public virtual TResult VisitCSharpDirective(CSharpDirectiveSyntax node) + { + return DefaultVisit(node); + } + + /// Called when the visitor visits a CSharpDirectiveBodySyntax node. + public virtual TResult VisitCSharpDirectiveBody(CSharpDirectiveBodySyntax node) + { + return DefaultVisit(node); + } + } + + internal partial class SyntaxVisitor + { + /// Called when the visitor visits a RazorCommentBlockSyntax node. + public virtual void VisitRazorCommentBlock(RazorCommentBlockSyntax node) + { + DefaultVisit(node); + } + + /// Called when the visitor visits a HtmlTextLiteralSyntax node. + public virtual void VisitHtmlTextLiteral(HtmlTextLiteralSyntax node) + { + DefaultVisit(node); + } + + /// Called when the visitor visits a CSharpTransitionSyntax node. + public virtual void VisitCSharpTransition(CSharpTransitionSyntax node) + { + DefaultVisit(node); + } + + /// Called when the visitor visits a CSharpMetaCodeSyntax node. + public virtual void VisitCSharpMetaCode(CSharpMetaCodeSyntax node) + { + DefaultVisit(node); + } + + /// Called when the visitor visits a CSharpCodeLiteralSyntax node. + public virtual void VisitCSharpCodeLiteral(CSharpCodeLiteralSyntax node) + { + DefaultVisit(node); + } + + /// Called when the visitor visits a CSharpCodeBlockSyntax node. + public virtual void VisitCSharpCodeBlock(CSharpCodeBlockSyntax node) + { + DefaultVisit(node); + } + + /// Called when the visitor visits a CSharpStatement node. + public virtual void VisitCSharpStatement(CSharpStatement node) + { + DefaultVisit(node); + } + + /// Called when the visitor visits a CSharpStatementBodySyntax node. + public virtual void VisitCSharpStatementBody(CSharpStatementBodySyntax node) + { + DefaultVisit(node); + } + + /// Called when the visitor visits a CSharpExpression node. + public virtual void VisitCSharpExpression(CSharpExpression node) + { + DefaultVisit(node); + } + + /// Called when the visitor visits a CSharpExpressionBodySyntax node. + public virtual void VisitCSharpExpressionBody(CSharpExpressionBodySyntax node) + { + DefaultVisit(node); + } + + /// Called when the visitor visits a CSharpDirectiveSyntax node. + public virtual void VisitCSharpDirective(CSharpDirectiveSyntax node) + { + DefaultVisit(node); + } + + /// Called when the visitor visits a CSharpDirectiveBodySyntax node. + public virtual void VisitCSharpDirectiveBody(CSharpDirectiveBodySyntax node) + { + DefaultVisit(node); + } + } + + internal static partial class SyntaxFactory + { + /// Creates a new RazorCommentBlockSyntax instance. + public static RazorCommentBlockSyntax RazorCommentBlock(SyntaxToken startCommentTransition, SyntaxToken startCommentStar, SyntaxToken comment, SyntaxToken endCommentStar, SyntaxToken endCommentTransition) + { + switch (startCommentTransition.Kind) + { + case SyntaxKind.RazorCommentTransition: + break; + default: + throw new ArgumentException("startCommentTransition"); + } + switch (startCommentStar.Kind) + { + case SyntaxKind.RazorCommentStar: + break; + default: + throw new ArgumentException("startCommentStar"); + } + switch (comment.Kind) + { + case SyntaxKind.RazorComment: + case SyntaxKind.Unknown: + break; + default: + throw new ArgumentException("comment"); + } + switch (endCommentStar.Kind) + { + case SyntaxKind.RazorCommentStar: + break; + default: + throw new ArgumentException("endCommentStar"); + } + switch (endCommentTransition.Kind) + { + case SyntaxKind.RazorCommentTransition: + break; + default: + throw new ArgumentException("endCommentTransition"); + } + return (RazorCommentBlockSyntax)InternalSyntax.SyntaxFactory.RazorCommentBlock((Syntax.InternalSyntax.SyntaxToken)startCommentTransition.Green, (Syntax.InternalSyntax.SyntaxToken)startCommentStar.Green, (Syntax.InternalSyntax.SyntaxToken)comment.Green, (Syntax.InternalSyntax.SyntaxToken)endCommentStar.Green, (Syntax.InternalSyntax.SyntaxToken)endCommentTransition.Green).CreateRed(); + } + + /// Creates a new RazorCommentBlockSyntax instance. + public static RazorCommentBlockSyntax RazorCommentBlock() + { + return SyntaxFactory.RazorCommentBlock(SyntaxFactory.Token(SyntaxKind.RazorCommentTransition), SyntaxFactory.Token(SyntaxKind.RazorCommentStar), default(SyntaxToken), SyntaxFactory.Token(SyntaxKind.RazorCommentStar), SyntaxFactory.Token(SyntaxKind.RazorCommentTransition)); + } + + /// Creates a new HtmlTextLiteralSyntax instance. + public static HtmlTextLiteralSyntax HtmlTextLiteral(SyntaxList textTokens) + { + return (HtmlTextLiteralSyntax)InternalSyntax.SyntaxFactory.HtmlTextLiteral(textTokens.Node.ToGreenList()).CreateRed(); + } + + /// Creates a new HtmlTextLiteralSyntax instance. + public static HtmlTextLiteralSyntax HtmlTextLiteral() + { + return SyntaxFactory.HtmlTextLiteral(default(SyntaxList)); + } + + /// Creates a new CSharpTransitionSyntax instance. + public static CSharpTransitionSyntax CSharpTransition(SyntaxToken transition) + { + switch (transition.Kind) + { + case SyntaxKind.Transition: + break; + default: + throw new ArgumentException("transition"); + } + return (CSharpTransitionSyntax)InternalSyntax.SyntaxFactory.CSharpTransition((Syntax.InternalSyntax.SyntaxToken)transition.Green).CreateRed(); + } + + /// Creates a new CSharpTransitionSyntax instance. + public static CSharpTransitionSyntax CSharpTransition() + { + return SyntaxFactory.CSharpTransition(SyntaxFactory.Token(SyntaxKind.Transition)); + } + + /// Creates a new CSharpMetaCodeSyntax instance. + public static CSharpMetaCodeSyntax CSharpMetaCode(SyntaxList metaCode) + { + return (CSharpMetaCodeSyntax)InternalSyntax.SyntaxFactory.CSharpMetaCode(metaCode.Node.ToGreenList()).CreateRed(); + } + + /// Creates a new CSharpMetaCodeSyntax instance. + public static CSharpMetaCodeSyntax CSharpMetaCode() + { + return SyntaxFactory.CSharpMetaCode(default(SyntaxList)); + } + + /// Creates a new CSharpCodeLiteralSyntax instance. + public static CSharpCodeLiteralSyntax CSharpCodeLiteral(SyntaxList cSharpTokens) + { + return (CSharpCodeLiteralSyntax)InternalSyntax.SyntaxFactory.CSharpCodeLiteral(cSharpTokens.Node.ToGreenList()).CreateRed(); + } + + /// Creates a new CSharpCodeLiteralSyntax instance. + public static CSharpCodeLiteralSyntax CSharpCodeLiteral() + { + return SyntaxFactory.CSharpCodeLiteral(default(SyntaxList)); + } + + /// Creates a new CSharpCodeBlockSyntax instance. + public static CSharpCodeBlockSyntax CSharpCodeBlock(SyntaxList children) + { + return (CSharpCodeBlockSyntax)InternalSyntax.SyntaxFactory.CSharpCodeBlock(children.Node.ToGreenList()).CreateRed(); + } + + /// Creates a new CSharpCodeBlockSyntax instance. + public static CSharpCodeBlockSyntax CSharpCodeBlock() + { + return SyntaxFactory.CSharpCodeBlock(default(SyntaxList)); + } + + /// Creates a new CSharpStatement instance. + public static CSharpStatement CSharpStatement(CSharpTransitionSyntax transition, CSharpSyntaxNode body) + { + if (transition == null) + throw new ArgumentNullException(nameof(transition)); + if (body == null) + throw new ArgumentNullException(nameof(body)); + return (CSharpStatement)InternalSyntax.SyntaxFactory.CSharpStatement(transition == null ? null : (InternalSyntax.CSharpTransitionSyntax)transition.Green, body == null ? null : (InternalSyntax.CSharpSyntaxNode)body.Green).CreateRed(); + } + + /// Creates a new CSharpStatement instance. + public static CSharpStatement CSharpStatement(CSharpSyntaxNode body) + { + return SyntaxFactory.CSharpStatement(SyntaxFactory.CSharpTransition(), body); + } + + /// Creates a new CSharpStatementBodySyntax instance. + public static CSharpStatementBodySyntax CSharpStatementBody(CSharpMetaCodeSyntax openBrace, CSharpCodeBlockSyntax cSharpCode, CSharpMetaCodeSyntax closeBrace) + { + if (openBrace == null) + throw new ArgumentNullException(nameof(openBrace)); + if (cSharpCode == null) + throw new ArgumentNullException(nameof(cSharpCode)); + if (closeBrace == null) + throw new ArgumentNullException(nameof(closeBrace)); + return (CSharpStatementBodySyntax)InternalSyntax.SyntaxFactory.CSharpStatementBody(openBrace == null ? null : (InternalSyntax.CSharpMetaCodeSyntax)openBrace.Green, cSharpCode == null ? null : (InternalSyntax.CSharpCodeBlockSyntax)cSharpCode.Green, closeBrace == null ? null : (InternalSyntax.CSharpMetaCodeSyntax)closeBrace.Green).CreateRed(); + } + + /// Creates a new CSharpStatementBodySyntax instance. + public static CSharpStatementBodySyntax CSharpStatementBody() + { + return SyntaxFactory.CSharpStatementBody(SyntaxFactory.CSharpMetaCode(), SyntaxFactory.CSharpCodeBlock(), SyntaxFactory.CSharpMetaCode()); + } + + /// Creates a new CSharpExpression instance. + public static CSharpExpression CSharpExpression(CSharpTransitionSyntax transition, CSharpSyntaxNode body) + { + if (transition == null) + throw new ArgumentNullException(nameof(transition)); + if (body == null) + throw new ArgumentNullException(nameof(body)); + return (CSharpExpression)InternalSyntax.SyntaxFactory.CSharpExpression(transition == null ? null : (InternalSyntax.CSharpTransitionSyntax)transition.Green, body == null ? null : (InternalSyntax.CSharpSyntaxNode)body.Green).CreateRed(); + } + + /// Creates a new CSharpExpression instance. + public static CSharpExpression CSharpExpression(CSharpSyntaxNode body) + { + return SyntaxFactory.CSharpExpression(SyntaxFactory.CSharpTransition(), body); + } + + /// Creates a new CSharpExpressionBodySyntax instance. + public static CSharpExpressionBodySyntax CSharpExpressionBody(CSharpMetaCodeSyntax openParen, CSharpCodeBlockSyntax cSharpCode, CSharpMetaCodeSyntax closeParen) + { + if (cSharpCode == null) + throw new ArgumentNullException(nameof(cSharpCode)); + return (CSharpExpressionBodySyntax)InternalSyntax.SyntaxFactory.CSharpExpressionBody(openParen == null ? null : (InternalSyntax.CSharpMetaCodeSyntax)openParen.Green, cSharpCode == null ? null : (InternalSyntax.CSharpCodeBlockSyntax)cSharpCode.Green, closeParen == null ? null : (InternalSyntax.CSharpMetaCodeSyntax)closeParen.Green).CreateRed(); + } + + /// Creates a new CSharpExpressionBodySyntax instance. + public static CSharpExpressionBodySyntax CSharpExpressionBody() + { + return SyntaxFactory.CSharpExpressionBody(default(CSharpMetaCodeSyntax), SyntaxFactory.CSharpCodeBlock(), default(CSharpMetaCodeSyntax)); + } + + /// Creates a new CSharpDirectiveSyntax instance. + public static CSharpDirectiveSyntax CSharpDirective(CSharpTransitionSyntax transition, CSharpSyntaxNode body) + { + if (transition == null) + throw new ArgumentNullException(nameof(transition)); + if (body == null) + throw new ArgumentNullException(nameof(body)); + return (CSharpDirectiveSyntax)InternalSyntax.SyntaxFactory.CSharpDirective(transition == null ? null : (InternalSyntax.CSharpTransitionSyntax)transition.Green, body == null ? null : (InternalSyntax.CSharpSyntaxNode)body.Green).CreateRed(); + } + + /// Creates a new CSharpDirectiveSyntax instance. + public static CSharpDirectiveSyntax CSharpDirective(CSharpSyntaxNode body) + { + return SyntaxFactory.CSharpDirective(SyntaxFactory.CSharpTransition(), body); + } + + /// Creates a new CSharpDirectiveBodySyntax instance. + public static CSharpDirectiveBodySyntax CSharpDirectiveBody(CSharpMetaCodeSyntax keyword, CSharpCodeBlockSyntax cSharpCode) + { + if (keyword == null) + throw new ArgumentNullException(nameof(keyword)); + if (cSharpCode == null) + throw new ArgumentNullException(nameof(cSharpCode)); + return (CSharpDirectiveBodySyntax)InternalSyntax.SyntaxFactory.CSharpDirectiveBody(keyword == null ? null : (InternalSyntax.CSharpMetaCodeSyntax)keyword.Green, cSharpCode == null ? null : (InternalSyntax.CSharpCodeBlockSyntax)cSharpCode.Green).CreateRed(); + } + + /// Creates a new CSharpDirectiveBodySyntax instance. + public static CSharpDirectiveBodySyntax CSharpDirectiveBody() + { + return SyntaxFactory.CSharpDirectiveBody(SyntaxFactory.CSharpMetaCode(), SyntaxFactory.CSharpCodeBlock()); + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/Generated/Syntax.xml.Syntax.Generated.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/Generated/Syntax.xml.Syntax.Generated.cs new file mode 100644 index 0000000000..a11e4071eb --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/Generated/Syntax.xml.Syntax.Generated.cs @@ -0,0 +1,1079 @@ +// + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Threading; + + +namespace Microsoft.AspNetCore.Razor.Language.Syntax +{ + internal abstract partial class RazorSyntaxNode : SyntaxNode + { + internal RazorSyntaxNode(GreenNode green, SyntaxNode parent, int position) + : base(green, parent, position) + { + } + } + + internal sealed partial class RazorCommentBlockSyntax : RazorSyntaxNode + { + private SyntaxToken _startCommentTransition; + private SyntaxToken _startCommentStar; + private SyntaxToken _comment; + private SyntaxToken _endCommentStar; + private SyntaxToken _endCommentTransition; + + internal RazorCommentBlockSyntax(GreenNode green, SyntaxNode parent, int position) + : base(green, parent, position) + { + } + + public SyntaxToken StartCommentTransition + { + get + { + return GetRedAtZero(ref _startCommentTransition); + } + } + + public SyntaxToken StartCommentStar + { + get + { + return GetRed(ref _startCommentStar, 1); + } + } + + public SyntaxToken Comment + { + get + { + return GetRed(ref _comment, 2); + } + } + + public SyntaxToken EndCommentStar + { + get + { + return GetRed(ref _endCommentStar, 3); + } + } + + public SyntaxToken EndCommentTransition + { + get + { + return GetRed(ref _endCommentTransition, 4); + } + } + + internal override SyntaxNode GetNodeSlot(int index) + { + switch (index) + { + case 0: return GetRedAtZero(ref _startCommentTransition); + case 1: return GetRed(ref _startCommentStar, 1); + case 2: return GetRed(ref _comment, 2); + case 3: return GetRed(ref _endCommentStar, 3); + case 4: return GetRed(ref _endCommentTransition, 4); + default: return null; + } + } + internal override SyntaxNode GetCachedSlot(int index) + { + switch (index) + { + case 0: return _startCommentTransition; + case 1: return _startCommentStar; + case 2: return _comment; + case 3: return _endCommentStar; + case 4: return _endCommentTransition; + default: return null; + } + } + + public override TResult Accept(SyntaxVisitor visitor) + { + return visitor.VisitRazorCommentBlock(this); + } + + public override void Accept(SyntaxVisitor visitor) + { + visitor.VisitRazorCommentBlock(this); + } + + public RazorCommentBlockSyntax Update(SyntaxToken startCommentTransition, SyntaxToken startCommentStar, SyntaxToken comment, SyntaxToken endCommentStar, SyntaxToken endCommentTransition) + { + if (startCommentTransition != StartCommentTransition || startCommentStar != StartCommentStar || comment != Comment || endCommentStar != EndCommentStar || endCommentTransition != EndCommentTransition) + { + var newNode = SyntaxFactory.RazorCommentBlock(startCommentTransition, startCommentStar, comment, endCommentStar, endCommentTransition); + var annotations = GetAnnotations(); + if (annotations != null && annotations.Length > 0) + return newNode.WithAnnotations(annotations); + return newNode; + } + + return this; + } + + public RazorCommentBlockSyntax WithStartCommentTransition(SyntaxToken startCommentTransition) + { + return Update(startCommentTransition, _startCommentStar, _comment, _endCommentStar, _endCommentTransition); + } + + public RazorCommentBlockSyntax WithStartCommentStar(SyntaxToken startCommentStar) + { + return Update(_startCommentTransition, startCommentStar, _comment, _endCommentStar, _endCommentTransition); + } + + public RazorCommentBlockSyntax WithComment(SyntaxToken comment) + { + return Update(_startCommentTransition, _startCommentStar, comment, _endCommentStar, _endCommentTransition); + } + + public RazorCommentBlockSyntax WithEndCommentStar(SyntaxToken endCommentStar) + { + return Update(_startCommentTransition, _startCommentStar, _comment, endCommentStar, _endCommentTransition); + } + + public RazorCommentBlockSyntax WithEndCommentTransition(SyntaxToken endCommentTransition) + { + return Update(_startCommentTransition, _startCommentStar, _comment, _endCommentStar, endCommentTransition); + } + } + + internal abstract partial class HtmlSyntaxNode : RazorSyntaxNode + { + internal HtmlSyntaxNode(GreenNode green, SyntaxNode parent, int position) + : base(green, parent, position) + { + } + } + + internal sealed partial class HtmlTextLiteralSyntax : HtmlSyntaxNode + { + private SyntaxNode _textTokens; + + internal HtmlTextLiteralSyntax(GreenNode green, SyntaxNode parent, int position) + : base(green, parent, position) + { + } + + public SyntaxList TextTokens + { + get + { + return new SyntaxList(GetRed(ref _textTokens, 0)); + } + } + + internal override SyntaxNode GetNodeSlot(int index) + { + switch (index) + { + case 0: return GetRedAtZero(ref _textTokens); + default: return null; + } + } + internal override SyntaxNode GetCachedSlot(int index) + { + switch (index) + { + case 0: return _textTokens; + default: return null; + } + } + + public override TResult Accept(SyntaxVisitor visitor) + { + return visitor.VisitHtmlTextLiteral(this); + } + + public override void Accept(SyntaxVisitor visitor) + { + visitor.VisitHtmlTextLiteral(this); + } + + public HtmlTextLiteralSyntax Update(SyntaxList textTokens) + { + if (textTokens != TextTokens) + { + var newNode = SyntaxFactory.HtmlTextLiteral(textTokens); + var annotations = GetAnnotations(); + if (annotations != null && annotations.Length > 0) + return newNode.WithAnnotations(annotations); + return newNode; + } + + return this; + } + + public HtmlTextLiteralSyntax WithTextTokens(SyntaxList textTokens) + { + return Update(textTokens); + } + + public HtmlTextLiteralSyntax AddTextTokens(params SyntaxToken[] items) + { + return WithTextTokens(this.TextTokens.AddRange(items)); + } + } + + internal abstract partial class CSharpSyntaxNode : RazorSyntaxNode + { + internal CSharpSyntaxNode(GreenNode green, SyntaxNode parent, int position) + : base(green, parent, position) + { + } + } + + internal sealed partial class CSharpTransitionSyntax : CSharpSyntaxNode + { + private SyntaxToken _transition; + + internal CSharpTransitionSyntax(GreenNode green, SyntaxNode parent, int position) + : base(green, parent, position) + { + } + + public SyntaxToken Transition + { + get + { + return GetRedAtZero(ref _transition); + } + } + + internal override SyntaxNode GetNodeSlot(int index) + { + switch (index) + { + case 0: return GetRedAtZero(ref _transition); + default: return null; + } + } + internal override SyntaxNode GetCachedSlot(int index) + { + switch (index) + { + case 0: return _transition; + default: return null; + } + } + + public override TResult Accept(SyntaxVisitor visitor) + { + return visitor.VisitCSharpTransition(this); + } + + public override void Accept(SyntaxVisitor visitor) + { + visitor.VisitCSharpTransition(this); + } + + public CSharpTransitionSyntax Update(SyntaxToken transition) + { + if (transition != Transition) + { + var newNode = SyntaxFactory.CSharpTransition(transition); + var annotations = GetAnnotations(); + if (annotations != null && annotations.Length > 0) + return newNode.WithAnnotations(annotations); + return newNode; + } + + return this; + } + + public CSharpTransitionSyntax WithTransition(SyntaxToken transition) + { + return Update(transition); + } + } + + internal sealed partial class CSharpMetaCodeSyntax : CSharpSyntaxNode + { + private SyntaxNode _metaCode; + + internal CSharpMetaCodeSyntax(GreenNode green, SyntaxNode parent, int position) + : base(green, parent, position) + { + } + + public SyntaxList MetaCode + { + get + { + return new SyntaxList(GetRed(ref _metaCode, 0)); + } + } + + internal override SyntaxNode GetNodeSlot(int index) + { + switch (index) + { + case 0: return GetRedAtZero(ref _metaCode); + default: return null; + } + } + internal override SyntaxNode GetCachedSlot(int index) + { + switch (index) + { + case 0: return _metaCode; + default: return null; + } + } + + public override TResult Accept(SyntaxVisitor visitor) + { + return visitor.VisitCSharpMetaCode(this); + } + + public override void Accept(SyntaxVisitor visitor) + { + visitor.VisitCSharpMetaCode(this); + } + + public CSharpMetaCodeSyntax Update(SyntaxList metaCode) + { + if (metaCode != MetaCode) + { + var newNode = SyntaxFactory.CSharpMetaCode(metaCode); + var annotations = GetAnnotations(); + if (annotations != null && annotations.Length > 0) + return newNode.WithAnnotations(annotations); + return newNode; + } + + return this; + } + + public CSharpMetaCodeSyntax WithMetaCode(SyntaxList metaCode) + { + return Update(metaCode); + } + + public CSharpMetaCodeSyntax AddMetaCode(params SyntaxToken[] items) + { + return WithMetaCode(this.MetaCode.AddRange(items)); + } + } + + internal sealed partial class CSharpCodeLiteralSyntax : CSharpSyntaxNode + { + private SyntaxNode _cSharpTokens; + + internal CSharpCodeLiteralSyntax(GreenNode green, SyntaxNode parent, int position) + : base(green, parent, position) + { + } + + public SyntaxList CSharpTokens + { + get + { + return new SyntaxList(GetRed(ref _cSharpTokens, 0)); + } + } + + internal override SyntaxNode GetNodeSlot(int index) + { + switch (index) + { + case 0: return GetRedAtZero(ref _cSharpTokens); + default: return null; + } + } + internal override SyntaxNode GetCachedSlot(int index) + { + switch (index) + { + case 0: return _cSharpTokens; + default: return null; + } + } + + public override TResult Accept(SyntaxVisitor visitor) + { + return visitor.VisitCSharpCodeLiteral(this); + } + + public override void Accept(SyntaxVisitor visitor) + { + visitor.VisitCSharpCodeLiteral(this); + } + + public CSharpCodeLiteralSyntax Update(SyntaxList cSharpTokens) + { + if (cSharpTokens != CSharpTokens) + { + var newNode = SyntaxFactory.CSharpCodeLiteral(cSharpTokens); + var annotations = GetAnnotations(); + if (annotations != null && annotations.Length > 0) + return newNode.WithAnnotations(annotations); + return newNode; + } + + return this; + } + + public CSharpCodeLiteralSyntax WithCSharpTokens(SyntaxList cSharpTokens) + { + return Update(cSharpTokens); + } + + public CSharpCodeLiteralSyntax AddCSharpTokens(params SyntaxToken[] items) + { + return WithCSharpTokens(this.CSharpTokens.AddRange(items)); + } + } + + internal sealed partial class CSharpCodeBlockSyntax : CSharpSyntaxNode + { + private SyntaxNode _children; + + internal CSharpCodeBlockSyntax(GreenNode green, SyntaxNode parent, int position) + : base(green, parent, position) + { + } + + public SyntaxList Children + { + get + { + return new SyntaxList(GetRed(ref _children, 0)); + } + } + + internal override SyntaxNode GetNodeSlot(int index) + { + switch (index) + { + case 0: return GetRedAtZero(ref _children); + default: return null; + } + } + internal override SyntaxNode GetCachedSlot(int index) + { + switch (index) + { + case 0: return _children; + default: return null; + } + } + + public override TResult Accept(SyntaxVisitor visitor) + { + return visitor.VisitCSharpCodeBlock(this); + } + + public override void Accept(SyntaxVisitor visitor) + { + visitor.VisitCSharpCodeBlock(this); + } + + public CSharpCodeBlockSyntax Update(SyntaxList children) + { + if (children != Children) + { + var newNode = SyntaxFactory.CSharpCodeBlock(children); + var annotations = GetAnnotations(); + if (annotations != null && annotations.Length > 0) + return newNode.WithAnnotations(annotations); + return newNode; + } + + return this; + } + + public CSharpCodeBlockSyntax WithChildren(SyntaxList children) + { + return Update(children); + } + + public CSharpCodeBlockSyntax AddChildren(params RazorSyntaxNode[] items) + { + return WithChildren(this.Children.AddRange(items)); + } + } + + internal abstract partial class CSharpBlockSyntax : CSharpSyntaxNode + { + internal CSharpBlockSyntax(GreenNode green, SyntaxNode parent, int position) + : base(green, parent, position) + { + } + + public abstract CSharpTransitionSyntax Transition { get; } + public CSharpBlockSyntax WithTransition(CSharpTransitionSyntax _transition) => WithTransitionCore(_transition); + internal abstract CSharpBlockSyntax WithTransitionCore(CSharpTransitionSyntax _transition); + + public abstract CSharpSyntaxNode Body { get; } + public CSharpBlockSyntax WithBody(CSharpSyntaxNode _body) => WithBodyCore(_body); + internal abstract CSharpBlockSyntax WithBodyCore(CSharpSyntaxNode _body); + } + + internal sealed partial class CSharpStatement : CSharpBlockSyntax + { + private CSharpTransitionSyntax _transition; + private CSharpSyntaxNode _body; + + internal CSharpStatement(GreenNode green, SyntaxNode parent, int position) + : base(green, parent, position) + { + } + + public override CSharpTransitionSyntax Transition + { + get + { + return GetRedAtZero(ref _transition); + } + } + + public override CSharpSyntaxNode Body + { + get + { + return GetRed(ref _body, 1); + } + } + + internal override SyntaxNode GetNodeSlot(int index) + { + switch (index) + { + case 0: return GetRedAtZero(ref _transition); + case 1: return GetRed(ref _body, 1); + default: return null; + } + } + internal override SyntaxNode GetCachedSlot(int index) + { + switch (index) + { + case 0: return _transition; + case 1: return _body; + default: return null; + } + } + + public override TResult Accept(SyntaxVisitor visitor) + { + return visitor.VisitCSharpStatement(this); + } + + public override void Accept(SyntaxVisitor visitor) + { + visitor.VisitCSharpStatement(this); + } + + public CSharpStatement Update(CSharpTransitionSyntax transition, CSharpSyntaxNode body) + { + if (transition != Transition || body != Body) + { + var newNode = SyntaxFactory.CSharpStatement(transition, body); + var annotations = GetAnnotations(); + if (annotations != null && annotations.Length > 0) + return newNode.WithAnnotations(annotations); + return newNode; + } + + return this; + } + + internal override CSharpBlockSyntax WithTransitionCore(CSharpTransitionSyntax transition) => WithTransition(transition); + public new CSharpStatement WithTransition(CSharpTransitionSyntax transition) + { + return Update(transition, _body); + } + + internal override CSharpBlockSyntax WithBodyCore(CSharpSyntaxNode body) => WithBody(body); + public new CSharpStatement WithBody(CSharpSyntaxNode body) + { + return Update(_transition, body); + } + } + + internal sealed partial class CSharpStatementBodySyntax : CSharpSyntaxNode + { + private CSharpMetaCodeSyntax _openBrace; + private CSharpCodeBlockSyntax _cSharpCode; + private CSharpMetaCodeSyntax _closeBrace; + + internal CSharpStatementBodySyntax(GreenNode green, SyntaxNode parent, int position) + : base(green, parent, position) + { + } + + public CSharpMetaCodeSyntax OpenBrace + { + get + { + return GetRedAtZero(ref _openBrace); + } + } + + public CSharpCodeBlockSyntax CSharpCode + { + get + { + return GetRed(ref _cSharpCode, 1); + } + } + + public CSharpMetaCodeSyntax CloseBrace + { + get + { + return GetRed(ref _closeBrace, 2); + } + } + + internal override SyntaxNode GetNodeSlot(int index) + { + switch (index) + { + case 0: return GetRedAtZero(ref _openBrace); + case 1: return GetRed(ref _cSharpCode, 1); + case 2: return GetRed(ref _closeBrace, 2); + default: return null; + } + } + internal override SyntaxNode GetCachedSlot(int index) + { + switch (index) + { + case 0: return _openBrace; + case 1: return _cSharpCode; + case 2: return _closeBrace; + default: return null; + } + } + + public override TResult Accept(SyntaxVisitor visitor) + { + return visitor.VisitCSharpStatementBody(this); + } + + public override void Accept(SyntaxVisitor visitor) + { + visitor.VisitCSharpStatementBody(this); + } + + public CSharpStatementBodySyntax Update(CSharpMetaCodeSyntax openBrace, CSharpCodeBlockSyntax cSharpCode, CSharpMetaCodeSyntax closeBrace) + { + if (openBrace != OpenBrace || cSharpCode != CSharpCode || closeBrace != CloseBrace) + { + var newNode = SyntaxFactory.CSharpStatementBody(openBrace, cSharpCode, closeBrace); + var annotations = GetAnnotations(); + if (annotations != null && annotations.Length > 0) + return newNode.WithAnnotations(annotations); + return newNode; + } + + return this; + } + + public CSharpStatementBodySyntax WithOpenBrace(CSharpMetaCodeSyntax openBrace) + { + return Update(openBrace, _cSharpCode, _closeBrace); + } + + public CSharpStatementBodySyntax WithCSharpCode(CSharpCodeBlockSyntax cSharpCode) + { + return Update(_openBrace, cSharpCode, _closeBrace); + } + + public CSharpStatementBodySyntax WithCloseBrace(CSharpMetaCodeSyntax closeBrace) + { + return Update(_openBrace, _cSharpCode, closeBrace); + } + + public CSharpStatementBodySyntax AddOpenBraceMetaCode(params SyntaxToken[] items) + { + return this.WithOpenBrace(this.OpenBrace.WithMetaCode(this.OpenBrace.MetaCode.AddRange(items))); + } + + public CSharpStatementBodySyntax AddCSharpCodeChildren(params RazorSyntaxNode[] items) + { + return this.WithCSharpCode(this.CSharpCode.WithChildren(this.CSharpCode.Children.AddRange(items))); + } + + public CSharpStatementBodySyntax AddCloseBraceMetaCode(params SyntaxToken[] items) + { + return this.WithCloseBrace(this.CloseBrace.WithMetaCode(this.CloseBrace.MetaCode.AddRange(items))); + } + } + + internal sealed partial class CSharpExpression : CSharpBlockSyntax + { + private CSharpTransitionSyntax _transition; + private CSharpSyntaxNode _body; + + internal CSharpExpression(GreenNode green, SyntaxNode parent, int position) + : base(green, parent, position) + { + } + + public override CSharpTransitionSyntax Transition + { + get + { + return GetRedAtZero(ref _transition); + } + } + + public override CSharpSyntaxNode Body + { + get + { + return GetRed(ref _body, 1); + } + } + + internal override SyntaxNode GetNodeSlot(int index) + { + switch (index) + { + case 0: return GetRedAtZero(ref _transition); + case 1: return GetRed(ref _body, 1); + default: return null; + } + } + internal override SyntaxNode GetCachedSlot(int index) + { + switch (index) + { + case 0: return _transition; + case 1: return _body; + default: return null; + } + } + + public override TResult Accept(SyntaxVisitor visitor) + { + return visitor.VisitCSharpExpression(this); + } + + public override void Accept(SyntaxVisitor visitor) + { + visitor.VisitCSharpExpression(this); + } + + public CSharpExpression Update(CSharpTransitionSyntax transition, CSharpSyntaxNode body) + { + if (transition != Transition || body != Body) + { + var newNode = SyntaxFactory.CSharpExpression(transition, body); + var annotations = GetAnnotations(); + if (annotations != null && annotations.Length > 0) + return newNode.WithAnnotations(annotations); + return newNode; + } + + return this; + } + + internal override CSharpBlockSyntax WithTransitionCore(CSharpTransitionSyntax transition) => WithTransition(transition); + public new CSharpExpression WithTransition(CSharpTransitionSyntax transition) + { + return Update(transition, _body); + } + + internal override CSharpBlockSyntax WithBodyCore(CSharpSyntaxNode body) => WithBody(body); + public new CSharpExpression WithBody(CSharpSyntaxNode body) + { + return Update(_transition, body); + } + } + + internal sealed partial class CSharpExpressionBodySyntax : CSharpSyntaxNode + { + private CSharpMetaCodeSyntax _openParen; + private CSharpCodeBlockSyntax _cSharpCode; + private CSharpMetaCodeSyntax _closeParen; + + internal CSharpExpressionBodySyntax(GreenNode green, SyntaxNode parent, int position) + : base(green, parent, position) + { + } + + public CSharpMetaCodeSyntax OpenParen + { + get + { + return GetRedAtZero(ref _openParen); + } + } + + public CSharpCodeBlockSyntax CSharpCode + { + get + { + return GetRed(ref _cSharpCode, 1); + } + } + + public CSharpMetaCodeSyntax CloseParen + { + get + { + return GetRed(ref _closeParen, 2); + } + } + + internal override SyntaxNode GetNodeSlot(int index) + { + switch (index) + { + case 0: return GetRedAtZero(ref _openParen); + case 1: return GetRed(ref _cSharpCode, 1); + case 2: return GetRed(ref _closeParen, 2); + default: return null; + } + } + internal override SyntaxNode GetCachedSlot(int index) + { + switch (index) + { + case 0: return _openParen; + case 1: return _cSharpCode; + case 2: return _closeParen; + default: return null; + } + } + + public override TResult Accept(SyntaxVisitor visitor) + { + return visitor.VisitCSharpExpressionBody(this); + } + + public override void Accept(SyntaxVisitor visitor) + { + visitor.VisitCSharpExpressionBody(this); + } + + public CSharpExpressionBodySyntax Update(CSharpMetaCodeSyntax openParen, CSharpCodeBlockSyntax cSharpCode, CSharpMetaCodeSyntax closeParen) + { + if (openParen != OpenParen || cSharpCode != CSharpCode || closeParen != CloseParen) + { + var newNode = SyntaxFactory.CSharpExpressionBody(openParen, cSharpCode, closeParen); + var annotations = GetAnnotations(); + if (annotations != null && annotations.Length > 0) + return newNode.WithAnnotations(annotations); + return newNode; + } + + return this; + } + + public CSharpExpressionBodySyntax WithOpenParen(CSharpMetaCodeSyntax openParen) + { + return Update(openParen, _cSharpCode, _closeParen); + } + + public CSharpExpressionBodySyntax WithCSharpCode(CSharpCodeBlockSyntax cSharpCode) + { + return Update(_openParen, cSharpCode, _closeParen); + } + + public CSharpExpressionBodySyntax WithCloseParen(CSharpMetaCodeSyntax closeParen) + { + return Update(_openParen, _cSharpCode, closeParen); + } + + public CSharpExpressionBodySyntax AddOpenParenMetaCode(params SyntaxToken[] items) + { + var _openParen = this.OpenParen ?? SyntaxFactory.CSharpMetaCode(); + return this.WithOpenParen(_openParen.WithMetaCode(_openParen.MetaCode.AddRange(items))); + } + + public CSharpExpressionBodySyntax AddCSharpCodeChildren(params RazorSyntaxNode[] items) + { + return this.WithCSharpCode(this.CSharpCode.WithChildren(this.CSharpCode.Children.AddRange(items))); + } + + public CSharpExpressionBodySyntax AddCloseParenMetaCode(params SyntaxToken[] items) + { + var _closeParen = this.CloseParen ?? SyntaxFactory.CSharpMetaCode(); + return this.WithCloseParen(_closeParen.WithMetaCode(_closeParen.MetaCode.AddRange(items))); + } + } + + internal sealed partial class CSharpDirectiveSyntax : CSharpBlockSyntax + { + private CSharpTransitionSyntax _transition; + private CSharpSyntaxNode _body; + + internal CSharpDirectiveSyntax(GreenNode green, SyntaxNode parent, int position) + : base(green, parent, position) + { + } + + public override CSharpTransitionSyntax Transition + { + get + { + return GetRedAtZero(ref _transition); + } + } + + public override CSharpSyntaxNode Body + { + get + { + return GetRed(ref _body, 1); + } + } + + internal override SyntaxNode GetNodeSlot(int index) + { + switch (index) + { + case 0: return GetRedAtZero(ref _transition); + case 1: return GetRed(ref _body, 1); + default: return null; + } + } + internal override SyntaxNode GetCachedSlot(int index) + { + switch (index) + { + case 0: return _transition; + case 1: return _body; + default: return null; + } + } + + public override TResult Accept(SyntaxVisitor visitor) + { + return visitor.VisitCSharpDirective(this); + } + + public override void Accept(SyntaxVisitor visitor) + { + visitor.VisitCSharpDirective(this); + } + + public CSharpDirectiveSyntax Update(CSharpTransitionSyntax transition, CSharpSyntaxNode body) + { + if (transition != Transition || body != Body) + { + var newNode = SyntaxFactory.CSharpDirective(transition, body); + var annotations = GetAnnotations(); + if (annotations != null && annotations.Length > 0) + return newNode.WithAnnotations(annotations); + return newNode; + } + + return this; + } + + internal override CSharpBlockSyntax WithTransitionCore(CSharpTransitionSyntax transition) => WithTransition(transition); + public new CSharpDirectiveSyntax WithTransition(CSharpTransitionSyntax transition) + { + return Update(transition, _body); + } + + internal override CSharpBlockSyntax WithBodyCore(CSharpSyntaxNode body) => WithBody(body); + public new CSharpDirectiveSyntax WithBody(CSharpSyntaxNode body) + { + return Update(_transition, body); + } + } + + internal sealed partial class CSharpDirectiveBodySyntax : CSharpSyntaxNode + { + private CSharpMetaCodeSyntax _keyword; + private CSharpCodeBlockSyntax _cSharpCode; + + internal CSharpDirectiveBodySyntax(GreenNode green, SyntaxNode parent, int position) + : base(green, parent, position) + { + } + + public CSharpMetaCodeSyntax Keyword + { + get + { + return GetRedAtZero(ref _keyword); + } + } + + public CSharpCodeBlockSyntax CSharpCode + { + get + { + return GetRed(ref _cSharpCode, 1); + } + } + + internal override SyntaxNode GetNodeSlot(int index) + { + switch (index) + { + case 0: return GetRedAtZero(ref _keyword); + case 1: return GetRed(ref _cSharpCode, 1); + default: return null; + } + } + internal override SyntaxNode GetCachedSlot(int index) + { + switch (index) + { + case 0: return _keyword; + case 1: return _cSharpCode; + default: return null; + } + } + + public override TResult Accept(SyntaxVisitor visitor) + { + return visitor.VisitCSharpDirectiveBody(this); + } + + public override void Accept(SyntaxVisitor visitor) + { + visitor.VisitCSharpDirectiveBody(this); + } + + public CSharpDirectiveBodySyntax Update(CSharpMetaCodeSyntax keyword, CSharpCodeBlockSyntax cSharpCode) + { + if (keyword != Keyword || cSharpCode != CSharpCode) + { + var newNode = SyntaxFactory.CSharpDirectiveBody(keyword, cSharpCode); + var annotations = GetAnnotations(); + if (annotations != null && annotations.Length > 0) + return newNode.WithAnnotations(annotations); + return newNode; + } + + return this; + } + + public CSharpDirectiveBodySyntax WithKeyword(CSharpMetaCodeSyntax keyword) + { + return Update(keyword, _cSharpCode); + } + + public CSharpDirectiveBodySyntax WithCSharpCode(CSharpCodeBlockSyntax cSharpCode) + { + return Update(_keyword, cSharpCode); + } + + public CSharpDirectiveBodySyntax AddKeywordMetaCode(params SyntaxToken[] items) + { + return this.WithKeyword(this.Keyword.WithMetaCode(this.Keyword.MetaCode.AddRange(items))); + } + + public CSharpDirectiveBodySyntax AddCSharpCodeChildren(params RazorSyntaxNode[] items) + { + return this.WithCSharpCode(this.CSharpCode.WithChildren(this.CSharpCode.Children.AddRange(items))); + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/GreenNode.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/GreenNode.cs new file mode 100644 index 0000000000..7e05d7ab39 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/GreenNode.cs @@ -0,0 +1,577 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text; + +namespace Microsoft.AspNetCore.Razor.Language.Syntax +{ + internal abstract class GreenNode + { + private static readonly RazorDiagnostic[] EmptyDiagnostics = Array.Empty(); + private static readonly SyntaxAnnotation[] EmptyAnnotations = Array.Empty(); + private static readonly ConditionalWeakTable DiagnosticsTable = + new ConditionalWeakTable(); + private static readonly ConditionalWeakTable AnnotationsTable = + new ConditionalWeakTable(); + + private NodeFlags _flags; + private byte _slotCount; + + protected GreenNode(SyntaxKind kind) + { + Kind = kind; + } + + protected GreenNode(SyntaxKind kind, int fullWidth) + : this(kind) + { + FullWidth = fullWidth; + } + + protected GreenNode(SyntaxKind kind, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) + : this(kind, 0, diagnostics, annotations) + { + } + + protected GreenNode(SyntaxKind kind, int fullWidth, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) + : this(kind, fullWidth) + { + if (diagnostics?.Length > 0) + { + _flags |= NodeFlags.ContainsDiagnostics; + DiagnosticsTable.Add(this, diagnostics); + } + + if (annotations?.Length > 0) + { + foreach (var annotation in annotations) + { + if (annotation == null) + { + throw new ArgumentException(nameof(annotations), "Annotation cannot be null"); + } + } + + _flags |= NodeFlags.ContainsAnnotations; + AnnotationsTable.Add(this, annotations); + } + } + + protected void AdjustFlagsAndWidth(GreenNode node) + { + if (node == null) + { + return; + } + + _flags |= (node.Flags & NodeFlags.InheritMask); + FullWidth += node.FullWidth; + } + + #region Kind + internal SyntaxKind Kind { get; } + + internal virtual bool IsList => false; + + internal virtual bool IsToken => false; + + internal virtual bool IsTrivia => false; + #endregion + + #region Slots + public int SlotCount + { + get + { + int count = _slotCount; + if (count == byte.MaxValue) + { + count = GetSlotCount(); + } + + return count; + } + + protected set + { + _slotCount = (byte)value; + } + } + + internal abstract GreenNode GetSlot(int index); + + // for slot counts >= byte.MaxValue + protected virtual int GetSlotCount() + { + return _slotCount; + } + + public virtual int GetSlotOffset(int index) + { + var offset = 0; + for (var i = 0; i < index; i++) + { + var child = GetSlot(i); + if (child != null) + offset += child.FullWidth; + } + + return offset; + } + + public virtual int FindSlotIndexContainingOffset(int offset) + { + Debug.Assert(0 <= offset && offset < FullWidth); + + int i; + var accumulatedWidth = 0; + for (i = 0; ; i++) + { + Debug.Assert(i < SlotCount); + var child = GetSlot(i); + if (child != null) + { + accumulatedWidth += child.FullWidth; + if (offset < accumulatedWidth) + { + break; + } + } + } + + return i; + } + #endregion + + #region Flags + internal NodeFlags Flags => _flags; + + internal void SetFlags(NodeFlags flags) + { + _flags |= flags; + } + + internal void ClearFlags(NodeFlags flags) + { + _flags &= ~flags; + } + + internal virtual bool IsMissing => (_flags & NodeFlags.IsMissing) != 0; + + public bool ContainsDiagnostics + { + get + { + return (_flags & NodeFlags.ContainsDiagnostics) != 0; + } + } + + public bool ContainsAnnotations + { + get + { + return (_flags & NodeFlags.ContainsAnnotations) != 0; + } + } + #endregion + + #region Spans + internal int FullWidth { get; private set; } + + public virtual int Width + { + get + { + return FullWidth - GetLeadingTriviaWidth() - GetTrailingTriviaWidth(); + } + } + + public virtual int GetLeadingTriviaWidth() + { + return FullWidth != 0 ? GetFirstTerminal().GetLeadingTriviaWidth() : 0; + } + + public virtual int GetTrailingTriviaWidth() + { + return FullWidth != 0 ? GetLastTerminal().GetTrailingTriviaWidth() : 0; + } + + public bool HasLeadingTrivia + { + get + { + return GetLeadingTriviaWidth() != 0; + } + } + + public bool HasTrailingTrivia + { + get + { + return GetTrailingTriviaWidth() != 0; + } + } + #endregion + + #region Diagnostics + internal abstract GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics); + + internal RazorDiagnostic[] GetDiagnostics() + { + if (ContainsDiagnostics) + { + if (DiagnosticsTable.TryGetValue(this, out var diagnostics)) + { + return diagnostics; + } + } + + return EmptyDiagnostics; + } + #endregion + + #region Annotations + internal abstract GreenNode SetAnnotations(SyntaxAnnotation[] annotations); + + internal SyntaxAnnotation[] GetAnnotations() + { + if (ContainsAnnotations) + { + if (AnnotationsTable.TryGetValue(this, out var annotations)) + { + Debug.Assert(annotations.Length != 0, "There cannot be an empty annotation entry."); + return annotations; + } + } + + return EmptyAnnotations; + } + #endregion + + #region Text + public virtual string ToFullString() + { + var builder = new StringBuilder(); + var writer = new StringWriter(builder, System.Globalization.CultureInfo.InvariantCulture); + WriteTo(writer); + return builder.ToString(); + } + + public virtual void WriteTo(TextWriter writer) + { + WriteTo(writer, leading: true, trailing: true); + } + + protected internal void WriteTo(TextWriter writer, bool leading, bool trailing) + { + // Use an actual Stack so we can write out deeply recursive structures without overflowing. + var stack = new Stack(); + stack.Push(new StackEntry(this, leading, trailing)); + + // Separated out stack processing logic so that it does not unintentionally refer to + // "this", "leading" or "trailing. + ProcessStack(writer, stack); + } + + protected virtual void WriteTriviaTo(TextWriter writer) + { + throw new NotImplementedException(); + } + + protected virtual void WriteTokenTo(TextWriter writer, bool leading, bool trailing) + { + throw new NotImplementedException(); + } + #endregion + + #region Tokens + + public virtual object GetValue() + { + return null; + } + + public virtual string GetValueText() + { + return string.Empty; + } + + public virtual GreenNode GetLeadingTrivia() + { + return null; + } + + public virtual GreenNode GetTrailingTrivia() + { + return null; + } + + public virtual GreenNode WithLeadingTrivia(GreenNode trivia) + { + return this; + } + + public virtual GreenNode WithTrailingTrivia(GreenNode trivia) + { + return this; + } + + public InternalSyntax.SyntaxToken GetFirstToken() + { + return (InternalSyntax.SyntaxToken)GetFirstTerminal(); + } + + public InternalSyntax.SyntaxToken GetLastToken() + { + return (InternalSyntax.SyntaxToken)GetLastTerminal(); + } + + internal GreenNode GetFirstTerminal() + { + var node = this; + + do + { + GreenNode firstChild = null; + for (int i = 0, n = node.SlotCount; i < n; i++) + { + var child = node.GetSlot(i); + if (child != null) + { + firstChild = child; + break; + } + } + node = firstChild; + } while (node?._slotCount > 0); + + return node; + } + + internal GreenNode GetLastTerminal() + { + var node = this; + + do + { + GreenNode lastChild = null; + for (var i = node.SlotCount - 1; i >= 0; i--) + { + var child = node.GetSlot(i); + if (child != null) + { + lastChild = child; + break; + } + } + node = lastChild; + } while (node?._slotCount > 0); + + return node; + } + #endregion + + #region Equivalence + public virtual bool IsEquivalentTo(GreenNode other) + { + if (this == other) + { + return true; + } + + if (other == null) + { + return false; + } + + return EquivalentToInternal(this, other); + } + + private static bool EquivalentToInternal(GreenNode node1, GreenNode node2) + { + if (node1.Kind != node2.Kind) + { + // A single-element list is usually represented as just a single node, + // but can be represented as a List node with one child. Move to that + // child if necessary. + if (node1.IsList && node1.SlotCount == 1) + { + node1 = node1.GetSlot(0); + } + + if (node2.IsList && node2.SlotCount == 1) + { + node2 = node2.GetSlot(0); + } + + if (node1.Kind != node2.Kind) + { + return false; + } + } + + if (node1.FullWidth != node2.FullWidth) + { + return false; + } + + var n = node1.SlotCount; + if (n != node2.SlotCount) + { + return false; + } + + for (var i = 0; i < n; i++) + { + var node1Child = node1.GetSlot(i); + var node2Child = node2.GetSlot(i); + if (node1Child != null && node2Child != null && !node1Child.IsEquivalentTo(node2Child)) + { + return false; + } + } + + return true; + } + #endregion + + #region Factories + public virtual GreenNode CreateList(IEnumerable nodes, bool alwaysCreateListNode = false) + { + if (nodes == null) + { + return null; + } + + var list = nodes.ToArray(); + + switch (list.Length) + { + case 0: + return null; + case 1: + if (alwaysCreateListNode) + { + goto default; + } + else + { + return list[0]; + } + case 2: + return InternalSyntax.SyntaxList.List(list[0], list[1]); + case 3: + return InternalSyntax.SyntaxList.List(list[0], list[1], list[2]); + default: + return InternalSyntax.SyntaxList.List(list); + } + } + + public SyntaxNode CreateRed() + { + return CreateRed(null, 0); + } + + internal abstract SyntaxNode CreateRed(SyntaxNode parent, int position); + #endregion + + public abstract TResult Accept(InternalSyntax.SyntaxVisitor visitor); + + public abstract void Accept(InternalSyntax.SyntaxVisitor visitor); + + #region StaticMethods + + private static void ProcessStack(TextWriter writer, + Stack stack) + { + while (stack.Count > 0) + { + var current = stack.Pop(); + var currentNode = current.Node; + var currentLeading = current.Leading; + var currentTrailing = current.Trailing; + + if (currentNode.IsToken) + { + currentNode.WriteTokenTo(writer, currentLeading, currentTrailing); + continue; + } + + if (currentNode.IsTrivia) + { + currentNode.WriteTriviaTo(writer); + continue; + } + + var firstIndex = GetFirstNonNullChildIndex(currentNode); + var lastIndex = GetLastNonNullChildIndex(currentNode); + + for (var i = lastIndex; i >= firstIndex; i--) + { + var child = currentNode.GetSlot(i); + if (child != null) + { + var first = i == firstIndex; + var last = i == lastIndex; + stack.Push(new StackEntry(child, currentLeading | !first, currentTrailing | !last)); + } + } + } + } + + private static int GetFirstNonNullChildIndex(GreenNode node) + { + int n = node.SlotCount; + int firstIndex = 0; + for (; firstIndex < n; firstIndex++) + { + var child = node.GetSlot(firstIndex); + if (child != null) + { + break; + } + } + + return firstIndex; + } + + private static int GetLastNonNullChildIndex(GreenNode node) + { + int n = node.SlotCount; + int lastIndex = n - 1; + for (; lastIndex >= 0; lastIndex--) + { + var child = node.GetSlot(lastIndex); + if (child != null) + { + break; + } + } + + return lastIndex; + } + + private struct StackEntry + { + public StackEntry(GreenNode node, bool leading, bool trailing) + { + Node = node; + Leading = leading; + Trailing = trailing; + } + + public GreenNode Node { get; } + + public bool Leading { get; } + + public bool Trailing { get; } + } + #endregion + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/GreenNodeExtensions.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/GreenNodeExtensions.cs new file mode 100644 index 0000000000..6895dfdd02 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/GreenNodeExtensions.cs @@ -0,0 +1,56 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Generic; + +namespace Microsoft.AspNetCore.Razor.Language.Syntax +{ + internal static class GreenNodeExtensions + { + internal static InternalSyntax.SyntaxList ToGreenList(this SyntaxNode node) where T : GreenNode + { + return node != null ? + ToGreenList(node.Green) : + default(InternalSyntax.SyntaxList); + } + + internal static InternalSyntax.SyntaxList ToGreenList(this GreenNode node) where T : GreenNode + { + return new InternalSyntax.SyntaxList(node); + } + + public static TNode WithAnnotationsGreen(this TNode node, IEnumerable annotations) where TNode : GreenNode + { + var newAnnotations = new List(); + foreach (var candidate in annotations) + { + if (!newAnnotations.Contains(candidate)) + { + newAnnotations.Add(candidate); + } + } + + if (newAnnotations.Count == 0) + { + var existingAnnotations = node.GetAnnotations(); + if (existingAnnotations == null || existingAnnotations.Length == 0) + { + return node; + } + else + { + return (TNode)node.SetAnnotations(null); + } + } + else + { + return (TNode)node.SetAnnotations(newAnnotations.ToArray()); + } + } + + public static TNode WithDiagnosticsGreen(this TNode node, RazorDiagnostic[] diagnostics) where TNode : GreenNode + { + return (TNode)node.SetDiagnostics(diagnostics); + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxFactory.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxFactory.cs new file mode 100644 index 0000000000..79562ded0d --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxFactory.cs @@ -0,0 +1,21 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Linq; + +namespace Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax +{ + internal static partial class SyntaxFactory + { + internal static SyntaxToken Token(SyntaxKind kind, string content, IEnumerable diagnostics) + { + return Token(kind, content, diagnostics.ToArray()); + } + + internal static SyntaxToken Token(SyntaxKind kind, string content, params RazorDiagnostic[] diagnostics) + { + return new SyntaxToken(kind, content, diagnostics); + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxList.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxList.cs new file mode 100644 index 0000000000..ff466af513 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxList.cs @@ -0,0 +1,428 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Diagnostics; + +namespace Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax +{ + internal abstract class SyntaxList : GreenNode + { + internal SyntaxList() + : base(SyntaxKind.List) + { + } + + internal SyntaxList(RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) + : base(SyntaxKind.List, diagnostics, annotations) + { + } + + internal override bool IsList => true; + + internal static GreenNode List(GreenNode child) + { + return child; + } + + internal static WithTwoChildren List(GreenNode child0, GreenNode child1) + { + Debug.Assert(child0 != null); + Debug.Assert(child1 != null); + + var result = new WithTwoChildren(child0, child1); + return result; + } + + internal static WithThreeChildren List(GreenNode child0, GreenNode child1, GreenNode child2) + { + Debug.Assert(child0 != null); + Debug.Assert(child1 != null); + Debug.Assert(child2 != null); + + var result = new WithThreeChildren(child0, child1, child2); + return result; + } + + internal static GreenNode List(GreenNode[] nodes) + { + return List(nodes, nodes.Length); + } + + internal static GreenNode List(GreenNode[] nodes, int count) + { + var array = new ArrayElement[count]; + for (int i = 0; i < count; i++) + { + Debug.Assert(nodes[i] != null); + array[i].Value = nodes[i]; + } + + return List(array); + } + + internal static SyntaxList List(ArrayElement[] children) + { + // "WithLotsOfChildren" list will allocate a separate array to hold + // precomputed node offsets. It may not be worth it for smallish lists. + if (children.Length < 10) + { + return new WithManyChildren(children); + } + else + { + return new WithLotsOfChildren(children); + } + } + + internal abstract void CopyTo(ArrayElement[] array, int offset); + + internal static GreenNode Concat(GreenNode left, GreenNode right) + { + if (left == null) + { + return right; + } + + if (right == null) + { + return left; + } + + var leftList = left as SyntaxList; + var rightList = right as SyntaxList; + if (leftList != null) + { + if (rightList != null) + { + var tmp = new ArrayElement[left.SlotCount + right.SlotCount]; + leftList.CopyTo(tmp, 0); + rightList.CopyTo(tmp, left.SlotCount); + return List(tmp); + } + else + { + var tmp = new ArrayElement[left.SlotCount + 1]; + leftList.CopyTo(tmp, 0); + tmp[left.SlotCount].Value = right; + return List(tmp); + } + } + else if (rightList != null) + { + var tmp = new ArrayElement[rightList.SlotCount + 1]; + tmp[0].Value = left; + rightList.CopyTo(tmp, 1); + return List(tmp); + } + else + { + return List(left, right); + } + } + + public override TResult Accept(SyntaxVisitor visitor) + { + return visitor.Visit(this); + } + + public override void Accept(SyntaxVisitor visitor) + { + visitor.Visit(this); + } + + internal class WithTwoChildren : SyntaxList + { + private readonly GreenNode _child0; + private readonly GreenNode _child1; + + internal WithTwoChildren(GreenNode child0, GreenNode child1) + { + SlotCount = 2; + AdjustFlagsAndWidth(child0); + _child0 = child0; + AdjustFlagsAndWidth(child1); + _child1 = child1; + } + + internal WithTwoChildren(RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations, GreenNode child0, GreenNode child1) + { + SlotCount = 2; + AdjustFlagsAndWidth(child0); + _child0 = child0; + AdjustFlagsAndWidth(child1); + _child1 = child1; + } + + internal override GreenNode GetSlot(int index) + { + switch (index) + { + case 0: + return _child0; + case 1: + return _child1; + default: + return null; + } + } + + internal override void CopyTo(ArrayElement[] array, int offset) + { + array[offset].Value = _child0; + array[offset + 1].Value = _child1; + } + + internal override SyntaxNode CreateRed(SyntaxNode parent, int position) + { + return new Syntax.SyntaxList.WithTwoChildren(this, parent, position); + } + + internal override GreenNode SetDiagnostics(RazorDiagnostic[] errors) + { + return new WithTwoChildren(errors, this.GetAnnotations(), _child0, _child1); + } + + internal override GreenNode SetAnnotations(SyntaxAnnotation[] annotations) + { + return new WithTwoChildren(GetDiagnostics(), annotations, _child0, _child1); + } + } + + internal class WithThreeChildren : SyntaxList + { + private readonly GreenNode _child0; + private readonly GreenNode _child1; + private readonly GreenNode _child2; + + internal WithThreeChildren(GreenNode child0, GreenNode child1, GreenNode child2) + { + SlotCount = 3; + AdjustFlagsAndWidth(child0); + _child0 = child0; + AdjustFlagsAndWidth(child1); + _child1 = child1; + AdjustFlagsAndWidth(child2); + _child2 = child2; + } + + internal WithThreeChildren(RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations, GreenNode child0, GreenNode child1, GreenNode child2) + : base(diagnostics, annotations) + { + SlotCount = 3; + AdjustFlagsAndWidth(child0); + _child0 = child0; + AdjustFlagsAndWidth(child1); + _child1 = child1; + AdjustFlagsAndWidth(child2); + _child2 = child2; + } + + internal override GreenNode GetSlot(int index) + { + switch (index) + { + case 0: + return _child0; + case 1: + return _child1; + case 2: + return _child2; + default: + return null; + } + } + + internal override void CopyTo(ArrayElement[] array, int offset) + { + array[offset].Value = _child0; + array[offset + 1].Value = _child1; + array[offset + 2].Value = _child2; + } + + internal override SyntaxNode CreateRed(SyntaxNode parent, int position) + { + return new Syntax.SyntaxList.WithThreeChildren(this, parent, position); + } + + internal override GreenNode SetDiagnostics(RazorDiagnostic[] errors) + { + return new WithThreeChildren(errors, GetAnnotations(), _child0, _child1, _child2); + } + + internal override GreenNode SetAnnotations(SyntaxAnnotation[] annotations) + { + return new WithThreeChildren(GetDiagnostics(), annotations, _child0, _child1, _child2); + } + } + + internal abstract class WithManyChildrenBase : SyntaxList + { + internal readonly ArrayElement[] children; + + internal WithManyChildrenBase(ArrayElement[] children) + { + this.children = children; + this.InitializeChildren(); + } + + internal WithManyChildrenBase(RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations, ArrayElement[] children) + : base(diagnostics, annotations) + { + this.children = children; + this.InitializeChildren(); + } + + private void InitializeChildren() + { + var n = children.Length; + if (n < byte.MaxValue) + { + SlotCount = (byte)n; + } + else + { + SlotCount = byte.MaxValue; + } + + for (var i = 0; i < children.Length; i++) + { + AdjustFlagsAndWidth(children[i]); + } + } + + protected override int GetSlotCount() + { + return children.Length; + } + + internal override GreenNode GetSlot(int index) + { + return children[index]; + } + + internal override void CopyTo(ArrayElement[] array, int offset) + { + Array.Copy(children, 0, array, offset, children.Length); + } + + internal override SyntaxNode CreateRed(SyntaxNode parent, int position) + { + return new Syntax.SyntaxList.WithManyChildren(this, parent, position); + } + } + + internal sealed class WithManyChildren : WithManyChildrenBase + { + internal WithManyChildren(ArrayElement[] children) + : base(children) + { + } + + internal WithManyChildren(RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations, ArrayElement[] children) + : base(diagnostics, annotations, children) + { + } + + internal override GreenNode SetDiagnostics(RazorDiagnostic[] errors) + { + return new WithManyChildren(errors, GetAnnotations(), children); + } + + internal override GreenNode SetAnnotations(SyntaxAnnotation[] annotations) + { + return new WithManyChildren(GetDiagnostics(), annotations, children); + } + } + + internal sealed class WithLotsOfChildren : WithManyChildrenBase + { + private readonly int[] _childOffsets; + + internal WithLotsOfChildren(ArrayElement[] children) + : base(children) + { + _childOffsets = CalculateOffsets(children); + } + + internal WithLotsOfChildren(RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations, ArrayElement[] children, int[] childOffsets) + : base(diagnostics, annotations, children) + { + _childOffsets = childOffsets; + } + + public override int GetSlotOffset(int index) + { + return _childOffsets[index]; + } + + /// + /// Find the slot that contains the given offset. + /// + /// The target offset. Must be between 0 and . + /// The slot index of the slot containing the given offset. + /// + /// This implementation uses a binary search to find the first slot that contains + /// the given offset. + /// + public override int FindSlotIndexContainingOffset(int offset) + { + Debug.Assert(offset >= 0 && offset < FullWidth); + return BinarySearchUpperBound(_childOffsets, offset) - 1; + } + + private static int[] CalculateOffsets(ArrayElement[] children) + { + var n = children.Length; + var childOffsets = new int[n]; + var offset = 0; + for (var i = 0; i < n; i++) + { + childOffsets[i] = offset; + offset += children[i].Value.FullWidth; + } + return childOffsets; + } + + internal override GreenNode SetDiagnostics(RazorDiagnostic[] errors) + { + return new WithLotsOfChildren(errors, this.GetAnnotations(), children, _childOffsets); + } + + internal override GreenNode SetAnnotations(SyntaxAnnotation[] annotations) + { + return new WithLotsOfChildren(GetDiagnostics(), annotations, children, _childOffsets); + } + + /// + /// Search a sorted integer array for the target value in O(log N) time. + /// + /// The array of integers which must be sorted in ascending order. + /// The target value. + /// An index in the array pointing to the position where should be + /// inserted in order to maintain the sorted order. All values to the right of this position will be + /// strictly greater than . Note that this may return a position off the end + /// of the array if all elements are less than or equal to . + private static int BinarySearchUpperBound(int[] array, int value) + { + var low = 0; + var high = array.Length - 1; + + while (low <= high) + { + var middle = low + ((high - low) >> 1); + if (array[middle] > value) + { + high = middle - 1; + } + else + { + low = middle + 1; + } + } + + return low; + } + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxListBuilder.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxListBuilder.cs new file mode 100644 index 0000000000..fae8e718a7 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxListBuilder.cs @@ -0,0 +1,201 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Diagnostics; + +namespace Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax +{ + internal class SyntaxListBuilder + { + private ArrayElement[] _nodes; + + public int Count { get; private set; } + + public SyntaxListBuilder(int size) + { + _nodes = new ArrayElement[size]; + } + + public static SyntaxListBuilder Create() + { + return new SyntaxListBuilder(8); + } + + public void Clear() + { + Count = 0; + } + + public GreenNode this[int index] + { + get + { + return _nodes[index]; + } + + set + { + _nodes[index].Value = value; + } + } + + public void Add(GreenNode item) + { + if (item == null) return; + + if (item.IsList) + { + var slotCount = item.SlotCount; + + // Necessary, but not sufficient (e.g. for nested lists). + EnsureAdditionalCapacity(slotCount); + + for (var i = 0; i < slotCount; i++) + { + Add(item.GetSlot(i)); + } + } + else + { + EnsureAdditionalCapacity(1); + + _nodes[Count++].Value = item; + } + } + + public void AddRange(GreenNode[] items) + { + AddRange(items, 0, items.Length); + } + + public void AddRange(GreenNode[] items, int offset, int length) + { + // Necessary, but not sufficient (e.g. for nested lists). + EnsureAdditionalCapacity(length - offset); + + var oldCount = Count; + + for (var i = offset; i < length; i++) + { + Add(items[i]); + } + + Validate(oldCount, Count); + } + + [Conditional("DEBUG")] + private void Validate(int start, int end) + { + for (var i = start; i < end; i++) + { + Debug.Assert(_nodes[i].Value != null); + } + } + + public void AddRange(SyntaxList list) + { + this.AddRange(list, 0, list.Count); + } + + public void AddRange(SyntaxList list, int offset, int length) + { + // Necessary, but not sufficient (e.g. for nested lists). + EnsureAdditionalCapacity(length - offset); + + var oldCount = Count; + + for (var i = offset; i < length; i++) + { + Add(list[i]); + } + + Validate(oldCount, Count); + } + + public void AddRange(SyntaxList list) where TNode : GreenNode + { + this.AddRange(list, 0, list.Count); + } + + public void AddRange(SyntaxList list, int offset, int length) where TNode : GreenNode + { + AddRange(new SyntaxList(list.Node), offset, length); + } + + public void RemoveLast() + { + Count--; + _nodes[Count].Value = null; + } + + private void EnsureAdditionalCapacity(int additionalCount) + { + var currentSize = _nodes.Length; + var requiredSize = Count + additionalCount; + + if (requiredSize <= currentSize) return; + + var newSize = + requiredSize < 8 ? 8 : + requiredSize >= (int.MaxValue / 2) ? int.MaxValue : + Math.Max(requiredSize, currentSize * 2); // NB: Size will *at least* double. + Debug.Assert(newSize >= requiredSize); + + Array.Resize(ref _nodes, newSize); + } + + public bool Any(SyntaxKind kind) + { + for (var i = 0; i < Count; i++) + { + if (_nodes[i].Value.Kind == kind) + { + return true; + } + } + + return false; + } + + public GreenNode[] ToArray() + { + var array = new GreenNode[Count]; + for (var i = 0; i < array.Length; i++) + { + array[i] = _nodes[i]; + } + + return array; + } + + internal GreenNode ToListNode() + { + switch (Count) + { + case 0: + return null; + case 1: + return _nodes[0]; + case 2: + return SyntaxList.List(_nodes[0], _nodes[1]); + case 3: + return SyntaxList.List(_nodes[0], _nodes[1], _nodes[2]); + default: + var tmp = new ArrayElement[Count]; + Array.Copy(_nodes, tmp, Count); + return SyntaxList.List(tmp); + } + } + + public SyntaxList ToList() + { + return new SyntaxList(ToListNode()); + } + + public SyntaxList ToList() where TNode : GreenNode + { + return new SyntaxList(ToListNode()); + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxListBuilderOfT.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxListBuilderOfT.cs new file mode 100644 index 0000000000..65a11313f6 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxListBuilderOfT.cs @@ -0,0 +1,115 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax +{ + internal readonly struct SyntaxListBuilder where TNode : GreenNode + { + private readonly SyntaxListBuilder _builder; + + public SyntaxListBuilder(int size) + : this(new SyntaxListBuilder(size)) + { + } + + public static SyntaxListBuilder Create() + { + return new SyntaxListBuilder(8); + } + + internal SyntaxListBuilder(SyntaxListBuilder builder) + { + _builder = builder; + } + + public bool IsNull + { + get + { + return _builder == null; + } + } + + public int Count + { + get + { + return _builder.Count; + } + } + + public TNode this[int index] + { + get + { + return (TNode)_builder[index]; + } + + set + { + _builder[index] = value; + } + } + + public void Clear() + { + _builder.Clear(); + } + + public SyntaxListBuilder Add(TNode node) + { + _builder.Add(node); + return this; + } + + public void AddRange(TNode[] items, int offset, int length) + { + _builder.AddRange(items, offset, length); + } + + public void AddRange(SyntaxList nodes) + { + _builder.AddRange(nodes); + } + + public void AddRange(SyntaxList nodes, int offset, int length) + { + _builder.AddRange(nodes, offset, length); + } + + public bool Any(SyntaxKind kind) + { + return _builder.Any(kind); + } + + public SyntaxList ToList() + { + return _builder.ToList(); + } + + public GreenNode ToListNode() + { + return _builder.ToListNode(); + } + + public static implicit operator SyntaxListBuilder(SyntaxListBuilder builder) + { + return builder._builder; + } + + public static implicit operator SyntaxList(SyntaxListBuilder builder) + { + if (builder._builder != null) + { + return builder.ToList(); + } + + return default(SyntaxList); + } + + public SyntaxList ToList() where TDerived : GreenNode + { + return new SyntaxList(ToListNode()); + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxListOfT.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxListOfT.cs new file mode 100644 index 0000000000..945781978d --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxListOfT.cs @@ -0,0 +1,139 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Diagnostics; + +namespace Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax +{ + internal readonly struct SyntaxList + where TNode : GreenNode + { + private readonly GreenNode _node; + + public SyntaxList(GreenNode node) + { + _node = node; + } + + public GreenNode Node + { + get + { + return ((GreenNode)_node); + } + } + + public int Count + { + get + { + return (_node == null) ? 0 : _node.IsList ? _node.SlotCount : 1; + } + } + + public TNode Last + { + get + { + var node = _node; + if (node.IsList) + { + return ((TNode)node.GetSlot(node.SlotCount - 1)); + } + + return ((TNode)node); + } + } + + /* Not Implemented: Default */ + public TNode this[int index] + { + get + { + var node = _node; + if (node.IsList) + { + return ((TNode)node.GetSlot(index)); + } + + Debug.Assert(index == 0); + return ((TNode)node); + } + } + + public GreenNode ItemUntyped(int index) + { + var node = _node; + if (node.IsList) + { + return node.GetSlot(index); + } + + Debug.Assert(index == 0); + return node; + } + + public bool Any() + { + return _node != null; + } + + public bool Any(SyntaxKind kind) + { + for (var i = 0; i < Count; i++) + { + var element = ItemUntyped(i); + if ((element.Kind == kind)) + { + return true; + } + } + + return false; + } + + public TNode[] Nodes + { + get + { + var arr = new TNode[Count]; + for (var i = 0; i < Count; i++) + { + arr[i] = this[i]; + } + + return arr; + } + } + + public static bool operator ==(SyntaxList left, SyntaxList right) + { + return (left._node == right._node); + } + + public static bool operator !=(SyntaxList left, SyntaxList right) + { + return !(left._node == right._node); + } + + public override bool Equals(object obj) + { + return (obj is SyntaxList && (_node == ((SyntaxList)obj)._node)); + } + + public override int GetHashCode() + { + return _node != null ? _node.GetHashCode() : 0; + } + + public static implicit operator SyntaxList(TNode node) + { + return new SyntaxList(node); + } + + public static implicit operator SyntaxList(SyntaxList nodes) + { + return new SyntaxList(nodes._node); + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxToken.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxToken.cs new file mode 100644 index 0000000000..3b11afa5e4 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxToken.cs @@ -0,0 +1,199 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.IO; +using Microsoft.AspNetCore.Razor.Language.Legacy; + +namespace Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax +{ + internal class SyntaxToken : GreenNode + { + internal SyntaxToken(SyntaxKind kind, string content, RazorDiagnostic[] diagnostics) + : base(kind, content.Length, diagnostics, annotations: null) + { + Content = content; + } + + internal SyntaxToken(SyntaxKind kind, string content, GreenNode leadingTrivia, GreenNode trailingTrivia) + : base(kind, content.Length) + { + Content = content; + LeadingTrivia = leadingTrivia; + AdjustFlagsAndWidth(leadingTrivia); + TrailingTrivia = trailingTrivia; + AdjustFlagsAndWidth(trailingTrivia); + } + + internal SyntaxToken(SyntaxKind kind, string content, GreenNode leadingTrivia, GreenNode trailingTrivia, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) + : base(kind, content.Length, diagnostics, annotations) + { + Content = content; + LeadingTrivia = leadingTrivia; + AdjustFlagsAndWidth(leadingTrivia); + TrailingTrivia = trailingTrivia; + AdjustFlagsAndWidth(trailingTrivia); + } + + public string Content { get; } + + public GreenNode LeadingTrivia { get; } + + public GreenNode TrailingTrivia { get; } + + internal override bool IsToken => true; + + public override int Width => Content.Length; + + internal override SyntaxNode CreateRed(SyntaxNode parent, int position) + { + return new Syntax.SyntaxToken(this, parent, position); + } + + protected override void WriteTokenTo(TextWriter writer, bool leading, bool trailing) + { + if (leading) + { + var trivia = GetLeadingTrivia(); + if (trivia != null) + { + trivia.WriteTo(writer, true, true); + } + } + + writer.Write(Content); + + if (trailing) + { + var trivia = GetTrailingTrivia(); + if (trivia != null) + { + trivia.WriteTo(writer, true, true); + } + } + } + + public override sealed GreenNode GetLeadingTrivia() + { + return LeadingTrivia; + } + + public override int GetLeadingTriviaWidth() + { + return LeadingTrivia == null ? 0 : LeadingTrivia.FullWidth; + } + + public override sealed GreenNode GetTrailingTrivia() + { + return TrailingTrivia; + } + + public override int GetTrailingTriviaWidth() + { + return TrailingTrivia == null ? 0 : TrailingTrivia.FullWidth; + } + + public sealed override GreenNode WithLeadingTrivia(GreenNode trivia) + { + return TokenWithLeadingTrivia(trivia); + } + + public virtual SyntaxToken TokenWithLeadingTrivia(GreenNode trivia) + { + return new SyntaxToken(Kind, Content, trivia, TrailingTrivia, GetDiagnostics(), GetAnnotations()); + } + + public sealed override GreenNode WithTrailingTrivia(GreenNode trivia) + { + return TokenWithTrailingTrivia(trivia); + } + + public virtual SyntaxToken TokenWithTrailingTrivia(GreenNode trivia) + { + return new SyntaxToken(Kind, Content, LeadingTrivia, trivia, GetDiagnostics(), GetAnnotations()); + } + + internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) + { + return new SyntaxToken(Kind, Content, LeadingTrivia, TrailingTrivia, diagnostics, GetAnnotations()); + } + + internal override GreenNode SetAnnotations(SyntaxAnnotation[] annotations) + { + return new SyntaxToken(Kind, Content, LeadingTrivia, TrailingTrivia, GetDiagnostics(), annotations); + } + + protected override sealed int GetSlotCount() + { + return 0; + } + + internal override sealed GreenNode GetSlot(int index) + { + throw new InvalidOperationException("Tokens don't have slots."); + } + + public override TResult Accept(SyntaxVisitor visitor) + { + return visitor.VisitToken(this); + } + + public override void Accept(SyntaxVisitor visitor) + { + visitor.VisitToken(this); + } + + public override bool IsEquivalentTo(GreenNode other) + { + if (!base.IsEquivalentTo(other)) + { + return false; + } + + var otherToken = (SyntaxToken)other; + + if (Content != otherToken.Content) + { + return false; + } + + var thisLeading = GetLeadingTrivia(); + var otherLeading = otherToken.GetLeadingTrivia(); + if (thisLeading != otherLeading) + { + if (thisLeading == null || otherLeading == null) + { + return false; + } + + if (!thisLeading.IsEquivalentTo(otherLeading)) + { + return false; + } + } + + var thisTrailing = GetTrailingTrivia(); + var otherTrailing = otherToken.GetTrailingTrivia(); + if (thisTrailing != otherTrailing) + { + if (thisTrailing == null || otherTrailing == null) + { + return false; + } + + if (!thisTrailing.IsEquivalentTo(otherTrailing)) + { + return false; + } + } + + return true; + } + + public override string ToString() + { + return Content; + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxTrivia.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxTrivia.cs new file mode 100644 index 0000000000..84ad53155a --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxTrivia.cs @@ -0,0 +1,100 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.IO; + +namespace Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax +{ + internal class SyntaxTrivia : GreenNode + { + internal SyntaxTrivia(SyntaxKind kind, string text) + : base(kind, text.Length) + { + Text = text; + } + + internal SyntaxTrivia(SyntaxKind kind, string text, RazorDiagnostic[] diagnostics, SyntaxAnnotation[] annotations) + : base(kind, text.Length, diagnostics, annotations) + { + Text = text; + } + + public string Text { get; } + + internal override bool IsTrivia => true; + + public override int Width => Text.Length; + + protected override void WriteTriviaTo(TextWriter writer) + { + writer.Write(Text); + } + + public sealed override string ToFullString() + { + return Text; + } + + public sealed override int GetLeadingTriviaWidth() + { + return 0; + } + + public sealed override int GetTrailingTriviaWidth() + { + return 0; + } + + protected override sealed int GetSlotCount() + { + return 0; + } + + internal override sealed GreenNode GetSlot(int index) + { + throw new InvalidOperationException(); + } + + internal override SyntaxNode CreateRed(SyntaxNode parent, int position) + { + return new Syntax.SyntaxTrivia(this, parent, position); + } + + public override TResult Accept(SyntaxVisitor visitor) + { + return visitor.VisitTrivia(this); + } + + public override void Accept(SyntaxVisitor visitor) + { + visitor.VisitTrivia(this); + } + + internal override GreenNode SetDiagnostics(RazorDiagnostic[] diagnostics) + { + return new SyntaxTrivia(Kind, Text, diagnostics, GetAnnotations()); + } + + internal override GreenNode SetAnnotations(SyntaxAnnotation[] annotations) + { + return new SyntaxTrivia(Kind, Text, GetDiagnostics(), annotations); + } + + public override bool IsEquivalentTo(GreenNode other) + { + if (!base.IsEquivalentTo(other)) + { + return false; + } + + if (Text != ((SyntaxTrivia)other).Text) + { + return false; + } + + return true; + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxVisitor.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxVisitor.cs new file mode 100644 index 0000000000..a00f30f477 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/InternalSyntax/SyntaxVisitor.cs @@ -0,0 +1,60 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax +{ + internal abstract partial class SyntaxVisitor + { + public virtual TResult Visit(GreenNode node) + { + if (node == null) + { + return default(TResult); + } + + return node.Accept(this); + } + + public virtual TResult VisitToken(SyntaxToken token) + { + return DefaultVisit(token); + } + + public virtual TResult VisitTrivia(SyntaxTrivia trivia) + { + return DefaultVisit(trivia); + } + + protected virtual TResult DefaultVisit(GreenNode node) + { + return default(TResult); + } + } + + internal abstract partial class SyntaxVisitor + { + public virtual GreenNode Visit(GreenNode node) + { + if (node != null) + { + node.Accept(this); + } + + return null; + } + + public virtual void VisitToken(SyntaxToken token) + { + DefaultVisit(token); + } + + public virtual void VisitTrivia(SyntaxTrivia trivia) + { + DefaultVisit(trivia); + } + + protected virtual void DefaultVisit(GreenNode node) + { + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/NodeFlags.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/NodeFlags.cs new file mode 100644 index 0000000000..5dd4850e58 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/NodeFlags.cs @@ -0,0 +1,21 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; + +namespace Microsoft.AspNetCore.Razor.Language.Syntax +{ + [Flags] + internal enum NodeFlags : byte + { + None = 0, + ContainsDiagnostics = 1 << 0, + ContainsStructuredTrivia = 1 << 1, + ContainsDirectives = 1 << 2, + ContainsSkippedText = 1 << 3, + ContainsAnnotations = 1 << 4, + IsMissing = 1 << 5, + + InheritMask = ContainsDiagnostics | ContainsStructuredTrivia | ContainsDirectives | ContainsSkippedText | ContainsAnnotations | IsMissing, + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/ObjectPool.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/ObjectPool.cs new file mode 100644 index 0000000000..2df35b64ac --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/ObjectPool.cs @@ -0,0 +1,248 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Diagnostics; +using System.Threading; + +#if DETECT_LEAKS +using System.Runtime.CompilerServices; + +#endif + +// define TRACE_LEAKS to get additional diagnostics that can lead to the leak sources. note: it will +// make everything about 2-3x slower +// +// #define TRACE_LEAKS + +// define DETECT_LEAKS to detect possible leaks +// #if DEBUG +// #define DETECT_LEAKS //for now always enable DETECT_LEAKS in debug. +// #endif + +namespace Microsoft.AspNetCore.Razor.Language.Syntax +{ + /// + /// Generic implementation of object pooling pattern with predefined pool size limit. The main + /// purpose is that limited number of frequently used objects can be kept in the pool for + /// further recycling. + /// + /// Notes: + /// 1) it is not the goal to keep all returned objects. Pool is not meant for storage. If there + /// is no space in the pool, extra returned objects will be dropped. + /// + /// 2) it is implied that if object was obtained from a pool, the caller will return it back in + /// a relatively short time. Keeping checked out objects for long durations is ok, but + /// reduces usefulness of pooling. Just new up your own. + /// + /// Not returning objects to the pool in not detrimental to the pool's work, but is a bad practice. + /// Rationale: + /// If there is no intent for reusing the object, do not use pool - just use "new". + /// + internal class ObjectPool where T : class + { + private struct Element + { + internal T Value; + } + + /// + /// Not using because this file is linked into the (debugger) Formatter, + /// which does not have that type (since it compiles against .NET 2.0). + /// + internal delegate T Factory(); + + // storage for the pool objects. + private readonly Element[] _items; + + // factory is stored for the lifetime of the pool. We will call this only when pool needs to + // expand. compared to "new T()", Func gives more flexibility to implementers and faster + // than "new T()". + private readonly Factory _factory; + +#if DETECT_LEAKS + private static readonly ConditionalWeakTable leakTrackers = new ConditionalWeakTable(); + + private class LeakTracker : IDisposable + { + private volatile bool disposed; + +#if TRACE_LEAKS + internal volatile System.Diagnostics.StackTrace Trace = null; +#endif + + public void Dispose() + { + disposed = true; + GC.SuppressFinalize(this); + } + + private string GetTrace() + { +#if TRACE_LEAKS + return Trace == null? "": Trace.ToString(); +#else + return "Leak tracing information is disabled. Define TRACE_LEAKS on ObjectPool`1.cs to get more info \n"; +#endif + } + + ~LeakTracker() + { + if (!this.disposed && + !Environment.HasShutdownStarted && + !AppDomain.CurrentDomain.IsFinalizingForUnload()) + { + string report = string.Format("Pool detected potential leaking of {0}. \n Location of the leak: \n {1} ", + typeof(T).ToString(), + GetTrace()); + + // If you are seeing this message it means that object has been allocated from the pool + // and has not been returned back. This is not critical, but turns pool into rather + // inefficient kind of "new". + Debug.WriteLine("TRACEOBJECTPOOLLEAKS_BEGIN\n" + report + "TRACEOBJECTPOOLLEAKS_END"); + } + } + } +#endif + + internal ObjectPool(Factory factory) + : this(factory, Environment.ProcessorCount * 2) + { } + + internal ObjectPool(Factory factory, int size) + { + _factory = factory; + _items = new Element[size]; + } + + private T CreateInstance() + { + var inst = _factory(); + return inst; + } + + /// + /// Produces an instance. + /// + /// + /// Search strategy is a simple linear probing which is chosen for it cache-friendliness. + /// Note that Free will try to store recycled objects close to the start thus statistically + /// reducing how far we will typically search. + /// + internal T Allocate() + { + var items = _items; + T inst; + + for (var i = 0; i < items.Length; i++) + { + // Note that the read is optimistically not synchronized. That is intentional. + // We will interlock only when we have a candidate. in a worst case we may miss some + // recently returned objects. Not a big deal. + inst = items[i].Value; + if (inst != null) + { + if (inst == Interlocked.CompareExchange(ref items[i].Value, null, inst)) + { + goto gotInstance; + } + } + } + + inst = CreateInstance(); + gotInstance: + +#if DETECT_LEAKS + var tracker = new LeakTracker(); + leakTrackers.Add(inst, tracker); + +#if TRACE_LEAKS + var frame = new System.Diagnostics.StackTrace(false); + tracker.Trace = frame; +#endif +#endif + + return inst; + } + + /// + /// Returns objects to the pool. + /// + /// + /// Search strategy is a simple linear probing which is chosen for it cache-friendliness. + /// Note that Free will try to store recycled objects close to the start thus statistically + /// reducing how far we will typically search in Allocate. + /// + internal void Free(T obj) + { + Validate(obj); + ForgetTrackedObject(obj); + + var items = _items; + for (var i = 0; i < items.Length; i++) + { + if (items[i].Value == null) + { + // Intentionally not using interlocked here. + // In a worst case scenario two objects may be stored into same slot. + // It is very unlikely to happen and will only mean that one of the objects will get collected. + items[i].Value = obj; + break; + } + } + } + + /// + /// Removes an object from leak tracking. + /// + /// This is called when an object is returned to the pool. It may also be explicitly + /// called if an object allocated from the pool is intentionally not being returned + /// to the pool. This can be of use with pooled arrays if the consumer wants to + /// return a larger array to the pool than was originally allocated. + /// + [Conditional("DEBUG")] + internal void ForgetTrackedObject(T old, T replacement = null) + { +#if DETECT_LEAKS + LeakTracker tracker; + if (leakTrackers.TryGetValue(old, out tracker)) + { + tracker.Dispose(); + leakTrackers.Remove(old); + } + else + { + string report = string.Format("Object of type {0} was freed, but was not from pool. \n Callstack: \n {1} ", + typeof(T).ToString(), + new System.Diagnostics.StackTrace(false)); + + Debug.WriteLine("TRACEOBJECTPOOLLEAKS_BEGIN\n" + report + "TRACEOBJECTPOOLLEAKS_END"); + } + + if (replacement != null) + { + tracker = new LeakTracker(); + leakTrackers.Add(replacement, tracker); + } +#endif + } + + [Conditional("DEBUG")] + private void Validate(object obj) + { + Debug.Assert(obj != null, "freeing null?"); + + var items = _items; + for (var i = 0; i < items.Length; i++) + { + var value = items[i].Value; + if (value == null) + { + return; + } + + Debug.Assert(value != obj, "freeing twice?"); + } + } + } +} \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/ParserState.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/ParserState.cs new file mode 100644 index 0000000000..adb81967dd --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/ParserState.cs @@ -0,0 +1,14 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace Microsoft.AspNetCore.Razor.Language +{ + internal enum ParserState + { + Unknown, + Misc, + Content, + StartTag, + EndTag, + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SpecializedCollections.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SpecializedCollections.cs new file mode 100644 index 0000000000..3e1094003f --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SpecializedCollections.cs @@ -0,0 +1,169 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.AspNetCore.Razor.Language.Syntax +{ + internal static class SpecializedCollections + { + public static IEnumerator EmptyEnumerator() + { + return Empty.Enumerator.Instance; + } + + public static IEnumerable EmptyEnumerable() + { + return Empty.List.Instance; + } + + public static ICollection EmptyCollection() + { + return Empty.List.Instance; + } + + public static IList EmptyList() + { + return Empty.List.Instance; + } + + public static IReadOnlyList EmptyReadOnlyList() + { + return Empty.List.Instance; + } + + private class Empty + { + internal class Enumerator : Enumerator, IEnumerator + { + public static new readonly IEnumerator Instance = new Enumerator(); + + protected Enumerator() + { + } + + public new T Current => throw new InvalidOperationException(); + + public void Dispose() + { + } + } + + internal class Enumerator : IEnumerator + { + public static readonly IEnumerator Instance = new Enumerator(); + + protected Enumerator() + { + } + + public object Current => throw new InvalidOperationException(); + + public bool MoveNext() + { + return false; + } + + public void Reset() + { + throw new InvalidOperationException(); + } + } + + internal class Enumerable : IEnumerable + { + // PERF: cache the instance of enumerator. + // accessing a generic static field is kinda slow from here, + // but since empty enumerables are singletons, there is no harm in having + // one extra instance field + private readonly IEnumerator _enumerator = Enumerator.Instance; + + public IEnumerator GetEnumerator() + { + return _enumerator; + } + + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } + + internal class Collection : Enumerable, ICollection + { + public static readonly ICollection Instance = new Collection(); + + protected Collection() + { + } + + public void Add(T item) + { + throw new NotSupportedException(); + } + + public void Clear() + { + throw new NotSupportedException(); + } + + public bool Contains(T item) + { + return false; + } + + public void CopyTo(T[] array, int arrayIndex) + { + } + + public int Count => 0; + + public bool IsReadOnly => true; + + public bool Remove(T item) + { + throw new NotSupportedException(); + } + } + + internal class List : Collection, IList, IReadOnlyList + { + public static readonly new List Instance = new List(); + + protected List() + { + } + + public int IndexOf(T item) + { + return -1; + } + + public void Insert(int index, T item) + { + throw new NotSupportedException(); + } + + public void RemoveAt(int index) + { + throw new NotSupportedException(); + } + + public T this[int index] + { + get + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + + set + { + throw new NotSupportedException(); + } + } + } + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/Syntax.xml b/src/Microsoft.AspNetCore.Razor.Language/Syntax/Syntax.xml new file mode 100644 index 0000000000..2fdd25db04 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/Syntax.xml @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxAnnotation.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxAnnotation.cs new file mode 100644 index 0000000000..dbb72fb1ae --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxAnnotation.cs @@ -0,0 +1,93 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Diagnostics; + +namespace Microsoft.AspNetCore.Razor.Language.Syntax +{ + /// + /// A SyntaxAnnotation is used to annotate syntax elements with additional information. + /// + /// Since syntax elements are immutable, annotating them requires creating new instances of them + /// with the annotations attached. + /// + [DebuggerDisplay("{GetDebuggerDisplay(), nq}")] + internal sealed class SyntaxAnnotation : IEquatable + { + // use a value identity instead of object identity so a deserialized instance matches the original instance. + private readonly long _id; + private static long s_nextId; + + // use a value identity instead of object identity so a deserialized instance matches the original instance. + public string Kind { get; } + public string Data { get; } + + public SyntaxAnnotation() + { + _id = System.Threading.Interlocked.Increment(ref s_nextId); + } + + public SyntaxAnnotation(string kind) + : this() + { + Kind = kind; + } + + public SyntaxAnnotation(string kind, string data) + : this(kind) + { + Data = data; + } + + private string GetDebuggerDisplay() + { + return string.Format("Annotation: Kind='{0}' Data='{1}'", this.Kind ?? "", this.Data ?? ""); + } + + public bool Equals(SyntaxAnnotation other) + { + return (object)other != null && _id == other._id; + } + + public static bool operator ==(SyntaxAnnotation left, SyntaxAnnotation right) + { + if ((object)left == (object)right) + { + return true; + } + + if ((object)left == null || (object)right == null) + { + return false; + } + + return left.Equals(right); + } + + public static bool operator !=(SyntaxAnnotation left, SyntaxAnnotation right) + { + if ((object)left == (object)right) + { + return false; + } + + if ((object)left == null || (object)right == null) + { + return true; + } + + return !left.Equals(right); + } + + public override bool Equals(object obj) + { + return Equals(obj as SyntaxAnnotation); + } + + public override int GetHashCode() + { + return _id.GetHashCode(); + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxFactory.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxFactory.cs new file mode 100644 index 0000000000..98568d21d2 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxFactory.cs @@ -0,0 +1,18 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace Microsoft.AspNetCore.Razor.Language.Syntax +{ + internal static partial class SyntaxFactory + { + public static SyntaxToken Token(SyntaxKind kind, params RazorDiagnostic[] diagnostics) + { + return Token(kind, content: string.Empty, diagnostics: diagnostics); + } + + public static SyntaxToken Token(SyntaxKind kind, string content, params RazorDiagnostic[] diagnostics) + { + return new SyntaxToken(InternalSyntax.SyntaxFactory.Token(kind, content), parent: null, position: 0); + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpTokenType.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxKind.cs similarity index 56% rename from src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpTokenType.cs rename to src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxKind.cs index 10f3478d6d..59cddf7116 100644 --- a/src/Microsoft.AspNetCore.Razor.Language/Legacy/CSharpTokenType.cs +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxKind.cs @@ -1,22 +1,66 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -namespace Microsoft.AspNetCore.Razor.Language.Legacy +namespace Microsoft.AspNetCore.Razor.Language { - internal enum CSharpTokenType + internal enum SyntaxKind : byte { + #region Nodes + // HTML + HtmlTextLiteral, + HtmlDocument, + HtmlDeclaration, + + // CSharp + CSharpBlock, + CSharpStatement, + CSharpStatementBody, + CSharpExpression, + CSharpExpressionBody, + CSharpDirective, + CSharpDirectiveBody, + CSharpCodeBlock, + CSharpCodeLiteral, + CSharpMetaCode, + CSharpTransition, + + // Common + RazorComment, + #endregion + + #region Tokens + // Common Unknown, + List, + Whitespace, + NewLine, + Colon, + QuestionMark, + RightBracket, + LeftBracket, + Equals, + Transition, + + // HTML + Text, + OpenAngle, + Bang, + ForwardSlash, + DoubleHyphen, + CloseAngle, + DoubleQuote, + SingleQuote, + + // CSharp literals Identifier, Keyword, IntegerLiteral, - NewLine, - WhiteSpace, - Comment, + CSharpComment, RealLiteral, CharacterLiteral, StringLiteral, - // Operators + // CSharp operators Arrow, Minus, Decrement, @@ -37,12 +81,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy Slash, DivideAssign, DoubleColon, - Colon, Semicolon, - QuestionMark, NullCoalesce, - RightBracket, - LeftBracket, XorAssign, Xor, LeftBrace, @@ -59,17 +99,16 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy LeftShift, LeftShiftAssign, Assign, - Equals, GreaterThan, GreaterThanEqual, RightShift, RightShiftAssign, Hash, - Transition, // Razor specific - RazorCommentTransition, + RazorCommentLiteral, RazorCommentStar, - RazorComment + RazorCommentTransition, + #endregion } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxList.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxList.cs new file mode 100644 index 0000000000..3b7d318e37 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxList.cs @@ -0,0 +1,123 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace Microsoft.AspNetCore.Razor.Language.Syntax +{ + internal abstract class SyntaxList : SyntaxNode + { + internal SyntaxList(InternalSyntax.SyntaxList green, SyntaxNode parent, int position) + : base(green, parent, position) + { + } + + public override TResult Accept(SyntaxVisitor visitor) + { + return visitor.Visit(this); + } + + public override void Accept(SyntaxVisitor visitor) + { + visitor.Visit(this); + } + + internal class WithTwoChildren : SyntaxList + { + private SyntaxNode _child0; + private SyntaxNode _child1; + + internal WithTwoChildren(InternalSyntax.SyntaxList green, SyntaxNode parent, int position) + : base(green, parent, position) + { + } + + internal override SyntaxNode GetNodeSlot(int index) + { + switch (index) + { + case 0: + return GetRedElement(ref _child0, 0); + case 1: + return GetRedElement(ref _child1, 1); + default: + return null; + } + } + + internal override SyntaxNode GetCachedSlot(int index) + { + switch (index) + { + case 0: + return _child0; + case 1: + return _child1; + default: + return null; + } + } + } + + internal class WithThreeChildren : SyntaxList + { + private SyntaxNode _child0; + private SyntaxNode _child1; + private SyntaxNode _child2; + + internal WithThreeChildren(InternalSyntax.SyntaxList green, SyntaxNode parent, int position) + : base(green, parent, position) + { + } + + internal override SyntaxNode GetNodeSlot(int index) + { + switch (index) + { + case 0: + return GetRedElement(ref _child0, 0); + case 1: + return GetRedElement(ref _child1, 1); + case 2: + return GetRedElement(ref _child2, 2); + default: + return null; + } + } + + internal override SyntaxNode GetCachedSlot(int index) + { + switch (index) + { + case 0: + return _child0; + case 1: + return _child1; + case 2: + return _child2; + default: + return null; + } + } + } + + internal class WithManyChildren : SyntaxList + { + private readonly ArrayElement[] _children; + + internal WithManyChildren(InternalSyntax.SyntaxList green, SyntaxNode parent, int position) + : base(green, parent, position) + { + _children = new ArrayElement[green.SlotCount]; + } + + internal override SyntaxNode GetNodeSlot(int index) + { + return this.GetRedElement(ref _children[index].Value, index); + } + + internal override SyntaxNode GetCachedSlot(int index) + { + return _children[index]; + } + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxListBuilder.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxListBuilder.cs new file mode 100644 index 0000000000..415b8352bb --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxListBuilder.cs @@ -0,0 +1,172 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Diagnostics; + +namespace Microsoft.AspNetCore.Razor.Language.Syntax +{ + internal class SyntaxListBuilder + { + private ArrayElement[] _nodes; + + public int Count { get; private set; } + + public SyntaxListBuilder(int size) + { + _nodes = new ArrayElement[size]; + } + + public void Clear() + { + Count = 0; + } + + public void Add(SyntaxNode item) + { + AddInternal(item.Green); + } + + internal void AddInternal(GreenNode item) + { + if (item == null) + { + throw new ArgumentNullException(); + } + + if (_nodes == null || Count >= _nodes.Length) + { + Grow(Count == 0 ? 8 : _nodes.Length * 2); + } + + _nodes[Count++].Value = item; + } + + public void AddRange(SyntaxNode[] items) + { + AddRange(items, 0, items.Length); + } + + public void AddRange(SyntaxNode[] items, int offset, int length) + { + if (_nodes == null || Count + length > _nodes.Length) + { + Grow(Count + length); + } + + for (int i = offset, j = Count; i < offset + length; ++i, ++j) + { + _nodes[j].Value = items[i].Green; + } + + var start = Count; + Count += length; + Validate(start, Count); + } + + [Conditional("DEBUG")] + private void Validate(int start, int end) + { + for (var i = start; i < end; i++) + { + if (_nodes[i].Value == null) + { + throw new ArgumentException("Cannot add a null node."); + } + } + } + + public void AddRange(SyntaxList list) + { + AddRange(list, 0, list.Count); + } + + public void AddRange(SyntaxList list, int offset, int count) + { + if (_nodes == null || Count + count > _nodes.Length) + { + Grow(Count + count); + } + + var dst = Count; + for (int i = offset, limit = offset + count; i < limit; i++) + { + _nodes[dst].Value = list.ItemInternal(i).Green; + dst++; + } + + var start = Count; + Count += count; + Validate(start, Count); + } + + public void AddRange(SyntaxList list) where TNode : SyntaxNode + { + AddRange(list, 0, list.Count); + } + + public void AddRange(SyntaxList list, int offset, int count) where TNode : SyntaxNode + { + AddRange(new SyntaxList(list.Node), offset, count); + } + + private void Grow(int size) + { + var tmp = new ArrayElement[size]; + Array.Copy(_nodes, tmp, _nodes.Length); + _nodes = tmp; + } + + public bool Any(SyntaxKind kind) + { + for (var i = 0; i < Count; i++) + { + if (_nodes[i].Value.Kind == kind) + { + return true; + } + } + + return false; + } + + internal GreenNode ToListNode() + { + switch (Count) + { + case 0: + return null; + case 1: + return _nodes[0].Value; + case 2: + return InternalSyntax.SyntaxList.List(_nodes[0].Value, _nodes[1].Value); + case 3: + return InternalSyntax.SyntaxList.List(_nodes[0].Value, _nodes[1].Value, _nodes[2].Value); + default: + var tmp = new ArrayElement[Count]; + for (var i = 0; i < Count; i++) + { + tmp[i].Value = _nodes[i].Value; + } + + return InternalSyntax.SyntaxList.List(tmp); + } + } + + public static implicit operator SyntaxList(SyntaxListBuilder builder) + { + if (builder == null) + { + return default(SyntaxList); + } + + return builder.ToList(); + } + + internal void RemoveLast() + { + Count -= 1; + _nodes[Count] = default(ArrayElement); + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxListBuilderExtensions.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxListBuilderExtensions.cs new file mode 100644 index 0000000000..5b813c05b1 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxListBuilderExtensions.cs @@ -0,0 +1,29 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace Microsoft.AspNetCore.Razor.Language.Syntax +{ + internal static class SyntaxListBuilderExtensions + { + public static SyntaxList ToList(this SyntaxListBuilder builder) + { + if (builder == null || builder.Count == 0) + { + return default(SyntaxList); + } + + return new SyntaxList(builder.ToListNode().CreateRed()); + } + + public static SyntaxList ToList(this SyntaxListBuilder builder) + where TNode : SyntaxNode + { + if (builder == null || builder.Count == 0) + { + return new SyntaxList(); + } + + return new SyntaxList(builder.ToListNode().CreateRed()); + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxListBuilderOfT.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxListBuilderOfT.cs new file mode 100644 index 0000000000..8fcd9f2b3a --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxListBuilderOfT.cs @@ -0,0 +1,93 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace Microsoft.AspNetCore.Razor.Language.Syntax +{ + internal readonly struct SyntaxListBuilder + where TNode : SyntaxNode + { + private readonly SyntaxListBuilder _builder; + + public SyntaxListBuilder(int size) + : this(new SyntaxListBuilder(size)) + { + } + + public static SyntaxListBuilder Create() + { + return new SyntaxListBuilder(8); + } + + internal SyntaxListBuilder(SyntaxListBuilder builder) + { + _builder = builder; + } + + public bool IsNull + { + get + { + return _builder == null; + } + } + + public int Count + { + get + { + return _builder.Count; + } + } + + public void Clear() + { + _builder.Clear(); + } + + public SyntaxListBuilder Add(TNode node) + { + _builder.Add(node); + return this; + } + + public void AddRange(TNode[] items, int offset, int length) + { + _builder.AddRange(items, offset, length); + } + + public void AddRange(SyntaxList nodes) + { + _builder.AddRange(nodes); + } + + public void AddRange(SyntaxList nodes, int offset, int length) + { + _builder.AddRange(nodes, offset, length); + } + + public bool Any(SyntaxKind kind) + { + return _builder.Any(kind); + } + + public SyntaxList ToList() + { + return _builder.ToList(); + } + + public static implicit operator SyntaxListBuilder(SyntaxListBuilder builder) + { + return builder._builder; + } + + public static implicit operator SyntaxList(SyntaxListBuilder builder) + { + if (builder._builder != null) + { + return builder.ToList(); + } + + return default(SyntaxList); + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxListOfT.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxListOfT.cs new file mode 100644 index 0000000000..158e82859f --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxListOfT.cs @@ -0,0 +1,606 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Linq; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; + +namespace Microsoft.AspNetCore.Razor.Language.Syntax +{ + internal readonly struct SyntaxList : IReadOnlyList, IEquatable> + where TNode : SyntaxNode + { + public SyntaxList(SyntaxNode node) + { + Node = node; + } + + /// + /// Creates a singleton list of syntax nodes. + /// + /// The single element node. + public SyntaxList(TNode node) + : this((SyntaxNode)node) + { + } + + /// + /// Creates a list of syntax nodes. + /// + /// A sequence of element nodes. + public SyntaxList(IEnumerable nodes) + : this(CreateNode(nodes)) + { + } + + private static SyntaxNode CreateNode(IEnumerable nodes) + { + if (nodes == null) + { + return null; + } + + var builder = (nodes is ICollection collection) ? new SyntaxListBuilder(collection.Count) : SyntaxListBuilder.Create(); + + foreach (var node in nodes) + { + builder.Add(node); + } + + return builder.ToList().Node; + } + + internal SyntaxNode Node { get; } + + /// + /// The number of nodes in the list. + /// + public int Count + { + get + { + return Node == null ? 0 : (Node.IsList ? Node.SlotCount : 1); + } + } + + /// + /// Gets the node at the specified index. + /// + /// The zero-based index of the node to get or set. + /// The node at the specified index. + public TNode this[int index] + { + get + { + if (Node != null) + { + if (Node.IsList) + { + if (unchecked((uint)index < (uint)Node.SlotCount)) + { + return (TNode)Node.GetNodeSlot(index); + } + } + else if (index == 0) + { + return (TNode)Node; + } + } + throw new ArgumentOutOfRangeException(); + } + } + + internal SyntaxNode ItemInternal(int index) + { + if (Node.IsList) + { + return Node.GetNodeSlot(index); + } + + Debug.Assert(index == 0); + return Node; + } + + /// + /// The absolute span of the list elements in characters, including the leading and trailing trivia of the first and last elements. + /// + public TextSpan FullSpan + { + get + { + if (Count == 0) + { + return default(TextSpan); + } + else + { + return TextSpan.FromBounds(this[0].FullSpan.Start, this[Count - 1].FullSpan.End); + } + } + } + + /// + /// The absolute span of the list elements in characters, not including the leading and trailing trivia of the first and last elements. + /// + public TextSpan Span + { + get + { + if (Count == 0) + { + return default(TextSpan); + } + else + { + return TextSpan.FromBounds(this[0].Span.Start, this[Count - 1].Span.End); + } + } + } + + /// + /// Returns the string representation of the nodes in this list, not including + /// the first node's leading trivia and the last node's trailing trivia. + /// + /// + /// The string representation of the nodes in this list, not including + /// the first node's leading trivia and the last node's trailing trivia. + /// + public override string ToString() + { + return Node != null ? Node.ToString() : string.Empty; + } + + /// + /// Returns the full string representation of the nodes in this list including + /// the first node's leading trivia and the last node's trailing trivia. + /// + /// + /// The full string representation of the nodes in this list including + /// the first node's leading trivia and the last node's trailing trivia. + /// + public string ToFullString() + { + return Node != null ? Node.ToFullString() : string.Empty; + } + + /// + /// Creates a new list with the specified node added at the end. + /// + /// The node to add. + public SyntaxList Add(TNode node) + { + return Insert(Count, node); + } + + /// + /// Creates a new list with the specified nodes added at the end. + /// + /// The nodes to add. + public SyntaxList AddRange(IEnumerable nodes) + { + return InsertRange(Count, nodes); + } + + /// + /// Creates a new list with the specified node inserted at the index. + /// + /// The index to insert at. + /// The node to insert. + public SyntaxList Insert(int index, TNode node) + { + if (node == null) + { + throw new ArgumentNullException(nameof(node)); + } + + return InsertRange(index, new[] { node }); + } + + /// + /// Creates a new list with the specified nodes inserted at the index. + /// + /// The index to insert at. + /// The nodes to insert. + public SyntaxList InsertRange(int index, IEnumerable nodes) + { + if (index < 0 || index > Count) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + + if (nodes == null) + { + throw new ArgumentNullException(nameof(nodes)); + } + + var list = this.ToList(); + list.InsertRange(index, nodes); + + if (list.Count == 0) + { + return this; + } + else + { + return CreateList(list[0].Green, list); + } + } + + /// + /// Creates a new list with the element at specified index removed. + /// + /// The index of the element to remove. + public SyntaxList RemoveAt(int index) + { + if (index < 0 || index > Count) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + + return Remove(this[index]); + } + + /// + /// Creates a new list with the element removed. + /// + /// The element to remove. + public SyntaxList Remove(TNode node) + { + return CreateList(this.Where(x => x != node).ToList()); + } + + /// + /// Creates a new list with the specified element replaced with the new node. + /// + /// The element to replace. + /// The new node. + public SyntaxList Replace(TNode nodeInList, TNode newNode) + { + return ReplaceRange(nodeInList, new[] { newNode }); + } + + /// + /// Creates a new list with the specified element replaced with new nodes. + /// + /// The element to replace. + /// The new nodes. + public SyntaxList ReplaceRange(TNode nodeInList, IEnumerable newNodes) + { + if (nodeInList == null) + { + throw new ArgumentNullException(nameof(nodeInList)); + } + + if (newNodes == null) + { + throw new ArgumentNullException(nameof(newNodes)); + } + + var index = IndexOf(nodeInList); + if (index >= 0 && index < Count) + { + var list = this.ToList(); + list.RemoveAt(index); + list.InsertRange(index, newNodes); + return CreateList(list); + } + else + { + throw new ArgumentException(nameof(nodeInList)); + } + } + + static SyntaxList CreateList(List items) + { + if (items.Count == 0) + { + return default(SyntaxList); + } + else + { + return CreateList(items[0].Green, items); + } + } + + static SyntaxList CreateList(GreenNode creator, List items) + { + if (items.Count == 0) + { + return default(SyntaxList); + } + + var newGreen = creator.CreateList(items.Select(n => n.Green)); + return new SyntaxList(newGreen.CreateRed()); + } + + /// + /// The first node in the list. + /// + public TNode First() + { + return this[0]; + } + + /// + /// The first node in the list or default if the list is empty. + /// + public TNode FirstOrDefault() + { + if (this.Any()) + { + return this[0]; + } + else + { + return null; + } + } + + /// + /// The last node in the list. + /// + public TNode Last() + { + return this[Count - 1]; + } + + /// + /// The last node in the list or default if the list is empty. + /// + public TNode LastOrDefault() + { + if (Any()) + { + return this[Count - 1]; + } + else + { + return null; + } + } + + /// + /// True if the list has at least one node. + /// + public bool Any() + { + Debug.Assert(Node == null || Count != 0); + return Node != null; + } + + // for debugging + private TNode[] Nodes + { + get { return this.ToArray(); } + } + + /// + /// Get's the enumerator for this list. + /// + public Enumerator GetEnumerator() + { + return new Enumerator(in this); + } + + IEnumerator IEnumerable.GetEnumerator() + { + if (this.Any()) + { + return new EnumeratorImpl(this); + } + + return SpecializedCollections.EmptyEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + if (this.Any()) + { + return new EnumeratorImpl(this); + } + + return SpecializedCollections.EmptyEnumerator(); + } + + public static bool operator ==(SyntaxList left, SyntaxList right) + { + return left.Node == right.Node; + } + + public static bool operator !=(SyntaxList left, SyntaxList right) + { + return left.Node != right.Node; + } + + public bool Equals(SyntaxList other) + { + return Node == other.Node; + } + + public override bool Equals(object obj) + { + return obj is SyntaxList && Equals((SyntaxList)obj); + } + + public override int GetHashCode() + { + return Node?.GetHashCode() ?? 0; + } + + public static implicit operator SyntaxList(SyntaxList nodes) + { + return new SyntaxList(nodes.Node); + } + + public static implicit operator SyntaxList(SyntaxList nodes) + { + return new SyntaxList(nodes.Node); + } + + /// + /// The index of the node in this list, or -1 if the node is not in the list. + /// + public int IndexOf(TNode node) + { + var index = 0; + foreach (var child in this) + { + if (object.Equals(child, node)) + { + return index; + } + + index++; + } + + return -1; + } + + public int IndexOf(Func predicate) + { + var index = 0; + foreach (var child in this) + { + if (predicate(child)) + { + return index; + } + + index++; + } + + return -1; + } + + internal int IndexOf(SyntaxKind kind) + { + var index = 0; + foreach (var child in this) + { + if (child.Kind == kind) + { + return index; + } + + index++; + } + + return -1; + } + + public int LastIndexOf(TNode node) + { + for (var i = Count - 1; i >= 0; i--) + { + if (object.Equals(this[i], node)) + { + return i; + } + } + + return -1; + } + + public int LastIndexOf(Func predicate) + { + for (var i = Count - 1; i >= 0; i--) + { + if (predicate(this[i])) + { + return i; + } + } + + return -1; + } + + public struct Enumerator + { + private readonly SyntaxList _list; + private int _index; + + internal Enumerator(in SyntaxList list) + { + _list = list; + _index = -1; + } + + public bool MoveNext() + { + var newIndex = _index + 1; + if (newIndex < _list.Count) + { + _index = newIndex; + return true; + } + + return false; + } + + public TNode Current + { + get + { + return (TNode)_list.ItemInternal(_index); + } + } + + public void Reset() + { + _index = -1; + } + + public override bool Equals(object obj) + { + throw new NotSupportedException(); + } + + public override int GetHashCode() + { + throw new NotSupportedException(); + } + } + + private class EnumeratorImpl : IEnumerator + { + private Enumerator _e; + + internal EnumeratorImpl(in SyntaxList list) + { + _e = new Enumerator(in list); + } + + public bool MoveNext() + { + return _e.MoveNext(); + } + + public TNode Current + { + get + { + return _e.Current; + } + } + + void IDisposable.Dispose() + { + } + + object IEnumerator.Current + { + get + { + return _e.Current; + } + } + + void IEnumerator.Reset() + { + _e.Reset(); + } + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxNode.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxNode.cs new file mode 100644 index 0000000000..1c63ed9663 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxNode.cs @@ -0,0 +1,305 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Diagnostics; +using System.Threading; + +namespace Microsoft.AspNetCore.Razor.Language.Syntax +{ + internal abstract class SyntaxNode + { + public SyntaxNode(GreenNode green, SyntaxNode parent, int position) + { + Green = green; + Parent = parent; + Position = position; + } + + internal GreenNode Green { get; } + + public SyntaxNode Parent { get; } + + public int Position { get; } + + public int EndPosition => Position + FullWidth; + + public SyntaxKind Kind => Green.Kind; + + public int Width => Green.Width; + + public int FullWidth => Green.FullWidth; + + public int SpanStart => Position + Green.GetLeadingTriviaWidth(); + + public TextSpan FullSpan => new TextSpan(Position, Green.FullWidth); + + public TextSpan Span + { + get + { + // Start with the full span. + var start = Position; + var width = Green.FullWidth; + + // adjust for preceding trivia (avoid calling this twice, do not call Green.Width) + var precedingWidth = Green.GetLeadingTriviaWidth(); + start += precedingWidth; + width -= precedingWidth; + + // adjust for following trivia width + width -= Green.GetTrailingTriviaWidth(); + + Debug.Assert(width >= 0); + return new TextSpan(start, width); + } + } + + internal int SlotCount => Green.SlotCount; + + public bool IsList => Green.IsList; + + public bool IsMissing => Green.IsMissing; + + public bool HasLeadingTrivia + { + get + { + return GetLeadingTrivia().Count > 0; + } + } + + public bool HasTrailingTrivia + { + get + { + return GetTrailingTrivia().Count > 0; + } + } + + public bool ContainsDiagnostics => Green.ContainsDiagnostics; + + public bool ContainsAnnotations => Green.ContainsAnnotations; + + public abstract TResult Accept(SyntaxVisitor visitor); + + public abstract void Accept(SyntaxVisitor visitor); + + internal abstract SyntaxNode GetNodeSlot(int index); + + internal abstract SyntaxNode GetCachedSlot(int index); + + internal SyntaxNode GetRed(ref SyntaxNode field, int slot) + { + var result = field; + + if (result == null) + { + var green = Green.GetSlot(slot); + if (green != null) + { + Interlocked.CompareExchange(ref field, green.CreateRed(this, GetChildPosition(slot)), null); + result = field; + } + } + + return result; + } + + // Special case of above function where slot = 0, does not need GetChildPosition + internal SyntaxNode GetRedAtZero(ref SyntaxNode field) + { + var result = field; + + if (result == null) + { + var green = Green.GetSlot(0); + if (green != null) + { + Interlocked.CompareExchange(ref field, green.CreateRed(this, Position), null); + result = field; + } + } + + return result; + } + + protected T GetRed(ref T field, int slot) where T : SyntaxNode + { + var result = field; + + if (result == null) + { + var green = Green.GetSlot(slot); + if (green != null) + { + Interlocked.CompareExchange(ref field, (T)green.CreateRed(this, this.GetChildPosition(slot)), null); + result = field; + } + } + + return result; + } + + // special case of above function where slot = 0, does not need GetChildPosition + protected T GetRedAtZero(ref T field) where T : SyntaxNode + { + var result = field; + + if (result == null) + { + var green = Green.GetSlot(0); + if (green != null) + { + Interlocked.CompareExchange(ref field, (T)green.CreateRed(this, Position), null); + result = field; + } + } + + return result; + } + + internal SyntaxNode GetRedElement(ref SyntaxNode element, int slot) + { + Debug.Assert(IsList); + + var result = element; + + if (result == null) + { + var green = Green.GetSlot(slot); + // passing list's parent + Interlocked.CompareExchange(ref element, green.CreateRed(Parent, GetChildPosition(slot)), null); + result = element; + } + + return result; + } + + internal virtual int GetChildPosition(int index) + { + var offset = 0; + var green = Green; + while (index > 0) + { + index--; + var prevSibling = GetCachedSlot(index); + if (prevSibling != null) + { + return prevSibling.EndPosition + offset; + } + var greenChild = green.GetSlot(index); + if (greenChild != null) + { + offset += greenChild.FullWidth; + } + } + + return Position + offset; + } + + public virtual SyntaxTriviaList GetLeadingTrivia() + { + var firstToken = GetFirstToken(); + return firstToken != null ? firstToken.GetLeadingTrivia() : default(SyntaxTriviaList); + } + + public virtual SyntaxTriviaList GetTrailingTrivia() + { + var lastToken = GetLastToken(); + return lastToken != null ? lastToken.GetTrailingTrivia() : default(SyntaxTriviaList); + } + + internal SyntaxToken GetFirstToken() + { + return ((SyntaxToken)GetFirstTerminal()); + } + + internal SyntaxToken GetLastToken() + { + return ((SyntaxToken)GetLastTerminal()); + } + + public SyntaxNode GetFirstTerminal() + { + var node = this; + + do + { + var foundChild = false; + for (int i = 0, n = node.SlotCount; i < n; i++) + { + var child = node.GetNodeSlot(i); + if (child != null) + { + node = child; + foundChild = true; + break; + } + } + + if (!foundChild) + { + return null; + } + } + while (node.SlotCount != 0); + + return node == this ? this : node; + } + + public SyntaxNode GetLastTerminal() + { + var node = this; + + do + { + for (var i = node.SlotCount - 1; i >= 0; i--) + { + var child = node.GetNodeSlot(i); + if (child != null) + { + node = child; + break; + } + } + } while (node.SlotCount != 0); + + return node == this ? this : node; + } + + public RazorDiagnostic[] GetDiagnostics() + { + return Green.GetDiagnostics(); + } + + public SyntaxAnnotation[] GetAnnotations() + { + return Green.GetAnnotations(); + } + + public bool IsEquivalentTo(SyntaxNode other) + { + if (this == other) + { + return true; + } + + if (other == null) + { + return false; + } + + return Green.IsEquivalentTo(other.Green); + } + + public override string ToString() + { + return Green.ToString(); + } + + public virtual string ToFullString() + { + return Green.ToFullString(); + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxNodeExtensions.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxNodeExtensions.cs new file mode 100644 index 0000000000..21ae1260ef --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxNodeExtensions.cs @@ -0,0 +1,13 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace Microsoft.AspNetCore.Razor.Language.Syntax +{ + internal static class SyntaxNodeExtensions + { + public static TNode WithAnnotations(this TNode node, params SyntaxAnnotation[] annotations) where TNode : SyntaxNode + { + return (TNode)node.Green.SetAnnotations(annotations).CreateRed(); + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxToken.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxToken.cs new file mode 100644 index 0000000000..b87562f8f2 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxToken.cs @@ -0,0 +1,143 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using Microsoft.AspNetCore.Razor.Language.Legacy; + +namespace Microsoft.AspNetCore.Razor.Language.Syntax +{ + internal class SyntaxToken : SyntaxNode + { + internal SyntaxToken(GreenNode green, SyntaxNode parent, int position) + : this(green, parent, null, position) + { + } + + // Temporary plumbing + internal SyntaxToken(GreenNode green, SyntaxNode parent, Span parentSpan, int position) + : base(green, parent, position) + { + Debug.Assert(parent == null || !parent.Green.IsList, "list cannot be a parent"); + Debug.Assert(green == null || green.IsToken, "green must be a token"); + + ParentSpan = parentSpan; + } + + // Temporary plumbing + internal Span ParentSpan { get; } + + // Temporary plumbing + internal SourceLocation Start + { + get + { + if (ParentSpan == null) + { + return SourceLocation.Undefined; + } + + var tracker = new SourceLocationTracker(ParentSpan.Start); + for (var i = 0; i < ParentSpan.Tokens.Count; i++) + { + var token = ParentSpan.Tokens[i]; + if (object.ReferenceEquals(this, token)) + { + break; + } + + tracker.UpdateLocation(token.Content); + } + + return tracker.CurrentLocation; + } + } + + internal new InternalSyntax.SyntaxToken Green => (InternalSyntax.SyntaxToken)base.Green; + + public string Content => Green.Content; + + internal override sealed SyntaxNode GetCachedSlot(int index) + { + throw new InvalidOperationException("Tokens can't have slots."); + } + + internal override sealed SyntaxNode GetNodeSlot(int slot) + { + throw new InvalidOperationException("Tokens can't have slots."); + } + + public override TResult Accept(SyntaxVisitor visitor) + { + return visitor.VisitToken(this); + } + + public override void Accept(SyntaxVisitor visitor) + { + visitor.VisitToken(this); + } + + public SyntaxToken WithLeadingTrivia(SyntaxNode trivia) + { + return Green != null + ? new SyntaxToken(Green.WithLeadingTrivia(trivia.Green), parent: null, position: 0) + : default(SyntaxToken); + } + + public SyntaxToken WithTrailingTrivia(SyntaxNode trivia) + { + return Green != null + ? new SyntaxToken(Green.WithTrailingTrivia(trivia.Green), parent: null, position: 0) + : default(SyntaxToken); + } + + public SyntaxToken WithLeadingTrivia(IEnumerable trivia) + { + var greenList = trivia?.Select(t => t.Green); + return WithLeadingTrivia(Green.CreateList(greenList)?.CreateRed()); + } + + public SyntaxToken WithTrailingTrivia(IEnumerable trivia) + { + var greenList = trivia?.Select(t => t.Green); + return WithTrailingTrivia(Green.CreateList(greenList)?.CreateRed()); + } + + public override SyntaxTriviaList GetLeadingTrivia() + { + if (Green.LeadingTrivia == null) + { + return default(SyntaxTriviaList); + } + + return new SyntaxTriviaList(Green.LeadingTrivia.CreateRed(this, Position), Position); + } + + public override SyntaxTriviaList GetTrailingTrivia() + { + var trailingGreen = Green.TrailingTrivia; + if (trailingGreen == null) + { + return default(SyntaxTriviaList); + } + + var leading = Green.LeadingTrivia; + int index = 0; + if (leading != null) + { + index = leading.IsList ? leading.SlotCount : 1; + } + int trailingPosition = Position + FullWidth; + trailingPosition -= trailingGreen.FullWidth; + + return new SyntaxTriviaList(trailingGreen.CreateRed(this, trailingPosition), trailingPosition, index); + } + + public override string ToString() + { + return Content; + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxTrivia.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxTrivia.cs new file mode 100644 index 0000000000..d16e42f1ed --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxTrivia.cs @@ -0,0 +1,59 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; + +namespace Microsoft.AspNetCore.Razor.Language.Syntax +{ + internal class SyntaxTrivia : SyntaxNode + { + internal SyntaxTrivia(GreenNode green, SyntaxNode parent, int position) + : base(green, parent, position) + { + } + + internal new InternalSyntax.SyntaxTrivia Green => (InternalSyntax.SyntaxTrivia)base.Green; + + public string Text => Green.Text; + + internal override sealed SyntaxNode GetCachedSlot(int index) + { + throw new InvalidOperationException(); + } + + internal override sealed SyntaxNode GetNodeSlot(int slot) + { + throw new InvalidOperationException(); + } + + public override TResult Accept(SyntaxVisitor visitor) + { + return visitor.VisitTrivia(this); + } + + public override void Accept(SyntaxVisitor visitor) + { + visitor.VisitTrivia(this); + } + + public sealed override SyntaxTriviaList GetTrailingTrivia() + { + return default(SyntaxTriviaList); + } + + public sealed override SyntaxTriviaList GetLeadingTrivia() + { + return default(SyntaxTriviaList); + } + + public override string ToString() + { + return Text; + } + + public sealed override string ToFullString() + { + return Text; + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxTriviaList.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxTriviaList.cs new file mode 100644 index 0000000000..2097e9391c --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxTriviaList.cs @@ -0,0 +1,785 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Runtime.InteropServices; +using Microsoft.Extensions.Internal; + +namespace Microsoft.AspNetCore.Razor.Language.Syntax +{ + [StructLayout(LayoutKind.Auto)] + internal readonly struct SyntaxTriviaList : IEquatable, IReadOnlyList + { + public static SyntaxTriviaList Empty => default(SyntaxTriviaList); + + internal SyntaxTriviaList(SyntaxNode node, int position, int index = 0) + { + Node = node; + Position = position; + Index = index; + } + + internal SyntaxTriviaList(SyntaxNode node) + { + Node = node; + Position = node.Position; + Index = 0; + } + + public SyntaxTriviaList(SyntaxTrivia trivia) + { + Node = trivia; + Position = 0; + Index = 0; + } + + /// + /// Creates a list of trivia. + /// + /// An array of trivia. + public SyntaxTriviaList(params SyntaxTrivia[] trivias) + : this(CreateNode(trivias), 0, 0) + { + } + + /// + /// Creates a list of trivia. + /// + /// A sequence of trivia. + public SyntaxTriviaList(IEnumerable trivias) + : this(SyntaxTriviaListBuilder.Create(trivias).Node, 0, 0) + { + } + + private static SyntaxNode CreateNode(SyntaxTrivia[] trivias) + { + if (trivias == null) + { + return null; + } + + var builder = new SyntaxTriviaListBuilder(trivias.Length); + builder.Add(trivias); + return builder.ToList().Node; + } + + internal SyntaxNode Node { get; } + + internal int Position { get; } + + internal int Index { get; } + + public int Count + { + get { return Node == null ? 0 : (Node.IsList ? Node.SlotCount : 1); } + } + + public SyntaxTrivia ElementAt(int index) + { + return this[index]; + } + + /// + /// Gets the trivia at the specified index. + /// + /// The zero-based index of the trivia to get. + /// The token at the specified index. + /// + /// is less than 0.-or- is equal to or greater than . + public SyntaxTrivia this[int index] + { + get + { + if (Node != null) + { + if (Node.IsList) + { + if (unchecked((uint)index < (uint)Node.SlotCount)) + { + return Node.GetNodeSlot(index) as SyntaxTrivia; + } + } + else if (index == 0) + { + return Node as SyntaxTrivia; + } + } + + throw new ArgumentOutOfRangeException(nameof(index)); + } + } + + /// + /// The absolute span of the list elements in characters, including the leading and trailing trivia of the first and last elements. + /// + public TextSpan FullSpan + { + get + { + if (Node == null) + { + return default(TextSpan); + } + + return new TextSpan(Position, Node.FullWidth); + } + } + + /// + /// The absolute span of the list elements in characters, not including the leading and trailing trivia of the first and last elements. + /// + public TextSpan Span + { + get + { + if (Node == null) + { + return default(TextSpan); + } + + return TextSpan.FromBounds(Position + Node.Green.GetLeadingTriviaWidth(), + Position + Node.FullWidth - Node.Green.GetTrailingTriviaWidth()); + } + } + + /// + /// Returns the first trivia in the list. + /// + /// The first trivia in the list. + /// The list is empty. + public SyntaxTrivia First() + { + if (Any()) + { + return this[0]; + } + + throw new InvalidOperationException(); + } + + /// + /// Returns the last trivia in the list. + /// + /// The last trivia in the list. + /// The list is empty. + public SyntaxTrivia Last() + { + if (Any()) + { + return this[Count - 1]; + } + + throw new InvalidOperationException(); + } + + /// + /// Does this list have any items. + /// + public bool Any() + { + return Node != null; + } + + /// + /// Returns a list which contains all elements of in reversed order. + /// + /// which contains all elements of in reversed order + public Reversed Reverse() + { + return new Reversed(this); + } + + public Enumerator GetEnumerator() + { + return new Enumerator(this); + } + + public int IndexOf(SyntaxTrivia triviaInList) + { + for (int i = 0, n = Count; i < n; i++) + { + var trivia = this[i]; + if (trivia == triviaInList) + { + return i; + } + } + + return -1; + } + + internal int IndexOf(SyntaxKind kind) + { + for (int i = 0, n = Count; i < n; i++) + { + if (this[i].Kind == kind) + { + return i; + } + } + + return -1; + } + + /// + /// Creates a new with the specified trivia added to the end. + /// + /// The trivia to add. + public SyntaxTriviaList Add(SyntaxTrivia trivia) + { + return Insert(Count, trivia); + } + + /// + /// Creates a new with the specified trivia added to the end. + /// + /// The trivia to add. + public SyntaxTriviaList AddRange(IEnumerable trivia) + { + return InsertRange(Count, trivia); + } + + /// + /// Creates a new with the specified trivia inserted at the index. + /// + /// The index in the list to insert the trivia at. + /// The trivia to insert. + public SyntaxTriviaList Insert(int index, SyntaxTrivia trivia) + { + if (trivia == default(SyntaxTrivia)) + { + throw new ArgumentOutOfRangeException(nameof(trivia)); + } + + return InsertRange(index, new[] { trivia }); + } + + private static readonly ObjectPool s_builderPool = + new ObjectPool(() => SyntaxTriviaListBuilder.Create()); + + private static SyntaxTriviaListBuilder GetBuilder() + => s_builderPool.Allocate(); + + private static void ClearAndFreeBuilder(SyntaxTriviaListBuilder builder) + { + // It's possible someone might create a list with a huge amount of trivia + // in it. We don't want to hold onto such items forever. So only cache + // reasonably sized lists. In IDE testing, around 99% of all trivia lists + // were 16 or less elements. + const int MaxBuilderCount = 16; + if (builder.Count <= MaxBuilderCount) + { + builder.Clear(); + s_builderPool.Free(builder); + } + } + + /// + /// Creates a new with the specified trivia inserted at the index. + /// + /// The index in the list to insert the trivia at. + /// The trivia to insert. + public SyntaxTriviaList InsertRange(int index, IEnumerable trivia) + { + var thisCount = Count; + if (index < 0 || index > thisCount) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + + if (trivia == null) + { + throw new ArgumentNullException(nameof(trivia)); + } + + // Just return ourselves if we're not being asked to add anything. + if (trivia is ICollection triviaCollection && triviaCollection.Count == 0) + { + return this; + } + + var builder = GetBuilder(); + try + { + for (var i = 0; i < index; i++) + { + builder.Add(this[i]); + } + + builder.AddRange(trivia); + + for (var i = index; i < thisCount; i++) + { + builder.Add(this[i]); + } + + return builder.Count == thisCount ? this : builder.ToList(); + } + finally + { + ClearAndFreeBuilder(builder); + } + } + + /// + /// Creates a new with the element at the specified index removed. + /// + /// The index identifying the element to remove. + public SyntaxTriviaList RemoveAt(int index) + { + if (index < 0 || index >= Count) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + + var list = this.ToList(); + list.RemoveAt(index); + return new SyntaxTriviaList(list); + } + + /// + /// Creates a new with the specified element removed. + /// + /// The trivia element to remove. + public SyntaxTriviaList Remove(SyntaxTrivia triviaInList) + { + var index = IndexOf(triviaInList); + if (index >= 0 && index < Count) + { + return RemoveAt(index); + } + + return this; + } + + /// + /// Creates a new with the specified element replaced with new trivia. + /// + /// The trivia element to replace. + /// The trivia to replace the element with. + public SyntaxTriviaList Replace(SyntaxTrivia triviaInList, SyntaxTrivia newTrivia) + { + if (newTrivia == default(SyntaxTrivia)) + { + throw new ArgumentOutOfRangeException(nameof(newTrivia)); + } + + return ReplaceRange(triviaInList, new[] { newTrivia }); + } + + /// + /// Creates a new with the specified element replaced with new trivia. + /// + /// The trivia element to replace. + /// The trivia to replace the element with. + public SyntaxTriviaList ReplaceRange(SyntaxTrivia triviaInList, IEnumerable newTrivia) + { + var index = IndexOf(triviaInList); + if (index >= 0 && index < Count) + { + var list = this.ToList(); + list.RemoveAt(index); + list.InsertRange(index, newTrivia); + return new SyntaxTriviaList(list); + } + + throw new ArgumentOutOfRangeException(nameof(triviaInList)); + } + + // for debugging + private SyntaxTrivia[] Nodes => this.ToArray(); + + IEnumerator IEnumerable.GetEnumerator() + { + if (Node == null) + { + return SpecializedCollections.EmptyEnumerator(); + } + + return new EnumeratorImpl(this); + } + + IEnumerator IEnumerable.GetEnumerator() + { + if (Node == null) + { + return SpecializedCollections.EmptyEnumerator(); + } + + return new EnumeratorImpl(this); + } + + /// + /// get the green node at the specific slot + /// + private SyntaxNode GetNodeAt(int i) + { + return GetNodeAt(Node, i); + } + + private static SyntaxNode GetNodeAt(SyntaxNode node, int i) + { + Debug.Assert(node.IsList || (i == 0 && !node.IsList)); + return node.IsList ? node.GetNodeSlot(i) : node; + } + + public bool Equals(SyntaxTriviaList other) + { + return Node == other.Node && Index == other.Index; + } + + public static bool operator ==(SyntaxTriviaList left, SyntaxTriviaList right) + { + return left.Equals(right); + } + + public static bool operator !=(SyntaxTriviaList left, SyntaxTriviaList right) + { + return !left.Equals(right); + } + + public override bool Equals(object obj) + { + return (obj is SyntaxTriviaList) && Equals((SyntaxTriviaList)obj); + } + + public override int GetHashCode() + { + var hash = HashCodeCombiner.Start(); + hash.Add(Node); + hash.Add(Index); + return hash.CombinedHash; + } + + /// + /// Copy number of items starting at from this list into starting at . + /// + internal void CopyTo(int offset, SyntaxTrivia[] array, int arrayOffset, int count) + { + if (offset < 0 || count < 0 || Count < offset + count) + { + throw new IndexOutOfRangeException(); + } + + if (count == 0) + { + return; + } + + // get first one without creating any red node + var first = this[offset]; + array[arrayOffset] = first; + + // calculate trivia position from the first ourselves from now on + var position = first.Position; + var current = first; + + for (var i = 1; i < count; i++) + { + position += current.FullWidth; + current = GetNodeAt(offset + i) as SyntaxTrivia; + + array[arrayOffset + i] = current; + } + } + + public override string ToString() + { + return Node != null ? Node.ToString() : string.Empty; + } + + public string ToFullString() + { + return Node != null ? Node.ToFullString() : string.Empty; + } + + public static SyntaxTriviaList Create(SyntaxTrivia trivia) + { + return new SyntaxTriviaList(trivia); + } + + /// + /// Reversed enumerable. + /// + public struct Reversed : IEnumerable, IEquatable + { + private SyntaxTriviaList _list; + + public Reversed(in SyntaxTriviaList list) + { + _list = list; + } + + public Enumerator GetEnumerator() + { + return new Enumerator(in _list); + } + + IEnumerator IEnumerable.GetEnumerator() + { + if (_list.Count == 0) + { + return SpecializedCollections.EmptyEnumerator(); + } + + return new ReversedEnumeratorImpl(in _list); + } + + IEnumerator + IEnumerable.GetEnumerator() + { + if (_list.Count == 0) + { + return SpecializedCollections.EmptyEnumerator(); + } + + return new ReversedEnumeratorImpl(in _list); + } + + public override int GetHashCode() + { + return _list.GetHashCode(); + } + + public override bool Equals(object obj) + { + return obj is Reversed && Equals((Reversed)obj); + } + + public bool Equals(Reversed other) + { + return _list.Equals(other._list); + } + + [StructLayout(LayoutKind.Auto)] + public struct Enumerator + { + private readonly SyntaxNode _singleNodeOrList; + private readonly int _baseIndex; + private readonly int _count; + + private int _index; + private SyntaxNode _current; + private int _position; + + public Enumerator(in SyntaxTriviaList list) + : this() + { + if (list.Any()) + { + _singleNodeOrList = list.Node; + _baseIndex = list.Index; + _count = list.Count; + + _index = _count; + _current = null; + + var last = list.Last(); + _position = last.Position + last.FullWidth; + } + } + + public bool MoveNext() + { + if (_count == 0 || _index <= 0) + { + _current = null; + return false; + } + + _index--; + + _current = GetNodeAt(_singleNodeOrList, _index); + _position -= _current.FullWidth; + + return true; + } + + public SyntaxTrivia Current + { + get + { + if (_current == null) + { + throw new InvalidOperationException(); + } + + return (SyntaxTrivia)_current; + } + } + } + + private class ReversedEnumeratorImpl : IEnumerator + { + private Enumerator _enumerator; + + // SyntaxTriviaList is a relatively big struct so is passed as ref + internal ReversedEnumeratorImpl(in SyntaxTriviaList list) + { + _enumerator = new Enumerator(in list); + } + + public SyntaxTrivia Current => _enumerator.Current; + + object IEnumerator.Current => _enumerator.Current; + + public bool MoveNext() + { + return _enumerator.MoveNext(); + } + + public void Reset() + { + throw new NotSupportedException(); + } + + public void Dispose() + { + } + } + } + + [StructLayout(LayoutKind.Auto)] + public struct Enumerator + { + private SyntaxNode _singleNodeOrList; + private int _baseIndex; + private int _count; + + private int _index; + private SyntaxNode _current; + private int _position; + + internal Enumerator(in SyntaxTriviaList list) + { + _singleNodeOrList = list.Node; + _baseIndex = list.Index; + _count = list.Count; + + _index = -1; + _current = null; + _position = list.Position; + } + + private void InitializeFrom(SyntaxNode node, int index, int position) + { + _singleNodeOrList = node; + _baseIndex = index; + _count = node.IsList ? node.SlotCount : 1; + + _index = -1; + _current = null; + _position = position; + } + + // PERF: Used to initialize an enumerator for leading trivia directly from a token. + // This saves constructing an intermediate SyntaxTriviaList. Also, passing token + // by ref since it's a non-trivial struct + internal void InitializeFromLeadingTrivia(in SyntaxToken token) + { + InitializeFrom(token.GetLeadingTrivia().Node, 0, token.Position); + } + + // PERF: Used to initialize an enumerator for trailing trivia directly from a token. + // This saves constructing an intermediate SyntaxTriviaList. Also, passing token + // by ref since it's a non-trivial struct + internal void InitializeFromTrailingTrivia(in SyntaxToken token) + { + var leading = token.GetLeadingTrivia().Node; + var index = 0; + if (leading != null) + { + index = leading.IsList ? leading.SlotCount : 1; + } + + var trailing = token.GetTrailingTrivia().Node; + var trailingPosition = token.Position + token.FullWidth; + if (trailing != null) + { + trailingPosition -= trailing.FullWidth; + } + + InitializeFrom(trailing, index, trailingPosition); + } + + public bool MoveNext() + { + var newIndex = _index + 1; + if (newIndex >= _count) + { + // invalidate iterator + _current = null; + return false; + } + + _index = newIndex; + + if (_current != null) + { + _position += _current.FullWidth; + } + + _current = GetNodeAt(_singleNodeOrList, newIndex); + return true; + } + + public SyntaxTrivia Current + { + get + { + if (_current == null) + { + throw new InvalidOperationException(); + } + + return _current as SyntaxTrivia; + } + } + + internal bool TryMoveNextAndGetCurrent(out SyntaxTrivia current) + { + if (!MoveNext()) + { + current = default; + return false; + } + + current = _current as SyntaxTrivia; + return true; + } + } + + private class EnumeratorImpl : IEnumerator + { + private Enumerator _enumerator; + + // SyntaxTriviaList is a relatively big struct so is passed as ref + internal EnumeratorImpl(in SyntaxTriviaList list) + { + _enumerator = new Enumerator(list); + } + + public SyntaxTrivia Current => _enumerator.Current; + + object IEnumerator.Current => _enumerator.Current; + + public bool MoveNext() + { + return _enumerator.MoveNext(); + } + + public void Reset() + { + throw new NotSupportedException(); + } + + public void Dispose() + { + } + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxTriviaListBuilder.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxTriviaListBuilder.cs new file mode 100644 index 0000000000..aa0a8caaec --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxTriviaListBuilder.cs @@ -0,0 +1,138 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; + +namespace Microsoft.AspNetCore.Razor.Language.Syntax +{ + internal class SyntaxTriviaListBuilder + { + private SyntaxTrivia[] _nodes; + + public SyntaxTriviaListBuilder(int size) + { + _nodes = new SyntaxTrivia[size]; + } + + public static SyntaxTriviaListBuilder Create() + { + return new SyntaxTriviaListBuilder(4); + } + + public static SyntaxTriviaList Create(IEnumerable trivia) + { + if (trivia == null) + { + return new SyntaxTriviaList(); + } + + var builder = Create(); + builder.AddRange(trivia); + return builder.ToList(); + } + + public int Count { get; private set; } + + public void Clear() + { + Count = 0; + } + + public SyntaxTrivia this[int index] + { + get + { + if (index < 0 || index > Count) + { + throw new IndexOutOfRangeException(); + } + + return _nodes[index]; + } + } + + public void AddRange(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Add(item); + } + } + } + + public SyntaxTriviaListBuilder Add(SyntaxTrivia item) + { + if (_nodes == null || Count >= _nodes.Length) + { + Grow(Count == 0 ? 8 : _nodes.Length * 2); + } + + _nodes[Count++] = item; + return this; + } + + public void Add(SyntaxTrivia[] items) + { + Add(items, 0, items.Length); + } + + public void Add(SyntaxTrivia[] items, int offset, int length) + { + if (_nodes == null || Count + length > _nodes.Length) + { + Grow(Count + length); + } + + Array.Copy(items, offset, _nodes, Count, length); + Count += length; + } + + public void Add(in SyntaxTriviaList list) + { + Add(list, 0, list.Count); + } + + public void Add(in SyntaxTriviaList list, int offset, int length) + { + if (_nodes == null || Count + length > _nodes.Length) + { + Grow(Count + length); + } + + list.CopyTo(offset, _nodes, Count, length); + Count += length; + } + + private void Grow(int size) + { + var tmp = new SyntaxTrivia[size]; + Array.Copy(_nodes, tmp, _nodes.Length); + _nodes = tmp; + } + + public static implicit operator SyntaxTriviaList(SyntaxTriviaListBuilder builder) + { + return builder.ToList(); + } + + public SyntaxTriviaList ToList() + { + if (Count > 0) + { + var tmp = new ArrayElement[Count]; + for (var i = 0; i < Count; i++) + { + tmp[i].Value = _nodes[i].Green; + } + return new SyntaxTriviaList(InternalSyntax.SyntaxList.List(tmp).CreateRed(), position: 0, index: 0); + } + else + { + return default(SyntaxTriviaList); + } + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxVisitor.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxVisitor.cs new file mode 100644 index 0000000000..98e1c8f245 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/SyntaxVisitor.cs @@ -0,0 +1,58 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace Microsoft.AspNetCore.Razor.Language.Syntax +{ + internal abstract partial class SyntaxVisitor + { + public virtual TResult Visit(SyntaxNode node) + { + if (node != null) + { + return node.Accept(this); + } + + return default(TResult); + } + + public virtual TResult VisitToken(SyntaxToken token) + { + return DefaultVisit(token); + } + + public virtual TResult VisitTrivia(SyntaxTrivia trivia) + { + return DefaultVisit(trivia); + } + + protected virtual TResult DefaultVisit(SyntaxNode node) + { + return default(TResult); + } + } + + internal abstract partial class SyntaxVisitor + { + public virtual void Visit(SyntaxNode node) + { + if (node != null) + { + node.Accept(this); + } + } + + public virtual void VisitToken(SyntaxToken token) + { + DefaultVisit(token); + } + + public virtual void VisitTrivia(SyntaxTrivia trivia) + { + DefaultVisit(trivia); + } + + public virtual void DefaultVisit(SyntaxNode node) + { + } + } +} diff --git a/src/Microsoft.AspNetCore.Razor.Language/Syntax/TextSpan.cs b/src/Microsoft.AspNetCore.Razor.Language/Syntax/TextSpan.cs new file mode 100644 index 0000000000..e80562b01b --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/Syntax/TextSpan.cs @@ -0,0 +1,261 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using Microsoft.Extensions.Internal; + +namespace Microsoft.AspNetCore.Razor.Language.Syntax +{ + /// + /// Immutable abstract representation of a span of text. For example, in an error diagnostic that reports a + /// location, it could come from a parsed string, text from a tool editor buffer, etc. + /// + internal readonly struct TextSpan : IEquatable, IComparable + { + /// + /// Creates a TextSpan instance beginning with the position Start and having the Length + /// specified with . + /// + public TextSpan(int start, int length) + { + if (start < 0) + { + throw new ArgumentOutOfRangeException(nameof(start)); + } + + if (start + length < start) + { + throw new ArgumentOutOfRangeException(nameof(length)); + } + + Start = start; + Length = length; + } + + /// + /// Start point of the span. + /// + public int Start { get; } + + /// + /// End of the span. + /// + public int End => Start + Length; + + /// + /// Length of the span. + /// + public int Length { get; } + + /// + /// Determines whether or not the span is empty. + /// + public bool IsEmpty => Length == 0; + + /// + /// Determines whether the position lies within the span. + /// + /// + /// The position to check. + /// + /// + /// true if the position is greater than or equal to Start and strictly less + /// than End, otherwise false. + /// + public bool Contains(int position) + { + return unchecked((uint)(position - Start) < (uint)Length); + } + + /// + /// Determines whether falls completely within this span. + /// + /// + /// The span to check. + /// + /// + /// true if the specified span falls completely within this span, otherwise false. + /// + public bool Contains(TextSpan span) + { + return span.Start >= Start && span.End <= End; + } + + /// + /// Determines whether overlaps this span. Two spans are considered to overlap + /// if they have positions in common and neither is empty. Empty spans do not overlap with any + /// other span. + /// + /// + /// The span to check. + /// + /// + /// true if the spans overlap, otherwise false. + /// + public bool OverlapsWith(TextSpan span) + { + var overlapStart = Math.Max(Start, span.Start); + var overlapEnd = Math.Min(End, span.End); + + return overlapStart < overlapEnd; + } + + /// + /// Returns the overlap with the given span, or null if there is no overlap. + /// + /// + /// The span to check. + /// + /// + /// The overlap of the spans, or null if the overlap is empty. + /// + public TextSpan? Overlap(TextSpan span) + { + var overlapStart = Math.Max(Start, span.Start); + var overlapEnd = Math.Min(End, span.End); + + return overlapStart < overlapEnd + ? FromBounds(overlapStart, overlapEnd) + : (TextSpan?)null; + } + + /// + /// Determines whether intersects this span. Two spans are considered to + /// intersect if they have positions in common or the end of one span + /// coincides with the start of the other span. + /// + /// + /// The span to check. + /// + /// + /// true if the spans intersect, otherwise false. + /// + public bool IntersectsWith(TextSpan span) + { + return span.Start <= End && span.End >= Start; + } + + /// + /// Determines whether intersects this span. + /// A position is considered to intersect if it is between the start and + /// end positions (inclusive) of this span. + /// + /// + /// The position to check. + /// + /// + /// true if the position intersects, otherwise false. + /// + public bool IntersectsWith(int position) + { + return unchecked((uint)(position - Start) <= (uint)Length); + } + + /// + /// Returns the intersection with the given span, or null if there is no intersection. + /// + /// + /// The span to check. + /// + /// + /// The intersection of the spans, or null if the intersection is empty. + /// + public TextSpan? Intersection(TextSpan span) + { + var intersectStart = Math.Max(Start, span.Start); + var intersectEnd = Math.Min(End, span.End); + + return intersectStart <= intersectEnd + ? FromBounds(intersectStart, intersectEnd) + : (TextSpan?)null; + } + + /// + /// Creates a new from and positions as opposed to a position and length. + /// + /// The returned TextSpan contains the range with inclusive, + /// and exclusive. + /// + public static TextSpan FromBounds(int start, int end) + { + if (start < 0) + { + throw new ArgumentOutOfRangeException(nameof(start), "start must not be negative"); + } + + if (end < start) + { + throw new ArgumentOutOfRangeException(nameof(end), "end must not be less than start"); + } + + return new TextSpan(start, end - start); + } + + /// + /// Determines if two instances of are the same. + /// + public static bool operator ==(TextSpan left, TextSpan right) + { + return left.Equals(right); + } + + /// + /// Determines if two instances of are different. + /// + public static bool operator !=(TextSpan left, TextSpan right) + { + return !left.Equals(right); + } + + /// + /// Determines if current instance of is equal to another. + /// + public bool Equals(TextSpan other) + { + return Start == other.Start && Length == other.Length; + } + + /// + /// Determines if current instance of is equal to another. + /// + public override bool Equals(object obj) + { + return obj is TextSpan && Equals((TextSpan)obj); + } + + /// + /// Produces a hash code for . + /// + public override int GetHashCode() + { + var combiner = new HashCodeCombiner(); + combiner.Add(Start); + combiner.Add(Length); + + return combiner.CombinedHash; + } + + /// + /// Provides a string representation for . + /// + public override string ToString() + { + return $"[{Start}..{End})"; + } + + /// + /// Compares current instance of with another. + /// + public int CompareTo(TextSpan other) + { + var diff = Start - other.Start; + if (diff != 0) + { + return diff; + } + + return Length - other.Length; + } + } +} diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultDocumentServiceProviderFactory.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultDocumentServiceProviderFactory.cs new file mode 100644 index 0000000000..ceebd2813f --- /dev/null +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultDocumentServiceProviderFactory.cs @@ -0,0 +1,29 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Composition; +using Microsoft.CodeAnalysis.Host; +using Microsoft.CodeAnalysis.Razor.ProjectSystem; + +namespace Microsoft.CodeAnalysis.Razor +{ + [Export(typeof(DocumentServiceProviderFactory))] + internal class DefaultDocumentServiceProviderFactory : DocumentServiceProviderFactory + { + public override IDocumentServiceProvider Create(DocumentSnapshot document) + { + if (document == null) + { + throw new ArgumentNullException(nameof(document)); + } + + return new RazorDocumentServiceProvider(document); + } + + public override IDocumentServiceProvider CreateEmpty() + { + return new RazorDocumentServiceProvider(); + } + } +} diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultProjectSnapshotProjectEngineFactory.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultProjectSnapshotProjectEngineFactory.cs index cd9ac1ee51..8651a9ced6 100644 --- a/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultProjectSnapshotProjectEngineFactory.cs +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultProjectSnapshotProjectEngineFactory.cs @@ -32,13 +32,8 @@ namespace Microsoft.CodeAnalysis.Razor _factories = factories; } - public override RazorProjectEngine Create(ProjectSnapshot project, RazorProjectFileSystem fileSystem, Action configure) + public override RazorProjectEngine Create(RazorConfiguration configuration, RazorProjectFileSystem fileSystem, Action configure) { - if (project == null) - { - throw new ArgumentNullException(nameof(project)); - } - if (fileSystem == null) { throw new ArgumentNullException(nameof(fileSystem)); @@ -55,7 +50,7 @@ namespace Microsoft.CodeAnalysis.Razor // // We typically want this because the language adds features over time - we don't want to a bunch of errors // to show up when a document is first opened, and then go away when the configuration loads, we'd prefer the opposite. - var configuration = project.Configuration ?? DefaultConfiguration; + configuration = configuration ?? DefaultConfiguration; // If there's no factory to handle the configuration then fall back to a very basic configuration. // diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultRazorCompletionFactsService.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultRazorCompletionFactsService.cs new file mode 100644 index 0000000000..17c0664f4a --- /dev/null +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultRazorCompletionFactsService.cs @@ -0,0 +1,92 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Composition; +using System.Linq; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.AspNetCore.Razor.Language.Legacy; + +namespace Microsoft.CodeAnalysis.Razor +{ + [Shared] + [Export(typeof(RazorCompletionFactsService))] + internal class DefaultRazorCompletionFactsService : RazorCompletionFactsService + { + private static readonly IEnumerable DefaultDirectives = new[] + { + CSharpCodeParser.AddTagHelperDirectiveDescriptor, + CSharpCodeParser.RemoveTagHelperDirectiveDescriptor, + CSharpCodeParser.TagHelperPrefixDirectiveDescriptor, + }; + + public override IReadOnlyList GetCompletionItems(RazorSyntaxTree syntaxTree, SourceSpan location) + { + var completionItems = new List(); + + if (AtDirectiveCompletionPoint(syntaxTree, location)) + { + var directiveCompletions = GetDirectiveCompletionItems(syntaxTree); + completionItems.AddRange(directiveCompletions); + } + + return completionItems; + } + + // Internal for testing + internal static List GetDirectiveCompletionItems(RazorSyntaxTree syntaxTree) + { + var directives = syntaxTree.Options.Directives.Concat(DefaultDirectives); + var completionItems = new List(); + foreach (var directive in directives) + { + var completionDisplayText = directive.DisplayName ?? directive.Directive; + var completionItem = new RazorCompletionItem( + completionDisplayText, + directive.Directive, + directive.Description, + RazorCompletionItemKind.Directive); + completionItems.Add(completionItem); + } + + return completionItems; + } + + // Internal for testing + internal static bool AtDirectiveCompletionPoint(RazorSyntaxTree syntaxTree, SourceSpan location) + { + if (syntaxTree == null) + { + return false; + } + + var change = new SourceChange(location, string.Empty); + var owner = syntaxTree.Root.LocateOwner(change); + + if (owner == null) + { + return false; + } + + if (owner.ChunkGenerator is ExpressionChunkGenerator && + owner.Tokens.All(IsDirectiveCompletableToken) && + // Do not provide IntelliSense for explicit expressions. Explicit expressions will usually look like: + // [@] [(] [DateTime.Now] [)] + owner.Parent?.Children.Count > 1 && + owner.Parent.Children[1] == owner) + { + return true; + } + + return false; + } + + // Internal for testing + internal static bool IsDirectiveCompletableToken(AspNetCore.Razor.Language.Syntax.SyntaxToken token) + { + return token.Kind == SyntaxKind.Identifier || + // Marker symbol + token.Kind == SyntaxKind.Unknown; + } + } +} diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentServiceProviderFactory.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentServiceProviderFactory.cs new file mode 100644 index 0000000000..2abe4c61de --- /dev/null +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentServiceProviderFactory.cs @@ -0,0 +1,15 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.CodeAnalysis.Host; +using Microsoft.CodeAnalysis.Razor.ProjectSystem; + +namespace Microsoft.CodeAnalysis.Razor +{ + internal abstract class DocumentServiceProviderFactory + { + public abstract IDocumentServiceProvider CreateEmpty(); + + public abstract IDocumentServiceProvider Create(DocumentSnapshot document); + } +} diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/Host/IDocumentExcerptService.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/Host/IDocumentExcerptService.cs new file mode 100644 index 0000000000..8729432a08 --- /dev/null +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/Host/IDocumentExcerptService.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft. All Rights Reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +#if DOCUMENT_SERVICE_FACTORY + +using System.Collections.Immutable; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Classification; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.CodeAnalysis.Host +{ + /// + /// excerpt some part of + /// + internal interface IDocumentExcerptService : IDocumentService + { + /// + /// return of given and + /// + /// the result might not be an exact copy of the given source or contains more then given span + /// + Task TryExcerptAsync(Document document, TextSpan span, ExcerptMode mode, CancellationToken cancellationToken); + } + + /// + /// this mode shows intention not actual behavior. it is up to implementation how to interpret the intention. + /// + internal enum ExcerptMode + { + SingleLine, + Tooltip + } + + /// + /// Result of excerpt + /// + internal struct ExcerptResult + { + /// + /// excerpt content + /// + public readonly SourceText Content; + + /// + /// span on that given got mapped to + /// + public readonly TextSpan MappedSpan; + + /// + /// classification information on the + /// + public readonly ImmutableArray ClassifiedSpans; + + /// + /// this excerpt is from + /// + public readonly Document Document; + + /// + /// span on this excerpt is from + /// + public readonly TextSpan Span; + + public ExcerptResult(SourceText content, TextSpan mappedSpan, ImmutableArray classifiedSpans, Document document, TextSpan span) + { + Content = content; + MappedSpan = mappedSpan; + ClassifiedSpans = classifiedSpans; + + // these 2 might not actually needed + Document = document; + Span = span; + } + } +} + +#endif \ No newline at end of file diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/Host/IDocumentOperationService.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/Host/IDocumentOperationService.cs new file mode 100644 index 0000000000..ae3e5f2191 --- /dev/null +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/Host/IDocumentOperationService.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft. All Rights Reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +#if DOCUMENT_SERVICE_FACTORY + +namespace Microsoft.CodeAnalysis.Host +{ + /// + /// provide various operations for this document + /// + /// I followed name from EditorOperation for now. + /// + internal interface IDocumentOperationService : IDocumentService + { + /// + /// document version of + /// + bool CanApplyChange { get; } + + /// + /// indicates whether this document supports diagnostics or not + /// + bool SupportDiagnostics { get; } + } +} + +#endif \ No newline at end of file diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/Host/IDocumentService.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/Host/IDocumentService.cs new file mode 100644 index 0000000000..fe6b075d0e --- /dev/null +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/Host/IDocumentService.cs @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft. All Rights Reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +#if DOCUMENT_SERVICE_FACTORY + +namespace Microsoft.CodeAnalysis.Host +{ + /// + /// Empty interface just to mark document services. + /// + internal interface IDocumentService + { + } +} + +#endif diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/Host/IDocumentServiceProvider.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/Host/IDocumentServiceProvider.cs new file mode 100644 index 0000000000..ba36d6fe04 --- /dev/null +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/Host/IDocumentServiceProvider.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft. All Rights Reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +#if DOCUMENT_SERVICE_FACTORY + +namespace Microsoft.CodeAnalysis.Host +{ + internal interface IDocumentServiceProvider + { + /// + /// Gets a document specific service provided by the host identified by the service type. + /// If the host does not provide the service, this method returns null. + /// + TService GetService() where TService : class, IDocumentService; + } +} + +#endif \ No newline at end of file diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/Host/ISpanMappingService.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/Host/ISpanMappingService.cs new file mode 100644 index 0000000000..4c32f09180 --- /dev/null +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/Host/ISpanMappingService.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft. All Rights Reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +#if DOCUMENT_SERVICE_FACTORY + +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.CodeAnalysis.Host +{ + /// + /// Map spans in a document to other spans even in other document + /// + /// this will be used by various features if provided to convert span in one document to other spans. + /// + /// for example, it is used to show spans users expect in a razor file rather than spans in + /// auto generated file that is implementation detail or navigate to the right place rather + /// than the generated file and etc. + /// + internal interface ISpanMappingService : IDocumentService + { + /// + /// Map spans in the document to more appropriate locations + /// + /// in current design, this can NOT map a span to a span that is not backed by a file. + /// for example, roslyn supports someone to have a document that is not backed by a file. and current design doesn't allow + /// such document to be returned from this API + /// for example, span on razor secondary buffer document in roslyn solution mapped to a span on razor cshtml file is possible but + /// a span on razor cshtml file to a span on secondary buffer document is not possible since secondary buffer document is not backed by a file + /// + /// Document given spans belong to + /// Spans in the document + /// Cancellation token + /// Return mapped span. order of result should be same as the given span + Task> MapSpansAsync(Document document, IEnumerable spans, CancellationToken cancellationToken); + } + + /// + /// Result of span mapping + /// + internal struct MappedSpanResult + { + /// + /// Path to mapped file + /// + public readonly string FilePath; + + /// + /// LinePosition representation of the Span + /// + public readonly LinePositionSpan LinePositionSpan; + + /// + /// Mapped span + /// + public readonly TextSpan Span; + + public MappedSpanResult(string filePath, LinePositionSpan linePositionSpan, TextSpan span) + { + FilePath = filePath; + LinePositionSpan = linePositionSpan; + Span = span; + } + } +} + +#endif diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/Microsoft.CodeAnalysis.Razor.Workspaces.csproj b/src/Microsoft.CodeAnalysis.Razor.Workspaces/Microsoft.CodeAnalysis.Razor.Workspaces.csproj index ca09c13e78..3a124ef791 100644 --- a/src/Microsoft.CodeAnalysis.Razor.Workspaces/Microsoft.CodeAnalysis.Razor.Workspaces.csproj +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/Microsoft.CodeAnalysis.Razor.Workspaces.csproj @@ -4,6 +4,7 @@ Razor is a markup syntax for adding server-side logic to web pages. This package contains the Razor design-time infrastructure. net46;netstandard2.0 false + $(DefineConstants);DOCUMENT_SERVICE_FACTORY diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSnapshotProjectEngineFactory.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSnapshotProjectEngineFactory.cs index cf2341878d..0f44e7c4c7 100644 --- a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSnapshotProjectEngineFactory.cs +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSnapshotProjectEngineFactory.cs @@ -45,7 +45,36 @@ namespace Microsoft.CodeAnalysis.Razor return Create(project, RazorProjectFileSystem.Create(Path.GetDirectoryName(project.FilePath)), configure); } - public abstract RazorProjectEngine Create(ProjectSnapshot project, RazorProjectFileSystem fileSystem, Action configure); + public RazorProjectEngine Create(ProjectSnapshot project, RazorProjectFileSystem fileSystem, Action configure) + { + if (project == null) + { + throw new ArgumentNullException(nameof(project)); + } + if (fileSystem == null) + { + throw new ArgumentNullException(nameof(fileSystem)); + } + + return Create(project.Configuration, fileSystem, configure); + } + + public RazorProjectEngine Create(RazorConfiguration configuration, string directoryPath, Action configure) + { + if (configuration == null) + { + throw new ArgumentNullException(nameof(configuration)); + } + + if (directoryPath == null) + { + throw new ArgumentNullException(nameof(directoryPath)); + } + + return Create(configuration, RazorProjectFileSystem.Create(directoryPath), configure); + } + + public abstract RazorProjectEngine Create(RazorConfiguration configuration, RazorProjectFileSystem fileSystem, Action configure); } } diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultDocumentSnapshot.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultDocumentSnapshot.cs index d25b38ddbe..fda5da61eb 100644 --- a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultDocumentSnapshot.cs +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultDocumentSnapshot.cs @@ -23,11 +23,11 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem throw new ArgumentNullException(nameof(state)); } - Project = project; + ProjectInternal = project; State = state; } - public DefaultProjectSnapshot Project { get; } + public DefaultProjectSnapshot ProjectInternal { get; } public DocumentState State { get; } @@ -35,9 +35,13 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem public override string TargetPath => State.HostDocument.TargetPath; + public override ProjectSnapshot Project => ProjectInternal; + + public override bool SupportsOutput => true; + public override IReadOnlyList GetImports() { - return State.Imports.GetImports(Project, this); + return State.GetImports(ProjectInternal); } public override Task GetTextAsync() @@ -50,10 +54,10 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem return State.GetTextVersionAsync(); } - public override Task GetGeneratedOutputAsync() + public override async Task GetGeneratedOutputAsync() { - // IMPORTANT: Don't put more code here. We want this to return a cached task. - return State.GeneratedOutput.GetGeneratedOutputInitializationTask(Project, this); + var (output, _, _) = await State.GetGeneratedOutputAndVersionAsync(ProjectInternal, this).ConfigureAwait(false); + return output; } public override bool TryGetText(out SourceText result) @@ -68,9 +72,9 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem public override bool TryGetGeneratedOutput(out RazorCodeDocument result) { - if (State.GeneratedOutput.IsResultAvailable) + if (State.IsGeneratedOutputResultAvailable) { - result = State.GeneratedOutput.GetGeneratedOutputInitializationTask(Project, this).Result; + result = State.GetGeneratedOutputAndVersionAsync(ProjectInternal, this).Result.output; return true; } diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultImportDocumentSnapshot.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultImportDocumentSnapshot.cs new file mode 100644 index 0000000000..1edc432e25 --- /dev/null +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultImportDocumentSnapshot.cs @@ -0,0 +1,85 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.CodeAnalysis.Razor.ProjectSystem +{ + internal class DefaultImportDocumentSnapshot : DocumentSnapshot + { + private ProjectSnapshot _project; + private RazorProjectItem _importItem; + private SourceText _sourceText; + private VersionStamp _version; + + public DefaultImportDocumentSnapshot(ProjectSnapshot project, RazorProjectItem item) + { + _project = project; + _importItem = item; + _version = VersionStamp.Default; + } + + public override string FilePath => null; + + public override string TargetPath => null; + + public override bool SupportsOutput => false; + + public override ProjectSnapshot Project => _project; + + public override Task GetGeneratedOutputAsync() + { + throw new NotSupportedException(); + } + + public override IReadOnlyList GetImports() + { + return Array.Empty(); + } + + public async override Task GetTextAsync() + { + using (var stream = _importItem.Read()) + using (var reader = new StreamReader(stream)) + { + var content = await reader.ReadToEndAsync(); + _sourceText = SourceText.From(content); + } + + return _sourceText; + } + + public override Task GetTextVersionAsync() + { + return Task.FromResult(_version); + } + + public override bool TryGetText(out SourceText result) + { + if (_sourceText != null) + { + result = _sourceText; + return true; + } + + result = null; + return false; + } + + public override bool TryGetTextVersion(out VersionStamp result) + { + result = _version; + return true; + } + + public override bool TryGetGeneratedOutput(out RazorCodeDocument result) + { + throw new NotSupportedException(); + } + } +} diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshot.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshot.cs index aba5e7a916..dff471af3d 100644 --- a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshot.cs +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshot.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; @@ -58,22 +59,50 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem } } + public override bool IsImportDocument(DocumentSnapshot document) + { + if (document == null) + { + throw new ArgumentNullException(nameof(document)); + } + + return State.ImportsToRelatedDocuments.ContainsKey(document.TargetPath); + } + + public override IEnumerable GetRelatedDocuments(DocumentSnapshot document) + { + if (document == null) + { + throw new ArgumentNullException(nameof(document)); + } + + if (State.ImportsToRelatedDocuments.TryGetValue(document.TargetPath, out var relatedDocuments)) + { + lock (_lock) + { + return relatedDocuments.Select(GetDocument).ToArray(); + } + } + + return Array.Empty(); + } + public override RazorProjectEngine GetProjectEngine() { - return State.ProjectEngine.GetProjectEngine(this); + return State.ProjectEngine; } public override Task> GetTagHelpersAsync() { // IMPORTANT: Don't put more code here. We want this to return a cached task. - return State.TagHelpers.GetTagHelperInitializationTask(this); + return State.GetTagHelpersAsync(this); } public override bool TryGetTagHelpers(out IReadOnlyList result) { - if (State.TagHelpers.IsResultAvailable) + if (State.IsTagHelperResultAvailable) { - result = State.TagHelpers.GetTagHelperInitializationTask(this).Result; + result = State.GetTagHelpersAsync(this).Result; return true; } diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotManager.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotManager.cs index 5a810cc803..9953878518 100644 --- a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotManager.cs +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotManager.cs @@ -90,12 +90,7 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem var projects = new ProjectSnapshot[_projects.Count]; foreach (var entry in _projects) { - if (entry.Value.Snapshot == null) - { - entry.Value.Snapshot = new DefaultProjectSnapshot(entry.Value.State); - } - - projects[i++] = entry.Value.Snapshot; + projects[i++] = entry.Value.GetSnapshot(); } return projects; @@ -115,12 +110,7 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem if (_projects.TryGetValue(filePath, out var entry)) { - if (entry.Snapshot == null) - { - entry.Snapshot = new DefaultProjectSnapshot(entry.State); - } - - return entry.Snapshot; + return entry.GetSnapshot(); } return null; @@ -175,8 +165,10 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem // Document updates can no-op. if (!object.ReferenceEquals(state, entry.State)) { - _projects[hostProject.FilePath] = new Entry(state); - NotifyListeners(new ProjectChangeEventArgs(hostProject.FilePath, document.FilePath, ProjectChangeKind.DocumentAdded)); + var oldSnapshot = entry.GetSnapshot(); + entry = new Entry(state); + _projects[hostProject.FilePath] = entry; + NotifyListeners(new ProjectChangeEventArgs(oldSnapshot, entry.GetSnapshot(), document.FilePath, ProjectChangeKind.DocumentAdded)); } } } @@ -201,8 +193,10 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem // Document updates can no-op. if (!object.ReferenceEquals(state, entry.State)) { - _projects[hostProject.FilePath] = new Entry(state); - NotifyListeners(new ProjectChangeEventArgs(hostProject.FilePath, document.FilePath, ProjectChangeKind.DocumentRemoved)); + var oldSnapshot = entry.GetSnapshot(); + entry = new Entry(state); + _projects[hostProject.FilePath] = entry; + NotifyListeners(new ProjectChangeEventArgs(oldSnapshot, entry.GetSnapshot(), document.FilePath, ProjectChangeKind.DocumentRemoved)); } } } @@ -229,12 +223,10 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem entry.State.Documents.TryGetValue(documentFilePath, out var older)) { ProjectState state; - SourceText olderText; - VersionStamp olderVersion; var currentText = sourceText; - if (older.TryGetText(out olderText) && - older.TryGetTextVersion(out olderVersion)) + if (older.TryGetText(out var olderText) && + older.TryGetTextVersion(out var olderVersion)) { var version = currentText.ContentEquals(olderText) ? olderVersion : olderVersion.GetNewerVersion(); state = entry.State.WithChangedHostDocument(older.HostDocument, currentText, version); @@ -256,8 +248,10 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem // Document updates can no-op. if (!object.ReferenceEquals(state, entry.State)) { - _projects[projectFilePath] = new Entry(state); - NotifyListeners(new ProjectChangeEventArgs(projectFilePath, documentFilePath, ProjectChangeKind.DocumentChanged)); + var oldSnapshot = entry.GetSnapshot(); + entry = new Entry(state); + _projects[projectFilePath] = entry; + NotifyListeners(new ProjectChangeEventArgs(oldSnapshot, entry.GetSnapshot(), documentFilePath, ProjectChangeKind.DocumentChanged)); } } } @@ -293,8 +287,10 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem // Document updates can no-op. if (!object.ReferenceEquals(state, entry.State)) { - _projects[projectFilePath] = new Entry(state); - NotifyListeners(new ProjectChangeEventArgs(projectFilePath, documentFilePath, ProjectChangeKind.DocumentChanged)); + var oldSnapshot = entry.GetSnapshot(); + entry = new Entry(state); + _projects[projectFilePath] = entry; + NotifyListeners(new ProjectChangeEventArgs(oldSnapshot, entry.GetSnapshot(), documentFilePath, ProjectChangeKind.DocumentChanged)); } } } @@ -321,12 +317,10 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem entry.State.Documents.TryGetValue(documentFilePath, out var older)) { ProjectState state; - SourceText olderText; - VersionStamp olderVersion; var currentText = sourceText; - if (older.TryGetText(out olderText) && - older.TryGetTextVersion(out olderVersion)) + if (older.TryGetText(out var olderText) && + older.TryGetTextVersion(out var olderVersion)) { var version = currentText.ContentEquals(olderText) ? olderVersion : olderVersion.GetNewerVersion(); state = entry.State.WithChangedHostDocument(older.HostDocument, currentText, version); @@ -346,8 +340,10 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem // Document updates can no-op. if (!object.ReferenceEquals(state, entry.State)) { - _projects[projectFilePath] = new Entry(state); - NotifyListeners(new ProjectChangeEventArgs(projectFilePath, documentFilePath, ProjectChangeKind.DocumentChanged)); + var oldSnapshot = entry.GetSnapshot(); + entry = new Entry(state); + _projects[projectFilePath] = entry; + NotifyListeners(new ProjectChangeEventArgs(oldSnapshot, entry.GetSnapshot(), documentFilePath, ProjectChangeKind.DocumentChanged)); } } } @@ -381,8 +377,10 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem // Document updates can no-op. if (!object.ReferenceEquals(state, entry.State)) { - _projects[projectFilePath] = new Entry(state); - NotifyListeners(new ProjectChangeEventArgs(projectFilePath, documentFilePath, ProjectChangeKind.DocumentChanged)); + var oldSnapshot = entry.GetSnapshot(); + entry = new Entry(state); + _projects[projectFilePath] = entry; + NotifyListeners(new ProjectChangeEventArgs(oldSnapshot, entry.GetSnapshot(), documentFilePath, ProjectChangeKind.DocumentChanged)); } } } @@ -407,10 +405,11 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem var workspaceProject = GetWorkspaceProject(hostProject.FilePath); var state = ProjectState.Create(Workspace.Services, hostProject, workspaceProject); - _projects[hostProject.FilePath] = new Entry(state); + var entry = new Entry(state); + _projects[hostProject.FilePath] = entry; // We need to notify listeners about every project add. - NotifyListeners(new ProjectChangeEventArgs(hostProject.FilePath, ProjectChangeKind.ProjectAdded)); + NotifyListeners(new ProjectChangeEventArgs(null, entry.GetSnapshot(), ProjectChangeKind.ProjectAdded)); } public override void HostProjectChanged(HostProject hostProject) @@ -429,9 +428,10 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem // HostProject updates can no-op. if (!object.ReferenceEquals(state, entry.State)) { - _projects[hostProject.FilePath] = new Entry(state); - - NotifyListeners(new ProjectChangeEventArgs(hostProject.FilePath, ProjectChangeKind.ProjectChanged)); + var oldSnapshot = entry.GetSnapshot(); + entry = new Entry(state); + _projects[hostProject.FilePath] = entry; + NotifyListeners(new ProjectChangeEventArgs(oldSnapshot, entry.GetSnapshot(), ProjectChangeKind.ProjectChanged)); } } } @@ -445,12 +445,12 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem _foregroundDispatcher.AssertForegroundThread(); - if (_projects.TryGetValue(hostProject.FilePath, out var snapshot)) + if (_projects.TryGetValue(hostProject.FilePath, out var entry)) { - _projects.Remove(hostProject.FilePath); - // We need to notify listeners about every project removal. - NotifyListeners(new ProjectChangeEventArgs(hostProject.FilePath, ProjectChangeKind.ProjectRemoved)); + var oldSnapshot = entry.GetSnapshot(); + _projects.Remove(hostProject.FilePath); + NotifyListeners(new ProjectChangeEventArgs(oldSnapshot, null, ProjectChangeKind.ProjectRemoved)); } } @@ -477,9 +477,11 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem if (entry.State.WorkspaceProject == null) { var state = entry.State.WithWorkspaceProject(workspaceProject); - _projects[workspaceProject.FilePath] = new Entry(state); - NotifyListeners(new ProjectChangeEventArgs(workspaceProject.FilePath, ProjectChangeKind.ProjectChanged)); + var oldSnapshot = entry.GetSnapshot(); + entry = new Entry(state); + _projects[workspaceProject.FilePath] = entry; + NotifyListeners(new ProjectChangeEventArgs(oldSnapshot, entry.GetSnapshot(), ProjectChangeKind.ProjectChanged)); } } } @@ -505,14 +507,15 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem (entry.State.WorkspaceProject == null || entry.State.WorkspaceProject.Version.GetNewerVersion(workspaceProject.Version) == workspaceProject.Version)) { var state = entry.State.WithWorkspaceProject(workspaceProject); - + // WorkspaceProject updates can no-op. This can be the case if a build is triggered, but we've // already seen the update. if (!object.ReferenceEquals(state, entry.State)) { - _projects[workspaceProject.FilePath] = new Entry(state); - - NotifyListeners(new ProjectChangeEventArgs(workspaceProject.FilePath, ProjectChangeKind.ProjectChanged)); + var oldSnapshot = entry.GetSnapshot(); + entry = new Entry(state); + _projects[workspaceProject.FilePath] = entry; + NotifyListeners(new ProjectChangeEventArgs(oldSnapshot, entry.GetSnapshot(), ProjectChangeKind.ProjectChanged)); } } } @@ -549,17 +552,21 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem { // OK there's another WorkspaceProject, use that. state = entry.State.WithWorkspaceProject(otherWorkspaceProject); - _projects[otherWorkspaceProject.FilePath] = new Entry(state); - NotifyListeners(new ProjectChangeEventArgs(otherWorkspaceProject.FilePath, ProjectChangeKind.ProjectChanged)); + var oldSnapshot = entry.GetSnapshot(); + entry = new Entry(state); + _projects[otherWorkspaceProject.FilePath] = entry; + NotifyListeners(new ProjectChangeEventArgs(oldSnapshot, entry.GetSnapshot(), ProjectChangeKind.ProjectChanged)); } else { - state = entry.State.WithWorkspaceProject(null); - _projects[workspaceProject.FilePath] = new Entry(state); - // Notify listeners of a change because we've removed computed state. - NotifyListeners(new ProjectChangeEventArgs(workspaceProject.FilePath, ProjectChangeKind.ProjectChanged)); + state = entry.State.WithWorkspaceProject(null); + + var oldSnapshot = entry.GetSnapshot(); + entry = new Entry(state); + _projects[workspaceProject.FilePath] = entry; + NotifyListeners(new ProjectChangeEventArgs(oldSnapshot, entry.GetSnapshot(), ProjectChangeKind.ProjectChanged)); } } } @@ -601,7 +608,7 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem { throw new ArgumentNullException(nameof(exception)); } - + _errorReporter.ReportError(exception, workspaceProject); } @@ -644,13 +651,18 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem private class Entry { - public ProjectSnapshot Snapshot; + public ProjectSnapshot SnapshotUnsafe; public readonly ProjectState State; public Entry(ProjectState state) { State = state; } + + public ProjectSnapshot GetSnapshot() + { + return SnapshotUnsafe ?? (SnapshotUnsafe = new DefaultProjectSnapshot(State)); + } } } } \ No newline at end of file diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentGeneratedOutputTracker.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentGeneratedOutputTracker.cs deleted file mode 100644 index a3e11da04f..0000000000 --- a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentGeneratedOutputTracker.cs +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis.Text; -using Microsoft.Extensions.Internal; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - internal class DocumentGeneratedOutputTracker - { - private readonly object _lock; - - private DocumentGeneratedOutputTracker _older; - private Task _task; - - private IReadOnlyList _tagHelpers; - private IReadOnlyList _imports; - - public DocumentGeneratedOutputTracker(DocumentGeneratedOutputTracker older) - { - _older = older; - - _lock = new object(); - } - - public bool IsResultAvailable => _task?.IsCompleted == true; - - public DocumentGeneratedOutputTracker Older => _older; - - public Task GetGeneratedOutputInitializationTask(ProjectSnapshot project, DocumentSnapshot document) - { - if (project == null) - { - throw new ArgumentNullException(nameof(project)); - } - - if (document == null) - { - throw new ArgumentNullException(nameof(document)); - } - - if (_task == null) - { - lock (_lock) - { - if (_task == null) - { - _task = GetGeneratedOutputInitializationTaskCore(project, document); - } - } - } - - return _task; - } - - public DocumentGeneratedOutputTracker Fork() - { - return new DocumentGeneratedOutputTracker(this); - } - - private async Task GetGeneratedOutputInitializationTaskCore(ProjectSnapshot project, DocumentSnapshot document) - { - var tagHelpers = await project.GetTagHelpersAsync().ConfigureAwait(false); - var imports = await GetImportsAsync(project, document); - - if (_older != null && _older.IsResultAvailable) - { - var tagHelperDifference = new HashSet(TagHelperDescriptorComparer.Default); - tagHelperDifference.UnionWith(_older._tagHelpers); - tagHelperDifference.SymmetricExceptWith(tagHelpers); - - var importDifference = new HashSet(); - importDifference.UnionWith(_older._imports); - importDifference.SymmetricExceptWith(imports); - - if (tagHelperDifference.Count == 0 && importDifference.Count == 0) - { - // We can use the cached result. - var result = _older._task.Result; - - // Drop reference so it can be GC'ed - _older = null; - - // Cache the tag helpers and imports so the next version can use them - _tagHelpers = tagHelpers; - _imports = imports; - - return result; - } - } - - // Drop reference so it can be GC'ed - _older = null; - - // Cache the tag helpers and imports so the next version can use them - _tagHelpers = tagHelpers; - _imports = imports; - - var importSources = new List(); - foreach (var item in imports) - { - var sourceDocument = await GetRazorSourceDocumentAsync(item.Import); - importSources.Add(sourceDocument); - } - - var documentSource = await GetRazorSourceDocumentAsync(document); - - var projectEngine = project.GetProjectEngine(); - - return projectEngine.ProcessDesignTime(documentSource, importSources, tagHelpers); - } - - private async Task GetRazorSourceDocumentAsync(DocumentSnapshot document) - { - var sourceText = await document.GetTextAsync(); - - return sourceText.GetRazorSourceDocument(document.FilePath); - } - - private async Task> GetImportsAsync(ProjectSnapshot project, DocumentSnapshot document) - { - var imports = new List(); - foreach (var snapshot in document.GetImports()) - { - var versionStamp = await snapshot.GetTextVersionAsync(); - imports.Add(new ImportItem(snapshot.FilePath, versionStamp, snapshot)); - } - - return imports; - } - - private struct ImportItem : IEquatable - { - public ImportItem(string filePath, VersionStamp versionStamp, DocumentSnapshot import) - { - FilePath = filePath; - VersionStamp = versionStamp; - Import = import; - } - - public string FilePath { get; } - - public VersionStamp VersionStamp { get; } - - public DocumentSnapshot Import { get; } - - public bool Equals(ImportItem other) - { - return - FilePathComparer.Instance.Equals(FilePath, other.FilePath) && - VersionStamp == other.VersionStamp; - } - - public override bool Equals(object obj) - { - return obj is ImportItem item ? Equals(item) : false; - } - - public override int GetHashCode() - { - var hash = new HashCodeCombiner(); - hash.Add(FilePath, FilePathComparer.Instance); - hash.Add(VersionStamp); - return hash; - } - } - } -} diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentImportsTracker.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentImportsTracker.cs deleted file mode 100644 index 96b927e42f..0000000000 --- a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentImportsTracker.cs +++ /dev/null @@ -1,165 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis.Text; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - internal class DocumentImportsTracker - { - private readonly object _lock; - - private IReadOnlyList _imports; - - public DocumentImportsTracker() - { - _lock = new object(); - } - - public IReadOnlyList GetImports(ProjectSnapshot project, DocumentSnapshot document) - { - if (project == null) - { - throw new ArgumentNullException(nameof(project)); - } - - if (document == null) - { - throw new ArgumentNullException(nameof(document)); - } - - if (_imports == null) - { - lock (_lock) - { - if (_imports == null) - { - _imports = GetImportsCore(project, document); - } - } - } - - return _imports; - } - - private IReadOnlyList GetImportsCore(ProjectSnapshot project, DocumentSnapshot document) - { - var projectEngine = project.GetProjectEngine(); - var importFeature = projectEngine.ProjectFeatures.OfType().FirstOrDefault(); - var projectItem = projectEngine.FileSystem.GetItem(document.FilePath); - var importItems = importFeature?.GetImports(projectItem).Where(i => i.Exists); - if (importItems == null) - { - return Array.Empty(); - } - - var imports = new List(); - foreach (var item in importItems) - { - if (item.PhysicalPath == null) - { - // This is a default import. - var defaultImport = new DefaultImportDocumentSnapshot(project, item); - imports.Add(defaultImport); - } - else - { - var import = project.GetDocument(item.PhysicalPath); - if (import == null) - { - // We are not tracking this document in this project. So do nothing. - continue; - } - - imports.Add(import); - } - } - - return imports; - } - - private class DefaultImportDocumentSnapshot : DocumentSnapshot - { - private ProjectSnapshot _project; - private RazorProjectItem _importItem; - private SourceText _sourceText; - private VersionStamp _version; - private DocumentGeneratedOutputTracker _generatedOutput; - - public DefaultImportDocumentSnapshot(ProjectSnapshot project, RazorProjectItem item) - { - _project = project; - _importItem = item; - _version = VersionStamp.Default; - _generatedOutput = new DocumentGeneratedOutputTracker(null); - } - - public override string FilePath => null; - - public override string TargetPath => null; - - public override Task GetGeneratedOutputAsync() - { - return _generatedOutput.GetGeneratedOutputInitializationTask(_project, this); - } - - public override IReadOnlyList GetImports() - { - return Array.Empty(); - } - - public async override Task GetTextAsync() - { - using (var stream = _importItem.Read()) - using (var reader = new StreamReader(stream)) - { - var content = await reader.ReadToEndAsync(); - _sourceText = SourceText.From(content); - } - - return _sourceText; - } - - public override Task GetTextVersionAsync() - { - return Task.FromResult(_version); - } - - public override bool TryGetText(out SourceText result) - { - if (_sourceText != null) - { - result = _sourceText; - return true; - } - - result = null; - return false; - } - - public override bool TryGetTextVersion(out VersionStamp result) - { - result = _version; - return true; - } - - public override bool TryGetGeneratedOutput(out RazorCodeDocument result) - { - if (_generatedOutput.IsResultAvailable) - { - result = GetGeneratedOutputAsync().Result; - return true; - } - - result = null; - return false; - } - } - } -} diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentSnapshot.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentSnapshot.cs index 0cc9da8f04..4d606cc499 100644 --- a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentSnapshot.cs +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentSnapshot.cs @@ -14,6 +14,10 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem public abstract string TargetPath { get; } + public abstract ProjectSnapshot Project { get; } + + public abstract bool SupportsOutput { get; } + public abstract IReadOnlyList GetImports(); public abstract Task GetTextAsync(); diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentState.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentState.cs index d1fb05b67a..31b9447126 100644 --- a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentState.cs +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentState.cs @@ -2,7 +2,10 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Language; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Text; @@ -18,14 +21,13 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem private readonly object _lock; + private ComputedStateTracker _computedState; + private Func> _loader; private Task _loaderTask; private SourceText _sourceText; private VersionStamp? _version; - private DocumentGeneratedOutputTracker _generatedOutput; - private DocumentImportsTracker _imports; - public static DocumentState Create( HostWorkspaceServices services, HostDocument hostDocument, @@ -65,42 +67,37 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem public HostWorkspaceServices Services { get; } - public DocumentGeneratedOutputTracker GeneratedOutput + public GeneratedCodeContainer GeneratedCodeContainer => HostDocument.GeneratedCodeContainer; + + public bool IsGeneratedOutputResultAvailable => ComputedState.IsResultAvailable == true; + + private ComputedStateTracker ComputedState { get { - if (_generatedOutput == null) + if (_computedState == null) { lock (_lock) { - if (_generatedOutput == null) + if (_computedState == null) { - _generatedOutput = new DocumentGeneratedOutputTracker(null); + _computedState = new ComputedStateTracker(this); } } } - return _generatedOutput; + return _computedState; } } - public DocumentImportsTracker Imports + public Task<(RazorCodeDocument output, VersionStamp inputVersion, VersionStamp outputVersion)> GetGeneratedOutputAndVersionAsync(DefaultProjectSnapshot project, DefaultDocumentSnapshot document) { - get - { - if (_imports == null) - { - lock (_lock) - { - if (_imports == null) - { - _imports = new DocumentImportsTracker(); - } - } - } + return ComputedState.GetGeneratedOutputAndVersionAsync(project, document); + } - return _imports; - } + public IReadOnlyList GetImports(DefaultProjectSnapshot project) + { + return GetImportsCore(project); } public async Task GetTextAsync() @@ -178,6 +175,23 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem state._version = _version; state._loaderTask = _loaderTask; + // Do not cache computed state + + return state; + } + + public virtual DocumentState WithImportsChange() + { + var state = new DocumentState(Services, HostDocument, _sourceText, _version, _loader); + + // The source could not have possibly changed. + state._sourceText = _sourceText; + state._version = _version; + state._loaderTask = _loaderTask; + + // Optimisically cache the computed state + state._computedState = new ComputedStateTracker(state, _computedState); + return state; } @@ -190,8 +204,8 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem state._version = _version; state._loaderTask = _loaderTask; - // Opportunistically cache the generated code - state._generatedOutput = _generatedOutput?.Fork(); + // Optimisically cache the computed state + state._computedState = new ComputedStateTracker(state, _computedState); return state; } @@ -203,6 +217,8 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem throw new ArgumentNullException(nameof(sourceText)); } + // Do not cache the computed state + return new DocumentState(Services, HostDocument, sourceText, version, null); } @@ -213,7 +229,239 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem throw new ArgumentNullException(nameof(loader)); } + // Do not cache the computed state + return new DocumentState(Services, HostDocument, null, null, loader); } + + private IReadOnlyList GetImportsCore(DefaultProjectSnapshot project) + { + var projectEngine = project.GetProjectEngine(); + var importFeature = projectEngine.ProjectFeatures.OfType().FirstOrDefault(); + var projectItem = projectEngine.FileSystem.GetItem(HostDocument.FilePath); + var importItems = importFeature?.GetImports(projectItem); + if (importItems == null) + { + return Array.Empty(); + } + + var imports = new List(); + foreach (var item in importItems) + { + if (item.PhysicalPath == null) + { + // This is a default import. + var defaultImport = new DefaultImportDocumentSnapshot(project, item); + imports.Add(defaultImport); + } + else + { + var import = project.GetDocument(item.PhysicalPath); + if (import == null) + { + // We are not tracking this document in this project. So do nothing. + continue; + } + + imports.Add(import); + } + } + + return imports; + } + + // See design notes on ProjectState.ComputedStateTracker. + private class ComputedStateTracker + { + private readonly object _lock; + + private ComputedStateTracker _older; + public Task<(RazorCodeDocument, VersionStamp, VersionStamp)> TaskUnsafe; + + public ComputedStateTracker(DocumentState state, ComputedStateTracker older = null) + { + _lock = state._lock; + _older = older; + } + + public bool IsResultAvailable => TaskUnsafe?.IsCompleted == true; + + public Task<(RazorCodeDocument, VersionStamp, VersionStamp)> GetGeneratedOutputAndVersionAsync(DefaultProjectSnapshot project, DocumentSnapshot document) + { + if (project == null) + { + throw new ArgumentNullException(nameof(project)); + } + + if (document == null) + { + throw new ArgumentNullException(nameof(document)); + } + + if (TaskUnsafe == null) + { + lock (_lock) + { + if (TaskUnsafe == null) + { + TaskUnsafe = GetGeneratedOutputAndVersionCoreAsync(project, document); + } + } + } + + return TaskUnsafe; + } + + private async Task<(RazorCodeDocument, VersionStamp, VersionStamp)> GetGeneratedOutputAndVersionCoreAsync(DefaultProjectSnapshot project, DocumentSnapshot document) + { + // We only need to produce the generated code if any of our inputs is newer than the + // previously cached output. + // + // First find the versions that are the inputs: + // - The project + computed state + // - The imports + // - This document + // + // All of these things are cached, so no work is wasted if we do need to generate the code. + var computedStateVersion = await project.State.GetComputedStateVersionAsync(project).ConfigureAwait(false); + var documentCollectionVersion = project.State.DocumentCollectionVersion; + var imports = await GetImportsAsync(project, document).ConfigureAwait(false); + var documentVersion = await document.GetTextVersionAsync().ConfigureAwait(false); + + // OK now that have the previous output and all of the versions, we can see if anything + // has changed that would require regenerating the code. + var inputVersion = documentVersion; + if (inputVersion.GetNewerVersion(computedStateVersion) == computedStateVersion) + { + inputVersion = computedStateVersion; + } + + if (inputVersion.GetNewerVersion(documentCollectionVersion) == documentCollectionVersion) + { + inputVersion = documentCollectionVersion; + } + + for (var i = 0; i < imports.Count; i++) + { + var importVersion = imports[i].Version; + if (inputVersion.GetNewerVersion(importVersion) == importVersion) + { + inputVersion = importVersion; + } + } + + RazorCodeDocument olderOutput = null; + var olderInputVersion = default(VersionStamp); + var olderOutputVersion = default(VersionStamp); + if (_older?.TaskUnsafe != null) + { + (olderOutput, olderInputVersion, olderOutputVersion) = await _older.TaskUnsafe.ConfigureAwait(false); + if (inputVersion.GetNewerVersion(olderInputVersion) == olderInputVersion) + { + // Nothing has changed, we can use the cached result. + lock (_lock) + { + TaskUnsafe = _older.TaskUnsafe; + _older = null; + return (olderOutput, olderInputVersion, olderOutputVersion); + } + } + } + + // OK we have to generate the code. + var tagHelpers = await project.GetTagHelpersAsync().ConfigureAwait(false); + var importSources = new List(); + foreach (var item in imports) + { + var sourceDocument = await GetRazorSourceDocumentAsync(item.Document).ConfigureAwait(false); + importSources.Add(sourceDocument); + } + + var documentSource = await GetRazorSourceDocumentAsync(document).ConfigureAwait(false); + + var projectEngine = project.GetProjectEngine(); + + var codeDocument = projectEngine.ProcessDesignTime(documentSource, importSources, tagHelpers); + var csharpDocument = codeDocument.GetCSharpDocument(); + + // OK now we've generated the code. Let's check if the output is actually different. This is + // a valuable optimization for our use cases because lots of changes you could make require + // us to run code generation, but don't change the result. + // + // Note that we're talking about the effect on the generated C# code here (not the other artifacts). + // This is the reason why we have two versions associated with the output. + // + // The INPUT version is related the .cshtml files and tag helpers + // The OUTPUT version is related to the generated C#. + // + // Examples: + // + // A change to a tag helper not used by this document - updates the INPUT version, but not + // the OUTPUT version. + // + // A change in the HTML - updates the INPUT version, but not the OUTPUT version. + // + // + // Razor IDE features should always retrieve the output and party on it regardless. Depending + // on the use cases we may or may not need to synchronize the output. + + var outputVersion = inputVersion; + if (olderOutput != null) + { + if (string.Equals( + olderOutput.GetCSharpDocument().GeneratedCode, + csharpDocument.GeneratedCode, + StringComparison.Ordinal)) + { + outputVersion = olderOutputVersion; + } + } + + if (document is DefaultDocumentSnapshot defaultDocument) + { + defaultDocument.State.HostDocument.GeneratedCodeContainer.SetOutput( + defaultDocument, + csharpDocument, + inputVersion, + outputVersion); + } + + return (codeDocument, inputVersion, outputVersion); + } + + private async Task GetRazorSourceDocumentAsync(DocumentSnapshot document) + { + var sourceText = await document.GetTextAsync(); + return sourceText.GetRazorSourceDocument(document.FilePath); + } + + private async Task> GetImportsAsync(ProjectSnapshot project, DocumentSnapshot document) + { + var imports = new List(); + foreach (var snapshot in document.GetImports()) + { + var versionStamp = await snapshot.GetTextVersionAsync(); + imports.Add(new ImportItem(snapshot.FilePath, versionStamp, snapshot)); + } + + return imports; + } + + private readonly struct ImportItem + { + public ImportItem(string filePath, VersionStamp version, DocumentSnapshot document) + { + FilePath = filePath; + Version = version; + Document = document; + } + + public string FilePath { get; } + + public VersionStamp Version { get; } + + public DocumentSnapshot Document { get; } + } + } } } diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/EmptyTextLoader.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/EmptyTextLoader.cs new file mode 100644 index 0000000000..765523fcf8 --- /dev/null +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/EmptyTextLoader.cs @@ -0,0 +1,26 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.CodeAnalysis.Razor.ProjectSystem +{ + internal class EmptyTextLoader : TextLoader + { + private readonly string _filePath; + private readonly VersionStamp _version; + + public EmptyTextLoader(string filePath) + { + _filePath = filePath; + _version = VersionStamp.Create(); // Version will never change so this can be reused. + } + + public override Task LoadTextAndVersionAsync(Workspace workspace, DocumentId documentId, CancellationToken cancellationToken) + { + return Task.FromResult(TextAndVersion.Create(SourceText.From(""), _version, _filePath)); + } + } +} \ No newline at end of file diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/EphemeralProjectSnapshot.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/EphemeralProjectSnapshot.cs index cd87c074de..82f9a93196 100644 --- a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/EphemeralProjectSnapshot.cs +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/EphemeralProjectSnapshot.cs @@ -56,6 +56,26 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem return null; } + public override bool IsImportDocument(DocumentSnapshot document) + { + if (document == null) + { + throw new ArgumentNullException(nameof(document)); + } + + return false; + } + + public override IEnumerable GetRelatedDocuments(DocumentSnapshot document) + { + if (document == null) + { + throw new ArgumentNullException(nameof(document)); + } + + return Array.Empty(); + } + public override RazorProjectEngine GetProjectEngine() { return _projectEngine.Value; diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/GeneratedCodeContainer.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/GeneratedCodeContainer.cs new file mode 100644 index 0000000000..dec2a48d4a --- /dev/null +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/GeneratedCodeContainer.cs @@ -0,0 +1,184 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Diagnostics; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.CodeAnalysis.Razor.ProjectSystem +{ + internal class GeneratedCodeContainer + { + public event EventHandler GeneratedCodeChanged; + + private SourceText _source; + private VersionStamp? _inputVersion; + private VersionStamp? _outputVersion; + private RazorCSharpDocument _output; + private DocumentSnapshot _latestDocument; + + private readonly object _setOutputLock = new object(); + private readonly TextContainer _textContainer; + + public GeneratedCodeContainer() + { + _textContainer = new TextContainer(_setOutputLock); + _textContainer.TextChanged += TextContainer_TextChanged; + } + + public SourceText Source + { + get + { + lock (_setOutputLock) + { + return _source; + } + } + } + + public VersionStamp InputVersion + { + get + { + lock (_setOutputLock) + { + return _inputVersion.Value; + } + } + } + + public VersionStamp OutputVersion + { + get + { + lock (_setOutputLock) + { + return _outputVersion.Value; + } + } + } + + public RazorCSharpDocument Output + { + get + { + lock (_setOutputLock) + { + return _output; + } + } + } + + public DocumentSnapshot LatestDocument + { + get + { + lock (_setOutputLock) + { + return _latestDocument; + } + } + } + + public SourceTextContainer SourceTextContainer + { + get + { + lock (_setOutputLock) + { + return _textContainer; + } + } + } + + public void SetOutput( + DefaultDocumentSnapshot document, + RazorCSharpDocument output, + VersionStamp inputVersion, + VersionStamp outputVersion) + { + lock (_setOutputLock) + { + if (_inputVersion.HasValue && + _inputVersion != inputVersion && + _inputVersion == _inputVersion.Value.GetNewerVersion(inputVersion)) + { + // Latest document is newer than the provided document. + return; + } + + if (!document.TryGetText(out var source)) + { + Debug.Fail("The text should have already been evaluated."); + return; + } + + _source = source; + _inputVersion = inputVersion; + _outputVersion = outputVersion; + _output = output; + _latestDocument = document; + _textContainer.SetText(SourceText.From(_output.GeneratedCode)); + } + } + + private void TextContainer_TextChanged(object sender, TextChangeEventArgs args) + { + GeneratedCodeChanged?.Invoke(this, args); + } + + private class TextContainer : SourceTextContainer + { + public override event EventHandler TextChanged; + + private readonly object _outerLock; + private SourceText _currentText; + + public TextContainer(object outerLock) + : this(SourceText.From(string.Empty)) + { + _outerLock = outerLock; + } + + public TextContainer(SourceText sourceText) + { + if (sourceText == null) + { + throw new ArgumentNullException(nameof(sourceText)); + } + + _currentText = sourceText; + } + + public override SourceText CurrentText + { + get + { + lock (_outerLock) + { + return _currentText; + } + } + } + + public void SetText(SourceText sourceText) + { + if (sourceText == null) + { + throw new ArgumentNullException(nameof(sourceText)); + } + + lock (_outerLock) + { + + var e = new TextChangeEventArgs(_currentText, sourceText); + _currentText = sourceText; + + TextChanged?.Invoke(this, e); + } + } + } + } +} diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/GeneratedOutputTextLoader.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/GeneratedOutputTextLoader.cs new file mode 100644 index 0000000000..8ca7821b63 --- /dev/null +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/GeneratedOutputTextLoader.cs @@ -0,0 +1,36 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.CodeAnalysis.Razor.ProjectSystem +{ + internal class GeneratedOutputTextLoader : TextLoader + { + private readonly DocumentSnapshot _document; + private readonly string _filePath; + private readonly VersionStamp _version; + + public GeneratedOutputTextLoader(DocumentSnapshot document, string filePath) + { + if (document == null) + { + throw new ArgumentNullException(nameof(document)); + } + + _document = document; + _filePath = filePath; + _version = VersionStamp.Create(); // Version will never change so this can be reused. + } + + public override async Task LoadTextAndVersionAsync(Workspace workspace, DocumentId documentId, CancellationToken cancellationToken) + { + var output = await _document.GetGeneratedOutputAsync().ConfigureAwait(false); + return TextAndVersion.Create(SourceText.From(output.GetCSharpDocument().GeneratedCode), _version, _filePath); + } + } +} \ No newline at end of file diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/HostDocument.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/HostDocument.cs index 859cc0df32..77d62eb854 100644 --- a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/HostDocument.cs +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/HostDocument.cs @@ -21,10 +21,13 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem FilePath = filePath; TargetPath = targetPath; + GeneratedCodeContainer = new GeneratedCodeContainer(); } public string FilePath { get; } public string TargetPath { get; } + + public GeneratedCodeContainer GeneratedCodeContainer { get; } } } diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/LiveShareProjectSnapshotBase.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/LiveShareProjectSnapshotBase.cs index f03a31b0ae..ae13f49735 100644 --- a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/LiveShareProjectSnapshotBase.cs +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/LiveShareProjectSnapshotBase.cs @@ -27,6 +27,10 @@ namespace Microsoft.CodeAnalysis.Razor.Workspaces.ProjectSystem public override DocumentSnapshot GetDocument(string filePath) => throw new NotImplementedException(); + public override bool IsImportDocument(DocumentSnapshot document) => throw new NotImplementedException(); + + public override IEnumerable GetRelatedDocuments(DocumentSnapshot document) => throw new NotImplementedException(); + public override RazorProjectEngine GetProjectEngine() => throw new NotImplementedException(); public override Task> GetTagHelpersAsync() => throw new NotImplementedException(); diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectChangeEventArgs.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectChangeEventArgs.cs index a163ba5f1b..3e0dd3ff68 100644 --- a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectChangeEventArgs.cs +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectChangeEventArgs.cs @@ -7,29 +7,39 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem { internal class ProjectChangeEventArgs : EventArgs { - public ProjectChangeEventArgs(string projectFilePath, ProjectChangeKind kind) + public ProjectChangeEventArgs(ProjectSnapshot older, ProjectSnapshot newer, ProjectChangeKind kind) { - if (projectFilePath == null) + if (older == null && newer == null) { - throw new ArgumentNullException(nameof(projectFilePath)); + throw new ArgumentException("Both projects cannot be null."); } - ProjectFilePath = projectFilePath; + Older = older; + Newer = newer; Kind = kind; + + ProjectFilePath = older?.FilePath ?? newer.FilePath; } - public ProjectChangeEventArgs(string projectFilePath, string documentFilePath, ProjectChangeKind kind) + public ProjectChangeEventArgs(ProjectSnapshot older, ProjectSnapshot newer, string documentFilePath, ProjectChangeKind kind) { - if (projectFilePath == null) + if (older == null && newer == null) { - throw new ArgumentNullException(nameof(projectFilePath)); + throw new ArgumentException("Both projects cannot be null."); } - ProjectFilePath = projectFilePath; + Older = older; + Newer = newer; DocumentFilePath = documentFilePath; Kind = kind; + + ProjectFilePath = older?.FilePath ?? newer.FilePath; } + public ProjectSnapshot Older { get; } + + public ProjectSnapshot Newer { get; } + public string ProjectFilePath { get; } public string DocumentFilePath { get; } diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectEngineTracker.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectEngineTracker.cs deleted file mode 100644 index 6e54daed0b..0000000000 --- a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectEngineTracker.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis.Host; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - internal class ProjectEngineTracker - { - private const ProjectDifference Mask = ProjectDifference.ConfigurationChanged; - - private readonly object _lock = new object(); - - private readonly HostWorkspaceServices _services; - private RazorProjectEngine _projectEngine; - - public ProjectEngineTracker(ProjectState state) - { - if (state == null) - { - throw new ArgumentNullException(nameof(state)); - } - - _services = state.Services; - } - - public ProjectEngineTracker ForkFor(ProjectState state, ProjectDifference difference) - { - if (state == null) - { - throw new ArgumentNullException(nameof(state)); - } - - if ((difference & Mask) != 0) - { - return null; - } - - return this; - } - - public RazorProjectEngine GetProjectEngine(ProjectSnapshot snapshot) - { - if (snapshot == null) - { - throw new ArgumentNullException(nameof(snapshot)); - } - - if (_projectEngine == null) - { - lock (_lock) - { - if (_projectEngine == null) - { - var factory = _services.GetRequiredService(); - _projectEngine = factory.Create(snapshot); - } - } - } - - return _projectEngine; - } - } -} diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshot.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshot.cs index 418d117ff2..cf091a4f19 100644 --- a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshot.cs +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshot.cs @@ -25,6 +25,17 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem public abstract DocumentSnapshot GetDocument(string filePath); + public abstract bool IsImportDocument(DocumentSnapshot document); + + /// + /// If the provided document is an import document, gets the other documents in the project + /// that include directives specified by the provided document. Otherwise returns an empty + /// list. + /// + /// The document. + /// A list of related documents. + public abstract IEnumerable GetRelatedDocuments(DocumentSnapshot document); + public abstract Task> GetTagHelpersAsync(); public abstract bool TryGetTagHelpers(out IReadOnlyList result); diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectState.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectState.cs index 6670ba55a2..7708b0c709 100644 --- a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectState.cs +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectState.cs @@ -3,7 +3,11 @@ using System; using System.Collections.Generic; +using System.Collections.Immutable; +using System.IO; +using System.Linq; using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Language; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Text; @@ -12,12 +16,24 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem // Internal tracker for DefaultProjectSnapshot internal class ProjectState { - private static readonly IReadOnlyDictionary EmptyDocuments = new Dictionary(); + private const ProjectDifference ClearComputedStateMask = ProjectDifference.ConfigurationChanged; + private const ProjectDifference ClearCachedTagHelpersMask = + ProjectDifference.ConfigurationChanged | + ProjectDifference.WorkspaceProjectAdded | + ProjectDifference.WorkspaceProjectChanged | + ProjectDifference.WorkspaceProjectRemoved; + + private const ProjectDifference ClearDocumentCollectionVersionMask = + ProjectDifference.ConfigurationChanged | + ProjectDifference.DocumentAdded | + ProjectDifference.DocumentRemoved; + + private static readonly ImmutableDictionary EmptyDocuments = ImmutableDictionary.Create(FilePathComparer.Instance); + private static readonly ImmutableDictionary> EmptyImportsToRelatedDocuments = ImmutableDictionary.Create>(FilePathComparer.Instance); private readonly object _lock; - private ProjectEngineTracker _projectEngine; - private ProjectTagHelperTracker _tagHelpers; + private ComputedStateTracker _computedState; public static ProjectState Create(HostWorkspaceServices services, HostProject hostProject, Project workspaceProject = null) { @@ -33,7 +49,7 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem return new ProjectState(services, hostProject, workspaceProject); } - + private ProjectState( HostWorkspaceServices services, HostProject hostProject, @@ -43,7 +59,9 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem HostProject = hostProject; WorkspaceProject = workspaceProject; Documents = EmptyDocuments; + ImportsToRelatedDocuments = EmptyImportsToRelatedDocuments; Version = VersionStamp.Create(); + DocumentCollectionVersion = Version; _lock = new object(); } @@ -53,7 +71,8 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem ProjectDifference difference, HostProject hostProject, Project workspaceProject, - IReadOnlyDictionary documents) + ImmutableDictionary documents, + ImmutableDictionary> importsToRelatedDocuments) { if (older == null) { @@ -70,21 +89,49 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem throw new ArgumentNullException(nameof(documents)); } + if (importsToRelatedDocuments == null) + { + throw new ArgumentNullException(nameof(importsToRelatedDocuments)); + } + Services = older.Services; Version = older.Version.GetNewerVersion(); HostProject = hostProject; WorkspaceProject = workspaceProject; Documents = documents; + ImportsToRelatedDocuments = importsToRelatedDocuments; _lock = new object(); - _projectEngine = older._projectEngine?.ForkFor(this, difference); - _tagHelpers = older._tagHelpers?.ForkFor(this, difference); + if ((difference & ClearDocumentCollectionVersionMask) == 0) + { + // Document collection hasn't changed + DocumentCollectionVersion = older.DocumentCollectionVersion; + } + else + { + DocumentCollectionVersion = Version; + } + + if ((difference & ClearComputedStateMask) == 0 && older._computedState != null) + { + // Optimistically cache the RazorProjectEngine. + _computedState = new ComputedStateTracker(this, older._computedState); + } + + if ((difference & ClearCachedTagHelpersMask) == 0 && _computedState != null) + { + // It's OK to keep the computed Tag Helpers. + _computedState.TaskUnsafe = older._computedState?.TaskUnsafe; + } } // Internal set for testing. - public IReadOnlyDictionary Documents { get; internal set; } + public ImmutableDictionary Documents { get; internal set; } + + // Internal set for testing. + public ImmutableDictionary> ImportsToRelatedDocuments { get; internal set; } public HostProject HostProject { get; } @@ -92,46 +139,68 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem public Project WorkspaceProject { get; } + /// + /// Gets the version of this project, INCLUDING content changes. The is + /// incremented for each new instance created. + /// public VersionStamp Version { get; } - // Computed State - public ProjectEngineTracker ProjectEngine + /// + /// Gets the version of this project, NOT INCLUDING computed or content changes. The + /// is incremented each time the configuration changes or + /// a document is added or removed. + /// + public VersionStamp DocumentCollectionVersion { get; } + + public RazorProjectEngine ProjectEngine => ComputedState.ProjectEngine; + + public bool IsTagHelperResultAvailable => ComputedState.TaskUnsafe?.IsCompleted == true; + + private ComputedStateTracker ComputedState { get { - if (_projectEngine == null) + if (_computedState == null) { lock (_lock) { - if (_projectEngine == null) + if (_computedState == null) { - _projectEngine = new ProjectEngineTracker(this); + _computedState = new ComputedStateTracker(this); } } } - return _projectEngine; + return _computedState; } } - // Computed State - public ProjectTagHelperTracker TagHelpers + /// + /// Gets the version of this project based on the computed state, NOT INCLUDING content + /// changes. The computed state is guaranteed to change when the configuration or tag helpers + /// change. + /// + /// Asynchronously returns the computed version. + public async Task GetComputedStateVersionAsync(ProjectSnapshot snapshot) { - get + if (snapshot == null) { - if (_tagHelpers == null) - { - lock (_lock) - { - if (_tagHelpers == null) - { - _tagHelpers = new ProjectTagHelperTracker(this); - } - } - } - - return _tagHelpers; + throw new ArgumentNullException(nameof(snapshot)); } + + var (_, version) = await ComputedState.GetTagHelpersAndVersionAsync(snapshot).ConfigureAwait(false); + return version; + } + + public async Task> GetTagHelpersAsync(ProjectSnapshot snapshot) + { + if (snapshot == null) + { + throw new ArgumentNullException(nameof(snapshot)); + } + + var (tagHelpers, _) = await ComputedState.GetTagHelpersAndVersionAsync(snapshot).ConfigureAwait(false); + return tagHelpers; } public ProjectState WithAddedHostDocument(HostDocument hostDocument, Func> loader) @@ -153,16 +222,23 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem return this; } - var documents = new Dictionary(FilePathComparer.Instance); - foreach (var kvp in Documents) - { - documents.Add(kvp.Key, kvp.Value); - } - - documents.Add(hostDocument.FilePath, DocumentState.Create(Services, hostDocument, loader)); + var documents = Documents.Add(hostDocument.FilePath, DocumentState.Create(Services, hostDocument, loader)); - var difference = ProjectDifference.DocumentAdded; - var state = new ProjectState(this, difference, HostProject, WorkspaceProject, documents); + // Compute the effect on the import map + var importTargetPaths = GetImportDocumentTargetPaths(hostDocument.TargetPath); + var importsToRelatedDocuments = AddToImportsToRelatedDocuments(ImportsToRelatedDocuments, hostDocument, importTargetPaths); + + // Now check if the updated document is an import - it's important this this happens after + // updating the imports map. + if (importsToRelatedDocuments.TryGetValue(hostDocument.TargetPath, out var relatedDocuments)) + { + foreach (var relatedDocument in relatedDocuments) + { + documents = documents.SetItem(relatedDocument, documents[relatedDocument].WithImportsChange()); + } + } + + var state = new ProjectState(this, ProjectDifference.DocumentAdded, HostProject, WorkspaceProject, documents, importsToRelatedDocuments); return state; } @@ -178,16 +254,23 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem return this; } - var documents = new Dictionary(FilePathComparer.Instance); - foreach (var kvp in Documents) + var documents = Documents.Remove(hostDocument.FilePath); + + // First check if the updated document is an import - it's important that this happens + // before updating the imports map. + if (ImportsToRelatedDocuments.TryGetValue(hostDocument.TargetPath, out var relatedDocuments)) { - documents.Add(kvp.Key, kvp.Value); + foreach (var relatedDocument in relatedDocuments) + { + documents = documents.SetItem(relatedDocument, documents[relatedDocument].WithImportsChange()); + } } - documents.Remove(hostDocument.FilePath); + // Compute the effect on the import map + var importTargetPaths = GetImportDocumentTargetPaths(hostDocument.TargetPath); + var importsToRelatedDocuments = RemoveFromImportsToRelatedDocuments(ImportsToRelatedDocuments, hostDocument, importTargetPaths); - var difference = ProjectDifference.DocumentRemoved; - var state = new ProjectState(this, difference, HostProject, WorkspaceProject, documents); + var state = new ProjectState(this, ProjectDifference.DocumentRemoved, HostProject, WorkspaceProject, documents, importsToRelatedDocuments); return state; } @@ -198,23 +281,22 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem throw new ArgumentNullException(nameof(hostDocument)); } - if (!Documents.ContainsKey(hostDocument.FilePath)) + if (!Documents.TryGetValue(hostDocument.FilePath, out var document)) { return this; } - var documents = new Dictionary(FilePathComparer.Instance); - foreach (var kvp in Documents) + var documents = Documents.SetItem(hostDocument.FilePath, document.WithText(sourceText, version)); + + if (ImportsToRelatedDocuments.TryGetValue(hostDocument.TargetPath, out var relatedDocuments)) { - documents.Add(kvp.Key, kvp.Value); + foreach (var relatedDocument in relatedDocuments) + { + documents = documents.SetItem(relatedDocument, documents[relatedDocument].WithImportsChange()); + } } - if (documents.TryGetValue(hostDocument.FilePath, out var document)) - { - documents[hostDocument.FilePath] = document.WithText(sourceText, version); - } - - var state = new ProjectState(this, ProjectDifference.DocumentChanged, HostProject, WorkspaceProject, documents); + var state = new ProjectState(this, ProjectDifference.DocumentChanged, HostProject, WorkspaceProject, documents, ImportsToRelatedDocuments); return state; } @@ -225,23 +307,22 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem throw new ArgumentNullException(nameof(hostDocument)); } - if (!Documents.ContainsKey(hostDocument.FilePath)) + if (!Documents.TryGetValue(hostDocument.FilePath, out var document)) { return this; } - var documents = new Dictionary(FilePathComparer.Instance); - foreach (var kvp in Documents) + var documents = Documents.SetItem(hostDocument.FilePath, document.WithTextLoader(loader)); + + if (ImportsToRelatedDocuments.TryGetValue(hostDocument.TargetPath, out var relatedDocuments)) { - documents.Add(kvp.Key, kvp.Value); + foreach (var relatedDocument in relatedDocuments) + { + documents = documents.SetItem(relatedDocument, documents[relatedDocument].WithImportsChange()); + } } - if (documents.TryGetValue(hostDocument.FilePath, out var document)) - { - documents[hostDocument.FilePath] = document.WithTextLoader(loader); - } - - var state = new ProjectState(this, ProjectDifference.DocumentChanged, HostProject, WorkspaceProject, documents); + var state = new ProjectState(this, ProjectDifference.DocumentChanged, HostProject, WorkspaceProject, documents, ImportsToRelatedDocuments); return state; } @@ -257,14 +338,18 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem return this; } - var difference = ProjectDifference.ConfigurationChanged; - var documents = new Dictionary(FilePathComparer.Instance); - foreach (var kvp in Documents) + var documents = Documents.ToImmutableDictionary(kvp => kvp.Key, kvp => kvp.Value.WithConfigurationChange(), FilePathComparer.Instance); + + // If the host project has changed then we need to recompute the imports map + var importsToRelatedDocuments = EmptyImportsToRelatedDocuments; + + foreach (var document in documents) { - documents.Add(kvp.Key, kvp.Value.WithConfigurationChange()); + var importTargetPaths = GetImportDocumentTargetPaths(document.Value.HostDocument.TargetPath); + importsToRelatedDocuments = AddToImportsToRelatedDocuments(ImportsToRelatedDocuments, document.Value.HostDocument, importTargetPaths); } - var state = new ProjectState(this, difference, hostProject, WorkspaceProject, documents); + var state = new ProjectState(this, ProjectDifference.ConfigurationChanged, hostProject, WorkspaceProject, documents, importsToRelatedDocuments); return state; } @@ -291,14 +376,161 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem return this; } - var documents = new Dictionary(FilePathComparer.Instance); - foreach (var kvp in Documents) + var documents = Documents.ToImmutableDictionary(kvp => kvp.Key, kvp => kvp.Value.WithWorkspaceProjectChange(), FilePathComparer.Instance); + var state = new ProjectState(this, difference, HostProject, workspaceProject, documents, ImportsToRelatedDocuments); + return state; + } + + private static ImmutableDictionary> AddToImportsToRelatedDocuments( + ImmutableDictionary> importsToRelatedDocuments, + HostDocument hostDocument, + List importTargetPaths) + { + foreach (var importTargetPath in importTargetPaths) { - documents.Add(kvp.Key, kvp.Value.WithWorkspaceProjectChange()); + if (!importsToRelatedDocuments.TryGetValue(importTargetPath, out var relatedDocuments)) + { + relatedDocuments = ImmutableArray.Create(); + } + + relatedDocuments = relatedDocuments.Add(hostDocument.FilePath); + importsToRelatedDocuments = importsToRelatedDocuments.SetItem(importTargetPath, relatedDocuments); } - var state = new ProjectState(this, difference, HostProject, workspaceProject, documents); - return state; + return importsToRelatedDocuments; + } + + private static ImmutableDictionary> RemoveFromImportsToRelatedDocuments( + ImmutableDictionary> importsToRelatedDocuments, + HostDocument hostDocument, + List importTargetPaths) + { + foreach (var importTargetPath in importTargetPaths) + { + if (importsToRelatedDocuments.TryGetValue(importTargetPath, out var relatedDocuments)) + { + relatedDocuments = relatedDocuments.Remove(hostDocument.FilePath); + if (relatedDocuments.Length > 0) + { + importsToRelatedDocuments = importsToRelatedDocuments.SetItem(importTargetPath, relatedDocuments); + } + else + { + importsToRelatedDocuments = importsToRelatedDocuments.Remove(importTargetPath); + } + } + } + + return importsToRelatedDocuments; + } + + private RazorProjectEngine CreateProjectEngine() + { + var factory = Services.GetRequiredService(); + return factory.Create(HostProject.Configuration, Path.GetDirectoryName(HostProject.FilePath), configure: null); + } + + public List GetImportDocumentTargetPaths(string targetPath) + { + var projectEngine = ComputedState.ProjectEngine; + var importFeature = projectEngine.ProjectFeatures.OfType().FirstOrDefault(); + var projectItem = projectEngine.FileSystem.GetItem(targetPath); + var importItems = importFeature?.GetImports(projectItem).Where(i => i.FilePath != null); + + // Target path looks like `Foo\\Bar.cshtml` + var targetPaths = new List(); + foreach (var importItem in importItems) + { + var itemTargetPath = importItem.FilePath.Replace('/', '\\').TrimStart('\\'); + targetPaths.Add(itemTargetPath); + } + + return targetPaths; + } + + // ComputedStateTracker is the 'holder' of all of the state that can be cached based on + // the data in a ProjectState. It should not hold onto a ProjectState directly + // as that could lead to things being in memory longer than we want them to. + // + // Rather, a ComputedStateTracker instance can hold on to a previous instance from an older + // version of the same project. + private class ComputedStateTracker + { + // ProjectState.Version + private readonly VersionStamp _projectStateVersion; + private readonly object _lock; + + private ComputedStateTracker _older; // We be set to null when state is computed + public Task<(IReadOnlyList, VersionStamp)> TaskUnsafe; + + public ComputedStateTracker(ProjectState state, ComputedStateTracker older = null) + { + _projectStateVersion = state.Version; + _lock = state._lock; + _older = older; + + ProjectEngine = _older?.ProjectEngine; + if (ProjectEngine == null) + { + ProjectEngine = state.CreateProjectEngine(); + } + } + + public RazorProjectEngine ProjectEngine { get; } + + public Task<(IReadOnlyList, VersionStamp)> GetTagHelpersAndVersionAsync(ProjectSnapshot snapshot) + { + if (TaskUnsafe == null) + { + lock (_lock) + { + if (TaskUnsafe == null) + { + TaskUnsafe = GetTagHelpersAndVersionCoreAsync(snapshot); + } + } + } + + return TaskUnsafe; + } + + private async Task<(IReadOnlyList, VersionStamp)> GetTagHelpersAndVersionCoreAsync(ProjectSnapshot snapshot) + { + // Don't allow synchronous execution - we expect this to always be called with the lock. + await Task.Yield(); + + var services = ((DefaultProjectSnapshot)snapshot).State.Services; + var resolver = services.GetLanguageServices(RazorLanguage.Name).GetRequiredService(); + + var tagHelpers = (await resolver.GetTagHelpersAsync(snapshot).ConfigureAwait(false)).Descriptors; + if (_older?.TaskUnsafe != null) + { + // We have something to diff against. + var (olderTagHelpers, olderVersion) = await _older.TaskUnsafe.ConfigureAwait(false); + + var difference = new HashSet(TagHelperDescriptorComparer.Default); + difference.UnionWith(olderTagHelpers); + difference.SymmetricExceptWith(tagHelpers); + + if (difference.Count == 0) + { + lock (_lock) + { + + // Everything is the same. Return the cached version. + TaskUnsafe = _older.TaskUnsafe; + _older = null; + return (olderTagHelpers, olderVersion); + } + } + } + + lock (_lock) + { + _older = null; + return (tagHelpers, _projectStateVersion); + } + } } } } diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectTagHelperTracker.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectTagHelperTracker.cs deleted file mode 100644 index 0c3be4ddec..0000000000 --- a/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectTagHelperTracker.cs +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis.Host; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - internal class ProjectTagHelperTracker - { - private const ProjectDifference Mask = - ProjectDifference.ConfigurationChanged | - ProjectDifference.WorkspaceProjectAdded | - ProjectDifference.WorkspaceProjectChanged | - ProjectDifference.WorkspaceProjectRemoved; - - private readonly object _lock = new object(); - private readonly HostWorkspaceServices _services; - - private Task> _task; - - public ProjectTagHelperTracker(ProjectState state) - { - if (state == null) - { - throw new ArgumentNullException(nameof(state)); - } - - _services = state.Services; - } - - public bool IsResultAvailable => _task?.IsCompleted == true; - - public ProjectTagHelperTracker ForkFor(ProjectState state, ProjectDifference difference) - { - if (state == null) - { - throw new ArgumentNullException(nameof(state)); - } - - if ((difference & Mask) != 0) - { - return null; - } - - return this; - } - - public Task> GetTagHelperInitializationTask(ProjectSnapshot snapshot) - { - if (snapshot == null) - { - throw new ArgumentNullException(nameof(snapshot)); - } - - if (_task == null) - { - lock (_lock) - { - if (_task == null) - { - _task = GetTagHelperInitializationTaskCore(snapshot); - } - } - } - - return _task; - } - - private async Task> GetTagHelperInitializationTaskCore(ProjectSnapshot snapshot) - { - var resolver = _services.GetLanguageServices(RazorLanguage.Name).GetRequiredService(); - return (await resolver.GetTagHelpersAsync(snapshot)).Descriptors; - } - } -} diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/Properties/AssemblyInfo.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/Properties/AssemblyInfo.cs index fefb5cd1de..905e1822ed 100644 --- a/src/Microsoft.CodeAnalysis.Razor.Workspaces/Properties/AssemblyInfo.cs +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/Properties/AssemblyInfo.cs @@ -2,6 +2,8 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Runtime.CompilerServices; +[assembly: InternalsVisibleTo("rzls, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] +[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Razor.LanguageServer.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.VisualStudio.LiveShare.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.VisualStudio.LiveShare.Razor, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.AspNetCore.Razor.Performance, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/RazorCompletionFactsService.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/RazorCompletionFactsService.cs new file mode 100644 index 0000000000..f5051dd536 --- /dev/null +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/RazorCompletionFactsService.cs @@ -0,0 +1,13 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Generic; +using Microsoft.AspNetCore.Razor.Language; + +namespace Microsoft.CodeAnalysis.Razor +{ + internal abstract class RazorCompletionFactsService + { + public abstract IReadOnlyList GetCompletionItems(RazorSyntaxTree syntaxTree, SourceSpan location); + } +} diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/RazorCompletionItem.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/RazorCompletionItem.cs new file mode 100644 index 0000000000..87bf19c858 --- /dev/null +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/RazorCompletionItem.cs @@ -0,0 +1,45 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; + +namespace Microsoft.CodeAnalysis.Razor +{ + internal sealed class RazorCompletionItem + { + public RazorCompletionItem( + string displayText, + string insertText, + string description, + RazorCompletionItemKind kind) + { + if (displayText == null) + { + throw new ArgumentNullException(nameof(displayText)); + } + + if (insertText == null) + { + throw new ArgumentNullException(nameof(insertText)); + } + + if (description == null) + { + throw new ArgumentNullException(nameof(description)); + } + + DisplayText = displayText; + InsertText = insertText; + Description = description; + Kind = kind; + } + + public string DisplayText { get; } + + public string InsertText { get; } + + public string Description { get; } + + public RazorCompletionItemKind Kind { get; } + } +} diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/RazorCompletionItemKind.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/RazorCompletionItemKind.cs new file mode 100644 index 0000000000..64d2e1ccca --- /dev/null +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/RazorCompletionItemKind.cs @@ -0,0 +1,10 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +namespace Microsoft.CodeAnalysis.Razor +{ + internal enum RazorCompletionItemKind + { + Directive + } +} diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/RazorDocumentExcerptService.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/RazorDocumentExcerptService.cs new file mode 100644 index 0000000000..6fe7d9b979 --- /dev/null +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/RazorDocumentExcerptService.cs @@ -0,0 +1,192 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.CodeAnalysis.Classification; +using Microsoft.CodeAnalysis.Host; +using Microsoft.CodeAnalysis.Razor.ProjectSystem; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.CodeAnalysis.Razor +{ + internal class RazorDocumentExcerptService : IDocumentExcerptService + { + private readonly DocumentSnapshot _document; + private readonly ISpanMappingService _mapper; + + public RazorDocumentExcerptService(DocumentSnapshot document, ISpanMappingService mapper) + { + if (mapper == null) + { + throw new ArgumentNullException(nameof(mapper)); + } + + _document = document; + _mapper = mapper; + } + + public async Task TryExcerptAsync( + Document document, + TextSpan span, + ExcerptMode mode, + CancellationToken cancellationToken) + { + if (_document == null) + { + return null; + } + + var mapped = await _mapper.MapSpansAsync(document, new[] { span }, cancellationToken).ConfigureAwait(false); + if (mapped.Length == 0 || mapped[0].Equals(default(MappedSpanResult))) + { + return null; + } + + var project = _document.Project; + var primaryDocument = project.GetDocument(mapped[0].FilePath); + if (primaryDocument == null) + { + return null; + } + + var primaryText = await primaryDocument.GetTextAsync().ConfigureAwait(false); + var primarySpan = primaryText.Lines.GetTextSpan(mapped[0].LinePositionSpan); + + var secondaryDocument = document; + var secondarySpan = span; + + // First compute the range of text we want to we to display relative to the primary document. + var excerptSpan = ChooseExcerptSpan(primaryText, primarySpan, mode); + + // Then we'll classify the spans based on the primary document, since that's the coordinate + // space that our output mappings use. + var output = await _document.GetGeneratedOutputAsync().ConfigureAwait(false); + var mappings = output.GetCSharpDocument().SourceMappings; + var classifiedSpans = await ClassifyPreviewAsync( + primaryText, + excerptSpan, + secondaryDocument, + mappings, + cancellationToken).ConfigureAwait(false); + + // Now translate everything to be relative to the excerpt + var offset = 0 - excerptSpan.Start; + var excerptText = primaryText.GetSubText(excerptSpan); + excerptSpan = new TextSpan(excerptSpan.Start + offset, excerptSpan.Length); + + for (var i = 0; i < classifiedSpans.Count; i++) + { + var classifiedSpan = classifiedSpans[i]; + var updated = new TextSpan(classifiedSpan.TextSpan.Start + offset, classifiedSpan.TextSpan.Length); + Debug.Assert(excerptSpan.Contains(updated)); + + classifiedSpans[i] = new ClassifiedSpan(classifiedSpan.ClassificationType, updated); + } + + return new ExcerptResult(excerptText, excerptSpan, classifiedSpans.ToImmutable(), document, span); + } + + private TextSpan ChooseExcerptSpan(SourceText primaryText, TextSpan primarySpan, ExcerptMode mode) + { + var startLine = primaryText.Lines.GetLineFromPosition(primarySpan.Start); + var endLine = primaryText.Lines.GetLineFromPosition(primarySpan.End); + + // If we're showing a single line then this will do. Otherwise expand the range by 1 in + // each direction (if possible). + if (mode == ExcerptMode.Tooltip && startLine.LineNumber > 0) + { + startLine = primaryText.Lines[startLine.LineNumber - 1]; + } + + if (mode == ExcerptMode.Tooltip && endLine.LineNumber < primaryText.Lines.Count - 1) + { + endLine = primaryText.Lines[endLine.LineNumber + 1]; + } + + return new TextSpan(startLine.Start, endLine.End - startLine.Start); + } + + private async Task.Builder> ClassifyPreviewAsync( + SourceText primaryText, + TextSpan excerptSpan, + Document secondaryDocument, + IReadOnlyList mappings, + CancellationToken cancellationToken) + { + var builder = ImmutableArray.CreateBuilder(); + + var sorted = new List(mappings); + sorted.Sort((x, y) => x.OriginalSpan.AbsoluteIndex.CompareTo(y.OriginalSpan.AbsoluteIndex)); + + // The algorithm here is to iterate through the source mappings (sorted) and use the C# classifier + // on the spans that are known to the C#. For the spans that are not known to be C# then + // we just treat them as text since we'd don't currently have our own classifications. + + var remainingSpan = excerptSpan; + for (var i = 0; i < sorted.Count && excerptSpan.Length > 0; i++) + { + var primarySpan = sorted[i].OriginalSpan.AsTextSpan(); + var intersection = primarySpan.Intersection(remainingSpan); + if (intersection == null) + { + // This span is outside the area we're interested in. + continue; + } + + // OK this span intersects with the excerpt span, so we will process it. Let's compute + // the secondary span that matches the intersection. + var secondarySpan = sorted[i].GeneratedSpan.AsTextSpan(); + secondarySpan = new TextSpan(secondarySpan.Start + intersection.Value.Start - primarySpan.Start, intersection.Value.Length); + primarySpan = intersection.Value; + + if (remainingSpan.Start < primarySpan.Start) + { + // The position is before the next C# span. Classify everything up to the C# start + // as text. + builder.Add(new ClassifiedSpan(ClassificationTypeNames.Text, new TextSpan(remainingSpan.Start, primarySpan.Start - remainingSpan.Start))); + + // Advance to the start of the C# span. + remainingSpan = new TextSpan(primarySpan.Start, remainingSpan.Length - (primarySpan.Start - remainingSpan.Start)); + } + + // We should be able to process this whole span as C#, so classify it. + // + // However, we'll have to translate it to the the secondary document's coordinates to do that. + Debug.Assert(remainingSpan.Contains(primarySpan) && remainingSpan.Start == primarySpan.Start); + var classifiedSecondarySpans = await Classifier.GetClassifiedSpansAsync( + secondaryDocument, + secondarySpan, + cancellationToken); + + // Now we have to translate back to the primary document's coordinates. + var offset = primarySpan.Start - secondarySpan.Start; + foreach (var classifiedSecondarySpan in classifiedSecondarySpans) + { + Debug.Assert(secondarySpan.Contains(classifiedSecondarySpan.TextSpan)); + + var updated = new TextSpan(classifiedSecondarySpan.TextSpan.Start + offset, classifiedSecondarySpan.TextSpan.Length); + Debug.Assert(primarySpan.Contains(updated)); + + builder.Add(new ClassifiedSpan(classifiedSecondarySpan.ClassificationType, updated)); + } + + remainingSpan = new TextSpan(primarySpan.End, remainingSpan.Length - primarySpan.Length); + } + + // Deal with residue + if (remainingSpan.Length > 0) + { + // Trailing Razor/markup text. + builder.Add(new ClassifiedSpan(ClassificationTypeNames.Text, remainingSpan)); + } + + return builder; + } + } +} \ No newline at end of file diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/RazorDocumentServiceProvider.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/RazorDocumentServiceProvider.cs new file mode 100644 index 0000000000..68a38f1c08 --- /dev/null +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/RazorDocumentServiceProvider.cs @@ -0,0 +1,71 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using Microsoft.CodeAnalysis.Razor; +using Microsoft.CodeAnalysis.Razor.ProjectSystem; + +namespace Microsoft.CodeAnalysis.Host +{ + internal class RazorDocumentServiceProvider : IDocumentServiceProvider, IDocumentOperationService + { + private readonly DocumentSnapshot _document; + private readonly object _lock; + + private RazorSpanMappingService _spanMappingService; + private RazorDocumentExcerptService _excerptService; + + public RazorDocumentServiceProvider() + : this(null) + { + } + + public RazorDocumentServiceProvider(DocumentSnapshot document) + { + _document = document; + + _lock = new object(); + } + + public bool CanApplyChange => false; + + public bool SupportDiagnostics => false; + + public TService GetService() where TService : class, IDocumentService + { + if (typeof(TService) == typeof(ISpanMappingService)) + { + if (_spanMappingService == null) + { + lock (_lock) + { + if (_spanMappingService == null) + { + _spanMappingService = new RazorSpanMappingService(_document); + } + } + } + + return (TService)(object)_spanMappingService; + } + + if (typeof(TService) == typeof(IDocumentExcerptService)) + { + if (_excerptService == null) + { + lock (_lock) + { + if (_excerptService == null) + { + _excerptService = new RazorDocumentExcerptService(_document, GetService()); + } + } + } + + return (TService)(object)_excerptService; + } + + return this as TService; + } + } +} diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/RazorSpanMappingService.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/RazorSpanMappingService.cs new file mode 100644 index 0000000000..7303d8a69a --- /dev/null +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/RazorSpanMappingService.cs @@ -0,0 +1,102 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.CodeAnalysis.Host; +using Microsoft.CodeAnalysis.Razor.ProjectSystem; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.CodeAnalysis.Razor +{ + internal class RazorSpanMappingService: ISpanMappingService + { + private readonly DocumentSnapshot _document; + + public RazorSpanMappingService(DocumentSnapshot document) + { + if (document == null) + { + throw new ArgumentNullException(nameof(document)); + } + + _document = document; + } + + public async Task> MapSpansAsync( + Document document, + IEnumerable spans, + CancellationToken cancellationToken) + { + if (document == null) + { + throw new ArgumentNullException(nameof(document)); + } + + if (spans == null) + { + throw new ArgumentNullException(nameof(spans)); + } + + // Called on an uninitialized document. + if (_document == null) + { + return ImmutableArray.Create(); + } + + var source = await _document.GetTextAsync().ConfigureAwait(false); + var output = await _document.GetGeneratedOutputAsync().ConfigureAwait(false); + + var results = ImmutableArray.CreateBuilder(); + foreach (var span in spans) + { + if (TryGetLinePositionSpan(span, source, output.GetCSharpDocument(), out var linePositionSpan)) + { + results.Add(new MappedSpanResult(output.Source.FilePath, linePositionSpan, span)); + } + else + { + results.Add(default); + } + } + + return results.ToImmutable(); + } + + // Internal for testing. + internal static bool TryGetLinePositionSpan(TextSpan span, SourceText source, RazorCSharpDocument output, out LinePositionSpan linePositionSpan) + { + var mappings = output.SourceMappings; + for (var i = 0; i < mappings.Count; i++) + { + var mapping = mappings[i]; + var original = mapping.OriginalSpan.AsTextSpan(); + var generated = mapping.GeneratedSpan.AsTextSpan(); + + if (!generated.Contains(span)) + { + // If the search span isn't contained within the generated span, it is not a match. + // A C# identifier won't cover multiple generated spans. + continue; + } + + var leftOffset = span.Start - generated.Start; + var rightOffset = span.End - generated.End; + if (leftOffset >= 0 && rightOffset <= 0) + { + // This span mapping contains the span. + var adjusted = new TextSpan(original.Start + leftOffset, (original.End + rightOffset) - (original.Start + leftOffset)); + linePositionSpan = source.Lines.GetLinePositionSpan(adjusted); + return true; + } + } + + linePositionSpan = default; + return false; + } + } +} diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/TagHelperResolutionResult.cs b/src/Microsoft.CodeAnalysis.Razor.Workspaces/TagHelperResolutionResult.cs index 0e8c7b19ef..581892a9fb 100644 --- a/src/Microsoft.CodeAnalysis.Razor.Workspaces/TagHelperResolutionResult.cs +++ b/src/Microsoft.CodeAnalysis.Razor.Workspaces/TagHelperResolutionResult.cs @@ -7,9 +7,9 @@ using Microsoft.AspNetCore.Razor.Language; namespace Microsoft.CodeAnalysis.Razor { - public sealed class TagHelperResolutionResult + internal sealed class TagHelperResolutionResult { - internal static TagHelperResolutionResult Empty = new TagHelperResolutionResult(Array.Empty(), Array.Empty()); + internal static readonly TagHelperResolutionResult Empty = new TagHelperResolutionResult(Array.Empty(), Array.Empty()); public TagHelperResolutionResult(IReadOnlyList descriptors, IReadOnlyList diagnostics) { diff --git a/src/Microsoft.CodeAnalysis.Razor/Properties/AssemblyInfo.cs b/src/Microsoft.CodeAnalysis.Razor/Properties/AssemblyInfo.cs index 0de18b91dc..2da745cbad 100644 --- a/src/Microsoft.CodeAnalysis.Razor/Properties/AssemblyInfo.cs +++ b/src/Microsoft.CodeAnalysis.Razor/Properties/AssemblyInfo.cs @@ -2,7 +2,8 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Runtime.CompilerServices; - +[assembly: InternalsVisibleTo("rzls, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] +[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Razor.LanguageServer.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.VisualStudio.LiveShare.Razor, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.VisualStudio.LiveShare.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.CodeAnalysis.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] diff --git a/src/Microsoft.CodeAnalysis.Razor/SourceSpanExtensions.cs b/src/Microsoft.CodeAnalysis.Razor/SourceSpanExtensions.cs new file mode 100644 index 0000000000..51fd517024 --- /dev/null +++ b/src/Microsoft.CodeAnalysis.Razor/SourceSpanExtensions.cs @@ -0,0 +1,16 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.CodeAnalysis.Razor +{ + internal static class SourceSpanExtensions + { + public static TextSpan AsTextSpan(this SourceSpan sourceSpan) + { + return new TextSpan(sourceSpan.AbsoluteIndex, sourceSpan.Length); + } + } +} diff --git a/src/Microsoft.CodeAnalysis.Remote.Razor/RazorServiceBase.cs b/src/Microsoft.CodeAnalysis.Remote.Razor/RazorServiceBase.cs index 289d75cc0f..32e8e3bcb6 100644 --- a/src/Microsoft.CodeAnalysis.Remote.Razor/RazorServiceBase.cs +++ b/src/Microsoft.CodeAnalysis.Remote.Razor/RazorServiceBase.cs @@ -76,6 +76,16 @@ namespace Microsoft.CodeAnalysis.Remote.Razor return null; } + public override bool IsImportDocument(DocumentSnapshot document) + { + throw new NotImplementedException(); + } + + public override IEnumerable GetRelatedDocuments(DocumentSnapshot document) + { + throw new NotImplementedException(); + } + public override RazorProjectEngine GetProjectEngine() { throw new NotImplementedException(); diff --git a/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.DesignTime.targets b/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.DesignTime.targets index 64c5d8f61a..9aaafbd17c 100644 --- a/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.DesignTime.targets +++ b/src/Microsoft.NET.Sdk.Razor/build/netstandard2.0/Microsoft.NET.Sdk.Razor.DesignTime.targets @@ -43,6 +43,9 @@ Copyright (c) .NET Foundation. All rights reserved. Project + + Project + diff --git a/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorIndentationFactsService.cs b/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorIndentationFactsService.cs index f69274fa15..f8776d6993 100644 --- a/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorIndentationFactsService.cs +++ b/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorIndentationFactsService.cs @@ -143,8 +143,7 @@ namespace Microsoft.VisualStudio.Editor.Razor { return currentChild is Span currentSpan && currentSpan.Tokens.Count == 1 && - currentSpan.Tokens[0] is CSharpToken symbol && - symbol.Type == CSharpTokenType.LeftBrace; + currentSpan.Tokens[0].Kind == SyntaxKind.LeftBrace; } } } diff --git a/src/Microsoft.VisualStudio.Editor.Razor/Microsoft.VisualStudio.Editor.Razor.csproj b/src/Microsoft.VisualStudio.Editor.Razor/Microsoft.VisualStudio.Editor.Razor.csproj index aa50d39965..3af8804777 100644 --- a/src/Microsoft.VisualStudio.Editor.Razor/Microsoft.VisualStudio.Editor.Razor.csproj +++ b/src/Microsoft.VisualStudio.Editor.Razor/Microsoft.VisualStudio.Editor.Razor.csproj @@ -9,7 +9,10 @@ - + + + + diff --git a/src/Microsoft.VisualStudio.Editor.Razor/Properties/AssemblyInfo.cs b/src/Microsoft.VisualStudio.Editor.Razor/Properties/AssemblyInfo.cs index 47ff95c911..1099d78d69 100644 --- a/src/Microsoft.VisualStudio.Editor.Razor/Properties/AssemblyInfo.cs +++ b/src/Microsoft.VisualStudio.Editor.Razor/Properties/AssemblyInfo.cs @@ -2,6 +2,8 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Runtime.CompilerServices; +[assembly: InternalsVisibleTo("rzls, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] +[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Razor.LanguageServer.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.VisualStudio.LiveShare.Razor, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.VisualStudio.LiveShare.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.VisualStudio.Editor.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] diff --git a/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionProvider.cs b/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionProvider.cs index 6a2d017716..66505c2115 100644 --- a/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionProvider.cs +++ b/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionProvider.cs @@ -16,6 +16,7 @@ using Microsoft.CodeAnalysis.Completion; using Microsoft.CodeAnalysis.Razor; using Microsoft.CodeAnalysis.Tags; using Microsoft.CodeAnalysis.Text; +using Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text.Projection; @@ -36,16 +37,33 @@ namespace Microsoft.VisualStudio.Editor.Razor CSharpCodeParser.TagHelperPrefixDirectiveDescriptor, }; private readonly Lazy _codeDocumentProvider; + private readonly Lazy _dependencies; + private readonly RazorTextBufferProvider _textBufferProvider; [ImportingConstructor] - public RazorDirectiveCompletionProvider([Import(typeof(RazorCodeDocumentProvider))] Lazy codeDocumentProvider) + public RazorDirectiveCompletionProvider( + [Import(typeof(RazorCodeDocumentProvider))] Lazy codeDocumentProvider, + [Import(typeof(CompletionProviderDependencies))] Lazy dependencies, + RazorTextBufferProvider textBufferProvider) { if (codeDocumentProvider == null) { throw new ArgumentNullException(nameof(codeDocumentProvider)); } + if (dependencies == null) + { + throw new ArgumentNullException(nameof(dependencies)); + } + + if (textBufferProvider == null) + { + throw new ArgumentNullException(nameof(textBufferProvider)); + } + _codeDocumentProvider = codeDocumentProvider; + _dependencies = dependencies; + _textBufferProvider = textBufferProvider; } public override Task GetDescriptionAsync(Document document, CompletionItem item, CancellationToken cancellationToken) @@ -96,6 +114,13 @@ namespace Microsoft.VisualStudio.Editor.Razor [MethodImpl(MethodImplOptions.NoInlining)] private Task AddCompletionItems(CompletionContext context) { + if (!_textBufferProvider.TryGetFromDocument(context.Document, out var textBuffer) || + !_dependencies.Value.AsyncCompletionBroker.IsCompletionSupported(textBuffer.ContentType)) + { + // Completion is not supported. + return Task.CompletedTask; + } + if (!_codeDocumentProvider.Value.TryGetFromDocument(context.Document, out var codeDocument)) { // A Razor code document has not yet been associated with the document. @@ -109,70 +134,41 @@ namespace Microsoft.VisualStudio.Editor.Razor return Task.CompletedTask; } - if (!AtDirectiveCompletionPoint(syntaxTree, context)) + if (!TryGetRazorSnapshotPoint(context, out var razorSnapshotPoint)) { - // Can't have a valid directive at the current location. + // Could not find associated Razor location. return Task.CompletedTask; } - var completionItems = GetCompletionItems(syntaxTree); - context.AddItems(completionItems); + var location = new SourceSpan(razorSnapshotPoint.Position, 0); + var razorCompletionItems = _dependencies.Value.CompletionFactsService.GetCompletionItems(syntaxTree, location); - return Task.CompletedTask; - } - - // Internal virtual for testing - internal virtual IEnumerable GetCompletionItems(RazorSyntaxTree syntaxTree) - { - var directives = syntaxTree.Options.Directives.Concat(DefaultDirectives); - var completionItems = new List(); - foreach (var directive in directives) + foreach (var razorCompletionItem in razorCompletionItems) { - var propertyDictionary = new Dictionary(StringComparer.Ordinal); - - if (!string.IsNullOrEmpty(directive.Description)) + if (razorCompletionItem.Kind != RazorCompletionItemKind.Directive) { - propertyDictionary[DescriptionKey] = directive.Description; + // Don't support any other types of completion kinds other than directives. + continue; + } + + var propertyDictionary = new Dictionary(StringComparer.Ordinal); + if (!string.IsNullOrEmpty(razorCompletionItem.Description)) + { + propertyDictionary[DescriptionKey] = razorCompletionItem.Description; } var completionItem = CompletionItem.Create( - directive.Directive, + razorCompletionItem.InsertText, // This groups all Razor directives together sortText: "_RazorDirective_", rules: CompletionItemRules.Create(formatOnCommit: false), tags: ImmutableArray.Create(WellKnownTags.Intrinsic), properties: propertyDictionary.ToImmutableDictionary()); - completionItems.Add(completionItem); + + context.AddItem(completionItem); } - return completionItems; - } - - // Internal for testing - internal bool AtDirectiveCompletionPoint(RazorSyntaxTree syntaxTree, CompletionContext context) - { - if (TryGetRazorSnapshotPoint(context, out var razorSnapshotPoint)) - { - var change = new SourceChange(razorSnapshotPoint.Position, 0, string.Empty); - var owner = syntaxTree.Root.LocateOwner(change); - - if (owner == null) - { - return false; - } - - if (owner.ChunkGenerator is ExpressionChunkGenerator && - owner.Tokens.All(IsDirectiveCompletableSymbol) && - // Do not provide IntelliSense for explicit expressions. Explicit expressions will usually look like: - // [@] [(] [DateTime.Now] [)] - owner.Parent?.Children.Count > 1 && - owner.Parent.Children[1] == owner) - { - return true; - } - } - - return false; + return Task.CompletedTask; } protected virtual bool TryGetRazorSnapshotPoint(CompletionContext context, out SnapshotPoint snapshotPoint) @@ -203,17 +199,41 @@ namespace Microsoft.VisualStudio.Editor.Razor return false; } + } - private static bool IsDirectiveCompletableSymbol(AspNetCore.Razor.Language.Legacy.IToken symbol) + // These types are only for this class to provide indirection for assembly loads. + internal abstract class CompletionProviderDependencies + { + public abstract RazorCompletionFactsService CompletionFactsService { get; } + + public abstract IAsyncCompletionBroker AsyncCompletionBroker { get; } + } + + [System.Composition.Shared] + [Export(typeof(CompletionProviderDependencies))] + internal class DefaultCompletionProviderDependencies : CompletionProviderDependencies + { + [ImportingConstructor] + public DefaultCompletionProviderDependencies( + RazorCompletionFactsService completionFactsService, + IAsyncCompletionBroker asyncCompletionBroker) { - if (!(symbol is CSharpToken csharpSymbol)) + if (completionFactsService == null) { - return false; + throw new ArgumentNullException(nameof(completionFactsService)); } - return csharpSymbol.Type == CSharpTokenType.Identifier || - // Marker symbol - csharpSymbol.Type == CSharpTokenType.Unknown; + if (asyncCompletionBroker == null) + { + throw new ArgumentNullException(nameof(asyncCompletionBroker)); + } + + CompletionFactsService = completionFactsService; + AsyncCompletionBroker = asyncCompletionBroker; } + + public override RazorCompletionFactsService CompletionFactsService { get; } + + public override IAsyncCompletionBroker AsyncCompletionBroker { get; } } } diff --git a/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionSource.cs b/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionSource.cs new file mode 100644 index 0000000000..30b0163971 --- /dev/null +++ b/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionSource.cs @@ -0,0 +1,119 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.CodeAnalysis.Razor; +using Microsoft.VisualStudio.Core.Imaging; +using Microsoft.VisualStudio.Imaging; +using Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion; +using Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion.Data; +using Microsoft.VisualStudio.Text; +using Microsoft.VisualStudio.Text.Adornments; + +namespace Microsoft.VisualStudio.Editor.Razor +{ + internal class RazorDirectiveCompletionSource : IAsyncCompletionSource + { + // Internal for testing + internal static readonly object DescriptionKey = new object(); + internal static readonly ImageElement DirectiveImageGlyph = new ImageElement( + new ImageId(KnownImageIds.ImageCatalogGuid, KnownImageIds.Type), + "Razor Directive."); + internal static readonly ImmutableArray DirectiveCompletionFilters = new[] { + new CompletionFilter("Razor Directive", "r", DirectiveImageGlyph) + }.ToImmutableArray(); + + // Internal for testing + internal readonly VisualStudioRazorParser _parser; + private readonly RazorCompletionFactsService _completionFactsService; + private readonly ForegroundDispatcher _foregroundDispatcher; + + public RazorDirectiveCompletionSource( + ForegroundDispatcher foregroundDispatcher, + VisualStudioRazorParser parser, + RazorCompletionFactsService completionFactsService) + { + if (foregroundDispatcher == null) + { + throw new ArgumentNullException(nameof(foregroundDispatcher)); + } + + if (parser == null) + { + throw new ArgumentNullException(nameof(parser)); + } + + if (completionFactsService == null) + { + throw new ArgumentNullException(nameof(completionFactsService)); + } + + _foregroundDispatcher = foregroundDispatcher; + _parser = parser; + _completionFactsService = completionFactsService; + } + + public Task GetCompletionContextAsync( + IAsyncCompletionSession session, + CompletionTrigger trigger, + SnapshotPoint triggerLocation, + SnapshotSpan applicableSpan, + CancellationToken token) + { + _foregroundDispatcher.AssertBackgroundThread(); + + var syntaxTree = _parser.CodeDocument?.GetSyntaxTree(); + var location = new SourceSpan(applicableSpan.Start.Position, applicableSpan.Length); + var razorCompletionItems = _completionFactsService.GetCompletionItems(syntaxTree, location); + + var completionItems = new List(); + foreach (var razorCompletionItem in razorCompletionItems) + { + if (razorCompletionItem.Kind != RazorCompletionItemKind.Directive) + { + // Don't support any other types of completion kinds other than directives. + continue; + } + + var completionItem = new CompletionItem( + displayText: razorCompletionItem.DisplayText, + filterText: razorCompletionItem.DisplayText, + insertText: razorCompletionItem.InsertText, + source: this, + icon: DirectiveImageGlyph, + filters: DirectiveCompletionFilters, + suffix: string.Empty, + sortText: razorCompletionItem.DisplayText, + attributeIcons: ImmutableArray.Empty); + completionItem.Properties.AddProperty(DescriptionKey, razorCompletionItem.Description); + completionItems.Add(completionItem); + } + var context = new CompletionContext(completionItems.ToImmutableArray()); + return Task.FromResult(context); + } + + public Task GetDescriptionAsync(IAsyncCompletionSession session, CompletionItem item, CancellationToken token) + { + if (!item.Properties.TryGetProperty(DescriptionKey, out var directiveDescription)) + { + directiveDescription = string.Empty; + } + + return Task.FromResult(directiveDescription); + } + + public CompletionStartData InitializeCompletion(CompletionTrigger trigger, SnapshotPoint triggerLocation, CancellationToken token) + { + // The applicable span for completion is the piece of text a completion is for. For example: + // @Date|Time.Now + // If you trigger completion at the | then the applicable span is the region of 'DateTime'; however, Razor + // doesn't know this information so we rely on Roslyn to define what the applicable span for a completion is. + return CompletionStartData.ParticipatesInCompletionIfAny; + } + } +} diff --git a/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionSourceProvider.cs b/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionSourceProvider.cs new file mode 100644 index 0000000000..0c9e40a38f --- /dev/null +++ b/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionSourceProvider.cs @@ -0,0 +1,73 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.ComponentModel.Composition; +using System.Linq; +using Microsoft.CodeAnalysis.Razor; +using Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion; +using Microsoft.VisualStudio.Text; +using Microsoft.VisualStudio.Text.Editor; +using Microsoft.VisualStudio.Utilities; + +namespace Microsoft.VisualStudio.Editor.Razor +{ + [System.Composition.Shared] + [Export(typeof(IAsyncCompletionSourceProvider))] + [Name("Razor directive completion provider.")] + [ContentType(RazorLanguage.CoreContentType)] + internal class RazorDirectiveCompletionSourceProvider : IAsyncCompletionSourceProvider + { + private readonly ForegroundDispatcher _foregroundDispatcher; + private readonly RazorCompletionFactsService _completionFactsService; + + [ImportingConstructor] + public RazorDirectiveCompletionSourceProvider( + ForegroundDispatcher foregroundDispatcher, + RazorCompletionFactsService completionFactsService) + { + if (foregroundDispatcher == null) + { + throw new ArgumentNullException(nameof(foregroundDispatcher)); + } + + if (completionFactsService == null) + { + throw new ArgumentNullException(nameof(completionFactsService)); + } + + _foregroundDispatcher = foregroundDispatcher; + _completionFactsService = completionFactsService; + } + + public IAsyncCompletionSource GetOrCreate(ITextView textView) + { + if (textView == null) + { + throw new ArgumentNullException(nameof(textView)); + } + + var razorBuffer = textView.BufferGraph.GetRazorBuffers().FirstOrDefault(); + if (!razorBuffer.Properties.TryGetProperty(typeof(RazorDirectiveCompletionSource), out IAsyncCompletionSource completionSource)) + { + completionSource = CreateCompletionSource(razorBuffer); + razorBuffer.Properties.AddProperty(typeof(RazorDirectiveCompletionSource), completionSource); + } + + return completionSource; + } + + // Internal for testing + internal IAsyncCompletionSource CreateCompletionSource(ITextBuffer razorBuffer) + { + if (!razorBuffer.Properties.TryGetProperty(typeof(VisualStudioRazorParser), out VisualStudioRazorParser parser)) + { + // Parser hasn't been associated with the text buffer yet. + return null; + } + + var completionSource = new RazorDirectiveCompletionSource(_foregroundDispatcher, parser, _completionFactsService); + return completionSource; + } + } +} diff --git a/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentGenerator/BackgroundDocumentGenerator.cs b/src/Microsoft.VisualStudio.LanguageServices.Razor/BackgroundDocumentGenerator.cs similarity index 77% rename from src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentGenerator/BackgroundDocumentGenerator.cs rename to src/Microsoft.VisualStudio.LanguageServices.Razor/BackgroundDocumentGenerator.cs index eba3c12e25..947dc1155a 100644 --- a/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentGenerator/BackgroundDocumentGenerator.cs +++ b/src/Microsoft.VisualStudio.LanguageServices.Razor/BackgroundDocumentGenerator.cs @@ -12,14 +12,13 @@ using Microsoft.Extensions.Internal; namespace Microsoft.CodeAnalysis.Razor { - // Deliberately not exported for now, until this feature is working end to end. - // [Export(typeof(ProjectSnapshotChangeTrigger))] + [Export(typeof(ProjectSnapshotChangeTrigger))] internal class BackgroundDocumentGenerator : ProjectSnapshotChangeTrigger { - private ForegroundDispatcher _foregroundDispatcher; + private readonly ForegroundDispatcher _foregroundDispatcher; private ProjectSnapshotManagerBase _projectManager; - private readonly Dictionary _files; + private readonly Dictionary _work; private Timer _timer; [ImportingConstructor] @@ -31,17 +30,16 @@ namespace Microsoft.CodeAnalysis.Razor } _foregroundDispatcher = foregroundDispatcher; - - _files = new Dictionary(); + _work = new Dictionary(); } public bool HasPendingNotifications { get { - lock (_files) + lock (_work) { - return _files.Count > 0; + return _work.Count > 0; } } } @@ -135,11 +133,11 @@ namespace Microsoft.CodeAnalysis.Razor _foregroundDispatcher.AssertForegroundThread(); - lock (_files) + lock (_work) { // We only want to store the last 'seen' version of any given document. That way when we pick one to process // it's always the best version to use. - _files[new DocumentKey(project.FilePath, document.FilePath)] = document; + _work[new DocumentKey(project.FilePath, document.FilePath)] = document; StartWorker(); } @@ -172,18 +170,18 @@ namespace Microsoft.CodeAnalysis.Razor OnStartingBackgroundWork(); - DocumentSnapshot[] work; - lock (_files) + KeyValuePair[] work; + lock (_work) { - work = _files.Values.ToArray(); - _files.Clear(); + work = _work.ToArray(); + _work.Clear(); } OnBackgroundCapturedWorkload(); for (var i = 0; i < work.Length; i++) { - var document = work[i]; + var document = work[i].Value; try { await ProcessDocument(document); @@ -196,14 +194,14 @@ namespace Microsoft.CodeAnalysis.Razor OnCompletingBackgroundWork(); - lock (_files) + lock (_work) { // Resetting the timer allows another batch of work to start. _timer.Dispose(); _timer = null; // If more work came in while we were running start the worker again. - if (_files.Count > 0) + if (_work.Count > 0) { StartWorker(); } @@ -238,35 +236,61 @@ namespace Microsoft.CodeAnalysis.Razor switch (e.Kind) { case ProjectChangeKind.ProjectAdded: + { + var projectSnapshot = e.Newer; + foreach (var documentFilePath in projectSnapshot.DocumentFilePaths) + { + Enqueue(projectSnapshot, projectSnapshot.GetDocument(documentFilePath)); + } + + break; + } case ProjectChangeKind.ProjectChanged: { - var project = _projectManager.GetLoadedProject(e.ProjectFilePath); - foreach (var documentFilePath in project.DocumentFilePaths) + var projectSnapshot = e.Newer; + foreach (var documentFilePath in projectSnapshot.DocumentFilePaths) { - Enqueue(project, project.GetDocument(documentFilePath)); + Enqueue(projectSnapshot, projectSnapshot.GetDocument(documentFilePath)); + } + + break; + } + + case ProjectChangeKind.DocumentAdded: + case ProjectChangeKind.DocumentChanged: + { + var project = e.Newer; + var document = project.GetDocument(e.DocumentFilePath); + + Enqueue(project, document); + foreach (var relatedDocument in project.GetRelatedDocuments(document)) + { + Enqueue(project, document); + } + + break; + } + + case ProjectChangeKind.DocumentRemoved: + { + // For removals use the old snapshot to find the removed document, so we can figure out + // what the imports were in the new snapshot. + var document = e.Older.GetDocument(e.DocumentFilePath); + + foreach (var relatedDocument in e.Newer.GetRelatedDocuments(document)) + { + Enqueue(e.Newer, document); } break; } case ProjectChangeKind.ProjectRemoved: - // ignore - break; - - case ProjectChangeKind.DocumentAdded: - case ProjectChangeKind.DocumentChanged: { - var project = _projectManager.GetLoadedProject(e.ProjectFilePath); - Enqueue(project, project.GetDocument(e.DocumentFilePath)); - + // ignore break; } - - case ProjectChangeKind.DocumentRemoved: - // ignore - break; - default: throw new InvalidOperationException($"Unknown ProjectChangeKind {e.Kind}"); } diff --git a/src/Microsoft.VisualStudio.LanguageServices.Razor/Microsoft.VisualStudio.LanguageServices.Razor.csproj b/src/Microsoft.VisualStudio.LanguageServices.Razor/Microsoft.VisualStudio.LanguageServices.Razor.csproj index 32296b51c6..5dcbf78723 100644 --- a/src/Microsoft.VisualStudio.LanguageServices.Razor/Microsoft.VisualStudio.LanguageServices.Razor.csproj +++ b/src/Microsoft.VisualStudio.LanguageServices.Razor/Microsoft.VisualStudio.LanguageServices.Razor.csproj @@ -5,22 +5,25 @@ Razor is a markup syntax for adding server-side logic to web pages. This package contains the Razor design-time infrastructure for Visual Studio. false ..\Microsoft.NET.Sdk.Razor\build\netstandard2.0\Rules\ + $(DefineConstants);WORKSPACE_PROJECT_CONTEXT_FACTORY + Microsoft.VisualStudio.LanguageServices.Razor.ruleset $(DefineConstants);RAZOR_EXTENSION_DEVELOPER_MODE + + - @@ -30,9 +33,12 @@ + + + diff --git a/src/Microsoft.VisualStudio.LanguageServices.Razor/Microsoft.VisualStudio.LanguageServices.Razor.ruleset b/src/Microsoft.VisualStudio.LanguageServices.Razor/Microsoft.VisualStudio.LanguageServices.Razor.ruleset new file mode 100644 index 0000000000..3f14803c35 --- /dev/null +++ b/src/Microsoft.VisualStudio.LanguageServices.Razor/Microsoft.VisualStudio.LanguageServices.Razor.ruleset @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/DefaultRazorProjectHost.cs b/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/DefaultRazorProjectHost.cs index 68dfc4312a..97978c18cd 100644 --- a/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/DefaultRazorProjectHost.cs +++ b/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/DefaultRazorProjectHost.cs @@ -7,15 +7,22 @@ using System.Collections.Immutable; using System.ComponentModel.Composition; using System.IO; using System.Linq; +using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; using System.Threading.Tasks.Dataflow; using Microsoft.AspNetCore.Razor.Language; +using Microsoft.VisualStudio; using Microsoft.VisualStudio.LanguageServices; using Microsoft.VisualStudio.ProjectSystem; using Microsoft.VisualStudio.ProjectSystem.Properties; +using Microsoft.VisualStudio.TextManager.Interop; using Item = System.Collections.Generic.KeyValuePair>; +#if WORKSPACE_PROJECT_CONTEXT_FACTORY +using IWorkspaceProjectContextFactory = Microsoft.VisualStudio.LanguageServices.ProjectSystem.IWorkspaceProjectContextFactory2; +#endif + namespace Microsoft.CodeAnalysis.Razor.ProjectSystem { // Somewhat similar to https://github.com/dotnet/project-system/blob/fa074d228dcff6dae9e48ce43dd4a3a5aa22e8f0/src/Microsoft.VisualStudio.ProjectSystem.Managed/ProjectSystem/LanguageServices/LanguageServiceHost.cs @@ -23,16 +30,18 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem // This class is responsible for intializing the Razor ProjectSnapshotManager for cases where // MSBuild provides configuration support (>= 2.1). [AppliesTo("DotNetCoreRazor & DotNetCoreRazorConfiguration")] + [ExportVsProfferedProjectService(typeof(IVsContainedLanguageProjectNameProvider))] [Export(ExportContractNames.Scopes.UnconfiguredProject, typeof(IProjectDynamicLoadComponent))] - internal class DefaultRazorProjectHost : RazorProjectHostBase + internal class DefaultRazorProjectHost : RazorProjectHostBase, IVsContainedLanguageProjectNameProvider { private IDisposable _subscription; [ImportingConstructor] public DefaultRazorProjectHost( IUnconfiguredProjectCommonServices commonServices, - [Import(typeof(VisualStudioWorkspace))] Workspace workspace) - : base(commonServices, workspace) + [Import(typeof(VisualStudioWorkspace))] Workspace workspace, + Lazy projectContextFactory) + : base(commonServices, workspace, projectContextFactory) { } @@ -68,6 +77,9 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem Rules.RazorConfiguration.SchemaName, Rules.RazorExtension.SchemaName, Rules.RazorGenerateWithTargetPath.SchemaName, + ManagedProjectSystemSchema.CompilerCommandLineArgs.SchemaName, + ManagedProjectSystemSchema.ConfigurationGeneral.SchemaName, + ManagedProjectSystemSchema.ResolvedCompilationReference.SchemaName, }); } @@ -107,9 +119,14 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem var documents = GetCurrentDocuments(update.Value); var changedDocuments = GetChangedAndRemovedDocuments(update.Value); + var references = GetReferences(update.Value); + TryGetCommandLineOptions(update.Value.CurrentState, out var commandLineOptions); + await UpdateAsync(() => { UpdateProjectUnsafe(hostProject); + UpdateWorkspaceProjectOptionsUnsafe(commandLineOptions); + UpdateWorkspaceProjectReferencesUnsafe(references); for (var i = 0; i < changedDocuments.Length; i++) { @@ -302,6 +319,77 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem return true; } + + // This is temporary code for initializing the companion project. We expect + // this to be provided by the Managed Project System in the near future. + internal static bool TryGetReferences( + IImmutableDictionary state, + out string[] references) + { + if (!state.TryGetValue(ManagedProjectSystemSchema.ResolvedCompilationReference.ItemName, out var rule)) + { + references = null; + return false; + } + + var items = rule.Items; + var referencesList = new List(); + foreach (var item in items) + { + var reference = item.Key; + if (!referencesList.Contains(reference, FilePathComparer.Instance)) + { + referencesList.Add(reference); + } + } + + references = referencesList.ToArray(); + return true; + } + + // This is temporary code for initializing the companion project. We expect + // this to be provided by the Managed Project System in the near future. + internal static bool TryGetCommandLineOptions( + IImmutableDictionary state, + out string commandLineOptions) + { + if (!state.TryGetValue(ManagedProjectSystemSchema.CompilerCommandLineArgs.ItemName, out var rule)) + { + commandLineOptions = null; + return false; + } + + commandLineOptions = string.Join(" ", rule.Items.Select(kvp => kvp.Key)); + return true; + } + + // This is temporary code for initializing the companion project. We expect + // this to be provided by the Managed Project System in the near future. + internal static bool TryGetTargetPath( + IImmutableDictionary state, + out string targetPath) + { + if (!state.TryGetValue(ManagedProjectSystemSchema.ConfigurationGeneral.SchemaName, out var rule)) + { + targetPath = null; + return false; + } + + if (!rule.Properties.TryGetValue(ManagedProjectSystemSchema.ConfigurationGeneral.TargetPathPropertyName, out targetPath)) + { + targetPath = null; + return false; + } + + if (string.IsNullOrEmpty(targetPath)) + { + targetPath = null; + return false; + } + + return true; + } + private HostDocument[] GetCurrentDocuments(IProjectSubscriptionUpdate update) { if (!update.CurrentState.TryGetValue(Rules.RazorGenerateWithTargetPath.SchemaName, out var rule)) @@ -348,5 +436,37 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem return documents.ToArray(); } + + // This is temporary code for initializing the companion project. We expect + // this to be provided by the Managed Project System in the near future. + private string[] GetReferences(IProjectSubscriptionUpdate update) + { + if (!TryGetReferences(update.CurrentState, out var references)) + { + return Array.Empty(); + } + + if (TryGetTargetPath(update.CurrentState, out var targetPath)) + { + references = references.Concat(new[] { targetPath, }).ToArray(); + } + + return references; + } + + // This is temporary code for initializing the companion project. We expect + // this to be provided by the Managed Project System in the near future. + public int GetProjectName([In] uint itemid, [MarshalAs(UnmanagedType.BStr)] out string pbstrProjectName) + { + if (Current == null) + { + pbstrProjectName = null; + + return VSConstants.E_INVALIDARG; + } + + pbstrProjectName = Path.GetFileNameWithoutExtension(Current.FilePath) + " (Razor)"; + return VSConstants.S_OK; + } } } \ No newline at end of file diff --git a/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/DefaultWorkspaceProjectContextFactory.cs b/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/DefaultWorkspaceProjectContextFactory.cs new file mode 100644 index 0000000000..0842ecc8fc --- /dev/null +++ b/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/DefaultWorkspaceProjectContextFactory.cs @@ -0,0 +1,101 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +// Temporary code until we get access to these APIs +#if WORKSPACE_PROJECT_CONTEXT_FACTORY + +using System; +using System.Collections.Generic; +using System.ComponentModel.Composition; +using Microsoft.CodeAnalysis; +using Microsoft.VisualStudio.LanguageServices.Implementation.TaskList; +using IWorkspaceProjectContextFactory = Microsoft.VisualStudio.LanguageServices.ProjectSystem.IWorkspaceProjectContextFactory2; + +namespace Microsoft.VisualStudio.LanguageServices.ProjectSystem +{ + [Export(typeof(IWorkspaceProjectContextFactory))] + internal class DefaultWorkspaceProjectContextFactory : IWorkspaceProjectContextFactory + { + public IWorkspaceProjectContext CreateProjectContext(string languageName, string projectDisplayName, string projectFilePath, Guid projectGuid, object hierarchy, string binOutputPath) + { + return new WorkspaceProjectContext(); + } + + public IWorkspaceProjectContext CreateProjectContext(string languageName, string projectDisplayName, string projectFilePath, Guid projectGuid, object hierarchy, string binOutputPath, ProjectExternalErrorReporter errorReporter) + { + return new WorkspaceProjectContext(); + } + + private class WorkspaceProjectContext : IWorkspaceProjectContext + { + public string DisplayName { get; set; } + public string ProjectFilePath { get; set; } + public Guid Guid { get; set; } + public bool LastDesignTimeBuildSucceeded { get; set; } + public string BinOutputPath { get; set; } + + public void AddAdditionalFile(string filePath, bool isInCurrentContext = true) + { + } + + public void AddAnalyzerReference(string referencePath) + { + } + + public void AddMetadataReference(string referencePath, MetadataReferenceProperties properties) + { + } + + public void AddProjectReference(IWorkspaceProjectContext project, MetadataReferenceProperties properties) + { + } + + public void AddSourceFile(string filePath, bool isInCurrentContext, IEnumerable folderNames, SourceCodeKind sourceCodeKind) + { + } + + public void AddDynamicSourceFile(string filePath, IEnumerable folderNames = null) + { + } + + public void Dispose() + { + } + + public void RemoveAdditionalFile(string filePath) + { + } + + public void RemoveAnalyzerReference(string referencePath) + { + } + + public void RemoveMetadataReference(string referencePath) + { + } + + public void RemoveProjectReference(IWorkspaceProjectContext project) + { + } + + public void RemoveSourceFile(string filePath) + { + } + + public void RemoveDynamicSourceFile(string filePath) + { + + } + + public void SetOptions(string commandLineForOptions) + { + } + + public void SetRuleSetFile(string filePath) + { + } + } + } +} + +#endif diff --git a/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/FallbackRazorProjectHost.cs b/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/FallbackRazorProjectHost.cs index 5dedf67af9..ef33b79723 100644 --- a/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/FallbackRazorProjectHost.cs +++ b/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/FallbackRazorProjectHost.cs @@ -38,7 +38,7 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem public FallbackRazorProjectHost( IUnconfiguredProjectCommonServices commonServices, [Import(typeof(VisualStudioWorkspace))] Workspace workspace) - : base(commonServices, workspace) + : base(commonServices, workspace, projectContextFactory: null) { } diff --git a/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/IWorkspaceProjectContext.cs b/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/IWorkspaceProjectContext.cs new file mode 100644 index 0000000000..91d7f2e90e --- /dev/null +++ b/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/IWorkspaceProjectContext.cs @@ -0,0 +1,45 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +// Temporary code until we get access to these APIs +#if WORKSPACE_PROJECT_CONTEXT_FACTORY + +using System; +using System.Collections.Generic; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.VisualStudio.LanguageServices.ProjectSystem +{ + internal interface IWorkspaceProjectContext : IDisposable + { + // Project properties. + string DisplayName { get; set; } + string ProjectFilePath { get; set; } + Guid Guid { get; set; } + bool LastDesignTimeBuildSucceeded { get; set; } + string BinOutputPath { get; set; } + + // Options. + void SetOptions(string commandLineForOptions); + + // References. + void AddMetadataReference(string referencePath, MetadataReferenceProperties properties); + void RemoveMetadataReference(string referencePath); + void AddProjectReference(IWorkspaceProjectContext project, MetadataReferenceProperties properties); + void RemoveProjectReference(IWorkspaceProjectContext project); + void AddAnalyzerReference(string referencePath); + void RemoveAnalyzerReference(string referencePath); + + // Files. + void AddSourceFile(string filePath, bool isInCurrentContext, IEnumerable folderNames, SourceCodeKind sourceCodeKind); + void AddDynamicSourceFile(string filePath, IEnumerable folderNames = null); + void RemoveSourceFile(string filePath); + void RemoveDynamicSourceFile(string filePath); + void AddAdditionalFile(string filePath, bool isInCurrentContext = true); + void RemoveAdditionalFile(string filePath); + void SetRuleSetFile(string filePath); + } +} + +#endif diff --git a/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/IWorkspaceProjectContextFactory.cs b/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/IWorkspaceProjectContextFactory.cs new file mode 100644 index 0000000000..0cb912b627 --- /dev/null +++ b/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/IWorkspaceProjectContextFactory.cs @@ -0,0 +1,23 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +// Temporary code until we get access to these APIs +#if WORKSPACE_PROJECT_CONTEXT_FACTORY + +using System; +using Microsoft.VisualStudio.LanguageServices.Implementation.TaskList; + +namespace Microsoft.VisualStudio.LanguageServices.ProjectSystem +{ + // The 2 is needed here to prevent clashes with the real interface. MEF is based on the FullName + // as a string. + internal interface IWorkspaceProjectContextFactory2 + { + IWorkspaceProjectContext CreateProjectContext(string languageName, string projectDisplayName, string projectFilePath, Guid projectGuid, object hierarchy, string binOutputPath); + + + IWorkspaceProjectContext CreateProjectContext(string languageName, string projectDisplayName, string projectFilePath, Guid projectGuid, object hierarchy, string binOutputPath, ProjectExternalErrorReporter errorReporter); + } +} + +#endif \ No newline at end of file diff --git a/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/ManagedProjectSystemSchema.cs b/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/ManagedProjectSystemSchema.cs index a56464e495..9f67217eb6 100644 --- a/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/ManagedProjectSystemSchema.cs +++ b/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/ManagedProjectSystemSchema.cs @@ -6,6 +6,20 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem // Well-Known Schema and property names defined by the ManagedProjectSystem internal static class ManagedProjectSystemSchema { + public static class CompilerCommandLineArgs + { + public static readonly string SchemaName = "CompilerCommandLineArgs"; + + public static readonly string ItemName = "CompilerCommandLineArgs"; + } + + public static class ConfigurationGeneral + { + public static readonly string SchemaName = "ConfigurationGeneral"; + + public static readonly string TargetPathPropertyName = "TargetPath"; + } + public static class ResolvedCompilationReference { public static readonly string SchemaName = "ResolvedCompilationReference"; diff --git a/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/ProjectExternalErrorReporter.cs b/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/ProjectExternalErrorReporter.cs new file mode 100644 index 0000000000..d9c230f65d --- /dev/null +++ b/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/ProjectExternalErrorReporter.cs @@ -0,0 +1,14 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +// Temporary code until we get access to these APIs +#if WORKSPACE_PROJECT_CONTEXT_FACTORY + +namespace Microsoft.VisualStudio.LanguageServices.Implementation.TaskList +{ + internal class ProjectExternalErrorReporter + { + } +} + +#endif \ No newline at end of file diff --git a/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/RazorProjectHostBase.cs b/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/RazorProjectHostBase.cs index e39a866f05..6d5700a796 100644 --- a/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/RazorProjectHostBase.cs +++ b/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/RazorProjectHostBase.cs @@ -5,27 +5,40 @@ using System; using System.Collections.Generic; using System.ComponentModel.Composition; using System.Diagnostics; +using System.IO; using System.Linq; +using System.Reflection; using System.Threading; using System.Threading.Tasks; +using Microsoft.VisualStudio.Composition; using Microsoft.VisualStudio.LanguageServices; +using Microsoft.VisualStudio.LanguageServices.ProjectSystem; using Microsoft.VisualStudio.ProjectSystem; using Microsoft.VisualStudio.Threading; +#if WORKSPACE_PROJECT_CONTEXT_FACTORY +using IWorkspaceProjectContextFactory = Microsoft.VisualStudio.LanguageServices.ProjectSystem.IWorkspaceProjectContextFactory2; +#endif + namespace Microsoft.CodeAnalysis.Razor.ProjectSystem { internal abstract class RazorProjectHostBase : OnceInitializedOnceDisposedAsync, IProjectDynamicLoadComponent { private readonly Workspace _workspace; + private readonly Lazy _projectContextFactory; private readonly AsyncSemaphore _lock; private ProjectSnapshotManagerBase _projectManager; private HostProject _current; + private IWorkspaceProjectContext _projectContext; private Dictionary _currentDocuments; + private HashSet _references; + private string _commandLineOptions; public RazorProjectHostBase( IUnconfiguredProjectCommonServices commonServices, - [Import(typeof(VisualStudioWorkspace))] Workspace workspace) + [Import(typeof(VisualStudioWorkspace))] Workspace workspace, + Lazy projectContextFactory) : base(commonServices.ThreadingService.JoinableTaskContext) { if (commonServices == null) @@ -40,9 +53,11 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem CommonServices = commonServices; _workspace = workspace; + _projectContextFactory = projectContextFactory; _lock = new AsyncSemaphore(initialCount: 1); _currentDocuments = new Dictionary(FilePathComparer.Instance); + _references = new HashSet(FilePathComparer.Instance); } // Internal for testing @@ -73,6 +88,7 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem _lock = new AsyncSemaphore(initialCount: 1); _currentDocuments = new Dictionary(FilePathComparer.Instance); + _references = new HashSet(FilePathComparer.Instance); } protected HostProject Current => _current; @@ -129,6 +145,8 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem { var filePath = CommonServices.UnconfiguredProject.FullPath; UpdateProjectUnsafe(new HostProject(filePath, old.Configuration)); + UpdateWorkspaceProjectOptionsUnsafe(_commandLineOptions); + UpdateWorkspaceProjectReferencesUnsafe(_references.ToArray()); // This should no-op in the common case, just putting it here for insurance. for (var i = 0; i < oldDocuments.Length; i++) @@ -153,6 +171,12 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem return _projectManager; } + private IWorkspaceProjectContextFactory GetProjectContextFactory() + { + CommonServices.ThreadingService.VerifyOnUIThread(); + return _projectContextFactory?.Value; + } + protected async Task UpdateAsync(Action action) { await CommonServices.ThreadingService.SwitchToUIThread(); @@ -174,12 +198,40 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem } else if (_current == null && project != null) { + // This is temporary code for initializing the companion project. We expect + // this to be provided by the Managed Project System in the near future. + var projectContextFactory = GetProjectContextFactory(); + if (projectContextFactory != null) + { + var assembly = Assembly.Load("Microsoft.VisualStudio.ProjectSystem.Managed, Version=2.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"); + var type = assembly.GetType("Microsoft.VisualStudio.ProjectSystem.LanguageServices.IProjectHostProvider"); + + var exportProviderType = CommonServices.UnconfiguredProject.Services.ExportProvider.GetType(); + var method = exportProviderType.GetMethod(nameof(ExportProvider.GetExportedValue), Array.Empty()).MakeGenericMethod(type); + var export = method.Invoke(CommonServices.UnconfiguredProject.Services.ExportProvider, Array.Empty()); + var host = new IProjectHostProvider(export); + + var displayName = Path.GetFileNameWithoutExtension(CommonServices.UnconfiguredProject.FullPath) + " (Razor)"; + _projectContext = projectContextFactory.CreateProjectContext( + LanguageNames.CSharp, + displayName, + CommonServices.UnconfiguredProject.FullPath, + Guid.NewGuid(), + host.UnconfiguredProjectHostObject.ActiveIntellisenseProjectHostObject, + null, + null); + } + + // END temporary code + projectManager.HostProjectAdded(project); } else if (_current != null && project == null) { Debug.Assert(_currentDocuments.Count == 0); projectManager.HostProjectRemoved(_current); + _projectContext?.Dispose(); + _projectContext = null; } else { @@ -189,6 +241,56 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem _current = project; } + protected void UpdateWorkspaceProjectOptionsUnsafe(string commandLineOptions) + { + if (_projectContext == null) + { + _commandLineOptions = null; + return; + } + + if (!string.Equals(_commandLineOptions, commandLineOptions)) + { + _projectContext.SetOptions(commandLineOptions); + _commandLineOptions = commandLineOptions; + } + } + + protected void UpdateWorkspaceProjectReferencesUnsafe(string[] references) + { + if (_projectContext == null) + { + _references.Clear(); + return; + } + + var newer = new HashSet(references, FilePathComparer.Instance); + var older = new HashSet(_references, FilePathComparer.Instance); + + if (older.SetEquals(newer)) + { + return; + } + + var remove = new HashSet(older, FilePathComparer.Instance); + remove.ExceptWith(newer); + + var add = new HashSet(newer, FilePathComparer.Instance); + add.ExceptWith(older); + + foreach (var reference in remove) + { + _references.Remove(reference); + _projectContext.RemoveMetadataReference(reference); + } + + foreach (var reference in add) + { + _references.Add(reference); + _projectContext.AddMetadataReference(reference, new MetadataReferenceProperties()); + } + } + protected void AddDocumentUnsafe(HostDocument document) { var projectManager = GetProjectManager(); @@ -200,6 +302,7 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem } projectManager.DocumentAdded(_current, document, new FileTextLoader(document.FilePath, null)); + _projectContext?.AddDynamicSourceFile(document.FilePath, GetFolders(document)); _currentDocuments.Add(document.FilePath, document); } @@ -207,6 +310,7 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem { var projectManager = GetProjectManager(); + _projectContext?.RemoveDynamicSourceFile(document.FilePath); projectManager.DocumentRemoved(_current, document); _currentDocuments.Remove(document.FilePath); } @@ -217,6 +321,7 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem foreach (var kvp in _currentDocuments) { + _projectContext?.RemoveSourceFile(kvp.Value.FilePath); _projectManager.DocumentRemoved(_current, kvp.Value); } @@ -249,5 +354,48 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem { await OnProjectRenamingAsync().ConfigureAwait(false); } + + private static IEnumerable GetFolders(HostDocument document) + { + var split = document.TargetPath.Split('/'); + return split.Take(split.Length - 1); + } + + private class IUnconfiguredProjectHostObject + { + private readonly object _inner; + + public IUnconfiguredProjectHostObject(object inner) + { + _inner = inner; + } + + public object ActiveIntellisenseProjectHostObject + { + get + { + return _inner.GetType().GetProperty(nameof(ActiveIntellisenseProjectHostObject)).GetValue(_inner); + } + } + } + + private class IProjectHostProvider + { + private readonly object _inner; + + public IProjectHostProvider(object inner) + { + _inner = inner; + } + + public IUnconfiguredProjectHostObject UnconfiguredProjectHostObject + { + get + { + var inner = _inner.GetType().GetProperty(nameof(UnconfiguredProjectHostObject)).GetValue(_inner); + return new IUnconfiguredProjectHostObject(inner); + } + } + } } } \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.cs index 93b05b4ddd..dd100bee00 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.cs @@ -28,7 +28,11 @@ namespace AspNetCore } ))(); ((System.Action)(() => { +#line 12 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" MyService __typeHelper = default(MyService); + +#line default +#line hidden } ))(); ((System.Action)(() => { diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt index c13c9c3006..4bb61bf781 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt @@ -20,21 +20,21 @@ Generated Location: (830:27,0 [0] ) Source Location: (159:11,8 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) |MyService| -Generated Location: (883:30,0 [17] ) +Generated Location: (980:31,0 [17] ) |MyService| Source Location: (176:11,25 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (1005:34,0 [0] ) +Generated Location: (1133:38,0 [0] ) || Source Location: (190:13,10 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (1058:37,0 [0] ) +Generated Location: (1186:41,0 [0] ) || Source Location: (203:14,11 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (1111:40,0 [0] ) +Generated Location: (1239:44,0 [0] ) || diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.codegen.cs index 6a16b10feb..7cdbaf3326 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.codegen.cs @@ -16,11 +16,19 @@ namespace AspNetCore #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml" MyBasePageForViews __typeHelper = default(MyBasePageForViews); + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml" MyModel __typeHelper = default(MyModel); + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.mappings.txt index 9b7a5db61d..6a313a909d 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.mappings.txt @@ -1,10 +1,10 @@ Source Location: (10:0,10 [26] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml) |MyBasePageForViews| -Generated Location: (647:18,0 [26] ) +Generated Location: (740:19,0 [26] ) |MyBasePageForViews| Source Location: (45:1,7 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml) |MyModel| -Generated Location: (787:22,0 [7] ) +Generated Location: (1004:27,0 [7] ) |MyModel| diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.codegen.cs index 8d27d45236..f174a0fc2f 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.codegen.cs @@ -16,7 +16,11 @@ namespace AspNetCore #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml" MyModel __typeHelper = default(MyModel); + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.mappings.txt index c120ec9937..e7daecd874 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (14:1,7 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml) |MyModel| -Generated Location: (646:18,0 [7] ) +Generated Location: (745:19,0 [7] ) |MyModel| diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.cs index e198bf38b2..2120622373 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.cs @@ -16,23 +16,43 @@ namespace AspNetCore #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml" MyModel __typeHelper = default(MyModel); + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml" MyApp __typeHelper = default(MyApp); + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml" global::System.Object MyPropertyName = null; + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml" MyService __typeHelper = default(MyService); + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml" global::System.Object Html = null; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.mappings.txt index 0d58ddea20..c4838ff64d 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.mappings.txt @@ -1,25 +1,25 @@ Source Location: (7:0,7 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml) |MyModel| -Generated Location: (675:18,0 [7] ) +Generated Location: (766:19,0 [7] ) |MyModel| Source Location: (24:1,8 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml) |MyApp| -Generated Location: (777:22,0 [5] ) +Generated Location: (990:27,0 [5] ) |MyApp| Source Location: (30:1,14 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml) |MyPropertyName| -Generated Location: (897:26,22 [14] ) +Generated Location: (1232:35,22 [14] ) |MyPropertyName| Source Location: (54:2,8 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml) |MyService| -Generated Location: (981:30,0 [17] ) +Generated Location: (1438:43,0 [17] ) |MyService| Source Location: (72:2,26 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml) |Html| -Generated Location: (1125:34,22 [4] ) +Generated Location: (1704:51,22 [4] ) |Html| diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.cs index 7d588d5d12..ea95a4e7eb 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.cs @@ -16,39 +16,75 @@ namespace AspNetCore #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml" MyModel __typeHelper = default(MyModel); + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml" MyApp __typeHelper = default(MyApp); + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml" global::System.Object MyPropertyName = null; + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml" MyService __typeHelper = default(MyService); + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml" global::System.Object Html = null; + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 4 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml" MyApp __typeHelper = default(MyApp); + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 4 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml" global::System.Object MyPropertyName2 = null; + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 5 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml" MyService __typeHelper = default(MyService); + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 5 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml" global::System.Object Html2 = null; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.mappings.txt index 8e98145f2d..6a90f75f3e 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.mappings.txt @@ -1,45 +1,45 @@ Source Location: (7:0,7 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyModel| -Generated Location: (679:18,0 [7] ) +Generated Location: (774:19,0 [7] ) |MyModel| Source Location: (24:1,8 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyApp| -Generated Location: (781:22,0 [5] ) +Generated Location: (1002:27,0 [5] ) |MyApp| Source Location: (30:1,14 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyPropertyName| -Generated Location: (901:26,22 [14] ) +Generated Location: (1248:35,22 [14] ) |MyPropertyName| Source Location: (58:2,8 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyService| -Generated Location: (985:30,0 [17] ) +Generated Location: (1458:43,0 [17] ) |MyService| Source Location: (76:2,26 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |Html| -Generated Location: (1129:34,22 [4] ) +Generated Location: (1728:51,22 [4] ) |Html| Source Location: (93:3,8 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyApp| -Generated Location: (1203:38,0 [5] ) +Generated Location: (1928:59,0 [5] ) |MyApp| Source Location: (99:3,14 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyPropertyName2| -Generated Location: (1323:42,22 [15] ) +Generated Location: (2174:67,22 [15] ) |MyPropertyName2| Source Location: (129:4,8 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyService| -Generated Location: (1408:46,0 [17] ) +Generated Location: (2385:75,0 [17] ) |MyService| Source Location: (147:4,26 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |Html2| -Generated Location: (1552:50,22 [5] ) +Generated Location: (2655:83,22 [5] ) |Html2| diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.cs index b6a4d2a93f..7b2f4fedc6 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.cs @@ -16,11 +16,19 @@ namespace AspNetCore #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml" MyApp __typeHelper = default(MyApp); + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml" global::System.Object MyPropertyName = null; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.mappings.txt index 8bd4399f3f..10ed356ecf 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.mappings.txt @@ -1,10 +1,10 @@ Source Location: (8:0,8 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml) |MyApp| -Generated Location: (666:18,0 [5] ) +Generated Location: (748:19,0 [5] ) |MyApp| Source Location: (14:0,14 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml) |MyPropertyName| -Generated Location: (786:22,22 [14] ) +Generated Location: (981:27,22 [14] ) |MyPropertyName| diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.cs index e669a23be0..82441cd663 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.cs @@ -17,11 +17,19 @@ namespace AspNetCore #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml" DateTime __typeHelper = default(DateTime); + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml" global::System.Object __typeHelper = "InputTestTagHelper, AppCode"; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.mappings.txt index ced10bc85e..63a7d6ccc1 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.mappings.txt @@ -1,20 +1,20 @@ Source Location: (7:0,7 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml) |DateTime| -Generated Location: (751:19,0 [8] ) +Generated Location: (851:20,0 [8] ) |DateTime| Source Location: (33:2,14 [29] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml) |"InputTestTagHelper, AppCode"| -Generated Location: (892:23,37 [29] ) +Generated Location: (1123:28,37 [29] ) |"InputTestTagHelper, AppCode"| Source Location: (83:4,17 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml) |Date| -Generated Location: (1540:36,102 [4] ) +Generated Location: (1802:44,102 [4] ) |Date| Source Location: (111:5,18 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml) |Model| -Generated Location: (1856:42,94 [5] ) +Generated Location: (2118:50,94 [5] ) |Model| diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.cs index 923b853936..63c2a52c6f 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.cs @@ -16,7 +16,11 @@ namespace AspNetCore #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml" System.Collections.IEnumerable __typeHelper = default(System.Collections.IEnumerable); + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.mappings.txt index 14e9047943..7d84cf754d 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (7:0,7 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml) |System.Collections.IEnumerable| -Generated Location: (688:18,0 [30] ) +Generated Location: (769:19,0 [30] ) |System.Collections.IEnumerable| diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.cs index dc5fcee8a2..e8f705cef7 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.cs @@ -16,11 +16,19 @@ namespace AspNetCore #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels.cshtml" ThisShouldBeGenerated __typeHelper = default(ThisShouldBeGenerated); + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels.cshtml" System.Collections.IEnumerable __typeHelper = default(System.Collections.IEnumerable); + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.mappings.txt index ff5971643c..79d7e257c7 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.mappings.txt @@ -1,10 +1,10 @@ Source Location: (7:0,7 [21] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels.cshtml) |ThisShouldBeGenerated| -Generated Location: (688:18,0 [21] ) +Generated Location: (778:19,0 [21] ) |ThisShouldBeGenerated| Source Location: (37:1,7 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels.cshtml) |System.Collections.IEnumerable| -Generated Location: (818:22,0 [30] ) +Generated Location: (1029:27,0 [30] ) |System.Collections.IEnumerable| diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.codegen.cs index cb05019c29..9d7181bfad 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.codegen.cs @@ -16,7 +16,11 @@ namespace Test.Namespace #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace.cshtml" global::System.Object __typeHelper = nameof(Test.Namespace); + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.mappings.txt index 23b745fa44..b41240c9c5 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (18:1,11 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace.cshtml) |Test.Namespace| -Generated Location: (716:18,44 [14] ) +Generated Location: (809:19,44 [14] ) |Test.Namespace| diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.codegen.cs index 69b52f95f7..8f5d082e6a 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.codegen.cs @@ -22,11 +22,19 @@ using Microsoft.AspNetCore.Mvc.RazorPages; #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml" global::System.Object __typeHelper = "/About"; + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml" NewModel __typeHelper = default(NewModel); + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.mappings.txt index e97ebe1943..cc5e9cad30 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.mappings.txt @@ -5,17 +5,17 @@ Generated Location: (492:14,0 [41] ) Source Location: (6:0,6 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml) |"/About"| -Generated Location: (1005:24,37 [8] ) +Generated Location: (1108:25,37 [8] ) |"/About"| Source Location: (25:2,7 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml) |NewModel| -Generated Location: (1076:28,0 [8] ) +Generated Location: (1313:33,0 [8] ) |NewModel| Source Location: (213:12,18 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml) |Model.Name| -Generated Location: (1573:40,18 [10] ) +Generated Location: (1841:48,18 [10] ) |Model.Name| Source Location: (93:5,12 [97] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml) @@ -25,7 +25,7 @@ Source Location: (93:5,12 [97] TestFiles/IntegrationTests/CodeGenerationIntegrat public string Name { get; set; } } | -Generated Location: (1781:47,12 [97] ) +Generated Location: (2049:55,12 [97] ) | public class NewModel : PageModel { diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.codegen.cs index af9ff10e76..aeb2631c46 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.codegen.cs @@ -22,7 +22,11 @@ using Microsoft.AspNetCore.Mvc.RazorPages; #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml" global::System.Object __typeHelper = "*, AppCode"; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.mappings.txt index a4abcf411d..33f7baa377 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.mappings.txt @@ -5,12 +5,12 @@ Generated Location: (487:14,0 [41] ) Source Location: (23:2,14 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml) |"*, AppCode"| -Generated Location: (937:24,37 [12] ) +Generated Location: (1035:25,37 [12] ) |"*, AppCode"| Source Location: (566:24,47 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml) |Name| -Generated Location: (1500:37,47 [4] ) +Generated Location: (1629:41,47 [4] ) |Name| Source Location: (95:5,12 [283] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml) @@ -28,7 +28,7 @@ Source Location: (95:5,12 [283] TestFiles/IntegrationTests/CodeGenerationIntegra public string Name { get; set; } } | -Generated Location: (1981:48,12 [283] ) +Generated Location: (2110:52,12 [283] ) | public IActionResult OnPost(Customer customer) { diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.codegen.cs index 8731920f14..d7acbdf7d1 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.codegen.cs @@ -22,11 +22,19 @@ using Microsoft.AspNetCore.Mvc.RazorPages; #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml" NewModel __typeHelper = default(NewModel); + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 4 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml" global::System.Object __typeHelper = "*, AppCode"; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.mappings.txt index 02d6726a3a..0af8c77dfd 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.mappings.txt @@ -5,17 +5,17 @@ Generated Location: (475:14,0 [41] ) Source Location: (16:2,7 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml) |NewModel| -Generated Location: (876:24,0 [8] ) +Generated Location: (962:25,0 [8] ) |NewModel| Source Location: (40:3,14 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml) |"*, AppCode"| -Generated Location: (1017:28,37 [12] ) +Generated Location: (1220:33,37 [12] ) |"*, AppCode"| Source Location: (661:28,47 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml) |Model.Name| -Generated Location: (1568:41,47 [10] ) +Generated Location: (1802:49,47 [10] ) |Model.Name| Source Location: (112:6,12 [360] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml) @@ -36,7 +36,7 @@ Source Location: (112:6,12 [360] TestFiles/IntegrationTests/CodeGenerationIntegr public string Name { get; set; } } | -Generated Location: (2043:52,12 [360] ) +Generated Location: (2277:60,12 [360] ) | public class NewModel : PageModel { diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.cs index 604b3f412a..3ca46af8a7 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.cs @@ -17,15 +17,27 @@ namespace AspNetCore #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml" DateTime __typeHelper = default(DateTime); + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml" global::System.Object __typeHelper = "InputTestTagHelper, AppCode"; + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 11 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml" global::System.Object Section1 = null; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.mappings.txt index 4eb221e12b..1cc991810c 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.mappings.txt @@ -1,29 +1,29 @@ Source Location: (7:0,7 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml) |DateTime| -Generated Location: (735:19,0 [8] ) +Generated Location: (819:20,0 [8] ) |DateTime| Source Location: (33:2,14 [29] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml) |"InputTestTagHelper, AppCode"| -Generated Location: (876:23,37 [29] ) +Generated Location: (1075:28,37 [29] ) |"InputTestTagHelper, AppCode"| Source Location: (152:10,9 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml) |Section1| -Generated Location: (990:27,22 [8] ) +Generated Location: (1305:36,22 [8] ) |Section1| Source Location: (68:4,2 [46] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml) | Layout = "_SectionTestLayout.cshtml"; | -Generated Location: (1425:39,2 [46] ) +Generated Location: (1771:51,2 [46] ) | Layout = "_SectionTestLayout.cshtml"; | Source Location: (222:12,21 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml) |Date| -Generated Location: (1850:47,102 [4] ) +Generated Location: (2196:59,102 [4] ) |Date| diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.codegen.cs index 1cd38d3029..b6196f6651 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.codegen.cs @@ -18,7 +18,11 @@ namespace AspNetCore #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml" global::System.Object __typeHelper = "*, AppCode"; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.mappings.txt index dcc0a00913..9c5fd32efb 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.mappings.txt @@ -1,19 +1,19 @@ Source Location: (14:0,14 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml) |"*, AppCode"| -Generated Location: (959:20,37 [12] ) +Generated Location: (1057:21,37 [12] ) |"*, AppCode"| Source Location: (30:1,2 [26] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml) | var foo = "Hello"; | -Generated Location: (1405:32,2 [26] ) +Generated Location: (1534:36,2 [26] ) | var foo = "Hello"; | Source Location: (83:5,22 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml) |foo| -Generated Location: (1856:40,22 [3] ) +Generated Location: (1985:44,22 [3] ) |foo| diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.codegen.cs index 208184dc25..209d3361f0 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.codegen.cs @@ -16,7 +16,11 @@ namespace Test.Namespace #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace.cshtml" global::System.Object __typeHelper = nameof(Test.Namespace); + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.mappings.txt index caae65f18f..2b7a295e01 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (11:0,11 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace.cshtml) |Test.Namespace| -Generated Location: (725:18,44 [14] ) +Generated Location: (818:19,44 [14] ) |Test.Namespace| diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.codegen.cs index 6bc3c83d01..1f60d924cc 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.codegen.cs @@ -16,11 +16,19 @@ namespace AspNetCore #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml" IHtmlHelper __typeHelper = default(IHtmlHelper); + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml" global::System.Object Helper = null; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.mappings.txt index a418264123..dc03ca32da 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.mappings.txt @@ -1,10 +1,10 @@ Source Location: (8:0,8 [19] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml) |IHtmlHelper| -Generated Location: (672:18,0 [19] ) +Generated Location: (760:19,0 [19] ) |IHtmlHelper| Source Location: (28:0,28 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml) |Helper| -Generated Location: (820:22,22 [6] ) +Generated Location: (1027:27,22 [6] ) |Helper| diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.cs index 5975633478..9fdc70a98b 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.cs @@ -28,7 +28,11 @@ namespace AspNetCore } ))(); ((System.Action)(() => { +#line 8 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" MyService __typeHelper = default(MyService); + +#line default +#line hidden } ))(); ((System.Action)(() => { diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt index 3b5068e43c..cb37b8b1a0 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt @@ -20,11 +20,11 @@ Generated Location: (839:27,0 [0] ) Source Location: (133:7,8 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) |MyService| -Generated Location: (892:30,0 [17] ) +Generated Location: (988:31,0 [17] ) |MyService| Source Location: (150:7,25 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (1014:34,0 [0] ) +Generated Location: (1141:38,0 [0] ) || diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.codegen.cs index 6a16b10feb..7cdbaf3326 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.codegen.cs @@ -16,11 +16,19 @@ namespace AspNetCore #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml" MyBasePageForViews __typeHelper = default(MyBasePageForViews); + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml" MyModel __typeHelper = default(MyModel); + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.mappings.txt index 9b7a5db61d..6a313a909d 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.mappings.txt @@ -1,10 +1,10 @@ Source Location: (10:0,10 [26] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml) |MyBasePageForViews| -Generated Location: (647:18,0 [26] ) +Generated Location: (740:19,0 [26] ) |MyBasePageForViews| Source Location: (45:1,7 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml) |MyModel| -Generated Location: (787:22,0 [7] ) +Generated Location: (1004:27,0 [7] ) |MyModel| diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.codegen.cs index b77fc2e72c..0ca023f56a 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.codegen.cs @@ -16,7 +16,11 @@ namespace AspNetCore #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml" MyModel __typeHelper = default(MyModel); + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.mappings.txt index 8ae3008a95..9ee5bceaa0 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (7:0,7 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml) |MyModel| -Generated Location: (653:18,0 [7] ) +Generated Location: (752:19,0 [7] ) |MyModel| diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.cs index e198bf38b2..2120622373 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.cs @@ -16,23 +16,43 @@ namespace AspNetCore #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml" MyModel __typeHelper = default(MyModel); + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml" MyApp __typeHelper = default(MyApp); + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml" global::System.Object MyPropertyName = null; + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml" MyService __typeHelper = default(MyService); + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml" global::System.Object Html = null; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.mappings.txt index 0d58ddea20..c4838ff64d 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.mappings.txt @@ -1,25 +1,25 @@ Source Location: (7:0,7 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml) |MyModel| -Generated Location: (675:18,0 [7] ) +Generated Location: (766:19,0 [7] ) |MyModel| Source Location: (24:1,8 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml) |MyApp| -Generated Location: (777:22,0 [5] ) +Generated Location: (990:27,0 [5] ) |MyApp| Source Location: (30:1,14 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml) |MyPropertyName| -Generated Location: (897:26,22 [14] ) +Generated Location: (1232:35,22 [14] ) |MyPropertyName| Source Location: (54:2,8 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml) |MyService| -Generated Location: (981:30,0 [17] ) +Generated Location: (1438:43,0 [17] ) |MyService| Source Location: (72:2,26 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml) |Html| -Generated Location: (1125:34,22 [4] ) +Generated Location: (1704:51,22 [4] ) |Html| diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.cs index 7d588d5d12..ea95a4e7eb 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.cs @@ -16,39 +16,75 @@ namespace AspNetCore #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml" MyModel __typeHelper = default(MyModel); + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml" MyApp __typeHelper = default(MyApp); + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml" global::System.Object MyPropertyName = null; + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml" MyService __typeHelper = default(MyService); + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml" global::System.Object Html = null; + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 4 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml" MyApp __typeHelper = default(MyApp); + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 4 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml" global::System.Object MyPropertyName2 = null; + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 5 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml" MyService __typeHelper = default(MyService); + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 5 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml" global::System.Object Html2 = null; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.mappings.txt index 8e98145f2d..6a90f75f3e 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.mappings.txt @@ -1,45 +1,45 @@ Source Location: (7:0,7 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyModel| -Generated Location: (679:18,0 [7] ) +Generated Location: (774:19,0 [7] ) |MyModel| Source Location: (24:1,8 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyApp| -Generated Location: (781:22,0 [5] ) +Generated Location: (1002:27,0 [5] ) |MyApp| Source Location: (30:1,14 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyPropertyName| -Generated Location: (901:26,22 [14] ) +Generated Location: (1248:35,22 [14] ) |MyPropertyName| Source Location: (58:2,8 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyService| -Generated Location: (985:30,0 [17] ) +Generated Location: (1458:43,0 [17] ) |MyService| Source Location: (76:2,26 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |Html| -Generated Location: (1129:34,22 [4] ) +Generated Location: (1728:51,22 [4] ) |Html| Source Location: (93:3,8 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyApp| -Generated Location: (1203:38,0 [5] ) +Generated Location: (1928:59,0 [5] ) |MyApp| Source Location: (99:3,14 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyPropertyName2| -Generated Location: (1323:42,22 [15] ) +Generated Location: (2174:67,22 [15] ) |MyPropertyName2| Source Location: (129:4,8 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyService| -Generated Location: (1408:46,0 [17] ) +Generated Location: (2385:75,0 [17] ) |MyService| Source Location: (147:4,26 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |Html2| -Generated Location: (1552:50,22 [5] ) +Generated Location: (2655:83,22 [5] ) |Html2| diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.cs index b6a4d2a93f..7b2f4fedc6 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.cs @@ -16,11 +16,19 @@ namespace AspNetCore #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml" MyApp __typeHelper = default(MyApp); + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml" global::System.Object MyPropertyName = null; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.mappings.txt index 8bd4399f3f..10ed356ecf 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.mappings.txt @@ -1,10 +1,10 @@ Source Location: (8:0,8 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml) |MyApp| -Generated Location: (666:18,0 [5] ) +Generated Location: (748:19,0 [5] ) |MyApp| Source Location: (14:0,14 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml) |MyPropertyName| -Generated Location: (786:22,22 [14] ) +Generated Location: (981:27,22 [14] ) |MyPropertyName| diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.cs index e669a23be0..82441cd663 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.cs @@ -17,11 +17,19 @@ namespace AspNetCore #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml" DateTime __typeHelper = default(DateTime); + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml" global::System.Object __typeHelper = "InputTestTagHelper, AppCode"; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.mappings.txt index ced10bc85e..63a7d6ccc1 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.mappings.txt @@ -1,20 +1,20 @@ Source Location: (7:0,7 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml) |DateTime| -Generated Location: (751:19,0 [8] ) +Generated Location: (851:20,0 [8] ) |DateTime| Source Location: (33:2,14 [29] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml) |"InputTestTagHelper, AppCode"| -Generated Location: (892:23,37 [29] ) +Generated Location: (1123:28,37 [29] ) |"InputTestTagHelper, AppCode"| Source Location: (83:4,17 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml) |Date| -Generated Location: (1540:36,102 [4] ) +Generated Location: (1802:44,102 [4] ) |Date| Source Location: (111:5,18 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml) |Model| -Generated Location: (1856:42,94 [5] ) +Generated Location: (2118:50,94 [5] ) |Model| diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.cs index 923b853936..63c2a52c6f 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.cs @@ -16,7 +16,11 @@ namespace AspNetCore #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml" System.Collections.IEnumerable __typeHelper = default(System.Collections.IEnumerable); + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.mappings.txt index 14e9047943..7d84cf754d 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (7:0,7 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml) |System.Collections.IEnumerable| -Generated Location: (688:18,0 [30] ) +Generated Location: (769:19,0 [30] ) |System.Collections.IEnumerable| diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.cs index dc5fcee8a2..e8f705cef7 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.cs @@ -16,11 +16,19 @@ namespace AspNetCore #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels.cshtml" ThisShouldBeGenerated __typeHelper = default(ThisShouldBeGenerated); + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels.cshtml" System.Collections.IEnumerable __typeHelper = default(System.Collections.IEnumerable); + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.mappings.txt index ff5971643c..79d7e257c7 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.mappings.txt @@ -1,10 +1,10 @@ Source Location: (7:0,7 [21] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels.cshtml) |ThisShouldBeGenerated| -Generated Location: (688:18,0 [21] ) +Generated Location: (778:19,0 [21] ) |ThisShouldBeGenerated| Source Location: (37:1,7 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels.cshtml) |System.Collections.IEnumerable| -Generated Location: (818:22,0 [30] ) +Generated Location: (1029:27,0 [30] ) |System.Collections.IEnumerable| diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.cs index 604b3f412a..3ca46af8a7 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.cs @@ -17,15 +17,27 @@ namespace AspNetCore #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml" DateTime __typeHelper = default(DateTime); + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml" global::System.Object __typeHelper = "InputTestTagHelper, AppCode"; + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 11 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml" global::System.Object Section1 = null; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.mappings.txt index 4eb221e12b..1cc991810c 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.mappings.txt @@ -1,29 +1,29 @@ Source Location: (7:0,7 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml) |DateTime| -Generated Location: (735:19,0 [8] ) +Generated Location: (819:20,0 [8] ) |DateTime| Source Location: (33:2,14 [29] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml) |"InputTestTagHelper, AppCode"| -Generated Location: (876:23,37 [29] ) +Generated Location: (1075:28,37 [29] ) |"InputTestTagHelper, AppCode"| Source Location: (152:10,9 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml) |Section1| -Generated Location: (990:27,22 [8] ) +Generated Location: (1305:36,22 [8] ) |Section1| Source Location: (68:4,2 [46] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml) | Layout = "_SectionTestLayout.cshtml"; | -Generated Location: (1425:39,2 [46] ) +Generated Location: (1771:51,2 [46] ) | Layout = "_SectionTestLayout.cshtml"; | Source Location: (222:12,21 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml) |Date| -Generated Location: (1850:47,102 [4] ) +Generated Location: (2196:59,102 [4] ) |Date| diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.codegen.cs index 1cd38d3029..b6196f6651 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.codegen.cs @@ -18,7 +18,11 @@ namespace AspNetCore #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml" global::System.Object __typeHelper = "*, AppCode"; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.mappings.txt index dcc0a00913..9c5fd32efb 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.mappings.txt @@ -1,19 +1,19 @@ Source Location: (14:0,14 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml) |"*, AppCode"| -Generated Location: (959:20,37 [12] ) +Generated Location: (1057:21,37 [12] ) |"*, AppCode"| Source Location: (30:1,2 [26] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml) | var foo = "Hello"; | -Generated Location: (1405:32,2 [26] ) +Generated Location: (1534:36,2 [26] ) | var foo = "Hello"; | Source Location: (83:5,22 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml) |foo| -Generated Location: (1856:40,22 [3] ) +Generated Location: (1985:44,22 [3] ) |foo| diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.codegen.cs index 6bc3c83d01..1f60d924cc 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.codegen.cs @@ -16,11 +16,19 @@ namespace AspNetCore #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml" IHtmlHelper __typeHelper = default(IHtmlHelper); + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml" global::System.Object Helper = null; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.mappings.txt index a418264123..dc03ca32da 100644 --- a/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.mappings.txt @@ -1,10 +1,10 @@ Source Location: (8:0,8 [19] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml) |IHtmlHelper| -Generated Location: (672:18,0 [19] ) +Generated Location: (760:19,0 [19] ) |IHtmlHelper| Source Location: (28:0,28 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml) |Helper| -Generated Location: (820:22,22 [6] ) +Generated Location: (1027:27,22 [6] ) |Helper| diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/DirectiveTokenEditHandlerTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/DirectiveTokenEditHandlerTest.cs index 0ddfa731e4..9cb09633a6 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/DirectiveTokenEditHandlerTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/DirectiveTokenEditHandlerTest.cs @@ -22,7 +22,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Test var directiveTokenHandler = new TestDirectiveTokenEditHandler(); var target = factory.Span(SpanKindInternal.Code, "SomeNamespace", markup: false) .With(directiveTokenHandler) - .Accepts(AcceptedCharactersInternal.NonWhiteSpace); + .Accepts(AcceptedCharactersInternal.NonWhitespace); var sourceChange = new SourceChange(index, length, newText); // Act @@ -43,7 +43,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Test var directiveTokenHandler = new TestDirectiveTokenEditHandler(); var target = factory.Span(SpanKindInternal.Code, "Some Namespace", markup: false) .With(directiveTokenHandler) - .Accepts(AcceptedCharactersInternal.NonWhiteSpace); + .Accepts(AcceptedCharactersInternal.NonWhitespace); var sourceChange = new SourceChange(index, length, newText); // Act diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Extensions/DesignTimeDirectiveTargetExtensionTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Extensions/DesignTimeDirectiveTargetExtensionTest.cs index e06f7a5dcc..d8f65c3d7b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Extensions/DesignTimeDirectiveTargetExtensionTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Extensions/DesignTimeDirectiveTargetExtensionTest.cs @@ -58,7 +58,11 @@ private void __RazorDirectiveTokenHelpers__() { @"#pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 ""test.cshtml"" System.String __typeHelper = default(System.String); + +#line default +#line hidden } ))(); } @@ -93,7 +97,11 @@ System.String __typeHelper = default(System.String); @"#pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 ""test.cshtml"" global::System.Object __typeHelper = nameof(System.Collections.Generic); + +#line default +#line hidden } ))(); } @@ -128,7 +136,11 @@ global::System.Object __typeHelper = nameof(System.Collections.Generic); @"#pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 ""test.cshtml"" global::System.Object Foo = null; + +#line default +#line hidden } ))(); } @@ -170,11 +182,19 @@ global::System.Object Foo = null; @"#pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 ""test.cshtml"" global::System.Object __typeHelper = ""Value""; + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 1 ""test.cshtml"" global::System.Object __typeHelper = ""Value""; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/CodeGenerationIntegrationTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/CodeGenerationIntegrationTest.cs index 6ead22dfae..2f91c8edc5 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/CodeGenerationIntegrationTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/CodeGenerationIntegrationTest.cs @@ -10,7 +10,11 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests { public class CodeGenerationIntegrationTest : IntegrationTestBase { - + public CodeGenerationIntegrationTest() + : base(generateBaselines: null) + { + } + #region Runtime [Fact] public void IncompleteDirectives_Runtime() diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/ExtensibleDirectiveTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/ExtensibleDirectiveTest.cs index e26ce3b6fd..11bfe9793e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/ExtensibleDirectiveTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/IntegrationTests/ExtensibleDirectiveTest.cs @@ -8,6 +8,11 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests // Extensible directives only have codegen for design time, so we're only testing that. public class ExtensibleDirectiveTest : IntegrationTestBase { + public ExtensibleDirectiveTest() + : base(generateBaselines: null) + { + } + [Fact] public void NamespaceToken() { diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/BlockTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/BlockTest.cs index d54ef401df..5cfbec740a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/BlockTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/BlockTest.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Linq; +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; using Xunit; namespace Microsoft.AspNetCore.Razor.Language.Legacy @@ -13,7 +14,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { // Arrange var spanBuilder = new SpanBuilder(SourceLocation.Zero); - spanBuilder.Accept(new HtmlToken("hello", HtmlTokenType.Text)); + spanBuilder.Accept(SyntaxFactory.Token(SyntaxKind.Text, "hello")); var span = spanBuilder.Build(); var blockBuilder = new BlockBuilder() { @@ -29,7 +30,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy var parentBlock = blockBuilder.Build(); var originalBlockLength = parentBlock.Length; spanBuilder = new SpanBuilder(SourceLocation.Zero); - spanBuilder.Accept(new HtmlToken("hi", HtmlTokenType.Text)); + spanBuilder.Accept(SyntaxFactory.Token(SyntaxKind.Text, "hi")); span.ReplaceWith(spanBuilder); // Wire up parents now so we can re-trigger ChildChanged to cause cache refresh. diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpLanguageCharacteristicsTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpLanguageCharacteristicsTest.cs index e8eeb8c586..84802523b2 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpLanguageCharacteristicsTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpLanguageCharacteristicsTest.cs @@ -11,7 +11,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy public void GetSample_RightShiftAssign_ReturnsCorrectToken() { // Arrange & Act - var token = CSharpLanguageCharacteristics.Instance.GetSample(CSharpTokenType.RightShiftAssign); + var token = CSharpLanguageCharacteristics.Instance.GetSample(SyntaxKind.RightShiftAssign); // Assert Assert.Equal(">>=", token); diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpRazorCommentsTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpRazorCommentsTest.cs index bcc8974b86..af280d67f0 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpRazorCommentsTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpRazorCommentsTest.cs @@ -42,6 +42,18 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy + "}"); } + [Fact] + public void RazorCommentInOpeningTagBlock() + { + ParseDocumentTest(""); + } + + [Fact] + public void RazorCommentInClosingTagBlock() + { + ParseDocumentTest(""); + } + [Fact] public void UnterminatedRazorCommentInVerbatimBlock() { diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpTokenizerCommentTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpTokenizerCommentTest.cs index 64dafafa16..0a7c55cc34 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpTokenizerCommentTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpTokenizerCommentTest.cs @@ -1,22 +1,23 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; using Xunit; namespace Microsoft.AspNetCore.Razor.Language.Legacy { public class CSharpTokenizerCommentTest : CSharpTokenizerTestBase { - private new CSharpToken IgnoreRemaining => (CSharpToken)base.IgnoreRemaining; + private new SyntaxToken IgnoreRemaining => (SyntaxToken)base.IgnoreRemaining; [Fact] public void Next_Ignores_Star_At_EOF_In_RazorComment() { TestTokenizer( "@* Foo * Bar * Baz *", - new CSharpToken("@", CSharpTokenType.RazorCommentTransition), - new CSharpToken("*", CSharpTokenType.RazorCommentStar), - new CSharpToken(" Foo * Bar * Baz *", CSharpTokenType.RazorComment)); + SyntaxFactory.Token(SyntaxKind.RazorCommentTransition, "@"), + SyntaxFactory.Token(SyntaxKind.RazorCommentStar, "*"), + SyntaxFactory.Token(SyntaxKind.RazorCommentLiteral, " Foo * Bar * Baz *")); } [Fact] @@ -24,11 +25,11 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { TestTokenizer( "@* Foo * Bar * Baz *@", - new CSharpToken("@", CSharpTokenType.RazorCommentTransition), - new CSharpToken("*", CSharpTokenType.RazorCommentStar), - new CSharpToken(" Foo * Bar * Baz ", CSharpTokenType.RazorComment), - new CSharpToken("*", CSharpTokenType.RazorCommentStar), - new CSharpToken("@", CSharpTokenType.RazorCommentTransition)); + SyntaxFactory.Token(SyntaxKind.RazorCommentTransition, "@"), + SyntaxFactory.Token(SyntaxKind.RazorCommentStar, "*"), + SyntaxFactory.Token(SyntaxKind.RazorCommentLiteral, " Foo * Bar * Baz "), + SyntaxFactory.Token(SyntaxKind.RazorCommentStar, "*"), + SyntaxFactory.Token(SyntaxKind.RazorCommentTransition, "@")); } [Fact] @@ -36,59 +37,59 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { TestTokenizer( "@* Foo Bar Baz *@", - new CSharpToken("@", CSharpTokenType.RazorCommentTransition), - new CSharpToken("*", CSharpTokenType.RazorCommentStar), - new CSharpToken(" Foo Bar Baz ", CSharpTokenType.RazorComment), - new CSharpToken("*", CSharpTokenType.RazorCommentStar), - new CSharpToken("@", CSharpTokenType.RazorCommentTransition)); + SyntaxFactory.Token(SyntaxKind.RazorCommentTransition, "@"), + SyntaxFactory.Token(SyntaxKind.RazorCommentStar, "*"), + SyntaxFactory.Token(SyntaxKind.RazorCommentLiteral, " Foo Bar Baz "), + SyntaxFactory.Token(SyntaxKind.RazorCommentStar, "*"), + SyntaxFactory.Token(SyntaxKind.RazorCommentTransition, "@")); } [Fact] public void Next_Returns_Comment_Token_For_Entire_Single_Line_Comment() { - TestTokenizer("// Foo Bar Baz", new CSharpToken("// Foo Bar Baz", CSharpTokenType.Comment)); + TestTokenizer("// Foo Bar Baz", SyntaxFactory.Token(SyntaxKind.CSharpComment, "// Foo Bar Baz")); } [Fact] public void Single_Line_Comment_Is_Terminated_By_Newline() { - TestTokenizer("// Foo Bar Baz\na", new CSharpToken("// Foo Bar Baz", CSharpTokenType.Comment), IgnoreRemaining); + TestTokenizer("// Foo Bar Baz\na", SyntaxFactory.Token(SyntaxKind.CSharpComment, "// Foo Bar Baz"), IgnoreRemaining); } [Fact] public void Multi_Line_Comment_In_Single_Line_Comment_Has_No_Effect() { - TestTokenizer("// Foo/*Bar*/ Baz\na", new CSharpToken("// Foo/*Bar*/ Baz", CSharpTokenType.Comment), IgnoreRemaining); + TestTokenizer("// Foo/*Bar*/ Baz\na", SyntaxFactory.Token(SyntaxKind.CSharpComment, "// Foo/*Bar*/ Baz"), IgnoreRemaining); } [Fact] public void Next_Returns_Comment_Token_For_Entire_Multi_Line_Comment() { - TestTokenizer("/* Foo\nBar\nBaz */", new CSharpToken("/* Foo\nBar\nBaz */", CSharpTokenType.Comment)); + TestTokenizer("/* Foo\nBar\nBaz */", SyntaxFactory.Token(SyntaxKind.CSharpComment, "/* Foo\nBar\nBaz */")); } [Fact] public void Multi_Line_Comment_Is_Terminated_By_End_Sequence() { - TestTokenizer("/* Foo\nBar\nBaz */a", new CSharpToken("/* Foo\nBar\nBaz */", CSharpTokenType.Comment), IgnoreRemaining); + TestTokenizer("/* Foo\nBar\nBaz */a", SyntaxFactory.Token(SyntaxKind.CSharpComment, "/* Foo\nBar\nBaz */"), IgnoreRemaining); } [Fact] public void Unterminated_Multi_Line_Comment_Captures_To_EOF() { - TestTokenizer("/* Foo\nBar\nBaz", new CSharpToken("/* Foo\nBar\nBaz", CSharpTokenType.Comment), IgnoreRemaining); + TestTokenizer("/* Foo\nBar\nBaz", SyntaxFactory.Token(SyntaxKind.CSharpComment, "/* Foo\nBar\nBaz"), IgnoreRemaining); } [Fact] public void Nested_Multi_Line_Comments_Terminated_At_First_End_Sequence() { - TestTokenizer("/* Foo/*\nBar\nBaz*/ */", new CSharpToken("/* Foo/*\nBar\nBaz*/", CSharpTokenType.Comment), IgnoreRemaining); + TestTokenizer("/* Foo/*\nBar\nBaz*/ */", SyntaxFactory.Token(SyntaxKind.CSharpComment, "/* Foo/*\nBar\nBaz*/"), IgnoreRemaining); } [Fact] public void Nested_Multi_Line_Comments_Terminated_At_Full_End_Sequence() { - TestTokenizer("/* Foo\nBar\nBaz* */", new CSharpToken("/* Foo\nBar\nBaz* */", CSharpTokenType.Comment), IgnoreRemaining); + TestTokenizer("/* Foo\nBar\nBaz* */", SyntaxFactory.Token(SyntaxKind.CSharpComment, "/* Foo\nBar\nBaz* */"), IgnoreRemaining); } } } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpTokenizerIdentifierTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpTokenizerIdentifierTest.cs index b24c976dc9..e5a3a466ac 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpTokenizerIdentifierTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpTokenizerIdentifierTest.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; using Xunit; namespace Microsoft.AspNetCore.Razor.Language.Legacy @@ -10,73 +11,73 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy [Fact] public void Simple_Identifier_Is_Recognized() { - TestTokenizer("foo", new CSharpToken("foo", CSharpTokenType.Identifier)); + TestTokenizer("foo", SyntaxFactory.Token(SyntaxKind.Identifier, "foo")); } [Fact] public void Identifier_Starting_With_Underscore_Is_Recognized() { - TestTokenizer("_foo", new CSharpToken("_foo", CSharpTokenType.Identifier)); + TestTokenizer("_foo", SyntaxFactory.Token(SyntaxKind.Identifier, "_foo")); } [Fact] public void Identifier_Can_Contain_Digits() { - TestTokenizer("foo4", new CSharpToken("foo4", CSharpTokenType.Identifier)); + TestTokenizer("foo4", SyntaxFactory.Token(SyntaxKind.Identifier, "foo4")); } [Fact] public void Identifier_Can_Start_With_Titlecase_Letter() { - TestTokenizer("ῼfoo", new CSharpToken("ῼfoo", CSharpTokenType.Identifier)); + TestTokenizer("ῼfoo", SyntaxFactory.Token(SyntaxKind.Identifier, "ῼfoo")); } [Fact] public void Identifier_Can_Start_With_Letter_Modifier() { - TestTokenizer("ᵊfoo", new CSharpToken("ᵊfoo", CSharpTokenType.Identifier)); + TestTokenizer("ᵊfoo", SyntaxFactory.Token(SyntaxKind.Identifier, "ᵊfoo")); } [Fact] public void Identifier_Can_Start_With_Other_Letter() { - TestTokenizer("ƻfoo", new CSharpToken("ƻfoo", CSharpTokenType.Identifier)); + TestTokenizer("ƻfoo", SyntaxFactory.Token(SyntaxKind.Identifier, "ƻfoo")); } [Fact] public void Identifier_Can_Start_With_Number_Letter() { - TestTokenizer("Ⅽool", new CSharpToken("Ⅽool", CSharpTokenType.Identifier)); + TestTokenizer("Ⅽool", SyntaxFactory.Token(SyntaxKind.Identifier, "Ⅽool")); } [Fact] public void Identifier_Can_Contain_Non_Spacing_Mark() { - TestTokenizer("foo\u0300", new CSharpToken("foo\u0300", CSharpTokenType.Identifier)); + TestTokenizer("foo\u0300", SyntaxFactory.Token(SyntaxKind.Identifier, "foo\u0300")); } [Fact] public void Identifier_Can_Contain_Spacing_Combining_Mark() { - TestTokenizer("fooः", new CSharpToken("fooः", CSharpTokenType.Identifier)); + TestTokenizer("fooः", SyntaxFactory.Token(SyntaxKind.Identifier, "fooः")); } [Fact] public void Identifier_Can_Contain_Non_English_Digit() { - TestTokenizer("foo١", new CSharpToken("foo١", CSharpTokenType.Identifier)); + TestTokenizer("foo١", SyntaxFactory.Token(SyntaxKind.Identifier, "foo١")); } [Fact] public void Identifier_Can_Contain_Connector_Punctuation() { - TestTokenizer("foo‿bar", new CSharpToken("foo‿bar", CSharpTokenType.Identifier)); + TestTokenizer("foo‿bar", SyntaxFactory.Token(SyntaxKind.Identifier, "foo‿bar")); } [Fact] public void Identifier_Can_Contain_Format_Character() { - TestTokenizer("foo؃bar", new CSharpToken("foo؃bar", CSharpTokenType.Identifier)); + TestTokenizer("foo؃bar", SyntaxFactory.Token(SyntaxKind.Identifier, "foo؃bar")); } [Fact] @@ -164,7 +165,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy private void TestKeyword(string keyword, CSharpKeyword keywordType) { - TestTokenizer(keyword, new CSharpToken(keyword, CSharpTokenType.Keyword) { Keyword = keywordType }); + TestTokenizer(keyword, SyntaxFactory.Token(SyntaxKind.Keyword, keyword)); } } } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpTokenizerLiteralTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpTokenizerLiteralTest.cs index a10aea8ba9..c7c250cce3 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpTokenizerLiteralTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpTokenizerLiteralTest.cs @@ -2,286 +2,287 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; using Xunit; namespace Microsoft.AspNetCore.Razor.Language.Legacy { public class CSharpTokenizerLiteralTest : CSharpTokenizerTestBase { - private new CSharpToken IgnoreRemaining => (CSharpToken)base.IgnoreRemaining; + private new SyntaxToken IgnoreRemaining => (SyntaxToken)base.IgnoreRemaining; [Fact] public void Simple_Integer_Literal_Is_Recognized() { - TestSingleToken("01189998819991197253", CSharpTokenType.IntegerLiteral); + TestSingleToken("01189998819991197253", SyntaxKind.IntegerLiteral); } [Fact] public void Integer_Type_Suffix_Is_Recognized() { - TestSingleToken("42U", CSharpTokenType.IntegerLiteral); - TestSingleToken("42u", CSharpTokenType.IntegerLiteral); + TestSingleToken("42U", SyntaxKind.IntegerLiteral); + TestSingleToken("42u", SyntaxKind.IntegerLiteral); - TestSingleToken("42L", CSharpTokenType.IntegerLiteral); - TestSingleToken("42l", CSharpTokenType.IntegerLiteral); + TestSingleToken("42L", SyntaxKind.IntegerLiteral); + TestSingleToken("42l", SyntaxKind.IntegerLiteral); - TestSingleToken("42UL", CSharpTokenType.IntegerLiteral); - TestSingleToken("42Ul", CSharpTokenType.IntegerLiteral); + TestSingleToken("42UL", SyntaxKind.IntegerLiteral); + TestSingleToken("42Ul", SyntaxKind.IntegerLiteral); - TestSingleToken("42uL", CSharpTokenType.IntegerLiteral); - TestSingleToken("42ul", CSharpTokenType.IntegerLiteral); + TestSingleToken("42uL", SyntaxKind.IntegerLiteral); + TestSingleToken("42ul", SyntaxKind.IntegerLiteral); - TestSingleToken("42LU", CSharpTokenType.IntegerLiteral); - TestSingleToken("42Lu", CSharpTokenType.IntegerLiteral); + TestSingleToken("42LU", SyntaxKind.IntegerLiteral); + TestSingleToken("42Lu", SyntaxKind.IntegerLiteral); - TestSingleToken("42lU", CSharpTokenType.IntegerLiteral); - TestSingleToken("42lu", CSharpTokenType.IntegerLiteral); + TestSingleToken("42lU", SyntaxKind.IntegerLiteral); + TestSingleToken("42lu", SyntaxKind.IntegerLiteral); } [Fact] public void Trailing_Letter_Is_Not_Part_Of_Integer_Literal_If_Not_Type_Sufix() { - TestTokenizer("42a", new CSharpToken("42", CSharpTokenType.IntegerLiteral), IgnoreRemaining); + TestTokenizer("42a", SyntaxFactory.Token(SyntaxKind.IntegerLiteral, "42"), IgnoreRemaining); } [Fact] public void Simple_Hex_Literal_Is_Recognized() { - TestSingleToken("0x0123456789ABCDEF", CSharpTokenType.IntegerLiteral); + TestSingleToken("0x0123456789ABCDEF", SyntaxKind.IntegerLiteral); } [Fact] public void Integer_Type_Suffix_Is_Recognized_In_Hex_Literal() { - TestSingleToken("0xDEADBEEFU", CSharpTokenType.IntegerLiteral); - TestSingleToken("0xDEADBEEFu", CSharpTokenType.IntegerLiteral); + TestSingleToken("0xDEADBEEFU", SyntaxKind.IntegerLiteral); + TestSingleToken("0xDEADBEEFu", SyntaxKind.IntegerLiteral); - TestSingleToken("0xDEADBEEFL", CSharpTokenType.IntegerLiteral); - TestSingleToken("0xDEADBEEFl", CSharpTokenType.IntegerLiteral); + TestSingleToken("0xDEADBEEFL", SyntaxKind.IntegerLiteral); + TestSingleToken("0xDEADBEEFl", SyntaxKind.IntegerLiteral); - TestSingleToken("0xDEADBEEFUL", CSharpTokenType.IntegerLiteral); - TestSingleToken("0xDEADBEEFUl", CSharpTokenType.IntegerLiteral); + TestSingleToken("0xDEADBEEFUL", SyntaxKind.IntegerLiteral); + TestSingleToken("0xDEADBEEFUl", SyntaxKind.IntegerLiteral); - TestSingleToken("0xDEADBEEFuL", CSharpTokenType.IntegerLiteral); - TestSingleToken("0xDEADBEEFul", CSharpTokenType.IntegerLiteral); + TestSingleToken("0xDEADBEEFuL", SyntaxKind.IntegerLiteral); + TestSingleToken("0xDEADBEEFul", SyntaxKind.IntegerLiteral); - TestSingleToken("0xDEADBEEFLU", CSharpTokenType.IntegerLiteral); - TestSingleToken("0xDEADBEEFLu", CSharpTokenType.IntegerLiteral); + TestSingleToken("0xDEADBEEFLU", SyntaxKind.IntegerLiteral); + TestSingleToken("0xDEADBEEFLu", SyntaxKind.IntegerLiteral); - TestSingleToken("0xDEADBEEFlU", CSharpTokenType.IntegerLiteral); - TestSingleToken("0xDEADBEEFlu", CSharpTokenType.IntegerLiteral); + TestSingleToken("0xDEADBEEFlU", SyntaxKind.IntegerLiteral); + TestSingleToken("0xDEADBEEFlu", SyntaxKind.IntegerLiteral); } [Fact] public void Trailing_Letter_Is_Not_Part_Of_Hex_Literal_If_Not_Type_Sufix() { - TestTokenizer("0xDEADBEEFz", new CSharpToken("0xDEADBEEF", CSharpTokenType.IntegerLiteral), IgnoreRemaining); + TestTokenizer("0xDEADBEEFz", SyntaxFactory.Token(SyntaxKind.IntegerLiteral, "0xDEADBEEF"), IgnoreRemaining); } [Fact] public void Dot_Followed_By_Non_Digit_Is_Not_Part_Of_Real_Literal() { - TestTokenizer("3.a", new CSharpToken("3", CSharpTokenType.IntegerLiteral), IgnoreRemaining); + TestTokenizer("3.a", SyntaxFactory.Token(SyntaxKind.IntegerLiteral, "3"), IgnoreRemaining); } [Fact] public void Simple_Real_Literal_Is_Recognized() { - TestTokenizer("3.14159", new CSharpToken("3.14159", CSharpTokenType.RealLiteral)); + TestTokenizer("3.14159", SyntaxFactory.Token(SyntaxKind.RealLiteral, "3.14159")); } [Fact] public void Real_Literal_Between_Zero_And_One_Is_Recognized() { - TestTokenizer(".14159", new CSharpToken(".14159", CSharpTokenType.RealLiteral)); + TestTokenizer(".14159", SyntaxFactory.Token(SyntaxKind.RealLiteral, ".14159")); } [Fact] public void Integer_With_Real_Type_Suffix_Is_Recognized() { - TestSingleToken("42F", CSharpTokenType.RealLiteral); - TestSingleToken("42f", CSharpTokenType.RealLiteral); - TestSingleToken("42D", CSharpTokenType.RealLiteral); - TestSingleToken("42d", CSharpTokenType.RealLiteral); - TestSingleToken("42M", CSharpTokenType.RealLiteral); - TestSingleToken("42m", CSharpTokenType.RealLiteral); + TestSingleToken("42F", SyntaxKind.RealLiteral); + TestSingleToken("42f", SyntaxKind.RealLiteral); + TestSingleToken("42D", SyntaxKind.RealLiteral); + TestSingleToken("42d", SyntaxKind.RealLiteral); + TestSingleToken("42M", SyntaxKind.RealLiteral); + TestSingleToken("42m", SyntaxKind.RealLiteral); } [Fact] public void Integer_With_Exponent_Is_Recognized() { - TestSingleToken("1e10", CSharpTokenType.RealLiteral); - TestSingleToken("1E10", CSharpTokenType.RealLiteral); - TestSingleToken("1e+10", CSharpTokenType.RealLiteral); - TestSingleToken("1E+10", CSharpTokenType.RealLiteral); - TestSingleToken("1e-10", CSharpTokenType.RealLiteral); - TestSingleToken("1E-10", CSharpTokenType.RealLiteral); + TestSingleToken("1e10", SyntaxKind.RealLiteral); + TestSingleToken("1E10", SyntaxKind.RealLiteral); + TestSingleToken("1e+10", SyntaxKind.RealLiteral); + TestSingleToken("1E+10", SyntaxKind.RealLiteral); + TestSingleToken("1e-10", SyntaxKind.RealLiteral); + TestSingleToken("1E-10", SyntaxKind.RealLiteral); } [Fact] public void Real_Number_With_Type_Suffix_Is_Recognized() { - TestSingleToken("3.14F", CSharpTokenType.RealLiteral); - TestSingleToken("3.14f", CSharpTokenType.RealLiteral); - TestSingleToken("3.14D", CSharpTokenType.RealLiteral); - TestSingleToken("3.14d", CSharpTokenType.RealLiteral); - TestSingleToken("3.14M", CSharpTokenType.RealLiteral); - TestSingleToken("3.14m", CSharpTokenType.RealLiteral); + TestSingleToken("3.14F", SyntaxKind.RealLiteral); + TestSingleToken("3.14f", SyntaxKind.RealLiteral); + TestSingleToken("3.14D", SyntaxKind.RealLiteral); + TestSingleToken("3.14d", SyntaxKind.RealLiteral); + TestSingleToken("3.14M", SyntaxKind.RealLiteral); + TestSingleToken("3.14m", SyntaxKind.RealLiteral); } [Fact] public void Real_Number_With_Exponent_Is_Recognized() { - TestSingleToken("3.14E10", CSharpTokenType.RealLiteral); - TestSingleToken("3.14e10", CSharpTokenType.RealLiteral); - TestSingleToken("3.14E+10", CSharpTokenType.RealLiteral); - TestSingleToken("3.14e+10", CSharpTokenType.RealLiteral); - TestSingleToken("3.14E-10", CSharpTokenType.RealLiteral); - TestSingleToken("3.14e-10", CSharpTokenType.RealLiteral); + TestSingleToken("3.14E10", SyntaxKind.RealLiteral); + TestSingleToken("3.14e10", SyntaxKind.RealLiteral); + TestSingleToken("3.14E+10", SyntaxKind.RealLiteral); + TestSingleToken("3.14e+10", SyntaxKind.RealLiteral); + TestSingleToken("3.14E-10", SyntaxKind.RealLiteral); + TestSingleToken("3.14e-10", SyntaxKind.RealLiteral); } [Fact] public void Real_Number_With_Exponent_And_Type_Suffix_Is_Recognized() { - TestSingleToken("3.14E+10F", CSharpTokenType.RealLiteral); + TestSingleToken("3.14E+10F", SyntaxKind.RealLiteral); } [Fact] public void Single_Character_Literal_Is_Recognized() { - TestSingleToken("'f'", CSharpTokenType.CharacterLiteral); + TestSingleToken("'f'", SyntaxKind.CharacterLiteral); } [Fact] public void Multi_Character_Literal_Is_Recognized() { - TestSingleToken("'foo'", CSharpTokenType.CharacterLiteral); + TestSingleToken("'foo'", SyntaxKind.CharacterLiteral); } [Fact] public void Character_Literal_Is_Terminated_By_EOF_If_Unterminated() { - TestSingleToken("'foo bar", CSharpTokenType.CharacterLiteral); + TestSingleToken("'foo bar", SyntaxKind.CharacterLiteral); } [Fact] public void Character_Literal_Not_Terminated_By_Escaped_Quote() { - TestSingleToken("'foo\\'bar'", CSharpTokenType.CharacterLiteral); + TestSingleToken("'foo\\'bar'", SyntaxKind.CharacterLiteral); } [Fact] public void Character_Literal_Is_Terminated_By_EOL_If_Unterminated() { - TestTokenizer("'foo\n", new CSharpToken("'foo", CSharpTokenType.CharacterLiteral), IgnoreRemaining); + TestTokenizer("'foo\n", SyntaxFactory.Token(SyntaxKind.CharacterLiteral, "'foo"), IgnoreRemaining); } [Fact] public void Character_Literal_Terminated_By_EOL_Even_When_Last_Char_Is_Slash() { - TestTokenizer("'foo\\\n", new CSharpToken("'foo\\", CSharpTokenType.CharacterLiteral), IgnoreRemaining); + TestTokenizer("'foo\\\n", SyntaxFactory.Token(SyntaxKind.CharacterLiteral, "'foo\\"), IgnoreRemaining); } [Fact] public void Character_Literal_Terminated_By_EOL_Even_When_Last_Char_Is_Slash_And_Followed_By_Stuff() { - TestTokenizer("'foo\\\nflarg", new CSharpToken("'foo\\", CSharpTokenType.CharacterLiteral), IgnoreRemaining); + TestTokenizer("'foo\\\nflarg", SyntaxFactory.Token(SyntaxKind.CharacterLiteral, "'foo\\"), IgnoreRemaining); } [Fact] public void Character_Literal_Terminated_By_CRLF_Even_When_Last_Char_Is_Slash() { - TestTokenizer("'foo\\" + Environment.NewLine, new CSharpToken("'foo\\", CSharpTokenType.CharacterLiteral), IgnoreRemaining); + TestTokenizer("'foo\\" + Environment.NewLine, SyntaxFactory.Token(SyntaxKind.CharacterLiteral, "'foo\\"), IgnoreRemaining); } [Fact] public void Character_Literal_Terminated_By_CRLF_Even_When_Last_Char_Is_Slash_And_Followed_By_Stuff() { - TestTokenizer($"'foo\\{Environment.NewLine}flarg", new CSharpToken("'foo\\", CSharpTokenType.CharacterLiteral), IgnoreRemaining); + TestTokenizer($"'foo\\{Environment.NewLine}flarg", SyntaxFactory.Token(SyntaxKind.CharacterLiteral, "'foo\\"), IgnoreRemaining); } [Fact] public void Character_Literal_Allows_Escaped_Escape() { - TestTokenizer("'foo\\\\'blah", new CSharpToken("'foo\\\\'", CSharpTokenType.CharacterLiteral), IgnoreRemaining); + TestTokenizer("'foo\\\\'blah", SyntaxFactory.Token(SyntaxKind.CharacterLiteral, "'foo\\\\'"), IgnoreRemaining); } [Fact] public void String_Literal_Is_Recognized() { - TestSingleToken("\"foo\"", CSharpTokenType.StringLiteral); + TestSingleToken("\"foo\"", SyntaxKind.StringLiteral); } [Fact] public void String_Literal_Is_Terminated_By_EOF_If_Unterminated() { - TestSingleToken("\"foo bar", CSharpTokenType.StringLiteral); + TestSingleToken("\"foo bar", SyntaxKind.StringLiteral); } [Fact] public void String_Literal_Not_Terminated_By_Escaped_Quote() { - TestSingleToken("\"foo\\\"bar\"", CSharpTokenType.StringLiteral); + TestSingleToken("\"foo\\\"bar\"", SyntaxKind.StringLiteral); } [Fact] public void String_Literal_Is_Terminated_By_EOL_If_Unterminated() { - TestTokenizer("\"foo\n", new CSharpToken("\"foo", CSharpTokenType.StringLiteral), IgnoreRemaining); + TestTokenizer("\"foo\n", SyntaxFactory.Token(SyntaxKind.StringLiteral, "\"foo"), IgnoreRemaining); } [Fact] public void String_Literal_Terminated_By_EOL_Even_When_Last_Char_Is_Slash() { - TestTokenizer("\"foo\\\n", new CSharpToken("\"foo\\", CSharpTokenType.StringLiteral), IgnoreRemaining); + TestTokenizer("\"foo\\\n", SyntaxFactory.Token(SyntaxKind.StringLiteral, "\"foo\\"), IgnoreRemaining); } [Fact] public void String_Literal_Terminated_By_EOL_Even_When_Last_Char_Is_Slash_And_Followed_By_Stuff() { - TestTokenizer("\"foo\\\nflarg", new CSharpToken("\"foo\\", CSharpTokenType.StringLiteral), IgnoreRemaining); + TestTokenizer("\"foo\\\nflarg", SyntaxFactory.Token(SyntaxKind.StringLiteral, "\"foo\\"), IgnoreRemaining); } [Fact] public void String_Literal_Terminated_By_CRLF_Even_When_Last_Char_Is_Slash() { - TestTokenizer("\"foo\\" + Environment.NewLine, new CSharpToken("\"foo\\", CSharpTokenType.StringLiteral), IgnoreRemaining); + TestTokenizer("\"foo\\" + Environment.NewLine, SyntaxFactory.Token(SyntaxKind.StringLiteral, "\"foo\\"), IgnoreRemaining); } [Fact] public void String_Literal_Terminated_By_CRLF_Even_When_Last_Char_Is_Slash_And_Followed_By_Stuff() { - TestTokenizer($"\"foo\\{Environment.NewLine}flarg", new CSharpToken("\"foo\\", CSharpTokenType.StringLiteral), IgnoreRemaining); + TestTokenizer($"\"foo\\{Environment.NewLine}flarg", SyntaxFactory.Token(SyntaxKind.StringLiteral, "\"foo\\"), IgnoreRemaining); } [Fact] public void String_Literal_Allows_Escaped_Escape() { - TestTokenizer("\"foo\\\\\"blah", new CSharpToken("\"foo\\\\\"", CSharpTokenType.StringLiteral), IgnoreRemaining); + TestTokenizer("\"foo\\\\\"blah", SyntaxFactory.Token(SyntaxKind.StringLiteral, "\"foo\\\\\""), IgnoreRemaining); } [Fact] public void Verbatim_String_Literal_Can_Contain_Newlines() { - TestSingleToken("@\"foo\nbar\nbaz\"", CSharpTokenType.StringLiteral); + TestSingleToken("@\"foo\nbar\nbaz\"", SyntaxKind.StringLiteral); } [Fact] public void Verbatim_String_Literal_Not_Terminated_By_Escaped_Double_Quote() { - TestSingleToken("@\"foo\"\"bar\"", CSharpTokenType.StringLiteral); + TestSingleToken("@\"foo\"\"bar\"", SyntaxKind.StringLiteral); } [Fact] public void Verbatim_String_Literal_Is_Terminated_By_Slash_Double_Quote() { - TestTokenizer("@\"foo\\\"bar\"", new CSharpToken("@\"foo\\\"", CSharpTokenType.StringLiteral), IgnoreRemaining); + TestTokenizer("@\"foo\\\"bar\"", SyntaxFactory.Token(SyntaxKind.StringLiteral, "@\"foo\\\""), IgnoreRemaining); } [Fact] public void Verbatim_String_Literal_Is_Terminated_By_EOF() { - TestSingleToken("@\"foo", CSharpTokenType.StringLiteral); + TestSingleToken("@\"foo", SyntaxKind.StringLiteral); } } } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpTokenizerOperatorsTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpTokenizerOperatorsTest.cs index 0b600ea9bc..fdf2718387 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpTokenizerOperatorsTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpTokenizerOperatorsTest.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; using Xunit; namespace Microsoft.AspNetCore.Razor.Language.Legacy @@ -10,287 +11,287 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy [Fact] public void LeftBrace_Is_Recognized() { - TestSingleToken("{", CSharpTokenType.LeftBrace); + TestSingleToken("{", SyntaxKind.LeftBrace); } [Fact] public void Plus_Is_Recognized() { - TestSingleToken("+", CSharpTokenType.Plus); + TestSingleToken("+", SyntaxKind.Plus); } [Fact] public void Assign_Is_Recognized() { - TestSingleToken("=", CSharpTokenType.Assign); + TestSingleToken("=", SyntaxKind.Assign); } [Fact] public void Arrow_Is_Recognized() { - TestSingleToken("->", CSharpTokenType.Arrow); + TestSingleToken("->", SyntaxKind.Arrow); } [Fact] public void AndAssign_Is_Recognized() { - TestSingleToken("&=", CSharpTokenType.AndAssign); + TestSingleToken("&=", SyntaxKind.AndAssign); } [Fact] public void RightBrace_Is_Recognized() { - TestSingleToken("}", CSharpTokenType.RightBrace); + TestSingleToken("}", SyntaxKind.RightBrace); } [Fact] public void Minus_Is_Recognized() { - TestSingleToken("-", CSharpTokenType.Minus); + TestSingleToken("-", SyntaxKind.Minus); } [Fact] public void LessThan_Is_Recognized() { - TestSingleToken("<", CSharpTokenType.LessThan); + TestSingleToken("<", SyntaxKind.LessThan); } [Fact] public void Equals_Is_Recognized() { - TestSingleToken("==", CSharpTokenType.Equals); + TestSingleToken("==", SyntaxKind.Equals); } [Fact] public void OrAssign_Is_Recognized() { - TestSingleToken("|=", CSharpTokenType.OrAssign); + TestSingleToken("|=", SyntaxKind.OrAssign); } [Fact] public void LeftBracket_Is_Recognized() { - TestSingleToken("[", CSharpTokenType.LeftBracket); + TestSingleToken("[", SyntaxKind.LeftBracket); } [Fact] public void Star_Is_Recognized() { - TestSingleToken("*", CSharpTokenType.Star); + TestSingleToken("*", SyntaxKind.Star); } [Fact] public void GreaterThan_Is_Recognized() { - TestSingleToken(">", CSharpTokenType.GreaterThan); + TestSingleToken(">", SyntaxKind.GreaterThan); } [Fact] public void NotEqual_Is_Recognized() { - TestSingleToken("!=", CSharpTokenType.NotEqual); + TestSingleToken("!=", SyntaxKind.NotEqual); } [Fact] public void XorAssign_Is_Recognized() { - TestSingleToken("^=", CSharpTokenType.XorAssign); + TestSingleToken("^=", SyntaxKind.XorAssign); } [Fact] public void RightBracket_Is_Recognized() { - TestSingleToken("]", CSharpTokenType.RightBracket); + TestSingleToken("]", SyntaxKind.RightBracket); } [Fact] public void Slash_Is_Recognized() { - TestSingleToken("/", CSharpTokenType.Slash); + TestSingleToken("/", SyntaxKind.Slash); } [Fact] public void QuestionMark_Is_Recognized() { - TestSingleToken("?", CSharpTokenType.QuestionMark); + TestSingleToken("?", SyntaxKind.QuestionMark); } [Fact] public void LessThanEqual_Is_Recognized() { - TestSingleToken("<=", CSharpTokenType.LessThanEqual); + TestSingleToken("<=", SyntaxKind.LessThanEqual); } [Fact] public void LeftShift_Is_Not_Specially_Recognized() { TestTokenizer("<<", - new CSharpToken("<", CSharpTokenType.LessThan), - new CSharpToken("<", CSharpTokenType.LessThan)); + SyntaxFactory.Token(SyntaxKind.LessThan, "<"), + SyntaxFactory.Token(SyntaxKind.LessThan, "<")); } [Fact] public void LeftParen_Is_Recognized() { - TestSingleToken("(", CSharpTokenType.LeftParenthesis); + TestSingleToken("(", SyntaxKind.LeftParenthesis); } [Fact] public void Modulo_Is_Recognized() { - TestSingleToken("%", CSharpTokenType.Modulo); + TestSingleToken("%", SyntaxKind.Modulo); } [Fact] public void NullCoalesce_Is_Recognized() { - TestSingleToken("??", CSharpTokenType.NullCoalesce); + TestSingleToken("??", SyntaxKind.NullCoalesce); } [Fact] public void GreaterThanEqual_Is_Recognized() { - TestSingleToken(">=", CSharpTokenType.GreaterThanEqual); + TestSingleToken(">=", SyntaxKind.GreaterThanEqual); } [Fact] public void EqualGreaterThan_Is_Recognized() { - TestSingleToken("=>", CSharpTokenType.GreaterThanEqual); + TestSingleToken("=>", SyntaxKind.GreaterThanEqual); } [Fact] public void RightParen_Is_Recognized() { - TestSingleToken(")", CSharpTokenType.RightParenthesis); + TestSingleToken(")", SyntaxKind.RightParenthesis); } [Fact] public void And_Is_Recognized() { - TestSingleToken("&", CSharpTokenType.And); + TestSingleToken("&", SyntaxKind.And); } [Fact] public void DoubleColon_Is_Recognized() { - TestSingleToken("::", CSharpTokenType.DoubleColon); + TestSingleToken("::", SyntaxKind.DoubleColon); } [Fact] public void PlusAssign_Is_Recognized() { - TestSingleToken("+=", CSharpTokenType.PlusAssign); + TestSingleToken("+=", SyntaxKind.PlusAssign); } [Fact] public void Semicolon_Is_Recognized() { - TestSingleToken(";", CSharpTokenType.Semicolon); + TestSingleToken(";", SyntaxKind.Semicolon); } [Fact] public void Tilde_Is_Recognized() { - TestSingleToken("~", CSharpTokenType.Tilde); + TestSingleToken("~", SyntaxKind.Tilde); } [Fact] public void DoubleOr_Is_Recognized() { - TestSingleToken("||", CSharpTokenType.DoubleOr); + TestSingleToken("||", SyntaxKind.DoubleOr); } [Fact] public void ModuloAssign_Is_Recognized() { - TestSingleToken("%=", CSharpTokenType.ModuloAssign); + TestSingleToken("%=", SyntaxKind.ModuloAssign); } [Fact] public void Colon_Is_Recognized() { - TestSingleToken(":", CSharpTokenType.Colon); + TestSingleToken(":", SyntaxKind.Colon); } [Fact] public void Not_Is_Recognized() { - TestSingleToken("!", CSharpTokenType.Not); + TestSingleToken("!", SyntaxKind.Not); } [Fact] public void DoubleAnd_Is_Recognized() { - TestSingleToken("&&", CSharpTokenType.DoubleAnd); + TestSingleToken("&&", SyntaxKind.DoubleAnd); } [Fact] public void DivideAssign_Is_Recognized() { - TestSingleToken("/=", CSharpTokenType.DivideAssign); + TestSingleToken("/=", SyntaxKind.DivideAssign); } [Fact] public void Comma_Is_Recognized() { - TestSingleToken(",", CSharpTokenType.Comma); + TestSingleToken(",", SyntaxKind.Comma); } [Fact] public void Xor_Is_Recognized() { - TestSingleToken("^", CSharpTokenType.Xor); + TestSingleToken("^", SyntaxKind.Xor); } [Fact] public void Decrement_Is_Recognized() { - TestSingleToken("--", CSharpTokenType.Decrement); + TestSingleToken("--", SyntaxKind.Decrement); } [Fact] public void MultiplyAssign_Is_Recognized() { - TestSingleToken("*=", CSharpTokenType.MultiplyAssign); + TestSingleToken("*=", SyntaxKind.MultiplyAssign); } [Fact] public void Dot_Is_Recognized() { - TestSingleToken(".", CSharpTokenType.Dot); + TestSingleToken(".", SyntaxKind.Dot); } [Fact] public void Or_Is_Recognized() { - TestSingleToken("|", CSharpTokenType.Or); + TestSingleToken("|", SyntaxKind.Or); } [Fact] public void Increment_Is_Recognized() { - TestSingleToken("++", CSharpTokenType.Increment); + TestSingleToken("++", SyntaxKind.Increment); } [Fact] public void MinusAssign_Is_Recognized() { - TestSingleToken("-=", CSharpTokenType.MinusAssign); + TestSingleToken("-=", SyntaxKind.MinusAssign); } [Fact] public void RightShift_Is_Not_Specially_Recognized() { TestTokenizer(">>", - new CSharpToken(">", CSharpTokenType.GreaterThan), - new CSharpToken(">", CSharpTokenType.GreaterThan)); + SyntaxFactory.Token(SyntaxKind.GreaterThan, ">"), + SyntaxFactory.Token(SyntaxKind.GreaterThan, ">")); } [Fact] public void Hash_Is_Recognized() { - TestSingleToken("#", CSharpTokenType.Hash); + TestSingleToken("#", SyntaxKind.Hash); } } } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpTokenizerTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpTokenizerTest.cs index cf98382ef4..5ee0715a7e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpTokenizerTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpTokenizerTest.cs @@ -1,13 +1,14 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; using Xunit; namespace Microsoft.AspNetCore.Razor.Language.Legacy { public class CSharpTokenizerTest : CSharpTokenizerTestBase { - private new CSharpToken IgnoreRemaining => (CSharpToken)base.IgnoreRemaining; + private new SyntaxToken IgnoreRemaining => (SyntaxToken)base.IgnoreRemaining; [Fact] public void Next_Returns_Null_When_EOF_Reached() @@ -20,8 +21,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { TestTokenizer( "\r\ra", - new CSharpToken("\r", CSharpTokenType.NewLine), - new CSharpToken("\r", CSharpTokenType.NewLine), + SyntaxFactory.Token(SyntaxKind.NewLine, "\r"), + SyntaxFactory.Token(SyntaxKind.NewLine, "\r"), IgnoreRemaining); } @@ -30,8 +31,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { TestTokenizer( "\n\na", - new CSharpToken("\n", CSharpTokenType.NewLine), - new CSharpToken("\n", CSharpTokenType.NewLine), + SyntaxFactory.Token(SyntaxKind.NewLine, "\n"), + SyntaxFactory.Token(SyntaxKind.NewLine, "\n"), IgnoreRemaining); } @@ -41,8 +42,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy // NEL: Unicode "Next Line" U+0085 TestTokenizer( "\u0085\u0085a", - new CSharpToken("\u0085", CSharpTokenType.NewLine), - new CSharpToken("\u0085", CSharpTokenType.NewLine), + SyntaxFactory.Token(SyntaxKind.NewLine, "\u0085"), + SyntaxFactory.Token(SyntaxKind.NewLine, "\u0085"), IgnoreRemaining); } @@ -52,8 +53,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy // Unicode "Line Separator" U+2028 TestTokenizer( "\u2028\u2028a", - new CSharpToken("\u2028", CSharpTokenType.NewLine), - new CSharpToken("\u2028", CSharpTokenType.NewLine), + SyntaxFactory.Token(SyntaxKind.NewLine, "\u2028"), + SyntaxFactory.Token(SyntaxKind.NewLine, "\u2028"), IgnoreRemaining); } @@ -63,8 +64,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy // Unicode "Paragraph Separator" U+2029 TestTokenizer( "\u2029\u2029a", - new CSharpToken("\u2029", CSharpTokenType.NewLine), - new CSharpToken("\u2029", CSharpTokenType.NewLine), + SyntaxFactory.Token(SyntaxKind.NewLine, "\u2029"), + SyntaxFactory.Token(SyntaxKind.NewLine, "\u2029"), IgnoreRemaining); } @@ -73,8 +74,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { TestTokenizer( "\r\n\r\na", - new CSharpToken("\r\n", CSharpTokenType.NewLine), - new CSharpToken("\r\n", CSharpTokenType.NewLine), + SyntaxFactory.Token(SyntaxKind.NewLine, "\r\n"), + SyntaxFactory.Token(SyntaxKind.NewLine, "\r\n"), IgnoreRemaining); } @@ -83,15 +84,15 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { TestTokenizer( " \f\t\u000B \n ", - new CSharpToken(" \f\t\u000B ", CSharpTokenType.WhiteSpace), - new CSharpToken("\n", CSharpTokenType.NewLine), - new CSharpToken(" ", CSharpTokenType.WhiteSpace)); + SyntaxFactory.Token(SyntaxKind.Whitespace, " \f\t\u000B "), + SyntaxFactory.Token(SyntaxKind.NewLine, "\n"), + SyntaxFactory.Token(SyntaxKind.Whitespace, " ")); } [Fact] public void Transition_Is_Recognized() { - TestSingleToken("@", CSharpTokenType.Transition); + TestSingleToken("@", SyntaxKind.Transition); } [Fact] @@ -99,8 +100,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { TestTokenizer( "@(", - new CSharpToken("@", CSharpTokenType.Transition), - new CSharpToken("(", CSharpTokenType.LeftParenthesis)); + SyntaxFactory.Token(SyntaxKind.Transition, "@"), + SyntaxFactory.Token(SyntaxKind.LeftParenthesis, "(")); } } } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpTokenizerTestBase.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpTokenizerTestBase.cs index 6869138c1e..60652e402f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpTokenizerTestBase.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpTokenizerTestBase.cs @@ -1,11 +1,13 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; + namespace Microsoft.AspNetCore.Razor.Language.Legacy { public abstract class CSharpTokenizerTestBase : TokenizerTestBase { - private static CSharpToken _ignoreRemaining = new CSharpToken(string.Empty, CSharpTokenType.Unknown); + private static SyntaxToken _ignoreRemaining = SyntaxFactory.Token(SyntaxKind.Unknown, string.Empty); internal override object IgnoreRemaining { @@ -17,14 +19,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return new CSharpTokenizer(source); } - internal void TestSingleToken(string text, CSharpTokenType expectedTokenType) + internal void TestSingleToken(string text, SyntaxKind expectedTokenKind) { - TestTokenizer(text, new CSharpToken(text, expectedTokenType)); - } - - internal void TestTokenizer(string input, params CSharpToken[] expectedTokens) - { - base.TestTokenizer(input, expectedTokens); + TestTokenizer(text, SyntaxFactory.Token(expectedTokenKind, text)); } } } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CodeParserTestBase.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CodeParserTestBase.cs index c3425055b4..f942a3dddf 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CodeParserTestBase.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CodeParserTestBase.cs @@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy internal void ImplicitExpressionTest(string input, params RazorDiagnostic[] errors) { - ImplicitExpressionTest(input, AcceptedCharactersInternal.NonWhiteSpace, errors); + ImplicitExpressionTest(input, AcceptedCharactersInternal.NonWhitespace, errors); } internal void ImplicitExpressionTest(string input, AcceptedCharactersInternal acceptedCharacters, params RazorDiagnostic[] errors) @@ -30,7 +30,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy internal void ImplicitExpressionTest(string input, string expected, params RazorDiagnostic[] errors) { - ImplicitExpressionTest(input, expected, AcceptedCharactersInternal.NonWhiteSpace, errors); + ImplicitExpressionTest(input, expected, AcceptedCharactersInternal.NonWhitespace, errors); } internal override void SingleSpanBlockTest(string document, BlockKindInternal blockKind, SpanKindInternal spanType, AcceptedCharactersInternal acceptedCharacters = AcceptedCharactersInternal.Any) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/DirectiveCSharpTokenizerTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/DirectiveCSharpTokenizerTest.cs index 7a1e0c070a..7f6e8db88a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/DirectiveCSharpTokenizerTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/DirectiveCSharpTokenizerTest.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; using Xunit; namespace Microsoft.AspNetCore.Razor.Language.Legacy @@ -12,12 +13,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { TestTokenizer( "\r\n @something \r\n @this is ignored", - new CSharpToken("\r\n", CSharpTokenType.NewLine), - new CSharpToken(" ", CSharpTokenType.WhiteSpace), - new CSharpToken("@", CSharpTokenType.Transition), - new CSharpToken("something", CSharpTokenType.Identifier), - new CSharpToken(" ", CSharpTokenType.WhiteSpace), - new CSharpToken("\r\n", CSharpTokenType.NewLine)); + SyntaxFactory.Token(SyntaxKind.NewLine, "\r\n"), + SyntaxFactory.Token(SyntaxKind.Whitespace, " "), + SyntaxFactory.Token(SyntaxKind.Transition, "@"), + SyntaxFactory.Token(SyntaxKind.Identifier, "something"), + SyntaxFactory.Token(SyntaxKind.Whitespace, " "), + SyntaxFactory.Token(SyntaxKind.NewLine, "\r\n")); } [Fact] @@ -25,18 +26,18 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { TestTokenizer( "@*included*@\r\n @something \"value\"\r\n @this is ignored", - new CSharpToken("@", CSharpTokenType.RazorCommentTransition), - new CSharpToken("*", CSharpTokenType.RazorCommentStar), - new CSharpToken("included", CSharpTokenType.RazorComment), - new CSharpToken("*", CSharpTokenType.RazorCommentStar), - new CSharpToken("@", CSharpTokenType.RazorCommentTransition), - new CSharpToken("\r\n", CSharpTokenType.NewLine), - new CSharpToken(" ", CSharpTokenType.WhiteSpace), - new CSharpToken("@", CSharpTokenType.Transition), - new CSharpToken("something", CSharpTokenType.Identifier), - new CSharpToken(" ", CSharpTokenType.WhiteSpace), - new CSharpToken("\"value\"", CSharpTokenType.StringLiteral), - new CSharpToken("\r\n", CSharpTokenType.NewLine)); + SyntaxFactory.Token(SyntaxKind.RazorCommentTransition, "@"), + SyntaxFactory.Token(SyntaxKind.RazorCommentStar, "*"), + SyntaxFactory.Token(SyntaxKind.RazorCommentLiteral, "included"), + SyntaxFactory.Token(SyntaxKind.RazorCommentStar, "*"), + SyntaxFactory.Token(SyntaxKind.RazorCommentTransition, "@"), + SyntaxFactory.Token(SyntaxKind.NewLine, "\r\n"), + SyntaxFactory.Token(SyntaxKind.Whitespace, " "), + SyntaxFactory.Token(SyntaxKind.Transition, "@"), + SyntaxFactory.Token(SyntaxKind.Identifier, "something"), + SyntaxFactory.Token(SyntaxKind.Whitespace, " "), + SyntaxFactory.Token(SyntaxKind.StringLiteral, "\"value\""), + SyntaxFactory.Token(SyntaxKind.NewLine, "\r\n")); } internal override object CreateTokenizer(ITextDocument source) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/DirectiveHtmlTokenizerTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/DirectiveHtmlTokenizerTest.cs index cffd0a0d0d..ffee2ab489 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/DirectiveHtmlTokenizerTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/DirectiveHtmlTokenizerTest.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; using Xunit; namespace Microsoft.AspNetCore.Razor.Language.Legacy @@ -12,9 +13,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { TestTokenizer( "\r\n
Ignored
", - new HtmlToken("\r\n", HtmlTokenType.NewLine), - new HtmlToken(" ", HtmlTokenType.WhiteSpace), - new HtmlToken("<", HtmlTokenType.OpenAngle)); + SyntaxFactory.Token(SyntaxKind.NewLine, "\r\n"), + SyntaxFactory.Token(SyntaxKind.Whitespace, " "), + SyntaxFactory.Token(SyntaxKind.OpenAngle, "<")); } [Fact] @@ -22,15 +23,15 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { TestTokenizer( "\r\n @*included*@
Ignored
", - new HtmlToken("\r\n", HtmlTokenType.NewLine), - new HtmlToken(" ", HtmlTokenType.WhiteSpace), - new HtmlToken("@", HtmlTokenType.RazorCommentTransition), - new HtmlToken("*", HtmlTokenType.RazorCommentStar), - new HtmlToken("included", HtmlTokenType.RazorComment), - new HtmlToken("*", HtmlTokenType.RazorCommentStar), - new HtmlToken("@", HtmlTokenType.RazorCommentTransition), - new HtmlToken(" ", HtmlTokenType.WhiteSpace), - new HtmlToken("<", HtmlTokenType.OpenAngle)); + SyntaxFactory.Token(SyntaxKind.NewLine, "\r\n"), + SyntaxFactory.Token(SyntaxKind.Whitespace, " "), + SyntaxFactory.Token(SyntaxKind.RazorCommentTransition, "@"), + SyntaxFactory.Token(SyntaxKind.RazorCommentStar, "*"), + SyntaxFactory.Token(SyntaxKind.RazorCommentLiteral, "included"), + SyntaxFactory.Token(SyntaxKind.RazorCommentStar, "*"), + SyntaxFactory.Token(SyntaxKind.RazorCommentTransition, "@"), + SyntaxFactory.Token(SyntaxKind.Whitespace, " "), + SyntaxFactory.Token(SyntaxKind.OpenAngle, "<")); } internal override object CreateTokenizer(ITextDocument source) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlMarkupParserTests.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlMarkupParserTests.cs index 839eb92353..c59bd36b08 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlMarkupParserTests.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlMarkupParserTests.cs @@ -2,23 +2,24 @@ using System.Collections.Generic; using System.Linq; using Microsoft.AspNetCore.Razor.Language.Legacy; +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; using Xunit; namespace Microsoft.AspNetCore.Razor.Language.Test.Legacy { public class HtmlMarkupParserTests { - private static readonly HtmlToken doubleHyphenToken = new HtmlToken("--", HtmlTokenType.DoubleHyphen); + private static readonly SyntaxToken doubleHyphenToken = SyntaxFactory.Token(SyntaxKind.DoubleHyphen, "--"); public static IEnumerable NonDashTokens { get { - yield return new[] { new HtmlToken("--", HtmlTokenType.DoubleHyphen) }; - yield return new[] { new HtmlToken("asdf", HtmlTokenType.Text) }; - yield return new[] { new HtmlToken(">", HtmlTokenType.CloseAngle) }; - yield return new[] { new HtmlToken("<", HtmlTokenType.OpenAngle) }; - yield return new[] { new HtmlToken("!", HtmlTokenType.Bang) }; + yield return new[] { SyntaxFactory.Token(SyntaxKind.DoubleHyphen, "--") }; + yield return new[] { SyntaxFactory.Token(SyntaxKind.Text, "asdf") }; + yield return new[] { SyntaxFactory.Token(SyntaxKind.CloseAngle, ">") }; + yield return new[] { SyntaxFactory.Token(SyntaxKind.OpenAngle, "<") }; + yield return new[] { SyntaxFactory.Token(SyntaxKind.Bang, "!") }; } } @@ -27,7 +28,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Test.Legacy public void IsHyphen_ReturnsFalseForNonDashToken(object token) { // Arrange - var convertedToken = (HtmlToken)token; + var convertedToken = (SyntaxToken)token; // Act & Assert Assert.False(HtmlMarkupParser.IsHyphen(convertedToken)); @@ -37,7 +38,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Test.Legacy public void IsHyphen_ReturnsTrueForADashToken() { // Arrange - var dashToken = new HtmlToken("-", HtmlTokenType.Text); + var dashToken = SyntaxFactory.Token(SyntaxKind.Text, "-"); // Act & Assert Assert.True(HtmlMarkupParser.IsHyphen(dashToken)); @@ -53,9 +54,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Test.Legacy var token = sut.AcceptAllButLastDoubleHyphens(); // Assert - Assert.Equal(doubleHyphenToken, token); - Assert.True(sut.At(HtmlTokenType.CloseAngle)); - Assert.Equal(doubleHyphenToken, sut.PreviousToken); + Assert.True(doubleHyphenToken.IsEquivalentTo(token)); + Assert.True(sut.At(SyntaxKind.CloseAngle)); + Assert.True(doubleHyphenToken.IsEquivalentTo(sut.PreviousToken)); } [Fact] @@ -68,8 +69,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Test.Legacy var token = sut.AcceptAllButLastDoubleHyphens(); // Assert - Assert.Equal(doubleHyphenToken, token); - Assert.True(sut.At(HtmlTokenType.CloseAngle)); + Assert.True(doubleHyphenToken.IsEquivalentTo(token)); + Assert.True(sut.At(SyntaxKind.CloseAngle)); Assert.True(HtmlMarkupParser.IsHyphen(sut.PreviousToken)); } @@ -157,8 +158,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Test.Legacy public void IsCommentContentEndingInvalid_ReturnsFalseForAllowedContent() { // Arrange - var expectedToken1 = new HtmlToken("a", HtmlTokenType.Text); - var sequence = Enumerable.Range((int)'a', 26).Select(item => new HtmlToken(((char)item).ToString(), HtmlTokenType.Text)); + var expectedToken1 = SyntaxFactory.Token(SyntaxKind.Text, "a"); + var sequence = Enumerable.Range((int)'a', 26).Select(item => SyntaxFactory.Token(SyntaxKind.Text, ((char)item).ToString())); // Act & Assert Assert.False(HtmlMarkupParser.IsCommentContentEndingInvalid(sequence)); @@ -168,8 +169,13 @@ namespace Microsoft.AspNetCore.Razor.Language.Test.Legacy public void IsCommentContentEndingInvalid_ReturnsTrueForDisallowedContent() { // Arrange - var expectedToken1 = new HtmlToken("a", HtmlTokenType.Text); - var sequence = new[] { new HtmlToken("<", HtmlTokenType.OpenAngle), new HtmlToken("!", HtmlTokenType.Bang), new HtmlToken("-", HtmlTokenType.Text) }; + var expectedToken1 = SyntaxFactory.Token(SyntaxKind.Text, "a"); + var sequence = new[] + { + SyntaxFactory.Token(SyntaxKind.OpenAngle, "<"), + SyntaxFactory.Token(SyntaxKind.Bang, "!"), + SyntaxFactory.Token(SyntaxKind.Text, "-") + }; // Act & Assert Assert.True(HtmlMarkupParser.IsCommentContentEndingInvalid(sequence)); @@ -179,8 +185,8 @@ namespace Microsoft.AspNetCore.Razor.Language.Test.Legacy public void IsCommentContentEndingInvalid_ReturnsFalseForEmptyContent() { // Arrange - var expectedToken1 = new HtmlToken("a", HtmlTokenType.Text); - var sequence = Array.Empty(); + var expectedToken1 = SyntaxFactory.Token(SyntaxKind.Text, "a"); + var sequence = Array.Empty(); // Act & Assert Assert.False(HtmlMarkupParser.IsCommentContentEndingInvalid(sequence)); @@ -188,7 +194,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Test.Legacy private class TestHtmlMarkupParser : HtmlMarkupParser { - public new HtmlToken PreviousToken + public new SyntaxToken PreviousToken { get => base.PreviousToken; } @@ -203,7 +209,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Test.Legacy this.EnsureCurrent(); } - public new HtmlToken AcceptAllButLastDoubleHyphens() + public new SyntaxToken AcceptAllButLastDoubleHyphens() { return base.AcceptAllButLastDoubleHyphens(); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlTokenizerTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlTokenizerTest.cs index 9b54d75957..92091fa278 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlTokenizerTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlTokenizerTest.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; using Xunit; namespace Microsoft.AspNetCore.Razor.Language.Legacy @@ -17,113 +18,113 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy public void Text_Is_Recognized() { TestTokenizer("foo-9309&smlkmb;::-3029022,.sdkq92384", - new HtmlToken("foo-9309&smlkmb;::-3029022,.sdkq92384", HtmlTokenType.Text)); + SyntaxFactory.Token(SyntaxKind.Text, "foo-9309&smlkmb;::-3029022,.sdkq92384")); } [Fact] public void Whitespace_Is_Recognized() { TestTokenizer(" \t\f ", - new HtmlToken(" \t\f ", HtmlTokenType.WhiteSpace)); + SyntaxFactory.Token(SyntaxKind.Whitespace, " \t\f ")); } [Fact] public void Newline_Is_Recognized() { TestTokenizer("\n\r\r\n", - new HtmlToken("\n", HtmlTokenType.NewLine), - new HtmlToken("\r", HtmlTokenType.NewLine), - new HtmlToken("\r\n", HtmlTokenType.NewLine)); + SyntaxFactory.Token(SyntaxKind.NewLine, "\n"), + SyntaxFactory.Token(SyntaxKind.NewLine, "\r"), + SyntaxFactory.Token(SyntaxKind.NewLine, "\r\n")); } [Fact] public void Transition_Is_Not_Recognized_Mid_Text_If_Surrounded_By_Alphanumeric_Characters() { - TestSingleToken("foo@bar", HtmlTokenType.Text); + TestSingleToken("foo@bar", SyntaxKind.Text); } [Fact] public void OpenAngle_Is_Recognized() { - TestSingleToken("<", HtmlTokenType.OpenAngle); + TestSingleToken("<", SyntaxKind.OpenAngle); } [Fact] public void Bang_Is_Recognized() { - TestSingleToken("!", HtmlTokenType.Bang); + TestSingleToken("!", SyntaxKind.Bang); } [Fact] public void Solidus_Is_Recognized() { - TestSingleToken("/", HtmlTokenType.ForwardSlash); + TestSingleToken("/", SyntaxKind.ForwardSlash); } [Fact] public void QuestionMark_Is_Recognized() { - TestSingleToken("?", HtmlTokenType.QuestionMark); + TestSingleToken("?", SyntaxKind.QuestionMark); } [Fact] public void LeftBracket_Is_Recognized() { - TestSingleToken("[", HtmlTokenType.LeftBracket); + TestSingleToken("[", SyntaxKind.LeftBracket); } [Fact] public void CloseAngle_Is_Recognized() { - TestSingleToken(">", HtmlTokenType.CloseAngle); + TestSingleToken(">", SyntaxKind.CloseAngle); } [Fact] public void RightBracket_Is_Recognized() { - TestSingleToken("]", HtmlTokenType.RightBracket); + TestSingleToken("]", SyntaxKind.RightBracket); } [Fact] public void Equals_Is_Recognized() { - TestSingleToken("=", HtmlTokenType.Equals); + TestSingleToken("=", SyntaxKind.Equals); } [Fact] public void DoubleQuote_Is_Recognized() { - TestSingleToken("\"", HtmlTokenType.DoubleQuote); + TestSingleToken("\"", SyntaxKind.DoubleQuote); } [Fact] public void SingleQuote_Is_Recognized() { - TestSingleToken("'", HtmlTokenType.SingleQuote); + TestSingleToken("'", SyntaxKind.SingleQuote); } [Fact] public void Transition_Is_Recognized() { - TestSingleToken("@", HtmlTokenType.Transition); + TestSingleToken("@", SyntaxKind.Transition); } [Fact] public void DoubleHyphen_Is_Recognized() { - TestSingleToken("--", HtmlTokenType.DoubleHyphen); + TestSingleToken("--", SyntaxKind.DoubleHyphen); } [Fact] public void SingleHyphen_Is_Not_Recognized() { - TestSingleToken("-", HtmlTokenType.Text); + TestSingleToken("-", SyntaxKind.Text); } [Fact] public void SingleHyphen_Mid_Text_Is_Not_Recognized_As_Separate_Token() { - TestSingleToken("foo-bar", HtmlTokenType.Text); + TestSingleToken("foo-bar", SyntaxKind.Text); } [Fact] @@ -131,9 +132,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { TestTokenizer( "@* Foo * Bar * Baz *", - new HtmlToken("@", HtmlTokenType.RazorCommentTransition), - new HtmlToken("*", HtmlTokenType.RazorCommentStar), - new HtmlToken(" Foo * Bar * Baz *", HtmlTokenType.RazorComment)); + SyntaxFactory.Token(SyntaxKind.RazorCommentTransition, "@"), + SyntaxFactory.Token(SyntaxKind.RazorCommentStar, "*"), + SyntaxFactory.Token(SyntaxKind.RazorCommentLiteral, " Foo * Bar * Baz *")); } [Fact] @@ -141,11 +142,11 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { TestTokenizer( "@* Foo * Bar * Baz *@", - new HtmlToken("@", HtmlTokenType.RazorCommentTransition), - new HtmlToken("*", HtmlTokenType.RazorCommentStar), - new HtmlToken(" Foo * Bar * Baz ", HtmlTokenType.RazorComment), - new HtmlToken("*", HtmlTokenType.RazorCommentStar), - new HtmlToken("@", HtmlTokenType.RazorCommentTransition)); + SyntaxFactory.Token(SyntaxKind.RazorCommentTransition, "@"), + SyntaxFactory.Token(SyntaxKind.RazorCommentStar, "*"), + SyntaxFactory.Token(SyntaxKind.RazorCommentLiteral, " Foo * Bar * Baz "), + SyntaxFactory.Token(SyntaxKind.RazorCommentStar, "*"), + SyntaxFactory.Token(SyntaxKind.RazorCommentTransition, "@")); } [Fact] @@ -153,11 +154,11 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { TestTokenizer( "@* Foo Bar Baz *@", - new HtmlToken("@", HtmlTokenType.RazorCommentTransition), - new HtmlToken("*", HtmlTokenType.RazorCommentStar), - new HtmlToken(" Foo Bar Baz ", HtmlTokenType.RazorComment), - new HtmlToken("*", HtmlTokenType.RazorCommentStar), - new HtmlToken("@", HtmlTokenType.RazorCommentTransition)); + SyntaxFactory.Token(SyntaxKind.RazorCommentTransition, "@"), + SyntaxFactory.Token(SyntaxKind.RazorCommentStar, "*"), + SyntaxFactory.Token(SyntaxKind.RazorCommentLiteral, " Foo Bar Baz "), + SyntaxFactory.Token(SyntaxKind.RazorCommentStar, "*"), + SyntaxFactory.Token(SyntaxKind.RazorCommentTransition, "@")); } } } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlTokenizerTestBase.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlTokenizerTestBase.cs index 6416496b32..76762e5bed 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlTokenizerTestBase.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/HtmlTokenizerTestBase.cs @@ -1,11 +1,13 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; + namespace Microsoft.AspNetCore.Razor.Language.Legacy { public abstract class HtmlTokenizerTestBase : TokenizerTestBase { - private static HtmlToken _ignoreRemaining = new HtmlToken(string.Empty, HtmlTokenType.Unknown); + private static SyntaxToken _ignoreRemaining = SyntaxFactory.Token(SyntaxKind.Unknown, string.Empty); internal override object IgnoreRemaining { @@ -17,14 +19,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return new HtmlTokenizer(source); } - internal void TestSingleToken(string text, HtmlTokenType expectedTokenType) + internal void TestSingleToken(string text, SyntaxKind expectedTokenKind) { - TestTokenizer(text, new HtmlToken(text, expectedTokenType)); - } - - internal void TestTokenizer(string input, params HtmlToken[] expectedTokens) - { - base.TestTokenizer(input, expectedTokens); + TestTokenizer(text, SyntaxFactory.Token(expectedTokenKind, text)); } } } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/ImplicitExpressionEditHandlerTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/ImplicitExpressionEditHandlerTest.cs index f96e7920af..2b3d8aa457 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/ImplicitExpressionEditHandlerTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/ImplicitExpressionEditHandlerTest.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; +using Microsoft.AspNetCore.Razor.Language.Syntax; using Xunit; namespace Microsoft.AspNetCore.Razor.Language.Legacy @@ -159,7 +160,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy public void TryUpdateBalanceCount_SingleLeftParenthesis_CountsCorrectly() { // Arrange - var token = new CSharpToken("(", CSharpTokenType.LeftParenthesis); + var token = SyntaxFactory.Token(SyntaxKind.LeftParenthesis, "("); var count = 0; // Act @@ -174,7 +175,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy public void TryUpdateBalanceCount_SingleRightParenthesis_CountsCorrectly() { // Arrange - var token = new CSharpToken(")", CSharpTokenType.RightParenthesis); + var token = SyntaxFactory.Token(SyntaxKind.RightParenthesis, ")"); var count = 2; // Act @@ -189,7 +190,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy public void TryUpdateBalanceCount_IncompleteStringLiteral_CountsCorrectly() { // Arrange - var token = new CSharpToken("\"((", CSharpTokenType.StringLiteral); + var token = SyntaxFactory.Token(SyntaxKind.StringLiteral, "\"(("); var count = 2; // Act @@ -204,7 +205,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy public void TryUpdateBalanceCount_IncompleteCharacterLiteral_CountsCorrectly() { // Arrange - var token = new CSharpToken("'((", CSharpTokenType.CharacterLiteral); + var token = SyntaxFactory.Token(SyntaxKind.CharacterLiteral, "'(("); var count = 2; // Act @@ -219,7 +220,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy public void TryUpdateBalanceCount_CompleteStringLiteral_CountsCorrectly() { // Arrange - var token = new CSharpToken("\"((\"", CSharpTokenType.StringLiteral); + var token = SyntaxFactory.Token(SyntaxKind.StringLiteral, "\"((\""); var count = 2; // Act @@ -234,7 +235,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy public void TryUpdateBalanceCount_CompleteCharacterLiteral_CountsCorrectly() { // Arrange - var token = new CSharpToken("'('", CSharpTokenType.CharacterLiteral); + var token = SyntaxFactory.Token(SyntaxKind.CharacterLiteral, "'('"); var count = 2; // Act @@ -249,7 +250,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy public void TryUpdateBalanceCount_InvalidParenthesis_ReturnsFalse() { // Arrange - var token = new CSharpToken(")", CSharpTokenType.RightParenthesis); + var token = SyntaxFactory.Token(SyntaxKind.RightParenthesis, ")"); var count = 0; // Act @@ -264,7 +265,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy public void TryUpdateBalanceCount_InvalidParenthesisStringLiteral_ReturnsFalse() { // Arrange - var token = new CSharpToken("\")", CSharpTokenType.StringLiteral); + var token = SyntaxFactory.Token(SyntaxKind.StringLiteral, "\")"); var count = 0; // Act @@ -279,7 +280,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy public void TryUpdateBalanceCount_InvalidParenthesisCharacterLiteral_ReturnsFalse() { // Arrange - var token = new CSharpToken("')", CSharpTokenType.CharacterLiteral); + var token = SyntaxFactory.Token(SyntaxKind.CharacterLiteral, "')"); var count = 0; // Act @@ -453,11 +454,10 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return span; } - private static IReadOnlyList GetTokens(SourceLocation start, string content) + private static IReadOnlyList GetTokens(SourceLocation start, string content) { var parent = GetSpan(start, content); - var tokens = parent.Tokens.Cast().ToArray(); - return tokens; + return parent.Tokens; } } } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpDirectivesTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/RazorDirectivesTest.cs similarity index 88% rename from test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpDirectivesTest.cs rename to test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/RazorDirectivesTest.cs index 2452e64f88..5da2a4bba0 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/CSharpDirectivesTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/RazorDirectivesTest.cs @@ -121,7 +121,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy b => b.AddStringToken().AddStringToken()); // Act & Assert - ParseCodeBlockTest( + ParseDocumentTest( "@custom \"string1\"\"string2\"", new[] { descriptor }); } @@ -136,7 +136,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy b => b.AddNamespaceToken()); // Act & Assert - ParseCodeBlockTest( + ParseDocumentTest( "@custom System.", new[] { descriptor }); } @@ -151,7 +151,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy b => b.AddNamespaceToken()); // Act & Assert - ParseCodeBlockTest( + ParseDocumentTest( "@custom System<", new[] { descriptor }); } @@ -165,7 +165,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy b => b.AddNamespaceToken()); // Act & Assert - ParseCodeBlockTest( + ParseDocumentTest( "@custom System." + Environment.NewLine, new[] { descriptor }); } @@ -180,7 +180,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy b => b.AddNamespaceToken()); // Act & Assert - ParseCodeBlockTest( + ParseDocumentTest( "@custom System<" + Environment.NewLine, new[] { descriptor }); } @@ -195,7 +195,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy b => b.AddTypeToken()); // Act & Assert - ParseCodeBlockTest(Environment.NewLine + " @custom System.Text.Encoding.ASCIIEncoding", + ParseDocumentTest(Environment.NewLine + " @custom System.Text.Encoding.ASCIIEncoding", new[] { descriptor }); } @@ -203,14 +203,14 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy public void BuiltInDirectiveDoesNotErorrIfNotAtStartOfLineBecauseOfWhitespace() { // Act & Assert - ParseCodeBlockTest(Environment.NewLine + " @addTagHelper \"*, Foo\""); + ParseDocumentTest(Environment.NewLine + " @addTagHelper \"*, Foo\""); } [Fact] public void BuiltInDirectiveErrorsIfNotAtStartOfLine() { // Act & Assert - ParseCodeBlockTest("{ @addTagHelper \"*, Foo\"" + Environment.NewLine + "}"); + ParseDocumentTest("{ @addTagHelper \"*, Foo\"" + Environment.NewLine + "}"); } [Fact] @@ -223,7 +223,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy b => b.AddTypeToken()); // Act & Assert - ParseCodeBlockTest( + ParseDocumentTest( "{ @custom System.Text.Encoding.ASCIIEncoding" + Environment.NewLine + "}", new[] { descriptor }); } @@ -238,7 +238,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy b => b.AddTypeToken()); // Act & Assert - ParseCodeBlockTest( + ParseDocumentTest( "@custom System.Text.Encoding.ASCIIEncoding", new[] { descriptor }); } @@ -253,7 +253,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy b => b.AddMemberToken()); // Act & Assert - ParseCodeBlockTest( + ParseDocumentTest( "@custom Some_Member", new[] { descriptor }); } @@ -268,7 +268,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy b => b.AddNamespaceToken()); // Act & Assert - ParseCodeBlockTest( + ParseDocumentTest( "@custom BaseNamespace", new[] { descriptor }); } @@ -283,7 +283,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy b => b.AddNamespaceToken()); // Act & Assert - ParseCodeBlockTest( + ParseDocumentTest( "@custom BaseNamespace.Foo.Bar", new[] { descriptor }); } @@ -298,7 +298,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy b => b.AddStringToken()); // Act & Assert - ParseCodeBlockTest( + ParseDocumentTest( "@custom \"AString\"", new[] { descriptor }); } @@ -313,7 +313,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy b => b.AddStringToken()); // Act & Assert - ParseCodeBlockTest( + ParseDocumentTest( "@custom AString", new[] { descriptor }); } @@ -328,7 +328,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy b => b.AddStringToken()); // Act & Assert - ParseCodeBlockTest( + ParseDocumentTest( "@custom {foo?}", new[] { descriptor }); } @@ -343,7 +343,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy b => b.AddStringToken()); // Act & Assert - ParseCodeBlockTest( + ParseDocumentTest( "@custom 'AString'", new[] { descriptor }); } @@ -358,7 +358,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy b => b.AddStringToken()); // Act & Assert - ParseCodeBlockTest( + ParseDocumentTest( "@custom AString\"", new[] { descriptor }); } @@ -373,7 +373,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy b => b.AddTypeToken().AddMemberToken().AddStringToken()); // Act & Assert - ParseCodeBlockTest( + ParseDocumentTest( "@custom System.Text.Encoding.ASCIIEncoding Some_Member \"AString\"", new[] { descriptor }); } @@ -388,7 +388,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy b => b.AddStringToken()); // Act & Assert - ParseCodeBlockTest( + ParseDocumentTest( "@custom \"Header\" {

F{o}o

}", new[] { descriptor }); } @@ -403,7 +403,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy b => b.AddStringToken()); // Act & Assert - ParseCodeBlockTest( + ParseDocumentTest( "@custom \"Name\" { foo(); bar(); }", new[] { descriptor }); } @@ -418,7 +418,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy b => b.AddTypeToken().AddMemberToken()); // Act & Assert - ParseCodeBlockTest( + ParseDocumentTest( "@custom System.Text.Encoding.ASCIIEncoding Some_Member ", new[] { descriptor }); } @@ -433,7 +433,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy b => b.AddMemberToken()); // Act & Assert - ParseCodeBlockTest( + ParseDocumentTest( "@custom -Some_Member", new[] { descriptor }); } @@ -448,7 +448,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy b => b.AddStringToken()); // Act & Assert - ParseCodeBlockTest( + ParseDocumentTest( "@custom \"hello\" ; ", new[] { descriptor }); } @@ -488,7 +488,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } // Act & Assert - ParseCodeBlockTest(source, new[] { descriptor }); + ParseDocumentTest(source, new[] { descriptor }); } [Fact] @@ -526,7 +526,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } // Act & Assert - ParseCodeBlockTest(source, new[] { descriptor }); + ParseDocumentTest(source, new[] { descriptor }); } [Fact] @@ -539,7 +539,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy b => b.AddTypeToken()); // Act & Assert - ParseCodeBlockTest( + ParseDocumentTest( $"@custom (bool, int?) ", new[] { descriptor }); } @@ -554,7 +554,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy b => b.AddStringToken()); // Act & Assert - ParseCodeBlockTest( + ParseDocumentTest( "@custom \"hello\" \"world\"", new[] { descriptor }); } @@ -569,7 +569,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy b => b.AddStringToken()); // Act & Assert - ParseCodeBlockTest( + ParseDocumentTest( "@custom \"Hello\" World { foo(); bar(); }", new[] { descriptor }); } @@ -584,7 +584,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy b => b.AddStringToken()); // Act & Assert - ParseCodeBlockTest( + ParseDocumentTest( "@custom \"Hello\"", new[] { descriptor }); } @@ -599,7 +599,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy b => b.AddStringToken()); // Act & Assert - ParseCodeBlockTest( + ParseDocumentTest( "@custom \"Hello\" {", new[] { descriptor }); } @@ -607,134 +607,134 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy [Fact] public void TagHelperPrefixDirective_NoValueSucceeds() { - ParseBlockTest("@tagHelperPrefix \"\""); + ParseDocumentTest("@tagHelperPrefix \"\""); } [Fact] public void TagHelperPrefixDirective_Succeeds() { - ParseBlockTest("@tagHelperPrefix Foo"); + ParseDocumentTest("@tagHelperPrefix Foo"); } [Fact] public void TagHelperPrefixDirective_WithQuotes_Succeeds() { - ParseBlockTest("@tagHelperPrefix \"Foo\""); + ParseDocumentTest("@tagHelperPrefix \"Foo\""); } [Fact] public void TagHelperPrefixDirective_RequiresValue() { - ParseBlockTest("@tagHelperPrefix "); + ParseDocumentTest("@tagHelperPrefix "); } [Fact] public void TagHelperPrefixDirective_StartQuoteRequiresDoubleQuotesAroundValue() { - ParseBlockTest("@tagHelperPrefix \"Foo"); + ParseDocumentTest("@tagHelperPrefix \"Foo"); } [Fact] public void TagHelperPrefixDirective_EndQuoteRequiresDoubleQuotesAroundValue() { - ParseBlockTest("@tagHelperPrefix Foo \""); + ParseDocumentTest("@tagHelperPrefix Foo \""); } [Fact] public void RemoveTagHelperDirective_NoValue_Invalid() { - ParseBlockTest("@removeTagHelper \"\""); + ParseDocumentTest("@removeTagHelper \"\""); } [Fact] public void RemoveTagHelperDirective_InvalidLookupText_AddsError() { - ParseBlockTest("@removeTagHelper Foo"); + ParseDocumentTest("@removeTagHelper Foo"); } [Fact] public void RemoveTagHelperDirective_SingleQuotes_AddsError() { - ParseBlockTest("@removeTagHelper '*, Foo'"); + ParseDocumentTest("@removeTagHelper '*, Foo'"); } [Fact] public void RemoveTagHelperDirective_WithQuotes_InvalidLookupText_AddsError() { - ParseBlockTest("@removeTagHelper \"Foo\""); + ParseDocumentTest("@removeTagHelper \"Foo\""); } [Fact] public void RemoveTagHelperDirective_SupportsSpaces() { - ParseBlockTest("@removeTagHelper Foo, Bar "); + ParseDocumentTest("@removeTagHelper Foo, Bar "); } [Fact] public void RemoveTagHelperDirective_RequiresValue() { - ParseBlockTest("@removeTagHelper "); + ParseDocumentTest("@removeTagHelper "); } [Fact] public void RemoveTagHelperDirective_StartQuoteRequiresDoubleQuotesAroundValue() { // Arrange - ParseBlockTest("@removeTagHelper \"Foo"); + ParseDocumentTest("@removeTagHelper \"Foo"); } [Fact] public void RemoveTagHelperDirective_EndQuoteRequiresDoubleQuotesAroundValue() { - ParseBlockTest("@removeTagHelper Foo\""); + ParseDocumentTest("@removeTagHelper Foo\""); } [Fact] public void AddTagHelperDirective_NoValue_Invalid() { - ParseBlockTest("@addTagHelper \"\""); + ParseDocumentTest("@addTagHelper \"\""); } [Fact] public void AddTagHelperDirective_InvalidLookupText_AddsError() { - ParseBlockTest("@addTagHelper Foo"); + ParseDocumentTest("@addTagHelper Foo"); } [Fact] public void AddTagHelperDirective_WithQuotes_InvalidLookupText_AddsError() { - ParseBlockTest("@addTagHelper \"Foo\""); + ParseDocumentTest("@addTagHelper \"Foo\""); } [Fact] public void AddTagHelperDirective_SingleQuotes_AddsError() { - ParseBlockTest("@addTagHelper '*, Foo'"); + ParseDocumentTest("@addTagHelper '*, Foo'"); } [Fact] public void AddTagHelperDirective_SupportsSpaces() { - ParseBlockTest("@addTagHelper Foo, Bar "); + ParseDocumentTest("@addTagHelper Foo, Bar "); } [Fact] public void AddTagHelperDirective_RequiresValue() { - ParseBlockTest("@addTagHelper "); + ParseDocumentTest("@addTagHelper "); } [Fact] public void AddTagHelperDirective_StartQuoteRequiresDoubleQuotesAroundValue() { - ParseBlockTest("@addTagHelper \"Foo"); + ParseDocumentTest("@addTagHelper \"Foo"); } [Fact] public void AddTagHelperDirective_EndQuoteRequiresDoubleQuotesAroundValue() { - ParseBlockTest("@addTagHelper Foo\""); + ParseDocumentTest("@addTagHelper Foo\""); } [Fact] @@ -764,7 +764,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy [Fact] public void Parse_FunctionsDirective() { - ParseCodeBlockTest( + ParseDocumentTest( "@functions { foo(); bar(); }", new[] { FunctionsDirective.Directive, }); } @@ -772,7 +772,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy [Fact] public void EmptyFunctionsDirective() { - ParseCodeBlockTest( + ParseDocumentTest( "@functions { }", new[] { FunctionsDirective.Directive, }); } @@ -780,7 +780,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy [Fact] public void Parse_SectionDirective() { - ParseCodeBlockTest( + ParseDocumentTest( "@section Header {

F{o}o

}", new[] { SectionDirective.Directive, }); } @@ -795,7 +795,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy b => b.AddOptionalStringToken()); // Act & Assert - ParseCodeBlockTest( + ParseDocumentTest( "@custom ", new[] { descriptor }); } @@ -810,7 +810,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy b => b.AddOptionalStringToken()); // Act & Assert - ParseCodeBlockTest( + ParseDocumentTest( "@custom \"simple-value\"", new[] { descriptor }); } @@ -825,7 +825,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy b => b.AddOptionalStringToken()); // Act & Assert - ParseCodeBlockTest( + ParseDocumentTest( "@custom \"{formaction}?/{id}?\"", new[] { descriptor }); } @@ -840,7 +840,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy b => b.AddOptionalStringToken().AddOptionalTypeToken()); // Act & Assert - ParseCodeBlockTest( + ParseDocumentTest( "@custom \"{formaction}?/{id}?\" System.String", new[] { descriptor }); } @@ -855,7 +855,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy b => b.AddOptionalMemberToken().AddOptionalStringToken()); // Act & Assert - ParseCodeBlockTest( + ParseDocumentTest( "@TestDirective ", new[] { descriptor }); } @@ -870,7 +870,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy b => b.AddOptionalMemberToken().AddOptionalStringToken()); // Act & Assert - ParseCodeBlockTest( + ParseDocumentTest( "@TestDirective PropertyName", new[] { descriptor }); } @@ -884,7 +884,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy DirectiveKind.SingleLine); // Act & Assert - ParseCodeBlockTest( + ParseDocumentTest( "@class", new[] { descriptor }); } @@ -898,25 +898,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy DirectiveKind.SingleLine); // Act & Assert - ParseCodeBlockTest( + ParseDocumentTest( "@namespace", new[] { descriptor }); } - - internal virtual void ParseCodeBlockTest(string document) - { - ParseCodeBlockTest(document, Array.Empty()); - } - - internal virtual void ParseCodeBlockTest( - string document, - IEnumerable descriptors, - Block expected = null, - params RazorDiagnostic[] expectedErrors) - { - var result = ParseCodeBlock(RazorLanguageVersion.Latest, document, descriptors, designTime: false); - - BaselineTest(result); - } } } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/RazorParserTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/RazorParserTest.cs index 15dacfdaf8..43d53bf84b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/RazorParserTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/RazorParserTest.cs @@ -36,7 +36,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy factory.CodeTransition(), factory.Code("bar") .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) - .Accepts(AcceptedCharactersInternal.NonWhiteSpace)), + .Accepts(AcceptedCharactersInternal.NonWhitespace)), factory.Markup(" baz"))); } @@ -58,7 +58,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy factory.CodeTransition(), factory.Code("bar") .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) - .Accepts(AcceptedCharactersInternal.NonWhiteSpace)), + .Accepts(AcceptedCharactersInternal.NonWhitespace)), factory.Markup(" baz"))); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/SpanTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/SpanTest.cs index 96c856848c..15b01b5d78 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/SpanTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/SpanTest.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; using Xunit; namespace Microsoft.AspNetCore.Razor.Language.Legacy @@ -12,10 +13,10 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { // Arrange var builder = new SpanBuilder(SourceLocation.Zero); - builder.Accept(new HtmlToken("hello", HtmlTokenType.Text)); + builder.Accept(SyntaxFactory.Token(SyntaxKind.Text, "hello")); var span = builder.Build(); var newBuilder = new SpanBuilder(SourceLocation.Zero); - newBuilder.Accept(new HtmlToken("hi", HtmlTokenType.Text)); + newBuilder.Accept(SyntaxFactory.Token(SyntaxKind.Text, "hi")); var originalLength = span.Length; // Act @@ -33,7 +34,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy { // Arrange var spanBuilder = new SpanBuilder(SourceLocation.Zero); - spanBuilder.Accept(new HtmlToken("hello", HtmlTokenType.Text)); + spanBuilder.Accept(SyntaxFactory.Token(SyntaxKind.Text, "hello")); var span = spanBuilder.Build(); var blockBuilder = new BlockBuilder() { @@ -44,7 +45,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy span.Parent = block; var originalBlockLength = block.Length; var newSpanBuilder = new SpanBuilder(SourceLocation.Zero); - newSpanBuilder.Accept(new HtmlToken("hi", HtmlTokenType.Text)); + newSpanBuilder.Accept(SyntaxFactory.Token(SyntaxKind.Text, "hi")); // Act span.ReplaceWith(newSpanBuilder); @@ -64,7 +65,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy Kind = SpanKindInternal.Transition, ChunkGenerator = new ExpressionChunkGenerator(), }; - spanBuilder.Accept(new CSharpToken("@", CSharpTokenType.Transition)); + spanBuilder.Accept(SyntaxFactory.Token(SyntaxKind.Transition, "@")); var span = spanBuilder.Build(); // Act diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TokenizerLookaheadTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TokenizerLookaheadTest.cs index 23a1df23dc..7776b5f531 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TokenizerLookaheadTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TokenizerLookaheadTest.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; using Xunit; namespace Microsoft.AspNetCore.Razor.Language.Legacy @@ -64,7 +65,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy // Act var i = 3; - IEnumerable previousTokens = null; + IEnumerable previousTokens = null; var tokenFound = tokenizer.LookaheadUntil((s, p) => { previousTokens = p; @@ -77,9 +78,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy // For the very first element, there will be no previous items, so null is expected var orderIndex = 0; Assert.Null(previousTokens.ElementAt(orderIndex++)); - Assert.Equal(new HtmlToken("asdf", HtmlTokenType.Text), previousTokens.ElementAt(orderIndex++)); - Assert.Equal(new HtmlToken("--", HtmlTokenType.DoubleHyphen), previousTokens.ElementAt(orderIndex++)); - Assert.Equal(new HtmlToken("fvd", HtmlTokenType.Text), previousTokens.ElementAt(orderIndex++)); + AssertTokenEqual(SyntaxFactory.Token(SyntaxKind.Text, "asdf"), previousTokens.ElementAt(orderIndex++)); + AssertTokenEqual(SyntaxFactory.Token(SyntaxKind.DoubleHyphen, "--"), previousTokens.ElementAt(orderIndex++)); + AssertTokenEqual(SyntaxFactory.Token(SyntaxKind.Text, "fvd"), previousTokens.ElementAt(orderIndex++)); } [Fact] @@ -89,7 +90,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy var tokenizer = CreateContentTokenizer("asdf--fvd"); // Act - var tokens = new Stack(); + var tokens = new Stack(); var tokenFound = tokenizer.LookaheadUntil((s, p) => { tokens.Push(s); @@ -99,9 +100,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy // Assert Assert.False(tokenFound); Assert.Equal(3, tokens.Count); - Assert.Equal(new HtmlToken("fvd", HtmlTokenType.Text), tokens.Pop()); - Assert.Equal(new HtmlToken("--", HtmlTokenType.DoubleHyphen), tokens.Pop()); - Assert.Equal(new HtmlToken("asdf", HtmlTokenType.Text), tokens.Pop()); + AssertTokenEqual(SyntaxFactory.Token(SyntaxKind.Text, "fvd"), tokens.Pop()); + AssertTokenEqual(SyntaxFactory.Token(SyntaxKind.DoubleHyphen, "--"), tokens.Pop()); + AssertTokenEqual(SyntaxFactory.Token(SyntaxKind.Text, "asdf"), tokens.Pop()); } [Fact] @@ -111,18 +112,18 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy var tokenizer = CreateContentTokenizer("asdf--fvd"); // Act - var tokens = new Stack(); + var tokens = new Stack(); var tokenFound = tokenizer.LookaheadUntil((s, p) => { tokens.Push(s); - return s.Type == HtmlTokenType.DoubleHyphen; + return s.Kind == SyntaxKind.DoubleHyphen; }); // Assert Assert.True(tokenFound); Assert.Equal(2, tokens.Count); - Assert.Equal(new HtmlToken("--", HtmlTokenType.DoubleHyphen), tokens.Pop()); - Assert.Equal(new HtmlToken("asdf", HtmlTokenType.Text), tokens.Pop()); + AssertTokenEqual(SyntaxFactory.Token(SyntaxKind.DoubleHyphen, "--"), tokens.Pop()); + AssertTokenEqual(SyntaxFactory.Token(SyntaxKind.Text, "asdf"), tokens.Pop()); } private static TestTokenizerBackedParser CreateContentTokenizer(string content) @@ -135,7 +136,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy return tokenizer; } - private class ExposedTokenizer : Tokenizer + private static void AssertTokenEqual(SyntaxToken expected, SyntaxToken actual) + { + Assert.True(expected.IsEquivalentTo(actual), "Tokens not equal."); + } + + private class ExposedTokenizer : Tokenizer { public ExposedTokenizer(string input) : base(new SeekableTextReader(input, filePath: null)) @@ -150,7 +156,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } } - public override CSharpTokenType RazorCommentStarType + public override SyntaxKind RazorCommentStarKind { get { @@ -158,7 +164,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } } - public override CSharpTokenType RazorCommentTransitionType + public override SyntaxKind RazorCommentTransitionKind { get { @@ -166,7 +172,7 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } } - public override CSharpTokenType RazorCommentType + public override SyntaxKind RazorCommentKind { get { @@ -182,9 +188,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } } - protected override CSharpToken CreateToken( + protected override SyntaxToken CreateToken( string content, - CSharpTokenType type, + SyntaxKind type, IReadOnlyList errors) { throw new NotImplementedException(); @@ -196,9 +202,9 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } } - private class TestTokenizerBackedParser : TokenizerBackedParser + private class TestTokenizerBackedParser : TokenizerBackedParser { - internal TestTokenizerBackedParser(LanguageCharacteristics language, ParserContext context) : base(language, context) + internal TestTokenizerBackedParser(LanguageCharacteristics language, ParserContext context) : base(language, context) { } @@ -207,12 +213,12 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy throw new NotImplementedException(); } - protected override bool TokenTypeEquals(HtmlTokenType x, HtmlTokenType y) + protected override bool TokenKindEquals(SyntaxKind x, SyntaxKind y) { throw new NotImplementedException(); } - internal new bool LookaheadUntil(Func, bool> condition) + internal new bool LookaheadUntil(Func, bool> condition) { return base.LookaheadUntil(condition); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TokenizerTestBase.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TokenizerTestBase.cs index 307ccad3a7..21ccddba3b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TokenizerTestBase.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/Legacy/TokenizerTestBase.cs @@ -4,6 +4,7 @@ using System; using System.Diagnostics; using System.Text; +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; using Xunit; namespace Microsoft.AspNetCore.Razor.Language.Legacy @@ -13,18 +14,16 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy internal abstract object IgnoreRemaining { get; } internal abstract object CreateTokenizer(ITextDocument source); - internal void TestTokenizer(string input, params TSymbol[] expectedSymbols) - where TSymbolType : struct - where TSymbol : TokenBase + internal void TestTokenizer(string input, params SyntaxToken[] expectedSymbols) { // Arrange var success = true; var output = new StringBuilder(); using (var source = new SeekableTextReader(input, filePath: null)) { - var tokenizer = (Tokenizer)CreateTokenizer(source); + var tokenizer = (Tokenizer)CreateTokenizer(source); var counter = 0; - TSymbol current = null; + SyntaxToken current = null; while ((current = tokenizer.NextToken()) != null) { if (counter >= expectedSymbols.Length) @@ -34,11 +33,11 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy } else if (ReferenceEquals(expectedSymbols[counter], IgnoreRemaining)) { - output.AppendLine(string.Format("P: Ignored {0}", current)); + output.AppendLine(string.Format("P: Ignored |{0}|", current)); } else { - if (!Equals(expectedSymbols[counter], current)) + if (!expectedSymbols[counter].IsEquivalentTo(current)) { output.AppendLine(string.Format("F: Expected: {0}; Actual: {1}", expectedSymbols[counter], current)); success = false; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/SourceChangeTest.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/SourceChangeTest.cs index 470b69720a..d569974b67 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/SourceChangeTest.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/SourceChangeTest.cs @@ -3,6 +3,7 @@ using System; using Microsoft.AspNetCore.Razor.Language.Legacy; +using Microsoft.AspNetCore.Razor.Language.Syntax.InternalSyntax; using Xunit; namespace Microsoft.AspNetCore.Razor.Language @@ -104,8 +105,8 @@ namespace Microsoft.AspNetCore.Razor.Language { // Arrange var builder = new SpanBuilder(new SourceLocation(0, 0, 0)); - builder.Accept(new RawTextToken(new SourceLocation(0, 0, 0), "Hello, ")); - builder.Accept(new RawTextToken(new SourceLocation(7, 0, 7), "World")); + builder.Accept(SyntaxFactory.Token(SyntaxKind.Unknown, "Hello, ")); + builder.Accept(SyntaxFactory.Token(SyntaxKind.Unknown, "World")); var span = new Span(builder); @@ -123,8 +124,8 @@ namespace Microsoft.AspNetCore.Razor.Language { // Arrange var builder = new SpanBuilder(new SourceLocation(13, 0, 0)); - builder.Accept(new RawTextToken(new SourceLocation(13, 0, 13), "Hello, ")); - builder.Accept(new RawTextToken(new SourceLocation(20, 0, 20), "World")); + builder.Accept(SyntaxFactory.Token(SyntaxKind.Unknown, "Hello, ")); + builder.Accept(SyntaxFactory.Token(SyntaxKind.Unknown, "World")); var span = new Span(builder); @@ -142,8 +143,8 @@ namespace Microsoft.AspNetCore.Razor.Language { // Arrange var builder = new SpanBuilder(new SourceLocation(13, 0, 0)); - builder.Accept(new RawTextToken(new SourceLocation(13, 0, 13), "Hello, ")); - builder.Accept(new RawTextToken(new SourceLocation(20, 0, 20), "World")); + builder.Accept(SyntaxFactory.Token(SyntaxKind.Unknown, "Hello, ")); + builder.Accept(SyntaxFactory.Token(SyntaxKind.Unknown, "World")); var span = new Span(builder); @@ -161,8 +162,8 @@ namespace Microsoft.AspNetCore.Razor.Language { // Arrange var builder = new SpanBuilder(new SourceLocation(13, 0, 0)); - builder.Accept(new RawTextToken(new SourceLocation(13, 0, 13), "Hello, ")); - builder.Accept(new RawTextToken(new SourceLocation(20, 0, 20), "World")); + builder.Accept(SyntaxFactory.Token(SyntaxKind.Unknown, "Hello, ")); + builder.Accept(SyntaxFactory.Token(SyntaxKind.Unknown, "World")); var span = new Span(builder); @@ -180,8 +181,8 @@ namespace Microsoft.AspNetCore.Razor.Language { // Arrange var builder = new SpanBuilder(new SourceLocation(13, 0, 0)); - builder.Accept(new RawTextToken(new SourceLocation(13, 0, 13), "Hello, ")); - builder.Accept(new RawTextToken(new SourceLocation(20, 0, 20), "World")); + builder.Accept(SyntaxFactory.Token(SyntaxKind.Unknown, "Hello, ")); + builder.Accept(SyntaxFactory.Token(SyntaxKind.Unknown, "World")); var span = new Span(builder); diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.codegen.cs index 9d90489dea..eb46570f7b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.codegen.cs @@ -8,7 +8,11 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective.cshtml" global::System.Object __typeHelper = "*, TestAssembly"; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.mappings.txt index bff77ec3f5..9b2515042f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective.cshtml) |"*, TestAssembly"| -Generated Location: (427:10,37 [17] ) +Generated Location: (524:11,37 [17] ) |"*, TestAssembly"| diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.codegen.cs index ae87635f43..dd6d3c27d0 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.codegen.cs @@ -12,7 +12,11 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml" global::System.Object __typeHelper = "*, TestAssembly"; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.mappings.txt index 46733338f6..3ddf69115e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.mappings.txt @@ -1,15 +1,15 @@ Source Location: (14:0,14 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml) |*, TestAssembly| -Generated Location: (779:14,38 [15] ) +Generated Location: (883:15,38 [15] ) |*, TestAssembly| Source Location: (187:5,36 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml) |true| -Generated Location: (1727:31,42 [4] ) +Generated Location: (1862:35,42 [4] ) |true| Source Location: (233:6,36 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml) |true| -Generated Location: (2380:41,42 [4] ) +Generated Location: (2515:45,42 [4] ) |true| diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.codegen.cs index ee78430716..a53cee2052 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.codegen.cs @@ -11,7 +11,11 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml" global::System.Object __typeHelper = "*, TestAssembly"; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.mappings.txt index 6eb05c5160..3af7b84cfc 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.mappings.txt @@ -1,15 +1,15 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml) |"*, TestAssembly"| -Generated Location: (673:13,37 [17] ) +Generated Location: (764:14,37 [17] ) |"*, TestAssembly"| Source Location: (220:5,38 [23] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml) |ViewBag.DefaultInterval| -Generated Location: (1439:28,38 [23] ) +Generated Location: (1561:32,38 [23] ) |ViewBag.DefaultInterval| Source Location: (303:6,40 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml) |true| -Generated Location: (2137:39,42 [4] ) +Generated Location: (2259:43,42 [4] ) |true| diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.codegen.cs index 6322f77a95..632c5c6da9 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.codegen.cs @@ -11,11 +11,19 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml" global::System.Object __typeHelper = "THS"; + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml" global::System.Object __typeHelper = "*, TestAssembly"; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.mappings.txt index 7c5ad4ca43..e8294fb2f1 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.mappings.txt @@ -1,15 +1,15 @@ Source Location: (17:0,17 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml) |"THS"| -Generated Location: (682:13,37 [5] ) +Generated Location: (782:14,37 [5] ) |"THS"| Source Location: (38:1,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml) |"*, TestAssembly"| -Generated Location: (787:17,37 [17] ) +Generated Location: (1018:22,37 [17] ) |"*, TestAssembly"| Source Location: (226:7,43 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml) |true| -Generated Location: (1624:33,43 [4] ) +Generated Location: (1886:41,43 [4] ) |true| diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.codegen.cs index e2ff79fdb5..f462ec5fb6 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.codegen.cs @@ -11,7 +11,11 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" global::System.Object __typeHelper = "*, TestAssembly"; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.mappings.txt index 5a3c14354f..3aadb7916f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.mappings.txt @@ -1,6 +1,6 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |"*, TestAssembly"| -Generated Location: (675:13,37 [17] ) +Generated Location: (768:14,37 [17] ) |"*, TestAssembly"| Source Location: (36:2,1 [52] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) @@ -9,7 +9,7 @@ Source Location: (36:2,1 [52] TestFiles/IntegrationTests/CodeGenerationIntegrati var checkbox = "checkbox"; | -Generated Location: (1103:25,1 [52] ) +Generated Location: (1227:29,1 [52] ) |if (true) { var checkbox = "checkbox"; @@ -18,39 +18,39 @@ Generated Location: (1103:25,1 [52] ) Source Location: (147:7,16 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |@| -Generated Location: (1409:35,33 [1] ) +Generated Location: (1533:39,33 [1] ) |@| Source Location: (149:7,18 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) || -Generated Location: (1410:35,34 [0] ) +Generated Location: (1534:39,34 [0] ) || Source Location: (149:7,18 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |@| -Generated Location: (1410:35,34 [1] ) +Generated Location: (1534:39,34 [1] ) |@| Source Location: (150:7,19 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |(| -Generated Location: (1411:35,35 [1] ) +Generated Location: (1535:39,35 [1] ) |(| Source Location: (151:7,20 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |1+2| -Generated Location: (1412:35,36 [3] ) +Generated Location: (1536:39,36 [3] ) |1+2| Source Location: (154:7,23 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |)| -Generated Location: (1415:35,39 [1] ) +Generated Location: (1539:39,39 [1] ) |)| Source Location: (273:10,13 [43] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |if (false) { | -Generated Location: (1557:40,13 [43] ) +Generated Location: (1681:44,13 [43] ) |if (false) { | @@ -61,7 +61,7 @@ Source Location: (399:12,99 [66] TestFiles/IntegrationTests/CodeGenerationIntegr else { | -Generated Location: (2277:52,99 [66] ) +Generated Location: (2401:56,99 [66] ) | } else @@ -70,224 +70,224 @@ Generated Location: (2277:52,99 [66] ) Source Location: (495:16,46 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |checkbox| -Generated Location: (2724:63,46 [8] ) +Generated Location: (2848:67,46 [8] ) |checkbox| Source Location: (512:16,63 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |true| -Generated Location: (3077:70,63 [4] ) +Generated Location: (3201:74,63 [4] ) |true| Source Location: (523:16,74 [18] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | | -Generated Location: (3378:76,74 [18] ) +Generated Location: (3502:80,74 [18] ) | | Source Location: (556:17,31 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |true ? "checkbox" : "anything"| -Generated Location: (3762:84,31 [30] ) +Generated Location: (3886:88,31 [30] ) |true ? "checkbox" : "anything"| Source Location: (591:17,66 [18] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | | -Generated Location: (4140:91,66 [18] ) +Generated Location: (4264:95,66 [18] ) | | Source Location: (623:18,30 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |if(true) { | -Generated Location: (4523:99,30 [11] ) +Generated Location: (4647:103,30 [11] ) |if(true) { | Source Location: (655:18,62 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | } else { | -Generated Location: (4723:104,62 [10] ) +Generated Location: (4847:108,62 [10] ) | } else { | Source Location: (686:18,93 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | }| -Generated Location: (4953:109,93 [2] ) +Generated Location: (5077:113,93 [2] ) | }| Source Location: (690:18,97 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | }| -Generated Location: (5333:116,97 [15] ) +Generated Location: (5457:120,97 [15] ) | }| Source Location: (212:8,32 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |DateTime.Now| -Generated Location: (5601:123,32 [12] ) +Generated Location: (5725:127,32 [12] ) |DateTime.Now| Source Location: (832:22,14 [21] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | var @object = false;| -Generated Location: (5755:128,14 [21] ) +Generated Location: (5879:132,14 [21] ) | var @object = false;| Source Location: (885:23,29 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |(| -Generated Location: (6153:135,42 [1] ) +Generated Location: (6277:139,42 [1] ) |(| Source Location: (886:23,30 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |@object| -Generated Location: (6154:135,43 [7] ) +Generated Location: (6278:139,43 [7] ) |@object| Source Location: (893:23,37 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |)| -Generated Location: (6161:135,50 [1] ) +Generated Location: (6285:139,50 [1] ) |)| Source Location: (760:21,39 [23] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |DateTimeOffset.Now.Year| -Generated Location: (6423:141,38 [23] ) +Generated Location: (6547:145,38 [23] ) |DateTimeOffset.Now.Year| Source Location: (783:21,62 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | -| -Generated Location: (6446:141,61 [2] ) +Generated Location: (6570:145,61 [2] ) | -| Source Location: (785:21,64 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | 1970| -Generated Location: (6448:141,63 [5] ) +Generated Location: (6572:145,63 [5] ) | 1970| Source Location: (1025:26,61 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |(| -Generated Location: (6849:148,60 [1] ) +Generated Location: (6973:152,60 [1] ) |(| Source Location: (1026:26,62 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |DateTimeOffset.Now.Year > 2014| -Generated Location: (6850:148,61 [30] ) +Generated Location: (6974:152,61 [30] ) |DateTimeOffset.Now.Year > 2014| Source Location: (1056:26,92 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |)| -Generated Location: (6880:148,91 [1] ) +Generated Location: (7004:152,91 [1] ) |)| Source Location: (928:25,16 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |-1970| -Generated Location: (7137:154,33 [5] ) +Generated Location: (7261:158,33 [5] ) |-1970| Source Location: (933:25,21 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | +| -Generated Location: (7142:154,38 [2] ) +Generated Location: (7266:158,38 [2] ) | +| Source Location: (935:25,23 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | | -Generated Location: (7144:154,40 [1] ) +Generated Location: (7268:158,40 [1] ) | | Source Location: (936:25,24 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |@| -Generated Location: (7145:154,41 [1] ) +Generated Location: (7269:158,41 [1] ) |@| Source Location: (937:25,25 [23] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |DateTimeOffset.Now.Year| -Generated Location: (7146:154,42 [23] ) +Generated Location: (7270:158,42 [23] ) |DateTimeOffset.Now.Year| Source Location: (1155:29,28 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |DateTimeOffset.Now.Year > 2014| -Generated Location: (7547:161,42 [30] ) +Generated Location: (7671:165,42 [30] ) |DateTimeOffset.Now.Year > 2014| Source Location: (1093:28,16 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |DateTimeOffset.Now.Year - 1970| -Generated Location: (7833:167,33 [30] ) +Generated Location: (7957:171,33 [30] ) |DateTimeOffset.Now.Year - 1970| Source Location: (1283:32,28 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | | -Generated Location: (8241:174,42 [3] ) +Generated Location: (8365:178,42 [3] ) | | Source Location: (1286:32,31 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |@| -Generated Location: (8244:174,45 [1] ) +Generated Location: (8368:178,45 [1] ) |@| Source Location: (1287:32,32 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |(| -Generated Location: (8245:174,46 [1] ) +Generated Location: (8369:178,46 [1] ) |(| Source Location: (1288:32,33 [27] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | DateTimeOffset.Now.Year | -Generated Location: (8246:174,47 [27] ) +Generated Location: (8370:178,47 [27] ) | DateTimeOffset.Now.Year | Source Location: (1315:32,60 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |)| -Generated Location: (8273:174,74 [1] ) +Generated Location: (8397:178,74 [1] ) |)| Source Location: (1316:32,61 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | >| -Generated Location: (8274:174,75 [2] ) +Generated Location: (8398:178,75 [2] ) | >| Source Location: (1318:32,63 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | 2014| -Generated Location: (8276:174,77 [5] ) +Generated Location: (8400:178,77 [5] ) | 2014| Source Location: (1323:32,68 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | | -Generated Location: (8281:174,82 [3] ) +Generated Location: (8405:178,82 [3] ) | | Source Location: (1220:31,17 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |(| -Generated Location: (8540:180,33 [1] ) +Generated Location: (8664:184,33 [1] ) |(| Source Location: (1221:31,18 [29] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |"My age is this long.".Length| -Generated Location: (8541:180,34 [29] ) +Generated Location: (8665:184,34 [29] ) |"My age is this long.".Length| Source Location: (1250:31,47 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |)| -Generated Location: (8570:180,63 [1] ) +Generated Location: (8694:184,63 [1] ) |)| Source Location: (1355:34,9 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |someMethod(| -Generated Location: (8708:185,9 [11] ) +Generated Location: (8832:189,9 [11] ) |someMethod(| Source Location: (1410:34,64 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |checked| -Generated Location: (9126:189,63 [7] ) +Generated Location: (9250:193,63 [7] ) |checked| Source Location: (1375:34,29 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |123| -Generated Location: (9381:195,33 [3] ) +Generated Location: (9505:199,33 [3] ) |123| Source Location: (1424:34,78 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |)| -Generated Location: (9422:200,1 [1] ) +Generated Location: (9546:204,1 [1] ) |)| Source Location: (1437:35,10 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | }| -Generated Location: (9561:205,10 [3] ) +Generated Location: (9685:209,10 [3] ) | }| diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.codegen.cs index d30aea4b02..3efdad255d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.codegen.cs @@ -8,7 +8,11 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 12 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml" global::System.Object Footer = null; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.mappings.txt index 87ab943dfc..f35877bdb3 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.mappings.txt @@ -1,49 +1,49 @@ Source Location: (173:11,9 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml) |Footer| -Generated Location: (401:10,22 [6] ) +Generated Location: (488:11,22 [6] ) |Footer| Source Location: (20:1,13 [36] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml) |for(int i = 1; i <= 10; i++) { | -Generated Location: (830:22,13 [36] ) +Generated Location: (948:26,13 [36] ) |for(int i = 1; i <= 10; i++) { | Source Location: (74:2,22 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml) |i| -Generated Location: (1007:28,22 [1] ) +Generated Location: (1125:32,22 [1] ) |i| Source Location: (79:2,27 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml) | }| -Generated Location: (1155:33,27 [15] ) +Generated Location: (1273:37,27 [15] ) | }| Source Location: (113:7,2 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml) |Foo(Bar.Baz)| -Generated Location: (1295:39,6 [12] ) +Generated Location: (1413:43,6 [12] ) |Foo(Bar.Baz)| Source Location: (129:8,1 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml) |Foo(| -Generated Location: (1433:44,6 [4] ) +Generated Location: (1551:48,6 [4] ) |Foo(| Source Location: (142:8,14 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml) |baz| -Generated Location: (1595:46,14 [3] ) +Generated Location: (1713:50,14 [3] ) |baz| Source Location: (153:8,25 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml) |)| -Generated Location: (1636:51,1 [1] ) +Generated Location: (1754:55,1 [1] ) |)| Source Location: (204:13,5 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml) |bar| -Generated Location: (1836:57,6 [3] ) +Generated Location: (1954:61,6 [3] ) |bar| diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.codegen.cs index bb9a7ef103..c0ce37ece6 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.codegen.cs @@ -11,7 +11,11 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml" global::System.Object __typeHelper = "*, TestAssembly"; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.mappings.txt index 550a6a62a4..4e2ad9730b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.mappings.txt @@ -1,20 +1,20 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml) |"*, TestAssembly"| -Generated Location: (686:13,37 [17] ) +Generated Location: (790:14,37 [17] ) |"*, TestAssembly"| Source Location: (146:4,34 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml) |true| -Generated Location: (1882:33,42 [4] ) +Generated Location: (2017:37,42 [4] ) |true| Source Location: (222:5,34 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml) |true| -Generated Location: (2424:42,42 [4] ) +Generated Location: (2559:46,42 [4] ) |true| Source Location: (43:2,8 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml) |3| -Generated Location: (2694:48,33 [1] ) +Generated Location: (2829:52,33 [1] ) |3| diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.codegen.cs index 98078501de..f9352a839f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.codegen.cs @@ -10,7 +10,11 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper.cshtml" global::System.Object __typeHelper = "*, TestAssembly"; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.mappings.txt index 800ab195ba..67262f09de 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.mappings.txt @@ -1,10 +1,10 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper.cshtml) |"*, TestAssembly"| -Generated Location: (608:12,37 [17] ) +Generated Location: (708:13,37 [17] ) |"*, TestAssembly"| Source Location: (67:2,32 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper.cshtml) |true| -Generated Location: (1449:28,41 [4] ) +Generated Location: (1580:32,41 [4] ) |true| diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.codegen.cs index dd5214d829..2758e4bca9 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.codegen.cs @@ -9,7 +9,11 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" global::System.Object __typeHelper = "*, TestAssembly"; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.mappings.txt index f2b45b216e..f3d53b0651 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.mappings.txt @@ -1,155 +1,155 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |"*, TestAssembly"| -Generated Location: (518:11,37 [17] ) +Generated Location: (620:12,37 [17] ) |"*, TestAssembly"| Source Location: (59:2,24 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |DateTime.Now| -Generated Location: (1081:24,24 [12] ) +Generated Location: (1214:28,24 [12] ) |DateTime.Now| Source Location: (96:4,17 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |if (true) { | -Generated Location: (1349:30,17 [12] ) +Generated Location: (1482:34,17 [12] ) |if (true) { | Source Location: (109:4,30 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |string.Empty| -Generated Location: (1526:35,30 [12] ) +Generated Location: (1659:39,30 [12] ) |string.Empty| Source Location: (121:4,42 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) | } else { | -Generated Location: (1716:40,42 [10] ) +Generated Location: (1849:44,42 [10] ) | } else { | Source Location: (132:4,53 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |false| -Generated Location: (1914:45,53 [5] ) +Generated Location: (2047:49,53 [5] ) |false| Source Location: (137:4,58 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) | }| -Generated Location: (2113:50,58 [2] ) +Generated Location: (2246:54,58 [2] ) | }| Source Location: (176:6,22 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |DateTime.Now| -Generated Location: (2375:56,22 [12] ) +Generated Location: (2508:60,22 [12] ) |DateTime.Now| Source Location: (214:6,60 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |DateTime.Now| -Generated Location: (2649:62,60 [12] ) +Generated Location: (2782:66,60 [12] ) |DateTime.Now| Source Location: (256:8,15 [13] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |long.MinValue| -Generated Location: (2915:68,15 [13] ) +Generated Location: (3048:72,15 [13] ) |long.MinValue| Source Location: (271:8,30 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |if (true) { | -Generated Location: (3094:73,30 [12] ) +Generated Location: (3227:77,30 [12] ) |if (true) { | Source Location: (284:8,43 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |string.Empty| -Generated Location: (3284:78,43 [12] ) +Generated Location: (3417:82,43 [12] ) |string.Empty| Source Location: (296:8,55 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) | } else { | -Generated Location: (3487:83,55 [10] ) +Generated Location: (3620:87,55 [10] ) | } else { | Source Location: (307:8,66 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |false| -Generated Location: (3698:88,66 [5] ) +Generated Location: (3831:92,66 [5] ) |false| Source Location: (312:8,71 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) | }| -Generated Location: (3910:93,71 [2] ) +Generated Location: (4043:97,71 [2] ) | }| Source Location: (316:8,75 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |int.MaxValue| -Generated Location: (4122:98,75 [12] ) +Generated Location: (4255:102,75 [12] ) |int.MaxValue| Source Location: (348:9,17 [13] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |long.MinValue| -Generated Location: (4354:104,17 [13] ) +Generated Location: (4487:108,17 [13] ) |long.MinValue| Source Location: (363:9,32 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |if (true) { | -Generated Location: (4536:109,32 [12] ) +Generated Location: (4669:113,32 [12] ) |if (true) { | Source Location: (376:9,45 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |string.Empty| -Generated Location: (4729:114,45 [12] ) +Generated Location: (4862:118,45 [12] ) |string.Empty| Source Location: (388:9,57 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) | } else { | -Generated Location: (4935:119,57 [10] ) +Generated Location: (5068:123,57 [10] ) | } else { | Source Location: (399:9,68 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |false| -Generated Location: (5149:124,68 [5] ) +Generated Location: (5282:128,68 [5] ) |false| Source Location: (404:9,73 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) | }| -Generated Location: (5364:129,73 [2] ) +Generated Location: (5497:133,73 [2] ) | }| Source Location: (408:9,77 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |int.MaxValue| -Generated Location: (5579:134,77 [12] ) +Generated Location: (5712:138,77 [12] ) |int.MaxValue| Source Location: (445:11,17 [13] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |long.MinValue| -Generated Location: (5848:140,17 [13] ) +Generated Location: (5981:144,17 [13] ) |long.MinValue| Source Location: (460:11,32 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |DateTime.Now| -Generated Location: (6030:145,32 [12] ) +Generated Location: (6163:149,32 [12] ) |DateTime.Now| Source Location: (492:11,64 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |int.MaxValue| -Generated Location: (6243:150,64 [12] ) +Generated Location: (6376:154,64 [12] ) |int.MaxValue| Source Location: (529:13,17 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |if (true) { | -Generated Location: (6512:156,17 [12] ) +Generated Location: (6645:160,17 [12] ) |if (true) { | Source Location: (542:13,30 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |string.Empty| -Generated Location: (6690:161,30 [12] ) +Generated Location: (6823:165,30 [12] ) |string.Empty| Source Location: (554:13,42 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) | } else { | -Generated Location: (6881:166,42 [10] ) +Generated Location: (7014:170,42 [10] ) | } else { | Source Location: (565:13,53 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |false| -Generated Location: (7080:171,53 [5] ) +Generated Location: (7213:175,53 [5] ) |false| Source Location: (570:13,58 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) | }| -Generated Location: (7280:176,58 [2] ) +Generated Location: (7413:180,58 [2] ) | }| diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.codegen.cs index 669d7a19c6..9e39a276ab 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.codegen.cs @@ -11,7 +11,11 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml" global::System.Object __typeHelper = "*, TestAssembly"; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.mappings.txt index 1f98a4c03f..08d465380f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.mappings.txt @@ -1,20 +1,20 @@ Source Location: (14:0,14 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml) |*, TestAssembly| -Generated Location: (683:13,38 [15] ) +Generated Location: (783:14,38 [15] ) |*, TestAssembly| Source Location: (66:3,26 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml) || -Generated Location: (1510:29,42 [0] ) +Generated Location: (1641:33,42 [0] ) || Source Location: (126:5,30 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml) || -Generated Location: (2038:38,42 [0] ) +Generated Location: (2169:42,42 [0] ) || Source Location: (92:4,12 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml) || -Generated Location: (2300:44,33 [0] ) +Generated Location: (2431:48,33 [0] ) || diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.codegen.cs index db0d5933b9..1e3baec784 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.codegen.cs @@ -10,7 +10,11 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml" global::System.Object __typeHelper = "*, TestAssembly"; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.mappings.txt index 948af33b62..f2c51bc5a4 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.mappings.txt @@ -1,49 +1,49 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) |"*, TestAssembly"| -Generated Location: (598:12,37 [17] ) +Generated Location: (688:13,37 [17] ) |"*, TestAssembly"| Source Location: (37:2,2 [39] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) | var enumValue = MyEnum.MyValue; | -Generated Location: (1024:24,2 [39] ) +Generated Location: (1145:28,2 [39] ) | var enumValue = MyEnum.MyValue; | Source Location: (96:6,15 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) |MyEnum.MyValue| -Generated Location: (1435:32,39 [14] ) +Generated Location: (1556:36,39 [14] ) |MyEnum.MyValue| Source Location: (131:7,15 [20] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) |MyEnum.MySecondValue| -Generated Location: (1800:39,15 [20] ) +Generated Location: (1921:43,15 [20] ) |MyEnum.MySecondValue| Source Location: (171:8,14 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) |MyValue| -Generated Location: (2288:46,132 [7] ) +Generated Location: (2409:50,132 [7] ) |MyValue| Source Location: (198:9,14 [13] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) |MySecondValue| -Generated Location: (2764:53,132 [13] ) +Generated Location: (2885:57,132 [13] ) |MySecondValue| Source Location: (224:9,40 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) |MyValue| -Generated Location: (3040:58,138 [7] ) +Generated Location: (3161:62,138 [7] ) |MyValue| Source Location: (251:10,15 [9] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) |enumValue| -Generated Location: (3423:65,39 [9] ) +Generated Location: (3544:69,39 [9] ) |enumValue| Source Location: (274:10,38 [9] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) |enumValue| -Generated Location: (3602:70,45 [9] ) +Generated Location: (3723:74,45 [9] ) |enumValue| diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.codegen.cs index 81fc96ba88..c07ab803f0 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.codegen.cs @@ -10,7 +10,11 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml" global::System.Object __typeHelper = "*, TestAssembly"; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.mappings.txt index 32e64b25e5..3ab1bf8760 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.mappings.txt @@ -1,20 +1,20 @@ Source Location: (14:0,14 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml) |*, TestAssembly| -Generated Location: (598:12,38 [15] ) +Generated Location: (691:13,38 [15] ) |*, TestAssembly| Source Location: (106:3,29 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml) |DateTime.Now| -Generated Location: (1053:24,29 [12] ) +Generated Location: (1177:28,29 [12] ) |DateTime.Now| Source Location: (204:5,51 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml) |DateTime.Now| -Generated Location: (1451:31,51 [12] ) +Generated Location: (1575:35,51 [12] ) |DateTime.Now| Source Location: (227:5,74 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml) |true| -Generated Location: (1818:38,74 [4] ) +Generated Location: (1942:42,74 [4] ) |true| diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.cs index 9e76084ccd..aded1d15f9 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.cs @@ -8,39 +8,75 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 3 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" global::System.Object __typeHelper = ""; + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 4 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" global::System.Object __typeHelper = ""; + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 5 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" global::System.Object __typeHelper = "; + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 7 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" global::System.Object __typeHelper = ""; + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 8 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" global::System.Object __typeHelper = ""; + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 9 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" global::System.Object __typeHelper = "; + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 11 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" global::System.Object __typeHelper = ""; + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 12 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" global::System.Object __typeHelper = ""; + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 13 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" global::System.Object __typeHelper = "; + +#line default +#line hidden } ))(); ((System.Action)(() => { diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt index 41510ddf4d..274e1271a8 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt @@ -1,70 +1,70 @@ Source Location: (100:2,13 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (427:10,38 [0] ) +Generated Location: (523:11,38 [0] ) || Source Location: (116:3,14 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (529:14,38 [0] ) +Generated Location: (752:19,38 [0] ) || Source Location: (132:4,14 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) |"| -Generated Location: (630:18,37 [1] ) +Generated Location: (980:27,37 [1] ) |"| Source Location: (153:6,16 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (732:22,38 [0] ) +Generated Location: (1209:35,38 [0] ) || Source Location: (172:7,17 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (834:26,38 [0] ) +Generated Location: (1438:43,38 [0] ) || Source Location: (191:8,17 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) |"| -Generated Location: (935:30,37 [1] ) +Generated Location: (1666:51,37 [1] ) |"| Source Location: (212:10,16 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (1037:34,38 [0] ) +Generated Location: (1896:59,38 [0] ) || Source Location: (231:11,17 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (1139:38,38 [0] ) +Generated Location: (2126:67,38 [0] ) || Source Location: (250:12,17 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) |"| -Generated Location: (1240:42,37 [1] ) +Generated Location: (2355:75,37 [1] ) |"| Source Location: (264:14,9 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (1304:46,0 [0] ) +Generated Location: (2450:82,0 [0] ) || Source Location: (276:15,10 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (1357:49,0 [0] ) +Generated Location: (2503:85,0 [0] ) || Source Location: (315:20,8 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (1410:52,0 [0] ) +Generated Location: (2556:88,0 [0] ) || Source Location: (326:21,9 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (1463:55,0 [0] ) +Generated Location: (2609:91,0 [0] ) || Source Location: (354:24,12 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (1879:66,12 [0] ) +Generated Location: (3025:102,12 [0] ) || diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_DesignTime.codegen.cs index 3a01486099..c41bad1d6d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_DesignTime.codegen.cs @@ -9,7 +9,11 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper.cshtml" global::System.Object __typeHelper = "*, TestAssembly"; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_DesignTime.mappings.txt index cad8cf7ea6..712b3e20a2 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper.cshtml) |"*, TestAssembly"| -Generated Location: (503:11,37 [17] ) +Generated Location: (598:12,37 [17] ) |"*, TestAssembly"| diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.codegen.cs index bb73db8e52..6601497a12 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.codegen.cs @@ -8,7 +8,11 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml" foo.bar>.boz __typeHelper = default(foo.bar>.boz); + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.mappings.txt index bbde1e3ca1..01b6682fe7 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.mappings.txt @@ -1,10 +1,10 @@ Source Location: (10:0,10 [21] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml) |foo.bar>.boz| -Generated Location: (401:10,0 [21] ) +Generated Location: (485:11,0 [21] ) |foo.bar>.boz| Source Location: (36:2,1 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml) |foo()| -Generated Location: (875:22,6 [5] ) +Generated Location: (990:26,6 [5] ) |foo()| diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.codegen.cs index 0dac7a2c04..2f0457a578 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.codegen.cs @@ -8,7 +8,11 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks.cshtml" global::System.Object Link = null; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.mappings.txt index defa39bbc4..0a768ff099 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.mappings.txt @@ -1,25 +1,25 @@ Source Location: (9:0,9 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks.cshtml) |Link| -Generated Location: (403:10,22 [4] ) +Generated Location: (491:11,22 [4] ) |Link| Source Location: (44:1,14 [19] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks.cshtml) |if(link != null) { | -Generated Location: (833:22,14 [19] ) +Generated Location: (952:26,14 [19] ) |if(link != null) { | Source Location: (64:1,34 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks.cshtml) |link| -Generated Location: (1007:27,34 [4] ) +Generated Location: (1126:31,34 [4] ) |link| Source Location: (68:1,38 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks.cshtml) | } else { | -Generated Location: (1171:32,38 [10] ) +Generated Location: (1290:36,38 [10] ) | } else { | Source Location: (92:1,62 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks.cshtml) | }| -Generated Location: (1364:37,62 [2] ) +Generated Location: (1483:41,62 [2] ) | }| diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.codegen.cs index 5f2fdedba9..fa57dea3a8 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.codegen.cs @@ -11,7 +11,11 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers.cshtml" global::System.Object __typeHelper = "*, TestAssembly"; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.mappings.txt index cb760ffd40..0de418c09e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers.cshtml) |"*, TestAssembly"| -Generated Location: (657:13,37 [17] ) +Generated Location: (752:14,37 [17] ) |"*, TestAssembly"| diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_DesignTime.codegen.cs index 0da5daae01..7062693c30 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_DesignTime.codegen.cs @@ -11,7 +11,11 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers.cshtml" global::System.Object __typeHelper = "*, TestAssembly"; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_DesignTime.mappings.txt index 59224681d1..4237e35905 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_DesignTime.mappings.txt @@ -1,29 +1,29 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers.cshtml) |"*, TestAssembly"| -Generated Location: (683:13,37 [17] ) +Generated Location: (784:14,37 [17] ) |"*, TestAssembly"| Source Location: (195:5,13 [46] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers.cshtml) |for(var i = 0; i < 5; i++) { | -Generated Location: (1131:25,13 [46] ) +Generated Location: (1263:29,13 [46] ) |for(var i = 0; i < 5; i++) { | Source Location: (339:7,50 [23] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers.cshtml) |ViewBag.DefaultInterval| -Generated Location: (1569:33,50 [23] ) +Generated Location: (1701:37,50 [23] ) |ViewBag.DefaultInterval| Source Location: (389:7,100 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers.cshtml) |true| -Generated Location: (1975:40,100 [4] ) +Generated Location: (2107:44,100 [4] ) |true| Source Location: (422:8,25 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers.cshtml) | }| -Generated Location: (2139:45,25 [15] ) +Generated Location: (2271:49,25 [15] ) | }| diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_DesignTime.codegen.cs index ea880b7745..dc07e6a077 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_DesignTime.codegen.cs @@ -11,7 +11,11 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers.cshtml" global::System.Object __typeHelper = "*, TestAssembly"; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_DesignTime.mappings.txt index 0cc715d741..f4933d814c 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (14:0,14 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers.cshtml) |*, TestAssembly| -Generated Location: (591:13,38 [15] ) +Generated Location: (683:14,38 [15] ) |*, TestAssembly| diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers_DesignTime.codegen.cs index 438c533987..7b5af6a7b8 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers_DesignTime.codegen.cs @@ -10,7 +10,11 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml" global::System.Object __typeHelper = "*, TestAssembly"; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers_DesignTime.mappings.txt index 2f22a4d206..ea1b6c005f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers_DesignTime.mappings.txt @@ -1,6 +1,6 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml) |"*, TestAssembly"| -Generated Location: (609:12,37 [17] ) +Generated Location: (712:13,37 [17] ) |"*, TestAssembly"| Source Location: (37:2,2 [242] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml) @@ -15,7 +15,7 @@ Source Location: (37:2,2 [242] TestFiles/IntegrationTests/CodeGenerationIntegrat { "name", "value" }, }; | -Generated Location: (1048:24,2 [242] ) +Generated Location: (1182:28,2 [242] ) | var literate = "or illiterate"; var intDictionary = new Dictionary @@ -30,51 +30,51 @@ Generated Location: (1048:24,2 [242] ) Source Location: (370:15,43 [13] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml) |intDictionary| -Generated Location: (1691:40,56 [13] ) +Generated Location: (1825:44,56 [13] ) |intDictionary| Source Location: (404:15,77 [16] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml) |stringDictionary| -Generated Location: (2043:46,77 [16] ) +Generated Location: (2177:50,77 [16] ) |stringDictionary| Source Location: (468:16,43 [13] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml) |intDictionary| -Generated Location: (2593:54,56 [13] ) +Generated Location: (2727:58,56 [13] ) |intDictionary| Source Location: (502:16,77 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml) |37| -Generated Location: (2945:60,77 [2] ) +Generated Location: (3079:64,77 [2] ) |37| Source Location: (526:16,101 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml) |42| -Generated Location: (3330:66,101 [2] ) +Generated Location: (3464:70,101 [2] ) |42| Source Location: (590:18,31 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml) |42| -Generated Location: (3851:74,46 [2] ) +Generated Location: (3985:78,46 [2] ) |42| Source Location: (611:18,52 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml) |37| -Generated Location: (4180:80,64 [2] ) +Generated Location: (4314:84,64 [2] ) |37| Source Location: (634:18,75 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml) |98| -Generated Location: (4535:86,75 [2] ) +Generated Location: (4669:90,75 [2] ) |98| Source Location: (783:20,42 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml) |literate| -Generated Location: (5317:96,42 [8] ) +Generated Location: (5451:100,42 [8] ) |literate| Source Location: (826:21,29 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml) |37| -Generated Location: (5981:105,65 [2] ) +Generated Location: (6115:109,65 [2] ) |37| diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments.cshtml b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments.cshtml index bd4820f914..1edd2fcc49 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments.cshtml +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments.cshtml @@ -13,3 +13,6 @@

But this should show the comment syntax: @bar

@(a@**@b) + + + diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_DesignTime.ir.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_DesignTime.ir.txt index e75591ec2d..5853591fb0 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_DesignTime.ir.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_DesignTime.ir.txt @@ -38,5 +38,14 @@ Document - CSharpExpression - (323:14,2 [2] RazorComments.cshtml) IntermediateToken - (323:14,2 [1] RazorComments.cshtml) - CSharp - a IntermediateToken - (328:14,7 [1] RazorComments.cshtml) - CSharp - b - HtmlContent - (330:14,9 [2] RazorComments.cshtml) - IntermediateToken - (330:14,9 [2] RazorComments.cshtml) - Html - \n + HtmlContent - (330:14,9 [85] RazorComments.cshtml) + IntermediateToken - (330:14,9 [4] RazorComments.cshtml) - Html - \n\n + IntermediateToken - (334:16,0 [6] RazorComments.cshtml) - Html - + IntermediateToken - (406:16,72 [2] RazorComments.cshtml) - Html - \n + IntermediateToken - (408:17,0 [7] RazorComments.cshtml) - Html - + IntermediateToken - (473:17,65 [2] RazorComments.cshtml) - Html - \n diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_Runtime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_Runtime.codegen.cs index d9b27a45c7..7579c50719 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_Runtime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_Runtime.codegen.cs @@ -1,11 +1,11 @@ -#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "051345e2cc0313fea445db2f6cf48fe28b0b4edf" +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "4d553281e07fafc67ca0139b27ee95724a37f162" // #pragma warning disable 1591 [assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorComments_Runtime), @"default", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments.cshtml")] namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles { #line hidden - [global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"051345e2cc0313fea445db2f6cf48fe28b0b4edf", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments.cshtml")] + [global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"SHA1", @"4d553281e07fafc67ca0139b27ee95724a37f162", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments.cshtml")] public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorComments_Runtime { #pragma warning disable 1998 @@ -45,7 +45,8 @@ Write(ab); #line default #line hidden - WriteLiteral("\r\n"); + WriteLiteral("\r\n\r\n\r\n\r\n"); } #pragma warning restore 1998 } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_Runtime.ir.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_Runtime.ir.txt index e05218677f..47c3a144f1 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_Runtime.ir.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_Runtime.ir.txt @@ -33,5 +33,14 @@ Document - CSharpExpression - (323:14,2 [2] RazorComments.cshtml) IntermediateToken - (323:14,2 [1] RazorComments.cshtml) - CSharp - a IntermediateToken - (328:14,7 [1] RazorComments.cshtml) - CSharp - b - HtmlContent - (330:14,9 [2] RazorComments.cshtml) - IntermediateToken - (330:14,9 [2] RazorComments.cshtml) - Html - \n + HtmlContent - (330:14,9 [85] RazorComments.cshtml) + IntermediateToken - (330:14,9 [4] RazorComments.cshtml) - Html - \n\n + IntermediateToken - (334:16,0 [6] RazorComments.cshtml) - Html - + IntermediateToken - (406:16,72 [2] RazorComments.cshtml) - Html - \n + IntermediateToken - (408:17,0 [7] RazorComments.cshtml) - Html - + IntermediateToken - (473:17,65 [2] RazorComments.cshtml) - Html - \n diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective_DesignTime.codegen.cs index 860fed746d..997aecf717 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective_DesignTime.codegen.cs @@ -8,7 +8,11 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective.cshtml" global::System.Object __typeHelper = "*, TestAssembly"; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective_DesignTime.mappings.txt index 709b86af82..eb3dd0052c 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (17:0,17 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective.cshtml) |*, TestAssembly| -Generated Location: (431:10,38 [15] ) +Generated Location: (531:11,38 [15] ) |*, TestAssembly| diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.cs index 556cf5e489..fa69badba2 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.cs @@ -8,15 +8,27 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 7 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml" global::System.Object Section2 = null; + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 11 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml" global::System.Object Section1 = null; + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 15 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml" global::System.Object NestedDelegates = null; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.mappings.txt index f6aedef836..f1bbd3c6c6 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.mappings.txt @@ -1,44 +1,44 @@ Source Location: (89:6,9 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml) |Section2| -Generated Location: (399:10,22 [8] ) +Generated Location: (483:11,22 [8] ) |Section2| Source Location: (172:10,9 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml) |Section1| -Generated Location: (499:14,22 [8] ) +Generated Location: (699:19,22 [8] ) |Section1| Source Location: (235:14,9 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml) |NestedDelegates| -Generated Location: (599:18,22 [15] ) +Generated Location: (915:27,22 [15] ) |NestedDelegates| Source Location: (2:0,2 [44] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml) | Layout = "_SectionTestLayout.cshtml" | -Generated Location: (1024:30,2 [44] ) +Generated Location: (1371:42,2 [44] ) | Layout = "_SectionTestLayout.cshtml" | Source Location: (123:7,22 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml) |thing| -Generated Location: (1279:37,22 [5] ) +Generated Location: (1626:49,22 [5] ) |thing| Source Location: (260:15,6 [27] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml) | Func f = | -Generated Location: (1626:48,6 [27] ) +Generated Location: (1973:60,6 [27] ) | Func f = | Source Location: (295:15,41 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml) |item| -Generated Location: (1886:54,41 [4] ) +Generated Location: (2233:66,41 [4] ) |item| Source Location: (306:15,52 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml) |; | -Generated Location: (2099:61,52 [2] ) +Generated Location: (2446:73,52 [2] ) |; | diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers_DesignTime.codegen.cs index 3cbb810d65..74ba99e03f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers_DesignTime.codegen.cs @@ -9,7 +9,11 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers.cshtml" global::System.Object __typeHelper = "*, TestAssembly"; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers_DesignTime.mappings.txt index 79472b01be..b2c300d627 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (14:0,14 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers.cshtml) |*, TestAssembly| -Generated Location: (481:11,38 [15] ) +Generated Location: (573:12,38 [15] ) |*, TestAssembly| diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes_DesignTime.codegen.cs index fb63b233ff..eff8546b1d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes_DesignTime.codegen.cs @@ -9,7 +9,11 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes.cshtml" global::System.Object __typeHelper = "*, TestAssembly"; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes_DesignTime.mappings.txt index 47bfc7994d..038c4de2c6 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes_DesignTime.mappings.txt @@ -1,10 +1,10 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes.cshtml) |"*, TestAssembly"| -Generated Location: (526:11,37 [17] ) +Generated Location: (644:12,37 [17] ) |"*, TestAssembly"| Source Location: (67:3,28 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes.cshtml) |1337| -Generated Location: (1106:24,33 [4] ) +Generated Location: (1255:28,33 [4] ) |1337| diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper_DesignTime.codegen.cs index bba1ae1d82..8cb3c83fd5 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper_DesignTime.codegen.cs @@ -9,7 +9,11 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper.cshtml" global::System.Object __typeHelper = "*, TestAssembly"; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper_DesignTime.mappings.txt index 68565eaf3e..7504fcd0f3 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper_DesignTime.mappings.txt @@ -1,10 +1,10 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper.cshtml) |"*, TestAssembly"| -Generated Location: (499:11,37 [17] ) +Generated Location: (590:12,37 [17] ) |"*, TestAssembly"| Source Location: (63:2,28 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper.cshtml) |1337| -Generated Location: (1052:24,33 [4] ) +Generated Location: (1174:28,33 [4] ) |1337| diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_DesignTime.codegen.cs index e1a96c0d30..e71879b612 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_DesignTime.codegen.cs @@ -8,11 +8,19 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 86 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals.cshtml" global::System.Object WriteLiteralsToInHere = null; + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 206 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals.cshtml" global::System.Object WriteLiteralsToInHereAlso = null; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_DesignTime.mappings.txt index 894e426da0..c8aab8c008 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_DesignTime.mappings.txt @@ -1,10 +1,10 @@ Source Location: (2022:85,9 [21] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals.cshtml) |WriteLiteralsToInHere| -Generated Location: (405:10,22 [21] ) +Generated Location: (496:11,22 [21] ) |WriteLiteralsToInHere| Source Location: (5701:205,9 [25] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals.cshtml) |WriteLiteralsToInHereAlso| -Generated Location: (518:14,22 [25] ) +Generated Location: (732:19,22 [25] ) |WriteLiteralsToInHereAlso| diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes_DesignTime.codegen.cs index 2c45a0431f..245dc4718f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes_DesignTime.codegen.cs @@ -9,7 +9,11 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes.cshtml" global::System.Object __typeHelper = "*, TestAssembly"; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes_DesignTime.mappings.txt index 6538479806..dca44c7efe 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes_DesignTime.mappings.txt @@ -1,25 +1,25 @@ Source Location: (14:0,14 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes.cshtml) |*, TestAssembly| -Generated Location: (520:11,38 [15] ) +Generated Location: (617:12,38 [15] ) |*, TestAssembly| Source Location: (302:11,18 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes.cshtml) |items| -Generated Location: (1106:24,46 [5] ) +Generated Location: (1234:28,46 [5] ) |items| Source Location: (351:12,20 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes.cshtml) |items| -Generated Location: (1399:30,47 [5] ) +Generated Location: (1527:34,47 [5] ) |items| Source Location: (405:13,23 [13] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes.cshtml) |doSomething()| -Generated Location: (1688:36,43 [13] ) +Generated Location: (1816:40,43 [13] ) |doSomething()| Source Location: (487:14,24 [13] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes.cshtml) |doSomething()| -Generated Location: (1985:42,43 [13] ) +Generated Location: (2113:46,43 [13] ) |doSomething()| diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes_DesignTime.codegen.cs index f875e4d082..316e5938a7 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes_DesignTime.codegen.cs @@ -9,7 +9,11 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes.cshtml" global::System.Object __typeHelper = "*, TestAssembly"; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes_DesignTime.mappings.txt index 597eef56ac..8996c532bd 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes_DesignTime.mappings.txt @@ -1,10 +1,10 @@ Source Location: (14:0,14 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes.cshtml) |*, TestAssembly| -Generated Location: (494:11,38 [15] ) +Generated Location: (599:12,38 [15] ) |*, TestAssembly| Source Location: (57:2,18 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes.cshtml) |Hello| -Generated Location: (1025:24,18 [5] ) +Generated Location: (1161:28,18 [5] ) |Hello| diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix_DesignTime.codegen.cs index 9d9b99ec91..d578f477fc 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix_DesignTime.codegen.cs @@ -9,11 +9,19 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix.cshtml" global::System.Object __typeHelper = "*, TestAssembly"; + +#line default +#line hidden } ))(); ((System.Action)(() => { +#line 2 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix.cshtml" global::System.Object __typeHelper = "cool:"; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix_DesignTime.mappings.txt index f44871f2b6..1635962c6a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix_DesignTime.mappings.txt @@ -1,15 +1,15 @@ Source Location: (14:0,14 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix.cshtml) |*, TestAssembly| -Generated Location: (485:11,38 [15] ) +Generated Location: (581:12,38 [15] ) |*, TestAssembly| Source Location: (48:1,17 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix.cshtml) |cool:| -Generated Location: (602:15,38 [5] ) +Generated Location: (825:20,38 [5] ) |cool:| Source Location: (86:3,23 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix.cshtml) |Hello| -Generated Location: (1119:28,23 [5] ) +Generated Location: (1373:36,23 [5] ) |Hello| diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate_DesignTime.codegen.cs index 47937e15b1..431dc241e9 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate_DesignTime.codegen.cs @@ -10,7 +10,11 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate.cshtml" global::System.Object __typeHelper = "*, TestAssembly"; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate_DesignTime.mappings.txt index 7426e542d0..7c9c00360a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate_DesignTime.mappings.txt @@ -1,6 +1,6 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate.cshtml) |"*, TestAssembly"| -Generated Location: (540:12,37 [17] ) +Generated Location: (638:13,37 [17] ) |"*, TestAssembly"| Source Location: (333:12,6 [66] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate.cshtml) @@ -8,7 +8,7 @@ Source Location: (333:12,6 [66] TestFiles/IntegrationTests/CodeGenerationIntegra RenderTemplate( "Template: ", | -Generated Location: (979:24,6 [66] ) +Generated Location: (1108:28,6 [66] ) | RenderTemplate( "Template: ", @@ -16,13 +16,13 @@ Generated Location: (979:24,6 [66] ) Source Location: (427:15,40 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate.cshtml) |item| -Generated Location: (1287:33,40 [4] ) +Generated Location: (1416:37,40 [4] ) |item| Source Location: (482:15,95 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate.cshtml) |); | -Generated Location: (1703:42,95 [8] ) +Generated Location: (1832:46,95 [8] ) |); | @@ -35,7 +35,7 @@ Source Location: (47:2,12 [268] TestFiles/IntegrationTests/CodeGenerationIntegra helperResult.WriteTo(Output, HtmlEncoder); } | -Generated Location: (1974:51,12 [268] ) +Generated Location: (2103:55,12 [268] ) | public void RenderTemplate(string title, Func template) { diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_DesignTime.codegen.cs index 42a22375b7..a9bf4e007c 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_DesignTime.codegen.cs @@ -11,7 +11,11 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes.cshtml" global::System.Object __typeHelper = "*, TestAssembly"; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_DesignTime.mappings.txt index 541fbb7b28..30d7559702 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_DesignTime.mappings.txt @@ -1,20 +1,20 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes.cshtml) |"*, TestAssembly"| -Generated Location: (695:13,37 [17] ) +Generated Location: (808:14,37 [17] ) |"*, TestAssembly"| Source Location: (74:5,21 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes.cshtml) |1337| -Generated Location: (1270:26,33 [4] ) +Generated Location: (1414:30,33 [4] ) |1337| Source Location: (99:6,19 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes.cshtml) |true| -Generated Location: (1440:31,19 [4] ) +Generated Location: (1584:35,19 [4] ) |true| Source Location: (186:10,11 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes.cshtml) |1234| -Generated Location: (2076:41,33 [4] ) +Generated Location: (2220:45,33 [4] ) |1234| diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_DesignTime.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_DesignTime.codegen.cs index f4215d9483..0ad5da86f6 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_DesignTime.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_DesignTime.codegen.cs @@ -9,7 +9,11 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml" global::System.Object __typeHelper = "*, TestAssembly"; + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_DesignTime.mappings.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_DesignTime.mappings.txt index 8a511b7839..83a0f021c3 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_DesignTime.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_DesignTime.mappings.txt @@ -1,6 +1,6 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) |"*, TestAssembly"| -Generated Location: (516:11,37 [17] ) +Generated Location: (624:12,37 [17] ) |"*, TestAssembly"| Source Location: (35:1,2 [59] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) @@ -8,7 +8,7 @@ Source Location: (35:1,2 [59] TestFiles/IntegrationTests/CodeGenerationIntegrati var @class = "container-fluid"; var @int = 1; | -Generated Location: (960:23,2 [59] ) +Generated Location: (1099:27,2 [59] ) | var @class = "container-fluid"; var @int = 1; @@ -16,101 +16,101 @@ Generated Location: (960:23,2 [59] ) Source Location: (122:6,23 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) |1337| -Generated Location: (1286:31,33 [4] ) +Generated Location: (1425:35,33 [4] ) |1337| Source Location: (157:7,12 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) |@class| -Generated Location: (1539:37,12 [6] ) +Generated Location: (1678:41,12 [6] ) |@class| Source Location: (171:7,26 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) |42| -Generated Location: (1720:42,33 [2] ) +Generated Location: (1859:46,33 [2] ) |42| Source Location: (202:8,21 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) |42| -Generated Location: (1992:48,33 [2] ) +Generated Location: (2131:52,33 [2] ) |42| Source Location: (204:8,23 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) | +| -Generated Location: (1994:48,35 [2] ) +Generated Location: (2133:52,35 [2] ) | +| Source Location: (206:8,25 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) | | -Generated Location: (1996:48,37 [1] ) +Generated Location: (2135:52,37 [1] ) | | Source Location: (207:8,26 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) |@| -Generated Location: (1997:48,38 [1] ) +Generated Location: (2136:52,38 [1] ) |@| Source Location: (208:8,27 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) |int| -Generated Location: (1998:48,39 [3] ) +Generated Location: (2137:52,39 [3] ) |int| Source Location: (241:9,22 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) |int| -Generated Location: (2272:54,33 [3] ) +Generated Location: (2411:58,33 [3] ) |int| Source Location: (274:10,22 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) |(| -Generated Location: (2546:60,33 [1] ) +Generated Location: (2685:64,33 [1] ) |(| Source Location: (275:10,23 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) |@int| -Generated Location: (2547:60,34 [4] ) +Generated Location: (2686:64,34 [4] ) |@int| Source Location: (279:10,27 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) |)| -Generated Location: (2551:60,38 [1] ) +Generated Location: (2690:64,38 [1] ) |)| Source Location: (307:11,19 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) |@class| -Generated Location: (2809:66,19 [6] ) +Generated Location: (2948:70,19 [6] ) |@class| Source Location: (321:11,33 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) |4| -Generated Location: (2991:71,33 [1] ) +Generated Location: (3130:75,33 [1] ) |4| Source Location: (322:11,34 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) | *| -Generated Location: (2992:71,34 [2] ) +Generated Location: (3131:75,34 [2] ) | *| Source Location: (324:11,36 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) | | -Generated Location: (2994:71,36 [1] ) +Generated Location: (3133:75,36 [1] ) | | Source Location: (325:11,37 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) |@| -Generated Location: (2995:71,37 [1] ) +Generated Location: (3134:75,37 [1] ) |@| Source Location: (326:11,38 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) |(| -Generated Location: (2996:71,38 [1] ) +Generated Location: (3135:75,38 [1] ) |(| Source Location: (327:11,39 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) |@int + 2| -Generated Location: (2997:71,39 [8] ) +Generated Location: (3136:75,39 [8] ) |@int + 2| Source Location: (335:11,47 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) |)| -Generated Location: (3005:71,47 [1] ) +Generated Location: (3144:75,47 [1] ) |)| diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/ExtensibleDirectiveTest/NamespaceToken.codegen.cs b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/ExtensibleDirectiveTest/NamespaceToken.codegen.cs index c50a6894ab..12dac56726 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/ExtensibleDirectiveTest/NamespaceToken.codegen.cs +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/ExtensibleDirectiveTest/NamespaceToken.codegen.cs @@ -8,7 +8,11 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests.TestFiles #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((System.Action)(() => { +#line 1 "TestFiles/IntegrationTests/ExtensibleDirectiveTest/NamespaceToken.cshtml" global::System.Object __typeHelper = nameof(System.Globalization); + +#line default +#line hidden } ))(); } diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/ExtensibleDirectiveTest/NamespaceToken.mappings.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/ExtensibleDirectiveTest/NamespaceToken.mappings.txt index c0b79c2c79..d292ce87db 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/ExtensibleDirectiveTest/NamespaceToken.mappings.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/IntegrationTests/ExtensibleDirectiveTest/NamespaceToken.mappings.txt @@ -1,5 +1,5 @@ Source Location: (8:0,8 [20] TestFiles/IntegrationTests/ExtensibleDirectiveTest/NamespaceToken.cshtml) |System.Globalization| -Generated Location: (410:10,44 [20] ) +Generated Location: (494:11,44 [20] ) |System.Globalization| diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/FunctionsDirectiveAutoCompleteAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/FunctionsDirectiveAutoCompleteAtEOF.stree.txt index 4d7733a74b..96c1e627ca 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/FunctionsDirectiveAutoCompleteAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/FunctionsDirectiveAutoCompleteAtEOF.stree.txt @@ -1,9 +1,9 @@ Directive block - Gen - 11 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [functions] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[functions]; + SyntaxKind.Identifier;[functions]; MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd - (10:0,10) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Code span - Gen - [] - CodeBlockEditHandler;Accepts:Any;CodeBlock - (11:0,11) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/FunctionsDirectiveAutoCompleteAtStartOfFile.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/FunctionsDirectiveAutoCompleteAtStartOfFile.stree.txt index 18a654401d..62f1357ad5 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/FunctionsDirectiveAutoCompleteAtStartOfFile.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/FunctionsDirectiveAutoCompleteAtStartOfFile.stree.txt @@ -1,10 +1,10 @@ Directive block - Gen - 16 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [functions] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[functions]; + SyntaxKind.Identifier;[functions]; MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd - (10:0,10) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Code span - Gen - [LFfoo] - CodeBlockEditHandler;Accepts:Any;CodeBlock - (11:0,11) - Tokens:2 - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.Identifier;[foo]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Identifier;[foo]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/SectionDirectiveAutoCompleteAtEOF.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/SectionDirectiveAutoCompleteAtEOF.cspans.txt index a7489e366c..effd398972 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/SectionDirectiveAutoCompleteAtEOF.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/SectionDirectiveAutoCompleteAtEOF.cspans.txt @@ -1,7 +1,7 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [17] ) MetaCode span at (1:0,1 [7] ) (Accepts:None) - Parent: Directive block at (0:0,0 [17] ) -Code span at (8:0,8 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [17] ) -Code span at (9:0,9 [6] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [17] ) -Markup span at (15:0,15 [1] ) (Accepts:AllWhiteSpace) - Parent: Directive block at (0:0,0 [17] ) +Code span at (8:0,8 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [17] ) +Code span at (9:0,9 [6] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [17] ) +Markup span at (15:0,15 [1] ) (Accepts:AllWhitespace) - Parent: Directive block at (0:0,0 [17] ) MetaCode span at (16:0,16 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [17] ) Markup span at (17:0,17 [0] ) (Accepts:Any) - Parent: Markup block at (17:0,17 [0] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/SectionDirectiveAutoCompleteAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/SectionDirectiveAutoCompleteAtEOF.stree.txt index 25e7638666..1a861c9f17 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/SectionDirectiveAutoCompleteAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/SectionDirectiveAutoCompleteAtEOF.stree.txt @@ -1,16 +1,16 @@ Directive block - Gen - 17 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [Header] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[Header]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (15:0,15) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Identifier;[section]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [Header] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 + SyntaxKind.Identifier;[Header]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (15:0,15) - Tokens:1 + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd - (16:0,16) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 0 - (17:0,17) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (17:0,17) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/SectionDirectiveAutoCompleteAtStartOfFile.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/SectionDirectiveAutoCompleteAtStartOfFile.cspans.txt index 94d6f8ac64..51148275b8 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/SectionDirectiveAutoCompleteAtStartOfFile.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/SectionDirectiveAutoCompleteAtStartOfFile.cspans.txt @@ -1,8 +1,8 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [29] ) MetaCode span at (1:0,1 [7] ) (Accepts:None) - Parent: Directive block at (0:0,0 [29] ) -Code span at (8:0,8 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [29] ) -Code span at (9:0,9 [6] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [29] ) -Markup span at (15:0,15 [1] ) (Accepts:AllWhiteSpace) - Parent: Directive block at (0:0,0 [29] ) +Code span at (8:0,8 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [29] ) +Code span at (9:0,9 [6] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [29] ) +Markup span at (15:0,15 [1] ) (Accepts:AllWhitespace) - Parent: Directive block at (0:0,0 [29] ) MetaCode span at (16:0,16 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [29] ) Markup span at (17:0,17 [2] ) (Accepts:Any) - Parent: Markup block at (17:0,17 [12] ) Markup span at (19:1,0 [3] ) (Accepts:Any) - Parent: Tag block at (19:1,0 [3] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/SectionDirectiveAutoCompleteAtStartOfFile.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/SectionDirectiveAutoCompleteAtStartOfFile.stree.txt index cab4006af3..71141a41bb 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/SectionDirectiveAutoCompleteAtStartOfFile.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/SectionDirectiveAutoCompleteAtStartOfFile.stree.txt @@ -1,29 +1,29 @@ Directive block - Gen - 29 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [Header] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[Header]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (15:0,15) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Identifier;[section]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [Header] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 + SyntaxKind.Identifier;[Header]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (15:0,15) - Tokens:1 + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd - (16:0,16) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 12 - (17:0,17) Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (17:0,17) - Tokens:1 - HtmlTokenType.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; Tag block - Gen - 3 - (19:1,0) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (19:1,0) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [Foo] - SpanEditHandler;Accepts:Any - (22:1,3) - Tokens:1 - HtmlTokenType.Text;[Foo]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; + SyntaxKind.HtmlTextLiteral - [Foo] - [22..25) - FullWidth: 3 - Slots: 1 + SyntaxKind.Text;[Foo]; Tag block - Gen - 4 - (25:1,6) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (25:1,6) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/VerbatimBlockAutoCompleteAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/VerbatimBlockAutoCompleteAtEOF.stree.txt index 5c1bcb1c4a..b2da8414ab 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/VerbatimBlockAutoCompleteAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/VerbatimBlockAutoCompleteAtEOF.stree.txt @@ -1,7 +1,7 @@ Statement block - Gen - 2 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Code span - Gen - [] - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[}];AtEOL - (2:0,2) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/VerbatimBlockAutoCompleteAtStartOfFile.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/VerbatimBlockAutoCompleteAtStartOfFile.stree.txt index 9be89463a8..928cc26ae4 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/VerbatimBlockAutoCompleteAtStartOfFile.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpAutoCompleteTest/VerbatimBlockAutoCompleteAtStartOfFile.stree.txt @@ -1,21 +1,21 @@ Statement block - Gen - 11 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Code span - Gen - [LF] - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[}];AtEOL - (2:0,2) - Tokens:1 - CSharpTokenType.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; Markup block - Gen - 7 - (4:1,0) Tag block - Gen - 3 - (4:1,0) Markup span - Gen - [

] - SpanEditHandler;Accepts:None - (4:1,0) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Tag block - Gen - 4 - (7:1,3) Markup span - Gen - [

] - SpanEditHandler;Accepts:None - (7:1,3) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Code span - Gen - [] - SpanEditHandler;Accepts:Any - (11:1,7) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/AcceptsElseIfWithNoCondition.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/AcceptsElseIfWithNoCondition.stree.txt index 7b74209f11..868839ebf6 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/AcceptsElseIfWithNoCondition.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/AcceptsElseIfWithNoCondition.stree.txt @@ -1,60 +1,60 @@ Statement block - Gen - 106 - (0:0,0) Code span - Gen - [if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"foo } bar");LF} else if { foo(); }] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:58 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[int]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[0]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LessThan;[<]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[10]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.StringLiteral;["baz"]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Debug]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[WriteLine]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.StringLiteral;[@"foo } bar"]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[else]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[int]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[0]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LessThan;[<]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[10]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.StringLiteral;["baz"]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Debug]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[WriteLine]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.StringLiteral;[@"foo } bar"]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[else]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/AcceptsTrailingDotIntoImplicitExpressionWhenEmbeddedInCode.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/AcceptsTrailingDotIntoImplicitExpressionWhenEmbeddedInCode.cspans.txt index f0caa5ab82..0726da8853 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/AcceptsTrailingDotIntoImplicitExpressionWhenEmbeddedInCode.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/AcceptsTrailingDotIntoImplicitExpressionWhenEmbeddedInCode.cspans.txt @@ -1,4 +1,4 @@ Code span at (0:0,0 [10] ) (Accepts:Any) - Parent: Statement block at (0:0,0 [17] ) Transition span at (10:0,10 [1] ) (Accepts:None) - Parent: Expression block at (10:0,10 [5] ) -Code span at (11:0,11 [4] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (10:0,10 [5] ) +Code span at (11:0,11 [4] ) (Accepts:NonWhitespace) - Parent: Expression block at (10:0,10 [5] ) Code span at (15:0,15 [2] ) (Accepts:Any) - Parent: Statement block at (0:0,0 [17] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/AcceptsTrailingDotIntoImplicitExpressionWhenEmbeddedInCode.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/AcceptsTrailingDotIntoImplicitExpressionWhenEmbeddedInCode.stree.txt index a32c45341c..da0e4e5684 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/AcceptsTrailingDotIntoImplicitExpressionWhenEmbeddedInCode.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/AcceptsTrailingDotIntoImplicitExpressionWhenEmbeddedInCode.stree.txt @@ -1,18 +1,18 @@ Statement block - Gen - 17 - (0:0,0) Code span - Gen - [if(foo) { ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:7 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; Expression block - Gen - 5 - (10:0,10) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (10:0,10) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [foo.] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[ATD];K14 - (11:0,11) - Tokens:2 - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.Dot;[.]; + SyntaxKind.Transition;[@]; + Code span - Gen - [foo.] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[ATD];K14 - (11:0,11) - Tokens:2 + SyntaxKind.Identifier;[foo]; + SyntaxKind.Dot;[.]; Code span - Gen - [ }] - SpanEditHandler;Accepts:Any - (15:0,15) - Tokens:2 - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/AllowsEmptyBlockStatement.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/AllowsEmptyBlockStatement.stree.txt index 78000ba7a0..e52cb3277b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/AllowsEmptyBlockStatement.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/AllowsEmptyBlockStatement.stree.txt @@ -1,10 +1,10 @@ Statement block - Gen - 13 - (0:0,0) Code span - Gen - [if(false) { }] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:8 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[false]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[false]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/BalancingBracketsIgnoresStringLiteralCharactersAndBrackets.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/BalancingBracketsIgnoresStringLiteralCharactersAndBrackets.stree.txt index e2a2903cf4..6fa6c5ed36 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/BalancingBracketsIgnoresStringLiteralCharactersAndBrackets.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/BalancingBracketsIgnoresStringLiteralCharactersAndBrackets.stree.txt @@ -1,19 +1,19 @@ Statement block - Gen - 47 - (0:0,0) Code span - Gen - [if(foo) {LF // bar } " baz 'LF zoop();LF}] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:17 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Comment;[// bar } " baz ']; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[zoop]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.CSharpComment;[// bar } " baz ']; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[zoop]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/BalancingBracketsIgnoresStringLiteralCharactersAndBracketsInsideBlockComments.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/BalancingBracketsIgnoresStringLiteralCharactersAndBracketsInsideBlockComments.stree.txt index f9d3e2b176..7d34a81381 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/BalancingBracketsIgnoresStringLiteralCharactersAndBracketsInsideBlockComments.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/BalancingBracketsIgnoresStringLiteralCharactersAndBracketsInsideBlockComments.stree.txt @@ -1,21 +1,21 @@ Statement block - Gen - 54 - (0:0,0) Code span - Gen - [if(foo) {LF /* bar } " */ ' baz } 'LF zoop();LF}] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:19 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Comment;[/* bar } " */]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.CharacterLiteral;[' baz } ']; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[zoop]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.CSharpComment;[/* bar } " */]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.CharacterLiteral;[' baz } ']; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[zoop]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CapturesNewlineAfterUsing.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CapturesNewlineAfterUsing.stree.txt index 4f557730af..6b754ce0a0 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CapturesNewlineAfterUsing.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CapturesNewlineAfterUsing.stree.txt @@ -1,6 +1,6 @@ Directive block - Gen - 11 - (0:0,0) Code span - Gen - [using FooLF] - SpanEditHandler;Accepts:AnyExceptNewline - (0:0,0) - Tokens:4 - CSharpTokenType.Keyword;[using]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.NewLine;[LF]; + SyntaxKind.Keyword;[using]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.NewLine;[LF]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlock.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlock.stree.txt index b30314d849..ead956f330 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlock.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlock.stree.txt @@ -1,26 +1,26 @@ Statement block - Gen - 40 - (0:0,0) Code span - Gen - [do { var foo = bar; } while(foo != bar);] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:24 - CSharpTokenType.Keyword;[do]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[while]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.NotEqual;[!=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; + SyntaxKind.Keyword;[do]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[while]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.NotEqual;[!=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlockMissingSemicolon.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlockMissingSemicolon.stree.txt index ca898906ac..e7b6d30e06 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlockMissingSemicolon.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlockMissingSemicolon.stree.txt @@ -1,25 +1,25 @@ Statement block - Gen - 39 - (0:0,0) Code span - Gen - [do { var foo = bar; } while(foo != bar)] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:23 - CSharpTokenType.Keyword;[do]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[while]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.NotEqual;[!=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.RightParenthesis;[)]; + SyntaxKind.Keyword;[do]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[while]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.NotEqual;[!=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlockMissingWhileClauseEntirely.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlockMissingWhileClauseEntirely.stree.txt index ba8d12a4e0..45a35ab1d6 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlockMissingWhileClauseEntirely.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlockMissingWhileClauseEntirely.stree.txt @@ -1,16 +1,16 @@ Statement block - Gen - 21 - (0:0,0) Code span - Gen - [do { var foo = bar; }] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:14 - CSharpTokenType.Keyword;[do]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[do]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlockMissingWhileCondition.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlockMissingWhileCondition.stree.txt index f5ab356933..acc83fbd92 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlockMissingWhileCondition.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlockMissingWhileCondition.stree.txt @@ -1,18 +1,18 @@ Statement block - Gen - 27 - (0:0,0) Code span - Gen - [do { var foo = bar; } while] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:16 - CSharpTokenType.Keyword;[do]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[while]; + SyntaxKind.Keyword;[do]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[while]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlockMissingWhileConditionWithSemicolon.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlockMissingWhileConditionWithSemicolon.stree.txt index e93c870c6f..84dbbd25a4 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlockMissingWhileConditionWithSemicolon.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesDoWhileBlockMissingWhileConditionWithSemicolon.stree.txt @@ -1,19 +1,19 @@ Statement block - Gen - 28 - (0:0,0) Code span - Gen - [do { var foo = bar; } while;] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:17 - CSharpTokenType.Keyword;[do]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[while]; - CSharpTokenType.Semicolon;[;]; + SyntaxKind.Keyword;[do]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[while]; + SyntaxKind.Semicolon;[;]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesMarkupInDoWhileBlock.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesMarkupInDoWhileBlock.stree.txt index ea36eb7e97..ea31ba7107 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesMarkupInDoWhileBlock.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/CorrectlyParsesMarkupInDoWhileBlock.stree.txt @@ -1,50 +1,50 @@ Statement block - Gen - 58 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [do { var foo = bar;] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:12 - CSharpTokenType.Keyword;[do]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.Semicolon;[;]; + SyntaxKind.Keyword;[do]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.Semicolon;[;]; Markup block - Gen - 12 - (20:0,20) Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (20:0,20) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 3 - (21:0,21) Markup span - Gen - [

] - SpanEditHandler;Accepts:None - (21:0,21) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [Foo] - SpanEditHandler;Accepts:Any - (24:0,24) - Tokens:1 - HtmlTokenType.Text;[Foo]; + SyntaxKind.Text;[Foo]; Tag block - Gen - 4 - (27:0,27) Markup span - Gen - [

] - SpanEditHandler;Accepts:None - (27:0,27) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (31:0,31) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [foo++; } while (foo);] - SpanEditHandler;Accepts:None - (32:0,32) - Tokens:15 - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.Increment;[++]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[while]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.LessThan;[<]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.GreaterThan;[>]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Increment;[++]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[while]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.LessThan;[<]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.GreaterThan;[>]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/DoesNotAllowMultipleFinallyBlocks.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/DoesNotAllowMultipleFinallyBlocks.stree.txt index c9a0cb5fa2..8ae4de426a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/DoesNotAllowMultipleFinallyBlocks.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/DoesNotAllowMultipleFinallyBlocks.stree.txt @@ -1,37 +1,37 @@ Statement block - Gen - 55 - (0:0,0) Code span - Gen - [try { var foo = new { } } finally { var foo = new { } }] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:35 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[finally]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[try]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[finally]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/DoesNotParseOnSwitchCharacterNotFollowedByOpenAngleOrColon.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/DoesNotParseOnSwitchCharacterNotFollowedByOpenAngleOrColon.stree.txt index 7eb0dd4ec7..a2187f4354 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/DoesNotParseOnSwitchCharacterNotFollowedByOpenAngleOrColon.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/DoesNotParseOnSwitchCharacterNotFollowedByOpenAngleOrColon.stree.txt @@ -1,17 +1,17 @@ Statement block - Gen - 30 - (0:0,0) Code span - Gen - [if(foo) { @"Foo".ToString(); }] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:15 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.StringLiteral;[@"Foo"]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[ToString]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.StringLiteral;[@"Foo"]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[ToString]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/DoesntCaptureWhitespaceAfterUsing.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/DoesntCaptureWhitespaceAfterUsing.stree.txt index 5c5013b233..955f9551aa 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/DoesntCaptureWhitespaceAfterUsing.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/DoesntCaptureWhitespaceAfterUsing.stree.txt @@ -1,5 +1,5 @@ Directive block - Gen - 9 - (0:0,0) Code span - Gen - [using Foo] - SpanEditHandler;Accepts:AnyExceptNewline - (0:0,0) - Tokens:3 - CSharpTokenType.Keyword;[using]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Foo]; + SyntaxKind.Keyword;[using]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Foo]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/HasErrorsIfNamespaceAliasMissingSemicolon.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/HasErrorsIfNamespaceAliasMissingSemicolon.stree.txt index ceb649cba3..d2ea231421 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/HasErrorsIfNamespaceAliasMissingSemicolon.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/HasErrorsIfNamespaceAliasMissingSemicolon.stree.txt @@ -1,13 +1,13 @@ Directive block - Gen - 29 - (0:0,0) Code span - Gen - [using Foo.Bar.Baz = FooBarBaz] - SpanEditHandler;Accepts:AnyExceptNewline - (0:0,0) - Tokens:11 - CSharpTokenType.Keyword;[using]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Baz]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[FooBarBaz]; + SyntaxKind.Keyword;[using]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Baz]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[FooBarBaz]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/HasErrorsIfNamespaceImportMissingSemicolon.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/HasErrorsIfNamespaceImportMissingSemicolon.stree.txt index 0e214796db..92f8d6a426 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/HasErrorsIfNamespaceImportMissingSemicolon.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/HasErrorsIfNamespaceImportMissingSemicolon.stree.txt @@ -1,9 +1,9 @@ Directive block - Gen - 17 - (0:0,0) Code span - Gen - [using Foo.Bar.Baz] - SpanEditHandler;Accepts:AnyExceptNewline - (0:0,0) - Tokens:7 - CSharpTokenType.Keyword;[using]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Baz]; + SyntaxKind.Keyword;[using]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Baz]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/NestedCodeBlockWithAtDoesntCauseError.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/NestedCodeBlockWithAtDoesntCauseError.stree.txt index f0d580e422..88eb4a4448 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/NestedCodeBlockWithAtDoesntCauseError.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/NestedCodeBlockWithAtDoesntCauseError.stree.txt @@ -1,25 +1,25 @@ Statement block - Gen - 28 - (0:0,0) Code span - Gen - [if (true) { ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:8 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[true]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[true]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; Statement block - Gen - 14 - (12:0,12) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (12:0,12) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [if(false) { }] - SpanEditHandler;Accepts:Any - (13:0,13) - Tokens:8 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[false]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[false]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; Code span - Gen - [ }] - SpanEditHandler;Accepts:Any - (26:0,26) - Tokens:2 - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/NestedCodeBlockWithCSharpAt.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/NestedCodeBlockWithCSharpAt.stree.txt index 80065e6122..4d2b182664 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/NestedCodeBlockWithCSharpAt.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/NestedCodeBlockWithCSharpAt.stree.txt @@ -1,41 +1,41 @@ Statement block - Gen - 49 - (0:0,0) MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Code span - Gen - [ if (true) { var val = @x; if (val != 3) { } } ] - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[];AtEOL - (1:0,1) - Tokens:35 - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[true]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[val]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Transition;[@]; - CSharpTokenType.Identifier;[x]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[val]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.NotEqual;[!=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[3]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[true]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[val]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Transition;[@]; + SyntaxKind.Identifier;[x]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[val]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.NotEqual;[!=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[3]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (48:0,48) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/NestedCodeBlockWithMarkupSetsDotAsMarkup.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/NestedCodeBlockWithMarkupSetsDotAsMarkup.cspans.txt index 1836f2b2e5..6cca837187 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/NestedCodeBlockWithMarkupSetsDotAsMarkup.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/NestedCodeBlockWithMarkupSetsDotAsMarkup.cspans.txt @@ -5,7 +5,7 @@ Markup span at (24:0,24 [1] ) (Accepts:Any) - Parent: Markup block at (24:0,24 [ Markup span at (25:0,25 [5] ) (Accepts:None) - Parent: Tag block at (25:0,25 [5] ) Markup span at (30:0,30 [0] ) (Accepts:Any) - Parent: Markup block at (24:0,24 [24] ) Transition span at (30:0,30 [1] ) (Accepts:None) - Parent: Expression block at (30:0,30 [10] ) -Code span at (31:0,31 [9] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (30:0,30 [10] ) +Code span at (31:0,31 [9] ) (Accepts:NonWhitespace) - Parent: Expression block at (30:0,30 [10] ) Markup span at (40:0,40 [1] ) (Accepts:Any) - Parent: Markup block at (24:0,24 [24] ) Markup span at (41:0,41 [6] ) (Accepts:None) - Parent: Tag block at (41:0,41 [6] ) Markup span at (47:0,47 [1] ) (Accepts:None) - Parent: Markup block at (24:0,24 [24] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/NestedCodeBlockWithMarkupSetsDotAsMarkup.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/NestedCodeBlockWithMarkupSetsDotAsMarkup.stree.txt index 28fa9d02af..faaeb88e72 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/NestedCodeBlockWithMarkupSetsDotAsMarkup.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/NestedCodeBlockWithMarkupSetsDotAsMarkup.stree.txt @@ -1,50 +1,50 @@ Statement block - Gen - 51 - (0:0,0) Code span - Gen - [if (true) { ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:8 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[true]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[true]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; Statement block - Gen - 37 - (12:0,12) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (12:0,12) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [if(false) {] - SpanEditHandler;Accepts:Any - (13:0,13) - Tokens:6 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[false]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[false]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 24 - (24:0,24) Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (24:0,24) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 5 - (25:0,25) Markup span - Gen - [
] - SpanEditHandler;Accepts:None - (25:0,25) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[div]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[div]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (30:0,30) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Expression block - Gen - 10 - (30:0,30) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (30:0,30) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [something] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (31:0,31) - Tokens:1 - CSharpTokenType.Identifier;[something]; + SyntaxKind.Transition;[@]; + Code span - Gen - [something] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (31:0,31) - Tokens:1 + SyntaxKind.Identifier;[something]; Markup span - Gen - [.] - SpanEditHandler;Accepts:Any - (40:0,40) - Tokens:1 - HtmlTokenType.Text;[.]; + SyntaxKind.Text;[.]; Tag block - Gen - 6 - (41:0,41) Markup span - Gen - [
] - SpanEditHandler;Accepts:None - (41:0,41) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[div]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[div]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (47:0,47) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [}] - SpanEditHandler;Accepts:Any - (48:0,48) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; Code span - Gen - [ }] - SpanEditHandler;Accepts:Any - (49:0,49) - Tokens:2 - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsersCanNestRecursively.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsersCanNestRecursively.cspans.txt index b7f50cae33..be60b063cc 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsersCanNestRecursively.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsersCanNestRecursively.cspans.txt @@ -5,7 +5,7 @@ Markup span at (52:1,17 [18] ) (Accepts:Any) - Parent: Markup block at (35:1,0 [ Markup span at (70:2,16 [4] ) (Accepts:None) - Parent: Tag block at (70:2,16 [4] ) Markup span at (74:2,20 [0] ) (Accepts:Any) - Parent: Markup block at (35:1,0 [307] ) Transition span at (74:2,20 [1] ) (Accepts:None) - Parent: Expression block at (74:2,20 [7] ) -Code span at (75:2,21 [6] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (74:2,20 [7] ) +Code span at (75:2,21 [6] ) (Accepts:NonWhitespace) - Parent: Expression block at (74:2,20 [7] ) Markup span at (81:2,27 [5] ) (Accepts:None) - Parent: Tag block at (81:2,27 [5] ) Markup span at (86:2,32 [18] ) (Accepts:Any) - Parent: Markup block at (35:1,0 [307] ) Markup span at (104:3,16 [4] ) (Accepts:None) - Parent: Tag block at (104:3,16 [4] ) @@ -18,12 +18,12 @@ Markup span at (187:5,24 [4] ) (Accepts:None) - Parent: Tag block at (187:5,24 [ Markup span at (191:5,28 [2] ) (Accepts:Any) - Parent: Tag block at (191:5,28 [67] ) Markup span at (193:5,30 [7] ) (Accepts:Any) - Parent: Markup block at (193:5,30 [64] ) Transition span at (200:5,37 [1] ) (Accepts:None) - Parent: Expression block at (200:5,37 [56] ) -Code span at (201:5,38 [55] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (200:5,37 [56] ) +Code span at (201:5,38 [55] ) (Accepts:NonWhitespace) - Parent: Expression block at (200:5,37 [56] ) Markup span at (256:5,93 [1] ) (Accepts:Any) - Parent: Markup block at (193:5,30 [64] ) Markup span at (257:5,94 [1] ) (Accepts:None) - Parent: Tag block at (191:5,28 [67] ) Markup span at (258:5,95 [0] ) (Accepts:Any) - Parent: Markup block at (163:5,0 [113] ) Transition span at (258:5,95 [1] ) (Accepts:None) - Parent: Expression block at (258:5,95 [7] ) -Code span at (259:5,96 [6] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (258:5,95 [7] ) +Code span at (259:5,96 [6] ) (Accepts:NonWhitespace) - Parent: Expression block at (258:5,95 [7] ) Markup span at (265:5,102 [4] ) (Accepts:None) - Parent: Tag block at (265:5,102 [4] ) Markup span at (269:5,106 [5] ) (Accepts:None) - Parent: Tag block at (269:5,106 [5] ) Markup span at (274:5,111 [2] ) (Accepts:None) - Parent: Markup block at (163:5,0 [113] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsersCanNestRecursively.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsersCanNestRecursively.stree.txt index 13ca10275e..a8cf933519 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsersCanNestRecursively.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsersCanNestRecursively.stree.txt @@ -1,179 +1,179 @@ Statement block - Gen - 351 - (0:0,0) Code span - Gen - [foreach(var c in db.Categories) {LF] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:15 - CSharpTokenType.Keyword;[foreach]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[c]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[in]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[db]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Categories]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.NewLine;[LF]; + SyntaxKind.Keyword;[foreach]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[c]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[in]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[db]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Categories]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.NewLine;[LF]; Markup block - Gen - 307 - (35:1,0) Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (35:1,0) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 5 - (47:1,12) Markup span - Gen - [
] - SpanEditHandler;Accepts:None - (47:1,12) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[div]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[div]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [LF ] - SpanEditHandler;Accepts:Any - (52:1,17) - Tokens:2 - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 4 - (70:2,16) Markup span - Gen - [

] - SpanEditHandler;Accepts:None - (70:2,16) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[h1]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[h1]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (74:2,20) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Expression block - Gen - 7 - (74:2,20) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (74:2,20) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [c.Name] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (75:2,21) - Tokens:3 - CSharpTokenType.Identifier;[c]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Name]; + SyntaxKind.Transition;[@]; + Code span - Gen - [c.Name] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (75:2,21) - Tokens:3 + SyntaxKind.Identifier;[c]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Name]; Tag block - Gen - 5 - (81:2,27) Markup span - Gen - [

] - SpanEditHandler;Accepts:None - (81:2,27) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[h1]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[h1]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [LF ] - SpanEditHandler;Accepts:Any - (86:2,32) - Tokens:2 - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 4 - (104:3,16) Markup span - Gen - [
    ] - SpanEditHandler;Accepts:None - (104:3,16) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[ul]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[ul]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (108:3,20) - Tokens:1 - HtmlTokenType.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; Statement block - Gen - 189 - (110:4,0) Code span - Gen - [ ] - SpanEditHandler;Accepts:Any - (110:4,0) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (130:4,20) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [foreach(var p in c.Products) {LF] - SpanEditHandler;Accepts:Any - (131:4,21) - Tokens:15 - CSharpTokenType.Keyword;[foreach]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[p]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[in]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[c]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Products]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.NewLine;[LF]; + SyntaxKind.Keyword;[foreach]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[p]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[in]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[c]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Products]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.NewLine;[LF]; Markup block - Gen - 113 - (163:5,0) Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (163:5,0) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 4 - (187:5,24) Markup span - Gen - [
  • ] - SpanEditHandler;Accepts:None - (187:5,24) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[li]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[li]; + SyntaxKind.CloseAngle;[>]; Tag block - Gen - 67 - (191:5,28) Markup span - Gen - [ - 64 - (193:5,30) Markup span - Gen - [ href="] - SpanEditHandler;Accepts:Any - (193:5,30) - Tokens:4 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[href]; - HtmlTokenType.Equals;[=]; - HtmlTokenType.DoubleQuote;["]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[href]; + SyntaxKind.Equals;[=]; + SyntaxKind.DoubleQuote;["]; Markup block - Gen - 56 - (200:5,37) Expression block - Gen - 56 - (200:5,37) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (200:5,37) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [Html.ActionUrl("Products", "Detail", new { id = p.Id })] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (201:5,38) - Tokens:24 - CSharpTokenType.Identifier;[Html]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[ActionUrl]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.StringLiteral;["Products"]; - CSharpTokenType.Comma;[,]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.StringLiteral;["Detail"]; - CSharpTokenType.Comma;[,]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[id]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[p]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Id]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.RightParenthesis;[)]; + SyntaxKind.Transition;[@]; + Code span - Gen - [Html.ActionUrl("Products", "Detail", new { id = p.Id })] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (201:5,38) - Tokens:24 + SyntaxKind.Identifier;[Html]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[ActionUrl]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.StringLiteral;["Products"]; + SyntaxKind.Comma;[,]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.StringLiteral;["Detail"]; + SyntaxKind.Comma;[,]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[id]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[p]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Id]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.RightParenthesis;[)]; Markup span - Gen - ["] - SpanEditHandler;Accepts:Any - (256:5,93) - Tokens:1 - HtmlTokenType.DoubleQuote;["]; + SyntaxKind.DoubleQuote;["]; Markup span - Gen - [>] - SpanEditHandler;Accepts:None - (257:5,94) - Tokens:1 - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (258:5,95) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Expression block - Gen - 7 - (258:5,95) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (258:5,95) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [p.Name] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (259:5,96) - Tokens:3 - CSharpTokenType.Identifier;[p]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Name]; + SyntaxKind.Transition;[@]; + Code span - Gen - [p.Name] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (259:5,96) - Tokens:3 + SyntaxKind.Identifier;[p]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Name]; Tag block - Gen - 4 - (265:5,102) Markup span - Gen - [] - SpanEditHandler;Accepts:None - (265:5,102) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[a]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[a]; + SyntaxKind.CloseAngle;[>]; Tag block - Gen - 5 - (269:5,106) Markup span - Gen - [
  • ] - SpanEditHandler;Accepts:None - (269:5,106) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[li]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[li]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [LF] - SpanEditHandler;Accepts:None - (274:5,111) - Tokens:1 - HtmlTokenType.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; Code span - Gen - [ }LF] - SpanEditHandler;Accepts:None - (276:6,0) - Tokens:3 - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.NewLine;[LF]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (299:7,0) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 5 - (315:7,16) Markup span - Gen - [
] - SpanEditHandler;Accepts:None - (315:7,16) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[ul]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[ul]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [LF ] - SpanEditHandler;Accepts:Any - (320:7,21) - Tokens:2 - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 6 - (334:8,12) Markup span - Gen - [
] - SpanEditHandler;Accepts:None - (334:8,12) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[div]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[div]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [LF] - SpanEditHandler;Accepts:None - (340:8,18) - Tokens:1 - HtmlTokenType.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; Code span - Gen - [ }] - SpanEditHandler;Accepts:None - (342:9,0) - Tokens:2 - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesElseIfBranchesOfIfStatement.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesElseIfBranchesOfIfStatement.stree.txt index 5563401047..c86d52c614 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesElseIfBranchesOfIfStatement.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesElseIfBranchesOfIfStatement.stree.txt @@ -1,95 +1,95 @@ Statement block - Gen - 180 - (0:0,0) Code span - Gen - [if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"foo } bar");LF} else if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"bar } baz");LF}] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:93 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[int]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[0]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LessThan;[<]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[10]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.StringLiteral;["baz"]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Debug]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[WriteLine]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.StringLiteral;[@"foo } bar"]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[else]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[int]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[0]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LessThan;[<]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[10]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.StringLiteral;["baz"]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Debug]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[WriteLine]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.StringLiteral;[@"bar } baz"]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[int]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[0]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LessThan;[<]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[10]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.StringLiteral;["baz"]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Debug]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[WriteLine]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.StringLiteral;[@"foo } bar"]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[else]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[int]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[0]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LessThan;[<]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[10]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.StringLiteral;["baz"]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Debug]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[WriteLine]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.StringLiteral;[@"bar } baz"]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesExpressionOnSwitchCharacterFollowedByIdentifierStart.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesExpressionOnSwitchCharacterFollowedByIdentifierStart.cspans.txt index 2295e35eba..23578b778f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesExpressionOnSwitchCharacterFollowedByIdentifierStart.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesExpressionOnSwitchCharacterFollowedByIdentifierStart.cspans.txt @@ -1,4 +1,4 @@ Code span at (0:0,0 [10] ) (Accepts:Any) - Parent: Statement block at (0:0,0 [25] ) Transition span at (10:0,10 [1] ) (Accepts:None) - Parent: Expression block at (10:0,10 [13] ) -Code span at (11:0,11 [12] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (10:0,10 [13] ) +Code span at (11:0,11 [12] ) (Accepts:NonWhitespace) - Parent: Expression block at (10:0,10 [13] ) Code span at (23:0,23 [2] ) (Accepts:Any) - Parent: Statement block at (0:0,0 [25] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesExpressionOnSwitchCharacterFollowedByIdentifierStart.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesExpressionOnSwitchCharacterFollowedByIdentifierStart.stree.txt index 45b2fc09d2..7e1f4a4855 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesExpressionOnSwitchCharacterFollowedByIdentifierStart.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesExpressionOnSwitchCharacterFollowedByIdentifierStart.stree.txt @@ -1,24 +1,24 @@ Statement block - Gen - 25 - (0:0,0) Code span - Gen - [if(foo) { ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:7 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; Expression block - Gen - 13 - (10:0,10) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (10:0,10) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [foo[4].bar()] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[ATD];K14 - (11:0,11) - Tokens:8 - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.LeftBracket;[[]; - CSharpTokenType.IntegerLiteral;[4]; - CSharpTokenType.RightBracket;[]]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; + SyntaxKind.Transition;[@]; + Code span - Gen - [foo[4].bar()] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[ATD];K14 - (11:0,11) - Tokens:8 + SyntaxKind.Identifier;[foo]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.IntegerLiteral;[4]; + SyntaxKind.RightBracket;[]]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; Code span - Gen - [ }] - SpanEditHandler;Accepts:Any - (23:0,23) - Tokens:2 - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesExpressionOnSwitchCharacterFollowedByOpenParen.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesExpressionOnSwitchCharacterFollowedByOpenParen.stree.txt index 09618cf66e..1bfc6b33f3 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesExpressionOnSwitchCharacterFollowedByOpenParen.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesExpressionOnSwitchCharacterFollowedByOpenParen.stree.txt @@ -1,25 +1,25 @@ Statement block - Gen - 24 - (0:0,0) Code span - Gen - [if(foo) { ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:7 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; Expression block - Gen - 12 - (10:0,10) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (10:0,10) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (11:0,11) - Tokens:1 - CSharpTokenType.LeftParenthesis;[(]; + SyntaxKind.LeftParenthesis;[(]; Code span - Gen - [foo + bar] - SpanEditHandler;Accepts:Any - (12:0,12) - Tokens:5 - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Plus;[+]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Plus;[+]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; MetaCode span - Gen - [)] - SpanEditHandler;Accepts:None - (21:0,21) - Tokens:1 - CSharpTokenType.RightParenthesis;[)]; + SyntaxKind.RightParenthesis;[)]; Code span - Gen - [ }] - SpanEditHandler;Accepts:Any - (22:0,22) - Tokens:2 - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesMultipleElseIfBranchesOfIfStatement.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesMultipleElseIfBranchesOfIfStatement.stree.txt index 05d2542f80..cb4f3cd094 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesMultipleElseIfBranchesOfIfStatement.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesMultipleElseIfBranchesOfIfStatement.stree.txt @@ -1,239 +1,239 @@ Statement block - Gen - 459 - (0:0,0) Code span - Gen - [if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"foo } bar");LF} else if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"bar } baz");LF} else if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"bar } baz");LF} else if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"bar } baz");LF} else if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"bar } baz");LF}] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:237 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[int]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[0]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LessThan;[<]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[10]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.StringLiteral;["baz"]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Debug]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[WriteLine]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.StringLiteral;[@"foo } bar"]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[else]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[int]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[0]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LessThan;[<]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[10]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.StringLiteral;["baz"]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Debug]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[WriteLine]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.StringLiteral;[@"bar } baz"]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[else]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[int]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[0]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LessThan;[<]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[10]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.StringLiteral;["baz"]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Debug]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[WriteLine]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.StringLiteral;[@"bar } baz"]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[else]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[int]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[0]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LessThan;[<]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[10]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.StringLiteral;["baz"]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Debug]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[WriteLine]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.StringLiteral;[@"bar } baz"]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[else]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[int]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[0]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LessThan;[<]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[10]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.StringLiteral;["baz"]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Debug]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[WriteLine]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.StringLiteral;[@"bar } baz"]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[int]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[0]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LessThan;[<]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[10]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.StringLiteral;["baz"]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Debug]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[WriteLine]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.StringLiteral;[@"foo } bar"]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[else]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[int]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[0]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LessThan;[<]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[10]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.StringLiteral;["baz"]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Debug]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[WriteLine]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.StringLiteral;[@"bar } baz"]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[else]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[int]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[0]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LessThan;[<]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[10]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.StringLiteral;["baz"]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Debug]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[WriteLine]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.StringLiteral;[@"bar } baz"]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[else]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[int]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[0]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LessThan;[<]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[10]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.StringLiteral;["baz"]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Debug]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[WriteLine]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.StringLiteral;[@"bar } baz"]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[else]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[int]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[0]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LessThan;[<]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[10]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.StringLiteral;["baz"]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Debug]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[WriteLine]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.StringLiteral;[@"bar } baz"]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesMultipleElseIfBranchesOfIfStatementFollowedByOneElseBranch.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesMultipleElseIfBranchesOfIfStatementFollowedByOneElseBranch.stree.txt index 766f7e4ddd..62a654f7b7 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesMultipleElseIfBranchesOfIfStatementFollowedByOneElseBranch.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesMultipleElseIfBranchesOfIfStatementFollowedByOneElseBranch.stree.txt @@ -1,157 +1,157 @@ Statement block - Gen - 313 - (0:0,0) Code span - Gen - [if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"foo } bar");LF} else if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"bar } baz");LF} else if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"bar } baz");LF} else { Debug.WriteLine(@"bar } baz"); }] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:155 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[int]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[0]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LessThan;[<]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[10]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.StringLiteral;["baz"]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Debug]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[WriteLine]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.StringLiteral;[@"foo } bar"]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[else]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[int]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[0]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LessThan;[<]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[10]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.StringLiteral;["baz"]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Debug]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[WriteLine]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.StringLiteral;[@"bar } baz"]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[else]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[int]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[0]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LessThan;[<]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[10]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.StringLiteral;["baz"]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Debug]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[WriteLine]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.StringLiteral;[@"bar } baz"]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[else]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Debug]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[WriteLine]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.StringLiteral;[@"bar } baz"]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[int]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[0]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LessThan;[<]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[10]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.StringLiteral;["baz"]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Debug]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[WriteLine]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.StringLiteral;[@"foo } bar"]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[else]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[int]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[0]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LessThan;[<]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[10]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.StringLiteral;["baz"]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Debug]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[WriteLine]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.StringLiteral;[@"bar } baz"]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[else]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[int]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[0]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LessThan;[<]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[10]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.StringLiteral;["baz"]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Debug]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[WriteLine]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.StringLiteral;[@"bar } baz"]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[else]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Debug]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[WriteLine]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.StringLiteral;[@"bar } baz"]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesNamespaceAliasWithSemicolonForUsingKeywordIfIsInValidFormat.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesNamespaceAliasWithSemicolonForUsingKeywordIfIsInValidFormat.stree.txt index 9b0810ec74..c6cb9e90a8 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesNamespaceAliasWithSemicolonForUsingKeywordIfIsInValidFormat.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesNamespaceAliasWithSemicolonForUsingKeywordIfIsInValidFormat.stree.txt @@ -1,10 +1,10 @@ Directive block - Gen - 28 - (0:0,0) Code span - Gen - [using FooBarBaz = FooBarBaz;] - SpanEditHandler;Accepts:AnyExceptNewline - (0:0,0) - Tokens:8 - CSharpTokenType.Keyword;[using]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[FooBarBaz]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[FooBarBaz]; - CSharpTokenType.Semicolon;[;]; + SyntaxKind.Keyword;[using]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[FooBarBaz]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[FooBarBaz]; + SyntaxKind.Semicolon;[;]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesNamespaceImportWithSemicolonForUsingKeywordIfIsInValidFormat.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesNamespaceImportWithSemicolonForUsingKeywordIfIsInValidFormat.stree.txt index d9f8d37923..5fa73eb8f2 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesNamespaceImportWithSemicolonForUsingKeywordIfIsInValidFormat.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ParsesNamespaceImportWithSemicolonForUsingKeywordIfIsInValidFormat.stree.txt @@ -1,10 +1,10 @@ Directive block - Gen - 18 - (0:0,0) Code span - Gen - [using Foo.Bar.Baz;] - SpanEditHandler;Accepts:AnyExceptNewline - (0:0,0) - Tokens:8 - CSharpTokenType.Keyword;[using]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Baz]; - CSharpTokenType.Semicolon;[;]; + SyntaxKind.Keyword;[using]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Baz]; + SyntaxKind.Semicolon;[;]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsForKeyword.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsForKeyword.stree.txt index c19dcce9b3..9bd2fe906d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsForKeyword.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsForKeyword.stree.txt @@ -1,46 +1,46 @@ Statement block - Gen - 82 - (0:0,0) Code span - Gen - [for(int i = 0; i < 10; new Foo { Bar = "baz" }) { Debug.WriteLine(@"foo } bar"); }] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:44 - CSharpTokenType.Keyword;[for]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[int]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[0]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LessThan;[<]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[10]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.StringLiteral;["baz"]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Debug]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[WriteLine]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.StringLiteral;[@"foo } bar"]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[for]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[int]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[0]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LessThan;[<]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[10]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.StringLiteral;["baz"]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Debug]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[WriteLine]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.StringLiteral;[@"foo } bar"]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsForeachKeyword.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsForeachKeyword.stree.txt index 8e095ff484..a6ba84a761 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsForeachKeyword.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsForeachKeyword.stree.txt @@ -1,46 +1,46 @@ Statement block - Gen - 86 - (0:0,0) Code span - Gen - [foreach(int i = 0; i < 10; new Foo { Bar = "baz" }) { Debug.WriteLine(@"foo } bar"); }] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:44 - CSharpTokenType.Keyword;[foreach]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[int]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[0]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LessThan;[<]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[10]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.StringLiteral;["baz"]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Debug]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[WriteLine]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.StringLiteral;[@"foo } bar"]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[foreach]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[int]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[0]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LessThan;[<]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[10]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.StringLiteral;["baz"]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Debug]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[WriteLine]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.StringLiteral;[@"foo } bar"]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsIfKeywordWithNoElseBranches.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsIfKeywordWithNoElseBranches.stree.txt index bb4eee2f14..712f8110b9 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsIfKeywordWithNoElseBranches.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsIfKeywordWithNoElseBranches.stree.txt @@ -1,46 +1,46 @@ Statement block - Gen - 81 - (0:0,0) Code span - Gen - [if(int i = 0; i < 10; new Foo { Bar = "baz" }) { Debug.WriteLine(@"foo } bar"); }] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:44 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[int]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[0]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LessThan;[<]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[10]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.StringLiteral;["baz"]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Debug]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[WriteLine]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.StringLiteral;[@"foo } bar"]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[int]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[0]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LessThan;[<]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[10]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.StringLiteral;["baz"]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Debug]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[WriteLine]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.StringLiteral;[@"foo } bar"]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsSwitchKeyword.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsSwitchKeyword.stree.txt index f0e5015b28..23b29665ec 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsSwitchKeyword.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsSwitchKeyword.stree.txt @@ -1,54 +1,54 @@ Statement block - Gen - 161 - (0:0,0) Code span - Gen - [switch(foo) {LF case 0:LF break;LF case 1:LF {LF break;LF }LF case 2:LF return;LF default:LF return;LF}] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:52 - CSharpTokenType.Keyword;[switch]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[case]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[0]; - CSharpTokenType.Colon;[:]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[break]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[case]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[1]; - CSharpTokenType.Colon;[:]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[break]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[case]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[2]; - CSharpTokenType.Colon;[:]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[return]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[default]; - CSharpTokenType.Colon;[:]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[return]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[switch]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[case]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[0]; + SyntaxKind.Colon;[:]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[break]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[case]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[1]; + SyntaxKind.Colon;[:]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[break]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[case]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[2]; + SyntaxKind.Colon;[:]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[return]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[default]; + SyntaxKind.Colon;[:]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[return]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsWhileKeyword.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsWhileKeyword.stree.txt index 261becea48..8867fa66fb 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsWhileKeyword.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesBracesIfFirstIdentifierIsWhileKeyword.stree.txt @@ -1,46 +1,46 @@ Statement block - Gen - 84 - (0:0,0) Code span - Gen - [while(int i = 0; i < 10; new Foo { Bar = "baz" }) { Debug.WriteLine(@"foo } bar"); }] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:44 - CSharpTokenType.Keyword;[while]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[int]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[0]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LessThan;[<]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[10]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.StringLiteral;["baz"]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Debug]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[WriteLine]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.StringLiteral;[@"foo } bar"]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[while]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[int]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[0]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LessThan;[<]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[10]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.StringLiteral;["baz"]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Debug]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[WriteLine]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.StringLiteral;[@"foo } bar"]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesIfFirstIdentifierIsUsingFollowedByParen.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesIfFirstIdentifierIsUsingFollowedByParen.stree.txt index aaabf8bbd5..18268ec09d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesIfFirstIdentifierIsUsingFollowedByParen.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SkipsExprThenBalancesIfFirstIdentifierIsUsingFollowedByParen.stree.txt @@ -1,46 +1,46 @@ Statement block - Gen - 84 - (0:0,0) Code span - Gen - [using(int i = 0; i < 10; new Foo { Bar = "baz" }) { Debug.WriteLine(@"foo } bar"); }] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:44 - CSharpTokenType.Keyword;[using]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[int]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[0]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LessThan;[<]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[10]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.StringLiteral;["baz"]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Debug]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[WriteLine]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.StringLiteral;[@"foo } bar"]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[using]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[int]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[0]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LessThan;[<]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[10]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.StringLiteral;["baz"]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Debug]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[WriteLine]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.StringLiteral;[@"foo } bar"]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/StopsParsingCatchClausesAfterFinallyBlock.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/StopsParsingCatchClausesAfterFinallyBlock.stree.txt index c9a0cb5fa2..8ae4de426a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/StopsParsingCatchClausesAfterFinallyBlock.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/StopsParsingCatchClausesAfterFinallyBlock.stree.txt @@ -1,37 +1,37 @@ Statement block - Gen - 55 - (0:0,0) Code span - Gen - [try { var foo = new { } } finally { var foo = new { } }] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:35 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[finally]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[try]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[finally]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/StopsParsingCodeAfterElseBranch.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/StopsParsingCodeAfterElseBranch.stree.txt index 8aea7b10e3..7ed1071296 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/StopsParsingCodeAfterElseBranch.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/StopsParsingCodeAfterElseBranch.stree.txt @@ -1,109 +1,109 @@ Statement block - Gen - 220 - (0:0,0) Code span - Gen - [if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"foo } bar");LF} else if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"bar } baz");LF} else { Debug.WriteLine(@"bar } baz"); }] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:107 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[int]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[0]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LessThan;[<]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[10]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.StringLiteral;["baz"]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Debug]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[WriteLine]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.StringLiteral;[@"foo } bar"]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[else]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[int]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[0]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LessThan;[<]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[10]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.StringLiteral;["baz"]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Debug]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[WriteLine]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.StringLiteral;[@"bar } baz"]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[else]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Debug]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[WriteLine]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.StringLiteral;[@"bar } baz"]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[int]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[0]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LessThan;[<]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[10]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.StringLiteral;["baz"]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Debug]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[WriteLine]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.StringLiteral;[@"foo } bar"]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[else]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[int]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[0]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LessThan;[<]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[10]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.StringLiteral;["baz"]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Debug]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[WriteLine]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.StringLiteral;[@"bar } baz"]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[else]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Debug]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[WriteLine]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.StringLiteral;[@"bar } baz"]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/StopsParsingIfIfStatementNotFollowedByElse.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/StopsParsingIfIfStatementNotFollowedByElse.stree.txt index a6fde6d036..66455be822 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/StopsParsingIfIfStatementNotFollowedByElse.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/StopsParsingIfIfStatementNotFollowedByElse.stree.txt @@ -1,47 +1,47 @@ Statement block - Gen - 87 - (0:0,0) Code span - Gen - [if(int i = 0; i < 10; new Foo { Bar = "baz" }) {LF Debug.WriteLine(@"foo } bar");LF}] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:45 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[int]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[0]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LessThan;[<]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[10]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.StringLiteral;["baz"]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Debug]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[WriteLine]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.StringLiteral;[@"foo } bar"]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[int]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[0]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LessThan;[<]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[10]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.StringLiteral;["baz"]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Debug]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[WriteLine]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.StringLiteral;[@"foo } bar"]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenCatchAndFinallyClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenCatchAndFinallyClause.stree.txt index 4dd24cad32..73bc070d63 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenCatchAndFinallyClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenCatchAndFinallyClause.stree.txt @@ -1,41 +1,41 @@ Statement block - Gen - 75 - (0:0,0) Code span - Gen - [try { bar(); } catch(bar) { baz(); } /* Foo */ /* Bar */ finally { biz(); }] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:39 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[catch]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[baz]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Comment;[/* Foo */]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Comment;[/* Bar */]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[finally]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[biz]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[try]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[catch]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[baz]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.CSharpComment;[/* Foo */]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.CSharpComment;[/* Bar */]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[finally]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[biz]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenDoAndWhileClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenDoAndWhileClause.stree.txt index 89aeaa49b0..55417a8113 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenDoAndWhileClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenDoAndWhileClause.stree.txt @@ -1,26 +1,26 @@ Statement block - Gen - 54 - (0:0,0) Code span - Gen - [do { var foo = bar; } /* Foo */ /* Bar */ while(true);] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:24 - CSharpTokenType.Keyword;[do]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Comment;[/* Foo */]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Comment;[/* Bar */]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[while]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[true]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; + SyntaxKind.Keyword;[do]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.CSharpComment;[/* Foo */]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.CSharpComment;[/* Bar */]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[while]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[true]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenElseIfAndElseClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenElseIfAndElseClause.stree.txt index 8beb9c4062..af30d4aa67 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenElseIfAndElseClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenElseIfAndElseClause.stree.txt @@ -1,46 +1,46 @@ Statement block - Gen - 78 - (0:0,0) Code span - Gen - [if(foo) { bar(); } else if(bar) { baz(); } /* Foo */ /* Bar */ else { biz(); }] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:44 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[else]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[baz]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Comment;[/* Foo */]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Comment;[/* Bar */]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[else]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[biz]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[else]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[baz]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.CSharpComment;[/* Foo */]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.CSharpComment;[/* Bar */]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[else]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[biz]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenIfAndElseClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenIfAndElseClause.stree.txt index c00834cb33..5c0454a7c6 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenIfAndElseClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenIfAndElseClause.stree.txt @@ -1,30 +1,30 @@ Statement block - Gen - 54 - (0:0,0) Code span - Gen - [if(foo) { bar(); } /* Foo */ /* Bar */ else { baz(); }] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:28 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Comment;[/* Foo */]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Comment;[/* Bar */]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[else]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[baz]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.CSharpComment;[/* Foo */]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.CSharpComment;[/* Bar */]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[else]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[baz]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenIfAndElseIfClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenIfAndElseIfClause.stree.txt index 35a7c0c0e2..6d0d09b6b4 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenIfAndElseIfClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenIfAndElseIfClause.stree.txt @@ -1,35 +1,35 @@ Statement block - Gen - 62 - (0:0,0) Code span - Gen - [if(foo) { bar(); } /* Foo */ /* Bar */ else if(bar) { baz(); }] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:33 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Comment;[/* Foo */]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Comment;[/* Bar */]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[else]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[baz]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.CSharpComment;[/* Foo */]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.CSharpComment;[/* Bar */]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[else]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[baz]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenTryAndCatchClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenTryAndCatchClause.stree.txt index 4fb861d57f..7d9cdf7fb9 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenTryAndCatchClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenTryAndCatchClause.stree.txt @@ -1,30 +1,30 @@ Statement block - Gen - 56 - (0:0,0) Code span - Gen - [try { bar(); } /* Foo */ /* Bar */ catch(bar) { baz(); }] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:28 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Comment;[/* Foo */]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Comment;[/* Bar */]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[catch]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[baz]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[try]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.CSharpComment;[/* Foo */]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.CSharpComment;[/* Bar */]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[catch]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[baz]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenTryAndFinallyClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenTryAndFinallyClause.stree.txt index 659643d83f..fc6549a8d0 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenTryAndFinallyClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsBlockCommentBetweenTryAndFinallyClause.stree.txt @@ -1,27 +1,27 @@ Statement block - Gen - 53 - (0:0,0) Code span - Gen - [try { bar(); } /* Foo */ /* Bar */ finally { baz(); }] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:25 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Comment;[/* Foo */]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Comment;[/* Bar */]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[finally]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[baz]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[try]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.CSharpComment;[/* Foo */]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.CSharpComment;[/* Bar */]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[finally]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[baz]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsExceptionLessCatchClauses.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsExceptionLessCatchClauses.stree.txt index bb84c5607a..cfdfe10393 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsExceptionLessCatchClauses.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsExceptionLessCatchClauses.stree.txt @@ -1,37 +1,37 @@ Statement block - Gen - 53 - (0:0,0) Code span - Gen - [try { var foo = new { } } catch { var foo = new { } }] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:35 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[catch]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[try]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[catch]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenCatchAndFinallyClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenCatchAndFinallyClause.stree.txt index b09a7b573c..1c1dd32483 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenCatchAndFinallyClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenCatchAndFinallyClause.stree.txt @@ -1,41 +1,41 @@ Statement block - Gen - 72 - (0:0,0) Code span - Gen - [try { bar(); } catch(bar) { baz(); }LF// FooLF// BarLFfinally { biz(); }] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:39 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[catch]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[baz]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.Comment;[// Foo]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.Comment;[// Bar]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.Keyword;[finally]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[biz]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[try]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[catch]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[baz]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.CSharpComment;[// Foo]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.CSharpComment;[// Bar]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Keyword;[finally]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[biz]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenDoAndWhileClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenDoAndWhileClause.stree.txt index 17b8ff17eb..2882f0ab41 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenDoAndWhileClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenDoAndWhileClause.stree.txt @@ -1,26 +1,26 @@ Statement block - Gen - 51 - (0:0,0) Code span - Gen - [do { var foo = bar; }LF// FooLF// BarLFwhile(true);] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:24 - CSharpTokenType.Keyword;[do]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.Comment;[// Foo]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.Comment;[// Bar]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.Keyword;[while]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[true]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; + SyntaxKind.Keyword;[do]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.CSharpComment;[// Foo]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.CSharpComment;[// Bar]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Keyword;[while]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[true]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenElseIfAndElseClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenElseIfAndElseClause.stree.txt index eb193d4c42..0fc2eef2b1 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenElseIfAndElseClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenElseIfAndElseClause.stree.txt @@ -1,46 +1,46 @@ Statement block - Gen - 75 - (0:0,0) Code span - Gen - [if(foo) { bar(); } else if(bar) { baz(); }LF// FooLF// BarLFelse { biz(); }] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:44 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[else]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[baz]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.Comment;[// Foo]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.Comment;[// Bar]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.Keyword;[else]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[biz]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[else]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[baz]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.CSharpComment;[// Foo]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.CSharpComment;[// Bar]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Keyword;[else]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[biz]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenIfAndElseClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenIfAndElseClause.stree.txt index 5494eeaffe..ab73bc4446 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenIfAndElseClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenIfAndElseClause.stree.txt @@ -1,30 +1,30 @@ Statement block - Gen - 51 - (0:0,0) Code span - Gen - [if(foo) { bar(); }LF// FooLF// BarLFelse { baz(); }] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:28 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.Comment;[// Foo]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.Comment;[// Bar]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.Keyword;[else]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[baz]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.CSharpComment;[// Foo]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.CSharpComment;[// Bar]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Keyword;[else]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[baz]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenIfAndElseIfClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenIfAndElseIfClause.stree.txt index 9359227eaf..a151fa562e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenIfAndElseIfClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenIfAndElseIfClause.stree.txt @@ -1,35 +1,35 @@ Statement block - Gen - 59 - (0:0,0) Code span - Gen - [if(foo) { bar(); }LF// FooLF// BarLFelse if(bar) { baz(); }] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:33 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.Comment;[// Foo]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.Comment;[// Bar]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.Keyword;[else]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[baz]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.CSharpComment;[// Foo]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.CSharpComment;[// Bar]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Keyword;[else]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[baz]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenTryAndCatchClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenTryAndCatchClause.stree.txt index fd741d9327..51faa5f9e7 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenTryAndCatchClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenTryAndCatchClause.stree.txt @@ -1,30 +1,30 @@ Statement block - Gen - 53 - (0:0,0) Code span - Gen - [try { bar(); }LF// FooLF// BarLFcatch(bar) { baz(); }] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:28 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.Comment;[// Foo]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.Comment;[// Bar]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.Keyword;[catch]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[baz]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[try]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.CSharpComment;[// Foo]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.CSharpComment;[// Bar]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Keyword;[catch]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[baz]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenTryAndFinallyClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenTryAndFinallyClause.stree.txt index 4f6a067875..1bdb46e8d9 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenTryAndFinallyClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsLineCommentBetweenTryAndFinallyClause.stree.txt @@ -1,27 +1,27 @@ Statement block - Gen - 50 - (0:0,0) Code span - Gen - [try { bar(); }LF// FooLF// BarLFfinally { baz(); }] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:25 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.Comment;[// Foo]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.Comment;[// Bar]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.Keyword;[finally]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[baz]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[try]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.CSharpComment;[// Foo]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.CSharpComment;[// Bar]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Keyword;[finally]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[baz]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsMarkupWithinAdditionalCatchClauses.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsMarkupWithinAdditionalCatchClauses.stree.txt index 12d1fbf839..f8e0615097 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsMarkupWithinAdditionalCatchClauses.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsMarkupWithinAdditionalCatchClauses.stree.txt @@ -1,100 +1,100 @@ Statement block - Gen - 141 - (0:0,0) Code span - Gen - [try { var foo = new { } } catch(Foo Bar Baz) { var foo = new { } } catch(Foo Bar Baz) { var foo = new { } } catch(Foo Bar Baz) {] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:78 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[catch]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Baz]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[catch]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Baz]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[catch]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Baz]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.Keyword;[try]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[catch]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Baz]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[catch]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Baz]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[catch]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Baz]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 12 - (128:0,128) Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (128:0,128) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 3 - (129:0,129) Markup span - Gen - [

] - SpanEditHandler;Accepts:None - (129:0,129) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [Foo] - SpanEditHandler;Accepts:Any - (132:0,132) - Tokens:1 - HtmlTokenType.Text;[Foo]; + SyntaxKind.Text;[Foo]; Tag block - Gen - 4 - (135:0,135) Markup span - Gen - [

] - SpanEditHandler;Accepts:None - (135:0,135) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (139:0,139) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [}] - SpanEditHandler;Accepts:Any - (140:0,140) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsMarkupWithinCatchClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsMarkupWithinCatchClause.stree.txt index eb1512a038..f2a74e5ca4 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsMarkupWithinCatchClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsMarkupWithinCatchClause.stree.txt @@ -1,50 +1,50 @@ Statement block - Gen - 59 - (0:0,0) Code span - Gen - [try { var foo = new { } } catch(Foo Bar Baz) {] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:28 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[catch]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Baz]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.Keyword;[try]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[catch]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Baz]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 12 - (46:0,46) Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (46:0,46) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 3 - (47:0,47) Markup span - Gen - [

] - SpanEditHandler;Accepts:None - (47:0,47) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [Foo] - SpanEditHandler;Accepts:Any - (50:0,50) - Tokens:1 - HtmlTokenType.Text;[Foo]; + SyntaxKind.Text;[Foo]; Tag block - Gen - 4 - (53:0,53) Markup span - Gen - [

] - SpanEditHandler;Accepts:None - (53:0,53) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (57:0,57) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [}] - SpanEditHandler;Accepts:Any - (58:0,58) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsMarkupWithinFinallyClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsMarkupWithinFinallyClause.stree.txt index 4af8d90e1a..4e7e1826a6 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsMarkupWithinFinallyClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsMarkupWithinFinallyClause.stree.txt @@ -1,43 +1,43 @@ Statement block - Gen - 48 - (0:0,0) Code span - Gen - [try { var foo = new { } } finally {] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:21 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[finally]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.Keyword;[try]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[finally]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 12 - (35:0,35) Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (35:0,35) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 3 - (36:0,36) Markup span - Gen - [

] - SpanEditHandler;Accepts:None - (36:0,36) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [Foo] - SpanEditHandler;Accepts:Any - (39:0,39) - Tokens:1 - HtmlTokenType.Text;[Foo]; + SyntaxKind.Text;[Foo]; Tag block - Gen - 4 - (42:0,42) Markup span - Gen - [

] - SpanEditHandler;Accepts:None - (42:0,42) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (46:0,46) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [}] - SpanEditHandler;Accepts:None - (47:0,47) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsMarkupWithinTryClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsMarkupWithinTryClause.stree.txt index f7fc9e38f9..83fa9cdbc1 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsMarkupWithinTryClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsMarkupWithinTryClause.stree.txt @@ -1,25 +1,25 @@ Statement block - Gen - 18 - (0:0,0) Code span - Gen - [try {] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:3 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.Keyword;[try]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 12 - (5:0,5) Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (5:0,5) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 3 - (6:0,6) Markup span - Gen - [

] - SpanEditHandler;Accepts:None - (6:0,6) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [Foo] - SpanEditHandler;Accepts:Any - (9:0,9) - Tokens:1 - HtmlTokenType.Text;[Foo]; + SyntaxKind.Text;[Foo]; Tag block - Gen - 4 - (12:0,12) Markup span - Gen - [

] - SpanEditHandler;Accepts:None - (12:0,12) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [}] - SpanEditHandler;Accepts:Any - (17:0,17) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenCatchAndFinallyClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenCatchAndFinallyClause.stree.txt index 7ebe9d2b86..0c589bfbe6 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenCatchAndFinallyClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenCatchAndFinallyClause.stree.txt @@ -1,63 +1,63 @@ Statement block - Gen - 75 - (0:0,0) Code span - Gen - [try { bar(); } catch(bar) { baz(); } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:25 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[catch]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[baz]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Keyword;[try]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[catch]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[baz]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; Comment block - Gen - 9 - (37:0,37) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (37:0,37) - Tokens:1 - CSharpTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (38:0,38) - Tokens:1 - CSharpTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Comment span - Gen - [ Foo ] - SpanEditHandler;Accepts:Any - (39:0,39) - Tokens:1 - CSharpTokenType.RazorComment;[ Foo ]; + SyntaxKind.RazorCommentLiteral;[ Foo ]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (44:0,44) - Tokens:1 - CSharpTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (45:0,45) - Tokens:1 - CSharpTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; Code span - Gen - [ ] - SpanEditHandler;Accepts:Any - (46:0,46) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Comment block - Gen - 9 - (47:0,47) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (47:0,47) - Tokens:1 - CSharpTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (48:0,48) - Tokens:1 - CSharpTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Comment span - Gen - [ Bar ] - SpanEditHandler;Accepts:Any - (49:0,49) - Tokens:1 - CSharpTokenType.RazorComment;[ Bar ]; + SyntaxKind.RazorCommentLiteral;[ Bar ]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (54:0,54) - Tokens:1 - CSharpTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (55:0,55) - Tokens:1 - CSharpTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; Code span - Gen - [ finally { biz(); }] - SpanEditHandler;Accepts:None - (56:0,56) - Tokens:11 - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[finally]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[biz]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[finally]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[biz]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenDoAndWhileClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenDoAndWhileClause.stree.txt index e31ec364b4..3c23c80fad 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenDoAndWhileClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenDoAndWhileClause.stree.txt @@ -1,48 +1,48 @@ Statement block - Gen - 54 - (0:0,0) Code span - Gen - [do { var foo = bar; } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:15 - CSharpTokenType.Keyword;[do]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Keyword;[do]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; Comment block - Gen - 9 - (22:0,22) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (22:0,22) - Tokens:1 - CSharpTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (23:0,23) - Tokens:1 - CSharpTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Comment span - Gen - [ Foo ] - SpanEditHandler;Accepts:Any - (24:0,24) - Tokens:1 - CSharpTokenType.RazorComment;[ Foo ]; + SyntaxKind.RazorCommentLiteral;[ Foo ]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (29:0,29) - Tokens:1 - CSharpTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (30:0,30) - Tokens:1 - CSharpTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; Code span - Gen - [ ] - SpanEditHandler;Accepts:Any - (31:0,31) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Comment block - Gen - 9 - (32:0,32) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (32:0,32) - Tokens:1 - CSharpTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (33:0,33) - Tokens:1 - CSharpTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Comment span - Gen - [ Bar ] - SpanEditHandler;Accepts:Any - (34:0,34) - Tokens:1 - CSharpTokenType.RazorComment;[ Bar ]; + SyntaxKind.RazorCommentLiteral;[ Bar ]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (39:0,39) - Tokens:1 - CSharpTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (40:0,40) - Tokens:1 - CSharpTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; Code span - Gen - [ while(true);] - SpanEditHandler;Accepts:None - (41:0,41) - Tokens:6 - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[while]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[true]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[while]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[true]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenElseIfAndElseClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenElseIfAndElseClause.stree.txt index 36f17bd744..b6367f8a36 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenElseIfAndElseClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenElseIfAndElseClause.stree.txt @@ -1,68 +1,68 @@ Statement block - Gen - 78 - (0:0,0) Code span - Gen - [if(foo) { bar(); } else if(bar) { baz(); } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:30 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[else]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[baz]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[else]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[baz]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; Comment block - Gen - 9 - (43:0,43) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (43:0,43) - Tokens:1 - CSharpTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (44:0,44) - Tokens:1 - CSharpTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Comment span - Gen - [ Foo ] - SpanEditHandler;Accepts:Any - (45:0,45) - Tokens:1 - CSharpTokenType.RazorComment;[ Foo ]; + SyntaxKind.RazorCommentLiteral;[ Foo ]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (50:0,50) - Tokens:1 - CSharpTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (51:0,51) - Tokens:1 - CSharpTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; Code span - Gen - [ ] - SpanEditHandler;Accepts:Any - (52:0,52) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Comment block - Gen - 9 - (53:0,53) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (53:0,53) - Tokens:1 - CSharpTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (54:0,54) - Tokens:1 - CSharpTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Comment span - Gen - [ Bar ] - SpanEditHandler;Accepts:Any - (55:0,55) - Tokens:1 - CSharpTokenType.RazorComment;[ Bar ]; + SyntaxKind.RazorCommentLiteral;[ Bar ]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (60:0,60) - Tokens:1 - CSharpTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (61:0,61) - Tokens:1 - CSharpTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; Code span - Gen - [ else { baz(); }] - SpanEditHandler;Accepts:None - (62:0,62) - Tokens:11 - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[else]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[baz]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[else]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[baz]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenIfAndElseClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenIfAndElseClause.stree.txt index 6a9926895b..24f5021c5f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenIfAndElseClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenIfAndElseClause.stree.txt @@ -1,52 +1,52 @@ Statement block - Gen - 54 - (0:0,0) Code span - Gen - [if(foo) { bar(); } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:14 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; Comment block - Gen - 9 - (19:0,19) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (19:0,19) - Tokens:1 - CSharpTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (20:0,20) - Tokens:1 - CSharpTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Comment span - Gen - [ Foo ] - SpanEditHandler;Accepts:Any - (21:0,21) - Tokens:1 - CSharpTokenType.RazorComment;[ Foo ]; + SyntaxKind.RazorCommentLiteral;[ Foo ]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (26:0,26) - Tokens:1 - CSharpTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (27:0,27) - Tokens:1 - CSharpTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; Code span - Gen - [ ] - SpanEditHandler;Accepts:Any - (28:0,28) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Comment block - Gen - 9 - (29:0,29) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (29:0,29) - Tokens:1 - CSharpTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (30:0,30) - Tokens:1 - CSharpTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Comment span - Gen - [ Bar ] - SpanEditHandler;Accepts:Any - (31:0,31) - Tokens:1 - CSharpTokenType.RazorComment;[ Bar ]; + SyntaxKind.RazorCommentLiteral;[ Bar ]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (36:0,36) - Tokens:1 - CSharpTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (37:0,37) - Tokens:1 - CSharpTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; Code span - Gen - [ else { baz(); }] - SpanEditHandler;Accepts:None - (38:0,38) - Tokens:11 - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[else]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[baz]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[else]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[baz]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenIfAndElseIfClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenIfAndElseIfClause.stree.txt index f25afcea4d..868fb9cd86 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenIfAndElseIfClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenIfAndElseIfClause.stree.txt @@ -1,57 +1,57 @@ Statement block - Gen - 62 - (0:0,0) Code span - Gen - [if(foo) { bar(); } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:14 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; Comment block - Gen - 9 - (19:0,19) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (19:0,19) - Tokens:1 - CSharpTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (20:0,20) - Tokens:1 - CSharpTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Comment span - Gen - [ Foo ] - SpanEditHandler;Accepts:Any - (21:0,21) - Tokens:1 - CSharpTokenType.RazorComment;[ Foo ]; + SyntaxKind.RazorCommentLiteral;[ Foo ]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (26:0,26) - Tokens:1 - CSharpTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (27:0,27) - Tokens:1 - CSharpTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; Code span - Gen - [ ] - SpanEditHandler;Accepts:Any - (28:0,28) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Comment block - Gen - 9 - (29:0,29) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (29:0,29) - Tokens:1 - CSharpTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (30:0,30) - Tokens:1 - CSharpTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Comment span - Gen - [ Bar ] - SpanEditHandler;Accepts:Any - (31:0,31) - Tokens:1 - CSharpTokenType.RazorComment;[ Bar ]; + SyntaxKind.RazorCommentLiteral;[ Bar ]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (36:0,36) - Tokens:1 - CSharpTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (37:0,37) - Tokens:1 - CSharpTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; Code span - Gen - [ else if(bar) { baz(); }] - SpanEditHandler;Accepts:Any - (38:0,38) - Tokens:16 - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[else]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[baz]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[else]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[baz]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenTryAndCatchClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenTryAndCatchClause.stree.txt index 7ca64561f4..465652cc21 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenTryAndCatchClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenTryAndCatchClause.stree.txt @@ -1,51 +1,51 @@ Statement block - Gen - 55 - (0:0,0) Code span - Gen - [try { bar(); }] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:10 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[try]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; Comment block - Gen - 9 - (14:0,14) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (14:0,14) - Tokens:1 - CSharpTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (15:0,15) - Tokens:1 - CSharpTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Comment span - Gen - [ Foo ] - SpanEditHandler;Accepts:Any - (16:0,16) - Tokens:1 - CSharpTokenType.RazorComment;[ Foo ]; + SyntaxKind.RazorCommentLiteral;[ Foo ]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (21:0,21) - Tokens:1 - CSharpTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (22:0,22) - Tokens:1 - CSharpTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; Code span - Gen - [ ] - SpanEditHandler;Accepts:Any - (23:0,23) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Comment block - Gen - 9 - (24:0,24) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (24:0,24) - Tokens:1 - CSharpTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (25:0,25) - Tokens:1 - CSharpTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Comment span - Gen - [ Bar ] - SpanEditHandler;Accepts:Any - (26:0,26) - Tokens:1 - CSharpTokenType.RazorComment;[ Bar ]; + SyntaxKind.RazorCommentLiteral;[ Bar ]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (31:0,31) - Tokens:1 - CSharpTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (32:0,32) - Tokens:1 - CSharpTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; Code span - Gen - [ catch(bar) { baz(); }] - SpanEditHandler;Accepts:Any - (33:0,33) - Tokens:14 - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[catch]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[baz]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[catch]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[baz]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenTryAndFinallyClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenTryAndFinallyClause.stree.txt index bb040a642a..82faa128c9 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenTryAndFinallyClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsRazorCommentBetweenTryAndFinallyClause.stree.txt @@ -1,49 +1,49 @@ Statement block - Gen - 53 - (0:0,0) Code span - Gen - [try { bar(); } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:11 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Keyword;[try]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; Comment block - Gen - 9 - (15:0,15) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (15:0,15) - Tokens:1 - CSharpTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - CSharpTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Comment span - Gen - [ Foo ] - SpanEditHandler;Accepts:Any - (17:0,17) - Tokens:1 - CSharpTokenType.RazorComment;[ Foo ]; + SyntaxKind.RazorCommentLiteral;[ Foo ]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (22:0,22) - Tokens:1 - CSharpTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (23:0,23) - Tokens:1 - CSharpTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; Code span - Gen - [ ] - SpanEditHandler;Accepts:Any - (24:0,24) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Comment block - Gen - 9 - (25:0,25) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (25:0,25) - Tokens:1 - CSharpTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (26:0,26) - Tokens:1 - CSharpTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Comment span - Gen - [ Bar ] - SpanEditHandler;Accepts:Any - (27:0,27) - Tokens:1 - CSharpTokenType.RazorComment;[ Bar ]; + SyntaxKind.RazorCommentLiteral;[ Bar ]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (32:0,32) - Tokens:1 - CSharpTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (33:0,33) - Tokens:1 - CSharpTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; Code span - Gen - [ finally { biz(); }] - SpanEditHandler;Accepts:None - (34:0,34) - Tokens:11 - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[finally]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[biz]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[finally]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[biz]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsTryStatementWithFinallyClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsTryStatementWithFinallyClause.stree.txt index c9a0cb5fa2..8ae4de426a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsTryStatementWithFinallyClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsTryStatementWithFinallyClause.stree.txt @@ -1,37 +1,37 @@ Statement block - Gen - 55 - (0:0,0) Code span - Gen - [try { var foo = new { } } finally { var foo = new { } }] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:35 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[finally]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[try]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[finally]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsTryStatementWithMultipleCatchClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsTryStatementWithMultipleCatchClause.stree.txt index b4bab579d7..46447b2fe9 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsTryStatementWithMultipleCatchClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsTryStatementWithMultipleCatchClause.stree.txt @@ -1,94 +1,94 @@ Statement block - Gen - 148 - (0:0,0) Code span - Gen - [try { var foo = new { } } catch(Foo Bar Baz) { var foo = new { } } catch(Foo Bar Baz) { var foo = new { } } catch(Foo Bar Baz) { var foo = new { } }] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:92 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[catch]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Baz]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[catch]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Baz]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[catch]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Baz]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[try]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[catch]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Baz]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[catch]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Baz]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[catch]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Baz]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsTryStatementWithNoAdditionalClauses.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsTryStatementWithNoAdditionalClauses.stree.txt index 8db73b2757..8a1d739940 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsTryStatementWithNoAdditionalClauses.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsTryStatementWithNoAdditionalClauses.stree.txt @@ -1,19 +1,19 @@ Statement block - Gen - 25 - (0:0,0) Code span - Gen - [try { var foo = new { } }] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:17 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[try]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsTryStatementWithOneCatchClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsTryStatementWithOneCatchClause.stree.txt index e83ac8d8ba..54e1530181 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsTryStatementWithOneCatchClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsTryStatementWithOneCatchClause.stree.txt @@ -1,44 +1,44 @@ Statement block - Gen - 66 - (0:0,0) Code span - Gen - [try { var foo = new { } } catch(Foo Bar Baz) { var foo = new { } }] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:42 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[catch]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Baz]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[try]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[catch]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Baz]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsUsingsNestedWithinOtherBlocks.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsUsingsNestedWithinOtherBlocks.stree.txt index 4618359626..429b126cbd 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsUsingsNestedWithinOtherBlocks.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/SupportsUsingsNestedWithinOtherBlocks.stree.txt @@ -1,55 +1,55 @@ Statement block - Gen - 96 - (0:0,0) Code span - Gen - [if(foo) { using(int i = 0; i < 10; new Foo { Bar = "baz" }) { Debug.WriteLine(@"foo } bar"); } }] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:53 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[using]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[int]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[0]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LessThan;[<]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[10]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.StringLiteral;["baz"]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Debug]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[WriteLine]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.StringLiteral;[@"foo } bar"]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[using]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[int]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[0]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LessThan;[<]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[10]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.StringLiteral;["baz"]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Debug]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[WriteLine]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.StringLiteral;[@"foo } bar"]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesBlockCommentAtEndOfFile.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesBlockCommentAtEndOfFile.stree.txt index c1ef9144c7..ea93ea30db 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesBlockCommentAtEndOfFile.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesBlockCommentAtEndOfFile.stree.txt @@ -1,16 +1,16 @@ Statement block - Gen - 38 - (0:0,0) Code span - Gen - [foreach(var f in Foo) { /* foo bar baz] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:14 - CSharpTokenType.Keyword;[foreach]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[f]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[in]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Comment;[/* foo bar baz];RZ1001(24:0,24 [1] ) + SyntaxKind.Keyword;[foreach]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[f]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[in]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.CSharpComment;[/* foo bar baz];RZ1001(24:0,24 [1] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesParenBalancingAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesParenBalancingAtEOF.stree.txt index 74aaae6293..9f50f95894 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesParenBalancingAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesParenBalancingAtEOF.stree.txt @@ -1,11 +1,11 @@ Expression block - Gen - 15 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [Html.En(code()] - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:7 - CSharpTokenType.Identifier;[Html]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[En]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[code]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; + SyntaxKind.Identifier;[Html]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[En]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[code]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesSingleLineCommentAtEndOfFile.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesSingleLineCommentAtEndOfFile.stree.txt index 132a174cc4..6151639077 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesSingleLineCommentAtEndOfFile.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesSingleLineCommentAtEndOfFile.stree.txt @@ -1,16 +1,16 @@ Statement block - Gen - 38 - (0:0,0) Code span - Gen - [foreach(var f in Foo) { // foo bar baz] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:14 - CSharpTokenType.Keyword;[foreach]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[f]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[in]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Comment;[// foo bar baz]; + SyntaxKind.Keyword;[foreach]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[f]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[in]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.CSharpComment;[// foo bar baz]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesSingleSlashAtEndOfFile.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesSingleSlashAtEndOfFile.stree.txt index fc3d51a91d..f2643653cd 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesSingleSlashAtEndOfFile.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesSingleSlashAtEndOfFile.stree.txt @@ -1,22 +1,22 @@ Statement block - Gen - 37 - (0:0,0) Code span - Gen - [foreach(var f in Foo) { / foo bar baz] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:20 - CSharpTokenType.Keyword;[foreach]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[f]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[in]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Slash;[/]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[baz]; + SyntaxKind.Keyword;[foreach]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[f]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[in]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Slash;[/]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[baz]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesUsingKeywordAtEOFAndOutputsFileCodeBlock.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesUsingKeywordAtEOFAndOutputsFileCodeBlock.stree.txt index 96f6f0f501..b0fd67916f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesUsingKeywordAtEOFAndOutputsFileCodeBlock.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TerminatesUsingKeywordAtEOFAndOutputsFileCodeBlock.stree.txt @@ -1,4 +1,4 @@ Statement block - Gen - 25 - (0:0,0) Code span - Gen - [using ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:2 - CSharpTokenType.Keyword;[using]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Keyword;[using]; + SyntaxKind.Whitespace;[ ]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ThenBalancesBracesIfFirstIdentifierIsLockKeyword.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ThenBalancesBracesIfFirstIdentifierIsLockKeyword.stree.txt index d1aea3ef3c..7d68d60c18 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ThenBalancesBracesIfFirstIdentifierIsLockKeyword.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/ThenBalancesBracesIfFirstIdentifierIsLockKeyword.stree.txt @@ -1,18 +1,18 @@ Statement block - Gen - 44 - (0:0,0) Code span - Gen - [lock(foo) { Debug.WriteLine(@"foo } bar"); }] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:16 - CSharpTokenType.Keyword;[lock]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Debug]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[WriteLine]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.StringLiteral;[@"foo } bar"]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[lock]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Debug]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[WriteLine]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.StringLiteral;[@"foo } bar"]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TreatsAtSignsAfterFirstPairAsPartOfCSharpStatement.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TreatsAtSignsAfterFirstPairAsPartOfCSharpStatement.stree.txt index 2adfba5136..83909c4da0 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TreatsAtSignsAfterFirstPairAsPartOfCSharpStatement.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TreatsAtSignsAfterFirstPairAsPartOfCSharpStatement.stree.txt @@ -1,22 +1,22 @@ Statement block - Gen - 27 - (0:0,0) Code span - Gen - [if(foo) { ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:7 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [@] - SpanEditHandler;Accepts:Any - (10:0,10) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [@@@class.Foo() }] - SpanEditHandler;Accepts:Any - (11:0,11) - Tokens:10 - CSharpTokenType.Transition;[@]; - CSharpTokenType.Transition;[@]; - CSharpTokenType.Transition;[@]; - CSharpTokenType.Keyword;[class]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Transition;[@]; + SyntaxKind.Transition;[@]; + SyntaxKind.Transition;[@]; + SyntaxKind.Keyword;[class]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TreatsDoubleAtSignAsEscapeSequenceIfAtStatementStart.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TreatsDoubleAtSignAsEscapeSequenceIfAtStatementStart.stree.txt index 2b2e1a980f..cfd3620a03 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TreatsDoubleAtSignAsEscapeSequenceIfAtStatementStart.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/TreatsDoubleAtSignAsEscapeSequenceIfAtStatementStart.stree.txt @@ -1,20 +1,20 @@ Statement block - Gen - 25 - (0:0,0) Code span - Gen - [if(foo) { ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:7 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [@] - SpanEditHandler;Accepts:Any - (10:0,10) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [@class.Foo() }] - SpanEditHandler;Accepts:Any - (11:0,11) - Tokens:8 - CSharpTokenType.Transition;[@]; - CSharpTokenType.Keyword;[class]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Transition;[@]; + SyntaxKind.Keyword;[class]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionAtBeginningOfAttributeValue_DoesNotThrow.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionAtBeginningOfAttributeValue_DoesNotThrow.stree.txt index ac7bda2f5e..ce9722564d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionAtBeginningOfAttributeValue_DoesNotThrow.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionAtBeginningOfAttributeValue_DoesNotThrow.stree.txt @@ -1,31 +1,31 @@ Statement block - Gen - 22 - (0:0,0) MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 20 - (1:0,1) Tag block - Gen - 20 - (1:0,1) Markup span - Gen - [ - 12 - (6:0,6) Markup span - Gen - [ foo='] - SpanEditHandler;Accepts:Any - (6:0,6) - Tokens:4 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[foo]; - HtmlTokenType.Equals;[=]; - HtmlTokenType.SingleQuote;[']; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[foo]; + SyntaxKind.Equals;[=]; + SyntaxKind.SingleQuote;[']; Markup block - Gen - 2 - (12:0,12) Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (12:0,12) - Tokens:1 - HtmlTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 - HtmlTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Markup span - Gen - [def] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - HtmlTokenType.Text;[def]; + SyntaxKind.Text;[def]; Markup span - Gen - ['] - SpanEditHandler;Accepts:Any - (17:0,17) - Tokens:1 - HtmlTokenType.SingleQuote;[']; + SyntaxKind.SingleQuote;[']; Markup span - Gen - [ />] - SpanEditHandler;Accepts:None - (18:0,18) - Tokens:3 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.CloseAngle;[>]; Code span - Gen - [] - SpanEditHandler;Accepts:Any - (21:0,21) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (21:0,21) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionAtEndOfAttributeValue_DoesNotThrow.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionAtEndOfAttributeValue_DoesNotThrow.stree.txt index d7426b2aac..6fdd673106 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionAtEndOfAttributeValue_DoesNotThrow.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionAtEndOfAttributeValue_DoesNotThrow.stree.txt @@ -1,31 +1,31 @@ Statement block - Gen - 22 - (0:0,0) MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 20 - (1:0,1) Tag block - Gen - 20 - (1:0,1) Markup span - Gen - [ - 12 - (6:0,6) Markup span - Gen - [ foo='] - SpanEditHandler;Accepts:Any - (6:0,6) - Tokens:4 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[foo]; - HtmlTokenType.Equals;[=]; - HtmlTokenType.SingleQuote;[']; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[foo]; + SyntaxKind.Equals;[=]; + SyntaxKind.SingleQuote;[']; Markup span - Gen - [abc] - SpanEditHandler;Accepts:Any - (12:0,12) - Tokens:1 - HtmlTokenType.Text;[abc]; + SyntaxKind.Text;[abc]; Markup block - Gen - 2 - (15:0,15) Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (15:0,15) - Tokens:1 - HtmlTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - HtmlTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Markup span - Gen - ['] - SpanEditHandler;Accepts:Any - (17:0,17) - Tokens:1 - HtmlTokenType.SingleQuote;[']; + SyntaxKind.SingleQuote;[']; Markup span - Gen - [ />] - SpanEditHandler;Accepts:None - (18:0,18) - Tokens:3 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.CloseAngle;[>]; Code span - Gen - [] - SpanEditHandler;Accepts:Any - (21:0,21) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (21:0,21) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionBetweenAttributeValue_DoesNotThrow.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionBetweenAttributeValue_DoesNotThrow.stree.txt index 6ec5d3f78a..028b870a53 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionBetweenAttributeValue_DoesNotThrow.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionBetweenAttributeValue_DoesNotThrow.stree.txt @@ -1,35 +1,35 @@ Statement block - Gen - 27 - (0:0,0) MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 25 - (1:0,1) Tag block - Gen - 25 - (1:0,1) Markup span - Gen - [ - 17 - (6:0,6) Markup span - Gen - [ foo='] - SpanEditHandler;Accepts:Any - (6:0,6) - Tokens:4 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[foo]; - HtmlTokenType.Equals;[=]; - HtmlTokenType.SingleQuote;[']; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[foo]; + SyntaxKind.Equals;[=]; + SyntaxKind.SingleQuote;[']; Markup span - Gen - [abc] - SpanEditHandler;Accepts:Any - (12:0,12) - Tokens:1 - HtmlTokenType.Text;[abc]; + SyntaxKind.Text;[abc]; Markup block - Gen - 3 - (15:0,15) Markup span - Gen - [ @] - SpanEditHandler;Accepts:None - (15:0,15) - Tokens:2 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Transition;[@]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Transition;[@]; Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (17:0,17) - Tokens:1 - HtmlTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Markup span - Gen - [ def] - SpanEditHandler;Accepts:Any - (18:0,18) - Tokens:2 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[def]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[def]; Markup span - Gen - ['] - SpanEditHandler;Accepts:Any - (22:0,22) - Tokens:1 - HtmlTokenType.SingleQuote;[']; + SyntaxKind.SingleQuote;[']; Markup span - Gen - [ />] - SpanEditHandler;Accepts:None - (23:0,23) - Tokens:3 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.CloseAngle;[>]; Code span - Gen - [] - SpanEditHandler;Accepts:Any - (26:0,26) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (26:0,26) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionInAttributeValue_DoesNotThrow.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionInAttributeValue_DoesNotThrow.stree.txt index 89200d1412..b979bc3645 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionInAttributeValue_DoesNotThrow.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionInAttributeValue_DoesNotThrow.stree.txt @@ -1,29 +1,29 @@ Statement block - Gen - 19 - (0:0,0) MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 17 - (1:0,1) Tag block - Gen - 17 - (1:0,1) Markup span - Gen - [ - 9 - (6:0,6) Markup span - Gen - [ foo='] - SpanEditHandler;Accepts:Any - (6:0,6) - Tokens:4 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[foo]; - HtmlTokenType.Equals;[=]; - HtmlTokenType.SingleQuote;[']; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[foo]; + SyntaxKind.Equals;[=]; + SyntaxKind.SingleQuote;[']; Markup block - Gen - 2 - (12:0,12) Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (12:0,12) - Tokens:1 - HtmlTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 - HtmlTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Markup span - Gen - ['] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - HtmlTokenType.SingleQuote;[']; + SyntaxKind.SingleQuote;[']; Markup span - Gen - [ />] - SpanEditHandler;Accepts:None - (15:0,15) - Tokens:3 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.CloseAngle;[>]; Code span - Gen - [] - SpanEditHandler;Accepts:Any - (18:0,18) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (18:0,18) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionInEmail_DoesNotThrow.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionInEmail_DoesNotThrow.stree.txt index 5ff6c98e4d..1d16ff79f2 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionInEmail_DoesNotThrow.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionInEmail_DoesNotThrow.stree.txt @@ -1,42 +1,42 @@ Statement block - Gen - 44 - (0:0,0) MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 42 - (1:0,1) Tag block - Gen - 42 - (1:0,1) Markup span - Gen - [ - 34 - (6:0,6) Markup span - Gen - [ foo='] - SpanEditHandler;Accepts:Any - (6:0,6) - Tokens:4 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[foo]; - HtmlTokenType.Equals;[=]; - HtmlTokenType.SingleQuote;[']; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[foo]; + SyntaxKind.Equals;[=]; + SyntaxKind.SingleQuote;[']; Markup span - Gen - [abc@def.com] - SpanEditHandler;Accepts:Any - (12:0,12) - Tokens:1 - HtmlTokenType.Text;[abc@def.com]; + SyntaxKind.Text;[abc@def.com]; Markup span - Gen - [ abc] - SpanEditHandler;Accepts:Any - (23:0,23) - Tokens:2 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[abc]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[abc]; Markup block - Gen - 2 - (27:0,27) Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (27:0,27) - Tokens:1 - HtmlTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (28:0,28) - Tokens:1 - HtmlTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Markup span - Gen - [def.com] - SpanEditHandler;Accepts:Any - (29:0,29) - Tokens:1 - HtmlTokenType.Text;[def.com]; + SyntaxKind.Text;[def.com]; Markup block - Gen - 3 - (36:0,36) Markup span - Gen - [ @] - SpanEditHandler;Accepts:None - (36:0,36) - Tokens:2 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Transition;[@]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Transition;[@]; Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (38:0,38) - Tokens:1 - HtmlTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Markup span - Gen - ['] - SpanEditHandler;Accepts:Any - (39:0,39) - Tokens:1 - HtmlTokenType.SingleQuote;[']; + SyntaxKind.SingleQuote;[']; Markup span - Gen - [ />] - SpanEditHandler;Accepts:None - (40:0,40) - Tokens:3 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.CloseAngle;[>]; Code span - Gen - [] - SpanEditHandler;Accepts:Any - (43:0,43) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (43:0,43) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionInRegex_DoesNotThrow.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionInRegex_DoesNotThrow.stree.txt index ae6eb40508..759fea4f4a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionInRegex_DoesNotThrow.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionInRegex_DoesNotThrow.stree.txt @@ -1,75 +1,75 @@ Statement block - Gen - 117 - (0:0,0) MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 115 - (1:0,1) Tag block - Gen - 115 - (1:0,1) Markup span - Gen - [ - 107 - (6:0,6) Markup span - Gen - [ foo="] - SpanEditHandler;Accepts:Any - (6:0,6) - Tokens:4 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[foo]; - HtmlTokenType.Equals;[=]; - HtmlTokenType.DoubleQuote;["]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[foo]; + SyntaxKind.Equals;[=]; + SyntaxKind.DoubleQuote;["]; Markup span - Gen - [/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+] - SpanEditHandler;Accepts:Any - (12:0,12) - Tokens:14 - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[^]; - HtmlTokenType.LeftBracket;[[]; - HtmlTokenType.Text;[a-z0-9]; - HtmlTokenType.Bang;[!]; - HtmlTokenType.Text;[#$%&]; - HtmlTokenType.SingleQuote;[']; - HtmlTokenType.Text;[*+\]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Equals;[=]; - HtmlTokenType.QuestionMark;[?]; - HtmlTokenType.Text;[^_`{|}~.-]; - HtmlTokenType.RightBracket;[]]; - HtmlTokenType.Text;[+]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[^]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.Text;[a-z0-9]; + SyntaxKind.Bang;[!]; + SyntaxKind.Text;[#$%&]; + SyntaxKind.SingleQuote;[']; + SyntaxKind.Text;[*+\]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Equals;[=]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.Text;[^_`{|}~.-]; + SyntaxKind.RightBracket;[]]; + SyntaxKind.Text;[+]; Markup block - Gen - 2 - (44:0,44) Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (44:0,44) - Tokens:1 - HtmlTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (45:0,45) - Tokens:1 - HtmlTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Markup span - Gen - [[a-z0-9]([a-z0-9-]*[a-z0-9])?\.([a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i] - SpanEditHandler;Accepts:Any - (46:0,46) - Tokens:30 - HtmlTokenType.LeftBracket;[[]; - HtmlTokenType.Text;[a-z0-9]; - HtmlTokenType.RightBracket;[]]; - HtmlTokenType.Text;[(]; - HtmlTokenType.LeftBracket;[[]; - HtmlTokenType.Text;[a-z0-9-]; - HtmlTokenType.RightBracket;[]]; - HtmlTokenType.Text;[*]; - HtmlTokenType.LeftBracket;[[]; - HtmlTokenType.Text;[a-z0-9]; - HtmlTokenType.RightBracket;[]]; - HtmlTokenType.Text;[)]; - HtmlTokenType.QuestionMark;[?]; - HtmlTokenType.Text;[\.(]; - HtmlTokenType.LeftBracket;[[]; - HtmlTokenType.Text;[a-z0-9]; - HtmlTokenType.RightBracket;[]]; - HtmlTokenType.Text;[(]; - HtmlTokenType.LeftBracket;[[]; - HtmlTokenType.Text;[a-z0-9-]; - HtmlTokenType.RightBracket;[]]; - HtmlTokenType.Text;[*]; - HtmlTokenType.LeftBracket;[[]; - HtmlTokenType.Text;[a-z0-9]; - HtmlTokenType.RightBracket;[]]; - HtmlTokenType.Text;[)]; - HtmlTokenType.QuestionMark;[?]; - HtmlTokenType.Text;[)*$]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[i]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.Text;[a-z0-9]; + SyntaxKind.RightBracket;[]]; + SyntaxKind.Text;[(]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.Text;[a-z0-9-]; + SyntaxKind.RightBracket;[]]; + SyntaxKind.Text;[*]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.Text;[a-z0-9]; + SyntaxKind.RightBracket;[]]; + SyntaxKind.Text;[)]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.Text;[\.(]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.Text;[a-z0-9]; + SyntaxKind.RightBracket;[]]; + SyntaxKind.Text;[(]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.Text;[a-z0-9-]; + SyntaxKind.RightBracket;[]]; + SyntaxKind.Text;[*]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.Text;[a-z0-9]; + SyntaxKind.RightBracket;[]]; + SyntaxKind.Text;[)]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.Text;[)*$]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[i]; Markup span - Gen - ["] - SpanEditHandler;Accepts:Any - (112:0,112) - Tokens:1 - HtmlTokenType.DoubleQuote;["]; + SyntaxKind.DoubleQuote;["]; Markup span - Gen - [ />] - SpanEditHandler;Accepts:None - (113:0,113) - Tokens:3 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.CloseAngle;[>]; Code span - Gen - [] - SpanEditHandler;Accepts:Any - (116:0,116) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (116:0,116) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionWithExpressionBlock_DoesNotThrow.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionWithExpressionBlock_DoesNotThrow.cspans.txt index 6f209128d6..59e39ab54c 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionWithExpressionBlock_DoesNotThrow.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionWithExpressionBlock_DoesNotThrow.cspans.txt @@ -18,17 +18,17 @@ Markup span at (33:0,33 [1] ) (Accepts:None) - Parent: Markup block at (33:0,33 Markup span at (34:0,34 [1] ) (Accepts:None) - Parent: Markup block at (33:0,33 [2] ) Markup span at (35:0,35 [0] ) (Accepts:Any) - Parent: Markup block at (35:0,35 [13] ) Transition span at (35:0,35 [1] ) (Accepts:None) - Parent: Expression block at (35:0,35 [13] ) -Code span at (36:0,36 [12] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (35:0,35 [13] ) +Code span at (36:0,36 [12] ) (Accepts:NonWhitespace) - Parent: Expression block at (35:0,35 [13] ) Markup span at (48:0,48 [1] ) (Accepts:Any) - Parent: Markup block at (21:0,21 [28] ) Markup span at (49:0,49 [6] ) (Accepts:Any) - Parent: Markup block at (49:0,49 [22] ) Transition span at (55:0,55 [1] ) (Accepts:None) - Parent: Expression block at (55:0,55 [13] ) -Code span at (56:0,56 [12] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (55:0,55 [13] ) +Code span at (56:0,56 [12] ) (Accepts:NonWhitespace) - Parent: Expression block at (55:0,55 [13] ) Markup span at (68:0,68 [1] ) (Accepts:None) - Parent: Markup block at (68:0,68 [2] ) Markup span at (69:0,69 [1] ) (Accepts:None) - Parent: Markup block at (68:0,68 [2] ) Markup span at (70:0,70 [1] ) (Accepts:Any) - Parent: Markup block at (49:0,49 [22] ) Markup span at (71:0,71 [6] ) (Accepts:Any) - Parent: Markup block at (71:0,71 [23] ) Transition span at (77:0,77 [1] ) (Accepts:None) - Parent: Expression block at (77:0,77 [13] ) -Code span at (78:0,78 [12] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (77:0,77 [13] ) +Code span at (78:0,78 [12] ) (Accepts:NonWhitespace) - Parent: Expression block at (77:0,77 [13] ) Markup span at (90:0,90 [2] ) (Accepts:None) - Parent: Markup block at (90:0,90 [3] ) Markup span at (92:0,92 [1] ) (Accepts:None) - Parent: Markup block at (90:0,90 [3] ) Markup span at (93:0,93 [1] ) (Accepts:Any) - Parent: Markup block at (71:0,71 [23] ) @@ -37,7 +37,7 @@ Markup span at (100:0,100 [1] ) (Accepts:None) - Parent: Markup block at (100:0, Markup span at (101:0,101 [1] ) (Accepts:None) - Parent: Markup block at (100:0,100 [2] ) Markup span at (102:0,102 [0] ) (Accepts:Any) - Parent: Markup block at (102:0,102 [13] ) Transition span at (102:0,102 [1] ) (Accepts:None) - Parent: Expression block at (102:0,102 [13] ) -Code span at (103:0,103 [12] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (102:0,102 [13] ) +Code span at (103:0,103 [12] ) (Accepts:NonWhitespace) - Parent: Expression block at (102:0,102 [13] ) Markup span at (115:0,115 [1] ) (Accepts:Any) - Parent: Markup block at (94:0,94 [22] ) Markup span at (116:0,116 [3] ) (Accepts:None) - Parent: Tag block at (1:0,1 [118] ) Code span at (119:0,119 [0] ) (Accepts:Any) - Parent: Statement block at (0:0,0 [120] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionWithExpressionBlock_DoesNotThrow.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionWithExpressionBlock_DoesNotThrow.stree.txt index c50182aa59..a01eb4cccd 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionWithExpressionBlock_DoesNotThrow.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransitionWithExpressionBlock_DoesNotThrow.stree.txt @@ -1,144 +1,144 @@ Statement block - Gen - 120 - (0:0,0) MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 118 - (1:0,1) Tag block - Gen - 118 - (1:0,1) Markup span - Gen - [ - 15 - (6:0,6) Markup span - Gen - [ foo='] - SpanEditHandler;Accepts:Any - (6:0,6) - Tokens:4 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[foo]; - HtmlTokenType.Equals;[=]; - HtmlTokenType.SingleQuote;[']; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[foo]; + SyntaxKind.Equals;[=]; + SyntaxKind.SingleQuote;[']; Markup block - Gen - 2 - (12:0,12) Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (12:0,12) - Tokens:1 - HtmlTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 - HtmlTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Markup block - Gen - 6 - (14:0,14) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Expression block - Gen - 6 - (14:0,14) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (14:0,14) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (15:0,15) - Tokens:1 - CSharpTokenType.LeftParenthesis;[(]; + SyntaxKind.LeftParenthesis;[(]; Code span - Gen - [2+3] - SpanEditHandler;Accepts:Any - (16:0,16) - Tokens:3 - CSharpTokenType.IntegerLiteral;[2]; - CSharpTokenType.Plus;[+]; - CSharpTokenType.IntegerLiteral;[3]; + SyntaxKind.IntegerLiteral;[2]; + SyntaxKind.Plus;[+]; + SyntaxKind.IntegerLiteral;[3]; MetaCode span - Gen - [)] - SpanEditHandler;Accepts:None - (19:0,19) - Tokens:1 - CSharpTokenType.RightParenthesis;[)]; + SyntaxKind.RightParenthesis;[)]; Markup span - Gen - ['] - SpanEditHandler;Accepts:Any - (20:0,20) - Tokens:1 - HtmlTokenType.SingleQuote;[']; + SyntaxKind.SingleQuote;[']; Markup block - Gen - 28 - (21:0,21) Markup span - Gen - [ bar='] - SpanEditHandler;Accepts:Any - (21:0,21) - Tokens:4 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[bar]; - HtmlTokenType.Equals;[=]; - HtmlTokenType.SingleQuote;[']; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[bar]; + SyntaxKind.Equals;[=]; + SyntaxKind.SingleQuote;[']; Markup block - Gen - 6 - (27:0,27) Expression block - Gen - 6 - (27:0,27) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (27:0,27) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (28:0,28) - Tokens:1 - CSharpTokenType.LeftParenthesis;[(]; + SyntaxKind.LeftParenthesis;[(]; Code span - Gen - [2+3] - SpanEditHandler;Accepts:Any - (29:0,29) - Tokens:3 - CSharpTokenType.IntegerLiteral;[2]; - CSharpTokenType.Plus;[+]; - CSharpTokenType.IntegerLiteral;[3]; + SyntaxKind.IntegerLiteral;[2]; + SyntaxKind.Plus;[+]; + SyntaxKind.IntegerLiteral;[3]; MetaCode span - Gen - [)] - SpanEditHandler;Accepts:None - (32:0,32) - Tokens:1 - CSharpTokenType.RightParenthesis;[)]; + SyntaxKind.RightParenthesis;[)]; Markup block - Gen - 2 - (33:0,33) Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (33:0,33) - Tokens:1 - HtmlTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (34:0,34) - Tokens:1 - HtmlTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Markup block - Gen - 13 - (35:0,35) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (35:0,35) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Expression block - Gen - 13 - (35:0,35) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (35:0,35) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [DateTime.Now] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (36:0,36) - Tokens:3 - CSharpTokenType.Identifier;[DateTime]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Now]; + SyntaxKind.Transition;[@]; + Code span - Gen - [DateTime.Now] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (36:0,36) - Tokens:3 + SyntaxKind.Identifier;[DateTime]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Now]; Markup span - Gen - ['] - SpanEditHandler;Accepts:Any - (48:0,48) - Tokens:1 - HtmlTokenType.SingleQuote;[']; + SyntaxKind.SingleQuote;[']; Markup block - Gen - 22 - (49:0,49) Markup span - Gen - [ baz='] - SpanEditHandler;Accepts:Any - (49:0,49) - Tokens:4 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[baz]; - HtmlTokenType.Equals;[=]; - HtmlTokenType.SingleQuote;[']; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[baz]; + SyntaxKind.Equals;[=]; + SyntaxKind.SingleQuote;[']; Markup block - Gen - 13 - (55:0,55) Expression block - Gen - 13 - (55:0,55) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (55:0,55) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [DateTime.Now] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (56:0,56) - Tokens:3 - CSharpTokenType.Identifier;[DateTime]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Now]; + SyntaxKind.Transition;[@]; + Code span - Gen - [DateTime.Now] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (56:0,56) - Tokens:3 + SyntaxKind.Identifier;[DateTime]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Now]; Markup block - Gen - 2 - (68:0,68) Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (68:0,68) - Tokens:1 - HtmlTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (69:0,69) - Tokens:1 - HtmlTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Markup span - Gen - ['] - SpanEditHandler;Accepts:Any - (70:0,70) - Tokens:1 - HtmlTokenType.SingleQuote;[']; + SyntaxKind.SingleQuote;[']; Markup block - Gen - 23 - (71:0,71) Markup span - Gen - [ bat='] - SpanEditHandler;Accepts:Any - (71:0,71) - Tokens:4 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[bat]; - HtmlTokenType.Equals;[=]; - HtmlTokenType.SingleQuote;[']; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[bat]; + SyntaxKind.Equals;[=]; + SyntaxKind.SingleQuote;[']; Markup block - Gen - 13 - (77:0,77) Expression block - Gen - 13 - (77:0,77) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (77:0,77) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [DateTime.Now] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (78:0,78) - Tokens:3 - CSharpTokenType.Identifier;[DateTime]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Now]; + SyntaxKind.Transition;[@]; + Code span - Gen - [DateTime.Now] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (78:0,78) - Tokens:3 + SyntaxKind.Identifier;[DateTime]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Now]; Markup block - Gen - 3 - (90:0,90) Markup span - Gen - [ @] - SpanEditHandler;Accepts:None - (90:0,90) - Tokens:2 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Transition;[@]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Transition;[@]; Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (92:0,92) - Tokens:1 - HtmlTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Markup span - Gen - ['] - SpanEditHandler;Accepts:Any - (93:0,93) - Tokens:1 - HtmlTokenType.SingleQuote;[']; + SyntaxKind.SingleQuote;[']; Markup block - Gen - 22 - (94:0,94) Markup span - Gen - [ zoo='] - SpanEditHandler;Accepts:Any - (94:0,94) - Tokens:4 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[zoo]; - HtmlTokenType.Equals;[=]; - HtmlTokenType.SingleQuote;[']; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[zoo]; + SyntaxKind.Equals;[=]; + SyntaxKind.SingleQuote;[']; Markup block - Gen - 2 - (100:0,100) Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (100:0,100) - Tokens:1 - HtmlTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (101:0,101) - Tokens:1 - HtmlTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Markup block - Gen - 13 - (102:0,102) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (102:0,102) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Expression block - Gen - 13 - (102:0,102) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (102:0,102) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [DateTime.Now] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (103:0,103) - Tokens:3 - CSharpTokenType.Identifier;[DateTime]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Now]; + SyntaxKind.Transition;[@]; + Code span - Gen - [DateTime.Now] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (103:0,103) - Tokens:3 + SyntaxKind.Identifier;[DateTime]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Now]; Markup span - Gen - ['] - SpanEditHandler;Accepts:Any - (115:0,115) - Tokens:1 - HtmlTokenType.SingleQuote;[']; + SyntaxKind.SingleQuote;[']; Markup span - Gen - [ />] - SpanEditHandler;Accepts:None - (116:0,116) - Tokens:3 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.CloseAngle;[>]; Code span - Gen - [] - SpanEditHandler;Accepts:Any - (119:0,119) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (119:0,119) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransition_EndOfFile_Throws.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransition_EndOfFile_Throws.stree.txt index 2f4c6d6bfd..f37297146b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransition_EndOfFile_Throws.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithDoubleTransition_EndOfFile_Throws.stree.txt @@ -1,21 +1,21 @@ Statement block - Gen - 14 - (0:0,0) MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 13 - (1:0,1) Tag block - Gen - 13 - (1:0,1) Markup span - Gen - [ - 2 - (12:0,12) Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (12:0,12) - Tokens:1 - HtmlTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 - HtmlTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithUnexpectedTransitionsInAttributeValue_Throws.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithUnexpectedTransitionsInAttributeValue_Throws.cspans.txt index 0625febbf9..104cc1143d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithUnexpectedTransitionsInAttributeValue_Throws.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithUnexpectedTransitionsInAttributeValue_Throws.cspans.txt @@ -2,10 +2,10 @@ MetaCode span at (0:0,0 [1] ) (Accepts:None) - Parent: Statement block at (0:0,0 Markup span at (1:0,1 [5] ) (Accepts:Any) - Parent: Tag block at (1:0,1 [18] ) Markup span at (6:0,6 [6] ) (Accepts:Any) - Parent: Markup block at (6:0,6 [10] ) Transition span at (12:0,12 [1] ) (Accepts:None) - Parent: Expression block at (12:0,12 [1] ) -Code span at (13:0,13 [0] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (12:0,12 [1] ) +Code span at (13:0,13 [0] ) (Accepts:NonWhitespace) - Parent: Expression block at (12:0,12 [1] ) Markup span at (13:0,13 [1] ) (Accepts:Any) - Parent: Markup block at (13:0,13 [2] ) Transition span at (14:0,14 [1] ) (Accepts:None) - Parent: Expression block at (14:0,14 [1] ) -Code span at (15:0,15 [0] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (14:0,14 [1] ) +Code span at (15:0,15 [0] ) (Accepts:NonWhitespace) - Parent: Expression block at (14:0,14 [1] ) Markup span at (15:0,15 [1] ) (Accepts:Any) - Parent: Markup block at (6:0,6 [10] ) Markup span at (16:0,16 [3] ) (Accepts:None) - Parent: Tag block at (1:0,1 [18] ) Code span at (19:0,19 [0] ) (Accepts:Any) - Parent: Statement block at (0:0,0 [20] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithUnexpectedTransitionsInAttributeValue_Throws.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithUnexpectedTransitionsInAttributeValue_Throws.stree.txt index cfd73bfa96..7ba0223716 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithUnexpectedTransitionsInAttributeValue_Throws.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpBlockTest/WithUnexpectedTransitionsInAttributeValue_Throws.stree.txt @@ -1,38 +1,38 @@ Statement block - Gen - 20 - (0:0,0) MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 18 - (1:0,1) Tag block - Gen - 18 - (1:0,1) Markup span - Gen - [ - 10 - (6:0,6) Markup span - Gen - [ foo='] - SpanEditHandler;Accepts:Any - (6:0,6) - Tokens:4 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[foo]; - HtmlTokenType.Equals;[=]; - HtmlTokenType.SingleQuote;[']; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[foo]; + SyntaxKind.Equals;[=]; + SyntaxKind.SingleQuote;[']; Markup block - Gen - 1 - (12:0,12) Expression block - Gen - 1 - (12:0,12) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (12:0,12) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (13:0,13) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Transition;[@]; + Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (13:0,13) - Tokens:1 + SyntaxKind.Unknown;[]; Markup block - Gen - 2 - (13:0,13) Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (13:0,13) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Expression block - Gen - 1 - (14:0,14) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (14:0,14) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (15:0,15) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Transition;[@]; + Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (15:0,15) - Tokens:1 + SyntaxKind.Unknown;[]; Markup span - Gen - ['] - SpanEditHandler;Accepts:Any - (15:0,15) - Tokens:1 - HtmlTokenType.SingleQuote;[']; + SyntaxKind.SingleQuote;[']; Markup span - Gen - [ />] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:3 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.CloseAngle;[>]; Code span - Gen - [] - SpanEditHandler;Accepts:Any - (19:0,19) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (19:0,19) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_EndQuoteRequiresDoubleQuotesAroundValue.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_EndQuoteRequiresDoubleQuotesAroundValue.cspans.txt index 8fa8983d5e..90b83a758f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_EndQuoteRequiresDoubleQuotesAroundValue.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_EndQuoteRequiresDoubleQuotesAroundValue.cspans.txt @@ -1,4 +1,6 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [18] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [18] ) MetaCode span at (1:0,1 [12] ) (Accepts:None) - Parent: Directive block at (0:0,0 [18] ) Markup span at (13:0,13 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [18] ) Code span at (14:0,14 [4] ) (Accepts:AnyExceptNewline) - Parent: Directive block at (0:0,0 [18] ) +Markup span at (18:0,18 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [18] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_EndQuoteRequiresDoubleQuotesAroundValue.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_EndQuoteRequiresDoubleQuotesAroundValue.stree.txt index 0b3a224f4b..bbf68175e3 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_EndQuoteRequiresDoubleQuotesAroundValue.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_EndQuoteRequiresDoubleQuotesAroundValue.stree.txt @@ -1,10 +1,15 @@ -Directive block - Gen - 18 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [addTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[addTagHelper]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [Foo"] - SpanEditHandler;Accepts:AnyExceptNewline - (14:0,14) - Tokens:2 - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.StringLiteral;["];RZ1000(17:0,17 [1] ) +Markup block - Gen - 18 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 18 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [addTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[addTagHelper]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [Foo"] - SpanEditHandler;Accepts:AnyExceptNewline - (14:0,14) - Tokens:2 + SyntaxKind.Identifier;[Foo]; + SyntaxKind.StringLiteral;["];RZ1000(17:0,17 [1] ) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (18:0,18) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_InvalidLookupText_AddsError.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_InvalidLookupText_AddsError.cspans.txt index 46934861be..bb83fe7c4c 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_InvalidLookupText_AddsError.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_InvalidLookupText_AddsError.cspans.txt @@ -1,4 +1,6 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [17] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [17] ) MetaCode span at (1:0,1 [12] ) (Accepts:None) - Parent: Directive block at (0:0,0 [17] ) Markup span at (13:0,13 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [17] ) Code span at (14:0,14 [3] ) (Accepts:AnyExceptNewline) - Parent: Directive block at (0:0,0 [17] ) +Markup span at (17:0,17 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [17] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_InvalidLookupText_AddsError.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_InvalidLookupText_AddsError.stree.txt index 138d746a0d..79078bb11d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_InvalidLookupText_AddsError.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_InvalidLookupText_AddsError.stree.txt @@ -1,9 +1,14 @@ -Directive block - Gen - 17 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [addTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[addTagHelper]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [Foo] - SpanEditHandler;Accepts:AnyExceptNewline - (14:0,14) - Tokens:1 - CSharpTokenType.Identifier;[Foo]; +Markup block - Gen - 17 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 17 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [addTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[addTagHelper]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [Foo] - SpanEditHandler;Accepts:AnyExceptNewline - (14:0,14) - Tokens:1 + SyntaxKind.Identifier;[Foo]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (17:0,17) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_NoValue_Invalid.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_NoValue_Invalid.cspans.txt index 6691c76927..25806343ae 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_NoValue_Invalid.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_NoValue_Invalid.cspans.txt @@ -1,4 +1,6 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [16] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [16] ) MetaCode span at (1:0,1 [12] ) (Accepts:None) - Parent: Directive block at (0:0,0 [16] ) Markup span at (13:0,13 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [16] ) Code span at (14:0,14 [2] ) (Accepts:AnyExceptNewline) - Parent: Directive block at (0:0,0 [16] ) +Markup span at (16:0,16 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [16] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_NoValue_Invalid.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_NoValue_Invalid.stree.txt index 9f107f20c1..c9aaa1ef64 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_NoValue_Invalid.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_NoValue_Invalid.stree.txt @@ -1,9 +1,14 @@ -Directive block - Gen - 16 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [addTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[addTagHelper]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [""] - SpanEditHandler;Accepts:AnyExceptNewline - (14:0,14) - Tokens:1 - CSharpTokenType.StringLiteral;[""]; +Markup block - Gen - 16 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 16 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [addTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[addTagHelper]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [""] - SpanEditHandler;Accepts:AnyExceptNewline - (14:0,14) - Tokens:1 + SyntaxKind.StringLiteral;[""]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (16:0,16) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_RequiresValue.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_RequiresValue.cspans.txt index b1d833a6db..61be581b1c 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_RequiresValue.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_RequiresValue.cspans.txt @@ -1,4 +1,6 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [14] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [14] ) MetaCode span at (1:0,1 [12] ) (Accepts:None) - Parent: Directive block at (0:0,0 [14] ) Markup span at (13:0,13 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [14] ) Code span at (14:0,14 [0] ) (Accepts:AnyExceptNewline) - Parent: Directive block at (0:0,0 [14] ) +Markup span at (14:0,14 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [14] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_RequiresValue.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_RequiresValue.stree.txt index 56dc421136..d93518bab5 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_RequiresValue.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_RequiresValue.stree.txt @@ -1,9 +1,14 @@ -Directive block - Gen - 14 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [addTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[addTagHelper]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [] - SpanEditHandler;Accepts:AnyExceptNewline - (14:0,14) - Tokens:1 - CSharpTokenType.Unknown;[]; +Markup block - Gen - 14 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 14 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [addTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[addTagHelper]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [] - SpanEditHandler;Accepts:AnyExceptNewline - (14:0,14) - Tokens:1 + SyntaxKind.Unknown;[]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_SingleQuotes_AddsError.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_SingleQuotes_AddsError.cspans.txt index 2739fb7f95..4810545912 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_SingleQuotes_AddsError.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_SingleQuotes_AddsError.cspans.txt @@ -1,4 +1,6 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [22] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [22] ) MetaCode span at (1:0,1 [12] ) (Accepts:None) - Parent: Directive block at (0:0,0 [22] ) Markup span at (13:0,13 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [22] ) Code span at (14:0,14 [8] ) (Accepts:AnyExceptNewline) - Parent: Directive block at (0:0,0 [22] ) +Markup span at (22:0,22 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [22] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_SingleQuotes_AddsError.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_SingleQuotes_AddsError.stree.txt index e6d7ba0e8f..592fbdc992 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_SingleQuotes_AddsError.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_SingleQuotes_AddsError.stree.txt @@ -1,9 +1,14 @@ -Directive block - Gen - 22 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [addTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[addTagHelper]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - ['*, Foo'] - SpanEditHandler;Accepts:AnyExceptNewline - (14:0,14) - Tokens:1 - CSharpTokenType.CharacterLiteral;['*, Foo']; +Markup block - Gen - 22 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 22 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [addTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[addTagHelper]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - ['*, Foo'] - SpanEditHandler;Accepts:AnyExceptNewline - (14:0,14) - Tokens:1 + SyntaxKind.CharacterLiteral;['*, Foo']; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (22:0,22) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_StartQuoteRequiresDoubleQuotesAroundValue.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_StartQuoteRequiresDoubleQuotesAroundValue.cspans.txt index 8fa8983d5e..90b83a758f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_StartQuoteRequiresDoubleQuotesAroundValue.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_StartQuoteRequiresDoubleQuotesAroundValue.cspans.txt @@ -1,4 +1,6 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [18] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [18] ) MetaCode span at (1:0,1 [12] ) (Accepts:None) - Parent: Directive block at (0:0,0 [18] ) Markup span at (13:0,13 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [18] ) Code span at (14:0,14 [4] ) (Accepts:AnyExceptNewline) - Parent: Directive block at (0:0,0 [18] ) +Markup span at (18:0,18 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [18] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_StartQuoteRequiresDoubleQuotesAroundValue.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_StartQuoteRequiresDoubleQuotesAroundValue.stree.txt index 817474e23d..83778385b1 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_StartQuoteRequiresDoubleQuotesAroundValue.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_StartQuoteRequiresDoubleQuotesAroundValue.stree.txt @@ -1,9 +1,14 @@ -Directive block - Gen - 18 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [addTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[addTagHelper]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - ["Foo] - SpanEditHandler;Accepts:AnyExceptNewline - (14:0,14) - Tokens:1 - CSharpTokenType.StringLiteral;["Foo];RZ1000(14:0,14 [1] ) +Markup block - Gen - 18 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 18 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [addTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[addTagHelper]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - ["Foo] - SpanEditHandler;Accepts:AnyExceptNewline - (14:0,14) - Tokens:1 + SyntaxKind.StringLiteral;["Foo];RZ1000(14:0,14 [1] ) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (18:0,18) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_SupportsSpaces.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_SupportsSpaces.cspans.txt index a4a9f85b10..1a383325f7 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_SupportsSpaces.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_SupportsSpaces.cspans.txt @@ -1,4 +1,6 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [32] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [32] ) MetaCode span at (1:0,1 [12] ) (Accepts:None) - Parent: Directive block at (0:0,0 [32] ) Markup span at (13:0,13 [5] ) (Accepts:None) - Parent: Directive block at (0:0,0 [32] ) Code span at (18:0,18 [14] ) (Accepts:AnyExceptNewline) - Parent: Directive block at (0:0,0 [32] ) +Markup span at (32:0,32 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [32] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_SupportsSpaces.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_SupportsSpaces.stree.txt index 7b55abb278..2d2db1bc47 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_SupportsSpaces.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_SupportsSpaces.stree.txt @@ -1,13 +1,18 @@ -Directive block - Gen - 32 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [addTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[addTagHelper]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [Foo, Bar ] - SpanEditHandler;Accepts:AnyExceptNewline - (18:0,18) - Tokens:5 - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.Comma;[,]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.WhiteSpace;[ ]; +Markup block - Gen - 32 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 32 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [addTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[addTagHelper]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [Foo, Bar ] - SpanEditHandler;Accepts:AnyExceptNewline - (18:0,18) - Tokens:5 + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Comma;[,]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Whitespace;[ ]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (32:0,32) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_WithQuotes_InvalidLookupText_AddsError.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_WithQuotes_InvalidLookupText_AddsError.cspans.txt index 7868088eef..3b7dd42093 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_WithQuotes_InvalidLookupText_AddsError.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_WithQuotes_InvalidLookupText_AddsError.cspans.txt @@ -1,4 +1,6 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [19] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [19] ) MetaCode span at (1:0,1 [12] ) (Accepts:None) - Parent: Directive block at (0:0,0 [19] ) Markup span at (13:0,13 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [19] ) Code span at (14:0,14 [5] ) (Accepts:AnyExceptNewline) - Parent: Directive block at (0:0,0 [19] ) +Markup span at (19:0,19 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [19] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_WithQuotes_InvalidLookupText_AddsError.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_WithQuotes_InvalidLookupText_AddsError.stree.txt index e009495ff2..06397a1d27 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_WithQuotes_InvalidLookupText_AddsError.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/AddTagHelperDirective_WithQuotes_InvalidLookupText_AddsError.stree.txt @@ -1,9 +1,14 @@ -Directive block - Gen - 19 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [addTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[addTagHelper]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - ["Foo"] - SpanEditHandler;Accepts:AnyExceptNewline - (14:0,14) - Tokens:1 - CSharpTokenType.StringLiteral;["Foo"]; +Markup block - Gen - 19 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 19 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [addTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[addTagHelper]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - ["Foo"] - SpanEditHandler;Accepts:AnyExceptNewline - (14:0,14) - Tokens:1 + SyntaxKind.StringLiteral;["Foo"]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (19:0,19) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/BuiltInDirectiveDoesNotErorrIfNotAtStartOfLineBecauseOfWhitespace.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/BuiltInDirectiveDoesNotErorrIfNotAtStartOfLineBecauseOfWhitespace.cspans.txt index dd5b3b78c7..597dd73020 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/BuiltInDirectiveDoesNotErorrIfNotAtStartOfLineBecauseOfWhitespace.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/BuiltInDirectiveDoesNotErorrIfNotAtStartOfLineBecauseOfWhitespace.cspans.txt @@ -1,5 +1,7 @@ -Code span at (0:0,0 [4] ) (Accepts:Any) - Parent: Directive block at (0:0,0 [26] ) -Transition span at (4:1,2 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [26] ) -MetaCode span at (5:1,3 [12] ) (Accepts:None) - Parent: Directive block at (0:0,0 [26] ) -Markup span at (17:1,15 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [26] ) -Code span at (18:1,16 [8] ) (Accepts:AnyExceptNewline) - Parent: Directive block at (0:0,0 [26] ) +Markup span at (0:0,0 [2] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [26] ) +Code span at (2:1,0 [2] ) (Accepts:Any) - Parent: Directive block at (2:1,0 [24] ) +Transition span at (4:1,2 [1] ) (Accepts:None) - Parent: Directive block at (2:1,0 [24] ) +MetaCode span at (5:1,3 [12] ) (Accepts:None) - Parent: Directive block at (2:1,0 [24] ) +Markup span at (17:1,15 [1] ) (Accepts:None) - Parent: Directive block at (2:1,0 [24] ) +Code span at (18:1,16 [8] ) (Accepts:AnyExceptNewline) - Parent: Directive block at (2:1,0 [24] ) +Markup span at (26:1,24 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [26] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/BuiltInDirectiveDoesNotErorrIfNotAtStartOfLineBecauseOfWhitespace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/BuiltInDirectiveDoesNotErorrIfNotAtStartOfLineBecauseOfWhitespace.stree.txt index 642f0611e8..2e4413ce6d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/BuiltInDirectiveDoesNotErorrIfNotAtStartOfLineBecauseOfWhitespace.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/BuiltInDirectiveDoesNotErorrIfNotAtStartOfLineBecauseOfWhitespace.stree.txt @@ -1,12 +1,16 @@ -Directive block - Gen - 26 - (0:0,0) - Code span - Gen - [LF ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:2 - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (4:1,2) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [addTagHelper] - SpanEditHandler;Accepts:None - (5:1,3) - Tokens:1 - CSharpTokenType.Identifier;[addTagHelper]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (17:1,15) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - ["*, Foo"] - SpanEditHandler;Accepts:AnyExceptNewline - (18:1,16) - Tokens:1 - CSharpTokenType.StringLiteral;["*, Foo"]; +Markup block - Gen - 26 - (0:0,0) + Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.NewLine;[LF]; + Directive block - Gen - 24 - (2:1,0) + Code span - Gen - [ ] - SpanEditHandler;Accepts:Any - (2:1,0) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (4:1,2) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [addTagHelper] - SpanEditHandler;Accepts:None - (5:1,3) - Tokens:1 + SyntaxKind.Identifier;[addTagHelper]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (17:1,15) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - ["*, Foo"] - SpanEditHandler;Accepts:AnyExceptNewline - (18:1,16) - Tokens:1 + SyntaxKind.StringLiteral;["*, Foo"]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (26:1,24) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/BuiltInDirectiveErrorsIfNotAtStartOfLine.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/BuiltInDirectiveErrorsIfNotAtStartOfLine.cspans.txt index a5e15b9d8e..8caeeee11d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/BuiltInDirectiveErrorsIfNotAtStartOfLine.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/BuiltInDirectiveErrorsIfNotAtStartOfLine.cspans.txt @@ -1,8 +1,6 @@ -MetaCode span at (0:0,0 [1] ) (Accepts:None) - Parent: Statement block at (0:0,0 [28] ) -Code span at (1:0,1 [2] ) (Accepts:Any) - Parent: Statement block at (0:0,0 [28] ) -Transition span at (3:0,3 [1] ) (Accepts:None) - Parent: Directive block at (3:0,3 [22] ) -MetaCode span at (4:0,4 [12] ) (Accepts:None) - Parent: Directive block at (3:0,3 [22] ) -Markup span at (16:0,16 [1] ) (Accepts:None) - Parent: Directive block at (3:0,3 [22] ) -Code span at (17:0,17 [8] ) (Accepts:AnyExceptNewline) - Parent: Directive block at (3:0,3 [22] ) -Code span at (25:0,25 [2] ) (Accepts:Any) - Parent: Statement block at (0:0,0 [28] ) -MetaCode span at (27:1,0 [1] ) (Accepts:None) - Parent: Statement block at (0:0,0 [28] ) +Markup span at (0:0,0 [3] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [28] ) +Transition span at (3:0,3 [1] ) (Accepts:None) - Parent: Directive block at (3:0,3 [24] ) +MetaCode span at (4:0,4 [12] ) (Accepts:None) - Parent: Directive block at (3:0,3 [24] ) +Markup span at (16:0,16 [1] ) (Accepts:None) - Parent: Directive block at (3:0,3 [24] ) +Code span at (17:0,17 [10] ) (Accepts:AnyExceptNewline) - Parent: Directive block at (3:0,3 [24] ) +Markup span at (27:1,0 [1] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [28] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/BuiltInDirectiveErrorsIfNotAtStartOfLine.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/BuiltInDirectiveErrorsIfNotAtStartOfLine.stree.txt index 2d4ada75c3..6c90f6f466 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/BuiltInDirectiveErrorsIfNotAtStartOfLine.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/BuiltInDirectiveErrorsIfNotAtStartOfLine.stree.txt @@ -1,18 +1,16 @@ -Statement block - Gen - 28 - (0:0,0) - MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; - Code span - Gen - [ ] - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[];AtEOL - (1:0,1) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Directive block - Gen - 22 - (3:0,3) +Markup block - Gen - 28 - (0:0,0) + Markup span - Gen - [{ ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:2 + SyntaxKind.Text;[{]; + SyntaxKind.Whitespace;[ ]; + Directive block - Gen - 24 - (3:0,3) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (3:0,3) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [addTagHelper] - SpanEditHandler;Accepts:None - (4:0,4) - Tokens:1 - CSharpTokenType.Identifier;[addTagHelper]; + SyntaxKind.Identifier;[addTagHelper]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - ["*, Foo"] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 - CSharpTokenType.StringLiteral;["*, Foo"]; - Code span - Gen - [LF] - SpanEditHandler;Accepts:Any - (25:0,25) - Tokens:1 - CSharpTokenType.NewLine;[LF]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (27:1,0) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + Code span - Gen - ["*, Foo"LF] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:2 + SyntaxKind.StringLiteral;["*, Foo"]; + SyntaxKind.NewLine;[LF]; + Markup span - Gen - [}] - SpanEditHandler;Accepts:Any - (27:1,0) - Tokens:1 + SyntaxKind.Text;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsNullableTypes.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsNullableTypes.cspans.txt index 39e6ab11a0..c23d9ce5f6 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsNullableTypes.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsNullableTypes.cspans.txt @@ -1,14 +1,16 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [176] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [176] ) MetaCode span at (1:0,1 [6] ) (Accepts:None) - Parent: Directive block at (0:0,0 [176] ) -Code span at (7:0,7 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [176] ) -Code span at (8:0,8 [7] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [176] ) -Code span at (15:0,15 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [176] ) -Code span at (16:0,16 [9] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [176] ) -Code span at (25:0,25 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [176] ) -Code span at (26:0,26 [21] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [176] ) -Code span at (47:0,47 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [176] ) -Code span at (48:0,48 [29] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [176] ) -Code span at (77:0,77 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [176] ) -Code span at (78:0,78 [31] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [176] ) -Code span at (109:0,109 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [176] ) -Code span at (110:0,110 [66] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [176] ) +Code span at (7:0,7 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [176] ) +Code span at (8:0,8 [7] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [176] ) +Code span at (15:0,15 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [176] ) +Code span at (16:0,16 [9] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [176] ) +Code span at (25:0,25 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [176] ) +Code span at (26:0,26 [21] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [176] ) +Code span at (47:0,47 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [176] ) +Code span at (48:0,48 [29] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [176] ) +Code span at (77:0,77 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [176] ) +Code span at (78:0,78 [31] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [176] ) +Code span at (109:0,109 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [176] ) +Code span at (110:0,110 [66] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [176] ) +Markup span at (176:0,176 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [176] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsNullableTypes.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsNullableTypes.stree.txt index 9c4daa1e93..6a9b54398a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsNullableTypes.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsNullableTypes.stree.txt @@ -1,71 +1,76 @@ -Directive block - Gen - 176 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [string?] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:2 - CSharpTokenType.Keyword;[string]; - CSharpTokenType.QuestionMark;[?]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (15:0,15) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [string?[]] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (16:0,16) - Tokens:4 - CSharpTokenType.Keyword;[string]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.LeftBracket;[[]; - CSharpTokenType.RightBracket;[]]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (25:0,25) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [global::System.Int32?] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (26:0,26) - Tokens:6 - CSharpTokenType.Identifier;[global]; - CSharpTokenType.DoubleColon;[::]; - CSharpTokenType.Identifier;[System]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Int32]; - CSharpTokenType.QuestionMark;[?]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (47:0,47) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [KeyValuePair?] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (48:0,48) - Tokens:8 - CSharpTokenType.Identifier;[KeyValuePair]; - CSharpTokenType.LessThan;[<]; - CSharpTokenType.Keyword;[string]; - CSharpTokenType.Comma;[,]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[string]; - CSharpTokenType.GreaterThan;[>]; - CSharpTokenType.QuestionMark;[?]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (77:0,77) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [KeyValuePair?[]] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (78:0,78) - Tokens:10 - CSharpTokenType.Identifier;[KeyValuePair]; - CSharpTokenType.LessThan;[<]; - CSharpTokenType.Keyword;[string]; - CSharpTokenType.Comma;[,]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[string]; - CSharpTokenType.GreaterThan;[>]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.LeftBracket;[[]; - CSharpTokenType.RightBracket;[]]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (109:0,109) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [global::System.Collections.Generic.KeyValuePair?[]] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (110:0,110) - Tokens:18 - CSharpTokenType.Identifier;[global]; - CSharpTokenType.DoubleColon;[::]; - CSharpTokenType.Identifier;[System]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Collections]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Generic]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[KeyValuePair]; - CSharpTokenType.LessThan;[<]; - CSharpTokenType.Keyword;[string]; - CSharpTokenType.Comma;[,]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[string]; - CSharpTokenType.GreaterThan;[>]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.LeftBracket;[[]; - CSharpTokenType.RightBracket;[]]; +Markup block - Gen - 176 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 176 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[custom]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [string?] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:2 + SyntaxKind.Keyword;[string]; + SyntaxKind.QuestionMark;[?]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (15:0,15) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [string?[]] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (16:0,16) - Tokens:4 + SyntaxKind.Keyword;[string]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.RightBracket;[]]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (25:0,25) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [global::System.Int32?] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (26:0,26) - Tokens:6 + SyntaxKind.Identifier;[global]; + SyntaxKind.DoubleColon;[::]; + SyntaxKind.Identifier;[System]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Int32]; + SyntaxKind.QuestionMark;[?]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (47:0,47) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [KeyValuePair?] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (48:0,48) - Tokens:8 + SyntaxKind.Identifier;[KeyValuePair]; + SyntaxKind.LessThan;[<]; + SyntaxKind.Keyword;[string]; + SyntaxKind.Comma;[,]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[string]; + SyntaxKind.GreaterThan;[>]; + SyntaxKind.QuestionMark;[?]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (77:0,77) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [KeyValuePair?[]] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (78:0,78) - Tokens:10 + SyntaxKind.Identifier;[KeyValuePair]; + SyntaxKind.LessThan;[<]; + SyntaxKind.Keyword;[string]; + SyntaxKind.Comma;[,]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[string]; + SyntaxKind.GreaterThan;[>]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.RightBracket;[]]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (109:0,109) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [global::System.Collections.Generic.KeyValuePair?[]] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (110:0,110) - Tokens:18 + SyntaxKind.Identifier;[global]; + SyntaxKind.DoubleColon;[::]; + SyntaxKind.Identifier;[System]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Collections]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Generic]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[KeyValuePair]; + SyntaxKind.LessThan;[<]; + SyntaxKind.Keyword;[string]; + SyntaxKind.Comma;[,]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[string]; + SyntaxKind.GreaterThan;[>]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.RightBracket;[]]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (176:0,176) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsTupleTypes.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsTupleTypes.cspans.txt index 0ab29a7f29..f0a1ad489a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsTupleTypes.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsTupleTypes.cspans.txt @@ -1,14 +1,16 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [246] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [246] ) MetaCode span at (1:0,1 [6] ) (Accepts:None) - Parent: Directive block at (0:0,0 [246] ) -Code span at (7:0,7 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [246] ) -Code span at (8:0,8 [11] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [246] ) -Code span at (19:0,19 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [246] ) -Code span at (20:0,20 [20] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [246] ) -Code span at (40:0,40 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [246] ) -Code span at (41:0,41 [29] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [246] ) -Code span at (70:0,70 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [246] ) -Code span at (71:0,71 [37] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [246] ) -Code span at (108:0,108 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [246] ) -Code span at (109:0,109 [36] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [246] ) -Code span at (145:0,145 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [246] ) -Code span at (146:0,146 [100] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [246] ) +Code span at (7:0,7 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [246] ) +Code span at (8:0,8 [11] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [246] ) +Code span at (19:0,19 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [246] ) +Code span at (20:0,20 [20] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [246] ) +Code span at (40:0,40 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [246] ) +Code span at (41:0,41 [29] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [246] ) +Code span at (70:0,70 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [246] ) +Code span at (71:0,71 [37] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [246] ) +Code span at (108:0,108 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [246] ) +Code span at (109:0,109 [36] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [246] ) +Code span at (145:0,145 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [246] ) +Code span at (146:0,146 [100] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [246] ) +Markup span at (246:0,246 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [246] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsTupleTypes.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsTupleTypes.stree.txt index f9e21e7409..1fca727de1 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsTupleTypes.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsTupleTypes.stree.txt @@ -1,155 +1,160 @@ -Directive block - Gen - 246 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [(bool, int)] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:6 - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[bool]; - CSharpTokenType.Comma;[,]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[int]; - CSharpTokenType.RightParenthesis;[)]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (19:0,19) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [(int aa, string bb)?] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (20:0,20) - Tokens:11 - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[int]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[aa]; - CSharpTokenType.Comma;[,]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[string]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bb]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.QuestionMark;[?]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (40:0,40) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [( int? q , bool w )] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (41:0,41) - Tokens:14 - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[int]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[q]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Comma;[,]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[bool]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[w]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightParenthesis;[)]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (70:0,70) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [( int ? q, bool ?w ,(long ? [])) ?] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (71:0,71) - Tokens:26 - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[int]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[q]; - CSharpTokenType.Comma;[,]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[bool]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.Identifier;[w]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Comma;[,]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[long]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBracket;[[]; - CSharpTokenType.RightBracket;[]]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.QuestionMark;[?]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (108:0,108) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [(List<(int, string)?> aa, string bb)] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (109:0,109) - Tokens:19 - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[List]; - CSharpTokenType.LessThan;[<]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[int]; - CSharpTokenType.Comma;[,]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[string]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.GreaterThan;[>]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[aa]; - CSharpTokenType.Comma;[,]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[string]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bb]; - CSharpTokenType.RightParenthesis;[)]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (145:0,145) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [(string ss, (int u, List<(string, int)> k, (Char c, bool b, List l)), global::System.Int32[] a)] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (146:0,146) - Tokens:56 - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[string]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[ss]; - CSharpTokenType.Comma;[,]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[int]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[u]; - CSharpTokenType.Comma;[,]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[List]; - CSharpTokenType.LessThan;[<]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[string]; - CSharpTokenType.Comma;[,]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[int]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.GreaterThan;[>]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[k]; - CSharpTokenType.Comma;[,]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[Char]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[c]; - CSharpTokenType.Comma;[,]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[bool]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[b]; - CSharpTokenType.Comma;[,]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[List]; - CSharpTokenType.LessThan;[<]; - CSharpTokenType.Keyword;[int]; - CSharpTokenType.GreaterThan;[>]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[l]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Comma;[,]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[global]; - CSharpTokenType.DoubleColon;[::]; - CSharpTokenType.Identifier;[System]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Int32]; - CSharpTokenType.LeftBracket;[[]; - CSharpTokenType.RightBracket;[]]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[a]; - CSharpTokenType.RightParenthesis;[)]; +Markup block - Gen - 246 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 246 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[custom]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [(bool, int)] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:6 + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[bool]; + SyntaxKind.Comma;[,]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[int]; + SyntaxKind.RightParenthesis;[)]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (19:0,19) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [(int aa, string bb)?] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (20:0,20) - Tokens:11 + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[int]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[aa]; + SyntaxKind.Comma;[,]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[string]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bb]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.QuestionMark;[?]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (40:0,40) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [( int? q , bool w )] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (41:0,41) - Tokens:14 + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[int]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[q]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Comma;[,]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[bool]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[w]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightParenthesis;[)]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (70:0,70) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [( int ? q, bool ?w ,(long ? [])) ?] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (71:0,71) - Tokens:26 + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[int]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[q]; + SyntaxKind.Comma;[,]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[bool]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.Identifier;[w]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Comma;[,]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[long]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.RightBracket;[]]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.QuestionMark;[?]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (108:0,108) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [(List<(int, string)?> aa, string bb)] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (109:0,109) - Tokens:19 + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[List]; + SyntaxKind.LessThan;[<]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[int]; + SyntaxKind.Comma;[,]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[string]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.GreaterThan;[>]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[aa]; + SyntaxKind.Comma;[,]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[string]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bb]; + SyntaxKind.RightParenthesis;[)]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (145:0,145) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [(string ss, (int u, List<(string, int)> k, (Char c, bool b, List l)), global::System.Int32[] a)] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (146:0,146) - Tokens:56 + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[string]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[ss]; + SyntaxKind.Comma;[,]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[int]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[u]; + SyntaxKind.Comma;[,]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[List]; + SyntaxKind.LessThan;[<]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[string]; + SyntaxKind.Comma;[,]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[int]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.GreaterThan;[>]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[k]; + SyntaxKind.Comma;[,]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[Char]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[c]; + SyntaxKind.Comma;[,]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[bool]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[b]; + SyntaxKind.Comma;[,]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[List]; + SyntaxKind.LessThan;[<]; + SyntaxKind.Keyword;[int]; + SyntaxKind.GreaterThan;[>]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[l]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Comma;[,]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[global]; + SyntaxKind.DoubleColon;[::]; + SyntaxKind.Identifier;[System]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Int32]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.RightBracket;[]]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[a]; + SyntaxKind.RightParenthesis;[)]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (246:0,246) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsTupleTypes_IgnoresTrailingWhitespace.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsTupleTypes_IgnoresTrailingWhitespace.cspans.txt index 38b5d16324..52a117679c 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsTupleTypes_IgnoresTrailingWhitespace.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsTupleTypes_IgnoresTrailingWhitespace.cspans.txt @@ -1,5 +1,7 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [23] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [23] ) MetaCode span at (1:0,1 [6] ) (Accepts:None) - Parent: Directive block at (0:0,0 [23] ) -Code span at (7:0,7 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [23] ) -Code span at (8:0,8 [12] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [23] ) -None span at (20:0,20 [3] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [23] ) +Code span at (7:0,7 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [23] ) +Code span at (8:0,8 [12] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [23] ) +None span at (20:0,20 [3] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [23] ) +Markup span at (23:0,23 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [23] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsTupleTypes_IgnoresTrailingWhitespace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsTupleTypes_IgnoresTrailingWhitespace.stree.txt index 6116fb54b7..36eac56a6c 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsTupleTypes_IgnoresTrailingWhitespace.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsTupleTypes_IgnoresTrailingWhitespace.stree.txt @@ -1,17 +1,22 @@ -Directive block - Gen - 23 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [(bool, int?)] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:7 - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[bool]; - CSharpTokenType.Comma;[,]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[int]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.RightParenthesis;[)]; - None span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (20:0,20) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; +Markup block - Gen - 23 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 23 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[custom]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [(bool, int?)] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:7 + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[bool]; + SyntaxKind.Comma;[,]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[int]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.RightParenthesis;[)]; + None span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (20:0,20) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (23:0,23) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsWhiteSpaceAroundTokens.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsWhiteSpaceAroundTokens.cspans.txt index 50c951eaaa..68dfa71c77 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsWhiteSpaceAroundTokens.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsWhiteSpaceAroundTokens.cspans.txt @@ -1,7 +1,9 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [67] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [67] ) MetaCode span at (1:0,1 [6] ) (Accepts:None) - Parent: Directive block at (0:0,0 [67] ) -Code span at (7:0,7 [4] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [67] ) -Code span at (11:0,11 [34] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [67] ) -Code span at (45:0,45 [7] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [67] ) -Code span at (52:0,52 [11] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [67] ) -None span at (63:0,63 [4] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [67] ) +Code span at (7:0,7 [4] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [67] ) +Code span at (11:0,11 [34] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [67] ) +Code span at (45:0,45 [7] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [67] ) +Code span at (52:0,52 [11] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [67] ) +None span at (63:0,63 [4] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [67] ) +Markup span at (67:0,67 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [67] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsWhiteSpaceAroundTokens.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsWhiteSpaceAroundTokens.stree.txt index 28cca39386..5ffe9978bb 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsWhiteSpaceAroundTokens.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_AllowsWhiteSpaceAroundTokens.stree.txt @@ -1,21 +1,26 @@ -Directive block - Gen - 67 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [System.Text.Encoding.ASCIIEncoding] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (11:0,11) - Tokens:7 - CSharpTokenType.Identifier;[System]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Text]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Encoding]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[ASCIIEncoding]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (45:0,45) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [Some_Member] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (52:0,52) - Tokens:1 - CSharpTokenType.Identifier;[Some_Member]; - None span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (63:0,63) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; +Markup block - Gen - 67 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 67 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[custom]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [System.Text.Encoding.ASCIIEncoding] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (11:0,11) - Tokens:7 + SyntaxKind.Identifier;[System]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Text]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Encoding]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[ASCIIEncoding]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (45:0,45) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [Some_Member] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (52:0,52) - Tokens:1 + SyntaxKind.Identifier;[Some_Member]; + None span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (63:0,63) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (67:0,67) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleEOFIncompleteNamespaceTokens.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleEOFIncompleteNamespaceTokens.cspans.txt index f8535e27f8..a2ac1bb1a7 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleEOFIncompleteNamespaceTokens.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleEOFIncompleteNamespaceTokens.cspans.txt @@ -1,3 +1,5 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [15] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [8] ) MetaCode span at (1:0,1 [6] ) (Accepts:None) - Parent: Directive block at (0:0,0 [8] ) -Code span at (7:0,7 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [8] ) +Code span at (7:0,7 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [8] ) +Markup span at (8:0,8 [7] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [15] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleEOFIncompleteNamespaceTokens.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleEOFIncompleteNamespaceTokens.stree.txt index 1fee4f1796..ee74b316d3 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleEOFIncompleteNamespaceTokens.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleEOFIncompleteNamespaceTokens.stree.txt @@ -1,7 +1,12 @@ -Directive block - Gen - 8 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; +Markup block - Gen - 15 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 8 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[custom]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Markup span - Gen - [System.] - SpanEditHandler;Accepts:Any - (8:0,8) - Tokens:1 + SyntaxKind.Text;[System.]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleEOFInvalidNamespaceTokens.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleEOFInvalidNamespaceTokens.cspans.txt index f8535e27f8..0d19696aec 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleEOFInvalidNamespaceTokens.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleEOFInvalidNamespaceTokens.cspans.txt @@ -1,3 +1,6 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [15] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [8] ) MetaCode span at (1:0,1 [6] ) (Accepts:None) - Parent: Directive block at (0:0,0 [8] ) -Code span at (7:0,7 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [8] ) +Code span at (7:0,7 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [8] ) +Markup span at (8:0,8 [6] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [15] ) +Markup span at (14:0,14 [1] ) (Accepts:Any) - Parent: Tag block at (14:0,14 [1] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleEOFInvalidNamespaceTokens.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleEOFInvalidNamespaceTokens.stree.txt index 1fee4f1796..5ab7bd2176 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleEOFInvalidNamespaceTokens.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleEOFInvalidNamespaceTokens.stree.txt @@ -1,7 +1,15 @@ -Directive block - Gen - 8 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; +Markup block - Gen - 15 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 8 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[custom]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Markup span - Gen - [System] - SpanEditHandler;Accepts:Any - (8:0,8) - Tokens:1 + SyntaxKind.Text;[System]; + Tag block - Gen - 1 - (14:0,14) + Markup span - Gen - [<] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 + SyntaxKind.OpenAngle;[<]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleIncompleteNamespaceTokens.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleIncompleteNamespaceTokens.cspans.txt index f8535e27f8..1b4c670d6a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleIncompleteNamespaceTokens.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleIncompleteNamespaceTokens.cspans.txt @@ -1,3 +1,5 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [17] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [8] ) MetaCode span at (1:0,1 [6] ) (Accepts:None) - Parent: Directive block at (0:0,0 [8] ) -Code span at (7:0,7 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [8] ) +Code span at (7:0,7 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [8] ) +Markup span at (8:0,8 [9] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [17] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleIncompleteNamespaceTokens.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleIncompleteNamespaceTokens.stree.txt index 1fee4f1796..5bc8e3d8b2 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleIncompleteNamespaceTokens.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleIncompleteNamespaceTokens.stree.txt @@ -1,7 +1,13 @@ -Directive block - Gen - 8 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; +Markup block - Gen - 17 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 8 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[custom]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Markup span - Gen - [System.LF] - SpanEditHandler;Accepts:Any - (8:0,8) - Tokens:2 + SyntaxKind.Text;[System.]; + SyntaxKind.NewLine;[LF]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleInvalidNamespaceTokens.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleInvalidNamespaceTokens.cspans.txt index f8535e27f8..7232de595e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleInvalidNamespaceTokens.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleInvalidNamespaceTokens.cspans.txt @@ -1,3 +1,6 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [17] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [8] ) MetaCode span at (1:0,1 [6] ) (Accepts:None) - Parent: Directive block at (0:0,0 [8] ) -Code span at (7:0,7 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [8] ) +Code span at (7:0,7 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [8] ) +Markup span at (8:0,8 [6] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [17] ) +Markup span at (14:0,14 [3] ) (Accepts:Any) - Parent: Tag block at (14:0,14 [3] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleInvalidNamespaceTokens.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleInvalidNamespaceTokens.stree.txt index 1fee4f1796..11bce54523 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleInvalidNamespaceTokens.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_CanHandleInvalidNamespaceTokens.stree.txt @@ -1,7 +1,16 @@ -Directive block - Gen - 8 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; +Markup block - Gen - 17 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 8 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[custom]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Markup span - Gen - [System] - SpanEditHandler;Accepts:Any - (8:0,8) - Tokens:1 + SyntaxKind.Text;[System]; + Tag block - Gen - 3 - (14:0,14) + Markup span - Gen - [ - 16 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - ["hello"] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.StringLiteral;["hello"]; - None span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (15:0,15) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; +Markup block - Gen - 23 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 16 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[custom]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - ["hello"] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:1 + SyntaxKind.StringLiteral;["hello"]; + None span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (15:0,15) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Markup span - Gen - ["world"] - SpanEditHandler;Accepts:Any - (16:0,16) - Tokens:3 + SyntaxKind.DoubleQuote;["]; + SyntaxKind.Text;[world]; + SyntaxKind.DoubleQuote;["]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsForInvalidMemberTokens.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsForInvalidMemberTokens.cspans.txt index f8535e27f8..59f2a44c20 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsForInvalidMemberTokens.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsForInvalidMemberTokens.cspans.txt @@ -1,3 +1,5 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [20] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [8] ) MetaCode span at (1:0,1 [6] ) (Accepts:None) - Parent: Directive block at (0:0,0 [8] ) -Code span at (7:0,7 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [8] ) +Code span at (7:0,7 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [8] ) +Markup span at (8:0,8 [12] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [20] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsForInvalidMemberTokens.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsForInvalidMemberTokens.stree.txt index 66c8f9e22b..e80139ceb4 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsForInvalidMemberTokens.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsForInvalidMemberTokens.stree.txt @@ -1,7 +1,12 @@ -Directive block - Gen - 8 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; +Markup block - Gen - 20 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 8 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[custom]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Markup span - Gen - [-Some_Member] - SpanEditHandler;Accepts:Any - (8:0,8) - Tokens:1 + SyntaxKind.Text;[-Some_Member]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsWhenEOFBeforeDirectiveBlockStart.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsWhenEOFBeforeDirectiveBlockStart.cspans.txt index 41583f7ddd..66d394bc52 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsWhenEOFBeforeDirectiveBlockStart.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsWhenEOFBeforeDirectiveBlockStart.cspans.txt @@ -1,4 +1,6 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [15] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [15] ) MetaCode span at (1:0,1 [6] ) (Accepts:None) - Parent: Directive block at (0:0,0 [15] ) -Markup span at (7:0,7 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [15] ) -Code span at (8:0,8 [7] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [15] ) +Markup span at (7:0,7 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [15] ) +Code span at (8:0,8 [7] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [15] ) +Markup span at (15:0,15 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [15] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsWhenEOFBeforeDirectiveBlockStart.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsWhenEOFBeforeDirectiveBlockStart.stree.txt index 785e17335e..8e0af839b9 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsWhenEOFBeforeDirectiveBlockStart.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsWhenEOFBeforeDirectiveBlockStart.stree.txt @@ -1,9 +1,14 @@ -Directive block - Gen - 15 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - ["Hello"] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.StringLiteral;["Hello"]; +Markup block - Gen - 15 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 15 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[custom]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - ["Hello"] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:1 + SyntaxKind.StringLiteral;["Hello"]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (15:0,15) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsWhenExtraContentBeforeBlockStart.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsWhenExtraContentBeforeBlockStart.cspans.txt index a1cf9382b0..557ac27df2 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsWhenExtraContentBeforeBlockStart.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsWhenExtraContentBeforeBlockStart.cspans.txt @@ -1,5 +1,7 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [39] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [16] ) MetaCode span at (1:0,1 [6] ) (Accepts:None) - Parent: Directive block at (0:0,0 [16] ) -Markup span at (7:0,7 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [16] ) -Code span at (8:0,8 [7] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [16] ) -Markup span at (15:0,15 [1] ) (Accepts:AllWhiteSpace) - Parent: Directive block at (0:0,0 [16] ) +Markup span at (7:0,7 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [16] ) +Code span at (8:0,8 [7] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [16] ) +Markup span at (15:0,15 [1] ) (Accepts:AllWhitespace) - Parent: Directive block at (0:0,0 [16] ) +Markup span at (16:0,16 [23] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [39] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsWhenExtraContentBeforeBlockStart.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsWhenExtraContentBeforeBlockStart.stree.txt index d4346b5102..421836eef5 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsWhenExtraContentBeforeBlockStart.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsWhenExtraContentBeforeBlockStart.stree.txt @@ -1,11 +1,24 @@ -Directive block - Gen - 16 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - ["Hello"] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.StringLiteral;["Hello"]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (15:0,15) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; +Markup block - Gen - 39 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 16 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[custom]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - ["Hello"] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:1 + SyntaxKind.StringLiteral;["Hello"]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (15:0,15) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Markup span - Gen - [World { foo(); bar(); }] - SpanEditHandler;Accepts:Any - (16:0,16) - Tokens:9 + SyntaxKind.Text;[World]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[foo();]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[bar();]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsWhenMissingEndBrace.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsWhenMissingEndBrace.cspans.txt index 2bd242fa71..87860025d2 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsWhenMissingEndBrace.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsWhenMissingEndBrace.cspans.txt @@ -1,7 +1,8 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [17] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [17] ) MetaCode span at (1:0,1 [6] ) (Accepts:None) - Parent: Directive block at (0:0,0 [17] ) -Markup span at (7:0,7 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [17] ) -Code span at (8:0,8 [7] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [17] ) -Markup span at (15:0,15 [1] ) (Accepts:AllWhiteSpace) - Parent: Directive block at (0:0,0 [17] ) +Markup span at (7:0,7 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [17] ) +Code span at (8:0,8 [7] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [17] ) +Markup span at (15:0,15 [1] ) (Accepts:AllWhitespace) - Parent: Directive block at (0:0,0 [17] ) MetaCode span at (16:0,16 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [17] ) Code span at (17:0,17 [0] ) (Accepts:Any) - Parent: Directive block at (0:0,0 [17] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsWhenMissingEndBrace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsWhenMissingEndBrace.stree.txt index 15be232395..fdf4b27ff0 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsWhenMissingEndBrace.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_ErrorsWhenMissingEndBrace.stree.txt @@ -1,15 +1,18 @@ -Directive block - Gen - 17 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - ["Hello"] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.StringLiteral;["Hello"]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (15:0,15) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd - (16:0,16) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; - Code span - Gen - [] - CodeBlockEditHandler;Accepts:Any;CodeBlock - (17:0,17) - Tokens:1 - CSharpTokenType.Unknown;[]; +Markup block - Gen - 17 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 17 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[custom]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - ["Hello"] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:1 + SyntaxKind.StringLiteral;["Hello"]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (15:0,15) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd - (16:0,16) - Tokens:1 + SyntaxKind.LeftBrace;[{]; + Code span - Gen - [] - CodeBlockEditHandler;Accepts:Any;CodeBlock - (17:0,17) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScopedMultipleOccurring_CanHaveDuplicates.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScopedMultipleOccurring_CanHaveDuplicates.cspans.txt index 04bf3c5828..5429ef434a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScopedMultipleOccurring_CanHaveDuplicates.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScopedMultipleOccurring_CanHaveDuplicates.cspans.txt @@ -1,12 +1,12 @@ Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [85] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [44] ) MetaCode span at (1:0,1 [6] ) (Accepts:None) - Parent: Directive block at (0:0,0 [44] ) -Code span at (7:0,7 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [44] ) -Code span at (8:0,8 [34] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [44] ) -Markup span at (42:0,42 [2] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [44] ) +Code span at (7:0,7 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [44] ) +Code span at (8:0,8 [34] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [44] ) +Markup span at (42:0,42 [2] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [44] ) Markup span at (44:1,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [85] ) Transition span at (44:1,0 [1] ) (Accepts:None) - Parent: Directive block at (44:1,0 [41] ) MetaCode span at (45:1,1 [6] ) (Accepts:None) - Parent: Directive block at (44:1,0 [41] ) -Code span at (51:1,7 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (44:1,0 [41] ) -Code span at (52:1,8 [33] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (44:1,0 [41] ) +Code span at (51:1,7 [1] ) (Accepts:Whitespace) - Parent: Directive block at (44:1,0 [41] ) +Code span at (52:1,8 [33] ) (Accepts:NonWhitespace) - Parent: Directive block at (44:1,0 [41] ) Markup span at (85:1,41 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [85] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScopedMultipleOccurring_CanHaveDuplicates.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScopedMultipleOccurring_CanHaveDuplicates.stree.txt index f9f16307e7..6c9bc613cc 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScopedMultipleOccurring_CanHaveDuplicates.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScopedMultipleOccurring_CanHaveDuplicates.stree.txt @@ -1,39 +1,39 @@ Markup block - Gen - 85 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 44 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [System.Text.Encoding.ASCIIEncoding] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:7 - CSharpTokenType.Identifier;[System]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Text]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Encoding]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[ASCIIEncoding]; - Markup span - Gen - [LF] - SpanEditHandler;Accepts:WhiteSpace - (42:0,42) - Tokens:1 - CSharpTokenType.NewLine;[LF]; + SyntaxKind.Identifier;[custom]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [System.Text.Encoding.ASCIIEncoding] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:7 + SyntaxKind.Identifier;[System]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Text]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Encoding]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[ASCIIEncoding]; + Markup span - Gen - [LF] - SpanEditHandler;Accepts:Whitespace - (42:0,42) - Tokens:1 + SyntaxKind.NewLine;[LF]; Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (44:1,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 41 - (44:1,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (44:1,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (45:1,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (51:1,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [System.Text.Encoding.UTF8Encoding] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (52:1,8) - Tokens:7 - CSharpTokenType.Identifier;[System]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Text]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Encoding]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[UTF8Encoding]; + SyntaxKind.Identifier;[custom]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (51:1,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [System.Text.Encoding.UTF8Encoding] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (52:1,8) - Tokens:7 + SyntaxKind.Identifier;[System]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Text]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Encoding]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[UTF8Encoding]; Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (85:1,41) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScopedSinglyOccurring_ErrorsIfDuplicate.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScopedSinglyOccurring_ErrorsIfDuplicate.cspans.txt index 04bf3c5828..5429ef434a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScopedSinglyOccurring_ErrorsIfDuplicate.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScopedSinglyOccurring_ErrorsIfDuplicate.cspans.txt @@ -1,12 +1,12 @@ Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [85] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [44] ) MetaCode span at (1:0,1 [6] ) (Accepts:None) - Parent: Directive block at (0:0,0 [44] ) -Code span at (7:0,7 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [44] ) -Code span at (8:0,8 [34] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [44] ) -Markup span at (42:0,42 [2] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [44] ) +Code span at (7:0,7 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [44] ) +Code span at (8:0,8 [34] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [44] ) +Markup span at (42:0,42 [2] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [44] ) Markup span at (44:1,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [85] ) Transition span at (44:1,0 [1] ) (Accepts:None) - Parent: Directive block at (44:1,0 [41] ) MetaCode span at (45:1,1 [6] ) (Accepts:None) - Parent: Directive block at (44:1,0 [41] ) -Code span at (51:1,7 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (44:1,0 [41] ) -Code span at (52:1,8 [33] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (44:1,0 [41] ) +Code span at (51:1,7 [1] ) (Accepts:Whitespace) - Parent: Directive block at (44:1,0 [41] ) +Code span at (52:1,8 [33] ) (Accepts:NonWhitespace) - Parent: Directive block at (44:1,0 [41] ) Markup span at (85:1,41 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [85] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScopedSinglyOccurring_ErrorsIfDuplicate.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScopedSinglyOccurring_ErrorsIfDuplicate.stree.txt index ed97532104..b24cfe0182 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScopedSinglyOccurring_ErrorsIfDuplicate.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScopedSinglyOccurring_ErrorsIfDuplicate.stree.txt @@ -1,39 +1,39 @@ Markup block - Gen - 85 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 44 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [System.Text.Encoding.ASCIIEncoding] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:7 - CSharpTokenType.Identifier;[System]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Text]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Encoding]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[ASCIIEncoding]; - Markup span - Gen - [LF] - SpanEditHandler;Accepts:WhiteSpace - (42:0,42) - Tokens:1 - CSharpTokenType.NewLine;[LF]; + SyntaxKind.Identifier;[custom]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [System.Text.Encoding.ASCIIEncoding] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:7 + SyntaxKind.Identifier;[System]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Text]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Encoding]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[ASCIIEncoding]; + Markup span - Gen - [LF] - SpanEditHandler;Accepts:Whitespace - (42:0,42) - Tokens:1 + SyntaxKind.NewLine;[LF]; Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (44:1,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 41 - (44:1,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (44:1,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (45:1,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (51:1,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [System.Text.Encoding.UTF8Encoding] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (52:1,8) - Tokens:7 - CSharpTokenType.Identifier;[System]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Text]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Encoding]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[UTF8Encoding]; + SyntaxKind.Identifier;[custom]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (51:1,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [System.Text.Encoding.UTF8Encoding] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (52:1,8) - Tokens:7 + SyntaxKind.Identifier;[System]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Text]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Encoding]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[UTF8Encoding]; Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (85:1,41) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScoped_CanBeBeneathOtherDirectives.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScoped_CanBeBeneathOtherDirectives.cspans.txt index 0d5ab809f3..715c97f1c9 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScoped_CanBeBeneathOtherDirectives.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScoped_CanBeBeneathOtherDirectives.cspans.txt @@ -1,12 +1,12 @@ Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [59] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [44] ) MetaCode span at (1:0,1 [6] ) (Accepts:None) - Parent: Directive block at (0:0,0 [44] ) -Code span at (7:0,7 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [44] ) -Code span at (8:0,8 [34] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [44] ) -Markup span at (42:0,42 [2] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [44] ) +Code span at (7:0,7 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [44] ) +Code span at (8:0,8 [34] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [44] ) +Markup span at (42:0,42 [2] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [44] ) Markup span at (44:1,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [59] ) Transition span at (44:1,0 [1] ) (Accepts:None) - Parent: Directive block at (44:1,0 [15] ) MetaCode span at (45:1,1 [9] ) (Accepts:None) - Parent: Directive block at (44:1,0 [15] ) -Code span at (54:1,10 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (44:1,0 [15] ) -Code span at (55:1,11 [4] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (44:1,0 [15] ) +Code span at (54:1,10 [1] ) (Accepts:Whitespace) - Parent: Directive block at (44:1,0 [15] ) +Code span at (55:1,11 [4] ) (Accepts:NonWhitespace) - Parent: Directive block at (44:1,0 [15] ) Markup span at (59:1,15 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [59] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScoped_CanBeBeneathOtherDirectives.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScoped_CanBeBeneathOtherDirectives.stree.txt index dabeb41382..50c499246f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScoped_CanBeBeneathOtherDirectives.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScoped_CanBeBeneathOtherDirectives.stree.txt @@ -1,33 +1,33 @@ Markup block - Gen - 59 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 44 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [System.Text.Encoding.ASCIIEncoding] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:7 - CSharpTokenType.Identifier;[System]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Text]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Encoding]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[ASCIIEncoding]; - Markup span - Gen - [LF] - SpanEditHandler;Accepts:WhiteSpace - (42:0,42) - Tokens:1 - CSharpTokenType.NewLine;[LF]; + SyntaxKind.Identifier;[custom]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [System.Text.Encoding.ASCIIEncoding] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:7 + SyntaxKind.Identifier;[System]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Text]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Encoding]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[ASCIIEncoding]; + Markup span - Gen - [LF] - SpanEditHandler;Accepts:Whitespace - (42:0,42) - Tokens:1 + SyntaxKind.NewLine;[LF]; Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (44:1,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 15 - (44:1,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (44:1,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [something] - SpanEditHandler;Accepts:None - (45:1,1) - Tokens:1 - CSharpTokenType.Identifier;[something]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (54:1,10) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [Else] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (55:1,11) - Tokens:1 - CSharpTokenType.Identifier;[Else]; + SyntaxKind.Identifier;[something]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (54:1,10) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [Else] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (55:1,11) - Tokens:1 + SyntaxKind.Identifier;[Else]; Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (59:1,15) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScoped_CanBeBeneathOtherWhiteSpaceCommentsAndDirectives.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScoped_CanBeBeneathOtherWhiteSpaceCommentsAndDirectives.cspans.txt index a345090d3e..b65e57e7d9 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScoped_CanBeBeneathOtherWhiteSpaceCommentsAndDirectives.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScoped_CanBeBeneathOtherWhiteSpaceCommentsAndDirectives.cspans.txt @@ -7,15 +7,15 @@ Transition span at (42:0,42 [1] ) (Accepts:None) - Parent: Comment block at (0:0 Markup span at (43:0,43 [2] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [130] ) Transition span at (45:1,0 [1] ) (Accepts:None) - Parent: Directive block at (45:1,0 [44] ) MetaCode span at (46:1,1 [6] ) (Accepts:None) - Parent: Directive block at (45:1,0 [44] ) -Code span at (52:1,7 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (45:1,0 [44] ) -Code span at (53:1,8 [34] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (45:1,0 [44] ) -Markup span at (87:1,42 [2] ) (Accepts:WhiteSpace) - Parent: Directive block at (45:1,0 [44] ) +Code span at (52:1,7 [1] ) (Accepts:Whitespace) - Parent: Directive block at (45:1,0 [44] ) +Code span at (53:1,8 [34] ) (Accepts:NonWhitespace) - Parent: Directive block at (45:1,0 [44] ) +Markup span at (87:1,42 [2] ) (Accepts:Whitespace) - Parent: Directive block at (45:1,0 [44] ) Markup span at (89:2,0 [2] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [130] ) Transition span at (91:3,0 [1] ) (Accepts:None) - Parent: Directive block at (91:3,0 [17] ) MetaCode span at (92:3,1 [9] ) (Accepts:None) - Parent: Directive block at (91:3,0 [17] ) -Code span at (101:3,10 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (91:3,0 [17] ) -Code span at (102:3,11 [4] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (91:3,0 [17] ) -Markup span at (106:3,15 [2] ) (Accepts:WhiteSpace) - Parent: Directive block at (91:3,0 [17] ) +Code span at (101:3,10 [1] ) (Accepts:Whitespace) - Parent: Directive block at (91:3,0 [17] ) +Code span at (102:3,11 [4] ) (Accepts:NonWhitespace) - Parent: Directive block at (91:3,0 [17] ) +Markup span at (106:3,15 [2] ) (Accepts:Whitespace) - Parent: Directive block at (91:3,0 [17] ) Markup span at (108:4,0 [2] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [130] ) Markup span at (110:5,0 [3] ) (Accepts:Any) - Parent: Tag block at (110:5,0 [3] ) Markup span at (113:5,3 [13] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [130] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScoped_CanBeBeneathOtherWhiteSpaceCommentsAndDirectives.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScoped_CanBeBeneathOtherWhiteSpaceCommentsAndDirectives.stree.txt index 203fd7aee0..52ce246776 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScoped_CanBeBeneathOtherWhiteSpaceCommentsAndDirectives.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_FileScoped_CanBeBeneathOtherWhiteSpaceCommentsAndDirectives.stree.txt @@ -1,65 +1,66 @@ Markup block - Gen - 130 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Comment block - Gen - 43 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - HtmlTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - HtmlTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Comment span - Gen - [ There are two directives beneath this ] - SpanEditHandler;Accepts:Any - (2:0,2) - Tokens:1 - HtmlTokenType.RazorComment;[ There are two directives beneath this ]; + SyntaxKind.RazorCommentLiteral;[ There are two directives beneath this ]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (41:0,41) - Tokens:1 - HtmlTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (42:0,42) - Tokens:1 - HtmlTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (43:0,43) - Tokens:1 - HtmlTokenType.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; Directive block - Gen - 44 - (45:1,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (45:1,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (46:1,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (52:1,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [System.Text.Encoding.ASCIIEncoding] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (53:1,8) - Tokens:7 - CSharpTokenType.Identifier;[System]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Text]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Encoding]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[ASCIIEncoding]; - Markup span - Gen - [LF] - SpanEditHandler;Accepts:WhiteSpace - (87:1,42) - Tokens:1 - CSharpTokenType.NewLine;[LF]; + SyntaxKind.Identifier;[custom]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (52:1,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [System.Text.Encoding.ASCIIEncoding] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (53:1,8) - Tokens:7 + SyntaxKind.Identifier;[System]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Text]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Encoding]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[ASCIIEncoding]; + Markup span - Gen - [LF] - SpanEditHandler;Accepts:Whitespace - (87:1,42) - Tokens:1 + SyntaxKind.NewLine;[LF]; Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (89:2,0) - Tokens:1 - HtmlTokenType.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; Directive block - Gen - 17 - (91:3,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (91:3,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [something] - SpanEditHandler;Accepts:None - (92:3,1) - Tokens:1 - CSharpTokenType.Identifier;[something]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (101:3,10) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [Else] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (102:3,11) - Tokens:1 - CSharpTokenType.Identifier;[Else]; - Markup span - Gen - [LF] - SpanEditHandler;Accepts:WhiteSpace - (106:3,15) - Tokens:1 - CSharpTokenType.NewLine;[LF]; + SyntaxKind.Identifier;[something]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (101:3,10) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [Else] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (102:3,11) - Tokens:1 + SyntaxKind.Identifier;[Else]; + Markup span - Gen - [LF] - SpanEditHandler;Accepts:Whitespace - (106:3,15) - Tokens:1 + SyntaxKind.NewLine;[LF]; Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (108:4,0) - Tokens:1 - HtmlTokenType.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; Tag block - Gen - 3 - (110:5,0) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (110:5,0) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [This is extra] - SpanEditHandler;Accepts:Any - (113:5,3) - Tokens:5 - HtmlTokenType.Text;[This]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[is]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[extra]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; + SyntaxKind.HtmlTextLiteral - [This is extra] - [113..126) - FullWidth: 13 - Slots: 1 + SyntaxKind.List - [This is extra] - [113..126) - FullWidth: 13 - Slots: 5 + SyntaxKind.Text;[This]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[is]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[extra]; Tag block - Gen - 4 - (126:5,16) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (126:5,16) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_NoErrorsSemicolonAfterDirective.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_NoErrorsSemicolonAfterDirective.cspans.txt index e25b16bc6a..f44c1c18b8 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_NoErrorsSemicolonAfterDirective.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_NoErrorsSemicolonAfterDirective.cspans.txt @@ -1,7 +1,9 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [19] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [19] ) MetaCode span at (1:0,1 [6] ) (Accepts:None) - Parent: Directive block at (0:0,0 [19] ) -Markup span at (7:0,7 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [19] ) -Code span at (8:0,8 [7] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [19] ) -None span at (15:0,15 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [19] ) -MetaCode span at (16:0,16 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [19] ) -Markup span at (17:0,17 [2] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [19] ) +Markup span at (7:0,7 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [19] ) +Code span at (8:0,8 [7] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [19] ) +None span at (15:0,15 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [19] ) +MetaCode span at (16:0,16 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [19] ) +Markup span at (17:0,17 [2] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [19] ) +Markup span at (19:0,19 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [19] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_NoErrorsSemicolonAfterDirective.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_NoErrorsSemicolonAfterDirective.stree.txt index 6feb3829cd..686fa9221b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_NoErrorsSemicolonAfterDirective.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_NoErrorsSemicolonAfterDirective.stree.txt @@ -1,15 +1,20 @@ -Directive block - Gen - 19 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - ["hello"] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.StringLiteral;["hello"]; - None span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (15:0,15) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - MetaCode span - Gen - [;] - SpanEditHandler;Accepts:WhiteSpace - (16:0,16) - Tokens:1 - CSharpTokenType.Semicolon;[;]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (17:0,17) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; +Markup block - Gen - 19 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 19 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[custom]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - ["hello"] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:1 + SyntaxKind.StringLiteral;["hello"]; + None span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (15:0,15) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + MetaCode span - Gen - [;] - SpanEditHandler;Accepts:Whitespace - (16:0,16) - Tokens:1 + SyntaxKind.Semicolon;[;]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (17:0,17) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (19:0,19) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForNonStringValue.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForNonStringValue.cspans.txt index f1fd6cb92b..82186c467a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForNonStringValue.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForNonStringValue.cspans.txt @@ -1,3 +1,5 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [14] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [8] ) MetaCode span at (1:0,1 [6] ) (Accepts:None) - Parent: Directive block at (0:0,0 [8] ) -Markup span at (7:0,7 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [8] ) +Markup span at (7:0,7 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [8] ) +Markup span at (8:0,8 [6] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [14] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForNonStringValue.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForNonStringValue.stree.txt index 8dfad4bd3c..154f851b00 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForNonStringValue.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForNonStringValue.stree.txt @@ -1,7 +1,14 @@ -Directive block - Gen - 8 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; +Markup block - Gen - 14 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 8 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[custom]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Markup span - Gen - [{foo?}] - SpanEditHandler;Accepts:Any - (8:0,8) - Tokens:3 + SyntaxKind.Text;[{foo]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.Text;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForPartialQuotedValue.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForPartialQuotedValue.cspans.txt index f1fd6cb92b..9e73b54511 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForPartialQuotedValue.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForPartialQuotedValue.cspans.txt @@ -1,3 +1,5 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [16] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [8] ) MetaCode span at (1:0,1 [6] ) (Accepts:None) - Parent: Directive block at (0:0,0 [8] ) -Markup span at (7:0,7 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [8] ) +Markup span at (7:0,7 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [8] ) +Markup span at (8:0,8 [8] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [16] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForPartialQuotedValue.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForPartialQuotedValue.stree.txt index fd51b1bf91..e5ebe493a7 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForPartialQuotedValue.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForPartialQuotedValue.stree.txt @@ -1,7 +1,13 @@ -Directive block - Gen - 8 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; +Markup block - Gen - 16 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 8 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[custom]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Markup span - Gen - [AString"] - SpanEditHandler;Accepts:Any - (8:0,8) - Tokens:2 + SyntaxKind.Text;[AString]; + SyntaxKind.DoubleQuote;["]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForSingleQuotedValue.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForSingleQuotedValue.cspans.txt index f1fd6cb92b..d5d9f27aef 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForSingleQuotedValue.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForSingleQuotedValue.cspans.txt @@ -1,3 +1,5 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [17] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [8] ) MetaCode span at (1:0,1 [6] ) (Accepts:None) - Parent: Directive block at (0:0,0 [8] ) -Markup span at (7:0,7 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [8] ) +Markup span at (7:0,7 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [8] ) +Markup span at (8:0,8 [9] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [17] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForSingleQuotedValue.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForSingleQuotedValue.stree.txt index b65823863d..32b2606e4b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForSingleQuotedValue.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForSingleQuotedValue.stree.txt @@ -1,7 +1,14 @@ -Directive block - Gen - 8 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; +Markup block - Gen - 17 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 8 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[custom]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Markup span - Gen - ['AString'] - SpanEditHandler;Accepts:Any - (8:0,8) - Tokens:3 + SyntaxKind.SingleQuote;[']; + SyntaxKind.Text;[AString]; + SyntaxKind.SingleQuote;[']; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForUnquotedValue.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForUnquotedValue.cspans.txt index f1fd6cb92b..5d403c8984 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForUnquotedValue.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForUnquotedValue.cspans.txt @@ -1,3 +1,5 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [15] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [8] ) MetaCode span at (1:0,1 [6] ) (Accepts:None) - Parent: Directive block at (0:0,0 [8] ) -Markup span at (7:0,7 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [8] ) +Markup span at (7:0,7 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [8] ) +Markup span at (8:0,8 [7] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [15] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForUnquotedValue.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForUnquotedValue.stree.txt index fd51b1bf91..64f9b87bb3 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForUnquotedValue.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_StringToken_ParserErrorForUnquotedValue.stree.txt @@ -1,7 +1,12 @@ -Directive block - Gen - 8 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; +Markup block - Gen - 15 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 8 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[custom]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Markup span - Gen - [AString] - SpanEditHandler;Accepts:Any - (8:0,8) - Tokens:1 + SyntaxKind.Text;[AString]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_TokensMustBeSeparatedBySpace.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_TokensMustBeSeparatedBySpace.cspans.txt index de1247ad81..263c7efaa3 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_TokensMustBeSeparatedBySpace.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_TokensMustBeSeparatedBySpace.cspans.txt @@ -1,4 +1,6 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [26] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [17] ) MetaCode span at (1:0,1 [6] ) (Accepts:None) - Parent: Directive block at (0:0,0 [17] ) -Markup span at (7:0,7 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [17] ) -Code span at (8:0,8 [9] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [17] ) +Markup span at (7:0,7 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [17] ) +Code span at (8:0,8 [9] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [17] ) +Markup span at (17:0,17 [9] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [26] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_TokensMustBeSeparatedBySpace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_TokensMustBeSeparatedBySpace.stree.txt index 7c8de4fbc1..337552e7ea 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_TokensMustBeSeparatedBySpace.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_TokensMustBeSeparatedBySpace.stree.txt @@ -1,9 +1,16 @@ -Directive block - Gen - 17 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - ["string1"] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.StringLiteral;["string1"]; +Markup block - Gen - 26 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 17 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[custom]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - ["string1"] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:1 + SyntaxKind.StringLiteral;["string1"]; + Markup span - Gen - ["string2"] - SpanEditHandler;Accepts:Any - (17:0,17) - Tokens:3 + SyntaxKind.DoubleQuote;["]; + SyntaxKind.Text;[string2]; + SyntaxKind.DoubleQuote;["]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsCodeBlocks.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsCodeBlocks.cspans.txt index a4003deee6..85992b911b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsCodeBlocks.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsCodeBlocks.cspans.txt @@ -1,8 +1,10 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [32] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [32] ) MetaCode span at (1:0,1 [6] ) (Accepts:None) - Parent: Directive block at (0:0,0 [32] ) -Markup span at (7:0,7 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [32] ) -Code span at (8:0,8 [6] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [32] ) -Markup span at (14:0,14 [1] ) (Accepts:AllWhiteSpace) - Parent: Directive block at (0:0,0 [32] ) +Markup span at (7:0,7 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [32] ) +Code span at (8:0,8 [6] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [32] ) +Markup span at (14:0,14 [1] ) (Accepts:AllWhitespace) - Parent: Directive block at (0:0,0 [32] ) MetaCode span at (15:0,15 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [32] ) Code span at (16:0,16 [15] ) (Accepts:Any) - Parent: Directive block at (0:0,0 [32] ) MetaCode span at (31:0,31 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [32] ) +Markup span at (32:0,32 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [32] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsCodeBlocks.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsCodeBlocks.stree.txt index 64c88fe4f9..4f7ff6b749 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsCodeBlocks.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsCodeBlocks.stree.txt @@ -1,27 +1,32 @@ -Directive block - Gen - 32 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - ["Name"] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.StringLiteral;["Name"]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (14:0,14) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (15:0,15) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; - Code span - Gen - [ foo(); bar(); ] - CodeBlockEditHandler;Accepts:Any;CodeBlock - (16:0,16) - Tokens:11 - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (31:0,31) - Tokens:1 - CSharpTokenType.RightBrace;[}]; +Markup block - Gen - 32 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 32 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[custom]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - ["Name"] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:1 + SyntaxKind.StringLiteral;["Name"]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (14:0,14) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (15:0,15) - Tokens:1 + SyntaxKind.LeftBrace;[{]; + Code span - Gen - [ foo(); bar(); ] - CodeBlockEditHandler;Accepts:Any;CodeBlock - (16:0,16) - Tokens:11 + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (31:0,31) - Tokens:1 + SyntaxKind.RightBrace;[}]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (32:0,32) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsMemberTokens.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsMemberTokens.cspans.txt index 3bd36e8664..69febe9867 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsMemberTokens.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsMemberTokens.cspans.txt @@ -1,4 +1,6 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [19] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [19] ) MetaCode span at (1:0,1 [6] ) (Accepts:None) - Parent: Directive block at (0:0,0 [19] ) -Code span at (7:0,7 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [19] ) -Code span at (8:0,8 [11] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [19] ) +Code span at (7:0,7 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [19] ) +Code span at (8:0,8 [11] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [19] ) +Markup span at (19:0,19 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [19] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsMemberTokens.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsMemberTokens.stree.txt index c51aa18acd..8c7fd5ccac 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsMemberTokens.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsMemberTokens.stree.txt @@ -1,9 +1,14 @@ -Directive block - Gen - 19 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [Some_Member] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.Identifier;[Some_Member]; +Markup block - Gen - 19 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 19 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[custom]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [Some_Member] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:1 + SyntaxKind.Identifier;[Some_Member]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (19:0,19) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsMultipleTokens.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsMultipleTokens.cspans.txt index 07dfcef1d7..9a307ed573 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsMultipleTokens.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsMultipleTokens.cspans.txt @@ -1,8 +1,10 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [64] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [64] ) MetaCode span at (1:0,1 [6] ) (Accepts:None) - Parent: Directive block at (0:0,0 [64] ) -Code span at (7:0,7 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [64] ) -Code span at (8:0,8 [34] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [64] ) -Code span at (42:0,42 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [64] ) -Code span at (43:0,43 [11] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [64] ) -Markup span at (54:0,54 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [64] ) -Code span at (55:0,55 [9] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [64] ) +Code span at (7:0,7 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [64] ) +Code span at (8:0,8 [34] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [64] ) +Code span at (42:0,42 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [64] ) +Code span at (43:0,43 [11] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [64] ) +Markup span at (54:0,54 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [64] ) +Code span at (55:0,55 [9] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [64] ) +Markup span at (64:0,64 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [64] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsMultipleTokens.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsMultipleTokens.stree.txt index 1cca925839..c42a454625 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsMultipleTokens.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsMultipleTokens.stree.txt @@ -1,23 +1,28 @@ -Directive block - Gen - 64 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [System.Text.Encoding.ASCIIEncoding] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:7 - CSharpTokenType.Identifier;[System]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Text]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Encoding]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[ASCIIEncoding]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (42:0,42) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [Some_Member] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (43:0,43) - Tokens:1 - CSharpTokenType.Identifier;[Some_Member]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (54:0,54) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - ["AString"] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (55:0,55) - Tokens:1 - CSharpTokenType.StringLiteral;["AString"]; +Markup block - Gen - 64 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 64 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[custom]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [System.Text.Encoding.ASCIIEncoding] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:7 + SyntaxKind.Identifier;[System]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Text]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Encoding]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[ASCIIEncoding]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (42:0,42) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [Some_Member] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (43:0,43) - Tokens:1 + SyntaxKind.Identifier;[Some_Member]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (54:0,54) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - ["AString"] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (55:0,55) - Tokens:1 + SyntaxKind.StringLiteral;["AString"]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (64:0,64) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsRazorBlocks.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsRazorBlocks.cspans.txt index 1a375c2158..22dc8a5957 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsRazorBlocks.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsRazorBlocks.cspans.txt @@ -1,8 +1,9 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [33] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [33] ) MetaCode span at (1:0,1 [6] ) (Accepts:None) - Parent: Directive block at (0:0,0 [33] ) -Markup span at (7:0,7 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [33] ) -Code span at (8:0,8 [8] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [33] ) -Markup span at (16:0,16 [1] ) (Accepts:AllWhiteSpace) - Parent: Directive block at (0:0,0 [33] ) +Markup span at (7:0,7 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [33] ) +Code span at (8:0,8 [8] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [33] ) +Markup span at (16:0,16 [1] ) (Accepts:AllWhitespace) - Parent: Directive block at (0:0,0 [33] ) MetaCode span at (17:0,17 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [33] ) Markup span at (18:0,18 [1] ) (Accepts:Any) - Parent: Markup block at (18:0,18 [14] ) Markup span at (19:0,19 [3] ) (Accepts:Any) - Parent: Tag block at (19:0,19 [3] ) @@ -10,3 +11,4 @@ Markup span at (22:0,22 [5] ) (Accepts:Any) - Parent: Markup block at (18:0,18 [ Markup span at (27:0,27 [4] ) (Accepts:Any) - Parent: Tag block at (27:0,27 [4] ) Markup span at (31:0,31 [1] ) (Accepts:Any) - Parent: Markup block at (18:0,18 [14] ) MetaCode span at (32:0,32 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [33] ) +Markup span at (33:0,33 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [33] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsRazorBlocks.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsRazorBlocks.stree.txt index c5bde0c85c..13a0b22a66 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsRazorBlocks.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsRazorBlocks.stree.txt @@ -1,37 +1,43 @@ -Directive block - Gen - 33 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - ["Header"] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.StringLiteral;["Header"]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (16:0,16) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (17:0,17) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; - Markup block - Gen - 14 - (18:0,18) - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (18:0,18) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; - Tag block - Gen - 3 - (19:0,19) - Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (19:0,19) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [F{o}o] - SpanEditHandler;Accepts:Any - (22:0,22) - Tokens:5 - HtmlTokenType.Text;[F]; - HtmlTokenType.Text;[{]; - HtmlTokenType.Text;[o]; - HtmlTokenType.Text;[}]; - HtmlTokenType.Text;[o]; - Tag block - Gen - 4 - (27:0,27) - Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (27:0,27) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (31:0,31) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (32:0,32) - Tokens:1 - CSharpTokenType.RightBrace;[}]; +Markup block - Gen - 33 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 33 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[custom]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - ["Header"] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:1 + SyntaxKind.StringLiteral;["Header"]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (16:0,16) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (17:0,17) - Tokens:1 + SyntaxKind.LeftBrace;[{]; + Markup block - Gen - 14 - (18:0,18) + Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (18:0,18) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Tag block - Gen - 3 - (19:0,19) + Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (19:0,19) - Tokens:3 + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; + SyntaxKind.HtmlTextLiteral - [F{o}o] - [22..27) - FullWidth: 5 - Slots: 1 + SyntaxKind.List - [F{o}o] - [22..27) - FullWidth: 5 - Slots: 5 + SyntaxKind.Text;[F]; + SyntaxKind.Text;[{]; + SyntaxKind.Text;[o]; + SyntaxKind.Text;[}]; + SyntaxKind.Text;[o]; + Tag block - Gen - 4 - (27:0,27) + Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (27:0,27) - Tokens:4 + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (31:0,31) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (32:0,32) - Tokens:1 + SyntaxKind.RightBrace;[}]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (33:0,33) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsStringTokens.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsStringTokens.cspans.txt index de1247ad81..e3413d97ee 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsStringTokens.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsStringTokens.cspans.txt @@ -1,4 +1,6 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [17] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [17] ) MetaCode span at (1:0,1 [6] ) (Accepts:None) - Parent: Directive block at (0:0,0 [17] ) -Markup span at (7:0,7 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [17] ) -Code span at (8:0,8 [9] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [17] ) +Markup span at (7:0,7 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [17] ) +Code span at (8:0,8 [9] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [17] ) +Markup span at (17:0,17 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [17] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsStringTokens.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsStringTokens.stree.txt index 3413cd7516..bef10a81c3 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsStringTokens.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsStringTokens.stree.txt @@ -1,9 +1,14 @@ -Directive block - Gen - 17 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - ["AString"] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.StringLiteral;["AString"]; +Markup block - Gen - 17 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 17 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[custom]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - ["AString"] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:1 + SyntaxKind.StringLiteral;["AString"]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (17:0,17) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsTypeTokens.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsTypeTokens.cspans.txt index 1bbf8de3f4..fd5256e31f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsTypeTokens.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsTypeTokens.cspans.txt @@ -1,4 +1,6 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [42] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [42] ) MetaCode span at (1:0,1 [6] ) (Accepts:None) - Parent: Directive block at (0:0,0 [42] ) -Code span at (7:0,7 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [42] ) -Code span at (8:0,8 [34] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [42] ) +Code span at (7:0,7 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [42] ) +Code span at (8:0,8 [34] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [42] ) +Markup span at (42:0,42 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [42] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsTypeTokens.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsTypeTokens.stree.txt index 4032e9314f..0947eb9d41 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsTypeTokens.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/DirectiveDescriptor_UnderstandsTypeTokens.stree.txt @@ -1,15 +1,20 @@ -Directive block - Gen - 42 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [System.Text.Encoding.ASCIIEncoding] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:7 - CSharpTokenType.Identifier;[System]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Text]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Encoding]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[ASCIIEncoding]; +Markup block - Gen - 42 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 42 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[custom]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [System.Text.Encoding.ASCIIEncoding] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:7 + SyntaxKind.Identifier;[System]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Text]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Encoding]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[ASCIIEncoding]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (42:0,42) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Directives_CanUseReservedWord_Class.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Directives_CanUseReservedWord_Class.cspans.txt index edcf8072b2..35eaf0bb6c 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Directives_CanUseReservedWord_Class.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Directives_CanUseReservedWord_Class.cspans.txt @@ -1,2 +1,4 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [6] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [6] ) MetaCode span at (1:0,1 [5] ) (Accepts:None) - Parent: Directive block at (0:0,0 [6] ) +Markup span at (6:0,6 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [6] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Directives_CanUseReservedWord_Class.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Directives_CanUseReservedWord_Class.stree.txt index 32fae95183..5c945ea75b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Directives_CanUseReservedWord_Class.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Directives_CanUseReservedWord_Class.stree.txt @@ -1,5 +1,10 @@ -Directive block - Gen - 6 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [class] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Keyword;[class]; +Markup block - Gen - 6 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 6 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [class] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Keyword;[class]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (6:0,6) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Directives_CanUseReservedWord_Namespace.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Directives_CanUseReservedWord_Namespace.cspans.txt index c92fb77651..65fa84c6ab 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Directives_CanUseReservedWord_Namespace.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Directives_CanUseReservedWord_Namespace.cspans.txt @@ -1,2 +1,4 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [10] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [10] ) MetaCode span at (1:0,1 [9] ) (Accepts:None) - Parent: Directive block at (0:0,0 [10] ) +Markup span at (10:0,10 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [10] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Directives_CanUseReservedWord_Namespace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Directives_CanUseReservedWord_Namespace.stree.txt index 2beaf1fc4f..83ae36a2e6 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Directives_CanUseReservedWord_Namespace.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Directives_CanUseReservedWord_Namespace.stree.txt @@ -1,5 +1,10 @@ -Directive block - Gen - 10 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [namespace] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Keyword;[namespace]; +Markup block - Gen - 10 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 10 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [namespace] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Keyword;[namespace]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (10:0,10) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/EmptyFunctionsDirective.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/EmptyFunctionsDirective.cspans.txt index 17a8238d63..ec35aaf914 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/EmptyFunctionsDirective.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/EmptyFunctionsDirective.cspans.txt @@ -1,6 +1,8 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [14] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [14] ) MetaCode span at (1:0,1 [9] ) (Accepts:None) - Parent: Directive block at (0:0,0 [14] ) -Markup span at (10:0,10 [1] ) (Accepts:AllWhiteSpace) - Parent: Directive block at (0:0,0 [14] ) +Markup span at (10:0,10 [1] ) (Accepts:AllWhitespace) - Parent: Directive block at (0:0,0 [14] ) MetaCode span at (11:0,11 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [14] ) Code span at (12:0,12 [1] ) (Accepts:Any) - Parent: Directive block at (0:0,0 [14] ) MetaCode span at (13:0,13 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [14] ) +Markup span at (14:0,14 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [14] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/EmptyFunctionsDirective.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/EmptyFunctionsDirective.stree.txt index f4f2d2009c..b35ade0d67 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/EmptyFunctionsDirective.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/EmptyFunctionsDirective.stree.txt @@ -1,13 +1,18 @@ -Directive block - Gen - 14 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [functions] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[functions]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (10:0,10) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (11:0,11) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; - Code span - Gen - [ ] - CodeBlockEditHandler;Accepts:Any;CodeBlock - (12:0,12) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 - CSharpTokenType.RightBrace;[}]; +Markup block - Gen - 14 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 14 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [functions] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[functions]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (10:0,10) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (11:0,11) - Tokens:1 + SyntaxKind.LeftBrace;[{]; + Code span - Gen - [ ] - CodeBlockEditHandler;Accepts:Any;CodeBlock - (12:0,12) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 + SyntaxKind.RightBrace;[}]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/ExtensibleDirectiveDoesNotErorrIfNotAtStartOfLineBecauseOfWhitespace.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/ExtensibleDirectiveDoesNotErorrIfNotAtStartOfLineBecauseOfWhitespace.cspans.txt index 13f5f32062..212cedc070 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/ExtensibleDirectiveDoesNotErorrIfNotAtStartOfLineBecauseOfWhitespace.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/ExtensibleDirectiveDoesNotErorrIfNotAtStartOfLineBecauseOfWhitespace.cspans.txt @@ -1,5 +1,7 @@ -Code span at (0:0,0 [4] ) (Accepts:Any) - Parent: Directive block at (0:0,0 [46] ) -Transition span at (4:1,2 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [46] ) -MetaCode span at (5:1,3 [6] ) (Accepts:None) - Parent: Directive block at (0:0,0 [46] ) -Code span at (11:1,9 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [46] ) -Code span at (12:1,10 [34] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [46] ) +Markup span at (0:0,0 [2] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [46] ) +Code span at (2:1,0 [2] ) (Accepts:Any) - Parent: Directive block at (2:1,0 [44] ) +Transition span at (4:1,2 [1] ) (Accepts:None) - Parent: Directive block at (2:1,0 [44] ) +MetaCode span at (5:1,3 [6] ) (Accepts:None) - Parent: Directive block at (2:1,0 [44] ) +Code span at (11:1,9 [1] ) (Accepts:Whitespace) - Parent: Directive block at (2:1,0 [44] ) +Code span at (12:1,10 [34] ) (Accepts:NonWhitespace) - Parent: Directive block at (2:1,0 [44] ) +Markup span at (46:1,44 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [46] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/ExtensibleDirectiveDoesNotErorrIfNotAtStartOfLineBecauseOfWhitespace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/ExtensibleDirectiveDoesNotErorrIfNotAtStartOfLineBecauseOfWhitespace.stree.txt index cb071c8170..9800bcc8f0 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/ExtensibleDirectiveDoesNotErorrIfNotAtStartOfLineBecauseOfWhitespace.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/ExtensibleDirectiveDoesNotErorrIfNotAtStartOfLineBecauseOfWhitespace.stree.txt @@ -1,18 +1,22 @@ -Directive block - Gen - 46 - (0:0,0) - Code span - Gen - [LF ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:2 - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (4:1,2) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (5:1,3) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (11:1,9) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [System.Text.Encoding.ASCIIEncoding] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (12:1,10) - Tokens:7 - CSharpTokenType.Identifier;[System]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Text]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Encoding]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[ASCIIEncoding]; +Markup block - Gen - 46 - (0:0,0) + Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.NewLine;[LF]; + Directive block - Gen - 44 - (2:1,0) + Code span - Gen - [ ] - SpanEditHandler;Accepts:Any - (2:1,0) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (4:1,2) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (5:1,3) - Tokens:1 + SyntaxKind.Identifier;[custom]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (11:1,9) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [System.Text.Encoding.ASCIIEncoding] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (12:1,10) - Tokens:7 + SyntaxKind.Identifier;[System]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Text]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Encoding]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[ASCIIEncoding]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (46:1,44) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/ExtensibleDirectiveErrorsIfNotAtStartOfLine.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/ExtensibleDirectiveErrorsIfNotAtStartOfLine.cspans.txt index 4cadbefff0..2b00010889 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/ExtensibleDirectiveErrorsIfNotAtStartOfLine.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/ExtensibleDirectiveErrorsIfNotAtStartOfLine.cspans.txt @@ -1,9 +1,7 @@ -MetaCode span at (0:0,0 [1] ) (Accepts:None) - Parent: Statement block at (0:0,0 [48] ) -Code span at (1:0,1 [2] ) (Accepts:Any) - Parent: Statement block at (0:0,0 [48] ) +Markup span at (0:0,0 [3] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [48] ) Transition span at (3:0,3 [1] ) (Accepts:None) - Parent: Directive block at (3:0,3 [44] ) MetaCode span at (4:0,4 [6] ) (Accepts:None) - Parent: Directive block at (3:0,3 [44] ) -Code span at (10:0,10 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (3:0,3 [44] ) -Code span at (11:0,11 [34] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (3:0,3 [44] ) -Markup span at (45:0,45 [2] ) (Accepts:WhiteSpace) - Parent: Directive block at (3:0,3 [44] ) -Code span at (47:1,0 [0] ) (Accepts:Any) - Parent: Statement block at (0:0,0 [48] ) -MetaCode span at (47:1,0 [1] ) (Accepts:None) - Parent: Statement block at (0:0,0 [48] ) +Code span at (10:0,10 [1] ) (Accepts:Whitespace) - Parent: Directive block at (3:0,3 [44] ) +Code span at (11:0,11 [34] ) (Accepts:NonWhitespace) - Parent: Directive block at (3:0,3 [44] ) +Markup span at (45:0,45 [2] ) (Accepts:Whitespace) - Parent: Directive block at (3:0,3 [44] ) +Markup span at (47:1,0 [1] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [48] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/ExtensibleDirectiveErrorsIfNotAtStartOfLine.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/ExtensibleDirectiveErrorsIfNotAtStartOfLine.stree.txt index ceac2d5c09..0921a9be45 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/ExtensibleDirectiveErrorsIfNotAtStartOfLine.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/ExtensibleDirectiveErrorsIfNotAtStartOfLine.stree.txt @@ -1,26 +1,23 @@ -Statement block - Gen - 48 - (0:0,0) - MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; - Code span - Gen - [ ] - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[];AtEOL - (1:0,1) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; +Markup block - Gen - 48 - (0:0,0) + Markup span - Gen - [{ ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:2 + SyntaxKind.Text;[{]; + SyntaxKind.Whitespace;[ ]; Directive block - Gen - 44 - (3:0,3) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (3:0,3) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (4:0,4) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (10:0,10) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [System.Text.Encoding.ASCIIEncoding] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (11:0,11) - Tokens:7 - CSharpTokenType.Identifier;[System]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Text]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Encoding]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[ASCIIEncoding]; - Markup span - Gen - [LF] - SpanEditHandler;Accepts:WhiteSpace - (45:0,45) - Tokens:1 - CSharpTokenType.NewLine;[LF]; - Code span - Gen - [] - SpanEditHandler;Accepts:Any - (47:1,0) - Tokens:1 - CSharpTokenType.Unknown;[]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (47:1,0) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Identifier;[custom]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (10:0,10) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [System.Text.Encoding.ASCIIEncoding] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (11:0,11) - Tokens:7 + SyntaxKind.Identifier;[System]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Text]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Encoding]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[ASCIIEncoding]; + Markup span - Gen - [LF] - SpanEditHandler;Accepts:Whitespace - (45:0,45) - Tokens:1 + SyntaxKind.NewLine;[LF]; + Markup span - Gen - [}] - SpanEditHandler;Accepts:Any - (47:1,0) - Tokens:1 + SyntaxKind.Text;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsArrays.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsArrays.cspans.txt index 3147ee9712..79d48099bf 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsArrays.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsArrays.cspans.txt @@ -1,6 +1,6 @@ Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [22] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [22] ) MetaCode span at (1:0,1 [8] ) (Accepts:None) - Parent: Directive block at (0:0,0 [22] ) -Code span at (9:0,9 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [22] ) -Code span at (10:0,10 [12] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [22] ) +Code span at (9:0,9 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [22] ) +Code span at (10:0,10 [12] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [22] ) Markup span at (22:0,22 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [22] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsArrays.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsArrays.stree.txt index 4dba3c76e7..cb7c610d0e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsArrays.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsArrays.stree.txt @@ -1,20 +1,20 @@ Markup block - Gen - 22 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 22 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [inherits] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[inherits]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [string[[]][]] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (10:0,10) - Tokens:7 - CSharpTokenType.Keyword;[string]; - CSharpTokenType.LeftBracket;[[]; - CSharpTokenType.LeftBracket;[[]; - CSharpTokenType.RightBracket;[]]; - CSharpTokenType.RightBracket;[]]; - CSharpTokenType.LeftBracket;[[]; - CSharpTokenType.RightBracket;[]]; + SyntaxKind.Identifier;[inherits]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (9:0,9) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [string[[]][]] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (10:0,10) - Tokens:7 + SyntaxKind.Keyword;[string]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.RightBracket;[]]; + SyntaxKind.RightBracket;[]]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.RightBracket;[]]; Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (22:0,22) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsNestedGenerics.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsNestedGenerics.cspans.txt index 2b3f6f0879..4a73c4c8ca 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsNestedGenerics.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsNestedGenerics.cspans.txt @@ -1,6 +1,6 @@ Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [87] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [87] ) MetaCode span at (1:0,1 [8] ) (Accepts:None) - Parent: Directive block at (0:0,0 [87] ) -Code span at (9:0,9 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [87] ) -Code span at (10:0,10 [77] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [87] ) +Code span at (9:0,9 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [87] ) +Code span at (10:0,10 [77] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [87] ) Markup span at (87:0,87 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [87] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsNestedGenerics.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsNestedGenerics.stree.txt index 598a5043f8..9a883699ea 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsNestedGenerics.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsNestedGenerics.stree.txt @@ -1,30 +1,30 @@ Markup block - Gen - 87 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 87 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [inherits] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[inherits]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [System.Web.Mvc.WebViewPage>] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (10:0,10) - Tokens:17 - CSharpTokenType.Identifier;[System]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Web]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Mvc]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[WebViewPage]; - CSharpTokenType.LessThan;[<]; - CSharpTokenType.Identifier;[IEnumerable]; - CSharpTokenType.LessThan;[<]; - CSharpTokenType.Identifier;[MvcApplication2]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Models]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[RegisterModel]; - CSharpTokenType.GreaterThan;[>]; - CSharpTokenType.GreaterThan;[>]; + SyntaxKind.Identifier;[inherits]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (9:0,9) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [System.Web.Mvc.WebViewPage>] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (10:0,10) - Tokens:17 + SyntaxKind.Identifier;[System]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Web]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Mvc]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[WebViewPage]; + SyntaxKind.LessThan;[<]; + SyntaxKind.Identifier;[IEnumerable]; + SyntaxKind.LessThan;[<]; + SyntaxKind.Identifier;[MvcApplication2]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Models]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[RegisterModel]; + SyntaxKind.GreaterThan;[>]; + SyntaxKind.GreaterThan;[>]; Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (87:0,87) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsTypeKeywords.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsTypeKeywords.cspans.txt index 814c89b4eb..0be18525ff 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsTypeKeywords.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsTypeKeywords.cspans.txt @@ -1,6 +1,6 @@ Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [16] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [16] ) MetaCode span at (1:0,1 [8] ) (Accepts:None) - Parent: Directive block at (0:0,0 [16] ) -Code span at (9:0,9 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [16] ) -Code span at (10:0,10 [6] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [16] ) +Code span at (9:0,9 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [16] ) +Code span at (10:0,10 [6] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [16] ) Markup span at (16:0,16 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [16] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsTypeKeywords.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsTypeKeywords.stree.txt index a65a1bba4c..5a7bc55b5c 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsTypeKeywords.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/InheritsDirectiveSupportsTypeKeywords.stree.txt @@ -1,14 +1,14 @@ Markup block - Gen - 16 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 16 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [inherits] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[inherits]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [string] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (10:0,10) - Tokens:1 - CSharpTokenType.Keyword;[string]; + SyntaxKind.Identifier;[inherits]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (9:0,9) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [string] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (10:0,10) - Tokens:1 + SyntaxKind.Keyword;[string]; Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (16:0,16) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_AreSkipped.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_AreSkipped.cspans.txt index f1fd6cb92b..2afc521ace 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_AreSkipped.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_AreSkipped.cspans.txt @@ -1,3 +1,5 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [8] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [8] ) MetaCode span at (1:0,1 [6] ) (Accepts:None) - Parent: Directive block at (0:0,0 [8] ) -Markup span at (7:0,7 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [8] ) +Markup span at (7:0,7 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [8] ) +Markup span at (8:0,8 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [8] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_AreSkipped.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_AreSkipped.stree.txt index 5b7ca1b209..937267a115 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_AreSkipped.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_AreSkipped.stree.txt @@ -1,7 +1,12 @@ -Directive block - Gen - 8 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; +Markup block - Gen - 8 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 8 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[custom]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (8:0,8) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_WithBraces_AreParsed.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_WithBraces_AreParsed.cspans.txt index a54168ebd2..1b7631b73f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_WithBraces_AreParsed.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_WithBraces_AreParsed.cspans.txt @@ -1,4 +1,6 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [29] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [29] ) MetaCode span at (1:0,1 [6] ) (Accepts:None) - Parent: Directive block at (0:0,0 [29] ) -Markup span at (7:0,7 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [29] ) -Code span at (8:0,8 [21] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [29] ) +Markup span at (7:0,7 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [29] ) +Code span at (8:0,8 [21] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [29] ) +Markup span at (29:0,29 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [29] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_WithBraces_AreParsed.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_WithBraces_AreParsed.stree.txt index 1951c2e8a1..a08f88a74b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_WithBraces_AreParsed.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_WithBraces_AreParsed.stree.txt @@ -1,9 +1,14 @@ -Directive block - Gen - 29 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - ["{formaction}?/{id}?"] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.StringLiteral;["{formaction}?/{id}?"]; +Markup block - Gen - 29 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 29 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[custom]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - ["{formaction}?/{id}?"] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:1 + SyntaxKind.StringLiteral;["{formaction}?/{id}?"]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (29:0,29) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_WithMultipleOptionalTokens_AreParsed.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_WithMultipleOptionalTokens_AreParsed.cspans.txt index 39ac31cfc7..d4a6305e23 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_WithMultipleOptionalTokens_AreParsed.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_WithMultipleOptionalTokens_AreParsed.cspans.txt @@ -1,6 +1,8 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [43] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [43] ) MetaCode span at (1:0,1 [6] ) (Accepts:None) - Parent: Directive block at (0:0,0 [43] ) -Markup span at (7:0,7 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [43] ) -Code span at (8:0,8 [21] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [43] ) -Code span at (29:0,29 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [43] ) -Code span at (30:0,30 [13] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [43] ) +Markup span at (7:0,7 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [43] ) +Code span at (8:0,8 [21] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [43] ) +Code span at (29:0,29 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [43] ) +Code span at (30:0,30 [13] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [43] ) +Markup span at (43:0,43 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [43] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_WithMultipleOptionalTokens_AreParsed.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_WithMultipleOptionalTokens_AreParsed.stree.txt index 4f534b5d86..7cb6d46f42 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_WithMultipleOptionalTokens_AreParsed.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_WithMultipleOptionalTokens_AreParsed.stree.txt @@ -1,15 +1,20 @@ -Directive block - Gen - 43 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - ["{formaction}?/{id}?"] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.StringLiteral;["{formaction}?/{id}?"]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (29:0,29) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [System.String] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (30:0,30) - Tokens:3 - CSharpTokenType.Identifier;[System]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[String]; +Markup block - Gen - 43 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 43 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[custom]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - ["{formaction}?/{id}?"] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:1 + SyntaxKind.StringLiteral;["{formaction}?/{id}?"]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (29:0,29) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [System.String] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (30:0,30) - Tokens:3 + SyntaxKind.Identifier;[System]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[String]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (43:0,43) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_WithSimpleTokens_AreParsed.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_WithSimpleTokens_AreParsed.cspans.txt index 2fca4ed7c1..bd10c900ba 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_WithSimpleTokens_AreParsed.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_WithSimpleTokens_AreParsed.cspans.txt @@ -1,4 +1,6 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [22] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [22] ) MetaCode span at (1:0,1 [6] ) (Accepts:None) - Parent: Directive block at (0:0,0 [22] ) -Markup span at (7:0,7 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [22] ) -Code span at (8:0,8 [14] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [22] ) +Markup span at (7:0,7 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [22] ) +Code span at (8:0,8 [14] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [22] ) +Markup span at (22:0,22 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [22] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_WithSimpleTokens_AreParsed.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_WithSimpleTokens_AreParsed.stree.txt index 1e6bb057fa..2709d6336d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_WithSimpleTokens_AreParsed.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalDirectiveTokens_WithSimpleTokens_AreParsed.stree.txt @@ -1,9 +1,14 @@ -Directive block - Gen - 22 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - ["simple-value"] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.StringLiteral;["simple-value"]; +Markup block - Gen - 22 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 22 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[custom]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - ["simple-value"] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:1 + SyntaxKind.StringLiteral;["simple-value"]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (22:0,22) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalMemberTokens_WithMemberSpecified_IsParsed.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalMemberTokens_WithMemberSpecified_IsParsed.cspans.txt index 0e09c28b92..0fe58ec33c 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalMemberTokens_WithMemberSpecified_IsParsed.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalMemberTokens_WithMemberSpecified_IsParsed.cspans.txt @@ -1,4 +1,6 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [27] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [27] ) MetaCode span at (1:0,1 [13] ) (Accepts:None) - Parent: Directive block at (0:0,0 [27] ) -Code span at (14:0,14 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [27] ) -Code span at (15:0,15 [12] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [27] ) +Code span at (14:0,14 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [27] ) +Code span at (15:0,15 [12] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [27] ) +Markup span at (27:0,27 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [27] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalMemberTokens_WithMemberSpecified_IsParsed.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalMemberTokens_WithMemberSpecified_IsParsed.stree.txt index 114b39032d..f9f4020e32 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalMemberTokens_WithMemberSpecified_IsParsed.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalMemberTokens_WithMemberSpecified_IsParsed.stree.txt @@ -1,9 +1,14 @@ -Directive block - Gen - 27 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [TestDirective] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[TestDirective]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (14:0,14) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [PropertyName] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (15:0,15) - Tokens:1 - CSharpTokenType.Identifier;[PropertyName]; +Markup block - Gen - 27 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 27 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [TestDirective] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[TestDirective]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (14:0,14) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [PropertyName] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (15:0,15) - Tokens:1 + SyntaxKind.Identifier;[PropertyName]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (27:0,27) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalMemberTokens_WithMissingMember_IsParsed.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalMemberTokens_WithMissingMember_IsParsed.cspans.txt index bd5a26dfaf..de71313701 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalMemberTokens_WithMissingMember_IsParsed.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalMemberTokens_WithMissingMember_IsParsed.cspans.txt @@ -1,4 +1,6 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [15] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [15] ) MetaCode span at (1:0,1 [13] ) (Accepts:None) - Parent: Directive block at (0:0,0 [15] ) -Code span at (14:0,14 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [15] ) -Code span at (15:0,15 [0] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [15] ) +Code span at (14:0,14 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [15] ) +Code span at (15:0,15 [0] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [15] ) +Markup span at (15:0,15 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [15] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalMemberTokens_WithMissingMember_IsParsed.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalMemberTokens_WithMissingMember_IsParsed.stree.txt index ee0063aa4b..e7a4614bd4 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalMemberTokens_WithMissingMember_IsParsed.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/OptionalMemberTokens_WithMissingMember_IsParsed.stree.txt @@ -1,9 +1,14 @@ -Directive block - Gen - 15 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [TestDirective] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[TestDirective]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (14:0,14) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (15:0,15) - Tokens:1 - CSharpTokenType.Unknown;[]; +Markup block - Gen - 15 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 15 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [TestDirective] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[TestDirective]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (14:0,14) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (15:0,15) - Tokens:1 + SyntaxKind.Unknown;[]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (15:0,15) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parse_FunctionsDirective.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parse_FunctionsDirective.cspans.txt index d5fc0c09b5..56124263ab 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parse_FunctionsDirective.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parse_FunctionsDirective.cspans.txt @@ -1,6 +1,8 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [28] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [28] ) MetaCode span at (1:0,1 [9] ) (Accepts:None) - Parent: Directive block at (0:0,0 [28] ) -Markup span at (10:0,10 [1] ) (Accepts:AllWhiteSpace) - Parent: Directive block at (0:0,0 [28] ) +Markup span at (10:0,10 [1] ) (Accepts:AllWhitespace) - Parent: Directive block at (0:0,0 [28] ) MetaCode span at (11:0,11 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [28] ) Code span at (12:0,12 [15] ) (Accepts:Any) - Parent: Directive block at (0:0,0 [28] ) MetaCode span at (27:0,27 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [28] ) +Markup span at (28:0,28 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [28] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parse_FunctionsDirective.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parse_FunctionsDirective.stree.txt index 119a7b047b..d6b8dce298 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parse_FunctionsDirective.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parse_FunctionsDirective.stree.txt @@ -1,23 +1,28 @@ -Directive block - Gen - 28 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [functions] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[functions]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (10:0,10) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (11:0,11) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; - Code span - Gen - [ foo(); bar(); ] - CodeBlockEditHandler;Accepts:Any;CodeBlock - (12:0,12) - Tokens:11 - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (27:0,27) - Tokens:1 - CSharpTokenType.RightBrace;[}]; +Markup block - Gen - 28 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 28 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [functions] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[functions]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (10:0,10) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (11:0,11) - Tokens:1 + SyntaxKind.LeftBrace;[{]; + Code span - Gen - [ foo(); bar(); ] - CodeBlockEditHandler;Accepts:Any;CodeBlock - (12:0,12) - Tokens:11 + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (27:0,27) - Tokens:1 + SyntaxKind.RightBrace;[}]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (28:0,28) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parse_SectionDirective.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parse_SectionDirective.cspans.txt index 4e1fdc7d0c..ec566ae759 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parse_SectionDirective.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parse_SectionDirective.cspans.txt @@ -1,8 +1,9 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [32] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [32] ) MetaCode span at (1:0,1 [7] ) (Accepts:None) - Parent: Directive block at (0:0,0 [32] ) -Code span at (8:0,8 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [32] ) -Code span at (9:0,9 [6] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [32] ) -Markup span at (15:0,15 [1] ) (Accepts:AllWhiteSpace) - Parent: Directive block at (0:0,0 [32] ) +Code span at (8:0,8 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [32] ) +Code span at (9:0,9 [6] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [32] ) +Markup span at (15:0,15 [1] ) (Accepts:AllWhitespace) - Parent: Directive block at (0:0,0 [32] ) MetaCode span at (16:0,16 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [32] ) Markup span at (17:0,17 [1] ) (Accepts:Any) - Parent: Markup block at (17:0,17 [14] ) Markup span at (18:0,18 [3] ) (Accepts:Any) - Parent: Tag block at (18:0,18 [3] ) @@ -10,3 +11,4 @@ Markup span at (21:0,21 [5] ) (Accepts:Any) - Parent: Markup block at (17:0,17 [ Markup span at (26:0,26 [4] ) (Accepts:Any) - Parent: Tag block at (26:0,26 [4] ) Markup span at (30:0,30 [1] ) (Accepts:Any) - Parent: Markup block at (17:0,17 [14] ) MetaCode span at (31:0,31 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [32] ) +Markup span at (32:0,32 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [32] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parse_SectionDirective.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parse_SectionDirective.stree.txt index 2af805b4b0..3a6b35cf22 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parse_SectionDirective.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parse_SectionDirective.stree.txt @@ -1,37 +1,43 @@ -Directive block - Gen - 32 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [Header] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[Header]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (15:0,15) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (16:0,16) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; - Markup block - Gen - 14 - (17:0,17) - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (17:0,17) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; - Tag block - Gen - 3 - (18:0,18) - Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (18:0,18) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [F{o}o] - SpanEditHandler;Accepts:Any - (21:0,21) - Tokens:5 - HtmlTokenType.Text;[F]; - HtmlTokenType.Text;[{]; - HtmlTokenType.Text;[o]; - HtmlTokenType.Text;[}]; - HtmlTokenType.Text;[o]; - Tag block - Gen - 4 - (26:0,26) - Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (26:0,26) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (30:0,30) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; - MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (31:0,31) - Tokens:1 - CSharpTokenType.RightBrace;[}]; +Markup block - Gen - 32 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 32 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[section]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [Header] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 + SyntaxKind.Identifier;[Header]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (15:0,15) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (16:0,16) - Tokens:1 + SyntaxKind.LeftBrace;[{]; + Markup block - Gen - 14 - (17:0,17) + Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (17:0,17) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Tag block - Gen - 3 - (18:0,18) + Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (18:0,18) - Tokens:3 + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; + SyntaxKind.HtmlTextLiteral - [F{o}o] - [21..26) - FullWidth: 5 - Slots: 1 + SyntaxKind.List - [F{o}o] - [21..26) - FullWidth: 5 - Slots: 5 + SyntaxKind.Text;[F]; + SyntaxKind.Text;[{]; + SyntaxKind.Text;[o]; + SyntaxKind.Text;[}]; + SyntaxKind.Text;[o]; + Tag block - Gen - 4 - (26:0,26) + Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (26:0,26) - Tokens:4 + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (30:0,30) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (31:0,31) - Tokens:1 + SyntaxKind.RightBrace;[}]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (32:0,32) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parser_ParsesNamespaceDirectiveToken_WithMultipleSegments.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parser_ParsesNamespaceDirectiveToken_WithMultipleSegments.cspans.txt index 37abb54fcf..93ef395357 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parser_ParsesNamespaceDirectiveToken_WithMultipleSegments.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parser_ParsesNamespaceDirectiveToken_WithMultipleSegments.cspans.txt @@ -1,4 +1,6 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [29] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [29] ) MetaCode span at (1:0,1 [6] ) (Accepts:None) - Parent: Directive block at (0:0,0 [29] ) -Code span at (7:0,7 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [29] ) -Code span at (8:0,8 [21] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [29] ) +Code span at (7:0,7 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [29] ) +Code span at (8:0,8 [21] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [29] ) +Markup span at (29:0,29 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [29] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parser_ParsesNamespaceDirectiveToken_WithMultipleSegments.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parser_ParsesNamespaceDirectiveToken_WithMultipleSegments.stree.txt index 9776383715..0585c3609b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parser_ParsesNamespaceDirectiveToken_WithMultipleSegments.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parser_ParsesNamespaceDirectiveToken_WithMultipleSegments.stree.txt @@ -1,13 +1,18 @@ -Directive block - Gen - 29 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [BaseNamespace.Foo.Bar] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:5 - CSharpTokenType.Identifier;[BaseNamespace]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Bar]; +Markup block - Gen - 29 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 29 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[custom]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [BaseNamespace.Foo.Bar] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:5 + SyntaxKind.Identifier;[BaseNamespace]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Bar]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (29:0,29) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parser_ParsesNamespaceDirectiveToken_WithSingleSegment.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parser_ParsesNamespaceDirectiveToken_WithSingleSegment.cspans.txt index 6b4d8a5908..e096a23423 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parser_ParsesNamespaceDirectiveToken_WithSingleSegment.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parser_ParsesNamespaceDirectiveToken_WithSingleSegment.cspans.txt @@ -1,4 +1,6 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [21] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [21] ) MetaCode span at (1:0,1 [6] ) (Accepts:None) - Parent: Directive block at (0:0,0 [21] ) -Code span at (7:0,7 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [21] ) -Code span at (8:0,8 [13] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [21] ) +Code span at (7:0,7 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [21] ) +Code span at (8:0,8 [13] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [21] ) +Markup span at (21:0,21 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [21] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parser_ParsesNamespaceDirectiveToken_WithSingleSegment.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parser_ParsesNamespaceDirectiveToken_WithSingleSegment.stree.txt index 8a637f25e1..446919afdb 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parser_ParsesNamespaceDirectiveToken_WithSingleSegment.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/Parser_ParsesNamespaceDirectiveToken_WithSingleSegment.stree.txt @@ -1,9 +1,14 @@ -Directive block - Gen - 21 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[custom]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (7:0,7) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [BaseNamespace] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.Identifier;[BaseNamespace]; +Markup block - Gen - 21 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 21 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [custom] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[custom]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (7:0,7) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [BaseNamespace] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:1 + SyntaxKind.Identifier;[BaseNamespace]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (21:0,21) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_EndQuoteRequiresDoubleQuotesAroundValue.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_EndQuoteRequiresDoubleQuotesAroundValue.cspans.txt index 814a67e317..b0884a958a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_EndQuoteRequiresDoubleQuotesAroundValue.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_EndQuoteRequiresDoubleQuotesAroundValue.cspans.txt @@ -1,4 +1,6 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [21] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [21] ) MetaCode span at (1:0,1 [15] ) (Accepts:None) - Parent: Directive block at (0:0,0 [21] ) Markup span at (16:0,16 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [21] ) Code span at (17:0,17 [4] ) (Accepts:AnyExceptNewline) - Parent: Directive block at (0:0,0 [21] ) +Markup span at (21:0,21 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [21] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_EndQuoteRequiresDoubleQuotesAroundValue.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_EndQuoteRequiresDoubleQuotesAroundValue.stree.txt index 7d2f6da517..ed5ff5d728 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_EndQuoteRequiresDoubleQuotesAroundValue.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_EndQuoteRequiresDoubleQuotesAroundValue.stree.txt @@ -1,10 +1,15 @@ -Directive block - Gen - 21 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [removeTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[removeTagHelper]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [Foo"] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:2 - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.StringLiteral;["];RZ1000(20:0,20 [1] ) +Markup block - Gen - 21 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 21 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [removeTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[removeTagHelper]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [Foo"] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:2 + SyntaxKind.Identifier;[Foo]; + SyntaxKind.StringLiteral;["];RZ1000(20:0,20 [1] ) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (21:0,21) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_InvalidLookupText_AddsError.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_InvalidLookupText_AddsError.cspans.txt index d6dde5b7a8..a3ad9a1394 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_InvalidLookupText_AddsError.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_InvalidLookupText_AddsError.cspans.txt @@ -1,4 +1,6 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [20] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [20] ) MetaCode span at (1:0,1 [15] ) (Accepts:None) - Parent: Directive block at (0:0,0 [20] ) Markup span at (16:0,16 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [20] ) Code span at (17:0,17 [3] ) (Accepts:AnyExceptNewline) - Parent: Directive block at (0:0,0 [20] ) +Markup span at (20:0,20 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [20] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_InvalidLookupText_AddsError.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_InvalidLookupText_AddsError.stree.txt index 860f903187..688bccd009 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_InvalidLookupText_AddsError.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_InvalidLookupText_AddsError.stree.txt @@ -1,9 +1,14 @@ -Directive block - Gen - 20 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [removeTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[removeTagHelper]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [Foo] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 - CSharpTokenType.Identifier;[Foo]; +Markup block - Gen - 20 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 20 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [removeTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[removeTagHelper]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [Foo] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 + SyntaxKind.Identifier;[Foo]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (20:0,20) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_NoValue_Invalid.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_NoValue_Invalid.cspans.txt index d847da62f5..0dfe38be7c 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_NoValue_Invalid.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_NoValue_Invalid.cspans.txt @@ -1,4 +1,6 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [19] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [19] ) MetaCode span at (1:0,1 [15] ) (Accepts:None) - Parent: Directive block at (0:0,0 [19] ) Markup span at (16:0,16 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [19] ) Code span at (17:0,17 [2] ) (Accepts:AnyExceptNewline) - Parent: Directive block at (0:0,0 [19] ) +Markup span at (19:0,19 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [19] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_NoValue_Invalid.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_NoValue_Invalid.stree.txt index 73ba9fd131..bab4f16853 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_NoValue_Invalid.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_NoValue_Invalid.stree.txt @@ -1,9 +1,14 @@ -Directive block - Gen - 19 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [removeTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[removeTagHelper]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [""] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 - CSharpTokenType.StringLiteral;[""]; +Markup block - Gen - 19 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 19 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [removeTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[removeTagHelper]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [""] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 + SyntaxKind.StringLiteral;[""]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (19:0,19) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_RequiresValue.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_RequiresValue.cspans.txt index adc30c55d8..a8d324c3dc 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_RequiresValue.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_RequiresValue.cspans.txt @@ -1,4 +1,6 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [17] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [17] ) MetaCode span at (1:0,1 [15] ) (Accepts:None) - Parent: Directive block at (0:0,0 [17] ) Markup span at (16:0,16 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [17] ) Code span at (17:0,17 [0] ) (Accepts:AnyExceptNewline) - Parent: Directive block at (0:0,0 [17] ) +Markup span at (17:0,17 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [17] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_RequiresValue.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_RequiresValue.stree.txt index 2666ac8a58..37aa1e6a54 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_RequiresValue.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_RequiresValue.stree.txt @@ -1,9 +1,14 @@ -Directive block - Gen - 17 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [removeTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[removeTagHelper]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 - CSharpTokenType.Unknown;[]; +Markup block - Gen - 17 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 17 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [removeTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[removeTagHelper]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 + SyntaxKind.Unknown;[]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (17:0,17) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_SingleQuotes_AddsError.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_SingleQuotes_AddsError.cspans.txt index 82433192e9..d9553ee9ff 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_SingleQuotes_AddsError.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_SingleQuotes_AddsError.cspans.txt @@ -1,4 +1,6 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [25] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [25] ) MetaCode span at (1:0,1 [15] ) (Accepts:None) - Parent: Directive block at (0:0,0 [25] ) Markup span at (16:0,16 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [25] ) Code span at (17:0,17 [8] ) (Accepts:AnyExceptNewline) - Parent: Directive block at (0:0,0 [25] ) +Markup span at (25:0,25 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [25] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_SingleQuotes_AddsError.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_SingleQuotes_AddsError.stree.txt index acf4682a63..84791ee2db 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_SingleQuotes_AddsError.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_SingleQuotes_AddsError.stree.txt @@ -1,9 +1,14 @@ -Directive block - Gen - 25 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [removeTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[removeTagHelper]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - ['*, Foo'] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 - CSharpTokenType.CharacterLiteral;['*, Foo']; +Markup block - Gen - 25 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 25 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [removeTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[removeTagHelper]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - ['*, Foo'] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 + SyntaxKind.CharacterLiteral;['*, Foo']; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (25:0,25) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_StartQuoteRequiresDoubleQuotesAroundValue.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_StartQuoteRequiresDoubleQuotesAroundValue.cspans.txt index 814a67e317..b0884a958a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_StartQuoteRequiresDoubleQuotesAroundValue.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_StartQuoteRequiresDoubleQuotesAroundValue.cspans.txt @@ -1,4 +1,6 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [21] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [21] ) MetaCode span at (1:0,1 [15] ) (Accepts:None) - Parent: Directive block at (0:0,0 [21] ) Markup span at (16:0,16 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [21] ) Code span at (17:0,17 [4] ) (Accepts:AnyExceptNewline) - Parent: Directive block at (0:0,0 [21] ) +Markup span at (21:0,21 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [21] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_StartQuoteRequiresDoubleQuotesAroundValue.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_StartQuoteRequiresDoubleQuotesAroundValue.stree.txt index 5483dd02f2..a05a980ac3 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_StartQuoteRequiresDoubleQuotesAroundValue.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_StartQuoteRequiresDoubleQuotesAroundValue.stree.txt @@ -1,9 +1,14 @@ -Directive block - Gen - 21 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [removeTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[removeTagHelper]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - ["Foo] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 - CSharpTokenType.StringLiteral;["Foo];RZ1000(17:0,17 [1] ) +Markup block - Gen - 21 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 21 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [removeTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[removeTagHelper]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - ["Foo] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 + SyntaxKind.StringLiteral;["Foo];RZ1000(17:0,17 [1] ) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (21:0,21) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_SupportsSpaces.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_SupportsSpaces.cspans.txt index 7047bf83e0..71bf30f73f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_SupportsSpaces.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_SupportsSpaces.cspans.txt @@ -1,4 +1,6 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [35] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [35] ) MetaCode span at (1:0,1 [15] ) (Accepts:None) - Parent: Directive block at (0:0,0 [35] ) Markup span at (16:0,16 [5] ) (Accepts:None) - Parent: Directive block at (0:0,0 [35] ) Code span at (21:0,21 [14] ) (Accepts:AnyExceptNewline) - Parent: Directive block at (0:0,0 [35] ) +Markup span at (35:0,35 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [35] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_SupportsSpaces.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_SupportsSpaces.stree.txt index 2bcd74c5e6..fe72198ba6 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_SupportsSpaces.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_SupportsSpaces.stree.txt @@ -1,13 +1,18 @@ -Directive block - Gen - 35 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [removeTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[removeTagHelper]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [Foo, Bar ] - SpanEditHandler;Accepts:AnyExceptNewline - (21:0,21) - Tokens:5 - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.Comma;[,]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.WhiteSpace;[ ]; +Markup block - Gen - 35 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 35 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [removeTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[removeTagHelper]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [Foo, Bar ] - SpanEditHandler;Accepts:AnyExceptNewline - (21:0,21) - Tokens:5 + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Comma;[,]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Whitespace;[ ]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (35:0,35) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_WithQuotes_InvalidLookupText_AddsError.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_WithQuotes_InvalidLookupText_AddsError.cspans.txt index e34deac84b..b919e2b98c 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_WithQuotes_InvalidLookupText_AddsError.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_WithQuotes_InvalidLookupText_AddsError.cspans.txt @@ -1,4 +1,6 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [22] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [22] ) MetaCode span at (1:0,1 [15] ) (Accepts:None) - Parent: Directive block at (0:0,0 [22] ) Markup span at (16:0,16 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [22] ) Code span at (17:0,17 [5] ) (Accepts:AnyExceptNewline) - Parent: Directive block at (0:0,0 [22] ) +Markup span at (22:0,22 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [22] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_WithQuotes_InvalidLookupText_AddsError.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_WithQuotes_InvalidLookupText_AddsError.stree.txt index 2f9b4b42d9..ad4137388e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_WithQuotes_InvalidLookupText_AddsError.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/RemoveTagHelperDirective_WithQuotes_InvalidLookupText_AddsError.stree.txt @@ -1,9 +1,14 @@ -Directive block - Gen - 22 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [removeTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[removeTagHelper]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - ["Foo"] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 - CSharpTokenType.StringLiteral;["Foo"]; +Markup block - Gen - 22 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 22 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [removeTagHelper] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[removeTagHelper]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - ["Foo"] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 + SyntaxKind.StringLiteral;["Foo"]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (22:0,22) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_EndQuoteRequiresDoubleQuotesAroundValue.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_EndQuoteRequiresDoubleQuotesAroundValue.cspans.txt index 3de0fa6980..06a4f306a1 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_EndQuoteRequiresDoubleQuotesAroundValue.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_EndQuoteRequiresDoubleQuotesAroundValue.cspans.txt @@ -1,4 +1,6 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [24] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [24] ) MetaCode span at (1:0,1 [15] ) (Accepts:None) - Parent: Directive block at (0:0,0 [24] ) Markup span at (16:0,16 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [24] ) Code span at (17:0,17 [7] ) (Accepts:AnyExceptNewline) - Parent: Directive block at (0:0,0 [24] ) +Markup span at (24:0,24 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [24] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_EndQuoteRequiresDoubleQuotesAroundValue.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_EndQuoteRequiresDoubleQuotesAroundValue.stree.txt index 6377f48d15..2dbb3eb569 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_EndQuoteRequiresDoubleQuotesAroundValue.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_EndQuoteRequiresDoubleQuotesAroundValue.stree.txt @@ -1,11 +1,16 @@ -Directive block - Gen - 24 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [tagHelperPrefix] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[tagHelperPrefix]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [Foo "] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:3 - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.StringLiteral;["];RZ1000(23:0,23 [1] ) +Markup block - Gen - 24 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 24 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [tagHelperPrefix] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[tagHelperPrefix]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [Foo "] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:3 + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.StringLiteral;["];RZ1000(23:0,23 [1] ) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (24:0,24) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_NoValueSucceeds.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_NoValueSucceeds.cspans.txt index d847da62f5..0dfe38be7c 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_NoValueSucceeds.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_NoValueSucceeds.cspans.txt @@ -1,4 +1,6 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [19] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [19] ) MetaCode span at (1:0,1 [15] ) (Accepts:None) - Parent: Directive block at (0:0,0 [19] ) Markup span at (16:0,16 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [19] ) Code span at (17:0,17 [2] ) (Accepts:AnyExceptNewline) - Parent: Directive block at (0:0,0 [19] ) +Markup span at (19:0,19 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [19] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_NoValueSucceeds.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_NoValueSucceeds.stree.txt index 5a5e18da25..d7a2dd3c67 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_NoValueSucceeds.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_NoValueSucceeds.stree.txt @@ -1,9 +1,14 @@ -Directive block - Gen - 19 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [tagHelperPrefix] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[tagHelperPrefix]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [""] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 - CSharpTokenType.StringLiteral;[""]; +Markup block - Gen - 19 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 19 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [tagHelperPrefix] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[tagHelperPrefix]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [""] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 + SyntaxKind.StringLiteral;[""]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (19:0,19) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_RequiresValue.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_RequiresValue.cspans.txt index adc30c55d8..a8d324c3dc 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_RequiresValue.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_RequiresValue.cspans.txt @@ -1,4 +1,6 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [17] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [17] ) MetaCode span at (1:0,1 [15] ) (Accepts:None) - Parent: Directive block at (0:0,0 [17] ) Markup span at (16:0,16 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [17] ) Code span at (17:0,17 [0] ) (Accepts:AnyExceptNewline) - Parent: Directive block at (0:0,0 [17] ) +Markup span at (17:0,17 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [17] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_RequiresValue.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_RequiresValue.stree.txt index d63b77168e..b47f0135fb 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_RequiresValue.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_RequiresValue.stree.txt @@ -1,9 +1,14 @@ -Directive block - Gen - 17 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [tagHelperPrefix] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[tagHelperPrefix]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 - CSharpTokenType.Unknown;[]; +Markup block - Gen - 17 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 17 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [tagHelperPrefix] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[tagHelperPrefix]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 + SyntaxKind.Unknown;[]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (17:0,17) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_StartQuoteRequiresDoubleQuotesAroundValue.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_StartQuoteRequiresDoubleQuotesAroundValue.cspans.txt index 814a67e317..b0884a958a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_StartQuoteRequiresDoubleQuotesAroundValue.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_StartQuoteRequiresDoubleQuotesAroundValue.cspans.txt @@ -1,4 +1,6 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [21] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [21] ) MetaCode span at (1:0,1 [15] ) (Accepts:None) - Parent: Directive block at (0:0,0 [21] ) Markup span at (16:0,16 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [21] ) Code span at (17:0,17 [4] ) (Accepts:AnyExceptNewline) - Parent: Directive block at (0:0,0 [21] ) +Markup span at (21:0,21 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [21] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_StartQuoteRequiresDoubleQuotesAroundValue.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_StartQuoteRequiresDoubleQuotesAroundValue.stree.txt index 277fbd3a51..ad7e95ee8a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_StartQuoteRequiresDoubleQuotesAroundValue.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_StartQuoteRequiresDoubleQuotesAroundValue.stree.txt @@ -1,9 +1,14 @@ -Directive block - Gen - 21 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [tagHelperPrefix] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[tagHelperPrefix]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - ["Foo] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 - CSharpTokenType.StringLiteral;["Foo];RZ1000(17:0,17 [1] ) +Markup block - Gen - 21 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 21 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [tagHelperPrefix] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[tagHelperPrefix]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - ["Foo] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 + SyntaxKind.StringLiteral;["Foo];RZ1000(17:0,17 [1] ) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (21:0,21) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_Succeeds.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_Succeeds.cspans.txt index d6dde5b7a8..a3ad9a1394 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_Succeeds.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_Succeeds.cspans.txt @@ -1,4 +1,6 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [20] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [20] ) MetaCode span at (1:0,1 [15] ) (Accepts:None) - Parent: Directive block at (0:0,0 [20] ) Markup span at (16:0,16 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [20] ) Code span at (17:0,17 [3] ) (Accepts:AnyExceptNewline) - Parent: Directive block at (0:0,0 [20] ) +Markup span at (20:0,20 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [20] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_Succeeds.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_Succeeds.stree.txt index 7e9a17d299..8f4da6020c 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_Succeeds.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_Succeeds.stree.txt @@ -1,9 +1,14 @@ -Directive block - Gen - 20 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [tagHelperPrefix] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[tagHelperPrefix]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [Foo] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 - CSharpTokenType.Identifier;[Foo]; +Markup block - Gen - 20 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 20 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [tagHelperPrefix] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[tagHelperPrefix]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [Foo] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 + SyntaxKind.Identifier;[Foo]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (20:0,20) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_WithQuotes_Succeeds.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_WithQuotes_Succeeds.cspans.txt index e34deac84b..b919e2b98c 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_WithQuotes_Succeeds.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_WithQuotes_Succeeds.cspans.txt @@ -1,4 +1,6 @@ +Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [22] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [22] ) MetaCode span at (1:0,1 [15] ) (Accepts:None) - Parent: Directive block at (0:0,0 [22] ) Markup span at (16:0,16 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [22] ) Code span at (17:0,17 [5] ) (Accepts:AnyExceptNewline) - Parent: Directive block at (0:0,0 [22] ) +Markup span at (22:0,22 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [22] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_WithQuotes_Succeeds.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_WithQuotes_Succeeds.stree.txt index 1c5a3a9321..997e4fb959 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_WithQuotes_Succeeds.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpDirectivesTest/TagHelperPrefixDirective_WithQuotes_Succeeds.stree.txt @@ -1,9 +1,14 @@ -Directive block - Gen - 22 - (0:0,0) - Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - MetaCode span - Gen - [tagHelperPrefix] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[tagHelperPrefix]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - ["Foo"] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 - CSharpTokenType.StringLiteral;["Foo"]; +Markup block - Gen - 22 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 + SyntaxKind.Unknown;[]; + Directive block - Gen - 22 - (0:0,0) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 + SyntaxKind.Transition;[@]; + MetaCode span - Gen - [tagHelperPrefix] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[tagHelperPrefix]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - ["Foo"] - SpanEditHandler;Accepts:AnyExceptNewline - (17:0,17) - Tokens:1 + SyntaxKind.StringLiteral;["Foo"]; + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (22:0,22) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CapturesWhitespaceToEOLInInvalidUsingStmtAndTreatsAsFileCode.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CapturesWhitespaceToEOLInInvalidUsingStmtAndTreatsAsFileCode.stree.txt index 6f18195cab..c7cdd8cb0f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CapturesWhitespaceToEOLInInvalidUsingStmtAndTreatsAsFileCode.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CapturesWhitespaceToEOLInInvalidUsingStmtAndTreatsAsFileCode.stree.txt @@ -1,5 +1,5 @@ Statement block - Gen - 17 - (0:0,0) Code span - Gen - [using LF] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:3 - CSharpTokenType.Keyword;[using]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.NewLine;[LF]; + SyntaxKind.Keyword;[using]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.NewLine;[LF]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyHandlesInCorrectTransitionsIfImplicitExpressionParensUnclosed.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyHandlesInCorrectTransitionsIfImplicitExpressionParensUnclosed.stree.txt index c0c22405e9..5285577e78 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyHandlesInCorrectTransitionsIfImplicitExpressionParensUnclosed.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyHandlesInCorrectTransitionsIfImplicitExpressionParensUnclosed.stree.txt @@ -1,5 +1,5 @@ Expression block - Gen - 7 - (0:0,0) Code span - Gen - [Href(LF] - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 - (0:0,0) - Tokens:3 - CSharpTokenType.Identifier;[Href]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.NewLine;[LF]; + SyntaxKind.Identifier;[Href]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.NewLine;[LF]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyParsesAtSignInDelimitedBlock.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyParsesAtSignInDelimitedBlock.stree.txt index 604a9bb8b6..6ef5983ab5 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyParsesAtSignInDelimitedBlock.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyParsesAtSignInDelimitedBlock.stree.txt @@ -1,17 +1,17 @@ Expression block - Gen - 46 - (0:0,0) MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.LeftParenthesis;[(]; + SyntaxKind.LeftParenthesis;[(]; Code span - Gen - [Request["description"] ?? @photo.Description] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:11 - CSharpTokenType.Identifier;[Request]; - CSharpTokenType.LeftBracket;[[]; - CSharpTokenType.StringLiteral;["description"]; - CSharpTokenType.RightBracket;[]]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.NullCoalesce;[??]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Transition;[@]; - CSharpTokenType.Identifier;[photo]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Description]; + SyntaxKind.Identifier;[Request]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.StringLiteral;["description"]; + SyntaxKind.RightBracket;[]]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.NullCoalesce;[??]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Transition;[@]; + SyntaxKind.Identifier;[photo]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Description]; MetaCode span - Gen - [)] - SpanEditHandler;Accepts:None - (45:0,45) - Tokens:1 - CSharpTokenType.RightParenthesis;[)]; + SyntaxKind.RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyParsesMarkupIncorrectyAssumedToBeWithinAStatement.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyParsesMarkupIncorrectyAssumedToBeWithinAStatement.cspans.txt index df42b12e56..214565841a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyParsesMarkupIncorrectyAssumedToBeWithinAStatement.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyParsesMarkupIncorrectyAssumedToBeWithinAStatement.cspans.txt @@ -2,7 +2,7 @@ Code span at (0:0,0 [43] ) (Accepts:Any) - Parent: Statement block at (0:0,0 [64 Markup span at (43:2,4 [3] ) (Accepts:None) - Parent: Tag block at (43:2,4 [3] ) Markup span at (46:2,7 [7] ) (Accepts:Any) - Parent: Markup block at (43:2,4 [20] ) Transition span at (53:2,14 [1] ) (Accepts:None) - Parent: Expression block at (53:2,14 [4] ) -Code span at (54:2,15 [3] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (53:2,14 [4] ) +Code span at (54:2,15 [3] ) (Accepts:NonWhitespace) - Parent: Expression block at (53:2,14 [4] ) Markup span at (57:2,18 [4] ) (Accepts:None) - Parent: Tag block at (57:2,18 [4] ) Markup span at (61:2,22 [2] ) (Accepts:None) - Parent: Markup block at (43:2,4 [20] ) Code span at (63:3,0 [1] ) (Accepts:Any) - Parent: Statement block at (0:0,0 [64] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyParsesMarkupIncorrectyAssumedToBeWithinAStatement.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyParsesMarkupIncorrectyAssumedToBeWithinAStatement.stree.txt index 5f1e30a96d..b55b387eff 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyParsesMarkupIncorrectyAssumedToBeWithinAStatement.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyParsesMarkupIncorrectyAssumedToBeWithinAStatement.stree.txt @@ -1,45 +1,45 @@ Statement block - Gen - 64 - (0:0,0) Code span - Gen - [if(foo) {LF var foo = "foo bar bazLF ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:17 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.StringLiteral;["foo bar baz];RZ1000(25:1,14 [1] ) - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.StringLiteral;["foo bar baz];RZ1000(25:1,14 [1] ) + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; Markup block - Gen - 20 - (43:2,4) Tag block - Gen - 3 - (43:2,4) Markup span - Gen - [

] - SpanEditHandler;Accepts:None - (43:2,4) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [Foo is ] - SpanEditHandler;Accepts:Any - (46:2,7) - Tokens:4 - HtmlTokenType.Text;[Foo]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[is]; - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Text;[Foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[is]; + SyntaxKind.Whitespace;[ ]; Expression block - Gen - 4 - (53:2,14) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (53:2,14) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [foo] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (54:2,15) - Tokens:1 - CSharpTokenType.Identifier;[foo]; + SyntaxKind.Transition;[@]; + Code span - Gen - [foo] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (54:2,15) - Tokens:1 + SyntaxKind.Identifier;[foo]; Tag block - Gen - 4 - (57:2,18) Markup span - Gen - [

] - SpanEditHandler;Accepts:None - (57:2,18) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [LF] - SpanEditHandler;Accepts:None - (61:2,22) - Tokens:1 - HtmlTokenType.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; Code span - Gen - [}] - SpanEditHandler;Accepts:Any - (63:3,0) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyRecoversFromMissingCloseParenInExpressionWithinCode.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyRecoversFromMissingCloseParenInExpressionWithinCode.stree.txt index 7832ba2cb6..0bf1908997 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyRecoversFromMissingCloseParenInExpressionWithinCode.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/CorrectlyRecoversFromMissingCloseParenInExpressionWithinCode.stree.txt @@ -1,24 +1,24 @@ Statement block - Gen - 29 - (0:0,0) MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Code span - Gen - [string.Format(] - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[];AtEOL - (1:0,1) - Tokens:4 - CSharpTokenType.Keyword;[string]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Format]; - CSharpTokenType.LeftParenthesis;[(]; + SyntaxKind.Keyword;[string]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Format]; + SyntaxKind.LeftParenthesis;[(]; Markup block - Gen - 13 - (15:0,15) Tag block - Gen - 6 - (15:0,15) Markup span - Gen - [] - SpanEditHandler;Accepts:None - (15:0,15) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[html]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[html]; + SyntaxKind.CloseAngle;[>]; Tag block - Gen - 7 - (21:0,21) Markup span - Gen - [] - SpanEditHandler;Accepts:None - (21:0,21) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[html]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[html]; + SyntaxKind.CloseAngle;[>]; Code span - Gen - [] - SpanEditHandler;Accepts:Any - (28:0,28) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (28:0,28) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/HandlesQuotesAfterTransition.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/HandlesQuotesAfterTransition.cspans.txt index df81e75cc2..7d1e387fe4 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/HandlesQuotesAfterTransition.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/HandlesQuotesAfterTransition.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [1] ) -Code span at (1:0,1 [0] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [1] ) +Code span at (1:0,1 [0] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [1] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/HandlesQuotesAfterTransition.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/HandlesQuotesAfterTransition.stree.txt index 8f8de632d0..40da231bf0 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/HandlesQuotesAfterTransition.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/HandlesQuotesAfterTransition.stree.txt @@ -1,5 +1,5 @@ Expression block - Gen - 1 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Transition;[@]; + Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/IncludesUnexpectedCharacterInSingleStatementControlFlowStatementError.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/IncludesUnexpectedCharacterInSingleStatementControlFlowStatementError.stree.txt index 14a29b0b80..1442776795 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/IncludesUnexpectedCharacterInSingleStatementControlFlowStatementError.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/IncludesUnexpectedCharacterInSingleStatementControlFlowStatementError.stree.txt @@ -1,20 +1,20 @@ Statement block - Gen - 27 - (0:0,0) Code span - Gen - [if(foo)) { var bar = foo; }] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:18 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodOutputsOpenCurlyAsCodeSpanIfEofFoundAfterOpenCurlyBrace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodOutputsOpenCurlyAsCodeSpanIfEofFoundAfterOpenCurlyBrace.stree.txt index 2a25f6f7de..491e283506 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodOutputsOpenCurlyAsCodeSpanIfEofFoundAfterOpenCurlyBrace.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodOutputsOpenCurlyAsCodeSpanIfEofFoundAfterOpenCurlyBrace.stree.txt @@ -1,5 +1,5 @@ Statement block - Gen - 1 - (0:0,0) MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Code span - Gen - [] - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[}];AtEOL - (1:0,1) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodOutputsZeroLengthCodeSpanIfStatementBlockEmpty.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodOutputsZeroLengthCodeSpanIfStatementBlockEmpty.stree.txt index 898717d0f5..2128b17448 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodOutputsZeroLengthCodeSpanIfStatementBlockEmpty.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodOutputsZeroLengthCodeSpanIfStatementBlockEmpty.stree.txt @@ -1,7 +1,7 @@ Statement block - Gen - 2 - (0:0,0) MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Code span - Gen - [] - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[];AtEOL - (1:0,1) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodParsesNothingIfFirstCharacterIsNotIdentifierStartOrParenOrBrace.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodParsesNothingIfFirstCharacterIsNotIdentifierStartOrParenOrBrace.cspans.txt index df81e75cc2..7d1e387fe4 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodParsesNothingIfFirstCharacterIsNotIdentifierStartOrParenOrBrace.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodParsesNothingIfFirstCharacterIsNotIdentifierStartOrParenOrBrace.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [1] ) -Code span at (1:0,1 [0] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [1] ) +Code span at (1:0,1 [0] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [1] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodParsesNothingIfFirstCharacterIsNotIdentifierStartOrParenOrBrace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodParsesNothingIfFirstCharacterIsNotIdentifierStartOrParenOrBrace.stree.txt index 8f8de632d0..40da231bf0 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodParsesNothingIfFirstCharacterIsNotIdentifierStartOrParenOrBrace.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodParsesNothingIfFirstCharacterIsNotIdentifierStartOrParenOrBrace.stree.txt @@ -1,5 +1,5 @@ Expression block - Gen - 1 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Transition;[@]; + Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfEOFAfterTransitionInEmbeddedExpression.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfEOFAfterTransitionInEmbeddedExpression.cspans.txt index a8ccb8bc5e..7fe5b3077c 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfEOFAfterTransitionInEmbeddedExpression.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfEOFAfterTransitionInEmbeddedExpression.cspans.txt @@ -1,5 +1,5 @@ MetaCode span at (0:0,0 [1] ) (Accepts:None) - Parent: Statement block at (0:0,0 [8] ) Code span at (1:0,1 [6] ) (Accepts:Any) - Parent: Statement block at (0:0,0 [8] ) Transition span at (7:1,4 [1] ) (Accepts:None) - Parent: Expression block at (7:1,4 [1] ) -Code span at (8:1,5 [0] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (7:1,4 [1] ) +Code span at (8:1,5 [0] ) (Accepts:NonWhitespace) - Parent: Expression block at (7:1,4 [1] ) Code span at (8:1,5 [0] ) (Accepts:Any) - Parent: Statement block at (0:0,0 [8] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfEOFAfterTransitionInEmbeddedExpression.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfEOFAfterTransitionInEmbeddedExpression.stree.txt index d7a2344f3c..c80317bc2f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfEOFAfterTransitionInEmbeddedExpression.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfEOFAfterTransitionInEmbeddedExpression.stree.txt @@ -1,13 +1,13 @@ Statement block - Gen - 8 - (0:0,0) MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Code span - Gen - [LF ] - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[}];AtEOL - (1:0,1) - Tokens:2 - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; Expression block - Gen - 1 - (7:1,4) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (7:1,4) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[ATD];K14 - (8:1,5) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Transition;[@]; + Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[ATD];K14 - (8:1,5) - Tokens:1 + SyntaxKind.Unknown;[]; Code span - Gen - [] - SpanEditHandler;Accepts:Any - (8:1,5) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfNewlineFollowsTransition.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfNewlineFollowsTransition.cspans.txt index df81e75cc2..7d1e387fe4 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfNewlineFollowsTransition.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfNewlineFollowsTransition.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [1] ) -Code span at (1:0,1 [0] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [1] ) +Code span at (1:0,1 [0] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [1] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfNewlineFollowsTransition.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfNewlineFollowsTransition.stree.txt index 8f8de632d0..40da231bf0 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfNewlineFollowsTransition.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfNewlineFollowsTransition.stree.txt @@ -1,5 +1,5 @@ Expression block - Gen - 1 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Transition;[@]; + Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfWhitespaceBetweenTransitionAndBlockStartInEmbeddedExpr.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfWhitespaceBetweenTransitionAndBlockStartInEmbeddedExpr.cspans.txt index fdf5c8e1ef..2c9f48a807 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfWhitespaceBetweenTransitionAndBlockStartInEmbeddedExpr.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfWhitespaceBetweenTransitionAndBlockStartInEmbeddedExpr.cspans.txt @@ -1,6 +1,6 @@ MetaCode span at (0:0,0 [1] ) (Accepts:None) - Parent: Statement block at (0:0,0 [16] ) Code span at (1:0,1 [6] ) (Accepts:Any) - Parent: Statement block at (0:0,0 [16] ) Transition span at (7:1,4 [1] ) (Accepts:None) - Parent: Expression block at (7:1,4 [1] ) -Code span at (8:1,5 [0] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (7:1,4 [1] ) +Code span at (8:1,5 [0] ) (Accepts:NonWhitespace) - Parent: Expression block at (7:1,4 [1] ) Code span at (8:1,5 [7] ) (Accepts:Any) - Parent: Statement block at (0:0,0 [16] ) MetaCode span at (15:2,0 [1] ) (Accepts:None) - Parent: Statement block at (0:0,0 [16] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfWhitespaceBetweenTransitionAndBlockStartInEmbeddedExpr.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfWhitespaceBetweenTransitionAndBlockStartInEmbeddedExpr.stree.txt index cea41801d1..3b85ef0e92 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfWhitespaceBetweenTransitionAndBlockStartInEmbeddedExpr.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/MethodProducesErrorIfWhitespaceBetweenTransitionAndBlockStartInEmbeddedExpr.stree.txt @@ -1,18 +1,18 @@ Statement block - Gen - 16 - (0:0,0) MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Code span - Gen - [LF ] - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[];AtEOL - (1:0,1) - Tokens:2 - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; Expression block - Gen - 1 - (7:1,4) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (7:1,4) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[ATD];K14 - (8:1,5) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Transition;[@]; + Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[ATD];K14 - (8:1,5) - Tokens:1 + SyntaxKind.Unknown;[]; Code span - Gen - [ {}LF] - SpanEditHandler;Accepts:Any - (8:1,5) - Tokens:4 - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.NewLine;[LF]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (15:2,0) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/OutputsErrorIfAtSignFollowedByLessThanSignAtStatementStart.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/OutputsErrorIfAtSignFollowedByLessThanSignAtStatementStart.stree.txt index 691f6016fb..87158d029b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/OutputsErrorIfAtSignFollowedByLessThanSignAtStatementStart.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/OutputsErrorIfAtSignFollowedByLessThanSignAtStatementStart.stree.txt @@ -1,30 +1,30 @@ Statement block - Gen - 23 - (0:0,0) Code span - Gen - [if(foo) {] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:6 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 13 - (9:0,9) Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (9:0,9) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (10:0,10) - Tokens:1 - HtmlTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Tag block - Gen - 3 - (11:0,11) Markup span - Gen - [

] - SpanEditHandler;Accepts:None - (11:0,11) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [Bar] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - HtmlTokenType.Text;[Bar]; + SyntaxKind.Text;[Bar]; Tag block - Gen - 4 - (17:0,17) Markup span - Gen - [

] - SpanEditHandler;Accepts:None - (17:0,17) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (21:0,21) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [}] - SpanEditHandler;Accepts:Any - (22:0,22) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfCatchBlockUnterminatedAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfCatchBlockUnterminatedAtEOF.stree.txt index dce1789d78..7a8d568054 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfCatchBlockUnterminatedAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfCatchBlockUnterminatedAtEOF.stree.txt @@ -1,47 +1,47 @@ Statement block - Gen - 70 - (0:0,0) Code span - Gen - [try { baz(); } catch(Foo) { var foo = bar; if(foo != null) { bar(); } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:45 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[baz]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[catch]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.NotEqual;[!=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[null]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Keyword;[try]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[baz]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[catch]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.NotEqual;[!=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[null]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfClassBlockUnterminatedAtEOF.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfClassBlockUnterminatedAtEOF.cspans.txt index 8944928f75..b5cfe654bc 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfClassBlockUnterminatedAtEOF.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfClassBlockUnterminatedAtEOF.cspans.txt @@ -1,4 +1,4 @@ MetaCode span at (0:0,0 [9] ) (Accepts:None) - Parent: Directive block at (0:0,0 [54] ) -Markup span at (9:0,9 [1] ) (Accepts:AllWhiteSpace) - Parent: Directive block at (0:0,0 [54] ) +Markup span at (9:0,9 [1] ) (Accepts:AllWhitespace) - Parent: Directive block at (0:0,0 [54] ) MetaCode span at (10:0,10 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [54] ) Code span at (11:0,11 [43] ) (Accepts:Any) - Parent: Directive block at (0:0,0 [54] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfClassBlockUnterminatedAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfClassBlockUnterminatedAtEOF.stree.txt index 08147658a8..9a606a91a5 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfClassBlockUnterminatedAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfClassBlockUnterminatedAtEOF.stree.txt @@ -1,36 +1,36 @@ Directive block - Gen - 54 - (0:0,0) MetaCode span - Gen - [functions] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Identifier;[functions]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Identifier;[functions]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (9:0,9) - Tokens:1 + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd - (10:0,10) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Code span - Gen - [ var foo = bar; if(foo != null) { bar(); } ] - CodeBlockEditHandler;Accepts:Any;CodeBlock - (11:0,11) - Tokens:28 - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.NotEqual;[!=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[null]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.NotEqual;[!=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[null]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfDoBlockUnterminatedAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfDoBlockUnterminatedAtEOF.stree.txt index 73e25271f0..dffd45efb6 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfDoBlockUnterminatedAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfDoBlockUnterminatedAtEOF.stree.txt @@ -1,33 +1,33 @@ Statement block - Gen - 47 - (0:0,0) Code span - Gen - [do { var foo = bar; if(foo != null) { bar(); } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:31 - CSharpTokenType.Keyword;[do]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.NotEqual;[!=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[null]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Keyword;[do]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.NotEqual;[!=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[null]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfElseBlockUnterminatedAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfElseBlockUnterminatedAtEOF.stree.txt index 652f403cec..1c52331a42 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfElseBlockUnterminatedAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfElseBlockUnterminatedAtEOF.stree.txt @@ -1,47 +1,47 @@ Statement block - Gen - 68 - (0:0,0) Code span - Gen - [if(foo) { baz(); } else { var foo = bar; if(foo != null) { bar(); } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:45 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[baz]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[else]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.NotEqual;[!=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[null]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[baz]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[else]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.NotEqual;[!=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[null]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfElseIfBlockUnterminatedAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfElseIfBlockUnterminatedAtEOF.stree.txt index 4750dbca0e..a37cd60847 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfElseIfBlockUnterminatedAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfElseIfBlockUnterminatedAtEOF.stree.txt @@ -1,49 +1,49 @@ Statement block - Gen - 71 - (0:0,0) Code span - Gen - [if(foo) { baz(); } else if { var foo = bar; if(foo != null) { bar(); } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:47 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[baz]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[else]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.NotEqual;[!=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[null]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[baz]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[else]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.NotEqual;[!=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[null]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfExplicitCodeBlockUnterminatedAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfExplicitCodeBlockUnterminatedAtEOF.stree.txt index de02008232..ed2107e5d1 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfExplicitCodeBlockUnterminatedAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfExplicitCodeBlockUnterminatedAtEOF.stree.txt @@ -1,32 +1,32 @@ Statement block - Gen - 44 - (0:0,0) MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Code span - Gen - [ var foo = bar; if(foo != null) { bar(); } ] - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[}];AtEOL - (1:0,1) - Tokens:28 - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.NotEqual;[!=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[null]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.NotEqual;[!=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[null]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfFinallyBlockUnterminatedAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfFinallyBlockUnterminatedAtEOF.stree.txt index 17ec773583..96559bd778 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfFinallyBlockUnterminatedAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfFinallyBlockUnterminatedAtEOF.stree.txt @@ -1,44 +1,44 @@ Statement block - Gen - 67 - (0:0,0) Code span - Gen - [try { baz(); } finally { var foo = bar; if(foo != null) { bar(); } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:42 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[baz]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[finally]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.NotEqual;[!=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[null]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Keyword;[try]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[baz]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[finally]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.NotEqual;[!=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[null]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfForBlockUnterminatedAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfForBlockUnterminatedAtEOF.stree.txt index f896c4413c..d65c73a1b9 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfForBlockUnterminatedAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfForBlockUnterminatedAtEOF.stree.txt @@ -1,37 +1,37 @@ Statement block - Gen - 54 - (0:0,0) Code span - Gen - [for (foo) { var foo = bar; if(foo != null) { bar(); } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:35 - CSharpTokenType.Keyword;[for]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.NotEqual;[!=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[null]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Keyword;[for]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.NotEqual;[!=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[null]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfForeachBlockUnterminatedAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfForeachBlockUnterminatedAtEOF.stree.txt index f040273553..611834ba29 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfForeachBlockUnterminatedAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfForeachBlockUnterminatedAtEOF.stree.txt @@ -1,37 +1,37 @@ Statement block - Gen - 58 - (0:0,0) Code span - Gen - [foreach (foo) { var foo = bar; if(foo != null) { bar(); } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:35 - CSharpTokenType.Keyword;[foreach]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.NotEqual;[!=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[null]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Keyword;[foreach]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.NotEqual;[!=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[null]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfIfBlockUnterminatedAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfIfBlockUnterminatedAtEOF.stree.txt index 8940e51eb3..9dcb914c02 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfIfBlockUnterminatedAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfIfBlockUnterminatedAtEOF.stree.txt @@ -1,37 +1,37 @@ Statement block - Gen - 53 - (0:0,0) Code span - Gen - [if (foo) { var foo = bar; if(foo != null) { bar(); } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:35 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.NotEqual;[!=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[null]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.NotEqual;[!=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[null]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfLockBlockUnterminatedAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfLockBlockUnterminatedAtEOF.stree.txt index 2db346c06b..408980c538 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfLockBlockUnterminatedAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfLockBlockUnterminatedAtEOF.stree.txt @@ -1,37 +1,37 @@ Statement block - Gen - 55 - (0:0,0) Code span - Gen - [lock (foo) { var foo = bar; if(foo != null) { bar(); } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:35 - CSharpTokenType.Keyword;[lock]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.NotEqual;[!=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[null]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Keyword;[lock]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.NotEqual;[!=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[null]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfSwitchBlockUnterminatedAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfSwitchBlockUnterminatedAtEOF.stree.txt index 274707aa24..c9988fb22c 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfSwitchBlockUnterminatedAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfSwitchBlockUnterminatedAtEOF.stree.txt @@ -1,37 +1,37 @@ Statement block - Gen - 57 - (0:0,0) Code span - Gen - [switch (foo) { var foo = bar; if(foo != null) { bar(); } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:35 - CSharpTokenType.Keyword;[switch]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.NotEqual;[!=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[null]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Keyword;[switch]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.NotEqual;[!=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[null]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfTryBlockUnterminatedAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfTryBlockUnterminatedAtEOF.stree.txt index b8edb26e7e..29ed508ce6 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfTryBlockUnterminatedAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfTryBlockUnterminatedAtEOF.stree.txt @@ -1,33 +1,33 @@ Statement block - Gen - 48 - (0:0,0) Code span - Gen - [try { var foo = bar; if(foo != null) { bar(); } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:31 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.NotEqual;[!=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[null]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Keyword;[try]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.NotEqual;[!=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[null]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfUsingBlockUnterminatedAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfUsingBlockUnterminatedAtEOF.stree.txt index 50ee1fda7f..61ae015863 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfUsingBlockUnterminatedAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfUsingBlockUnterminatedAtEOF.stree.txt @@ -1,37 +1,37 @@ Statement block - Gen - 56 - (0:0,0) Code span - Gen - [using (foo) { var foo = bar; if(foo != null) { bar(); } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:35 - CSharpTokenType.Keyword;[using]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.NotEqual;[!=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[null]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Keyword;[using]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.NotEqual;[!=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[null]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfWhileBlockUnterminatedAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfWhileBlockUnterminatedAtEOF.stree.txt index cef398b06c..21cd2742d9 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfWhileBlockUnterminatedAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ReportsErrorIfWhileBlockUnterminatedAtEOF.stree.txt @@ -1,37 +1,37 @@ Statement block - Gen - 56 - (0:0,0) Code span - Gen - [while (foo) { var foo = bar; if(foo != null) { bar(); } ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:35 - CSharpTokenType.Keyword;[while]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.NotEqual;[!=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[null]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Keyword;[while]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.NotEqual;[!=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[null]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/RequiresControlFlowStatementsToHaveBraces.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/RequiresControlFlowStatementsToHaveBraces.stree.txt index b7e771e87f..5e9d2a11bc 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/RequiresControlFlowStatementsToHaveBraces.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/RequiresControlFlowStatementsToHaveBraces.stree.txt @@ -1,66 +1,66 @@ Statement block - Gen - 58 - (0:0,0) Code span - Gen - [if(foo) ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:5 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; Markup block - Gen - 11 - (8:0,8) Tag block - Gen - 3 - (8:0,8) Markup span - Gen - [

] - SpanEditHandler;Accepts:None - (8:0,8) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [Bar] - SpanEditHandler;Accepts:Any - (11:0,11) - Tokens:1 - HtmlTokenType.Text;[Bar]; + SyntaxKind.Text;[Bar]; Tag block - Gen - 4 - (14:0,14) Markup span - Gen - [

] - SpanEditHandler;Accepts:None - (14:0,14) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (18:0,18) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [else if(bar) ] - SpanEditHandler;Accepts:Any - (19:0,19) - Tokens:7 - CSharpTokenType.Keyword;[else]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Keyword;[else]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; Markup block - Gen - 11 - (32:0,32) Tag block - Gen - 3 - (32:0,32) Markup span - Gen - [

] - SpanEditHandler;Accepts:None - (32:0,32) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [Baz] - SpanEditHandler;Accepts:Any - (35:0,35) - Tokens:1 - HtmlTokenType.Text;[Baz]; + SyntaxKind.Text;[Baz]; Tag block - Gen - 4 - (38:0,38) Markup span - Gen - [

] - SpanEditHandler;Accepts:None - (38:0,38) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (42:0,42) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [else ] - SpanEditHandler;Accepts:Any - (43:0,43) - Tokens:2 - CSharpTokenType.Keyword;[else]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Keyword;[else]; + SyntaxKind.Whitespace;[ ]; Markup block - Gen - 10 - (48:0,48) Tag block - Gen - 3 - (48:0,48) Markup span - Gen - [

] - SpanEditHandler;Accepts:None - (48:0,48) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [Boz] - SpanEditHandler;Accepts:Any - (51:0,51) - Tokens:1 - HtmlTokenType.Text;[Boz]; + SyntaxKind.Text;[Boz]; Tag block - Gen - 4 - (54:0,54) Markup span - Gen - [

] - SpanEditHandler;Accepts:None - (54:0,54) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Code span - Gen - [] - SpanEditHandler;Accepts:Any - (58:0,58) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ResumesIfStatementAfterOpenParen.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ResumesIfStatementAfterOpenParen.stree.txt index f1e59db50a..e27910989e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ResumesIfStatementAfterOpenParen.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ResumesIfStatementAfterOpenParen.stree.txt @@ -1,28 +1,28 @@ Statement block - Gen - 24 - (0:0,0) Code span - Gen - [if(LFelse {] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:6 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.Keyword;[else]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Keyword;[else]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 12 - (11:1,6) Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (11:1,6) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 3 - (12:1,7) Markup span - Gen - [

] - SpanEditHandler;Accepts:None - (12:1,7) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [Foo] - SpanEditHandler;Accepts:Any - (15:1,10) - Tokens:1 - HtmlTokenType.Text;[Foo]; + SyntaxKind.Text;[Foo]; Tag block - Gen - 4 - (18:1,13) Markup span - Gen - [

] - SpanEditHandler;Accepts:None - (18:1,13) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (22:1,17) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [}] - SpanEditHandler;Accepts:None - (23:1,18) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtEOFIfBracketInImplicitExpressionUnclosed.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtEOFIfBracketInImplicitExpressionUnclosed.stree.txt index 72e23a8a3c..7edce35666 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtEOFIfBracketInImplicitExpressionUnclosed.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtEOFIfBracketInImplicitExpressionUnclosed.stree.txt @@ -1,12 +1,12 @@ Expression block - Gen - 22 - (0:0,0) Code span - Gen - [Foo[Bar[Baz]LFBizLFBoz] - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 - (0:0,0) - Tokens:10 - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.LeftBracket;[[]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.LeftBracket;[[]; - CSharpTokenType.Identifier;[Baz]; - CSharpTokenType.RightBracket;[]]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.Identifier;[Biz]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.Identifier;[Boz]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.Identifier;[Baz]; + SyntaxKind.RightBracket;[]]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Identifier;[Biz]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Identifier;[Boz]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtEOFIfIfParenInExplicitExprUnclosed.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtEOFIfIfParenInExplicitExprUnclosed.stree.txt index 78cdf0005e..5bc5080b04 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtEOFIfIfParenInExplicitExprUnclosed.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtEOFIfIfParenInExplicitExprUnclosed.stree.txt @@ -1,9 +1,9 @@ Expression block - Gen - 13 - (0:0,0) MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.LeftParenthesis;[(]; + SyntaxKind.LeftParenthesis;[(]; Code span - Gen - [foo barLFbaz] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:5 - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.Identifier;[baz]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Identifier;[baz]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtEOFIfParenInImplicitExprUnclosed.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtEOFIfParenInImplicitExprUnclosed.stree.txt index 8a2b46772d..487be52e9e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtEOFIfParenInImplicitExprUnclosed.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtEOFIfParenInImplicitExprUnclosed.stree.txt @@ -1,12 +1,12 @@ Expression block - Gen - 22 - (0:0,0) Code span - Gen - [Foo(Bar(Baz)LFBizLFBoz] - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 - (0:0,0) - Tokens:10 - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[Baz]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.Identifier;[Biz]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.Identifier;[Boz]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[Baz]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Identifier;[Biz]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Identifier;[Boz]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtMarkupIfBracketInImplicitExprUnclosed.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtMarkupIfBracketInImplicitExprUnclosed.stree.txt index ec70a45174..6f02e88cec 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtMarkupIfBracketInImplicitExprUnclosed.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtMarkupIfBracketInImplicitExprUnclosed.stree.txt @@ -1,11 +1,11 @@ Expression block - Gen - 19 - (0:0,0) Code span - Gen - [Foo[Bar[Baz]LFBizLF] - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 - (0:0,0) - Tokens:9 - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.LeftBracket;[[]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.LeftBracket;[[]; - CSharpTokenType.Identifier;[Baz]; - CSharpTokenType.RightBracket;[]]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.Identifier;[Biz]; - CSharpTokenType.NewLine;[LF]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.Identifier;[Baz]; + SyntaxKind.RightBracket;[]]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Identifier;[Biz]; + SyntaxKind.NewLine;[LF]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtMarkupIfIfParenInExplicitExprUnclosed.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtMarkupIfIfParenInExplicitExprUnclosed.stree.txt index c23684a3e4..526cc8c992 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtMarkupIfIfParenInExplicitExprUnclosed.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtMarkupIfIfParenInExplicitExprUnclosed.stree.txt @@ -1,8 +1,8 @@ Expression block - Gen - 10 - (0:0,0) MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.LeftParenthesis;[(]; + SyntaxKind.LeftParenthesis;[(]; Code span - Gen - [foo barLF] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:4 - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.NewLine;[LF]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.NewLine;[LF]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtMarkupIfParenInImplicitExpressionUnclosed.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtMarkupIfParenInImplicitExpressionUnclosed.stree.txt index e8a7af923b..74a5b4d8e8 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtMarkupIfParenInImplicitExpressionUnclosed.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/ShouldReportErrorAndTerminateAtMarkupIfParenInImplicitExpressionUnclosed.stree.txt @@ -1,11 +1,11 @@ Expression block - Gen - 19 - (0:0,0) Code span - Gen - [Foo(Bar(Baz)LFBizLF] - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 - (0:0,0) - Tokens:9 - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[Baz]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.Identifier;[Biz]; - CSharpTokenType.NewLine;[LF]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[Baz]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Identifier;[Biz]; + SyntaxKind.NewLine;[LF]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesForeachBlockAtEOLWhenRecoveringFromMissingCloseParen.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesForeachBlockAtEOLWhenRecoveringFromMissingCloseParen.stree.txt index 7bbc78e8ff..4ea2cc9be1 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesForeachBlockAtEOLWhenRecoveringFromMissingCloseParen.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesForeachBlockAtEOLWhenRecoveringFromMissingCloseParen.stree.txt @@ -1,8 +1,8 @@ Statement block - Gen - 17 - (0:0,0) Code span - Gen - [foreach(foo barLF] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:6 - CSharpTokenType.Keyword;[foreach]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.NewLine;[LF]; + SyntaxKind.Keyword;[foreach]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.NewLine;[LF]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesIfBlockAtEOLWhenRecoveringFromMissingCloseParen.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesIfBlockAtEOLWhenRecoveringFromMissingCloseParen.stree.txt index d12e4eeb98..2fb112facd 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesIfBlockAtEOLWhenRecoveringFromMissingCloseParen.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesIfBlockAtEOLWhenRecoveringFromMissingCloseParen.stree.txt @@ -1,8 +1,8 @@ Statement block - Gen - 12 - (0:0,0) Code span - Gen - [if(foo barLF] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:6 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.NewLine;[LF]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.NewLine;[LF]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesNormalCSharpStringsAtEOLIfEndQuoteMissing.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesNormalCSharpStringsAtEOLIfEndQuoteMissing.stree.txt index 83c5c0e7bc..c8a7548e04 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesNormalCSharpStringsAtEOLIfEndQuoteMissing.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesNormalCSharpStringsAtEOLIfEndQuoteMissing.stree.txt @@ -1,21 +1,21 @@ Statement block - Gen - 41 - (0:0,0) Code span - Gen - [if(foo) {LF var p = "foo bar bazLF;LF}] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:19 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[p]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.StringLiteral;["foo bar baz];RZ1000(23:1,12 [1] ) - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[p]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.StringLiteral;["foo bar baz];RZ1000(23:1,12 [1] ) + SyntaxKind.NewLine;[LF]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesNormalStringAtEndOfFile.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesNormalStringAtEndOfFile.stree.txt index f62bdc8820..5626bc0158 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesNormalStringAtEndOfFile.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesNormalStringAtEndOfFile.stree.txt @@ -1,16 +1,16 @@ Statement block - Gen - 45 - (0:0,0) Code span - Gen - [if(foo) { var foo = "blah blah blah blah blah] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:14 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.StringLiteral;["blah blah blah blah blah];RZ1000(20:0,20 [1] ) + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.StringLiteral;["blah blah blah blah blah];RZ1000(20:0,20 [1] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesUsingBlockAtEOLWhenRecoveringFromMissingCloseParen.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesUsingBlockAtEOLWhenRecoveringFromMissingCloseParen.stree.txt index c0593ccb6f..cb18b098c3 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesUsingBlockAtEOLWhenRecoveringFromMissingCloseParen.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesUsingBlockAtEOLWhenRecoveringFromMissingCloseParen.stree.txt @@ -1,8 +1,8 @@ Statement block - Gen - 15 - (0:0,0) Code span - Gen - [using(foo barLF] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:6 - CSharpTokenType.Keyword;[using]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.NewLine;[LF]; + SyntaxKind.Keyword;[using]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.NewLine;[LF]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesVerbatimStringAtEndOfFile.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesVerbatimStringAtEndOfFile.stree.txt index b657dfb7d1..e3dff85a70 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesVerbatimStringAtEndOfFile.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesVerbatimStringAtEndOfFile.stree.txt @@ -1,16 +1,16 @@ Statement block - Gen - 60 - (0:0,0) Code span - Gen - [if(foo) { var foo = @"blah LFblah; LF

Foo

LFblah LFblah] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:14 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.StringLiteral;[@"blah LFblah; LF

Foo

LFblah LFblah];RZ1000(20:0,20 [1] ) + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.StringLiteral;[@"blah LFblah; LF

Foo

LFblah LFblah];RZ1000(20:0,20 [1] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesWhileClauseInDoStmtAtEOLWhenRecoveringFromMissingCloseParen.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesWhileClauseInDoStmtAtEOLWhenRecoveringFromMissingCloseParen.stree.txt index 9f5bb09d03..995a7e16d8 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesWhileClauseInDoStmtAtEOLWhenRecoveringFromMissingCloseParen.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/TerminatesWhileClauseInDoStmtAtEOLWhenRecoveringFromMissingCloseParen.stree.txt @@ -1,14 +1,14 @@ Statement block - Gen - 22 - (0:0,0) Code span - Gen - [do { } while(foo barLF] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:12 - CSharpTokenType.Keyword;[do]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[while]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.NewLine;[LF]; + SyntaxKind.Keyword;[do]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[while]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.NewLine;[LF]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/WithHelperDirectiveProducesError.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/WithHelperDirectiveProducesError.cspans.txt index aa175869a4..c1231b2190 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/WithHelperDirectiveProducesError.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/WithHelperDirectiveProducesError.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [7] ) -Code span at (1:0,1 [6] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [7] ) +Code span at (1:0,1 [6] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [7] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/WithHelperDirectiveProducesError.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/WithHelperDirectiveProducesError.stree.txt index 1454016ba1..933270de61 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/WithHelperDirectiveProducesError.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/WithHelperDirectiveProducesError.stree.txt @@ -1,5 +1,5 @@ Expression block - Gen - 7 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [helper] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[helper]; + SyntaxKind.Transition;[@]; + Code span - Gen - [helper] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[helper]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/WithNestedCodeBlockProducesError.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/WithNestedCodeBlockProducesError.stree.txt index bf52f4c935..c4e84ca787 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/WithNestedCodeBlockProducesError.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpErrorTest/WithNestedCodeBlockProducesError.stree.txt @@ -1,20 +1,20 @@ Statement block - Gen - 11 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [if { ] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:4 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; Statement block - Gen - 3 - (6:0,6) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (6:0,6) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (7:0,7) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Code span - Gen - [] - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[];AtEOL - (8:0,8) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (8:0,8) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; Code span - Gen - [ }] - SpanEditHandler;Accepts:Any - (9:0,9) - Tokens:2 - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptConsecutiveEscapedQuotesInNonVerbatimStrings.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptConsecutiveEscapedQuotesInNonVerbatimStrings.stree.txt index ab2776cd54..23eb18e378 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptConsecutiveEscapedQuotesInNonVerbatimStrings.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptConsecutiveEscapedQuotesInNonVerbatimStrings.stree.txt @@ -1,9 +1,9 @@ Expression block - Gen - 9 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.LeftParenthesis;[(]; + SyntaxKind.LeftParenthesis;[(]; Code span - Gen - ["\"\""] - SpanEditHandler;Accepts:Any - (2:0,2) - Tokens:1 - CSharpTokenType.StringLiteral;["\"\""]; + SyntaxKind.StringLiteral;["\"\""]; MetaCode span - Gen - [)] - SpanEditHandler;Accepts:None - (8:0,8) - Tokens:1 - CSharpTokenType.RightParenthesis;[)]; + SyntaxKind.RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptConsecutiveEscapedQuotesInVerbatimStrings.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptConsecutiveEscapedQuotesInVerbatimStrings.stree.txt index 173672adb1..6b9fcb7197 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptConsecutiveEscapedQuotesInVerbatimStrings.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptConsecutiveEscapedQuotesInVerbatimStrings.stree.txt @@ -1,9 +1,9 @@ Expression block - Gen - 10 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.LeftParenthesis;[(]; + SyntaxKind.LeftParenthesis;[(]; Code span - Gen - [@""""""] - SpanEditHandler;Accepts:Any - (2:0,2) - Tokens:1 - CSharpTokenType.StringLiteral;[@""""""]; + SyntaxKind.StringLiteral;[@""""""]; MetaCode span - Gen - [)] - SpanEditHandler;Accepts:None - (9:0,9) - Tokens:1 - CSharpTokenType.RightParenthesis;[)]; + SyntaxKind.RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptEscapedQuoteInNonVerbatimStrings.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptEscapedQuoteInNonVerbatimStrings.stree.txt index 28ef6bad21..f0cd494583 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptEscapedQuoteInNonVerbatimStrings.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptEscapedQuoteInNonVerbatimStrings.stree.txt @@ -1,9 +1,9 @@ Expression block - Gen - 7 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.LeftParenthesis;[(]; + SyntaxKind.LeftParenthesis;[(]; Code span - Gen - ["\""] - SpanEditHandler;Accepts:Any - (2:0,2) - Tokens:1 - CSharpTokenType.StringLiteral;["\""]; + SyntaxKind.StringLiteral;["\""]; MetaCode span - Gen - [)] - SpanEditHandler;Accepts:None - (6:0,6) - Tokens:1 - CSharpTokenType.RightParenthesis;[)]; + SyntaxKind.RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptEscapedQuoteInVerbatimStrings.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptEscapedQuoteInVerbatimStrings.stree.txt index e8c4fd0f60..302eae7f86 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptEscapedQuoteInVerbatimStrings.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptEscapedQuoteInVerbatimStrings.stree.txt @@ -1,9 +1,9 @@ Expression block - Gen - 8 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.LeftParenthesis;[(]; + SyntaxKind.LeftParenthesis;[(]; Code span - Gen - [@""""] - SpanEditHandler;Accepts:Any - (2:0,2) - Tokens:1 - CSharpTokenType.StringLiteral;[@""""]; + SyntaxKind.StringLiteral;[@""""]; MetaCode span - Gen - [)] - SpanEditHandler;Accepts:None - (7:0,7) - Tokens:1 - CSharpTokenType.RightParenthesis;[)]; + SyntaxKind.RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptMultiLineVerbatimStrings.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptMultiLineVerbatimStrings.stree.txt index c30fec9476..031978a70f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptMultiLineVerbatimStrings.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptMultiLineVerbatimStrings.stree.txt @@ -1,9 +1,9 @@ Expression block - Gen - 23 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.LeftParenthesis;[(]; + SyntaxKind.LeftParenthesis;[(]; Code span - Gen - [@"LFFooLFBarLFBazLF"] - SpanEditHandler;Accepts:Any - (2:0,2) - Tokens:1 - CSharpTokenType.StringLiteral;[@"LFFooLFBarLFBazLF"]; + SyntaxKind.StringLiteral;[@"LFFooLFBarLFBazLF"]; MetaCode span - Gen - [)] - SpanEditHandler;Accepts:None - (22:4,1) - Tokens:1 - CSharpTokenType.RightParenthesis;[)]; + SyntaxKind.RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptMultipleEscapedQuotesInNonVerbatimStrings.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptMultipleEscapedQuotesInNonVerbatimStrings.stree.txt index 054fbe06a9..196693b74a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptMultipleEscapedQuotesInNonVerbatimStrings.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptMultipleEscapedQuotesInNonVerbatimStrings.stree.txt @@ -1,9 +1,9 @@ Expression block - Gen - 21 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.LeftParenthesis;[(]; + SyntaxKind.LeftParenthesis;[(]; Code span - Gen - ["\"hello, world\""] - SpanEditHandler;Accepts:Any - (2:0,2) - Tokens:1 - CSharpTokenType.StringLiteral;["\"hello, world\""]; + SyntaxKind.StringLiteral;["\"hello, world\""]; MetaCode span - Gen - [)] - SpanEditHandler;Accepts:None - (20:0,20) - Tokens:1 - CSharpTokenType.RightParenthesis;[)]; + SyntaxKind.RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptMultipleEscapedQuotesInVerbatimStrings.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptMultipleEscapedQuotesInVerbatimStrings.stree.txt index a77e2669da..3db6a694d2 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptMultipleEscapedQuotesInVerbatimStrings.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptMultipleEscapedQuotesInVerbatimStrings.stree.txt @@ -1,9 +1,9 @@ Expression block - Gen - 22 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.LeftParenthesis;[(]; + SyntaxKind.LeftParenthesis;[(]; Code span - Gen - [@"""hello, world"""] - SpanEditHandler;Accepts:Any - (2:0,2) - Tokens:1 - CSharpTokenType.StringLiteral;[@"""hello, world"""]; + SyntaxKind.StringLiteral;[@"""hello, world"""]; MetaCode span - Gen - [)] - SpanEditHandler;Accepts:None - (21:0,21) - Tokens:1 - CSharpTokenType.RightParenthesis;[)]; + SyntaxKind.RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptMultipleRepeatedEscapedQuoteInVerbatimStrings.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptMultipleRepeatedEscapedQuoteInVerbatimStrings.stree.txt index 173672adb1..6b9fcb7197 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptMultipleRepeatedEscapedQuoteInVerbatimStrings.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldAcceptMultipleRepeatedEscapedQuoteInVerbatimStrings.stree.txt @@ -1,9 +1,9 @@ Expression block - Gen - 10 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.LeftParenthesis;[(]; + SyntaxKind.LeftParenthesis;[(]; Code span - Gen - [@""""""] - SpanEditHandler;Accepts:Any - (2:0,2) - Tokens:1 - CSharpTokenType.StringLiteral;[@""""""]; + SyntaxKind.StringLiteral;[@""""""]; MetaCode span - Gen - [)] - SpanEditHandler;Accepts:None - (9:0,9) - Tokens:1 - CSharpTokenType.RightParenthesis;[)]; + SyntaxKind.RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldOutputZeroLengthCodeSpanIfEOFOccursAfterStartOfExplicitExpr.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldOutputZeroLengthCodeSpanIfEOFOccursAfterStartOfExplicitExpr.stree.txt index f477a803b1..796bf69308 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldOutputZeroLengthCodeSpanIfEOFOccursAfterStartOfExplicitExpr.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldOutputZeroLengthCodeSpanIfEOFOccursAfterStartOfExplicitExpr.stree.txt @@ -1,7 +1,7 @@ Expression block - Gen - 2 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.LeftParenthesis;[(]; + SyntaxKind.LeftParenthesis;[(]; Code span - Gen - [] - SpanEditHandler;Accepts:Any - (2:0,2) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldOutputZeroLengthCodeSpanIfExplicitExpressionIsEmpty.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldOutputZeroLengthCodeSpanIfExplicitExpressionIsEmpty.stree.txt index ac2afba6aa..86c59ee8dc 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldOutputZeroLengthCodeSpanIfExplicitExpressionIsEmpty.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpExplicitExpressionTest/ShouldOutputZeroLengthCodeSpanIfExplicitExpressionIsEmpty.stree.txt @@ -1,9 +1,9 @@ Expression block - Gen - 3 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.LeftParenthesis;[(]; + SyntaxKind.LeftParenthesis;[(]; Code span - Gen - [] - SpanEditHandler;Accepts:Any - (2:0,2) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; MetaCode span - Gen - [)] - SpanEditHandler;Accepts:None - (2:0,2) - Tokens:1 - CSharpTokenType.RightParenthesis;[)]; + SyntaxKind.RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/AcceptsNonEnglishCharactersThatAreValidIdentifiers.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/AcceptsNonEnglishCharactersThatAreValidIdentifiers.cspans.txt index befccd6124..5796fa527a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/AcceptsNonEnglishCharactersThatAreValidIdentifiers.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/AcceptsNonEnglishCharactersThatAreValidIdentifiers.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [8] ) -Code span at (1:0,1 [7] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [8] ) +Code span at (1:0,1 [7] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [8] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/AcceptsNonEnglishCharactersThatAreValidIdentifiers.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/AcceptsNonEnglishCharactersThatAreValidIdentifiers.stree.txt index 7d0e4caeab..c833af2ae0 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/AcceptsNonEnglishCharactersThatAreValidIdentifiers.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/AcceptsNonEnglishCharactersThatAreValidIdentifiers.stree.txt @@ -1,5 +1,5 @@ Expression block - Gen - 8 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [हळूँजद॔] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[हळूँजद॔]; + SyntaxKind.Transition;[@]; + Code span - Gen - [हळूँजद॔] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[हळूँजद॔]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotAcceptSemicolonIfExpressionTerminatedByWhitespace.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotAcceptSemicolonIfExpressionTerminatedByWhitespace.cspans.txt index cdb23fb755..5d8d6c3b55 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotAcceptSemicolonIfExpressionTerminatedByWhitespace.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotAcceptSemicolonIfExpressionTerminatedByWhitespace.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [4] ) -Code span at (1:0,1 [3] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [4] ) +Code span at (1:0,1 [3] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [4] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotAcceptSemicolonIfExpressionTerminatedByWhitespace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotAcceptSemicolonIfExpressionTerminatedByWhitespace.stree.txt index 8967206fd1..d6126280d9 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotAcceptSemicolonIfExpressionTerminatedByWhitespace.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotAcceptSemicolonIfExpressionTerminatedByWhitespace.stree.txt @@ -1,5 +1,5 @@ Expression block - Gen - 4 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [foo] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[foo]; + SyntaxKind.Transition;[@]; + Code span - Gen - [foo] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[foo]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeDotAtEOFInImplicitExpression.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeDotAtEOFInImplicitExpression.cspans.txt index befccd6124..5796fa527a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeDotAtEOFInImplicitExpression.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeDotAtEOFInImplicitExpression.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [8] ) -Code span at (1:0,1 [7] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [8] ) +Code span at (1:0,1 [7] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [8] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeDotAtEOFInImplicitExpression.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeDotAtEOFInImplicitExpression.stree.txt index a319543617..ece2fdbfe0 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeDotAtEOFInImplicitExpression.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeDotAtEOFInImplicitExpression.stree.txt @@ -1,7 +1,7 @@ Expression block - Gen - 8 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [foo.bar] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:3 - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[bar]; + SyntaxKind.Transition;[@]; + Code span - Gen - [foo.bar] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:3 + SyntaxKind.Identifier;[foo]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[bar]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeDotFollowedByInvalidIdentifierCharInImplicitExpr1.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeDotFollowedByInvalidIdentifierCharInImplicitExpr1.cspans.txt index befccd6124..5796fa527a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeDotFollowedByInvalidIdentifierCharInImplicitExpr1.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeDotFollowedByInvalidIdentifierCharInImplicitExpr1.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [8] ) -Code span at (1:0,1 [7] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [8] ) +Code span at (1:0,1 [7] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [8] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeDotFollowedByInvalidIdentifierCharInImplicitExpr1.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeDotFollowedByInvalidIdentifierCharInImplicitExpr1.stree.txt index a319543617..ece2fdbfe0 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeDotFollowedByInvalidIdentifierCharInImplicitExpr1.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeDotFollowedByInvalidIdentifierCharInImplicitExpr1.stree.txt @@ -1,7 +1,7 @@ Expression block - Gen - 8 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [foo.bar] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:3 - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[bar]; + SyntaxKind.Transition;[@]; + Code span - Gen - [foo.bar] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:3 + SyntaxKind.Identifier;[foo]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[bar]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeDotFollowedByInvalidIdentifierCharInImplicitExpr2.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeDotFollowedByInvalidIdentifierCharInImplicitExpr2.cspans.txt index befccd6124..5796fa527a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeDotFollowedByInvalidIdentifierCharInImplicitExpr2.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeDotFollowedByInvalidIdentifierCharInImplicitExpr2.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [8] ) -Code span at (1:0,1 [7] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [8] ) +Code span at (1:0,1 [7] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [8] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeDotFollowedByInvalidIdentifierCharInImplicitExpr2.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeDotFollowedByInvalidIdentifierCharInImplicitExpr2.stree.txt index a319543617..ece2fdbfe0 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeDotFollowedByInvalidIdentifierCharInImplicitExpr2.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeDotFollowedByInvalidIdentifierCharInImplicitExpr2.stree.txt @@ -1,7 +1,7 @@ Expression block - Gen - 8 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [foo.bar] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:3 - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[bar]; + SyntaxKind.Transition;[@]; + Code span - Gen - [foo.bar] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:3 + SyntaxKind.Identifier;[foo]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[bar]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeSemicolonAfterDot.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeSemicolonAfterDot.cspans.txt index befccd6124..5796fa527a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeSemicolonAfterDot.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeSemicolonAfterDot.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [8] ) -Code span at (1:0,1 [7] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [8] ) +Code span at (1:0,1 [7] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [8] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeSemicolonAfterDot.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeSemicolonAfterDot.stree.txt index a319543617..ece2fdbfe0 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeSemicolonAfterDot.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/DoesNotIncludeSemicolonAfterDot.stree.txt @@ -1,7 +1,7 @@ Expression block - Gen - 8 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [foo.bar] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:3 - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[bar]; + SyntaxKind.Transition;[@]; + Code span - Gen - [foo.bar] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:3 + SyntaxKind.Identifier;[foo]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[bar]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/IgnoresSemicolonAtEndOfDottedIdentifiers.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/IgnoresSemicolonAtEndOfDottedIdentifiers.cspans.txt index 4c546c5213..0ee2dadc29 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/IgnoresSemicolonAtEndOfDottedIdentifiers.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/IgnoresSemicolonAtEndOfDottedIdentifiers.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [12] ) -Code span at (1:0,1 [11] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [12] ) +Code span at (1:0,1 [11] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [12] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/IgnoresSemicolonAtEndOfDottedIdentifiers.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/IgnoresSemicolonAtEndOfDottedIdentifiers.stree.txt index b130a21495..9b751618bf 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/IgnoresSemicolonAtEndOfDottedIdentifiers.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/IgnoresSemicolonAtEndOfDottedIdentifiers.stree.txt @@ -1,9 +1,9 @@ Expression block - Gen - 12 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [foo.bar.baz] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:5 - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[baz]; + SyntaxKind.Transition;[@]; + Code span - Gen - [foo.bar.baz] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:5 + SyntaxKind.Identifier;[foo]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[baz]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/IgnoresSemicolonAtEndOfSimpleImplicitExpression.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/IgnoresSemicolonAtEndOfSimpleImplicitExpression.cspans.txt index cdb23fb755..5d8d6c3b55 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/IgnoresSemicolonAtEndOfSimpleImplicitExpression.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/IgnoresSemicolonAtEndOfSimpleImplicitExpression.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [4] ) -Code span at (1:0,1 [3] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [4] ) +Code span at (1:0,1 [3] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [4] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/IgnoresSemicolonAtEndOfSimpleImplicitExpression.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/IgnoresSemicolonAtEndOfSimpleImplicitExpression.stree.txt index 8967206fd1..d6126280d9 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/IgnoresSemicolonAtEndOfSimpleImplicitExpression.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/IgnoresSemicolonAtEndOfSimpleImplicitExpression.stree.txt @@ -1,5 +1,5 @@ Expression block - Gen - 4 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [foo] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[foo]; + SyntaxKind.Transition;[@]; + Code span - Gen - [foo] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[foo]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/NestedImplicitExpression.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/NestedImplicitExpression.cspans.txt index 345383cbb0..70ce638f46 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/NestedImplicitExpression.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/NestedImplicitExpression.cspans.txt @@ -1,4 +1,4 @@ Code span at (0:0,0 [12] ) (Accepts:Any) - Parent: Statement block at (0:0,0 [18] ) Transition span at (12:0,12 [1] ) (Accepts:None) - Parent: Expression block at (12:0,12 [4] ) -Code span at (13:0,13 [3] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (12:0,12 [4] ) +Code span at (13:0,13 [3] ) (Accepts:NonWhitespace) - Parent: Expression block at (12:0,12 [4] ) Code span at (16:0,16 [2] ) (Accepts:Any) - Parent: Statement block at (0:0,0 [18] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/NestedImplicitExpression.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/NestedImplicitExpression.stree.txt index ca459f326c..f7400b9631 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/NestedImplicitExpression.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/NestedImplicitExpression.stree.txt @@ -1,18 +1,18 @@ Statement block - Gen - 18 - (0:0,0) Code span - Gen - [if (true) { ] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:8 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[true]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[true]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; Expression block - Gen - 4 - (12:0,12) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (12:0,12) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [foo] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[ATD];K14 - (13:0,13) - Tokens:1 - CSharpTokenType.Identifier;[foo]; + SyntaxKind.Transition;[@]; + Code span - Gen - [foo] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[ATD];K14 - (13:0,13) - Tokens:1 + SyntaxKind.Identifier;[foo]; Code span - Gen - [ }] - SpanEditHandler;Accepts:Any - (16:0,16) - Tokens:2 - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputExpressionIfModuleTokenNotFollowedByBrace.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputExpressionIfModuleTokenNotFollowedByBrace.cspans.txt index 91506cb48b..41c54b6b10 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputExpressionIfModuleTokenNotFollowedByBrace.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputExpressionIfModuleTokenNotFollowedByBrace.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [13] ) -Code span at (1:0,1 [12] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [13] ) +Code span at (1:0,1 [12] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [13] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputExpressionIfModuleTokenNotFollowedByBrace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputExpressionIfModuleTokenNotFollowedByBrace.stree.txt index e32608be70..92f959c82f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputExpressionIfModuleTokenNotFollowedByBrace.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputExpressionIfModuleTokenNotFollowedByBrace.stree.txt @@ -1,9 +1,9 @@ Expression block - Gen - 13 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [module.foo()] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:5 - CSharpTokenType.Identifier;[module]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; + SyntaxKind.Transition;[@]; + Code span - Gen - [module.foo()] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:5 + SyntaxKind.Identifier;[module]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputsZeroLengthCodeSpanIfEOFOccursAfterTransition.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputsZeroLengthCodeSpanIfEOFOccursAfterTransition.cspans.txt index df81e75cc2..7d1e387fe4 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputsZeroLengthCodeSpanIfEOFOccursAfterTransition.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputsZeroLengthCodeSpanIfEOFOccursAfterTransition.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [1] ) -Code span at (1:0,1 [0] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [1] ) +Code span at (1:0,1 [0] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [1] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputsZeroLengthCodeSpanIfEOFOccursAfterTransition.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputsZeroLengthCodeSpanIfEOFOccursAfterTransition.stree.txt index 8f8de632d0..40da231bf0 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputsZeroLengthCodeSpanIfEOFOccursAfterTransition.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputsZeroLengthCodeSpanIfEOFOccursAfterTransition.stree.txt @@ -1,5 +1,5 @@ Expression block - Gen - 1 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Transition;[@]; + Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputsZeroLengthCodeSpanIfInvalidCharacterFollowsTransition.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputsZeroLengthCodeSpanIfInvalidCharacterFollowsTransition.cspans.txt index df81e75cc2..7d1e387fe4 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputsZeroLengthCodeSpanIfInvalidCharacterFollowsTransition.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputsZeroLengthCodeSpanIfInvalidCharacterFollowsTransition.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [1] ) -Code span at (1:0,1 [0] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [1] ) +Code span at (1:0,1 [0] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [1] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputsZeroLengthCodeSpanIfInvalidCharacterFollowsTransition.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputsZeroLengthCodeSpanIfInvalidCharacterFollowsTransition.stree.txt index 8f8de632d0..40da231bf0 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputsZeroLengthCodeSpanIfInvalidCharacterFollowsTransition.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/OutputsZeroLengthCodeSpanIfInvalidCharacterFollowsTransition.stree.txt @@ -1,5 +1,5 @@ Expression block - Gen - 1 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Transition;[@]; + Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesDottedIdentifiersAsImplicitExpression.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesDottedIdentifiersAsImplicitExpression.cspans.txt index 4c546c5213..0ee2dadc29 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesDottedIdentifiersAsImplicitExpression.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesDottedIdentifiersAsImplicitExpression.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [12] ) -Code span at (1:0,1 [11] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [12] ) +Code span at (1:0,1 [11] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [12] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesDottedIdentifiersAsImplicitExpression.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesDottedIdentifiersAsImplicitExpression.stree.txt index b130a21495..9b751618bf 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesDottedIdentifiersAsImplicitExpression.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesDottedIdentifiersAsImplicitExpression.stree.txt @@ -1,9 +1,9 @@ Expression block - Gen - 12 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [foo.bar.baz] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:5 - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[baz]; + SyntaxKind.Transition;[@]; + Code span - Gen - [foo.bar.baz] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:5 + SyntaxKind.Identifier;[foo]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[baz]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket1.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket1.cspans.txt index cdb23fb755..5d8d6c3b55 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket1.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket1.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [4] ) -Code span at (1:0,1 [3] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [4] ) +Code span at (1:0,1 [3] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [4] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket1.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket1.stree.txt index d0922098d3..b18c1f269f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket1.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket1.stree.txt @@ -1,5 +1,5 @@ Expression block - Gen - 4 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[val]; + SyntaxKind.Transition;[@]; + Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[val]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket10.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket10.cspans.txt index 76e4befa6f..ec7b977780 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket10.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket10.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [9] ) -Code span at (1:0,1 [8] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [9] ) +Code span at (1:0,1 [8] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [9] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket10.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket10.stree.txt index a03e6f1514..bf5897cfb6 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket10.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket10.stree.txt @@ -1,10 +1,10 @@ Expression block - Gen - 9 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [val?[-1]] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:6 - CSharpTokenType.Identifier;[val]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.LeftBracket;[[]; - CSharpTokenType.Minus;[-]; - CSharpTokenType.IntegerLiteral;[1]; - CSharpTokenType.RightBracket;[]]; + SyntaxKind.Transition;[@]; + Code span - Gen - [val?[-1]] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:6 + SyntaxKind.Identifier;[val]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.Minus;[-]; + SyntaxKind.IntegerLiteral;[1]; + SyntaxKind.RightBracket;[]]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket11.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket11.stree.txt index 2445b36952..646f168e3a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket11.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket11.stree.txt @@ -1,12 +1,12 @@ Expression block - Gen - 15 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [val?[abc]?[def] - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:8 - CSharpTokenType.Identifier;[val]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.LeftBracket;[[]; - CSharpTokenType.Identifier;[abc]; - CSharpTokenType.RightBracket;[]]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.LeftBracket;[[]; - CSharpTokenType.Identifier;[def]; + SyntaxKind.Identifier;[val]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.Identifier;[abc]; + SyntaxKind.RightBracket;[]]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.Identifier;[def]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket12.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket12.cspans.txt index bde230d5d2..864c7d8d23 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket12.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket12.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [14] ) -Code span at (1:0,1 [13] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [14] ) +Code span at (1:0,1 [13] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [14] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket12.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket12.stree.txt index fcfaadd462..fdeae1b84d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket12.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket12.stree.txt @@ -1,13 +1,13 @@ Expression block - Gen - 14 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [val?[abc]?[2]] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:9 - CSharpTokenType.Identifier;[val]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.LeftBracket;[[]; - CSharpTokenType.Identifier;[abc]; - CSharpTokenType.RightBracket;[]]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.LeftBracket;[[]; - CSharpTokenType.IntegerLiteral;[2]; - CSharpTokenType.RightBracket;[]]; + SyntaxKind.Transition;[@]; + Code span - Gen - [val?[abc]?[2]] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:9 + SyntaxKind.Identifier;[val]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.Identifier;[abc]; + SyntaxKind.RightBracket;[]]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.IntegerLiteral;[2]; + SyntaxKind.RightBracket;[]]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket13.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket13.cspans.txt index 234d8ba877..35b87f10d7 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket13.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket13.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [22] ) -Code span at (1:0,1 [21] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [22] ) +Code span at (1:0,1 [21] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [22] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket13.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket13.stree.txt index 3c1fe5005f..6095a9ffe4 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket13.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket13.stree.txt @@ -1,16 +1,16 @@ Expression block - Gen - 22 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [val?[abc]?.more?[def]] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:12 - CSharpTokenType.Identifier;[val]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.LeftBracket;[[]; - CSharpTokenType.Identifier;[abc]; - CSharpTokenType.RightBracket;[]]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[more]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.LeftBracket;[[]; - CSharpTokenType.Identifier;[def]; - CSharpTokenType.RightBracket;[]]; + SyntaxKind.Transition;[@]; + Code span - Gen - [val?[abc]?.more?[def]] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:12 + SyntaxKind.Identifier;[val]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.Identifier;[abc]; + SyntaxKind.RightBracket;[]]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[more]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.Identifier;[def]; + SyntaxKind.RightBracket;[]]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket14.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket14.cspans.txt index 49e8605cc5..fbdf3c744b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket14.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket14.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [21] ) -Code span at (1:0,1 [20] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [21] ) +Code span at (1:0,1 [20] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [21] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket14.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket14.stree.txt index 24b8db6eaf..0517953966 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket14.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket14.stree.txt @@ -1,15 +1,15 @@ Expression block - Gen - 21 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [val?[abc]?.more?.abc] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:11 - CSharpTokenType.Identifier;[val]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.LeftBracket;[[]; - CSharpTokenType.Identifier;[abc]; - CSharpTokenType.RightBracket;[]]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[more]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[abc]; + SyntaxKind.Transition;[@]; + Code span - Gen - [val?[abc]?.more?.abc] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:11 + SyntaxKind.Identifier;[val]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.Identifier;[abc]; + SyntaxKind.RightBracket;[]]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[more]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[abc]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket15.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket15.cspans.txt index 8df3e04068..520ec8b081 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket15.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket15.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [19] ) -Code span at (1:0,1 [18] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [19] ) +Code span at (1:0,1 [18] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [19] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket15.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket15.stree.txt index d8b3eb81dd..da502209c5 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket15.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket15.stree.txt @@ -1,13 +1,13 @@ Expression block - Gen - 19 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [val?[null ?? true]] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:9 - CSharpTokenType.Identifier;[val]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.LeftBracket;[[]; - CSharpTokenType.Keyword;[null]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.NullCoalesce;[??]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[true]; - CSharpTokenType.RightBracket;[]]; + SyntaxKind.Transition;[@]; + Code span - Gen - [val?[null ?? true]] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:9 + SyntaxKind.Identifier;[val]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.Keyword;[null]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.NullCoalesce;[??]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[true]; + SyntaxKind.RightBracket;[]]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket16.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket16.cspans.txt index 9c65443a64..ae2be86cae 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket16.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket16.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [20] ) -Code span at (1:0,1 [19] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [20] ) +Code span at (1:0,1 [19] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [20] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket16.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket16.stree.txt index 6cef2a04b9..e30c74d598 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket16.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket16.stree.txt @@ -1,17 +1,17 @@ Expression block - Gen - 20 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [val?[abc?.gef?[-1]]] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:13 - CSharpTokenType.Identifier;[val]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.LeftBracket;[[]; - CSharpTokenType.Identifier;[abc]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[gef]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.LeftBracket;[[]; - CSharpTokenType.Minus;[-]; - CSharpTokenType.IntegerLiteral;[1]; - CSharpTokenType.RightBracket;[]]; - CSharpTokenType.RightBracket;[]]; + SyntaxKind.Transition;[@]; + Code span - Gen - [val?[abc?.gef?[-1]]] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:13 + SyntaxKind.Identifier;[val]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.Identifier;[abc]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[gef]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.Minus;[-]; + SyntaxKind.IntegerLiteral;[1]; + SyntaxKind.RightBracket;[]]; + SyntaxKind.RightBracket;[]]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket2.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket2.cspans.txt index cdb23fb755..5d8d6c3b55 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket2.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket2.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [4] ) -Code span at (1:0,1 [3] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [4] ) +Code span at (1:0,1 [3] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [4] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket2.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket2.stree.txt index d0922098d3..b18c1f269f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket2.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket2.stree.txt @@ -1,5 +1,5 @@ Expression block - Gen - 4 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[val]; + SyntaxKind.Transition;[@]; + Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[val]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket3.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket3.stree.txt index 6323d68f11..c0e4634e0e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket3.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket3.stree.txt @@ -1,7 +1,7 @@ Expression block - Gen - 6 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [val?[] - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:3 - CSharpTokenType.Identifier;[val]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.LeftBracket;[[]; + SyntaxKind.Identifier;[val]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.LeftBracket;[[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket4.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket4.cspans.txt index cdb23fb755..5d8d6c3b55 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket4.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket4.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [4] ) -Code span at (1:0,1 [3] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [4] ) +Code span at (1:0,1 [3] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [4] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket4.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket4.stree.txt index d0922098d3..b18c1f269f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket4.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket4.stree.txt @@ -1,5 +1,5 @@ Expression block - Gen - 4 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[val]; + SyntaxKind.Transition;[@]; + Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[val]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket5.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket5.stree.txt index a46eeb9133..0fc1f37efc 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket5.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket5.stree.txt @@ -1,8 +1,8 @@ Expression block - Gen - 10 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [val?[more] - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:4 - CSharpTokenType.Identifier;[val]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.LeftBracket;[[]; - CSharpTokenType.Identifier;[more]; + SyntaxKind.Identifier;[val]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.Identifier;[more]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket6.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket6.cspans.txt index befccd6124..5796fa527a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket6.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket6.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [8] ) -Code span at (1:0,1 [7] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [8] ) +Code span at (1:0,1 [7] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [8] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket6.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket6.stree.txt index b57c6e2517..ae96d51b05 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket6.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket6.stree.txt @@ -1,9 +1,9 @@ Expression block - Gen - 8 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [val?[0]] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:5 - CSharpTokenType.Identifier;[val]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.LeftBracket;[[]; - CSharpTokenType.IntegerLiteral;[0]; - CSharpTokenType.RightBracket;[]]; + SyntaxKind.Transition;[@]; + Code span - Gen - [val?[0]] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:5 + SyntaxKind.Identifier;[val]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.IntegerLiteral;[0]; + SyntaxKind.RightBracket;[]]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket7.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket7.stree.txt index 6323d68f11..c0e4634e0e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket7.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket7.stree.txt @@ -1,7 +1,7 @@ Expression block - Gen - 6 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [val?[] - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:3 - CSharpTokenType.Identifier;[val]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.LeftBracket;[[]; + SyntaxKind.Identifier;[val]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.LeftBracket;[[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket8.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket8.stree.txt index 61ca8525a6..c58999c69b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket8.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket8.stree.txt @@ -1,9 +1,9 @@ Expression block - Gen - 11 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [val?[more.] - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:5 - CSharpTokenType.Identifier;[val]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.LeftBracket;[[]; - CSharpTokenType.Identifier;[more]; - CSharpTokenType.Dot;[.]; + SyntaxKind.Identifier;[val]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.Identifier;[more]; + SyntaxKind.Dot;[.]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket9.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket9.cspans.txt index cdb23fb755..5d8d6c3b55 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket9.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket9.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [4] ) -Code span at (1:0,1 [3] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [4] ) +Code span at (1:0,1 [3] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [4] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket9.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket9.stree.txt index d0922098d3..b18c1f269f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket9.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Bracket9.stree.txt @@ -1,5 +1,5 @@ Expression block - Gen - 4 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[val]; + SyntaxKind.Transition;[@]; + Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[val]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot1.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot1.cspans.txt index cdb23fb755..5d8d6c3b55 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot1.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot1.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [4] ) -Code span at (1:0,1 [3] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [4] ) +Code span at (1:0,1 [3] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [4] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot1.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot1.stree.txt index d0922098d3..b18c1f269f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot1.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot1.stree.txt @@ -1,5 +1,5 @@ Expression block - Gen - 4 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[val]; + SyntaxKind.Transition;[@]; + Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[val]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot10.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot10.cspans.txt index 6c0269d3fa..10f688db0f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot10.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot10.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [10] ) -Code span at (1:0,1 [9] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [10] ) +Code span at (1:0,1 [9] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [10] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot10.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot10.stree.txt index 957c73bbe7..ac416a7286 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot10.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot10.stree.txt @@ -1,8 +1,8 @@ Expression block - Gen - 10 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [val?.more] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:4 - CSharpTokenType.Identifier;[val]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[more]; + SyntaxKind.Transition;[@]; + Code span - Gen - [val?.more] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:4 + SyntaxKind.Identifier;[val]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[more]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot11.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot11.cspans.txt index cdb23fb755..5d8d6c3b55 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot11.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot11.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [4] ) -Code span at (1:0,1 [3] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [4] ) +Code span at (1:0,1 [3] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [4] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot11.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot11.stree.txt index d0922098d3..b18c1f269f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot11.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot11.stree.txt @@ -1,5 +1,5 @@ Expression block - Gen - 4 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[val]; + SyntaxKind.Transition;[@]; + Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[val]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot12.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot12.cspans.txt index 8df3e04068..520ec8b081 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot12.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot12.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [19] ) -Code span at (1:0,1 [18] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [19] ) +Code span at (1:0,1 [18] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [19] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot12.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot12.stree.txt index 0a0c3e1a67..bacea444e6 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot12.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot12.stree.txt @@ -1,13 +1,13 @@ Expression block - Gen - 19 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [val?.more(false)?.] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:9 - CSharpTokenType.Identifier;[val]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[more]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[false]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.Dot;[.]; + SyntaxKind.Transition;[@]; + Code span - Gen - [val?.more(false)?.] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:9 + SyntaxKind.Identifier;[val]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[more]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[false]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.Dot;[.]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot13.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot13.cspans.txt index 234d8ba877..35b87f10d7 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot13.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot13.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [22] ) -Code span at (1:0,1 [21] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [22] ) +Code span at (1:0,1 [21] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [22] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot13.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot13.stree.txt index 8f54d19b74..aa043d3d76 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot13.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot13.stree.txt @@ -1,14 +1,14 @@ Expression block - Gen - 22 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [val?.more(false)?.abc] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:10 - CSharpTokenType.Identifier;[val]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[more]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[false]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[abc]; + SyntaxKind.Transition;[@]; + Code span - Gen - [val?.more(false)?.abc] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:10 + SyntaxKind.Identifier;[val]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[more]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[false]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[abc]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot14.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot14.cspans.txt index 451e06d958..07751b0177 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot14.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot14.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [29] ) -Code span at (1:0,1 [28] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [29] ) +Code span at (1:0,1 [28] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [29] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot14.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot14.stree.txt index bfb8b54625..1aec905882 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot14.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot14.stree.txt @@ -1,18 +1,18 @@ Expression block - Gen - 29 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [val?.more(null ?? true)?.abc] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:14 - CSharpTokenType.Identifier;[val]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[more]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[null]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.NullCoalesce;[??]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[true]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[abc]; + SyntaxKind.Transition;[@]; + Code span - Gen - [val?.more(null ?? true)?.abc] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:14 + SyntaxKind.Identifier;[val]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[more]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[null]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.NullCoalesce;[??]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[true]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[abc]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot2.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot2.cspans.txt index cdb23fb755..5d8d6c3b55 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot2.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot2.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [4] ) -Code span at (1:0,1 [3] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [4] ) +Code span at (1:0,1 [3] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [4] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot2.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot2.stree.txt index d0922098d3..b18c1f269f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot2.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot2.stree.txt @@ -1,5 +1,5 @@ Expression block - Gen - 4 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[val]; + SyntaxKind.Transition;[@]; + Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[val]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot3.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot3.cspans.txt index cdb23fb755..5d8d6c3b55 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot3.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot3.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [4] ) -Code span at (1:0,1 [3] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [4] ) +Code span at (1:0,1 [3] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [4] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot3.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot3.stree.txt index d0922098d3..b18c1f269f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot3.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot3.stree.txt @@ -1,5 +1,5 @@ Expression block - Gen - 4 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[val]; + SyntaxKind.Transition;[@]; + Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[val]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot4.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot4.cspans.txt index cdb23fb755..5d8d6c3b55 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot4.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot4.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [4] ) -Code span at (1:0,1 [3] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [4] ) +Code span at (1:0,1 [3] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [4] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot4.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot4.stree.txt index d0922098d3..b18c1f269f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot4.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot4.stree.txt @@ -1,5 +1,5 @@ Expression block - Gen - 4 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[val]; + SyntaxKind.Transition;[@]; + Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[val]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot5.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot5.cspans.txt index dd3f06b886..4b957e0a7e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot5.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot5.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [6] ) -Code span at (1:0,1 [5] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [6] ) +Code span at (1:0,1 [5] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [6] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot5.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot5.stree.txt index 3860072ffb..f71f1f7ae8 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot5.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot5.stree.txt @@ -1,7 +1,7 @@ Expression block - Gen - 6 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [val?.] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:3 - CSharpTokenType.Identifier;[val]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.Dot;[.]; + SyntaxKind.Transition;[@]; + Code span - Gen - [val?.] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:3 + SyntaxKind.Identifier;[val]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.Dot;[.]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot6.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot6.cspans.txt index cdb23fb755..5d8d6c3b55 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot6.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot6.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [4] ) -Code span at (1:0,1 [3] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [4] ) +Code span at (1:0,1 [3] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [4] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot6.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot6.stree.txt index d0922098d3..b18c1f269f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot6.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot6.stree.txt @@ -1,5 +1,5 @@ Expression block - Gen - 4 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[val]; + SyntaxKind.Transition;[@]; + Code span - Gen - [val] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[val]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot7.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot7.cspans.txt index dd3f06b886..4b957e0a7e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot7.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot7.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [6] ) -Code span at (1:0,1 [5] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [6] ) +Code span at (1:0,1 [5] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [6] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot7.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot7.stree.txt index 3860072ffb..f71f1f7ae8 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot7.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot7.stree.txt @@ -1,7 +1,7 @@ Expression block - Gen - 6 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [val?.] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:3 - CSharpTokenType.Identifier;[val]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.Dot;[.]; + SyntaxKind.Transition;[@]; + Code span - Gen - [val?.] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:3 + SyntaxKind.Identifier;[val]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.Dot;[.]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot8.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot8.cspans.txt index dd3f06b886..4b957e0a7e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot8.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot8.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [6] ) -Code span at (1:0,1 [5] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [6] ) +Code span at (1:0,1 [5] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [6] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot8.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot8.stree.txt index 3860072ffb..f71f1f7ae8 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot8.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot8.stree.txt @@ -1,7 +1,7 @@ Expression block - Gen - 6 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [val?.] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:3 - CSharpTokenType.Identifier;[val]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.Dot;[.]; + SyntaxKind.Transition;[@]; + Code span - Gen - [val?.] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:3 + SyntaxKind.Identifier;[val]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.Dot;[.]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot9.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot9.cspans.txt index 6c0269d3fa..10f688db0f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot9.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot9.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [10] ) -Code span at (1:0,1 [9] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [10] ) +Code span at (1:0,1 [9] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [10] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot9.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot9.stree.txt index 957c73bbe7..ac416a7286 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot9.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesNullConditionalOperatorImplicitExpression_Dot9.stree.txt @@ -1,8 +1,8 @@ Expression block - Gen - 10 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [val?.more] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:4 - CSharpTokenType.Identifier;[val]; - CSharpTokenType.QuestionMark;[?]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[more]; + SyntaxKind.Transition;[@]; + Code span - Gen - [val?.more] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:4 + SyntaxKind.Identifier;[val]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[more]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesSingleIdentifierAsImplicitExpression.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesSingleIdentifierAsImplicitExpression.cspans.txt index cdb23fb755..5d8d6c3b55 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesSingleIdentifierAsImplicitExpression.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesSingleIdentifierAsImplicitExpression.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [4] ) -Code span at (1:0,1 [3] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [4] ) +Code span at (1:0,1 [3] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [4] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesSingleIdentifierAsImplicitExpression.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesSingleIdentifierAsImplicitExpression.stree.txt index 8967206fd1..d6126280d9 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesSingleIdentifierAsImplicitExpression.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ParsesSingleIdentifierAsImplicitExpression.stree.txt @@ -1,5 +1,5 @@ Expression block - Gen - 4 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [foo] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[foo]; + SyntaxKind.Transition;[@]; + Code span - Gen - [foo] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[foo]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ProperlyParsesBracketsAndBalancesThemInImplicitExpression.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ProperlyParsesBracketsAndBalancesThemInImplicitExpression.cspans.txt index 5daaaee8dd..e36107cf2e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ProperlyParsesBracketsAndBalancesThemInImplicitExpression.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ProperlyParsesBracketsAndBalancesThemInImplicitExpression.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [34] ) -Code span at (1:0,1 [33] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [34] ) +Code span at (1:0,1 [33] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [34] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ProperlyParsesBracketsAndBalancesThemInImplicitExpression.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ProperlyParsesBracketsAndBalancesThemInImplicitExpression.stree.txt index b600515ce2..4a48ef8c59 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ProperlyParsesBracketsAndBalancesThemInImplicitExpression.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ProperlyParsesBracketsAndBalancesThemInImplicitExpression.stree.txt @@ -1,25 +1,25 @@ Expression block - Gen - 34 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [foo.bar[4 * (8 + 7)]["fo\"o"].baz] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:21 - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftBracket;[[]; - CSharpTokenType.IntegerLiteral;[4]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Star;[*]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.IntegerLiteral;[8]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Plus;[+]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[7]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.RightBracket;[]]; - CSharpTokenType.LeftBracket;[[]; - CSharpTokenType.StringLiteral;["fo\"o"]; - CSharpTokenType.RightBracket;[]]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[baz]; + SyntaxKind.Transition;[@]; + Code span - Gen - [foo.bar[4 * (8 + 7)]["fo\"o"].baz] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:21 + SyntaxKind.Identifier;[foo]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.IntegerLiteral;[4]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Star;[*]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.IntegerLiteral;[8]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Plus;[+]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[7]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.RightBracket;[]]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.StringLiteral;["fo\"o"]; + SyntaxKind.RightBracket;[]]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[baz]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ProperlyParsesParenthesesAndBalancesThemInImplicitExpression.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ProperlyParsesParenthesesAndBalancesThemInImplicitExpression.cspans.txt index f685dcc492..37fa7b6ae0 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ProperlyParsesParenthesesAndBalancesThemInImplicitExpression.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ProperlyParsesParenthesesAndBalancesThemInImplicitExpression.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [115] ) -Code span at (1:0,1 [114] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [115] ) +Code span at (1:0,1 [114] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [115] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ProperlyParsesParenthesesAndBalancesThemInImplicitExpression.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ProperlyParsesParenthesesAndBalancesThemInImplicitExpression.stree.txt index 860b824f83..24c0b3ea59 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ProperlyParsesParenthesesAndBalancesThemInImplicitExpression.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/ProperlyParsesParenthesesAndBalancesThemInImplicitExpression.stree.txt @@ -1,63 +1,63 @@ Expression block - Gen - 115 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [foo().bar("bi\"z", 4)("chained method; call").baz(@"bo""z", '\'', () => { return 4; }, (4+5+new { foo = bar[4] }))] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:59 - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.StringLiteral;["bi\"z"]; - CSharpTokenType.Comma;[,]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[4]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.StringLiteral;["chained method; call"]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[baz]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.StringLiteral;[@"bo""z"]; - CSharpTokenType.Comma;[,]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.CharacterLiteral;['\'']; - CSharpTokenType.Comma;[,]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.GreaterThanEqual;[=>]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[return]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[4]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.Comma;[,]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.IntegerLiteral;[4]; - CSharpTokenType.Plus;[+]; - CSharpTokenType.IntegerLiteral;[5]; - CSharpTokenType.Plus;[+]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftBracket;[[]; - CSharpTokenType.IntegerLiteral;[4]; - CSharpTokenType.RightBracket;[]]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.RightParenthesis;[)]; + SyntaxKind.Transition;[@]; + Code span - Gen - [foo().bar("bi\"z", 4)("chained method; call").baz(@"bo""z", '\'', () => { return 4; }, (4+5+new { foo = bar[4] }))] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:59 + SyntaxKind.Identifier;[foo]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.StringLiteral;["bi\"z"]; + SyntaxKind.Comma;[,]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[4]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.StringLiteral;["chained method; call"]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[baz]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.StringLiteral;[@"bo""z"]; + SyntaxKind.Comma;[,]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.CharacterLiteral;['\'']; + SyntaxKind.Comma;[,]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.GreaterThanEqual;[=>]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[return]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[4]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Comma;[,]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.IntegerLiteral;[4]; + SyntaxKind.Plus;[+]; + SyntaxKind.IntegerLiteral;[5]; + SyntaxKind.Plus;[+]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftBracket;[[]; + SyntaxKind.IntegerLiteral;[4]; + SyntaxKind.RightBracket;[]]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/StopsBalancingParenthesesAtEOF.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/StopsBalancingParenthesesAtEOF.stree.txt index baef337685..11fbcd48bc 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/StopsBalancingParenthesesAtEOF.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/StopsBalancingParenthesesAtEOF.stree.txt @@ -1,8 +1,8 @@ Expression block - Gen - 7 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [foo(()] - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:4 - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/SupportsSlashesWithinComplexImplicitExpressions.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/SupportsSlashesWithinComplexImplicitExpressions.cspans.txt index a9cb762b3d..5c4dc5a1d4 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/SupportsSlashesWithinComplexImplicitExpressions.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/SupportsSlashesWithinComplexImplicitExpressions.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [103] ) -Code span at (1:0,1 [102] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [103] ) +Code span at (1:0,1 [102] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [103] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/SupportsSlashesWithinComplexImplicitExpressions.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/SupportsSlashesWithinComplexImplicitExpressions.stree.txt index 00f9a55723..1d0244fc8d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/SupportsSlashesWithinComplexImplicitExpressions.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/SupportsSlashesWithinComplexImplicitExpressions.stree.txt @@ -1,39 +1,39 @@ Expression block - Gen - 103 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [DataGridColumn.Template("Years of Service", e => (int)Math.Round((DateTime.Now - dt).TotalDays / 365))] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:35 - CSharpTokenType.Identifier;[DataGridColumn]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Template]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.StringLiteral;["Years of Service"]; - CSharpTokenType.Comma;[,]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[e]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.GreaterThanEqual;[=>]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[int]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Identifier;[Math]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Round]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[DateTime]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Now]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Minus;[-]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[dt]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[TotalDays]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Slash;[/]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[365]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.RightParenthesis;[)]; + SyntaxKind.Transition;[@]; + Code span - Gen - [DataGridColumn.Template("Years of Service", e => (int)Math.Round((DateTime.Now - dt).TotalDays / 365))] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:35 + SyntaxKind.Identifier;[DataGridColumn]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Template]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.StringLiteral;["Years of Service"]; + SyntaxKind.Comma;[,]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[e]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.GreaterThanEqual;[=>]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[int]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Identifier;[Math]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Round]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[DateTime]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Now]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Minus;[-]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[dt]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[TotalDays]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Slash;[/]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[365]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesAfterIdentifierUnlessFollowedByDotOrParenInImplicitExpr.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesAfterIdentifierUnlessFollowedByDotOrParenInImplicitExpr.cspans.txt index befccd6124..5796fa527a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesAfterIdentifierUnlessFollowedByDotOrParenInImplicitExpr.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesAfterIdentifierUnlessFollowedByDotOrParenInImplicitExpr.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [8] ) -Code span at (1:0,1 [7] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [8] ) +Code span at (1:0,1 [7] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [8] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesAfterIdentifierUnlessFollowedByDotOrParenInImplicitExpr.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesAfterIdentifierUnlessFollowedByDotOrParenInImplicitExpr.stree.txt index a319543617..ece2fdbfe0 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesAfterIdentifierUnlessFollowedByDotOrParenInImplicitExpr.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesAfterIdentifierUnlessFollowedByDotOrParenInImplicitExpr.stree.txt @@ -1,7 +1,7 @@ Expression block - Gen - 8 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [foo.bar] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:3 - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[bar]; + SyntaxKind.Transition;[@]; + Code span - Gen - [foo.bar] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:3 + SyntaxKind.Identifier;[foo]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[bar]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExprBeforeDotIfDotNotFollowedByIdentifierStartChar.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExprBeforeDotIfDotNotFollowedByIdentifierStartChar.cspans.txt index bde230d5d2..864c7d8d23 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExprBeforeDotIfDotNotFollowedByIdentifierStartChar.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExprBeforeDotIfDotNotFollowedByIdentifierStartChar.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [14] ) -Code span at (1:0,1 [13] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [14] ) +Code span at (1:0,1 [13] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [14] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExprBeforeDotIfDotNotFollowedByIdentifierStartChar.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExprBeforeDotIfDotNotFollowedByIdentifierStartChar.stree.txt index 505ddd1f05..72c6d76525 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExprBeforeDotIfDotNotFollowedByIdentifierStartChar.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExprBeforeDotIfDotNotFollowedByIdentifierStartChar.stree.txt @@ -1,11 +1,11 @@ Expression block - Gen - 14 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [foo().bar.baz] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:7 - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[baz]; + SyntaxKind.Transition;[@]; + Code span - Gen - [foo().bar.baz] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:7 + SyntaxKind.Identifier;[foo]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[baz]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtHtmlEndTag.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtHtmlEndTag.cspans.txt index bde230d5d2..864c7d8d23 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtHtmlEndTag.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtHtmlEndTag.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [14] ) -Code span at (1:0,1 [13] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [14] ) +Code span at (1:0,1 [13] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [14] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtHtmlEndTag.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtHtmlEndTag.stree.txt index 505ddd1f05..72c6d76525 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtHtmlEndTag.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtHtmlEndTag.stree.txt @@ -1,11 +1,11 @@ Expression block - Gen - 14 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [foo().bar.baz] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:7 - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[baz]; + SyntaxKind.Transition;[@]; + Code span - Gen - [foo().bar.baz] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:7 + SyntaxKind.Identifier;[foo]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[baz]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtHtmlStartTag.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtHtmlStartTag.cspans.txt index bde230d5d2..864c7d8d23 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtHtmlStartTag.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtHtmlStartTag.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [14] ) -Code span at (1:0,1 [13] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [14] ) +Code span at (1:0,1 [13] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [14] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtHtmlStartTag.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtHtmlStartTag.stree.txt index 505ddd1f05..72c6d76525 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtHtmlStartTag.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtHtmlStartTag.stree.txt @@ -1,11 +1,11 @@ Expression block - Gen - 14 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [foo().bar.baz] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:7 - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[baz]; + SyntaxKind.Transition;[@]; + Code span - Gen - [foo().bar.baz] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:7 + SyntaxKind.Identifier;[foo]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[baz]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtLastValidPointIfDotFollowedByWhitespace.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtLastValidPointIfDotFollowedByWhitespace.cspans.txt index cdb23fb755..5d8d6c3b55 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtLastValidPointIfDotFollowedByWhitespace.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtLastValidPointIfDotFollowedByWhitespace.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [4] ) -Code span at (1:0,1 [3] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [4] ) +Code span at (1:0,1 [3] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [4] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtLastValidPointIfDotFollowedByWhitespace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtLastValidPointIfDotFollowedByWhitespace.stree.txt index 8967206fd1..d6126280d9 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtLastValidPointIfDotFollowedByWhitespace.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionAtLastValidPointIfDotFollowedByWhitespace.stree.txt @@ -1,5 +1,5 @@ Expression block - Gen - 4 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [foo] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[foo]; + SyntaxKind.Transition;[@]; + Code span - Gen - [foo] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[foo]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionIfCloseParenFollowedByAnyWhiteSpace.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionIfCloseParenFollowedByAnyWhiteSpace.cspans.txt index 6c0269d3fa..10f688db0f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionIfCloseParenFollowedByAnyWhiteSpace.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionIfCloseParenFollowedByAnyWhiteSpace.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [10] ) -Code span at (1:0,1 [9] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [10] ) +Code span at (1:0,1 [9] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [10] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionIfCloseParenFollowedByAnyWhiteSpace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionIfCloseParenFollowedByAnyWhiteSpace.stree.txt index 7dc1a3a043..db01d146c3 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionIfCloseParenFollowedByAnyWhiteSpace.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionIfCloseParenFollowedByAnyWhiteSpace.stree.txt @@ -1,9 +1,9 @@ Expression block - Gen - 10 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [foo.bar()] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:5 - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; + SyntaxKind.Transition;[@]; + Code span - Gen - [foo.bar()] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:5 + SyntaxKind.Identifier;[foo]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionIfIdentifierFollowedByAnyWhiteSpace.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionIfIdentifierFollowedByAnyWhiteSpace.cspans.txt index cdb23fb755..5d8d6c3b55 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionIfIdentifierFollowedByAnyWhiteSpace.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionIfIdentifierFollowedByAnyWhiteSpace.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [4] ) -Code span at (1:0,1 [3] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [4] ) +Code span at (1:0,1 [3] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [4] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionIfIdentifierFollowedByAnyWhiteSpace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionIfIdentifierFollowedByAnyWhiteSpace.stree.txt index 8967206fd1..d6126280d9 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionIfIdentifierFollowedByAnyWhiteSpace.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpImplicitExpressionTest/TerminatesImplicitExpressionIfIdentifierFollowedByAnyWhiteSpace.stree.txt @@ -1,5 +1,5 @@ Expression block - Gen - 4 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [foo] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[foo]; + SyntaxKind.Transition;[@]; + Code span - Gen - [foo] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[foo]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedCodeBlock.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedCodeBlock.stree.txt index f34e002cbb..512300af6c 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedCodeBlock.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedCodeBlock.stree.txt @@ -1,29 +1,29 @@ Statement block - Gen - 35 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [while(true) { { { { foo(); } } } }] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:25 - CSharpTokenType.Keyword;[while]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[true]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[while]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[true]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedExplicitExpression.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedExplicitExpression.stree.txt index e7571bdb11..7431ac8024 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedExplicitExpression.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedExplicitExpression.stree.txt @@ -1,23 +1,23 @@ Statement block - Gen - 23 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [while(true) { ] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:7 - CSharpTokenType.Keyword;[while]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[true]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Keyword;[while]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[true]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; Expression block - Gen - 6 - (15:0,15) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (15:0,15) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - CSharpTokenType.LeftParenthesis;[(]; + SyntaxKind.LeftParenthesis;[(]; Code span - Gen - [foo] - SpanEditHandler;Accepts:Any - (17:0,17) - Tokens:1 - CSharpTokenType.Identifier;[foo]; + SyntaxKind.Identifier;[foo]; MetaCode span - Gen - [)] - SpanEditHandler;Accepts:None - (20:0,20) - Tokens:1 - CSharpTokenType.RightParenthesis;[)]; + SyntaxKind.RightParenthesis;[)]; Code span - Gen - [ }] - SpanEditHandler;Accepts:None - (21:0,21) - Tokens:2 - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedImplicitExpression.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedImplicitExpression.cspans.txt index 6f05c63fa9..c33ed4d08a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedImplicitExpression.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedImplicitExpression.cspans.txt @@ -1,5 +1,5 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Statement block at (0:0,0 [21] ) Code span at (1:0,1 [14] ) (Accepts:Any) - Parent: Statement block at (0:0,0 [21] ) Transition span at (15:0,15 [1] ) (Accepts:None) - Parent: Expression block at (15:0,15 [4] ) -Code span at (16:0,16 [3] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (15:0,15 [4] ) +Code span at (16:0,16 [3] ) (Accepts:NonWhitespace) - Parent: Expression block at (15:0,15 [4] ) Code span at (19:0,19 [2] ) (Accepts:None) - Parent: Statement block at (0:0,0 [21] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedImplicitExpression.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedImplicitExpression.stree.txt index 2f0e49b1ad..4eee2c3a6f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedImplicitExpression.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedImplicitExpression.stree.txt @@ -1,19 +1,19 @@ Statement block - Gen - 21 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [while(true) { ] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:7 - CSharpTokenType.Keyword;[while]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[true]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Keyword;[while]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[true]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; Expression block - Gen - 4 - (15:0,15) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (15:0,15) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [foo] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[ATD];K14 - (16:0,16) - Tokens:1 - CSharpTokenType.Identifier;[foo]; + SyntaxKind.Transition;[@]; + Code span - Gen - [foo] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[ATD];K14 - (16:0,16) - Tokens:1 + SyntaxKind.Identifier;[foo]; Code span - Gen - [ }] - SpanEditHandler;Accepts:None - (19:0,19) - Tokens:2 - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedKeywordStatement.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedKeywordStatement.stree.txt index f7c3782b99..8bb927c9e5 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedKeywordStatement.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedKeywordStatement.stree.txt @@ -1,43 +1,43 @@ Statement block - Gen - 55 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [while(true) { for(int i = 0; i < 10; i++) { foo(); } }] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:39 - CSharpTokenType.Keyword;[while]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[true]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[for]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[int]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[0]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LessThan;[<]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[10]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.Increment;[++]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[while]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[true]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[for]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[int]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[0]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LessThan;[<]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[10]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Increment;[++]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedMarkupBlock.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedMarkupBlock.stree.txt index 8293783918..f7dfcb67d6 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedMarkupBlock.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedMarkupBlock.stree.txt @@ -1,30 +1,30 @@ Statement block - Gen - 29 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [while(true) {] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:6 - CSharpTokenType.Keyword;[while]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[true]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.Keyword;[while]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[true]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 14 - (14:0,14) Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 3 - (15:0,15) Markup span - Gen - [

] - SpanEditHandler;Accepts:None - (15:0,15) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [Hello] - SpanEditHandler;Accepts:Any - (18:0,18) - Tokens:1 - HtmlTokenType.Text;[Hello]; + SyntaxKind.Text;[Hello]; Tag block - Gen - 4 - (23:0,23) Markup span - Gen - [

] - SpanEditHandler;Accepts:None - (23:0,23) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:None - (27:0,27) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Code span - Gen - [}] - SpanEditHandler;Accepts:None - (28:0,28) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedSimpleStatement.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedSimpleStatement.stree.txt index 5a2eb3d2e3..9c3cab8153 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedSimpleStatement.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpNestedStatementsTest/NestedSimpleStatement.stree.txt @@ -1,17 +1,17 @@ Statement block - Gen - 23 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [while(true) { foo(); }] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:13 - CSharpTokenType.Keyword;[while]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[true]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[while]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[true]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/EmptyRazorComment.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/EmptyRazorComment.stree.txt index 23850e4407..0fa26e309a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/EmptyRazorComment.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/EmptyRazorComment.stree.txt @@ -1,16 +1,16 @@ Markup block - Gen - 4 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Comment block - Gen - 4 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - HtmlTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - HtmlTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Comment span - Gen - [] - SpanEditHandler;Accepts:Any - (2:0,2) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (2:0,2) - Tokens:1 - HtmlTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (3:0,3) - Tokens:1 - HtmlTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (4:0,4) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/MultipleRazorCommentInMarkup.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/MultipleRazorCommentInMarkup.stree.txt index 7c36168330..cc542a8c2f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/MultipleRazorCommentInMarkup.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/MultipleRazorCommentInMarkup.stree.txt @@ -1,43 +1,43 @@ Markup block - Gen - 25 - (0:0,0) Tag block - Gen - 3 - (0:0,0) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (3:0,3) - Tokens:1 - HtmlTokenType.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (5:1,0) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Comment block - Gen - 4 - (7:1,2) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (7:1,2) - Tokens:1 - HtmlTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (8:1,3) - Tokens:1 - HtmlTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Comment span - Gen - [] - SpanEditHandler;Accepts:Any - (9:1,4) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (9:1,4) - Tokens:1 - HtmlTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (10:1,5) - Tokens:1 - HtmlTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; Markup span - Gen - [ LF] - SpanEditHandler;Accepts:Any - (11:1,6) - Tokens:2 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.NewLine;[LF]; Comment block - Gen - 4 - (15:2,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (15:2,0) - Tokens:1 - HtmlTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (16:2,1) - Tokens:1 - HtmlTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Comment span - Gen - [] - SpanEditHandler;Accepts:Any - (17:2,2) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (17:2,2) - Tokens:1 - HtmlTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (18:2,3) - Tokens:1 - HtmlTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (19:2,4) - Tokens:1 - HtmlTokenType.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; Tag block - Gen - 4 - (21:3,0) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (21:3,0) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/MultipleRazorCommentsInSameLineInMarkup.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/MultipleRazorCommentsInSameLineInMarkup.stree.txt index 89fc73cdc8..aa67eb99bf 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/MultipleRazorCommentsInSameLineInMarkup.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/MultipleRazorCommentsInSameLineInMarkup.stree.txt @@ -1,42 +1,42 @@ Markup block - Gen - 21 - (0:0,0) Tag block - Gen - 3 - (0:0,0) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (3:0,3) - Tokens:1 - HtmlTokenType.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; Comment block - Gen - 4 - (5:1,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (5:1,0) - Tokens:1 - HtmlTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (6:1,1) - Tokens:1 - HtmlTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Comment span - Gen - [] - SpanEditHandler;Accepts:Any - (7:1,2) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (7:1,2) - Tokens:1 - HtmlTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (8:1,3) - Tokens:1 - HtmlTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (9:1,4) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (9:1,4) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Comment block - Gen - 4 - (11:1,6) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (11:1,6) - Tokens:1 - HtmlTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (12:1,7) - Tokens:1 - HtmlTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Comment span - Gen - [] - SpanEditHandler;Accepts:Any - (13:1,8) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (13:1,8) - Tokens:1 - HtmlTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (14:1,9) - Tokens:1 - HtmlTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (15:1,10) - Tokens:1 - HtmlTokenType.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; Tag block - Gen - 4 - (17:2,0) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (17:2,0) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInClosingTagBlock.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInClosingTagBlock.cspans.txt new file mode 100644 index 0000000000..af3dd82d31 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInClosingTagBlock.cspans.txt @@ -0,0 +1,8 @@ +Markup span at (0:0,0 [6] ) (Accepts:Any) - Parent: Tag block at (0:0,0 [6] ) +Markup span at (6:0,6 [7] ) (Accepts:Any) - Parent: Tag block at (6:0,6 [7] ) +Transition span at (13:0,13 [1] ) (Accepts:None) - Parent: Comment block at (13:0,13 [19] ) +MetaCode span at (14:0,14 [1] ) (Accepts:None) - Parent: Comment block at (13:0,13 [19] ) +Comment span at (15:0,15 [15] ) (Accepts:Any) - Parent: Comment block at (13:0,13 [19] ) +MetaCode span at (30:0,30 [1] ) (Accepts:None) - Parent: Comment block at (13:0,13 [19] ) +Transition span at (31:0,31 [1] ) (Accepts:None) - Parent: Comment block at (13:0,13 [19] ) +Markup span at (32:0,32 [1] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [33] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInClosingTagBlock.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInClosingTagBlock.stree.txt new file mode 100644 index 0000000000..be566bbf0e --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInClosingTagBlock.stree.txt @@ -0,0 +1,25 @@ +Markup block - Gen - 33 - (0:0,0) + Tag block - Gen - 6 - (0:0,0) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:3 + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[text]; + SyntaxKind.CloseAngle;[>]; + Tag block - Gen - 7 - (6:0,6) + Markup span - Gen - [ - 19 - (13:0,13) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (13:0,13) - Tokens:1 + SyntaxKind.RazorCommentTransition;[@]; + MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (14:0,14) - Tokens:1 + SyntaxKind.RazorCommentStar;[*]; + Comment span - Gen - [ razor comment ] - SpanEditHandler;Accepts:Any - (15:0,15) - Tokens:1 + SyntaxKind.RazorCommentLiteral;[ razor comment ]; + MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (30:0,30) - Tokens:1 + SyntaxKind.RazorCommentStar;[*]; + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (31:0,31) - Tokens:1 + SyntaxKind.RazorCommentTransition;[@]; + Markup span - Gen - [>] - SpanEditHandler;Accepts:Any - (32:0,32) - Tokens:1 + SyntaxKind.CloseAngle;[>]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInImplicitExpressionMethodCall.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInImplicitExpressionMethodCall.stree.txt index a720123ae4..0fa62fac08 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInImplicitExpressionMethodCall.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInImplicitExpressionMethodCall.stree.txt @@ -1,23 +1,23 @@ Markup block - Gen - 13 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Expression block - Gen - 13 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [foo(LF] - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:3 - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.NewLine;[LF]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.NewLine;[LF]; Comment block - Gen - 4 - (7:1,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (7:1,0) - Tokens:1 - CSharpTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (8:1,1) - Tokens:1 - CSharpTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Comment span - Gen - [] - SpanEditHandler;Accepts:Any - (9:1,2) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (9:1,2) - Tokens:1 - CSharpTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (10:1,3) - Tokens:1 - CSharpTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; Code span - Gen - [LF] - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 - (11:1,4) - Tokens:1 - CSharpTokenType.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInMarkup.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInMarkup.stree.txt index d220dd0bc1..1cb4734171 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInMarkup.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInMarkup.stree.txt @@ -1,27 +1,27 @@ Markup block - Gen - 15 - (0:0,0) Tag block - Gen - 3 - (0:0,0) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (3:0,3) - Tokens:1 - HtmlTokenType.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; Comment block - Gen - 4 - (5:1,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (5:1,0) - Tokens:1 - HtmlTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (6:1,1) - Tokens:1 - HtmlTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Comment span - Gen - [] - SpanEditHandler;Accepts:Any - (7:1,2) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (7:1,2) - Tokens:1 - HtmlTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (8:1,3) - Tokens:1 - HtmlTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (9:1,4) - Tokens:1 - HtmlTokenType.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; Tag block - Gen - 4 - (11:2,0) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (11:2,0) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInOpeningTagBlock.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInOpeningTagBlock.cspans.txt new file mode 100644 index 0000000000..be8102eb0a --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInOpeningTagBlock.cspans.txt @@ -0,0 +1,8 @@ +Markup span at (0:0,0 [6] ) (Accepts:Any) - Parent: Tag block at (0:0,0 [26] ) +Transition span at (6:0,6 [1] ) (Accepts:None) - Parent: Comment block at (6:0,6 [19] ) +MetaCode span at (7:0,7 [1] ) (Accepts:None) - Parent: Comment block at (6:0,6 [19] ) +Comment span at (8:0,8 [15] ) (Accepts:Any) - Parent: Comment block at (6:0,6 [19] ) +MetaCode span at (23:0,23 [1] ) (Accepts:None) - Parent: Comment block at (6:0,6 [19] ) +Transition span at (24:0,24 [1] ) (Accepts:None) - Parent: Comment block at (6:0,6 [19] ) +Markup span at (25:0,25 [1] ) (Accepts:Any) - Parent: Tag block at (0:0,0 [26] ) +Markup span at (26:0,26 [7] ) (Accepts:Any) - Parent: Tag block at (26:0,26 [7] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInOpeningTagBlock.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInOpeningTagBlock.stree.txt new file mode 100644 index 0000000000..7ae337d764 --- /dev/null +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInOpeningTagBlock.stree.txt @@ -0,0 +1,25 @@ +Markup block - Gen - 33 - (0:0,0) + Tag block - Gen - 26 - (0:0,0) + Markup span - Gen - [ - 19 - (6:0,6) + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (6:0,6) - Tokens:1 + SyntaxKind.RazorCommentTransition;[@]; + MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (7:0,7) - Tokens:1 + SyntaxKind.RazorCommentStar;[*]; + Comment span - Gen - [ razor comment ] - SpanEditHandler;Accepts:Any - (8:0,8) - Tokens:1 + SyntaxKind.RazorCommentLiteral;[ razor comment ]; + MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (23:0,23) - Tokens:1 + SyntaxKind.RazorCommentStar;[*]; + Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (24:0,24) - Tokens:1 + SyntaxKind.RazorCommentTransition;[@]; + Markup span - Gen - [>] - SpanEditHandler;Accepts:Any - (25:0,25) - Tokens:1 + SyntaxKind.CloseAngle;[>]; + Tag block - Gen - 7 - (26:0,26) + Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (26:0,26) - Tokens:4 + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[text]; + SyntaxKind.CloseAngle;[>]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInVerbatimBlock.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInVerbatimBlock.stree.txt index c83ed3402f..d7fc7840fb 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInVerbatimBlock.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentInVerbatimBlock.stree.txt @@ -1,35 +1,35 @@ Markup block - Gen - 26 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Statement block - Gen - 26 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Code span - Gen - [LF ] - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[}];AtEOL - (2:0,2) - Tokens:2 - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; Markup block - Gen - 18 - (8:1,4) Tag block - Gen - 5 - (8:1,4) Transition span - Gen - [ - [LF] - SpanEditHandler;Accepts:None - (13:1,9) - Tokens:1 - HtmlTokenType.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (15:2,0) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Comment block - Gen - 4 - (19:2,4) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (19:2,4) - Tokens:1 - HtmlTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (20:2,5) - Tokens:1 - HtmlTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Comment span - Gen - [] - SpanEditHandler;Accepts:Any - (21:2,6) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (21:2,6) - Tokens:1 - HtmlTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (22:2,7) - Tokens:1 - HtmlTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (23:2,8) - Tokens:1 - HtmlTokenType.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; Markup span - Gen - [}] - SpanEditHandler;Accepts:Any - (25:3,0) - Tokens:1 - HtmlTokenType.Text;[}]; + SyntaxKind.Text;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentWithExtraNewLineInMarkup.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentWithExtraNewLineInMarkup.stree.txt index f1c4b4d734..2a4dd88b3d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentWithExtraNewLineInMarkup.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentWithExtraNewLineInMarkup.stree.txt @@ -1,43 +1,43 @@ Markup block - Gen - 45 - (0:0,0) Tag block - Gen - 3 - (0:0,0) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [LFLF] - SpanEditHandler;Accepts:Any - (3:0,3) - Tokens:2 - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; Comment block - Gen - 13 - (7:2,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (7:2,0) - Tokens:1 - HtmlTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (8:2,1) - Tokens:1 - HtmlTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Comment span - Gen - [ content ] - SpanEditHandler;Accepts:Any - (9:2,2) - Tokens:1 - HtmlTokenType.RazorComment;[ content ]; + SyntaxKind.RazorCommentLiteral;[ content ]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (18:2,11) - Tokens:1 - HtmlTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (19:2,12) - Tokens:1 - HtmlTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (20:2,13) - Tokens:1 - HtmlTokenType.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; Comment block - Gen - 15 - (22:3,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (22:3,0) - Tokens:1 - HtmlTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (23:3,1) - Tokens:1 - HtmlTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Comment span - Gen - [LFcontentLF] - SpanEditHandler;Accepts:Any - (24:3,2) - Tokens:1 - HtmlTokenType.RazorComment;[LFcontentLF]; + SyntaxKind.RazorCommentLiteral;[LFcontentLF]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (35:5,0) - Tokens:1 - HtmlTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (36:5,1) - Tokens:1 - HtmlTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (37:5,2) - Tokens:1 - HtmlTokenType.NewLine;[LF]; - Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (39:6,0) - Tokens:1 - HtmlTokenType.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.HtmlTextLiteral - [LF] - [39..41) - FullWidth: 2 - Slots: 1 + SyntaxKind.NewLine;[LF]; Tag block - Gen - 4 - (41:7,0) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (41:7,0) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentsSurroundingMarkup.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentsSurroundingMarkup.stree.txt index b4d122ddd1..89ef6af770 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentsSurroundingMarkup.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/RazorCommentsSurroundingMarkup.stree.txt @@ -1,42 +1,42 @@ Markup block - Gen - 42 - (0:0,0) Tag block - Gen - 3 - (0:0,0) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (3:0,3) - Tokens:1 - HtmlTokenType.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; Comment block - Gen - 11 - (5:1,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (5:1,0) - Tokens:1 - HtmlTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (6:1,1) - Tokens:1 - HtmlTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Comment span - Gen - [ hello ] - SpanEditHandler;Accepts:Any - (7:1,2) - Tokens:1 - HtmlTokenType.RazorComment;[ hello ]; + SyntaxKind.RazorCommentLiteral;[ hello ]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (14:1,9) - Tokens:1 - HtmlTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (15:1,10) - Tokens:1 - HtmlTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; Markup span - Gen - [ content ] - SpanEditHandler;Accepts:Any - (16:1,11) - Tokens:3 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[content]; - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[content]; + SyntaxKind.Whitespace;[ ]; Comment block - Gen - 11 - (25:1,20) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (25:1,20) - Tokens:1 - HtmlTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (26:1,21) - Tokens:1 - HtmlTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Comment span - Gen - [ world ] - SpanEditHandler;Accepts:Any - (27:1,22) - Tokens:1 - HtmlTokenType.RazorComment;[ world ]; + SyntaxKind.RazorCommentLiteral;[ world ]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (34:1,29) - Tokens:1 - HtmlTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (35:1,30) - Tokens:1 - HtmlTokenType.RazorCommentTransition;[@]; - Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (36:1,31) - Tokens:1 - HtmlTokenType.NewLine;[LF]; + SyntaxKind.RazorCommentTransition;[@]; + SyntaxKind.HtmlTextLiteral - [LF] - [36..38) - FullWidth: 2 - Slots: 1 + SyntaxKind.NewLine;[LF]; Tag block - Gen - 4 - (38:2,0) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (38:2,0) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/UnterminatedRazorComment.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/UnterminatedRazorComment.stree.txt index a42813eed7..e205d34acc 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/UnterminatedRazorComment.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/UnterminatedRazorComment.stree.txt @@ -1,10 +1,10 @@ Markup block - Gen - 2 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Comment block - Gen - 2 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - HtmlTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - HtmlTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Comment span - Gen - [] - SpanEditHandler;Accepts:Any - (2:0,2) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/UnterminatedRazorCommentInImplicitExpressionMethodCall.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/UnterminatedRazorCommentInImplicitExpressionMethodCall.stree.txt index 9e50cab6a4..edad214460 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/UnterminatedRazorCommentInImplicitExpressionMethodCall.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/UnterminatedRazorCommentInImplicitExpressionMethodCall.stree.txt @@ -1,16 +1,16 @@ Markup block - Gen - 7 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Expression block - Gen - 7 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [foo(] - ImplicitExpressionEditHandler;Accepts:Any;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:2 - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.LeftParenthesis;[(]; Comment block - Gen - 2 - (5:0,5) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (5:0,5) - Tokens:1 - CSharpTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (6:0,6) - Tokens:1 - CSharpTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Comment span - Gen - [] - SpanEditHandler;Accepts:Any - (7:0,7) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/UnterminatedRazorCommentInVerbatimBlock.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/UnterminatedRazorCommentInVerbatimBlock.stree.txt index cd383fd925..943ac7f11a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/UnterminatedRazorCommentInVerbatimBlock.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpRazorCommentsTest/UnterminatedRazorCommentInVerbatimBlock.stree.txt @@ -1,17 +1,17 @@ Markup block - Gen - 4 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Statement block - Gen - 4 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Code span - Gen - [] - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[}];AtEOL - (2:0,2) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Comment block - Gen - 2 - (2:0,2) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (2:0,2) - Tokens:1 - CSharpTokenType.RazorCommentTransition;[@]; + SyntaxKind.RazorCommentTransition;[@]; MetaCode span - Gen - [*] - SpanEditHandler;Accepts:None - (3:0,3) - Tokens:1 - CSharpTokenType.RazorCommentStar;[*]; + SyntaxKind.RazorCommentStar;[*]; Comment span - Gen - [] - SpanEditHandler;Accepts:Any - (4:0,4) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpReservedWordsTest/ReservedWord.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpReservedWordsTest/ReservedWord.stree.txt index 65ed4440a2..33f4203300 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpReservedWordsTest/ReservedWord.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpReservedWordsTest/ReservedWord.stree.txt @@ -1,3 +1,3 @@ Directive block - Gen - 9 - (0:0,0) MetaCode span - Gen - [namespace] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Keyword;[namespace]; + SyntaxKind.Keyword;[namespace]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpReservedWordsTest/ReservedWordIsCaseSensitive.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpReservedWordsTest/ReservedWordIsCaseSensitive.cspans.txt index 546baea6fe..12bdcf7cd1 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpReservedWordsTest/ReservedWordIsCaseSensitive.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpReservedWordsTest/ReservedWordIsCaseSensitive.cspans.txt @@ -1 +1 @@ -Code span at (0:0,0 [9] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [9] ) +Code span at (0:0,0 [9] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [9] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpReservedWordsTest/ReservedWordIsCaseSensitive.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpReservedWordsTest/ReservedWordIsCaseSensitive.stree.txt index 3c97840031..d13f855c01 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpReservedWordsTest/ReservedWordIsCaseSensitive.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpReservedWordsTest/ReservedWordIsCaseSensitive.stree.txt @@ -1,3 +1,3 @@ Expression block - Gen - 9 - (0:0,0) - Code span - Gen - [NameSpace] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (0:0,0) - Tokens:1 - CSharpTokenType.Identifier;[NameSpace]; + Code span - Gen - [NameSpace] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (0:0,0) - Tokens:1 + SyntaxKind.Identifier;[NameSpace]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/AcceptsOpenBraceMultipleLinesBelowSectionName.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/AcceptsOpenBraceMultipleLinesBelowSectionName.cspans.txt index 56ba50f6db..5ab9ddbb98 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/AcceptsOpenBraceMultipleLinesBelowSectionName.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/AcceptsOpenBraceMultipleLinesBelowSectionName.cspans.txt @@ -1,9 +1,9 @@ Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [46] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [46] ) MetaCode span at (1:0,1 [7] ) (Accepts:None) - Parent: Directive block at (0:0,0 [46] ) -Code span at (8:0,8 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [46] ) -Code span at (9:0,9 [3] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [46] ) -Markup span at (12:0,12 [18] ) (Accepts:AllWhiteSpace) - Parent: Directive block at (0:0,0 [46] ) +Code span at (8:0,8 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [46] ) +Code span at (9:0,9 [3] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [46] ) +Markup span at (12:0,12 [18] ) (Accepts:AllWhitespace) - Parent: Directive block at (0:0,0 [46] ) MetaCode span at (30:6,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [46] ) Markup span at (31:6,1 [2] ) (Accepts:Any) - Parent: Markup block at (31:6,1 [14] ) Markup span at (33:7,0 [3] ) (Accepts:Any) - Parent: Tag block at (33:7,0 [3] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/AcceptsOpenBraceMultipleLinesBelowSectionName.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/AcceptsOpenBraceMultipleLinesBelowSectionName.stree.txt index c601f9eed9..2dfc967323 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/AcceptsOpenBraceMultipleLinesBelowSectionName.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/AcceptsOpenBraceMultipleLinesBelowSectionName.stree.txt @@ -1,44 +1,44 @@ Markup block - Gen - 46 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 46 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[foo]; - Markup span - Gen - [ LFLFLFLFLFLF] - SpanEditHandler;Accepts:AllWhiteSpace - (12:0,12) - Tokens:7 - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.NewLine;[LF]; + SyntaxKind.Identifier;[section]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 + SyntaxKind.Identifier;[foo]; + Markup span - Gen - [ LFLFLFLFLFLF] - SpanEditHandler;Accepts:AllWhitespace - (12:0,12) - Tokens:7 + SyntaxKind.Whitespace;[ ]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (30:6,0) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 14 - (31:6,1) Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (31:6,1) - Tokens:1 - HtmlTokenType.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; Tag block - Gen - 3 - (33:7,0) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (33:7,0) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [Foo] - SpanEditHandler;Accepts:Any - (36:7,3) - Tokens:1 - HtmlTokenType.Text;[Foo]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; + SyntaxKind.HtmlTextLiteral - [Foo] - [36..39) - FullWidth: 3 - Slots: 1 + SyntaxKind.Text;[Foo]; Tag block - Gen - 4 - (39:7,6) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (39:7,6) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (43:7,10) - Tokens:1 - HtmlTokenType.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (45:8,0) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (46:8,1) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/AllowsBracesInCSharpExpression.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/AllowsBracesInCSharpExpression.cspans.txt index 20913b3efd..1e03949cfe 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/AllowsBracesInCSharpExpression.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/AllowsBracesInCSharpExpression.cspans.txt @@ -1,9 +1,9 @@ Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [76] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [76] ) MetaCode span at (1:0,1 [7] ) (Accepts:None) - Parent: Directive block at (0:0,0 [76] ) -Code span at (8:0,8 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [76] ) -Code span at (9:0,9 [3] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [76] ) -Markup span at (12:0,12 [1] ) (Accepts:AllWhiteSpace) - Parent: Directive block at (0:0,0 [76] ) +Code span at (8:0,8 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [76] ) +Code span at (9:0,9 [3] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [76] ) +Markup span at (12:0,12 [1] ) (Accepts:AllWhitespace) - Parent: Directive block at (0:0,0 [76] ) MetaCode span at (13:0,13 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [76] ) Markup span at (14:0,14 [54] ) (Accepts:Any) - Parent: Markup block at (14:0,14 [61] ) Transition span at (68:0,68 [1] ) (Accepts:None) - Parent: Expression block at (68:0,68 [6] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/AllowsBracesInCSharpExpression.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/AllowsBracesInCSharpExpression.stree.txt index f0c43e199a..be93416c6f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/AllowsBracesInCSharpExpression.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/AllowsBracesInCSharpExpression.stree.txt @@ -1,58 +1,58 @@ Markup block - Gen - 76 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 76 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[foo]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (12:0,12) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Identifier;[section]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 + SyntaxKind.Identifier;[foo]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (12:0,12) - Tokens:1 + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (13:0,13) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 61 - (14:0,14) Markup span - Gen - [ I really want to render a close brace, so here I go: ] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:25 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[I]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[really]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[want]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[to]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[render]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[a]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[close]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[brace,]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[so]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[here]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[I]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[go:]; - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[I]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[really]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[want]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[to]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[render]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[a]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[close]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[brace,]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[so]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[here]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[I]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[go:]; + SyntaxKind.Whitespace;[ ]; Expression block - Gen - 6 - (68:0,68) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (68:0,68) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (69:0,69) - Tokens:1 - CSharpTokenType.LeftParenthesis;[(]; + SyntaxKind.LeftParenthesis;[(]; Code span - Gen - ["}"] - SpanEditHandler;Accepts:Any - (70:0,70) - Tokens:1 - CSharpTokenType.StringLiteral;["}"]; + SyntaxKind.StringLiteral;["}"]; MetaCode span - Gen - [)] - SpanEditHandler;Accepts:None - (73:0,73) - Tokens:1 - CSharpTokenType.RightParenthesis;[)]; + SyntaxKind.RightParenthesis;[)]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (74:0,74) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (75:0,75) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (76:0,76) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/BalancesBraces.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/BalancesBraces.cspans.txt index 227fa11335..fd7de8d057 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/BalancesBraces.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/BalancesBraces.cspans.txt @@ -1,9 +1,9 @@ Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [67] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [67] ) MetaCode span at (1:0,1 [7] ) (Accepts:None) - Parent: Directive block at (0:0,0 [67] ) -Code span at (8:0,8 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [67] ) -Code span at (9:0,9 [3] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [67] ) -Markup span at (12:0,12 [1] ) (Accepts:AllWhiteSpace) - Parent: Directive block at (0:0,0 [67] ) +Code span at (8:0,8 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [67] ) +Code span at (9:0,9 [3] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [67] ) +Markup span at (12:0,12 [1] ) (Accepts:AllWhitespace) - Parent: Directive block at (0:0,0 [67] ) MetaCode span at (13:0,13 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [67] ) Markup span at (14:0,14 [1] ) (Accepts:Any) - Parent: Markup block at (14:0,14 [52] ) Markup span at (15:0,15 [8] ) (Accepts:Any) - Parent: Tag block at (15:0,15 [8] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/BalancesBraces.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/BalancesBraces.stree.txt index 60d6671298..f8333a79a7 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/BalancesBraces.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/BalancesBraces.stree.txt @@ -1,48 +1,48 @@ Markup block - Gen - 67 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 67 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[foo]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (12:0,12) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Identifier;[section]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 + SyntaxKind.Identifier;[foo]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (12:0,12) - Tokens:1 + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (13:0,13) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 52 - (14:0,14) Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 8 - (15:0,15) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (56:0,56) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[script]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[script]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (65:0,65) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (66:0,66) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (67:0,67) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesNewlineImmediatelyFollowing.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesNewlineImmediatelyFollowing.cspans.txt index 438f3272c6..c10c843521 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesNewlineImmediatelyFollowing.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesNewlineImmediatelyFollowing.cspans.txt @@ -1,5 +1,5 @@ Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [10] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [8] ) MetaCode span at (1:0,1 [7] ) (Accepts:None) - Parent: Directive block at (0:0,0 [8] ) -Code span at (8:0,8 [0] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [8] ) +Code span at (8:0,8 [0] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [8] ) Markup span at (8:0,8 [2] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [10] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesNewlineImmediatelyFollowing.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesNewlineImmediatelyFollowing.stree.txt index 689b12e4aa..98001e7661 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesNewlineImmediatelyFollowing.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesNewlineImmediatelyFollowing.stree.txt @@ -1,12 +1,12 @@ Markup block - Gen - 10 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 8 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[section]; - Code span - Gen - [] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Identifier;[section]; + Code span - Gen - [] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (8:0,8) - Tokens:1 + SyntaxKind.Unknown;[]; Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (8:0,8) - Tokens:1 - HtmlTokenType.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesWhitespaceToEndOfLineInSectionStatementMissingName.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesWhitespaceToEndOfLineInSectionStatementMissingName.cspans.txt index 28235f8416..74bcdf61d7 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesWhitespaceToEndOfLineInSectionStatementMissingName.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesWhitespaceToEndOfLineInSectionStatementMissingName.cspans.txt @@ -1,6 +1,6 @@ Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [23] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [17] ) MetaCode span at (1:0,1 [7] ) (Accepts:None) - Parent: Directive block at (0:0,0 [17] ) -Code span at (8:0,8 [9] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [17] ) -Code span at (17:0,17 [0] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [17] ) +Code span at (8:0,8 [9] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [17] ) +Code span at (17:0,17 [0] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [17] ) Markup span at (17:0,17 [6] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [23] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesWhitespaceToEndOfLineInSectionStatementMissingName.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesWhitespaceToEndOfLineInSectionStatementMissingName.stree.txt index 0fde9614d9..501cdd5ac2 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesWhitespaceToEndOfLineInSectionStatementMissingName.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesWhitespaceToEndOfLineInSectionStatementMissingName.stree.txt @@ -1,15 +1,15 @@ Markup block - Gen - 23 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 17 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (17:0,17) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Identifier;[section]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (17:0,17) - Tokens:1 + SyntaxKind.Unknown;[]; Markup span - Gen - [LF ] - SpanEditHandler;Accepts:Any - (17:0,17) - Tokens:2 - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesWhitespaceToEndOfLineInSectionStatementMissingOpenBrace.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesWhitespaceToEndOfLineInSectionStatementMissingOpenBrace.cspans.txt index bff6dfd779..aec2814d1d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesWhitespaceToEndOfLineInSectionStatementMissingOpenBrace.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesWhitespaceToEndOfLineInSectionStatementMissingOpenBrace.cspans.txt @@ -1,7 +1,7 @@ Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [27] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [27] ) MetaCode span at (1:0,1 [7] ) (Accepts:None) - Parent: Directive block at (0:0,0 [27] ) -Code span at (8:0,8 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [27] ) -Code span at (9:0,9 [3] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [27] ) -Markup span at (12:0,12 [15] ) (Accepts:AllWhiteSpace) - Parent: Directive block at (0:0,0 [27] ) +Code span at (8:0,8 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [27] ) +Code span at (9:0,9 [3] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [27] ) +Markup span at (12:0,12 [15] ) (Accepts:AllWhitespace) - Parent: Directive block at (0:0,0 [27] ) Markup span at (27:1,4 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [27] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesWhitespaceToEndOfLineInSectionStatementMissingOpenBrace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesWhitespaceToEndOfLineInSectionStatementMissingOpenBrace.stree.txt index 3a2c1106da..46ed3a8aa6 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesWhitespaceToEndOfLineInSectionStatementMissingOpenBrace.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CapturesWhitespaceToEndOfLineInSectionStatementMissingOpenBrace.stree.txt @@ -1,18 +1,18 @@ Markup block - Gen - 27 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 27 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [Foo] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[Foo]; - Markup span - Gen - [ LF ] - SpanEditHandler;Accepts:AllWhiteSpace - (12:0,12) - Tokens:3 - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Identifier;[section]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [Foo] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 + SyntaxKind.Identifier;[Foo]; + Markup span - Gen - [ LF ] - SpanEditHandler;Accepts:AllWhitespace - (12:0,12) - Tokens:3 + SyntaxKind.Whitespace;[ ]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (27:1,4) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CommentRecoversFromUnclosedTag.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CommentRecoversFromUnclosedTag.cspans.txt index 975ab15e40..0649d567b7 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CommentRecoversFromUnclosedTag.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CommentRecoversFromUnclosedTag.cspans.txt @@ -1,14 +1,14 @@ Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [33] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [33] ) MetaCode span at (1:0,1 [7] ) (Accepts:None) - Parent: Directive block at (0:0,0 [33] ) -Code span at (8:0,8 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [33] ) -Code span at (9:0,9 [1] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [33] ) -Markup span at (10:0,10 [1] ) (Accepts:AllWhiteSpace) - Parent: Directive block at (0:0,0 [33] ) +Code span at (8:0,8 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [33] ) +Code span at (9:0,9 [1] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [33] ) +Markup span at (10:0,10 [1] ) (Accepts:AllWhitespace) - Parent: Directive block at (0:0,0 [33] ) MetaCode span at (11:0,11 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [33] ) Markup span at (12:0,12 [2] ) (Accepts:Any) - Parent: Markup block at (12:0,12 [20] ) Markup span at (14:1,0 [4] ) (Accepts:Any) - Parent: Tag block at (14:1,0 [4] ) Markup span at (18:2,0 [4] ) (Accepts:None) - Parent: HtmlComment block at (18:2,0 [14] ) -Markup span at (22:2,4 [7] ) (Accepts:WhiteSpace) - Parent: HtmlComment block at (18:2,0 [14] ) +Markup span at (22:2,4 [7] ) (Accepts:Whitespace) - Parent: HtmlComment block at (18:2,0 [14] ) Markup span at (29:2,11 [3] ) (Accepts:None) - Parent: HtmlComment block at (18:2,0 [14] ) Markup span at (32:2,14 [0] ) (Accepts:Any) - Parent: Markup block at (12:0,12 [20] ) MetaCode span at (32:2,14 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [33] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CommentRecoversFromUnclosedTag.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CommentRecoversFromUnclosedTag.stree.txt index e764c527f3..b128a9324c 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CommentRecoversFromUnclosedTag.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CommentRecoversFromUnclosedTag.stree.txt @@ -1,45 +1,45 @@ Markup block - Gen - 33 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 33 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [s] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[s]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (10:0,10) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Identifier;[section]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [s] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 + SyntaxKind.Identifier;[s]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (10:0,10) - Tokens:1 + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (11:0,11) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 20 - (12:0,12) Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (12:0,12) - Tokens:1 - HtmlTokenType.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; Tag block - Gen - 4 - (14:1,0) Markup span - Gen - [ - 14 - (18:2,0) Markup span - Gen - [] - SpanEditHandler;Accepts:None - (29:2,11) - Tokens:2 - HtmlTokenType.DoubleHyphen;[--]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.DoubleHyphen;[--]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (32:2,14) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (32:2,14) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (33:2,15) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CorrectlyTerminatesWhenCloseBraceImmediatelyFollowsMarkup.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CorrectlyTerminatesWhenCloseBraceImmediatelyFollowsMarkup.cspans.txt index 8df309466c..dddd0ceecc 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CorrectlyTerminatesWhenCloseBraceImmediatelyFollowsMarkup.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CorrectlyTerminatesWhenCloseBraceImmediatelyFollowsMarkup.cspans.txt @@ -1,9 +1,9 @@ Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [24] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [24] ) MetaCode span at (1:0,1 [7] ) (Accepts:None) - Parent: Directive block at (0:0,0 [24] ) -Code span at (8:0,8 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [24] ) -Code span at (9:0,9 [3] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [24] ) -Markup span at (12:0,12 [1] ) (Accepts:AllWhiteSpace) - Parent: Directive block at (0:0,0 [24] ) +Code span at (8:0,8 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [24] ) +Code span at (9:0,9 [3] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [24] ) +Markup span at (12:0,12 [1] ) (Accepts:AllWhitespace) - Parent: Directive block at (0:0,0 [24] ) MetaCode span at (13:0,13 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [24] ) Markup span at (14:0,14 [9] ) (Accepts:Any) - Parent: Markup block at (14:0,14 [9] ) MetaCode span at (23:0,23 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [24] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CorrectlyTerminatesWhenCloseBraceImmediatelyFollowsMarkup.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CorrectlyTerminatesWhenCloseBraceImmediatelyFollowsMarkup.stree.txt index 6bc6ea89b2..887190ddb5 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CorrectlyTerminatesWhenCloseBraceImmediatelyFollowsMarkup.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/CorrectlyTerminatesWhenCloseBraceImmediatelyFollowsMarkup.stree.txt @@ -1,23 +1,23 @@ Markup block - Gen - 24 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 24 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[foo]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (12:0,12) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Identifier;[section]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 + SyntaxKind.Identifier;[foo]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (12:0,12) - Tokens:1 + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (13:0,13) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 9 - (14:0,14) Markup span - Gen - [something] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - HtmlTokenType.Text;[something]; + SyntaxKind.Text;[something]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (23:0,23) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (24:0,24) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/DoesNotRequireSpaceBetweenSectionNameAndOpenBrace.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/DoesNotRequireSpaceBetweenSectionNameAndOpenBrace.cspans.txt index bd03ebf705..ecf1378f32 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/DoesNotRequireSpaceBetweenSectionNameAndOpenBrace.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/DoesNotRequireSpaceBetweenSectionNameAndOpenBrace.cspans.txt @@ -1,8 +1,8 @@ Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [26] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [26] ) MetaCode span at (1:0,1 [7] ) (Accepts:None) - Parent: Directive block at (0:0,0 [26] ) -Code span at (8:0,8 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [26] ) -Code span at (9:0,9 [3] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [26] ) +Code span at (8:0,8 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [26] ) +Code span at (9:0,9 [3] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [26] ) MetaCode span at (12:0,12 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [26] ) Markup span at (13:0,13 [1] ) (Accepts:Any) - Parent: Markup block at (13:0,13 [12] ) Markup span at (14:0,14 [3] ) (Accepts:Any) - Parent: Tag block at (14:0,14 [3] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/DoesNotRequireSpaceBetweenSectionNameAndOpenBrace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/DoesNotRequireSpaceBetweenSectionNameAndOpenBrace.stree.txt index 55381a524f..86004e805a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/DoesNotRequireSpaceBetweenSectionNameAndOpenBrace.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/DoesNotRequireSpaceBetweenSectionNameAndOpenBrace.stree.txt @@ -1,36 +1,36 @@ Markup block - Gen - 26 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 26 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[foo]; + SyntaxKind.Identifier;[section]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 + SyntaxKind.Identifier;[foo]; MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (12:0,12) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 12 - (13:0,13) Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (13:0,13) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 3 - (14:0,14) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [Foo] - SpanEditHandler;Accepts:Any - (17:0,17) - Tokens:1 - HtmlTokenType.Text;[Foo]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; + SyntaxKind.HtmlTextLiteral - [Foo] - [17..20) - FullWidth: 3 - Slots: 1 + SyntaxKind.Text;[Foo]; Tag block - Gen - 4 - (20:0,20) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (20:0,20) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (24:0,24) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (25:0,25) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (26:0,26) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenBrace.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenBrace.cspans.txt index 2ae2e13090..786a39e696 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenBrace.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenBrace.cspans.txt @@ -1,8 +1,8 @@ Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [14] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [14] ) MetaCode span at (1:0,1 [7] ) (Accepts:None) - Parent: Directive block at (0:0,0 [14] ) -Code span at (8:0,8 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [14] ) -Code span at (9:0,9 [3] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [14] ) -Markup span at (12:0,12 [1] ) (Accepts:AllWhiteSpace) - Parent: Directive block at (0:0,0 [14] ) +Code span at (8:0,8 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [14] ) +Code span at (9:0,9 [3] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [14] ) +Markup span at (12:0,12 [1] ) (Accepts:AllWhitespace) - Parent: Directive block at (0:0,0 [14] ) MetaCode span at (13:0,13 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [14] ) Markup span at (14:0,14 [0] ) (Accepts:Any) - Parent: Markup block at (14:0,14 [0] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenBrace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenBrace.stree.txt index 19018c5dbe..210e0a990b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenBrace.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenBrace.stree.txt @@ -1,19 +1,19 @@ Markup block - Gen - 14 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 14 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[foo]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (12:0,12) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Identifier;[section]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 + SyntaxKind.Identifier;[foo]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (12:0,12) - Tokens:1 + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd - (13:0,13) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 0 - (14:0,14) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent1.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent1.cspans.txt index 92cb61d49b..922bb729ba 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent1.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent1.cspans.txt @@ -1,8 +1,8 @@ Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [15] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [15] ) MetaCode span at (1:0,1 [7] ) (Accepts:None) - Parent: Directive block at (0:0,0 [15] ) -Code span at (8:0,8 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [15] ) -Code span at (9:0,9 [3] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [15] ) -Markup span at (12:0,12 [1] ) (Accepts:AllWhiteSpace) - Parent: Directive block at (0:0,0 [15] ) +Code span at (8:0,8 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [15] ) +Code span at (9:0,9 [3] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [15] ) +Markup span at (12:0,12 [1] ) (Accepts:AllWhitespace) - Parent: Directive block at (0:0,0 [15] ) MetaCode span at (13:0,13 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [15] ) Markup span at (14:0,14 [1] ) (Accepts:Any) - Parent: Markup block at (14:0,14 [1] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent1.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent1.stree.txt index 134177d6a6..94ffd5450d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent1.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent1.stree.txt @@ -1,19 +1,19 @@ Markup block - Gen - 15 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 15 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[foo]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (12:0,12) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Identifier;[section]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 + SyntaxKind.Identifier;[foo]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (12:0,12) - Tokens:1 + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd - (13:0,13) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 1 - (14:0,14) Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent2.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent2.cspans.txt index b485a40f1e..38c344ffc3 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent2.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent2.cspans.txt @@ -1,8 +1,8 @@ Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [16] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [16] ) MetaCode span at (1:0,1 [7] ) (Accepts:None) - Parent: Directive block at (0:0,0 [16] ) -Code span at (8:0,8 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [16] ) -Code span at (9:0,9 [3] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [16] ) -Markup span at (12:0,12 [1] ) (Accepts:AllWhiteSpace) - Parent: Directive block at (0:0,0 [16] ) +Code span at (8:0,8 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [16] ) +Code span at (9:0,9 [3] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [16] ) +Markup span at (12:0,12 [1] ) (Accepts:AllWhitespace) - Parent: Directive block at (0:0,0 [16] ) MetaCode span at (13:0,13 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [16] ) Markup span at (14:0,14 [2] ) (Accepts:Any) - Parent: Markup block at (14:0,14 [2] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent2.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent2.stree.txt index 0a934073ea..ba6aae139b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent2.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent2.stree.txt @@ -1,19 +1,19 @@ Markup block - Gen - 16 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 16 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[foo]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (12:0,12) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Identifier;[section]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 + SyntaxKind.Identifier;[foo]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (12:0,12) - Tokens:1 + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd - (13:0,13) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 2 - (14:0,14) Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - HtmlTokenType.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent3.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent3.cspans.txt index 81962d91a4..677fcd6e40 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent3.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent3.cspans.txt @@ -1,8 +1,8 @@ Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [17] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [17] ) MetaCode span at (1:0,1 [7] ) (Accepts:None) - Parent: Directive block at (0:0,0 [17] ) -Code span at (8:0,8 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [17] ) -Code span at (9:0,9 [3] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [17] ) -Markup span at (12:0,12 [1] ) (Accepts:AllWhiteSpace) - Parent: Directive block at (0:0,0 [17] ) +Code span at (8:0,8 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [17] ) +Code span at (9:0,9 [3] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [17] ) +Markup span at (12:0,12 [1] ) (Accepts:AllWhitespace) - Parent: Directive block at (0:0,0 [17] ) MetaCode span at (13:0,13 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [17] ) Markup span at (14:0,14 [3] ) (Accepts:Any) - Parent: Markup block at (14:0,14 [3] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent3.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent3.stree.txt index d828a581f0..2bbc778d10 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent3.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent3.stree.txt @@ -1,19 +1,19 @@ Markup block - Gen - 17 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 17 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[foo]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (12:0,12) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Identifier;[section]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 + SyntaxKind.Identifier;[foo]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (12:0,12) - Tokens:1 + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd - (13:0,13) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 3 - (14:0,14) Markup span - Gen - [abc] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - HtmlTokenType.Text;[abc]; + SyntaxKind.Text;[abc]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent4.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent4.cspans.txt index f180faa3a8..19ee80ede4 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent4.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent4.cspans.txt @@ -1,8 +1,8 @@ Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [20] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [20] ) MetaCode span at (1:0,1 [7] ) (Accepts:None) - Parent: Directive block at (0:0,0 [20] ) -Code span at (8:0,8 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [20] ) -Code span at (9:0,9 [3] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [20] ) -Markup span at (12:0,12 [1] ) (Accepts:AllWhiteSpace) - Parent: Directive block at (0:0,0 [20] ) +Code span at (8:0,8 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [20] ) +Code span at (9:0,9 [3] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [20] ) +Markup span at (12:0,12 [1] ) (Accepts:AllWhitespace) - Parent: Directive block at (0:0,0 [20] ) MetaCode span at (13:0,13 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [20] ) Markup span at (14:0,14 [6] ) (Accepts:Any) - Parent: Markup block at (14:0,14 [6] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent4.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent4.stree.txt index dfd8d9e423..ec24dcca8d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent4.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesEOFAfterOpenContent4.stree.txt @@ -1,21 +1,21 @@ Markup block - Gen - 20 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 20 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[foo]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (12:0,12) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Identifier;[section]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 + SyntaxKind.Identifier;[foo]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (12:0,12) - Tokens:1 + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd - (13:0,13) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 6 - (14:0,14) Markup span - Gen - [LF abc] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:3 - HtmlTokenType.NewLine;[LF]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[abc]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[abc]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesUnterminatedSection.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesUnterminatedSection.cspans.txt index 83b4408923..6d2cdedc5b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesUnterminatedSection.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesUnterminatedSection.cspans.txt @@ -1,9 +1,9 @@ Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [27] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [27] ) MetaCode span at (1:0,1 [7] ) (Accepts:None) - Parent: Directive block at (0:0,0 [27] ) -Code span at (8:0,8 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [27] ) -Code span at (9:0,9 [3] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [27] ) -Markup span at (12:0,12 [1] ) (Accepts:AllWhiteSpace) - Parent: Directive block at (0:0,0 [27] ) +Code span at (8:0,8 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [27] ) +Code span at (9:0,9 [3] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [27] ) +Markup span at (12:0,12 [1] ) (Accepts:AllWhitespace) - Parent: Directive block at (0:0,0 [27] ) MetaCode span at (13:0,13 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [27] ) Markup span at (14:0,14 [1] ) (Accepts:Any) - Parent: Markup block at (14:0,14 [13] ) Markup span at (15:0,15 [3] ) (Accepts:Any) - Parent: Tag block at (15:0,15 [3] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesUnterminatedSection.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesUnterminatedSection.stree.txt index bc5eedd22b..967219c4b4 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesUnterminatedSection.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesUnterminatedSection.stree.txt @@ -1,34 +1,35 @@ Markup block - Gen - 27 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 27 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[foo]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (12:0,12) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Identifier;[section]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 + SyntaxKind.Identifier;[foo]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (12:0,12) - Tokens:1 + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd - (13:0,13) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 13 - (14:0,14) Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 3 - (15:0,15) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (15:0,15) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [Foo{}] - SpanEditHandler;Accepts:Any - (18:0,18) - Tokens:3 - HtmlTokenType.Text;[Foo]; - HtmlTokenType.Text;[{]; - HtmlTokenType.Text;[}]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; + SyntaxKind.HtmlTextLiteral - [Foo{}] - [18..23) - FullWidth: 5 - Slots: 1 + SyntaxKind.List - [Foo{}] - [18..23) - FullWidth: 5 - Slots: 3 + SyntaxKind.Text;[Foo]; + SyntaxKind.Text;[{]; + SyntaxKind.Text;[}]; Tag block - Gen - 4 - (23:0,23) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (23:0,23) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesUnterminatedSectionWithNestedIf.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesUnterminatedSectionWithNestedIf.cspans.txt index ee6a1dfb85..4131a0dbcc 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesUnterminatedSectionWithNestedIf.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesUnterminatedSectionWithNestedIf.cspans.txt @@ -1,9 +1,9 @@ Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [73] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [73] ) MetaCode span at (1:0,1 [7] ) (Accepts:None) - Parent: Directive block at (0:0,0 [73] ) -Code span at (8:0,8 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [73] ) -Code span at (9:0,9 [4] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [73] ) -Markup span at (13:0,13 [2] ) (Accepts:AllWhiteSpace) - Parent: Directive block at (0:0,0 [73] ) +Code span at (8:0,8 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [73] ) +Code span at (9:0,9 [4] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [73] ) +Markup span at (13:0,13 [2] ) (Accepts:AllWhitespace) - Parent: Directive block at (0:0,0 [73] ) MetaCode span at (15:1,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [73] ) Markup span at (16:1,1 [2] ) (Accepts:Any) - Parent: Markup block at (16:1,1 [57] ) Code span at (18:2,0 [4] ) (Accepts:Any) - Parent: Statement block at (18:2,0 [55] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesUnterminatedSectionWithNestedIf.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesUnterminatedSectionWithNestedIf.stree.txt index 4090ca154c..307a32cb63 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesUnterminatedSectionWithNestedIf.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/HandlesUnterminatedSectionWithNestedIf.stree.txt @@ -1,56 +1,56 @@ Markup block - Gen - 73 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 73 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [Test] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[Test]; - Markup span - Gen - [LF] - SpanEditHandler;Accepts:AllWhiteSpace - (13:0,13) - Tokens:1 - CSharpTokenType.NewLine;[LF]; + SyntaxKind.Identifier;[section]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [Test] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 + SyntaxKind.Identifier;[Test]; + Markup span - Gen - [LF] - SpanEditHandler;Accepts:AllWhitespace - (13:0,13) - Tokens:1 + SyntaxKind.NewLine;[LF]; MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[}];AtEnd - (15:1,0) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 57 - (16:1,1) Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (16:1,1) - Tokens:1 - HtmlTokenType.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; Statement block - Gen - 55 - (18:2,0) Code span - Gen - [ ] - SpanEditHandler;Accepts:Any - (18:2,0) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (22:2,4) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [if(true)LF {LF] - SpanEditHandler;Accepts:Any - (23:2,5) - Tokens:8 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[true]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.NewLine;[LF]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[true]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.NewLine;[LF]; Markup block - Gen - 28 - (40:4,0) Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (40:4,0) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 3 - (48:4,8) Markup span - Gen - [

] - SpanEditHandler;Accepts:None - (48:4,8) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [Hello World] - SpanEditHandler;Accepts:Any - (51:4,11) - Tokens:3 - HtmlTokenType.Text;[Hello]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[World]; + SyntaxKind.Text;[Hello]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[World]; Tag block - Gen - 4 - (62:4,22) Markup span - Gen - [

] - SpanEditHandler;Accepts:None - (62:4,22) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [LF] - SpanEditHandler;Accepts:None - (66:4,26) - Tokens:1 - HtmlTokenType.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; Code span - Gen - [ }] - SpanEditHandler;Accepts:Any - (68:5,0) - Tokens:2 - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/IgnoresSectionUnlessAllLowerCase.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/IgnoresSectionUnlessAllLowerCase.cspans.txt index cd444657cd..500fddb951 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/IgnoresSectionUnlessAllLowerCase.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/IgnoresSectionUnlessAllLowerCase.cspans.txt @@ -1,4 +1,4 @@ Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [12] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [8] ) -Code span at (1:0,1 [7] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [8] ) +Code span at (1:0,1 [7] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [8] ) Markup span at (8:0,8 [4] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [12] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/IgnoresSectionUnlessAllLowerCase.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/IgnoresSectionUnlessAllLowerCase.stree.txt index 59d3f3e25a..88d5930930 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/IgnoresSectionUnlessAllLowerCase.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/IgnoresSectionUnlessAllLowerCase.stree.txt @@ -1,11 +1,11 @@ Markup block - Gen - 12 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Expression block - Gen - 8 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [Section] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K15 - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[Section]; + SyntaxKind.Transition;[@]; + Code span - Gen - [Section] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K15 - (1:0,1) - Tokens:1 + SyntaxKind.Identifier;[Section]; Markup span - Gen - [ foo] - SpanEditHandler;Accepts:Any - (8:0,8) - Tokens:2 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[foo]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParserOutputsErrorOnNestedSections.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParserOutputsErrorOnNestedSections.cspans.txt index 3e998dd114..c36b52c0d7 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParserOutputsErrorOnNestedSections.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParserOutputsErrorOnNestedSections.cspans.txt @@ -1,16 +1,16 @@ Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [44] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [44] ) MetaCode span at (1:0,1 [7] ) (Accepts:None) - Parent: Directive block at (0:0,0 [44] ) -Code span at (8:0,8 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [44] ) -Code span at (9:0,9 [3] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [44] ) -Markup span at (12:0,12 [1] ) (Accepts:AllWhiteSpace) - Parent: Directive block at (0:0,0 [44] ) +Code span at (8:0,8 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [44] ) +Code span at (9:0,9 [3] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [44] ) +Markup span at (12:0,12 [1] ) (Accepts:AllWhitespace) - Parent: Directive block at (0:0,0 [44] ) MetaCode span at (13:0,13 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [44] ) Markup span at (14:0,14 [1] ) (Accepts:Any) - Parent: Markup block at (14:0,14 [29] ) Transition span at (15:0,15 [1] ) (Accepts:None) - Parent: Directive block at (15:0,15 [27] ) MetaCode span at (16:0,16 [7] ) (Accepts:None) - Parent: Directive block at (15:0,15 [27] ) -Code span at (23:0,23 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (15:0,15 [27] ) -Code span at (24:0,24 [3] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (15:0,15 [27] ) -Markup span at (27:0,27 [1] ) (Accepts:AllWhiteSpace) - Parent: Directive block at (15:0,15 [27] ) +Code span at (23:0,23 [1] ) (Accepts:Whitespace) - Parent: Directive block at (15:0,15 [27] ) +Code span at (24:0,24 [3] ) (Accepts:NonWhitespace) - Parent: Directive block at (15:0,15 [27] ) +Markup span at (27:0,27 [1] ) (Accepts:AllWhitespace) - Parent: Directive block at (15:0,15 [27] ) MetaCode span at (28:0,28 [1] ) (Accepts:None) - Parent: Directive block at (15:0,15 [27] ) Markup span at (29:0,29 [1] ) (Accepts:Any) - Parent: Markup block at (29:0,29 [12] ) Markup span at (30:0,30 [3] ) (Accepts:Any) - Parent: Tag block at (30:0,30 [3] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParserOutputsErrorOnNestedSections.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParserOutputsErrorOnNestedSections.stree.txt index b8abb7fa56..f5a31332c6 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParserOutputsErrorOnNestedSections.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParserOutputsErrorOnNestedSections.stree.txt @@ -1,58 +1,58 @@ Markup block - Gen - 44 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 44 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[foo]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (12:0,12) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Identifier;[section]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 + SyntaxKind.Identifier;[foo]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (12:0,12) - Tokens:1 + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (13:0,13) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 29 - (14:0,14) Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Directive block - Gen - 27 - (15:0,15) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (15:0,15) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (16:0,16) - Tokens:1 - CSharpTokenType.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (23:0,23) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [bar] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (24:0,24) - Tokens:1 - CSharpTokenType.Identifier;[bar]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (27:0,27) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Identifier;[section]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (23:0,23) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [bar] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (24:0,24) - Tokens:1 + SyntaxKind.Identifier;[bar]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (27:0,27) - Tokens:1 + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (28:0,28) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 12 - (29:0,29) Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (29:0,29) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 3 - (30:0,30) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (30:0,30) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [Foo] - SpanEditHandler;Accepts:Any - (33:0,33) - Tokens:1 - HtmlTokenType.Text;[Foo]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; + SyntaxKind.HtmlTextLiteral - [Foo] - [33..36) - FullWidth: 3 - Slots: 1 + SyntaxKind.Text;[Foo]; Tag block - Gen - 4 - (36:0,36) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (36:0,36) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (40:0,40) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (41:0,41) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (42:0,42) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (43:0,43) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (44:0,44) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesComment.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesComment.cspans.txt index d48a285438..9e9f49db1d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesComment.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesComment.cspans.txt @@ -1,12 +1,12 @@ Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [21] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [21] ) MetaCode span at (1:0,1 [7] ) (Accepts:None) - Parent: Directive block at (0:0,0 [21] ) -Code span at (8:0,8 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [21] ) -Code span at (9:0,9 [1] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [21] ) -Markup span at (10:0,10 [1] ) (Accepts:AllWhiteSpace) - Parent: Directive block at (0:0,0 [21] ) +Code span at (8:0,8 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [21] ) +Code span at (9:0,9 [1] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [21] ) +Markup span at (10:0,10 [1] ) (Accepts:AllWhitespace) - Parent: Directive block at (0:0,0 [21] ) MetaCode span at (11:0,11 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [21] ) Markup span at (12:0,12 [4] ) (Accepts:None) - Parent: HtmlComment block at (12:0,12 [8] ) -Markup span at (16:0,16 [1] ) (Accepts:WhiteSpace) - Parent: HtmlComment block at (12:0,12 [8] ) +Markup span at (16:0,16 [1] ) (Accepts:Whitespace) - Parent: HtmlComment block at (12:0,12 [8] ) Markup span at (17:0,17 [3] ) (Accepts:None) - Parent: HtmlComment block at (12:0,12 [8] ) Markup span at (20:0,20 [0] ) (Accepts:Any) - Parent: Markup block at (12:0,12 [8] ) MetaCode span at (20:0,20 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [21] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesComment.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesComment.stree.txt index 4bdbe3877f..79ae5a2bf7 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesComment.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesComment.stree.txt @@ -1,33 +1,33 @@ Markup block - Gen - 21 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 21 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [s] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[s]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (10:0,10) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Identifier;[section]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [s] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 + SyntaxKind.Identifier;[s]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (10:0,10) - Tokens:1 + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (11:0,11) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 8 - (12:0,12) HtmlComment block - Gen - 8 - (12:0,12) Markup span - Gen - [] - SpanEditHandler;Accepts:None - (17:0,17) - Tokens:2 - HtmlTokenType.DoubleHyphen;[--]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.DoubleHyphen;[--]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (20:0,20) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (20:0,20) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (21:0,21) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesCommentWithDelimiters.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesCommentWithDelimiters.cspans.txt index dc6a5cfa46..aa83e0cc99 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesCommentWithDelimiters.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesCommentWithDelimiters.cspans.txt @@ -1,12 +1,12 @@ Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [26] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [26] ) MetaCode span at (1:0,1 [7] ) (Accepts:None) - Parent: Directive block at (0:0,0 [26] ) -Code span at (8:0,8 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [26] ) -Code span at (9:0,9 [1] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [26] ) -Markup span at (10:0,10 [1] ) (Accepts:AllWhiteSpace) - Parent: Directive block at (0:0,0 [26] ) +Code span at (8:0,8 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [26] ) +Code span at (9:0,9 [1] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [26] ) +Markup span at (10:0,10 [1] ) (Accepts:AllWhitespace) - Parent: Directive block at (0:0,0 [26] ) MetaCode span at (11:0,11 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [26] ) Markup span at (12:0,12 [4] ) (Accepts:None) - Parent: HtmlComment block at (12:0,12 [13] ) -Markup span at (16:0,16 [6] ) (Accepts:WhiteSpace) - Parent: HtmlComment block at (12:0,12 [13] ) +Markup span at (16:0,16 [6] ) (Accepts:Whitespace) - Parent: HtmlComment block at (12:0,12 [13] ) Markup span at (22:0,22 [3] ) (Accepts:None) - Parent: HtmlComment block at (12:0,12 [13] ) Markup span at (25:0,25 [0] ) (Accepts:Any) - Parent: Markup block at (12:0,12 [13] ) MetaCode span at (25:0,25 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [26] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesCommentWithDelimiters.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesCommentWithDelimiters.stree.txt index 86e6444d85..72698062ec 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesCommentWithDelimiters.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesCommentWithDelimiters.stree.txt @@ -1,38 +1,38 @@ Markup block - Gen - 26 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 26 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [s] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[s]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (10:0,10) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Identifier;[section]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [s] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 + SyntaxKind.Identifier;[s]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (10:0,10) - Tokens:1 + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (11:0,11) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 13 - (12:0,12) HtmlComment block - Gen - 13 - (12:0,12) Markup span - Gen - [] - SpanEditHandler;Accepts:None - (22:0,22) - Tokens:2 - HtmlTokenType.DoubleHyphen;[--]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.DoubleHyphen;[--]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (25:0,25) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (25:0,25) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (26:0,26) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesNamedSectionCorrectly.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesNamedSectionCorrectly.cspans.txt index 28dd678224..ad6311499d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesNamedSectionCorrectly.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesNamedSectionCorrectly.cspans.txt @@ -1,9 +1,9 @@ Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [27] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [27] ) MetaCode span at (1:0,1 [7] ) (Accepts:None) - Parent: Directive block at (0:0,0 [27] ) -Code span at (8:0,8 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [27] ) -Code span at (9:0,9 [3] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [27] ) -Markup span at (12:0,12 [1] ) (Accepts:AllWhiteSpace) - Parent: Directive block at (0:0,0 [27] ) +Code span at (8:0,8 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [27] ) +Code span at (9:0,9 [3] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [27] ) +Markup span at (12:0,12 [1] ) (Accepts:AllWhitespace) - Parent: Directive block at (0:0,0 [27] ) MetaCode span at (13:0,13 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [27] ) Markup span at (14:0,14 [1] ) (Accepts:Any) - Parent: Markup block at (14:0,14 [12] ) Markup span at (15:0,15 [3] ) (Accepts:Any) - Parent: Tag block at (15:0,15 [3] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesNamedSectionCorrectly.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesNamedSectionCorrectly.stree.txt index 816ec6dd7f..be21d3746d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesNamedSectionCorrectly.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesNamedSectionCorrectly.stree.txt @@ -1,38 +1,38 @@ Markup block - Gen - 27 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 27 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[foo]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (12:0,12) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Identifier;[section]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 + SyntaxKind.Identifier;[foo]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (12:0,12) - Tokens:1 + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (13:0,13) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 12 - (14:0,14) Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 3 - (15:0,15) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (15:0,15) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [Foo] - SpanEditHandler;Accepts:Any - (18:0,18) - Tokens:1 - HtmlTokenType.Text;[Foo]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; + SyntaxKind.HtmlTextLiteral - [Foo] - [18..21) - FullWidth: 3 - Slots: 1 + SyntaxKind.Text;[Foo]; Tag block - Gen - 4 - (21:0,21) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (21:0,21) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (25:0,25) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (26:0,26) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (27:0,27) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesXmlProcessingInstruction.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesXmlProcessingInstruction.cspans.txt index 58cbbb3588..a7e21f084d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesXmlProcessingInstruction.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesXmlProcessingInstruction.cspans.txt @@ -1,9 +1,9 @@ Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [28] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [28] ) MetaCode span at (1:0,1 [7] ) (Accepts:None) - Parent: Directive block at (0:0,0 [28] ) -Code span at (8:0,8 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [28] ) -Code span at (9:0,9 [1] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [28] ) -Markup span at (10:0,10 [1] ) (Accepts:AllWhiteSpace) - Parent: Directive block at (0:0,0 [28] ) +Code span at (8:0,8 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [28] ) +Code span at (9:0,9 [1] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [28] ) +Markup span at (10:0,10 [1] ) (Accepts:AllWhitespace) - Parent: Directive block at (0:0,0 [28] ) MetaCode span at (11:0,11 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [28] ) Markup span at (12:0,12 [15] ) (Accepts:Any) - Parent: Markup block at (12:0,12 [15] ) MetaCode span at (27:0,27 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [28] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesXmlProcessingInstruction.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesXmlProcessingInstruction.stree.txt index 92cd8e4296..290add3dad 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesXmlProcessingInstruction.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ParsesXmlProcessingInstruction.stree.txt @@ -1,32 +1,32 @@ Markup block - Gen - 28 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 28 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [s] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[s]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (10:0,10) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Identifier;[section]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [s] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 + SyntaxKind.Identifier;[s]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (10:0,10) - Tokens:1 + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (11:0,11) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 15 - (12:0,12) Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (12:0,12) - Tokens:10 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.QuestionMark;[?]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[xml]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[bleh]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.QuestionMark;[?]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[xml]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[bleh]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.QuestionMark;[?]; + SyntaxKind.CloseAngle;[>]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (27:0,27) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (28:0,28) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ReportsErrorAndAcceptsWhitespaceToEOLIfSectionNotFollowedByOpenBrace.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ReportsErrorAndAcceptsWhitespaceToEOLIfSectionNotFollowedByOpenBrace.cspans.txt index d1aebb95ee..39637d477b 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ReportsErrorAndAcceptsWhitespaceToEOLIfSectionNotFollowedByOpenBrace.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ReportsErrorAndAcceptsWhitespaceToEOLIfSectionNotFollowedByOpenBrace.cspans.txt @@ -1,7 +1,7 @@ Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [20] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [20] ) MetaCode span at (1:0,1 [7] ) (Accepts:None) - Parent: Directive block at (0:0,0 [20] ) -Code span at (8:0,8 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [20] ) -Code span at (9:0,9 [3] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [20] ) -Markup span at (12:0,12 [8] ) (Accepts:AllWhiteSpace) - Parent: Directive block at (0:0,0 [20] ) +Code span at (8:0,8 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [20] ) +Code span at (9:0,9 [3] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [20] ) +Markup span at (12:0,12 [8] ) (Accepts:AllWhitespace) - Parent: Directive block at (0:0,0 [20] ) Markup span at (20:1,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [20] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ReportsErrorAndAcceptsWhitespaceToEOLIfSectionNotFollowedByOpenBrace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ReportsErrorAndAcceptsWhitespaceToEOLIfSectionNotFollowedByOpenBrace.stree.txt index f0c5008e10..d94e0cb858 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ReportsErrorAndAcceptsWhitespaceToEOLIfSectionNotFollowedByOpenBrace.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ReportsErrorAndAcceptsWhitespaceToEOLIfSectionNotFollowedByOpenBrace.stree.txt @@ -1,17 +1,17 @@ Markup block - Gen - 20 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 20 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[foo]; - Markup span - Gen - [ LF] - SpanEditHandler;Accepts:AllWhiteSpace - (12:0,12) - Tokens:2 - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.NewLine;[LF]; + SyntaxKind.Identifier;[section]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 + SyntaxKind.Identifier;[foo]; + Markup span - Gen - [ LF] - SpanEditHandler;Accepts:AllWhitespace - (12:0,12) - Tokens:2 + SyntaxKind.Whitespace;[ ]; + SyntaxKind.NewLine;[LF]; Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (20:1,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ReportsErrorAndTerminatesSectionBlockIfKeywordNotFollowedByIdentifierStartChar.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ReportsErrorAndTerminatesSectionBlockIfKeywordNotFollowedByIdentifierStartChar.cspans.txt index 91c582c57e..1b511f83f5 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ReportsErrorAndTerminatesSectionBlockIfKeywordNotFollowedByIdentifierStartChar.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ReportsErrorAndTerminatesSectionBlockIfKeywordNotFollowedByIdentifierStartChar.cspans.txt @@ -1,7 +1,7 @@ Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [25] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [9] ) MetaCode span at (1:0,1 [7] ) (Accepts:None) - Parent: Directive block at (0:0,0 [9] ) -Code span at (8:0,8 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [9] ) +Code span at (8:0,8 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [9] ) Markup span at (9:0,9 [4] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [25] ) Markup span at (13:0,13 [3] ) (Accepts:Any) - Parent: Tag block at (13:0,13 [3] ) Markup span at (16:0,16 [3] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [25] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ReportsErrorAndTerminatesSectionBlockIfKeywordNotFollowedByIdentifierStartChar.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ReportsErrorAndTerminatesSectionBlockIfKeywordNotFollowedByIdentifierStartChar.stree.txt index 2505742c14..35badf1453 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ReportsErrorAndTerminatesSectionBlockIfKeywordNotFollowedByIdentifierStartChar.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ReportsErrorAndTerminatesSectionBlockIfKeywordNotFollowedByIdentifierStartChar.stree.txt @@ -1,31 +1,31 @@ Markup block - Gen - 25 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 9 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Identifier;[section]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 + SyntaxKind.Whitespace;[ ]; Markup span - Gen - [9 { ] - SpanEditHandler;Accepts:Any - (9:0,9) - Tokens:4 - HtmlTokenType.Text;[9]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[{]; - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Text;[9]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[{]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 3 - (13:0,13) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (13:0,13) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [Foo] - SpanEditHandler;Accepts:Any - (16:0,16) - Tokens:1 - HtmlTokenType.Text;[Foo]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; + SyntaxKind.HtmlTextLiteral - [Foo] - [16..19) - FullWidth: 3 - Slots: 1 + SyntaxKind.Text;[Foo]; Tag block - Gen - 4 - (19:0,19) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (19:0,19) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [ }] - SpanEditHandler;Accepts:Any - (23:0,23) - Tokens:2 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ReportsErrorAndTerminatesSectionBlockIfNameNotFollowedByOpenBrace.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ReportsErrorAndTerminatesSectionBlockIfNameNotFollowedByOpenBrace.cspans.txt index b96ad7e8d4..b1564f1bc8 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ReportsErrorAndTerminatesSectionBlockIfNameNotFollowedByOpenBrace.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ReportsErrorAndTerminatesSectionBlockIfNameNotFollowedByOpenBrace.cspans.txt @@ -1,8 +1,8 @@ Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [31] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [12] ) MetaCode span at (1:0,1 [7] ) (Accepts:None) - Parent: Directive block at (0:0,0 [12] ) -Code span at (8:0,8 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [12] ) -Code span at (9:0,9 [3] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [12] ) +Code span at (8:0,8 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [12] ) +Code span at (9:0,9 [3] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [12] ) Markup span at (12:0,12 [7] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [31] ) Markup span at (19:0,19 [3] ) (Accepts:Any) - Parent: Tag block at (19:0,19 [3] ) Markup span at (22:0,22 [3] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [31] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ReportsErrorAndTerminatesSectionBlockIfNameNotFollowedByOpenBrace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ReportsErrorAndTerminatesSectionBlockIfNameNotFollowedByOpenBrace.stree.txt index f9fea55241..22d3d989a0 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ReportsErrorAndTerminatesSectionBlockIfNameNotFollowedByOpenBrace.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/ReportsErrorAndTerminatesSectionBlockIfNameNotFollowedByOpenBrace.stree.txt @@ -1,33 +1,33 @@ Markup block - Gen - 31 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 12 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[foo]; + SyntaxKind.Identifier;[section]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [foo] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 + SyntaxKind.Identifier;[foo]; Markup span - Gen - [-bar { ] - SpanEditHandler;Accepts:Any - (12:0,12) - Tokens:4 - HtmlTokenType.Text;[-bar]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[{]; - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Text;[-bar]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[{]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 3 - (19:0,19) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (19:0,19) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; - Markup span - Gen - [Foo] - SpanEditHandler;Accepts:Any - (22:0,22) - Tokens:1 - HtmlTokenType.Text;[Foo]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; + SyntaxKind.HtmlTextLiteral - [Foo] - [22..25) - FullWidth: 3 - Slots: 1 + SyntaxKind.Text;[Foo]; Tag block - Gen - 4 - (25:0,25) Markup span - Gen - [

] - SpanEditHandler;Accepts:Any - (25:0,25) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [ }] - SpanEditHandler;Accepts:Any - (29:0,29) - Tokens:2 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/SectionCorrectlyTerminatedWhenCloseBraceFollowsCodeBlockNoWhitespace.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/SectionCorrectlyTerminatedWhenCloseBraceFollowsCodeBlockNoWhitespace.cspans.txt index 2e5cfb7364..0361cc1a71 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/SectionCorrectlyTerminatedWhenCloseBraceFollowsCodeBlockNoWhitespace.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/SectionCorrectlyTerminatedWhenCloseBraceFollowsCodeBlockNoWhitespace.cspans.txt @@ -1,9 +1,9 @@ Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [31] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [31] ) MetaCode span at (1:0,1 [7] ) (Accepts:None) - Parent: Directive block at (0:0,0 [31] ) -Code span at (8:0,8 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [31] ) -Code span at (9:0,9 [3] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [31] ) -Markup span at (12:0,12 [1] ) (Accepts:AllWhiteSpace) - Parent: Directive block at (0:0,0 [31] ) +Code span at (8:0,8 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [31] ) +Code span at (9:0,9 [3] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [31] ) +Markup span at (12:0,12 [1] ) (Accepts:AllWhitespace) - Parent: Directive block at (0:0,0 [31] ) MetaCode span at (13:0,13 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [31] ) Markup span at (14:0,14 [2] ) (Accepts:Any) - Parent: Markup block at (14:0,14 [16] ) Transition span at (16:1,0 [1] ) (Accepts:None) - Parent: Statement block at (16:1,0 [14] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/SectionCorrectlyTerminatedWhenCloseBraceFollowsCodeBlockNoWhitespace.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/SectionCorrectlyTerminatedWhenCloseBraceFollowsCodeBlockNoWhitespace.stree.txt index 1712aafc46..4f36cca4c7 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/SectionCorrectlyTerminatedWhenCloseBraceFollowsCodeBlockNoWhitespace.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/SectionCorrectlyTerminatedWhenCloseBraceFollowsCodeBlockNoWhitespace.stree.txt @@ -1,35 +1,35 @@ Markup block - Gen - 31 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 31 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [Foo] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[Foo]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (12:0,12) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Identifier;[section]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [Foo] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 + SyntaxKind.Identifier;[Foo]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (12:0,12) - Tokens:1 + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (13:0,13) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 16 - (14:0,14) Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - HtmlTokenType.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; Statement block - Gen - 14 - (16:1,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (16:1,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [if(true) {LF}] - SpanEditHandler;Accepts:Any - (17:1,1) - Tokens:8 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[true]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[true]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.RightBrace;[}]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (30:2,1) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (31:2,2) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/SectionIsCorrectlyTerminatedWhenCloseBraceImmediatelyFollowsCodeBlock.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/SectionIsCorrectlyTerminatedWhenCloseBraceImmediatelyFollowsCodeBlock.cspans.txt index 07b903f608..7ec7640bc9 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/SectionIsCorrectlyTerminatedWhenCloseBraceImmediatelyFollowsCodeBlock.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/SectionIsCorrectlyTerminatedWhenCloseBraceImmediatelyFollowsCodeBlock.cspans.txt @@ -1,9 +1,9 @@ Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [33] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [33] ) MetaCode span at (1:0,1 [7] ) (Accepts:None) - Parent: Directive block at (0:0,0 [33] ) -Code span at (8:0,8 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [33] ) -Code span at (9:0,9 [3] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [33] ) -Markup span at (12:0,12 [1] ) (Accepts:AllWhiteSpace) - Parent: Directive block at (0:0,0 [33] ) +Code span at (8:0,8 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [33] ) +Code span at (9:0,9 [3] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [33] ) +Markup span at (12:0,12 [1] ) (Accepts:AllWhitespace) - Parent: Directive block at (0:0,0 [33] ) MetaCode span at (13:0,13 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [33] ) Markup span at (14:0,14 [2] ) (Accepts:Any) - Parent: Markup block at (14:0,14 [18] ) Transition span at (16:1,0 [1] ) (Accepts:None) - Parent: Statement block at (16:1,0 [16] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/SectionIsCorrectlyTerminatedWhenCloseBraceImmediatelyFollowsCodeBlock.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/SectionIsCorrectlyTerminatedWhenCloseBraceImmediatelyFollowsCodeBlock.stree.txt index 5b549fd8de..d536400d5f 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/SectionIsCorrectlyTerminatedWhenCloseBraceImmediatelyFollowsCodeBlock.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/SectionIsCorrectlyTerminatedWhenCloseBraceImmediatelyFollowsCodeBlock.stree.txt @@ -1,36 +1,36 @@ Markup block - Gen - 33 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 33 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [Foo] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[Foo]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (12:0,12) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Identifier;[section]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [Foo] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 + SyntaxKind.Identifier;[Foo]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (12:0,12) - Tokens:1 + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (13:0,13) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 18 - (14:0,14) Markup span - Gen - [LF] - SpanEditHandler;Accepts:Any - (14:0,14) - Tokens:1 - HtmlTokenType.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; Statement block - Gen - 16 - (16:1,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (16:1,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [if(true) {LF}LF] - SpanEditHandler;Accepts:Any - (17:1,1) - Tokens:9 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[true]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.NewLine;[LF]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[true]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.NewLine;[LF]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (32:3,0) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (33:3,1) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/_WithDoubleTransition1.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/_WithDoubleTransition1.cspans.txt index 45000bd914..49aa650ad1 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/_WithDoubleTransition1.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/_WithDoubleTransition1.cspans.txt @@ -1,9 +1,9 @@ Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [30] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [30] ) MetaCode span at (1:0,1 [7] ) (Accepts:None) - Parent: Directive block at (0:0,0 [30] ) -Code span at (8:0,8 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [30] ) -Code span at (9:0,9 [1] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [30] ) -Markup span at (10:0,10 [1] ) (Accepts:AllWhiteSpace) - Parent: Directive block at (0:0,0 [30] ) +Code span at (8:0,8 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [30] ) +Code span at (9:0,9 [1] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [30] ) +Markup span at (10:0,10 [1] ) (Accepts:AllWhitespace) - Parent: Directive block at (0:0,0 [30] ) MetaCode span at (11:0,11 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [30] ) Markup span at (12:0,12 [5] ) (Accepts:Any) - Parent: Tag block at (12:0,12 [17] ) Markup span at (17:0,17 [6] ) (Accepts:Any) - Parent: Markup block at (17:0,17 [9] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/_WithDoubleTransition1.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/_WithDoubleTransition1.stree.txt index 5be347d4cf..df9f966f04 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/_WithDoubleTransition1.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/_WithDoubleTransition1.stree.txt @@ -1,42 +1,42 @@ Markup block - Gen - 30 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 30 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [s] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[s]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (10:0,10) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Identifier;[section]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [s] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 + SyntaxKind.Identifier;[s]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (10:0,10) - Tokens:1 + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (11:0,11) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 17 - (12:0,12) Tag block - Gen - 17 - (12:0,12) Markup span - Gen - [ - 9 - (17:0,17) Markup span - Gen - [ foo='] - SpanEditHandler;Accepts:Any - (17:0,17) - Tokens:4 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[foo]; - HtmlTokenType.Equals;[=]; - HtmlTokenType.SingleQuote;[']; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[foo]; + SyntaxKind.Equals;[=]; + SyntaxKind.SingleQuote;[']; Markup block - Gen - 2 - (23:0,23) Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (23:0,23) - Tokens:1 - HtmlTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (24:0,24) - Tokens:1 - HtmlTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Markup span - Gen - ['] - SpanEditHandler;Accepts:Any - (25:0,25) - Tokens:1 - HtmlTokenType.SingleQuote;[']; + SyntaxKind.SingleQuote;[']; Markup span - Gen - [ />] - SpanEditHandler;Accepts:Any - (26:0,26) - Tokens:3 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.CloseAngle;[>]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (29:0,29) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (30:0,30) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/_WithDoubleTransition2.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/_WithDoubleTransition2.cspans.txt index 066623b119..b2bb803352 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/_WithDoubleTransition2.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/_WithDoubleTransition2.cspans.txt @@ -1,14 +1,14 @@ Markup span at (0:0,0 [0] ) (Accepts:Any) - Parent: Markup block at (0:0,0 [44] ) Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [44] ) MetaCode span at (1:0,1 [7] ) (Accepts:None) - Parent: Directive block at (0:0,0 [44] ) -Code span at (8:0,8 [1] ) (Accepts:WhiteSpace) - Parent: Directive block at (0:0,0 [44] ) -Code span at (9:0,9 [1] ) (Accepts:NonWhiteSpace) - Parent: Directive block at (0:0,0 [44] ) -Markup span at (10:0,10 [1] ) (Accepts:AllWhiteSpace) - Parent: Directive block at (0:0,0 [44] ) +Code span at (8:0,8 [1] ) (Accepts:Whitespace) - Parent: Directive block at (0:0,0 [44] ) +Code span at (9:0,9 [1] ) (Accepts:NonWhitespace) - Parent: Directive block at (0:0,0 [44] ) +Markup span at (10:0,10 [1] ) (Accepts:AllWhitespace) - Parent: Directive block at (0:0,0 [44] ) MetaCode span at (11:0,11 [1] ) (Accepts:None) - Parent: Directive block at (0:0,0 [44] ) Markup span at (12:0,12 [5] ) (Accepts:Any) - Parent: Tag block at (12:0,12 [31] ) Markup span at (17:0,17 [6] ) (Accepts:Any) - Parent: Markup block at (17:0,17 [23] ) Transition span at (23:0,23 [1] ) (Accepts:None) - Parent: Expression block at (23:0,23 [13] ) -Code span at (24:0,24 [12] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (23:0,23 [13] ) +Code span at (24:0,24 [12] ) (Accepts:NonWhitespace) - Parent: Expression block at (23:0,23 [13] ) Markup span at (36:0,36 [2] ) (Accepts:None) - Parent: Markup block at (36:0,36 [3] ) Markup span at (38:0,38 [1] ) (Accepts:None) - Parent: Markup block at (36:0,36 [3] ) Markup span at (39:0,39 [1] ) (Accepts:Any) - Parent: Markup block at (17:0,17 [23] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/_WithDoubleTransition2.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/_WithDoubleTransition2.stree.txt index 062a860adb..32ae46f825 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/_WithDoubleTransition2.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSectionTest/_WithDoubleTransition2.stree.txt @@ -1,51 +1,51 @@ Markup block - Gen - 44 - (0:0,0) Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; Directive block - Gen - 44 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [section] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.Identifier;[section]; - Code span - Gen - [ ] - SpanEditHandler;Accepts:WhiteSpace - (8:0,8) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; - Code span - Gen - [s] - DirectiveTokenEditHandler;Accepts:NonWhiteSpace - (9:0,9) - Tokens:1 - CSharpTokenType.Identifier;[s]; - Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhiteSpace - (10:0,10) - Tokens:1 - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Identifier;[section]; + Code span - Gen - [ ] - SpanEditHandler;Accepts:Whitespace - (8:0,8) - Tokens:1 + SyntaxKind.Whitespace;[ ]; + Code span - Gen - [s] - DirectiveTokenEditHandler;Accepts:NonWhitespace - (9:0,9) - Tokens:1 + SyntaxKind.Identifier;[s]; + Markup span - Gen - [ ] - SpanEditHandler;Accepts:AllWhitespace - (10:0,10) - Tokens:1 + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [{] - AutoCompleteEditHandler;Accepts:None,AutoComplete:[];AtEnd - (11:0,11) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Markup block - Gen - 31 - (12:0,12) Tag block - Gen - 31 - (12:0,12) Markup span - Gen - [ - 23 - (17:0,17) Markup span - Gen - [ foo='] - SpanEditHandler;Accepts:Any - (17:0,17) - Tokens:4 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[foo]; - HtmlTokenType.Equals;[=]; - HtmlTokenType.SingleQuote;[']; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[foo]; + SyntaxKind.Equals;[=]; + SyntaxKind.SingleQuote;[']; Markup block - Gen - 13 - (23:0,23) Expression block - Gen - 13 - (23:0,23) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (23:0,23) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [DateTime.Now] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K15 - (24:0,24) - Tokens:3 - CSharpTokenType.Identifier;[DateTime]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Now]; + SyntaxKind.Transition;[@]; + Code span - Gen - [DateTime.Now] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K15 - (24:0,24) - Tokens:3 + SyntaxKind.Identifier;[DateTime]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Now]; Markup block - Gen - 3 - (36:0,36) Markup span - Gen - [ @] - SpanEditHandler;Accepts:None - (36:0,36) - Tokens:2 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Transition;[@]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Transition;[@]; Markup span - Gen - [@] - SpanEditHandler;Accepts:None - (38:0,38) - Tokens:1 - HtmlTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Markup span - Gen - ['] - SpanEditHandler;Accepts:Any - (39:0,39) - Tokens:1 - HtmlTokenType.SingleQuote;[']; + SyntaxKind.SingleQuote;[']; Markup span - Gen - [ />] - SpanEditHandler;Accepts:Any - (40:0,40) - Tokens:3 - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.CloseAngle;[>]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (43:0,43) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; Markup span - Gen - [] - SpanEditHandler;Accepts:Any - (44:0,44) - Tokens:1 - HtmlTokenType.Unknown;[]; + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/BalancesBracesOutsideStringsIfFirstCharIsBraceAndReturnsSpanOfTypeCode.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/BalancesBracesOutsideStringsIfFirstCharIsBraceAndReturnsSpanOfTypeCode.stree.txt index 19a360fd8b..ec75baf7a5 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/BalancesBracesOutsideStringsIfFirstCharIsBraceAndReturnsSpanOfTypeCode.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/BalancesBracesOutsideStringsIfFirstCharIsBraceAndReturnsSpanOfTypeCode.stree.txt @@ -1,26 +1,26 @@ Statement block - Gen - 52 - (0:0,0) MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Code span - Gen - [foo"b}ar" if(condition) { string.Format("{0}"); } ] - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[];AtEOL - (1:0,1) - Tokens:20 - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.StringLiteral;["b}ar"]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[condition]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[string]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Format]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.StringLiteral;["{0}"]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.StringLiteral;["b}ar"]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[condition]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[string]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Format]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.StringLiteral;["{0}"]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (51:0,51) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/BalancesParensOutsideStringsIfFirstCharIsParenAndReturnsSpanOfTypeExpr.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/BalancesParensOutsideStringsIfFirstCharIsParenAndReturnsSpanOfTypeExpr.stree.txt index 757004c73b..91c655daaa 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/BalancesParensOutsideStringsIfFirstCharIsParenAndReturnsSpanOfTypeExpr.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/BalancesParensOutsideStringsIfFirstCharIsParenAndReturnsSpanOfTypeExpr.stree.txt @@ -1,26 +1,26 @@ Expression block - Gen - 52 - (0:0,0) MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.LeftParenthesis;[(]; + SyntaxKind.LeftParenthesis;[(]; Code span - Gen - [foo"b)ar" if(condition) { string.Format("{0}"); } ] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:20 - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.StringLiteral;["b)ar"]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[condition]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[string]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Format]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.StringLiteral;["{0}"]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.StringLiteral;["b)ar"]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[condition]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[string]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Format]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.StringLiteral;["{0}"]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [)] - SpanEditHandler;Accepts:None - (51:0,51) - Tokens:1 - CSharpTokenType.RightParenthesis;[)]; + SyntaxKind.RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/NamespaceImportInsideCodeBlockCausesError.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/NamespaceImportInsideCodeBlockCausesError.stree.txt index 41fd907da2..7c4b8764f2 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/NamespaceImportInsideCodeBlockCausesError.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/NamespaceImportInsideCodeBlockCausesError.stree.txt @@ -1,25 +1,25 @@ Statement block - Gen - 37 - (0:0,0) MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Code span - Gen - [ using Foo.Bar.Baz; var foo = bar; ] - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[];AtEOL - (1:0,1) - Tokens:19 - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[using]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Baz]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[using]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Baz]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (36:0,36) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/NonKeywordStatementInCodeBlockIsHandledCorrectly.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/NonKeywordStatementInCodeBlockIsHandledCorrectly.stree.txt index 25dbecb0d5..d11ffc889a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/NonKeywordStatementInCodeBlockIsHandledCorrectly.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/NonKeywordStatementInCodeBlockIsHandledCorrectly.stree.txt @@ -1,26 +1,26 @@ Statement block - Gen - 56 - (0:0,0) MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Code span - Gen - [LF List photos = gallery.Photo.ToList();LF] - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[];AtEOL - (1:0,1) - Tokens:20 - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[List]; - CSharpTokenType.LessThan;[<]; - CSharpTokenType.Identifier;[dynamic]; - CSharpTokenType.GreaterThan;[>]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[photos]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[gallery]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Photo]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[ToList]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[List]; + SyntaxKind.LessThan;[<]; + SyntaxKind.Identifier;[dynamic]; + SyntaxKind.GreaterThan;[>]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[photos]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[gallery]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Photo]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[ToList]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.NewLine;[LF]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (55:2,0) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/ParseBlockIgnoresSingleSlashAtStart.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/ParseBlockIgnoresSingleSlashAtStart.cspans.txt index df81e75cc2..7d1e387fe4 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/ParseBlockIgnoresSingleSlashAtStart.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/ParseBlockIgnoresSingleSlashAtStart.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [1] ) -Code span at (1:0,1 [0] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [1] ) +Code span at (1:0,1 [0] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [1] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/ParseBlockIgnoresSingleSlashAtStart.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/ParseBlockIgnoresSingleSlashAtStart.stree.txt index 8f8de632d0..40da231bf0 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/ParseBlockIgnoresSingleSlashAtStart.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/ParseBlockIgnoresSingleSlashAtStart.stree.txt @@ -1,5 +1,5 @@ Expression block - Gen - 1 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Unknown;[]; + SyntaxKind.Transition;[@]; + Code span - Gen - [] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 + SyntaxKind.Unknown;[]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/ParseBlockTerminatesSingleLineCommentAtEndOfLine.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/ParseBlockTerminatesSingleLineCommentAtEndOfLine.stree.txt index 60b8f07d27..8289558050 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/ParseBlockTerminatesSingleLineCommentAtEndOfLine.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/ParseBlockTerminatesSingleLineCommentAtEndOfLine.stree.txt @@ -1,38 +1,38 @@ Statement block - Gen - 48 - (0:0,0) Code span - Gen - [if(!false) {LF // FooLF] - SpanEditHandler;Accepts:Any - (0:0,0) - Tokens:11 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Not;[!]; - CSharpTokenType.Keyword;[false]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Comment;[// Foo]; - CSharpTokenType.NewLine;[LF]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Not;[!]; + SyntaxKind.Keyword;[false]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.CSharpComment;[// Foo]; + SyntaxKind.NewLine;[LF]; Markup block - Gen - 21 - (26:2,0) Markup span - Gen - [ ] - SpanEditHandler;Accepts:Any - (26:2,0) - Tokens:1 - HtmlTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; Tag block - Gen - 3 - (27:2,1) Markup span - Gen - [

] - SpanEditHandler;Accepts:None - (27:2,1) - Tokens:3 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [A real tag!] - SpanEditHandler;Accepts:Any - (30:2,4) - Tokens:6 - HtmlTokenType.Text;[A]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[real]; - HtmlTokenType.WhiteSpace;[ ]; - HtmlTokenType.Text;[tag]; - HtmlTokenType.Bang;[!]; + SyntaxKind.Text;[A]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[real]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Text;[tag]; + SyntaxKind.Bang;[!]; Tag block - Gen - 4 - (41:2,15) Markup span - Gen - [

] - SpanEditHandler;Accepts:None - (41:2,15) - Tokens:4 - HtmlTokenType.OpenAngle;[<]; - HtmlTokenType.ForwardSlash;[/]; - HtmlTokenType.Text;[p]; - HtmlTokenType.CloseAngle;[>]; + SyntaxKind.OpenAngle;[<]; + SyntaxKind.ForwardSlash;[/]; + SyntaxKind.Text;[p]; + SyntaxKind.CloseAngle;[>]; Markup span - Gen - [LF] - SpanEditHandler;Accepts:None - (45:2,19) - Tokens:1 - HtmlTokenType.NewLine;[LF]; + SyntaxKind.NewLine;[LF]; Code span - Gen - [}] - SpanEditHandler;Accepts:Any - (47:3,0) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/TypeAliasInsideCodeBlockIsNotHandledSpecially.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/TypeAliasInsideCodeBlockIsNotHandledSpecially.stree.txt index 5576cf671f..566c40d08d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/TypeAliasInsideCodeBlockIsNotHandledSpecially.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpSpecialBlockTest/TypeAliasInsideCodeBlockIsNotHandledSpecially.stree.txt @@ -1,27 +1,27 @@ Statement block - Gen - 39 - (0:0,0) MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Code span - Gen - [ using Foo = Bar.Baz; var foo = bar; ] - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[];AtEOL - (1:0,1) - Tokens:21 - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[using]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Baz]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[using]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Baz]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (38:0,38) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/CatchClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/CatchClause.stree.txt index 979f01d5ec..bd9e33585e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/CatchClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/CatchClause.stree.txt @@ -1,46 +1,46 @@ Statement block - Gen - 94 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [try { foo(); } catch(IOException ioex) { handleIO(); } catch(Exception ex) { handleOther(); }] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:42 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[catch]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[IOException]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[ioex]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[handleIO]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[catch]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[Exception]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[ex]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[handleOther]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[try]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[catch]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[IOException]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[ioex]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[handleIO]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[catch]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[Exception]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[ex]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[handleOther]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/DoStatement.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/DoStatement.stree.txt index 3d7b1a88af..864f9a5c11 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/DoStatement.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/DoStatement.stree.txt @@ -1,20 +1,20 @@ Statement block - Gen - 27 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [do { foo(); } while(true);] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:16 - CSharpTokenType.Keyword;[do]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[while]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[true]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; + SyntaxKind.Keyword;[do]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[while]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[true]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ElseClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ElseClause.stree.txt index 6952c9d39e..9e2f4273e0 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ElseClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ElseClause.stree.txt @@ -1,28 +1,28 @@ Statement block - Gen - 36 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [if(true) { foo(); } else { foo(); }] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:24 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[true]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[else]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[true]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[else]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ElseIfClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ElseIfClause.stree.txt index 3ac82af49f..736d35fc5d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ElseIfClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ElseIfClause.stree.txt @@ -1,50 +1,50 @@ Statement block - Gen - 73 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [if(true) { foo(); } else if(false) { foo(); } else if(!false) { foo(); }] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:46 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[true]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[else]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[false]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[else]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Not;[!]; - CSharpTokenType.Keyword;[false]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[true]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[else]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[false]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[else]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Not;[!]; + SyntaxKind.Keyword;[false]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilterError_TryCatchWhen_InCompleteBody.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilterError_TryCatchWhen_InCompleteBody.stree.txt index a65e11f6c9..09016c9a8e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilterError_TryCatchWhen_InCompleteBody.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilterError_TryCatchWhen_InCompleteBody.stree.txt @@ -1,27 +1,27 @@ Statement block - Gen - 53 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [try { someMethod(); } catch(Exception) when (true) {] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:23 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[someMethod]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[catch]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[Exception]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[when]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[true]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.Keyword;[try]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[someMethod]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[catch]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[Exception]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[when]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[true]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilterError_TryCatchWhen_InCompleteCondition.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilterError_TryCatchWhen_InCompleteCondition.stree.txt index ea80c49749..25415c2f95 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilterError_TryCatchWhen_InCompleteCondition.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilterError_TryCatchWhen_InCompleteCondition.stree.txt @@ -1,23 +1,23 @@ Statement block - Gen - 46 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [try { someMethod(); } catch(Exception) when (] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:19 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[someMethod]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[catch]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[Exception]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[when]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftParenthesis;[(]; + SyntaxKind.Keyword;[try]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[someMethod]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[catch]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[Exception]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[when]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftParenthesis;[(]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_IncompleteTryCatchNoBodyWhen.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_IncompleteTryCatchNoBodyWhen.stree.txt index b974facb6a..2b4fbb308a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_IncompleteTryCatchNoBodyWhen.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_IncompleteTryCatchNoBodyWhen.stree.txt @@ -1,30 +1,30 @@ Statement block - Gen - 65 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [try { someMethod(); } catch(Exception) when { anotherMethod(); }] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:26 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[someMethod]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[catch]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[Exception]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[when]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[anotherMethod]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[try]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[someMethod]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[catch]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[Exception]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[when]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[anotherMethod]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_IncompleteTryCatchWhen.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_IncompleteTryCatchWhen.stree.txt index 7672a029cd..4bcac7751c 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_IncompleteTryCatchWhen.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_IncompleteTryCatchWhen.stree.txt @@ -1,21 +1,21 @@ Statement block - Gen - 44 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [try { someMethod(); } catch(Exception) when] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:17 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[someMethod]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[catch]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[Exception]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[when]; + SyntaxKind.Keyword;[try]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[someMethod]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[catch]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[Exception]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[when]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_IncompleteTryCatchWhenNoBodies.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_IncompleteTryCatchWhenNoBodies.stree.txt index 1d47290523..807d4bf6b6 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_IncompleteTryCatchWhenNoBodies.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_IncompleteTryCatchWhenNoBodies.stree.txt @@ -1,25 +1,25 @@ Statement block - Gen - 51 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [try { someMethod(); } catch(Exception) when (true)] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:21 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[someMethod]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[catch]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[Exception]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[when]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[true]; - CSharpTokenType.RightParenthesis;[)]; + SyntaxKind.Keyword;[try]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[someMethod]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[catch]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[Exception]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[when]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[true]; + SyntaxKind.RightParenthesis;[)]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_IncompleteTryWhen.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_IncompleteTryWhen.stree.txt index 1d2521b0e0..de0038c43e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_IncompleteTryWhen.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_IncompleteTryWhen.stree.txt @@ -1,14 +1,14 @@ Statement block - Gen - 22 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [try { someMethod(); }] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:10 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[someMethod]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[try]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[someMethod]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_MultiLine.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_MultiLine.stree.txt index f814178b03..89b302ea0e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_MultiLine.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_MultiLine.stree.txt @@ -1,54 +1,54 @@ Statement block - Gen - 103 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [tryLF{LFA();LF}LFcatch(Exception) when (true)LF{LFB();LF}LFcatch(IOException) when (false)LF{LFC();LF}] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:50 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.Identifier;[A]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.Keyword;[catch]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[Exception]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[when]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[true]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.Identifier;[B]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.Keyword;[catch]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[IOException]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[when]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[false]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.Identifier;[C]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.NewLine;[LF]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[try]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Identifier;[A]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Keyword;[catch]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[Exception]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[when]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[true]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Identifier;[B]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Keyword;[catch]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[IOException]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[when]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[false]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.Identifier;[C]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.NewLine;[LF]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_NestedTryCatchWhen.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_NestedTryCatchWhen.stree.txt index c7aebf715c..f6d20f2485 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_NestedTryCatchWhen.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_NestedTryCatchWhen.stree.txt @@ -1,38 +1,38 @@ Statement block - Gen - 69 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; MetaCode span - Gen - [{] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:1 - CSharpTokenType.LeftBrace;[{]; + SyntaxKind.LeftBrace;[{]; Code span - Gen - [try { someMethod(); } catch(Exception) when (true) { handleIO(); }] - AutoCompleteEditHandler;Accepts:Any,AutoComplete:[];AtEOL - (2:0,2) - Tokens:30 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[someMethod]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[catch]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[Exception]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[when]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[true]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[handleIO]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[try]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[someMethod]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[catch]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[Exception]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[when]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[true]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[handleIO]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; MetaCode span - Gen - [}] - SpanEditHandler;Accepts:None - (68:0,68) - Tokens:1 - CSharpTokenType.RightBrace;[}]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_TryCatchWhenCatchWhenComplete_SingleLine.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_TryCatchWhenCatchWhenComplete_SingleLine.stree.txt index 9b61a41852..5f93680e4d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_TryCatchWhenCatchWhenComplete_SingleLine.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_TryCatchWhenCatchWhenComplete_SingleLine.stree.txt @@ -1,54 +1,54 @@ Statement block - Gen - 92 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [try { A(); } catch(Exception) when (true) { B(); } catch(IOException) when (false) { C(); }] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:50 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[A]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[catch]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[Exception]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[when]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[true]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[B]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[catch]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[IOException]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[when]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[false]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[C]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[try]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[A]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[catch]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[Exception]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[when]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[true]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[B]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[catch]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[IOException]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[when]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[false]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[C]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_TryCatchWhenComplete_SingleLine.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_TryCatchWhenComplete_SingleLine.stree.txt index d4abea3d20..c071433877 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_TryCatchWhenComplete_SingleLine.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_TryCatchWhenComplete_SingleLine.stree.txt @@ -1,34 +1,34 @@ Statement block - Gen - 67 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [try { someMethod(); } catch(Exception) when (true) { handleIO(); }] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:30 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[someMethod]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[catch]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[Exception]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[when]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[true]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[handleIO]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[try]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[someMethod]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[catch]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[Exception]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[when]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[true]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[handleIO]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_TryCatchWhenFinallyComplete_SingleLine.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_TryCatchWhenFinallyComplete_SingleLine.stree.txt index d2eb922ac6..0e28068099 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_TryCatchWhenFinallyComplete_SingleLine.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ExceptionFilter_TryCatchWhenFinallyComplete_SingleLine.stree.txt @@ -1,45 +1,45 @@ Statement block - Gen - 68 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [try { A(); } catch(Exception) when (true) { B(); } finally { C(); }] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:41 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[A]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[catch]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[Exception]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[when]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[true]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[B]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[finally]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[C]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[try]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[A]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[catch]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[Exception]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[when]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[true]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[B]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[finally]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[C]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/FinallyClause.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/FinallyClause.stree.txt index 0810f3848a..82427e5566 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/FinallyClause.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/FinallyClause.stree.txt @@ -1,25 +1,25 @@ Statement block - Gen - 38 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [try { foo(); } finally { Dispose(); }] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:21 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[finally]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Dispose]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[try]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[finally]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Dispose]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ForEachStatement.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ForEachStatement.stree.txt index 7d4a7b839e..df4a2559f1 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ForEachStatement.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ForEachStatement.stree.txt @@ -1,23 +1,23 @@ Statement block - Gen - 35 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [foreach(var foo in bar) { foo(); }] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:19 - CSharpTokenType.Keyword;[foreach]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[in]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[bar]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[foreach]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[in]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[bar]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ForStatement.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ForStatement.stree.txt index 073af76a08..7453adeb1c 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ForStatement.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/ForStatement.stree.txt @@ -1,34 +1,34 @@ Statement block - Gen - 43 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [for(int i = 0; i++; i < length) { foo(); }] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:30 - CSharpTokenType.Keyword;[for]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[int]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.IntegerLiteral;[0]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.Increment;[++]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[i]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LessThan;[<]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[length]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[for]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[int]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.IntegerLiteral;[0]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Increment;[++]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[i]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LessThan;[<]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[length]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/IfStatement.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/IfStatement.stree.txt index d01613f66d..6d99745895 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/IfStatement.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/IfStatement.stree.txt @@ -1,17 +1,17 @@ Statement block - Gen - 20 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [if(true) { foo(); }] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:13 - CSharpTokenType.Keyword;[if]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[true]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[if]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[true]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/LockStatement.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/LockStatement.stree.txt index 7a8dcd7965..eddbbb0fc7 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/LockStatement.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/LockStatement.stree.txt @@ -1,17 +1,17 @@ Statement block - Gen - 21 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [lock(baz) { foo(); }] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:13 - CSharpTokenType.Keyword;[lock]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[baz]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[lock]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[baz]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/NonBlockKeywordTreatedAsImplicitExpression.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/NonBlockKeywordTreatedAsImplicitExpression.cspans.txt index f18c5a7565..eb46914ed0 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/NonBlockKeywordTreatedAsImplicitExpression.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/NonBlockKeywordTreatedAsImplicitExpression.cspans.txt @@ -1,2 +1,2 @@ Transition span at (0:0,0 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [3] ) -Code span at (1:0,1 [2] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (0:0,0 [3] ) +Code span at (1:0,1 [2] ) (Accepts:NonWhitespace) - Parent: Expression block at (0:0,0 [3] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/NonBlockKeywordTreatedAsImplicitExpression.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/NonBlockKeywordTreatedAsImplicitExpression.stree.txt index 7b1d379e7d..7b91a6e366 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/NonBlockKeywordTreatedAsImplicitExpression.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/NonBlockKeywordTreatedAsImplicitExpression.stree.txt @@ -1,5 +1,5 @@ Expression block - Gen - 3 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; - Code span - Gen - [is] - ImplicitExpressionEditHandler;Accepts:NonWhiteSpace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 - CSharpTokenType.Keyword;[is]; + SyntaxKind.Transition;[@]; + Code span - Gen - [is] - ImplicitExpressionEditHandler;Accepts:NonWhitespace;ImplicitExpression[RTD];K14 - (1:0,1) - Tokens:1 + SyntaxKind.Keyword;[is]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_Complete_Spaced.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_Complete_Spaced.stree.txt index 6e6611d1d6..659aa732fa 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_Complete_Spaced.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_Complete_Spaced.stree.txt @@ -1,13 +1,13 @@ Directive block - Gen - 40 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [using static global::System.Console] - SpanEditHandler;Accepts:AnyExceptNewline - (1:0,1) - Tokens:9 - CSharpTokenType.Keyword;[using]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[static]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[global]; - CSharpTokenType.DoubleColon;[::]; - CSharpTokenType.Identifier;[System]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Console]; + SyntaxKind.Keyword;[using]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[static]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[global]; + SyntaxKind.DoubleColon;[::]; + SyntaxKind.Identifier;[System]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Console]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_GlobalPrefix.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_GlobalPrefix.stree.txt index 7211d38d71..ca4687394a 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_GlobalPrefix.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_GlobalPrefix.stree.txt @@ -1,13 +1,13 @@ Directive block - Gen - 36 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [using static global::System.Console] - SpanEditHandler;Accepts:AnyExceptNewline - (1:0,1) - Tokens:9 - CSharpTokenType.Keyword;[using]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[static]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[global]; - CSharpTokenType.DoubleColon;[::]; - CSharpTokenType.Identifier;[System]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Console]; + SyntaxKind.Keyword;[using]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[static]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[global]; + SyntaxKind.DoubleColon;[::]; + SyntaxKind.Identifier;[System]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Console]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_MultipleIdentifiers.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_MultipleIdentifiers.stree.txt index 54278101f9..fb3e4bc329 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_MultipleIdentifiers.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_MultipleIdentifiers.stree.txt @@ -1,11 +1,11 @@ Directive block - Gen - 28 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [using static System.Console] - SpanEditHandler;Accepts:AnyExceptNewline - (1:0,1) - Tokens:7 - CSharpTokenType.Keyword;[using]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[static]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[System]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Console]; + SyntaxKind.Keyword;[using]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[static]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[System]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Console]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_NoUsing.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_NoUsing.stree.txt index 7d6aaac205..8c7fe292aa 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_NoUsing.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_NoUsing.stree.txt @@ -1,7 +1,7 @@ Directive block - Gen - 13 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [using static] - SpanEditHandler;Accepts:AnyExceptNewline - (1:0,1) - Tokens:3 - CSharpTokenType.Keyword;[using]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[static]; + SyntaxKind.Keyword;[using]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[static]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_SingleIdentifier.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_SingleIdentifier.stree.txt index 226b90f7bd..d618dfba5d 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_SingleIdentifier.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/StaticUsing_SingleIdentifier.stree.txt @@ -1,9 +1,9 @@ Directive block - Gen - 20 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [using static System] - SpanEditHandler;Accepts:AnyExceptNewline - (1:0,1) - Tokens:5 - CSharpTokenType.Keyword;[using]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[static]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[System]; + SyntaxKind.Keyword;[using]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[static]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[System]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/SwitchStatement.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/SwitchStatement.stree.txt index dd5b38a925..74740937b0 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/SwitchStatement.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/SwitchStatement.stree.txt @@ -1,17 +1,17 @@ Statement block - Gen - 23 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [switch(foo) { foo(); }] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:13 - CSharpTokenType.Keyword;[switch]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[switch]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/TryStatement.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/TryStatement.stree.txt index bd13bb3059..96b61f4e11 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/TryStatement.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/TryStatement.stree.txt @@ -1,14 +1,14 @@ Statement block - Gen - 15 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [try { foo(); }] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:10 - CSharpTokenType.Keyword;[try]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[try]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/UsingNamespaceImport.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/UsingNamespaceImport.stree.txt index 4a9d2be68d..a99f6b2bc4 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/UsingNamespaceImport.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/UsingNamespaceImport.stree.txt @@ -1,13 +1,13 @@ Directive block - Gen - 41 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [using System.Text.Encoding.ASCIIEncoding] - SpanEditHandler;Accepts:AnyExceptNewline - (1:0,1) - Tokens:9 - CSharpTokenType.Keyword;[using]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[System]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Text]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Encoding]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[ASCIIEncoding]; + SyntaxKind.Keyword;[using]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[System]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Text]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Encoding]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[ASCIIEncoding]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/UsingStatement.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/UsingStatement.stree.txt index b8a04ea3e1..652d8c2a38 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/UsingStatement.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/UsingStatement.stree.txt @@ -1,29 +1,29 @@ Statement block - Gen - 42 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [using(var foo = new Foo()) { foo.Bar(); }] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:25 - CSharpTokenType.Keyword;[using]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Identifier;[var]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[new]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[Foo]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Bar]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[using]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Identifier;[var]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[new]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[Foo]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Bar]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/UsingTypeAlias.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/UsingTypeAlias.stree.txt index df25b12077..3940d00b6e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/UsingTypeAlias.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/UsingTypeAlias.stree.txt @@ -1,23 +1,23 @@ Directive block - Gen - 79 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen;> - [using StringDictionary = System.Collections.Generic.Dictionary] - SpanEditHandler;Accepts:AnyExceptNewline - (1:0,1) - Tokens:19 - CSharpTokenType.Keyword;[using]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[StringDictionary]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Assign;[=]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[System]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Collections]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Generic]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Dictionary]; - CSharpTokenType.LessThan;[<]; - CSharpTokenType.Keyword;[string]; - CSharpTokenType.Comma;[,]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Keyword;[string]; - CSharpTokenType.GreaterThan;[>]; + SyntaxKind.Keyword;[using]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[StringDictionary]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Assign;[=]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[System]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Collections]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Generic]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Dictionary]; + SyntaxKind.LessThan;[<]; + SyntaxKind.Keyword;[string]; + SyntaxKind.Comma;[,]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Keyword;[string]; + SyntaxKind.GreaterThan;[>]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/WhileStatement.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/WhileStatement.stree.txt index 5a2eb3d2e3..9c3cab8153 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/WhileStatement.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpStatementTest/WhileStatement.stree.txt @@ -1,17 +1,17 @@ Statement block - Gen - 23 - (0:0,0) Transition span - Gen - [@] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.Transition;[@]; + SyntaxKind.Transition;[@]; Code span - Gen - [while(true) { foo(); }] - SpanEditHandler;Accepts:None - (1:0,1) - Tokens:13 - CSharpTokenType.Keyword;[while]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.Keyword;[true]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.LeftBrace;[{]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.Identifier;[foo]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.RightParenthesis;[)]; - CSharpTokenType.Semicolon;[;]; - CSharpTokenType.WhiteSpace;[ ]; - CSharpTokenType.RightBrace;[}]; + SyntaxKind.Keyword;[while]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.Keyword;[true]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.LeftBrace;[{]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.Identifier;[foo]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.RightParenthesis;[)]; + SyntaxKind.Semicolon;[;]; + SyntaxKind.Whitespace;[ ]; + SyntaxKind.RightBrace;[}]; diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpTemplateTest/HandlesSimpleTemplateInExplicitExpressionParens.cspans.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpTemplateTest/HandlesSimpleTemplateInExplicitExpressionParens.cspans.txt index 0684f9302c..2406d696ff 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpTemplateTest/HandlesSimpleTemplateInExplicitExpressionParens.cspans.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpTemplateTest/HandlesSimpleTemplateInExplicitExpressionParens.cspans.txt @@ -4,7 +4,7 @@ Transition span at (17:0,17 [1] ) (Accepts:None) - Parent: Markup block at (17:0 Markup span at (18:0,18 [3] ) (Accepts:None) - Parent: Tag block at (18:0,18 [3] ) Markup span at (21:0,21 [5] ) (Accepts:Any) - Parent: Markup block at (17:0,17 [18] ) Transition span at (26:0,26 [1] ) (Accepts:None) - Parent: Expression block at (26:0,26 [5] ) -Code span at (27:0,27 [4] ) (Accepts:NonWhiteSpace) - Parent: Expression block at (26:0,26 [5] ) +Code span at (27:0,27 [4] ) (Accepts:NonWhitespace) - Parent: Expression block at (26:0,26 [5] ) Markup span at (31:0,31 [4] ) (Accepts:None) - Parent: Tag block at (31:0,31 [4] ) Code span at (35:0,35 [1] ) (Accepts:Any) - Parent: Expression block at (0:0,0 [37] ) MetaCode span at (36:0,36 [1] ) (Accepts:None) - Parent: Expression block at (0:0,0 [37] ) diff --git a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpTemplateTest/HandlesSimpleTemplateInExplicitExpressionParens.stree.txt b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpTemplateTest/HandlesSimpleTemplateInExplicitExpressionParens.stree.txt index bdcccbd8c2..497fa3ec8e 100644 --- a/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpTemplateTest/HandlesSimpleTemplateInExplicitExpressionParens.stree.txt +++ b/test/Microsoft.AspNetCore.Razor.Language.Test/TestFiles/ParserTests/CSharpTemplateTest/HandlesSimpleTemplateInExplicitExpressionParens.stree.txt @@ -1,39 +1,39 @@ Expression block - Gen - 37 - (0:0,0) MetaCode span - Gen - [(] - SpanEditHandler;Accepts:None - (0:0,0) - Tokens:1 - CSharpTokenType.LeftParenthesis;[(]; + SyntaxKind.LeftParenthesis;[(]; Code span - Gen - [Html.Repeat(10, ] - SpanEditHandler;Accepts:Any - (1:0,1) - Tokens:7 - CSharpTokenType.Identifier;[Html]; - CSharpTokenType.Dot;[.]; - CSharpTokenType.Identifier;[Repeat]; - CSharpTokenType.LeftParenthesis;[(]; - CSharpTokenType.IntegerLiteral;[10]; - CSharpTokenType.Comma;[,]; - CSharpTokenType.WhiteSpace;[ ]; + SyntaxKind.Identifier;[Html]; + SyntaxKind.Dot;[.]; + SyntaxKind.Identifier;[Repeat]; + SyntaxKind.LeftParenthesis;[(]; + SyntaxKind.IntegerLiteral;[10]; + SyntaxKind.Comma;[,]; + SyntaxKind.Whitespace;[ ]; Template block - Gen